<?

$a = array();
$b = array();
//$fp = fopen('input.txt', 'r');
fscanf(STDIN, "%d %d\n", $n, $k);
$a = explode(' ', fgets(STDIN));
$b = explode(' ', fgets(STDIN));

$l = 0; $r = PHP_INT_MAX;
for($i = 0; $i < 50; $i++){
    $m = ($l + $r)/2;
    $m = intval($m);
    if(can($m)){
        $l = $m;
    }else{
        $r = $m;
    }
}

echo $l;

function can($x){
    $need = 0;
    global $n, $a, $b, $k;
    for($i = 0; $i < $n; $i++){
        $need += max(0, $a[$i]*1*$x - $b[$i]);
        if($need > $k) return false;
    }

    return $need <= $k;
}

<?

new Planning();

class Planning{

    private $n;
    private $k;
    private $a = array();
    private $b = array();
    private $inputFilename = '';

    public function __construct($inputFilename = 'input.txt')
    {
        $this->inputFilename = $inputFilename;
        $this->readData();
        echo $this->findSolution();
    }

    public function readData()
    {
        //$fp = fopen($this->inputFilename, 'r');
        fscanf(STDIN, "%d %d\n", $this->n, $this->k);
        $this->a = explode(' ', fgets(STDIN));
        $this->b = explode(' ', fgets(STDIN));
    }

    private function findSolution()
    {
        $l = 0; $r = 1E+15;

        for($i = 0; $i < 50; $i++){
            $m = ($l + $r)/2;
            $m = (int)$m;
            if($this->can($m)){
                $l = $m;
            }else{
                $r = $m;
            }
        }

        return $l;
    }

    private function can($x)
    {
        $need = 0;
        for($i = 0; $i < $this->n; $i++){
            $need += max(0, $this->a[$i]*1*$x - $this->b[$i]);
            if($need > $this->k) return false;
        }

        return $need <= $this->k;
    }

}

<?

$a = array();
$b = array();
//$fp = fopen('input.txt', 'r');
fscanf(STDIN, "%d %d\n", $n, $k);
$a = explode(' ', fgets(STDIN));
$b = explode(' ', fgets(STDIN));

$l = 0; $r = 10000000000;
for($i = 0; $i < 50; $i++){
    $m = (int)($l + $r)/2;
    if(can($m)){
        $l = $m;
    }else{
        $r = $m;
    }
}

echo $l;

function can($x){
    $need = 0;
    global $n, $a, $b, $k;
    for($i = 0; $i < $n; $i++){
        $need += max(0, $a[$i]*1*$x - $b[$i]);
        if($need > $k) return false;
    }

    return $need <= $k;
}


$str = trim(fgets(STDIN));
        //$str = "MFMFM";
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
      while(preg_match("/$needle/i", $str)){
            $seconds++;
            $str = str_replace($needle, $replace, $str);
        }
        print $seconds;

$str = trim(fgets(STDIN));
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
        $hasRotations = TRUE;
        while($hasRotations){
            $hasRotations = FALSE;
            for($i=0;$i<strlen($str)-1;$i++){
               if(strcmp($str[$i].$str[$i+1], $needle) == 0){
                   $str = str_replace($needle, $replace, $str);
                   $seconds++;
                   $hasRotations = TRUE;
               }
            }
        }

        $str = trim(fgets(STDIN));
        //$str = "FFMMM";
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
        $hasRotations = TRUE;
        while($hasRotations){
            $hasRotations = FALSE;
            for($i=0;$i<strlen($str)-1;$i++){
               if(strcmp($str[$i].$str[$i+1], $needle) == 0){
                   $str = str_replace($needle, $replace, $str);
                   $seconds++;
                   $hasRotations = TRUE;
               }
            }
        }
        /*while(preg_match("/$needle/i", $str)){
            $seconds++;
            $str = str_replace($needle, $replace, $str);
        }*/
        print $seconds;

<?
$str = trim(fgets(STDIN));

$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
	if ($str[$i] == "F") {
		$t = (($i - $fcount) > t) ? $i - $fcount : $t+1;
		$fcount++;
	}
}

print $t;

<?
$str = trim(fgets(STDIN));
//$str = "MMFF";
$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
    if ($str[$i] == "F") {
        $ti = $i - $fcount;
        $t = ($ti > $t) ? $ti : $t+1;
        $fcount++;
    }
}

print $t;

<?
$str = trim(fgets(STDIN));
        //$str = "MFMFM";
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
      	while(strripos($str, $needle)) {
            $seconds++;
            $str = str_replace($needle, $replace, $str);
        }
        print $seconds;

<?
$str = trim(fgets(STDIN));
        //$str = "MFMFM";
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
      	while(stripos($str, $needle)) {
            $seconds++;
            $str = str_replace($needle, $replace, $str);
        }
        print $seconds;

<?
$str = trim(fgets(STDIN));

$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i; $i >= $len; $i++) {
    if ($str[$i] == "F") {
        $t = (($i - $fcount) > t) ? $i - $fcount : $t++;
        $fcount++;
    }
}

print $t;

<?
$str = trim(fgets(STDIN));

$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
	if ($str[$i] == "F") {
		$t = (($i - $fcount) > t) ? $i - $fcount : $t++;
		$fcount++;
	}
}

print $t;

<?
$str = trim(fgets(STDIN));
        //$str = "MFMFM";
        $needle = "MF";
        $replace = "FM";
        $seconds = 0;
      	while(strpos($str, $needle)) {
            $seconds++;
            $str = str_replace($needle, $replace, $str);
        }
        print $seconds;

<?
$str = trim(fgets(STDIN));

$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i = 0; $i >= $len; $i++) {
	if ($str[$i] == "F") {
		$t = (($i - $fcount) > t) ? $i - $fcount : $t++;
		$fcount++;
	}
}

print $t;

<?
$str = trim(fgets(STDIN));

$t = 0;

$fcount = 0;

$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
    if ($str[$i] == "F") {
        $t = (($i - $fcount) > $t) ? $i - $fcount : $t++;
        $fcount++;
    }
}

print $t;


<?php

	function gcd ($a, $b) {
		return $b ? gcd ($b, $a % $b) : $a;
	}

	$t = trim(fgets(STDIN));

	$ans = '';
	for ($o = 0; $o < $t; $o++) {
		$x = trim(fgets(STDIN));
		$ans .= "1 ".($x-1)."\n";
	}

	print $ans;

?>

<?php
$a = trim(fgets(STDIN));
for($i = 1; $i <= $a; $i++)
{
	$x=trim(fgets(STDIN));
	print "1 ".($x-1). "\n";
}

<?php
$server = "php://stdin";
$handle = fopen($server, "r");
$t= trim(fgets($handle));
for($k=0;$k<$t;$k++)
{
    $n= trim(fgets($handle));
    echo '1'." ".($n-1)."\n";

}


<?php
$str1=trim(fgets(STDIN));
$str2=trim(fgets(STDIN));
$str3=trim(fgets(STDIN));
$str4=strtoupper($str2);
for ($i=0; $i <strlen($str3) ; $i++)
 {
 	if(ord($str3[$i])>=48 && ord($str3[$i])<=57)
 		echo "$str3[$i]";
   else if(ord($str3[$i])>=65&&ord($str3[$i])<=90)
   {
			for ($j=0; $j <strlen($str1) ; $j++)
		     {
		       if(strtolower($str3[$i])==$str1[$j])
		       	   echo "$str4[$j]";

		     }
   }
   else {
   				for ($j=0; $j <strlen($str1) ; $j++)
		     {
		       if(strtolower($str3[$i])==$str1[$j])
		       	   echo "$str2[$j]";

		     }
   }

}

<?php
$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
$c=trim(fgets(STDIN));
$d='';
$n=strlen($c);
for ($i=0;$i<$n;$i++){
    if (is_numeric($c[$i])){
        $d=$d.$c[$i];
    }
    else if(ord($c[$i])<97){
        $d=$d.strtoupper($b[strpos($a,strtolower($c[$i]))]);
    }
    else{
        $d=$d.$b[strpos($a,$c[$i])];
    }
}
echo $d;
?>

<?php
// $stdin = fopen('php://stdin', 'r');
$keyboard_wrong = str_split(fgets(STDIN));
$keyboard_correct = str_split(fgets(STDIN));
$problem_string = str_split(fgets(STDIN));

$pattern = [];
foreach (array_fill(0, 10, null) as $number => $crap) {
	$pattern["$number"] = "$number";
}
foreach ($keyboard_wrong as $index => $character) {
	$pattern[$keyboard_wrong[$index]] = $keyboard_correct[$index];
	$pattern[strtoupper($keyboard_wrong[$index])] = strtoupper($keyboard_correct[$index]);
}

$output = "";
foreach ($problem_string as $index => $character) {
	$output .= $pattern[$character];
}
// echo $output;
fwrite(STDOUT, $output);

<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
$c = trim(fgets(STDIN));
$d = "";
for($x = 0; $x < strlen($c); $x++)
{
     if(is_numeric($c[$x]) == TRUE)
     {
          $d .= $c[$x];
     }
     else
     {
          if(ctype_upper($c[$x]) == TRUE)
          {
               $e = strtolower($c[$x]);
               for($y = 0; $y < strlen($a); $y++)
               {
                    if($a[$y] == $e)
                    {
                         break;
                    }
               }
               $f = strtoupper($b[$y]);
               $d .= $f;
          }
          else
          {
               $e = $c[$x];
               for($y = 0; $y < strlen($a); $y++)
               {
                    if($a[$y] == $e)
                    {
                         break;
                    }
               }
               $d .= $b[$y];
          }
     }
}
print $d;
?>

<?php

$fh = fopen('php://stdin', 'r');

while ($s = fgets($fh, 1024))
  $alph_src[] = $s;

for ($i = 0; $i < strlen($alph_src[0]); $i++)
{
  $alph[$alph_src[0][$i]] = $alph_src[1][$i];
  $alph[strtoupper($alph_src[0][$i])] = strtoupper($alph_src[1][$i]);
}

for ($i = 0; $i < strlen($alph_src[2]); $i++)
{
  if (is_numeric($alph_src[2][$i]))
    $res[$i] = $alph_src[2][$i];
  else
    $res[$i] = $alph[$alph_src[2][$i]];
}

echo implode('', $res);

<?php
// $stdin = fopen('php://stdin', 'r');
$keyboard_wrong = str_split(fgets(STDIN));
$keyboard_correct = str_split(fgets(STDIN));
$problem_string = str_split(fgets(STDIN));

$pattern = [];
foreach (array_fill(1, 10, null) as $number => $crap) {
	$pattern["$number"] = "$number";
}
foreach ($keyboard_wrong as $index => $character) {
	$pattern[$keyboard_wrong[$index]] = $keyboard_correct[$index];
	$pattern[strtoupper($keyboard_wrong[$index])] = strtoupper($keyboard_correct[$index]);
}

$output = "";
foreach ($problem_string as $index => $character) {
	$output .= $pattern[$character];
}
// echo $output;
fwrite(STDOUT, $output);


<?php
	list($n,$m) = explode(' ',trim(fgets(STDIN)));
	class WantSome {
		public $lw;
		public $l;
		public $r;
		public $rw;
		public $lwc = false;
		public $lc = false;
		public $rc = false;
		public $rwc = false;
	}
	$a = array();
	$p = 1;
	for ($i = 0; $i < $n; $i++) array_push($a,new WantSome);
	for ($i = 0; $i < $n && $m > 0; $i++) {
		$a[$i]->lw = $p;
		$p++;
		$m--;
		$a[$i]->lwc = true;
		if ($m > 0) {
			$a[$i]->rw = $p;
			$p++;
			$m--;
			$a[$i]->rwc = true;
		}
	}
	for ($i = 0; $i < $n && $m > 0; $i++) {
		$a[$i]->l = $p;
		$p++;
		$m--;
		$a[$i]->lc = true;
		if ($m > 0) {
			$a[$i]->r = $p;
			$p++;
			$m--;
			$a[$i]->rc = true;
		}
	}
	for ($i = 0; $i < $n; $i++) {
		if ($a[$i]->lc) {
			echo $a[$i]->l;
			echo ' ';
		}
		if ($a[$i]->lwc) {
			echo $a[$i]->lw;
			echo ' ';
		}
		if ($a[$i]->rc) {
			echo $a[$i]->r;
			echo ' ';
		}
		if ($a[$i]->rwc) {
			echo $a[$i]->rw;
			echo ' ';
		}
	}
?>

<?php
$dir = fopen("php://stdin", 'r');
$data = stream_get_contents($dir);
$parsed = explode(' ', $data);
$n = (int)$parsed[0];
$m = (int)$parsed[1];
$final = $m;
$resultArray = [];
for ($i = 0; $i < $final; $i++) {
    $row = floor($i/4);
    $column = $i%4;
    $result = null;
    switch ($column) {
        case 0:
            $result = 1 + 2*$n + $row * 2;
            break;
        case 1:
            $result = 1 + $row * 2; break;
        case 2:
            $result = 2 + 2*$n + $row * 2; break;
        case 3:
            $result = 2 + $row * 2; break;
    }
    if ($result > $m) {
        $result = null;
        $final++;
    }

    if ($result !== null) {
        $resultArray[] = $result;
    }
}
echo implode($resultArray, ' ');
?>

<?php
$dir = fopen("php://stdin", 'r');
$data = stream_get_contents($dir);
$parsed = explode(' ', $data);
$n = $parsed[0];
$m = $parsed[1];
$final = $m;
$resultArray = [];
for ($i = 0; $i < $final; $i++) {
    $row = floor($i/4);
    $column = $i%4;
    $result = null;
    switch ($column) {
        case 0:
            $result = 1 + 2*$n + $row * 2;
            break;
        case 1:
            $result = 1 + $row * 2; break;
        case 2:
            $result = 2 + 2*$n + $row * 2; break;
        case 3:
            $result = 2 + $row * 2; break;
    }
    if ($result > $m) {
        $result = null;
        $final++;
    }
    if ($result !== null) {
        $resultArray[] = $result;
    }
}
echo implode($resultArray, ' ');
?>

<?php
$dir = fopen("php://stdin", 'r');
$data = stream_get_contents($dir);
$parsed = explode(' ', $data);
$n = $parsed[0];
$m = $parsed[1];
$final = $m;
$resultArray = [];
for ($i = 0; $i < $final; $i++) {
    $row = floor($i/4);
    $column = $i%4;
    $result = null;
    switch ($column) {
        case 0:
            $result = 1 + 2*$n + $row * 2;
            break;
        case 1:
            $result = 1 + $row * 2; break;
        case 2:
            $result = 2 + 2*$n + $row * 2; break;
        case 3:
            $result = 2 + $row * 2; break;
    }
    if ($result > $m) {
        $result = null;
        $final++;
    }

    if ($result !== null) {
        $resultArray[] = $result;
    }
}
var_dump($resultArray);
echo implode($resultArray, ' ');
?>

<?php
$dir = fopen("php://stdin", 'r');
$data = stream_get_contents($dir);
$parsed = explode(' ', $data);
$n = $parsed[0];
$m = $parsed[1];
$final = $m;
$resultArray = [];
var_dump($n, $m);
for ($i = 0; $i < $final; $i++) {
    $row = floor($i/4);
    $column = $i%4;
    $result = null;
    switch ($column) {
        case 0:
            $result = 1 + 2*$n + $row * 2;
            break;
        case 1:
            $result = 1 + $row * 2; break;
        case 2:
            $result = 2 + 2*$n + $row * 2; break;
        case 3:
            $result = 2 + $row * 2; break;
    }
    if ($result > $m) {
        $result = null;
        $final++;
    }

    if ($result !== null) {
        $resultArray[] = $result;
    }
}
echo implode($resultArray, ' ');
?>


<?php

$fh = fopen('php://stdin','r');
$numberOfTests = fgets($fh);

for ($testNr=0;$testNr<$numberOfTests;$testNr++){
    $input = rtrim(fgets($fh)," \t\n\r\0\x0B");
    $keyPosition = 0;
    $keyboard = array();
    $fail = 0;
    $alphabet="abcdefghijklmnopqrstuvwxyz";
    $keyboard[$keyPosition] = $input[0];
    $alphabet = preg_replace("/".$input[0]."/", "", $alphabet);

    for ($i = 1; $i < strlen($input); $i++){
        $char = $input[$i];
        if (strpos($alphabet,$char) === FALSE){
            if (array_key_exists($keyPosition-1,$keyboard) && $keyboard[$keyPosition-1]==$char){
                $keyPosition -= 1;
            }
            else if (array_key_exists($keyPosition+1,$keyboard) && $keyboard[$keyPosition+1]==$char){
                $keyPosition += 1;
            }
            else{
                $fail = 1;
                break;
            }
        }
        else{
            if (array_key_exists($keyPosition-1,$keyboard)){
                if (array_key_exists($keyPosition+1,$keyboard)){
                    $fail = 1;
                    break;
                }
                else{
                    $keyPosition += 1;
                }
            }
            else{
                $keyPosition -= 1;
            }
        }
        $alphabet = preg_replace("/".$char."/", "", $alphabet);
        $keyboard[$keyPosition] = $char;
        //print $keyPosition . " has " . $char . " and " . $keyboard[$keyPosition];
    }

    if ($fail){
        print "NO";
    }
    else{
        print "YES";
        print "\n";
        ksort($keyboard);
        foreach ($keyboard as $key){
            print $key;
        }
        print $alphabet;
    }
    print "\n";
}
?>

<?php

$fh = fopen('php://stdin','r');
$numberOfTests = fgets($fh);

for ($testNr=0;$testNr<$numberOfTests;$testNr++){
    $input = rtrim(fgets($fh)," \t\n\r\0\x0B");
    $keyPosition = 0;
    $keyboard = array();
    $fail = 0;
    $alphabet="abcdefghijklmnopqrstuvwxyz";
    $keyboard[$keyPosition] = $input[0];
    $alphabet = preg_replace("/".$input[0]."/", "", $alphabet);

    for ($i = 1; $i < strlen($input); $i++){
        $char = $input[$i];
        if (strpos($alphabet,$char) === FALSE){
            if (array_key_exists($keyPosition-1,$keyboard) && $keyboard[$keyPosition-1]==$char){
                $keyPosition -= 1;
            }
            else if (array_key_exists($keyPosition+1,$keyboard) && $keyboard[$keyPosition+1]==$char){
                $keyPosition += 1;
            }
            else{
                $fail = 1;
                break;
            }
        }
        else{
            if (array_key_exists($keyPosition-1)){
                if (array_key_exists($keyPosition+1)){
                    $fail = 1;
                    break;
                }
                else{
                    $keyPosition += 1;
                }
            }
            else{

                $keyPosition -= 1;
            }
        }
        $alphabet = preg_replace("/".$char."/", "", $alphabet);
        $keyboard[$keyPosition] = $char;
    }

    if ($fail){
        print "NO";
    }
    else{
        print "YES";
        print "\n";
        ksort($keyboard);
        foreach ($keyboard as $key){
            print $key;
        }
        print $alphabet;
    }
    print "\n";
}
?>

<?php

$fh = fopen('php://stdin','r') or die($php_errormsg);
$numberOfTests = fgets($fh);

for ($testNr=0;$testNr<$numberOfTests;$testNr++){

$input = fgets($fh);
$index = 30;
$keyboard = array();
$keyboard[$index] = $input[0];
$fail = 0;
$alphabet="abcdefghijklmnopqrstuvwxyz";

for ($i = 1; $i < strlen($input); $i++){
  if ($keyboard[$index]==$input[$i]){
  }
  else if (array_key_exists($index-1,$keyboard) && $keyboard[$index-1]==$input[$i]){
      $index -= 1;
  }
  else if (array_key_exists($index+1,$keyboard) && $keyboard[$index+1]==$input[$i]){
      $index += 1;
  }
  else if (array_key_exists($index+1,$keyboard)){
      if (array_key_exists($index-1,$keyboard)){
          $fail = 1;
          break;
      }
      else{
          $index -= 1;
      }
  }
  else{
      $index += 1;
  }
  $alphabet = preg_replace("/".$input[$i]."/", "", $alphabet);
  $keyboard[$index] = $input[$i];

if ($fail){
    print "NO";
}
else{
    print "YES";
    print "\n";
    ksort($keyboard);
    foreach ($keyboard as $key){
        print $key;
    }
    print $alphabet;
}
}
}
?>


<?php

$s = trim(fgets(STDIN));

$s = str_replace([',', ';'], ',', $s);
$words = explode(',', $s);

$a = [];
$b = [];

foreach ($words as $word) {
	if (is_numeric($word) && strpos($word, '.') === false && (strlen($word) == 1 || $word[0] != '0')) {
		$a[] = $word;
	} else {
		$b[] = $word;
	}
}

if (count($a)) {
	echo "\"" . implode(',', $a) . "\"\n";
} else {
	echo "-\n";
}

if (count($b)) {
	echo "\"" . implode(',', $b) . "\"\n";
} else {
	echo "-\n";
}

<?php
fscanf(STDIN, "%s", $str);
foreach(explode(',', strtr($str, ";.", ",,")) as $e) $arr[strval(intval($e)) === $e && $e >= 0][] = $e;
fprintf(STDOUT, '"%s"\n"%s"', implode("," ,$arr[1]), implode("," ,$arr[0]));
?>

<?php

$s = trim(fgets(STDIN));

$s = str_replace([',', ';'], ',', $s);
$words = explode(',', $s);

$a = [];
$b = [];

foreach ($words as $word) {
	if (is_numeric($word) && floatval($word) == intval($word) && (strlen($word) == 1 || $word[0] != '0')) {
		$a[] = $word;
	} else {
		$b[] = $word;
	}
}

if (count($a)) {
	echo "\"" . implode(',', $a) . "\"\n";
} else {
	echo "-\n";
}

if (count($b)) {
	echo "\"" . implode(',', $b) . "\"\n";
} else {
	echo "-\n";
}

<?php

$s = trim(fgets(STDIN));

$s = str_replace([',', ';'], ',', $s);
$words = explode(',', $s);

$a = [];
$b = [];

foreach ($words as $word) {
	if (is_numeric($word) && is_int(intval($word)) && (strlen($word) == 1 || $word[0] != '0')) {
		$a[] = $word;
	} else {
		$b[] = $word;
	}
}

if (count($a)) {
	echo "\"" . implode(',', $a) . "\"\n";
} else {
	echo "-\n";
}

if (count($b)) {
	echo "\"" . implode(',', $b) . "\"\n";
} else {
	echo "-\n";
}


<?php
    define("MAXN", 1024) ;
    define("GAP_VAL", 1e-7) ;

    function gap($n)
    {
        return $n < GAP_VAL ;
    }

    $t = intval(trim(fgets(STDIN))) ;
    while($t --)
    {
        $n = intval(trim(fgets(STDIN))) ;

        if($n == 1) echo "-1\n" ;
        else echo str_repeat("5", $n - 1) . "4\n" ;
    }
?>


<?php
$no = 'NO';
$yes = 'YES';
$mod = 1000000007;
$alph = 'abcdefghijklmnopqrstuvwxyz';
$inter = "\n";

  $t = getT();
//   $point = ord('a') + ord('b') ;

  for($q=0; $q <$t; $q++) {
      $ans = false;
      list($n, $m) = getA();
      $a =[];
      $b = [];
      $c = [];
      $tt = 0;
      $cc = 0;
      for($i=0; $i<$n; $i++) {
          $a[] = getT();

          for($j=0; $j<$m; $j++) {
              if($a[$i][$j] == 'R') {
                  $b[] = $j;
                  $tt++;
                  break;
              }
          }
      }
          $ans = true;
          $dd = 0;
          $ans = $b[0] == min($b) ? true : false;
        //   if($tt > 1) {
        //       for($i=0; $i<$tt-1; $i++) {
        //           if($b[$i] > $b[$i + 1]) {

        //               $ans = false;
        //               break;
        //           }
        //       }
        //   }
        //   if(!$ans && $b[0] == min($b)) {
        //      $ans  = true;
        //   }

          pr($ans ? $yes : $no);

  }
// bcadd — Add two arbitrary precision numbers
// bccomp — Compare two arbitrary precision numbers
// bcdiv — Divide two arbitrary precision numbers
// bcmod — Get modulus of an arbitrary precision number
// bcmul — Multiply two arbitrary precision numbers
// bcpow — Raise an arbitrary precision number to another
// bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
// bcscale — Set or get default scale parameter for all bc math functions
// bcsqrt — Get the square root of an arbitrary precision number
// bcsub — Subtract one arbitrary precision number from another
function getDar($n) {
    $dar = [2];
    for($i=0; $i<$n; $i++) {
        $dar[] = $dar[$i] * 2;
    }
    return $dar;
}
function getDar2($n, $k) {
    if($k == 0) {
        return 1;
    }
    return bcmul($n, getDar2($n, $k-1));
}

  function getT() {
      return trim(fgets(STDIN));
  }
  function getA() {
      return explode(' ', trim(fgets(STDIN)));
  }

  function is_prime($n) {
    $d = 2;
        while ($n % $d != 0) {
        	 $d += 1;
        }

        return $d == $n;
    }
function getMinValue($x, $y) {
        return $x > $y ? $y : $x;
    }
    function getMaxValue($x, $y) {
        return $x > $y ? $x : $y;
    }

    function getMaxValueBc($x, $y) {
        return bccomp($x, $y) == 1 ? $x : $y;
    }
    function getRotate($a, $s, $e, $ind) {
 		$ar = [];
        for ($i= $s; $i<=$e; $i++) {
        	$ar[$i] = $a[$i];
        	$j = $i + $ind > $e ? $i + $ind - $e - 1 : $i + $ind;
        	// echo $i, ' ', $j, ' ', $j < $i ? $ar[$j] : $a[$j] , "\n";
        	$a[$i] = $j < $i ? $ar[$j] : $a[$j];
        }
        return $a;
    }
    function pr($s) {
        if(is_array($s)) {
            echo implode( ' ', $s), PHP_EOL;
        } else {
            echo $s, PHP_EOL;
        }
    }
    function fab2($n, $a) {
        if($n <= 1) {
            return $a[$n];
        }
       for($i=2; $i<=$n; $i++) {
           $a[$i] = $a[$i-1] + $a[$i-2];
       }

        return $a[$n];
    }

    function mergeSort($aArray) {
    if(count($aArray) <= 1) {
        return $aArray;
    }
    $aLeft = [];
    $aRight = [];
    $n =floor(count($aArray) / 2);
    for($i = 0; $i <$n; $i++) {
       $aLeft[] = $aArray[$i];
    }
    for($i = $n; $i <count($aArray); $i++) {
       $aRight[] = $aArray[$i];
    }

    return merge(mergeSort($aLeft), mergeSort($aRight));
}

function merge($aLeft, $aRight) {
    $aResult = [];
    $iL = 0;
    $iR = 0;

    while($iL < count($aLeft) && $iR < count($aRight)) {
        if($aLeft[$iL] >= $aRight[$iR]) {
            $aResult[] = $aLeft[$iL];
            $iL++;
        } else {
            $aResult[] = $aRight[$iR];
            $iR++;
        }
    }

    while($iL < count($aLeft)) {
        $aResult[] = $aLeft[$iL];
        $iL++;
    }
    while($iR < count($aRight)) {
        $aResult[] = $aRight[$iR];
        $iR++;
    }

    return $aResult;

}

<?php
fscanf(STDIN, "%d", $t);
while ($t--) {
    $arr = [];
    $flag = true;
    fscanf(STDIN, "%d %d", $n, $m);
    for ($y = 0; $y < $n; $y++) {
        for ($s = trim(fgets(STDIN)), $x = 0; $x < $m; $x++) {
            if ('R' == $s[$x]) {
                $arr[] = str_replace('E', ' ', $s);
                break;
            }
        }
    }
    while ('R' != $arr[0][0]) {
        if (isset(array_column(array_map('str_split', $arr), 0, 0)['R'])) {
            $flag = false;
            break;
        }
        $arr = array_map('ltrim', $arr);
    }
    echo ['NO', 'YES'][$flag], "\n";
}

<?php
$no = 'NO';
$yes = 'YES';
$mod = 1000000007;
$alph = 'abcdefghijklmnopqrstuvwxyz';
$inter = "\n";

  $t = getT();
//   $point = ord('a') + ord('b') ;

  for($q=0; $q <$t; $q++) {
      $ans = false;
      list($n, $m) = getA();
      $a =[];
      $b = [];
      $tt = 0;
      for($i=0; $i<$n; $i++) {
          $a[] = getT();

          for($j=0; $j<$m; $j++) {
              if($a[$i][$j] == 'R') {
                  $b[] = $j+1;
                  $tt++;
                  break;
              }
          }
      }
      if($b[0] == 'R') {
          $ans = true;
      } else {
          $ans = true;
          if($tt > 1) {
              for($i=0; $i<$tt-1; $i++) {
                  if($b[$i] > $b[$i + 1]) {
                      $ans = false;
                      break;
                  }
              }
          }

      }

          pr($ans ? $yes : $no);

  }
// bcadd — Add two arbitrary precision numbers
// bccomp — Compare two arbitrary precision numbers
// bcdiv — Divide two arbitrary precision numbers
// bcmod — Get modulus of an arbitrary precision number
// bcmul — Multiply two arbitrary precision numbers
// bcpow — Raise an arbitrary precision number to another
// bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
// bcscale — Set or get default scale parameter for all bc math functions
// bcsqrt — Get the square root of an arbitrary precision number
// bcsub — Subtract one arbitrary precision number from another
function getDar($n) {
    $dar = [2];
    for($i=0; $i<$n; $i++) {
        $dar[] = $dar[$i] * 2;
    }
    return $dar;
}
function getDar2($n, $k) {
    if($k == 0) {
        return 1;
    }
    return bcmul($n, getDar2($n, $k-1));
}

  function getT() {
      return trim(fgets(STDIN));
  }
  function getA() {
      return explode(' ', trim(fgets(STDIN)));
  }

  function is_prime($n) {
    $d = 2;
        while ($n % $d != 0) {
        	 $d += 1;
        }

        return $d == $n;
    }
function getMinValue($x, $y) {
        return $x > $y ? $y : $x;
    }
    function getMaxValue($x, $y) {
        return $x > $y ? $x : $y;
    }

    function getMaxValueBc($x, $y) {
        return bccomp($x, $y) == 1 ? $x : $y;
    }
    function getRotate($a, $s, $e, $ind) {
 		$ar = [];
        for ($i= $s; $i<=$e; $i++) {
        	$ar[$i] = $a[$i];
        	$j = $i + $ind > $e ? $i + $ind - $e - 1 : $i + $ind;
        	// echo $i, ' ', $j, ' ', $j < $i ? $ar[$j] : $a[$j] , "\n";
        	$a[$i] = $j < $i ? $ar[$j] : $a[$j];
        }
        return $a;
    }
    function pr($s) {
        if(is_array($s)) {
            echo implode( ' ', $s), PHP_EOL;
        } else {
            echo $s, PHP_EOL;
        }
    }
    function fab2($n, $a) {
        if($n <= 1) {
            return $a[$n];
        }
       for($i=2; $i<=$n; $i++) {
           $a[$i] = $a[$i-1] + $a[$i-2];
       }

        return $a[$n];
    }

    function mergeSort($aArray) {
    if(count($aArray) <= 1) {
        return $aArray;
    }
    $aLeft = [];
    $aRight = [];
    $n =floor(count($aArray) / 2);
    for($i = 0; $i <$n; $i++) {
       $aLeft[] = $aArray[$i];
    }
    for($i = $n; $i <count($aArray); $i++) {
       $aRight[] = $aArray[$i];
    }

    return merge(mergeSort($aLeft), mergeSort($aRight));
}

function merge($aLeft, $aRight) {
    $aResult = [];
    $iL = 0;
    $iR = 0;

    while($iL < count($aLeft) && $iR < count($aRight)) {
        if($aLeft[$iL] >= $aRight[$iR]) {
            $aResult[] = $aLeft[$iL];
            $iL++;
        } else {
            $aResult[] = $aRight[$iR];
            $iR++;
        }
    }

    while($iL < count($aLeft)) {
        $aResult[] = $aLeft[$iL];
        $iL++;
    }
    while($iR < count($aRight)) {
        $aResult[] = $aRight[$iR];
        $iR++;
    }

    return $aResult;

}


<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;$odd=0;$enev=0;
    for ($i=0;$i<$n;$i++)
    {
        if($a[$i]%2!=0)
            $odd++;
        else
            $enev++;
        $sum=$sum+$a[$i];
    }

    if(($sum)%2!=0)
        echo "YES"."\n";
    else if($enev>=1 && $odd>=1)
        echo 'YES'."\n";
    else
        echo "NO"."\n";

}

?>

<?

$n = intval(fgets(STDIN));
for ($i = 0; $i < $n; $i++) {
    $t = intval(fgets(STDIN));
    $numbers = array_map('intval', explode(" ", fgets(STDIN)));
    $even = 0;
    $odd = 0;
    foreach($numbers as $val) {
        if($val % 2 == 0) $even++;
        else $odd++;
    }
    if($odd !== 0 && ($odd !== $t || $t % 2 == 1)) echo "YES\n";
    else echo "NO\n";
}
?>

<?php

    $input = file_get_contents("php://stdin");

    function doo ($input) {

        $t = (int)explode("\n",$input)[0];

        for($i = 0;$i < $t;$i++) {

            $n = explode("\n",$input)[($i * 2) + 1];

            $arr = explode(" ",explode("\n",$input)[($i * 2) + 2]);

            $even = 0;
            $odd = 0;

            //Loop Inside This Array.
            for($q = 0;$q < $n;$q++) {

                //Check If They're All Even.
                if($arr[$q] % 2 == 0) {

                    $even++;

                }else {

                    $odd++;

                }

            }

            if($even == $n) {

                echo "NO\n";
                continue;

            }elseif($odd == $n) {

                //Check If Their Sum Is Even.
                if(array_sum($arr) % 2 == 0) {

                    echo "NO\n";
                    continue;

                }else {

                    echo "YES\n";
                    continue;

                }

            }

            echo "YES\n";

        }

    }

    doo($input);

<?php

namespace io {
	$input_file_content = file_get_contents("php://stdin");
	$input_buf = explode("\r\n", $input_file_content);
	unset($input_file_content);
}

namespace main {
	error_reporting(E_ALL);
	ini_set('display_errors', true);
	ini_set('html_errors', false);

	use function io\next_line as next_line;
	use function io\next_ as next;
	use function io\next_int as next_int;
	use function io\next_double as next_double;

	$tc = next_int();
	for($cc=0; $cc<$tc; $cc++) {
		$n = next_int();
		$odd = 0;
		for($i=0; $i<$n; $i++) if((next_int() & 1) == 1) $odd++;
		$ans = (($odd > 0) && ((($n&1) == 1) || ($odd != $n))) ? "YES" : "NO";
		printf("%s\n", $ans);
	}
}

namespace io {
	function next_line() {
		static $cnt = 0;
		global $input_buf;
		return $input_buf[$cnt++];
	}
	function next_() {
		static $tk = [];
		static $tk_cnt = 0;
		if($tk_cnt == count($tk)) {
			$tk = explode(" ", next_line());
			$tk_cnt = 0;
		}
		return $tk[$tk_cnt++];
	}
	function next_int() {
		return (int)next_();
	}
	function next_double() {
		return (double)next_();
	}
}

?>

<?php
$input = file_get_contents("php://stdin");

$lines = explode("\n", $input);
array_shift($lines);

for ($i = 0; $i < count($lines)-1; $i = $i + 2) {
    // We only do the odd lines.
    $numbers = explode(' ', $lines[$i+1]);
    $sum = 0;
    $evenCount = 0;
    $oddCount = 0;

    foreach ($numbers as $number) {
        if ($number % 2 ===0) {
            $evenCount++;
        } else {
            $oddCount++;
        }

        $sum += $number;
    }

    if ($sum % 2 !== 0) {
        echo "YES\n";
    } else {
        if ($evenCount === 0 || $oddCount === 0) {
            echo "NO\n";
        } else {
            echo "YES\n";
        }
    }
}

<?php
    $t = trim(fgets(STDIN));

    for($i=0; $i<$t; $i++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

       $count1 = 0;
       $count2 = 0;

        for($j = 0; $j < count($a); $j++){
            if($a[$j] % 2) {
                 $count1 += 1;
            } else {
                $count2 += 1;
            }
        }

        if($count1 == 0) {
            echo "NO\n";
        } elseif (
                    (($count1 - $count2) > 1 && ($count1 - $count2) % 2 == 1)
                    || ($count1 - $count2) == 0)
        {
            echo "YES\n";
        } else {
            echo "NO\n";
        }

    }

<?php
    $t = trim(fgets(STDIN));

    for($i=0; $i<$t; $i++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

       $count1 = 0;
       $count2 = 0;

        for($j = 0; $j < count($a); $j++){
            if($a[$j] % 2) {
                 $count1 += 1;
            } else {
                $count2 += 1;
            }
        }

        if($count1 == 0) {
            echo "NO\n";
        } elseif ($count1 % 2 == 1)
        {
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    }

<?php
    $t = trim(fgets(STDIN));

    for($i=0; $i<$t; $i++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

       $count = 0;

        for($j = 0; $j < count($a); $j++){
           $count += $a[$j];
        }

        if($count % 2 == 1) {
            echo "YES\n";
        } else {
            echo "NO\n";
        }

    }

<?php
    $t = trim(fgets(STDIN));

    for($i=0; $i<$t; $i++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

       $count1 = 0;
       $count2 = 0;

        for($j = 0; $j < count($a); $j++){
            if($a[$j] % 2) {
                 $count1 += 1;
            } else {
                $count2 += 1;
            }
        }

        if((($count1 - $count2) > 1 && ($count1 - $count2) % 2 == 1) || ($count1 - $count2) == 0) {
            echo "YES\n";
        } else {
            echo "NO\n";
        }

    }

<?php
    $t = trim(fgets(STDIN));

    for($i=0; $i<$t; $i++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

       $count1 = 0;
       $count2 = 0;

        for($j = 0; $j < count($a); $j++){
            if($a[$j] % 2) {
                 $count1 += 1;
            } else {
                $count2 += 1;
            }
        }

        if($count1 == 0) {
            echo "NO\n";
        } elseif ($count1 % 2 == 1)
        {
            echo "YES\n";
        } elseif (($count1 - $count2) % 2 == 1)
        {
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    }

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;
    for ($i=0;$i<$n;$i++)
    {
        if($a[$i]%2!=0)
        $sum=$sum+$a[$i];
    }

    if(($sum)%2!=0)
        echo "YES"."\n";
    else
        echo "NO"."\n";

}

?>

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;$odd=0;$enev=0;
    for ($i=0;$i<$n;$i++)
    {
        if($a[$i]%2!=0)
            $odd++;
        else
            $enev++;
        $sum=$sum+$a[$i];
    }

    if(($sum)%2!=0)
        echo "YES"."\n";
    else if($sum%2==0 && $enev%2!=0)
        echo 'YES'."\n";
    else
        echo "NO"."\n";

}

?>

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;$odd=0;$enev=0;
    for ($i=0;$i<$n;$i++)
    {
        if($a[$i]%2!=0)
            $odd++;
        else
            $enev++;
        $sum=$sum+$a[$i];
    }

    if(($sum)%2!=0)
        echo "YES"."\n";
    else if($sum%2==0 && $enev>1 && $odd>1)
        echo 'YES'."\n";
    else
        echo "NO"."\n";

}

?>

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;$odd=0;$enev=0;
    for ($i=0;$i<$n;$i++)
    {
        if($a[$i]%2!=0)
            $odd++;
        else
            $enev++;
        $sum=$sum+$a[$i];
    }

    if(($sum)%2!=0)
        echo "YES"."\n";
    else if($sum%2==0 && $enev>1)
        echo 'YES'."\n";
    else
        echo "NO"."\n";

}

?>

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$t= trim(fgets($handle));

for($j=0;$j<$t;$j++)
{
    $n= trim(fgets($handle));
    $a= trim(fgets($handle));
    $a=explode(' ',$a);
    $sum=0;
    for ($i=0;$i<$n;$i++)
    {
        $sum=$sum+$a[$i];
    }

    if($sum%2!=0)
        echo "YES"."\n";
    else
        echo "NO"."\n";

}

?>

<?php

$input = trim(fgets(STDIN));

$lines = explode("\n", $a);
array_shift($lines);

for ($i = 1; $i <= count($lines); $i = $i + 2) {
    // We only do the odd lines.
    $numbers = explode(' ', $lines[$i]);
    $sum = 0;

    foreach ($numbers as $number) {
        $sum += $number;
    }

    if ($sum % 2 == 1) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}

<?php
$input = file_get_contents("php://stdin");

$lines = explode("\n", $input);
array_shift($lines);

for ($i = 0; $i < count($lines)-1; $i = $i + 2) {
    // We only do the odd lines.
    $numbers = explode(' ', $lines[$i+1]);
    $sum = 0;

    foreach ($numbers as $number) {
        $sum += $number;
    }

    if ($sum % 2 == 1) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}

<?php

$input = trim(fgets(STDIN));

$lines = explode("\n", $input);
array_shift($lines);

for ($i = 1; $i <= count($lines); $i = $i + 2) {
    // We only do the odd lines.
    $numbers = explode(' ', $lines[$i]);
    $sum = 0;

    foreach ($numbers as $number) {
        $sum += $number;
    }

    if ($sum % 2 == 1) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}

<?php
$input = file_get_contents("php://stdin");

$lines = explode("\n", $input);
array_shift($lines);

for ($i = 1; $i <= count($lines); $i = $i + 2) {
    // We only do the odd lines.
    $numbers = explode(' ', $lines[$i]);
    $sum = 0;

    foreach ($numbers as $number) {
        $sum += $number;
    }

    if ($sum % 2 == 1) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}


<?php
$fileName = 'php://stdin';
$file = fopen($fileName, "r");

$t = trim(fgets($file));

for ($j = 0; $j < $t; $j++) {
  list($a, $b) = explode(" ", trim(fgets($file)));
  if ($a == $b) { echo '0'.PHP_EOL; }
  else {
    if ($b < $a * 2) { $c = $b - $a; }
    else { $c = floor(($b - 1) / 2); }

    echo $c.PHP_EOL;
  }
}
?>

<?php
fscanf(STDIN, "%d", $number);
while($number--){
	fscanf(STDIN,"%d%d",$a,$b);
	$res = (int)($b/2);
	if($a == $b){
		echo "0\n";
	}else if($res >= $a){
		if($b % 2 == 0){
			$res-=1;
		}
		echo $res."\n";
	}else{
		echo $b % $a."\n";
	}
}
?>

  <?php

  $t = trim(fgets(STDIN));
  for($q=0; $q <$t; $q++) {
     list($l, $r) = explode(' ', trim(fgets(STDIN)));
     $mod = 0;
     if($l == $r) {
        $mod = 0;
     } else {
        $mod = ($r - $l ) < $l ? $r - $l : floor( ($r-1) / 2) ;
     }

     echo $mod . "\n";
  }


<?php

$n = (int)get_line();

print intval(($n * $n + 1) / 2);
print PHP_EOL;

$output = '';

for ($i = 0; $i < $n; $i ++) {
  for ($j = 0; $j < $n; $j ++) {
    if ($i % 2 == 0) {
      $output .= ($j % 2 == 0) ? 'C' : '.';
    } else {
      $output .= ($j % 2 == 0) ? '.' : 'C';
    }
  }
  $output .= PHP_EOL;
}

print $output;

function get_line() {
  return trim(fgets(STDIN));
}

<?php

$stdin = fopen('php://stdin', 'r');
$line1 = fgets($stdin);
$arr=explode(' ',$line1);
fclose($stdin);
$n=$arr[0];

$stdout=fopen('php://stdout','w');
if ($n%2==0) {$c=floor($n*$n/2);} else {$c=floor((floor($n/2)+1)*(floor($n/2)+1)+floor($n/2)*floor($n/2));}
fwrite($stdout,$c."\n");
$line='';
for ($i=1;$i<=$n;$i++)
{
for ($j=1;$j<=$n;$j++)
{
    if (($i+$j)%2==0) {$line=$line.'C';} else {$line=$line.'.';}
}
    fwrite($stdout,$line."\n");
    $line='';
}

fclose($stdout);

?>

<?php
error_reporting("off");
//384A: Coder
$n = trim(fgets(STDIN));
if ($n == 1) {
	echo "1\n";
	echo "C";
} elseif ($n % 2 == 0) {
	$firstline = str_repeat("C.", $n / 2);
	$secondline = strrev($firstline);
	$twolines = $firstline."\n".$secondline."\n";
	$result = str_repeat($twolines, $n / 2);
	$numberofc = $n * $n;
	$numberofc = $numberofc / 2;
	echo $numberofc."\n";
	echo $result;
} else {
	$other = $n - 1;
	$times = $other / 2;
	$firstline = str_repeat("C.", $times)."C";
	$secondline = str_repeat(".C", $times).".";
	$twolines = $firstline."\n".$secondline."\n";
	$result = str_repeat($twolines, $times).$firstline;
	$numberofc = $times * $n;
	$numberofc += $times + 1;
	echo $numberofc."\n";
	echo $result;
}
?>

<?php
error_reporting("off");
//384A: Coder
$n = trim(fgets(STDIN));
if ($n % 2 == 0) {
    $firstline = str_repeat("C.", $n / 2);
    $secondline = strrev($firstline);
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $n / 2);
} else {
    $other = $n - 1;
    $times = $other / 2;
    $firstline = str_repeat("C.", $times)."C";
    $secondline = str_repeat(".C", $times).".";
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $times).$firstline;
}
echo $result;
?>

<?php
error_reporting("off");
//384A: Coder
$n = trim(fgets(STDIN));
if ($n == 1) {
    echo "C";
} elseif ($n % 2 == 0) {
    $firstline = str_repeat("C.", $n / 2);
    $secondline = strrev($firstline);
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $n / 2);
    echo $result;
} else {
    $other = $n - 1;
    $times = $other / 2;
    $firstline = str_repeat("C.", $times)."C";
    $secondline = str_repeat(".C", $times).".";
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $times).$firstline;
    echo $result;
}
?>

<?php
error_reporting("off");
//384A: Coder
$n = trim(fgets(STDIN));
if ($n == 1) {
    echo "C";
} elseif ($n % 2 == 0) {
    $firstline = str_repeat("C.", $n / 2);
    $secondline = strrev($firstline);
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $n / 2);
    $numberofc = $n * $n;
    $numberofc = $numberofc / 2;
    echo $numberofc."\n";
    echo $result;
} else {
    $other = $n - 1;
    $times = $other / 2;
    $firstline = str_repeat("C.", $times)."C";
    $secondline = str_repeat(".C", $times).".";
    $twolines = $firstline."\n".$secondline."\n";
    $result = str_repeat($twolines, $times).$firstline;
    $numberofc = $times * $n;
    $numberofc += $times + 1;
    echo $numberofc."\n";
    echo $result;
}
?>


<?php
# 1157E
declare(strict_types=1);

$start = microtime(true);
$stdin = STDIN;
[$n] = fscanf($stdin, '%u');

$arrA = explode(' ', trim(fgets($stdin)));
$arrB = explode(' ', trim(fgets($stdin)));
sort($arrB);
$arrC = [];
$amountB = array_fill(0, $n, 0);
foreach ($arrB as $itemB) {
    $amountB[$itemB]++;
}

$orderList = array_keys($amountB);
unset($orderList[0]);
sort($orderList);
$orderList[] = 0;

foreach ($arrA as $i => $itemA) {
    $currentValue = ($n - $itemA) % $n;
    while ($amountB[$currentValue] === 0) {
        $nextValue = $orderList[$currentValue];
        if ($amountB[$nextValue] === 0) {
            $nextValue = $orderList[$currentValue] = $orderList[$nextValue];
        }
        $currentValue = $nextValue;
    }
    echo ($i ? ' ' : '') . (($itemA + $currentValue) % $n);
    $amountB[$currentValue]--;
}

<?php
# 1157E
declare(strict_types=1);

$start = microtime(true);
$stdin = STDIN;
[$n] = fscanf($stdin, '%u');

$arrA = explode(' ', trim(fgets($stdin)));
$arrB = explode(' ', trim(fgets($stdin)));
sort($arrB);
$arrC = [];
$amountB = array_fill(0, $n, 0);
foreach ($arrB as $itemB) {
    $amountB[$itemB]++;
}

$orderList = array_keys($amountB);
unset($orderList[0]);
sort($orderList);
$orderList[] = 0;

foreach ($arrA as $itemA) {
    $currentValue = ($n - $itemA) % $n;
    while ($amountB[$currentValue] === 0) {
        $nextValue = $orderList[$currentValue];
        if ($amountB[$nextValue] === 0) {
            $nextValue = $orderList[$currentValue] = $orderList[$nextValue];
        }
        $currentValue = $nextValue;
    }
    $arrC[] = ($itemA + $currentValue) % $n;
    $amountB[$currentValue]--;
}
echo implode(' ', $arrC);

<?php
# 1157E
declare(strict_types=1);

$start = microtime(true);
$stdin = STDIN;
[$n] = fscanf($stdin, '%u');

$arrA = explode(' ', trim(fgets($stdin)));
$arrB = explode(' ', trim(fgets($stdin)));
sort($arrB);
$result = '';

$amountB = array_fill(0, $n, 0);
foreach ($arrB as $itemB) {
    $amountB[$itemB]++;
}

unset($arrB);

$orderList = array_keys($amountB);
unset($orderList[0]);
sort($orderList);
$orderList[] = 0;

foreach ($arrA as $i => $itemA) {
    $currentValue = ($n - $itemA) % $n;
    while ($amountB[$currentValue] === 0) {
        $nextValue = $orderList[$currentValue];
        if ($amountB[$nextValue] === 0) {
            $nextValue = $orderList[$currentValue] = $orderList[$nextValue];
        }
        $currentValue = $nextValue;
    }
    $res .= ($i ? ' ' : '') . (($itemA + $currentValue) % $n);
    $amountB[$currentValue]--;
}
echo $res;


<?php
    define("MAXN", 1024) ;
    define("GAP_VAL", 1e-7) ;

    function gap($n)
    {
        return $n < GAP_VAL ;
    }

    $t = intval(trim(fgets(STDIN))) ;
    while($t --)
    {
        $in_str = explode(" ", trim(fgets(STDIN))) ;

        $x = intval($in_str[0]) ;
        $y = intval($in_str[1]) ;
        $n = intval($in_str[2]) ;

        $d = intval($n / $x) * $x ;

        if($d + $y <= $n) echo $d + $y . "\n" ;
        else echo $d - $x + $y . "\n" ;
    }
?>


<?php

for ($i = 3; $i < 25 + 3; ++$i) {
    fprintf(STDOUT, '? %d %d'.PHP_EOL, 1, $i);
    fprintf(STDOUT, '? %d %d'.PHP_EOL, $i, 1);
    fflush(STDOUT);

    fscanf(STDIN, '%d', $first);

    if ($first === -1) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $i - 1);
        break;
    }

    fscanf(STDIN, '%d', $second);

    if ($first !== $second) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $first + $second);
        break;
    }
}

<?php

// 1729 E. Guess the Cycle Size
// _probability_, _interactive_

for ($i = 3; $i < 25 + 3; ++$i) {
    fprintf(STDOUT, '? %d %d'.PHP_EOL, 1, $i);
    fprintf(STDOUT, '? %d %d'.PHP_EOL, $i, 1);

    fscanf(STDIN, '%d', $first);

    if ($first === -1) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $i - 1);
        break;
    }

    fscanf(STDIN, '%d', $second);

    if ($first !== $second) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $first + $second);
        break;
    }
}

<?php

// 1729 E. Guess the Cycle Size
// _probability_, _interactive_

for ($i = 3; $i < 25 + 3; ++$i) {
    fprintf(STDOUT, '? %d %d'.PHP_EOL, 1, $i);
    fprintf(STDOUT, '? %d %d'.PHP_EOL, $i, 1);
//    fflush(STDOUT);

    fscanf(STDIN, '%d', $first);

    if ($first === -1) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $i - 1);
        break;
    }

    fscanf(STDIN, '%d', $second);

    if ($first !== $second) {
        fprintf(STDOUT, '! %d' . PHP_EOL, $first + $second);
        break;
    }
}


<?php
$i = trim(fgets(STDIN));
$count = 0;
for($j = $i; $j>0; $j--){
    $count += 1/$j;
}
echo $count;

<?php

$n = intval(readline());

$joe = 0;
for ($i=1; $i<=$n; $i++) {
	$joe += 1/$i;
}

print $joe;


<?php

function solution(string $a, string $b, string $c): bool
{
    $a = str_split($a);
    $b = str_split($b);
    $c = str_split($c);
    for ($i = 0; $i < count($a); $i++) {
        if ($a[$i] == $c[$i] || $b[$i] == $c[$i]) {
            continue;
        }
        return false;
    }
    return true;
}

$n = intval(fgets(STDIN));
for ($i = 0; $i < $n; $i++) {
    $a = trim(fgets(STDIN));
    $b = trim(fgets(STDIN));
    $c = trim(fgets(STDIN));
    print (solution($a, $b, $c) ? 'YES' : 'NO') . PHP_EOL;
}

<?php
fscanf(STDIN, "%d\n",$tc);
while ($tc--) {
	fscanf(STDIN,"%s\n",$frst);
	fscanf(STDIN,"%s\n",$second);
	fscanf(STDIN,"%s\n",$third);

	for($i=0;$i<strlen($third);$i++)
	{
		if($third[$i]!=$frst[$i])
		{
			$tmp=$third[$i];
			$third[$i]=$frst[$i];
			$frst[$i]=$tmp;
		}
		elseif ($third[$i]!=$second[$i]) {
			$tmp=$third[$i];
			$third[$i]=$second[$i];
			$second[$i]=$tmp;
		}

    }
if($frst==$second)
	echo "YES\n";
else
	echo "NO\n";
}

<?php
$i = trim(fgets(STDIN));
for($j = 0; $j < $i; $j++){
    $a = str_split(trim(fgets(STDIN)));
    $b = str_split(trim(fgets(STDIN)));
    $c = str_split(trim(fgets(STDIN)));
    $bool = true;
    foreach($c as $k => $v){
        if($v != $a[$k] && $v != $b[$k]){
            $bool = false;
        }
    }
    if($bool){
        echo "YES\n";
    } else {
        echo "NO\n";
    }

}

<?php
function solve($t)
{

}
$server = "php://stdin";
$handle = fopen($server, "r");
$t = trim(fgets($handle));
for ($j=0;$j<$t;$j++)
{
    $a= trim(fgets($handle));
    $b = trim(fgets($handle));
    $c = trim(fgets($handle));
    $count=0;
    for ($i=0;$i<strlen($a);$i++)
    {
        if($a[$i]==$c[$i] ||$b[$i]==$c[$i])
        {
            $count++;
        }
    }
    if($count==strlen($a))
    {
        echo "YES"."\n";
    }else
    {
        echo "NO"."\n";
    }
}

?>

<?php
list($m) = explode(' ', trim(fgets(STDIN)));
for($k = 0; $k < $m; $k++) {
    $a = trim(fgets(STDIN));
    $b = trim(fgets(STDIN));
    $c = trim(fgets(STDIN));
    $bFlag = false;
    for ($i = 0; $i < strlen($a); $i++) {
        if ($c[$i] == $a[$i] || $c[$i] == $b[$i]) {
            $bFlag = true;
        } else {
            $bFlag = false;
            break;
        }
    }

    if ($bFlag) {
        echo 'YES'. "\n";
    } else {
        echo 'NO' . "\n";
    }

}

<?php
list($m) = explode(' ', trim(fgets(STDIN)));
for($k = 0; $k < $m; $k++) {
    $a = trim(fgets(STDIN));
    $b = trim(fgets(STDIN));
    $c = trim(fgets(STDIN));
    $aTest = [];
    $bFlag = false;
    for ($i = 0; $i < strlen($a); $i++) {
        if ($c[$i] == $a[$i] || $c[$i] == $b[$i]) {
            $bFlag = true;
        } else {
            $bFlag = false;
        }
    }

    if ($bFlag) {
        echo 'YES'. "\n";
    } else {
        echo 'NO' . "\n";
    }

}


<?php

for($t = intval(trim(fgets(STDIN))); $t > 0; $t --){
    //print pow(2, intval(fgets(STDIN)) - 1)."\n";
    list($n, $a, $b, $c, $d) = explode(" ", trim(fgets(STDIN)));

    if($n * ($a - $b) > $c + $d || $n * ($a + $b) < $c - $d)
        print("NO\n");

    else
        print("YES\n");

}

<?php
    define("MAXN", 200001) ;

    function solve($x, $y, $a, $b)
    {
    }

    $T = intval(fgets(STDIN));
    while($T --)
    {
        $Nastya = explode(" ", trim(fgets(STDIN))) ;

        $n = intval($Nastya[0]) ;
        $a = intval($Nastya[1]) ;
        $b = intval($Nastya[2]) ;
        $c = intval($Nastya[3]) ;
        $d = intval($Nastya[4]) ;

        $tmp_a = $n * ($a - $b) ;
        $tmp_b = $n * ($a + $b) ;
        $tmp_c = $c - $d ;
        $tmp_d = $c + $d ;

        if($tmp_a > $tmp_d) echo "NO" . "\n" ;
        else if($tmp_c > $tmp_b) echo "NO"."\n" ;
        else echo "YES"."\n" ;
    }
?>

<?php

for($t = intval(trim(fgets(STDIN))); $t > 0; $t --){
    //print pow(2, intval(fgets(STDIN)) - 1)."\n";
    list($n, $a, $b, $c, $d) = explode(" ", trim(fgets(STDIN)));
    $flag = 0;

    for($i = $a - $b; $i <= $a + $b; $i++){
        if($n * $i >= $c - $d && $n * $i <= $c + $d)
            $flag = 1;
    }

    if($flag)
        print("YES\n");

    else
        print("NO\n");

}

<?php
    define("MAXN", 200001) ;

    $Nastya = array_fill(0, 5, 0) ;

    function solve($x, $y, $a, $b)
    {
    }

    $a = intval(fgets(STDIN));
    while($a --)
    {
        $Nastya = explode(" ", fgets(STDIN)) ;

        $n = intval($Nastya[0]) ;
        $a = intval($Nastya[1]) ;
        $b = intval($Nastya[2]) ;
        $c = intval($Nastya[3]) ;
        $d = intval($Nastya[4]) ;

        $tmp_a = $n * ($a - $b) ;
        $tmp_b = $n * ($a + $b) ;
        $tmp_c = $c - $d ;
        $tmp_d = $c + $d ;

        if($tmp_a > $tmp_d) echo "NO" . "\n" ;
        else if($tmp_c > $tmp_b) echo "NO"."\n" ;
        else echo "YES"."\n" ;
    }
?>


<?php
$str1=trim(fgets(STDIN));
$str2=trim(fgets(STDIN));
$len1=strlen($str1);
$len2=strlen($str2);
if($len1!=$len2)
{
echo "NO\n";
}
else{
$j=0;
$count=0;
$a=array();
$b=array();
for ($i=0; $i <$len1 ; $i++)
{
	if($str1[$i]!=$str2[$i])
	 {
     $a[$j]=$str1[$i];
     $b[$j]=$str2[$i];
     $j++;
      $count++;
      if($count>2)
      {
      	//$flag=1;
      	//echo "NO";
      	break;
      }
     }
}

if($count==2&&$a[1]==$b[0]&&$a[0]==$b[1])
	echo "YES\n";
else
	echo "NO";

}

<?php

fscanf(STDIN, "%s", $a);
fscanf(STDIN, "%s", $b);

$ra = preg_split("//", $a);
$rb = preg_split("//", $b);

sort($ra);
sort($rb);

$a = implode("", $ra);
$b = implode("", $rb);

die(($a == $b ? "YES" : "NO"));

?>

<?php
$str1=trim(fgets(STDIN));
$str2=trim(fgets(STDIN));
if(strlen($str1)!=strlen($str2))
echo "NO\n";
else{
$split1=str_split($str1);
$split2=str_split($str2);
sort($split1);
sort($split2);
$alphabet="abcdefghijklmnopqrstuvwxyz";
$str3="";
for ($i=0; $i <strlen($alphabet) ; $i++)
{     $cnt=0;
	for ($j=0; $j <count($split1) ; $j++)
	{
		if($alphabet[$i]==$split1[$j])
		{
		  $cnt++;
			//break;
		}
	}
	$str3.=$alphabet[$i].$cnt;
}
$str4="";
for ($i=0; $i <strlen($alphabet) ; $i++)
{     $cnt=0;
	for ($j=0; $j <count($split2) ; $j++)
	{
		if($alphabet[$i]==$split2[$j])
		{
		  $cnt++;
			//break;
		}
	}
	$str4.=$alphabet[$i].$cnt;
}
if($str3==$str4)
	echo "YES\n";

else
	echo "NO\n";
}


<?php

$n = intval(trim(fgets(STDIN)));
for ($i = 1; $i <= $n; $i++) {
    $inp = intval(trim(fgets(STDIN)));
    $result = []; $max = $inp * 2;
    for ($y = 1; $y <= $inp; $y++) {
        $str = str_repeat('(', $y);
        $str = $str . str_repeat(')(',($inp - $y));
        $str = $str . str_repeat(')', $y );
        echo $str;
        echo "\n";
    }

}

<?php declare(strict_types = 1);

$t = intval(fgets(STDIN));
while ($t--) {
	$n = intval(fgets(STDIN));
	for ($i = 0; $i < $n; $i++) {
		for ($j = 0; $j < $i; $j++) {
			echo "()";
		}
		for ($j = $i; $j < $n; $j++) {
			echo "(";
		}
		for ($j = $i; $j < $n; $j++) {
			echo ")";
		}
		echo "\n";
	}
}

<?php
class IO {
    public static $aAlphabet = ['A','B','C','D', 'E', 'F', 'G', 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
    //Input/Output
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function asLine($mArr, $sep = ' ') { echo implode($sep, $mArr) . PHP_EOL; }

    //Z-function
    public static function z($sString) {
        $s = str_split($sString);
        $n = count($s);
        $z = array_fill(0, $n, 0);
        $r = $l = 0;
        for ($i = 1; $i < $n; $i++) {
            if ($r >= $i) {
                $z[$i] = min($z[$i - $l], $r - $i + 1);
            }
            while ($z[$i] + $i < $n && $s[$z[$i]] == $s[$z[$i] + $i]) {
                $z[$i]++;
            }
            if ($i + $z[$i] - 1 > $r) {
                $l = $i;
                $r = $i + $z[$i] - 1;
            }
        }
        return $z;
    }
    public static function getCountOfDiffSubstrWithZ($sString)
    {
        $s = str_split($sString);
        $n = count($s);
        $count = 0;
        $t = '';
        for ($i = $n - 1; $i >= 0; $i--) {
            $t = $s[$i] . $t;
            $count += $i + 1 - max(self::z($t));
        }
        return $count;
    }
    public static function getMinPeriodOfSubstrWithZ($sString)
    {
        $s = str_split($sString);
        $res = count($s);
        $z = self::z($sString);
        foreach ($z as $iI => $sV) {
            if ((int) $iI + $z[$iI] == $res && $res % (int) $iI == 0) {
                $res = $iI;
                break;
            }
        }
        return $res;
    }

    //Other functions
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function factorial($number)
    {
        $factorial = 1;
        for ($i = 1; $i <= $number; $i++){
            $factorial = $factorial * $i;
        }
        return $factorial;
    }

}

//$iQueryCount = 1;
$iQueryCount = IO::str();
$aAllResults = [];
while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    for ($i = 1; $i <= $n; $i++) {
        $str = $str2 = '';
        for ($j = 0; $j < $i; $j++) {
            $str .= '(';
            $str2 .= ')';
        }
        $r = $str . $str2;
        for ($x = 0; $x < $n - $i; $x++) {
            $r .= '()';
        }
        IO::line($r);
    }

}

?>


<?php
// Retrieve input
$stdin = fopen('php://stdin', 'r');
function g() {
	global $stdin;
	return explode(" ", trim(fgets($stdin)));
}

// Codeforces Contest 176 Div 2 Problem C
$raw = g();
$n = $raw[0];

if (($n % 4 == 2) || ($n % 4 == 3)) {echo "-1"; exit;}

if ($n % 4 == 1) {
	$r = ($n - 1)/4;
	for ($i = 1; $i <= $r; $i++) {
		$odd = 2*$i - 1;
		$even = 2*$i;
		$arr[$odd] = $even;
		$arr[$even] = $n+1 - $odd;
		$arr[$n+1 - $odd] = $n+1 - $even;
		$arr[$n+1 - $even] = $odd;
	}
	$arr[($n+1)/2] = ($n+1)/2;
}

if ($n % 4 == 0) {
	$r = $n/4;
	for ($i = 1; $i <= $r; $i++) {
		$odd = 2*$i - 1;
		$even = 2*$i;
		$arr[$odd] = $even;
		$arr[$even] = $n+1 - $odd;
		$arr[$n+1 - $odd] = $n+1 - $even;
		$arr[$n+1 - $even] = $odd;
	}
}

for ($i = 1; $i <= $n; $i++) {
	echo $arr[$i] . " ";
}

// End of submission file
// Submission by chaotic_iak
?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
$n = trim(fgets($file));
$aArray = array_fill(0, 26, 0);
$bArray = array_fill(0, 26, $aArray);
for ($i = 0; $i < $n; $i++) {
    $s = count_chars(trim(fgets($file)), 1);
    $c = count($s);
    if ($c > 2) {
        continue;
    } elseif ($c == 2) {
        $temp = array();
        $f = 0;
        foreach ($s as $l => $t) {
            $temp[] = $l - 97;
            $f += $t;
        }
        $bArray[$temp[0]][$temp[1]] += $f;
        $bArray[$temp[1]][$temp[0]] += $f;

    } else {
        foreach ($s as $l => $t) {
            $aArray[$l - 97] += $t;
        }
    }
}
$max = 0;
for ($i = 0; $i < 26; $i++) {
    for ($j = 0; $j < 26; $j++) {
        if ($i==$j) {
            continue;
        }
        $max = max($max, $bArray[$i][$j] + $aArray[$i] + $aArray[$j]);
    }
}
echo $max;


<?php

$ncash = trim(fgets(STDIN));
$nqueue = explode(" ", trim(fgets(STDIN)));

$m = PHP_INT_MAX;
for($i = 0; $i < $ncash; $i++)
{
	$nitems = explode(" ", trim(fgets(STDIN)));
	$qq = 15 * sizeof($nitems);
	for($j = 0; $j < sizeof($nitems); $j++)
		$qq += ($nitems[$j] * 5);

	$m = min($m, $qq);
}

echo $m . PHP_EOL;

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$f = array();
for($x = 1; $x <= $a; $x++)
{
    $c = explode(" ", trim(fgets(STDIN)));
    $e = 0;
    $d = array_sum($c);
    $e = ($d * 5) + (count($c) * 15);
    array_push($f, $e);
}
sort($f);
print $f[0];
?>

<?php
define('LOCAL_ENV', false);
if (LOCAL_ENV) {
    error_reporting(E_ALL & !E_NOTICE);
//    $test = <<<INPUT
//4.147 2.8819
//6
//INPUT;
    $test = <<<INPUT
4
1 4 3 2
100
1 2 2 3
1 9 1
7 8
INPUT;
    $stdin = fopen('php://temp/in', 'rw');
    fwrite($stdin, $test);
    rewind($stdin);
} else {
    error_reporting(0);
    $stdin = STDIN;
}
define('MY_STDIN', $stdin);

$n = (int) trim(fgets(MY_STDIN));
$k = explode(' ', trim(fgets(MY_STDIN)));
$min = PHP_INT_MAX;
for ($i = 0; $i < $n; $i++) {
    $m = explode(' ', trim(fgets(MY_STDIN)));
    $cur = 0;
    foreach ($m as $cnt) {
        $cur += $cnt * 5 + 15;
    }
    $min = min($min, $cur);
}

echo $min;


<?php
list ($n, $x0, $y0) = explode(' ', trim(fgets(STDIN)));
$xy = array();
for ($i = 0; $i < $n; $i++) {
  $xy[] = explode(' ', trim(fgets(STDIN)));
}

$count = 0;
while (!empty($xy)) {
  list ($x1, $y1) = array_shift($xy);

  $x1mx0 = $x1 - $x0;
  $y1my0 = $y1 - $y0;

  foreach ($xy as $i2 => $xy2) {
    list ($x2, $y2) = $xy2;
    if (abs($y1my0 * ($x2 - $x0) - $x1mx0 * ($y2 - $y0)) < 1e-8) {
      unset($xy[$i2]);
    }
  }

  $count++;
}

echo "$count\n";

<?php

$f = fopen('php://stdin', 'r');
//$f = fopen('test.txt', 'r');

$s = trim(fgets($f));

list($n,$x,$y) = explode(" ",$s);

$res = array();

$dop = 0;

for($i=0;$i<$n;$i++){
    list($a,$b) = explode(" ",trim(fgets($f)));

    if (($b-$y) == 0) {
        $dop = 1;
        continue;
    }

    $tan = ($a-$x)/($b-$y);
    $res["$tan"] = 1;

}

echo count($res)+$dop;


<?php
$arr = explode(" ", fgets(STDIN));
$row_count = $arr[0];
$people_count = $arr[1];
$arRows = [];
for($i = 0; $i < $row_count; $i++){
    $arRows[] = fgets(STDIN);
}

//NOT S

foreach ($arRows as $key => $row){
    $arrStr = str_split($row);
    $srt_return = '';
    foreach ($arrStr as $k => $char){
        if($char == ".") {
            if ($people_count > 0) {
                if ($k >=1 && $k < 11) {
                    if ($arrStr[$k - 1] != "S" && $arrStr[$k + 1] != "S") {
                        $char = "x";
                        $people_count = $people_count - 1;
                    }

                }
                elseif($k == 0 && $arrStr[$k + 1] != "S") {
                    $char = "x";
                    $people_count = $people_count - 1;
                }
                elseif($k == 11 && $arrStr[$k - 1] != "S") {
                    $char = "x";
                    $people_count = $people_count - 1;
                }
            }
        }

        $srt_return = $srt_return.$char;
    }
    $arRows[$key] = $srt_return;

}

foreach ($arRows as $key => $row){
    $arrStr = str_split($row);
    $srt_return = '';
    foreach ($arrStr as $k => $char){
        if($char == ".") {
            if ($people_count > 0) {
                if ($k >=1 && $k < 11) {
                    $sos = $arrStr[$k - 1] . $arrStr[$k + 1];
                    if ($sos != "SS") {
                        $char = "x";
                        $people_count = $people_count - 1;
                    }

                }
                else {
                    $char = "x";
                    $people_count = $people_count - 1;
                }
            }
        }

        $srt_return = $srt_return.$char;
    }
    $arRows[$key] = $srt_return;

}

foreach ($arRows as $k => $row){

    if($people_count >= 1){
        $arRows[$k] = preg_replace("/\./","x",$arRows[$k],$people_count,$count);
        $people_count = $people_count - $count;
    }
    else{
        break;
    }

}
global $count_result;
$count_result = 0;
function counter($f){
    global $count_result;
    if($f != ""){
        if($f != "-" && $f != "."){
            $count_result++;
        }
    }

}

foreach ($arRows as $key => $row){
    $arrStr = str_split($row);
    foreach ($arrStr as $k => $char){
        if($char == "S"){
            if($k > 0){
                counter($arrStr[$k-1]);
            }
            if($k < 11){
                counter($arrStr[$k+1]);
            }
        }
    }
}

echo $count_result."\n";
foreach ($arRows as $row){
    echo $row;
}

?>

<?php
function sorting($str, $row, $colomn){
	global $neighbors;
	global $best_place, $mid_place, $bad_place;
    for($i = 0; $i < strlen($str); $i++){
    	if($str[$i] == "S"){
    		if($i > 0 && $str[$i-1] != "."){
    			$neighbors++;
    		}
    		if($i< strlen($str)-1 && $str[$i+1]!="."){
    			$neighbors++;
    		}
    	}
    	if($str[$i] == "."){
    		$c = 0;
    		if($i>0 && $str[$i-1]=="S"){
    			$c++;
    		}
    		if($i+1 < strlen($str) && $str[$i+1]=="S"){
    			$c++;
    		}
    		switch ($c) {
    			case 0:
    				$best_place[] = [$row, $i+$colomn];
    				break;
    			case 1:
    				$mid_place[] = [$row, $i+$colomn];
    				break;
    			case 2:
    				$bad_place[] = [$row, $i+$colomn];
    		}
    	}
    }
}
$list = explode(" ", fgets(STDIN));
$n = $list[0];
$passangers = $list[1];
$best_place = [];
$mid_place = [];
$bad_place = [];
$need_place = [];
$neighbors = 0;
$rows = [];
for($i = 0; $i < $n; $i++){
	$row = trim(fgets(STDIN));
	$rows[] = $row;
	$rows_in_row = explode("-", $row);
	$r1 = $rows_in_row[0];
	$r2 = $rows_in_row[1];
	$r3 = $rows_in_row[2];
    sorting($r1, $i, 0);
    sorting($r2, $i, 4);
    sorting($r3, $i, 9);
}
$best = count($best_place);
$mid = count($mid_place);
$bad = count($bad_place);
if($best >= $passangers){
	$need_place = array_slice($best_place, 0, $passangers);
}
else{
    $need_place = $best_place;
    $passangers -= $best;
    if($passangers <= $mid){
    	$need_place = array_merge($need_place, array_slice($mid_place, 0, $passangers));
        $neighbors += $passangers;
    }
    else{
    	$neighbors += $mid;
    	$passangers-=$mid;
    	$need_place = array_merge($need_place, $mid_place, array_slice($bad_place, 0, $passangers));
    	$neighbors += 2*$passangers;
    }
}
foreach ($need_place as $place) {
	$rows[$place[0]][$place[1]] = "x";
}
echo $neighbors;
foreach ($rows as $row) {
	echo "\n".$row;
}
?>

<?php
$arr = explode(" ", fgets(STDIN));
$row_count = $arr[0];
$people_count = $arr[1];
$arRows = [];
for($i = 0; $i < $row_count; $i++){
    $arRows[] = fgets(STDIN);
}
$arFirstPaterns = array(
    "/P\.-S/" => "Px-S",
    "/S-\.P/" => "S-xP",
    "/P\.-/" => "Px-",
    "/P\.P/" => "PxP",
    "/\.\.P/" => ".xP",
    "/P\.\./" => "Px.",
    "/^\.P/" => "xP",
    "/P\.$/" => "Px"
);

$arSecondPaterns = array(
    "/\.\.S/" =>".xS",
    "/S\.\./" =>"Sx.",
    "/-\.S/"=> "-xS",
    "/S\.-/"=> "Sx-",
    "/S\.$/" =>"Sx",
    "/^\.S/" =>"xS",
    "/P\.S/"=> "PxS",
    "/S\.P/"=> "SxP",
);

$count = 0;
foreach ($arRows as $k => $row){
    if($people_count >= 2){
        $maxDuble = intval($people_count / 2);
        $arRows[$k] = preg_replace("/P\.\.P/","PxxP",$arRows[$k]);
        $people_count -= ($count * 2);
    }
    else{
        break;
    }

}

$count = 0;
foreach ($arRows as $k => $row){
    foreach ($arFirstPaterns as $search => $replace){
        if($people_count >= 1){
            $arRows[$k] = preg_replace($search,$replace,$arRows[$k],$people_count,$count);
            $people_count -= $count;
        }
        else{
            break 2;
        }
    }
}
$count = 0;
foreach ($arRows as $k => $row){
    foreach ($arSecondPaterns as $search => $replace){
        if($people_count >= 1){
            $arRows[$k] = preg_replace($search,$replace,$arRows[$k],$people_count,$count);
            $people_count -= $count;
        }
        else{
            break 2;
        }
    }
}

foreach ($arRows as $key => $row){
    $arrStr = str_split($row);
    $srt_return = '';
    foreach ($arrStr as $k => $char){
        if($char == ".") {
            if ($people_count > 0) {
                if ($k >=1 && $k < 11) {
                    $sos = $arrStr[$k - 1] . $arrStr[$k + 1];
                    if ($sos != "SS") {
                        $char = "x";
                        $people_count--;
                    }

                }
                else {
                    $char = "x";
                    $people_count--;
                }
            }
        }

        $srt_return = $srt_return.$char;
    }
    $arRows[$key] = $srt_return;

}

foreach ($arRows as $k => $row){

    if($people_count >= 1){
        $arRows[$k] = preg_replace("/\./","x",$arRows[$k],$people_count,$count);
        $people_count -= $count;
    }
    else{
        break;
    }

}
global $count_result;
$count_result = 0;
function counter($f){
    global $count_result;
    if($f != ""){
        if($f != "-" && $f != "."){
            $count_result++;
        }
    }

}

foreach ($arRows as $key => $row){
    $arrStr = str_split($row);
    foreach ($arrStr as $k => $char){
        if($char == "S"){
            if($k > 0){
                counter($arrStr[$k-1]);
            }
            if($k < 11){
                counter($arrStr[$k+1]);
            }
        }
    }
}

echo $count_result."\n";
foreach ($arRows as $row){
    echo $row;
}

?>

<?php
list($count, $range) = explode(" ", fgets(STDIN));
$count = (int) $count;
$range = (int) $range;
$arr = explode(" ", fgets(STDIN));
$velo = 0;

$pos = $arr[0];
for($i = 1; $i < $count; $i++){
    if($arr[$i] > $pos){
    	$pos = $arr[$i-1] + $range;
		if($arr[$i] > $pos){
			$velo = -1;
			break;
		} else {$velo ++;}
    }
}
echo $velo."  ";

<?php
function sorting($str, $row, $colomn){
	global $neighbors;
	global $best_place, $mid_place, $bad_place;
    for($i = 0; $i < strlen($str); $i++){
    	if($str[$i] == "S"){
    		if($i > 0 && $str[$i-1] != "."){
    			$neighbors++;
    		}
    		if($i< strlen($str)-1 && $str[$i+1]!="."){
    			$neighbors++;
    		}
    	}
    	if($str[$i] == "."){
    		$c = 0;
    		if($i>0 && $str[$i-1]=="S"){
    			$c++;
    		}
    		if($i+1 < strlen($str) && $str[$i+1]=="S"){
    			$c++;
    		}
    		switch ($c) {
    			case 0:
    				$best_place[] = [$row, $i+$colomn];
    				break;
    			case 1:
    				$mid_place[] = [$row, $i+$colomn];
    				break;
    			case 2:
    				$bad_place[] = [$row, $i+$colomn];
    		}
    	}
    }
}
$list = explode(" ", fgets(STDIN));
$n = $list[0];
$passangers = $list[1];
$best_place = [];
$mid_place = [];
$bad_place = [];
$need_place = [];
$neighbors = 0;
$rows = [];
for($i = 0; $i < $n; $i++){
	$row = trim(fgets(STDIN));
	$rows[] = $row;
	$rows_in_row = explode("-", $row);
	$r1 = $rows_in_row[0];
	$r2 = $rows_in_row[1];
	$r3 = $rows_in_row[2];
    sorting($r1, $i, 0);
    sorting($r2, $i, 4);
    sorting($r3, $i, 9);
}
$best = count($best_place);
$mid = count($mid_place);
$bad = count($bad_place);
echo "neig $neighbors \n";
if($best >= $passangers){
	$need_place = array_slice($best_place, 0, $passangers);
}
else{
    $need_place = $best_place;
    $passangers -= $best;
    if($passangers <= $mid){
    	$need_place = array_merge($need_place, array_slice($mid_place, 0, $passangers));
        $neighbors += $passangers;
    }
    else{
    	$neighbors += $mid;
    	$passangers-=$mid;
    	$need_place = array_merge($need_place, $mid_place, array_slice($bad_place, 0, $passangers));
    	$neighbors += 2*$passangers;
    }
}
foreach ($need_place as $place) {
	$rows[$place[0]][$place[1]] = "x";
}
echo $neighbors."\n";
foreach ($rows as $row) {
	echo $row."\n";
}
//echo "best";
//var_dump($best_place);
//echo "\n mid";
//var_dump($mid_place);
//echo "\n bad";
//var_dump($bad_place);
?>


<?php

$input = explode(" ", trim(fgets(STDIN)));

$setOfNumbers = explode(" ", trim(fgets(STDIN)));

$n = $input[0];
$k = $input[1];

sort($setOfNumbers);

if($k==0){
    if($setOfNumbers[0]<=1){
        print(-1);
    }
    else{
        print(1);
    }
}
else if($setOfNumbers[$k-1] == $setOfNumbers[$k]){
    print(-1);
}
else{
    print($setOfNumbers[$k-1]);
}

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = array();
for($x = 0; $x < $a; $x++)
{
     $d[$c[$x]]++;
}
ksort($d);
$e = array_keys($d);
$f = 0;
for($x = 0; $x < count($d); $x++)
{
     $f += $d[$e[$x]];
     if($f == $b)
     {
          print $e[$x];
          break;
     }
     elseif($f > $b)
     {
          print "-1";
          break;
     }
}
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
if($b == 0)
{
     print "1";
}
else
{
     $c = explode(" ", trim(fgets(STDIN)));
     $d = array();
     for($x = 0; $x < $a; $x++)
     {
          $d[$c[$x]]++;
     }
     ksort($d);
     $e = array_keys($d);
     $f = 0;
     for($x = 0; $x < count($d); $x++)
     {
          $f += $d[$e[$x]];
          if($f == $b)
          {
               print $e[$x];
               break;
          }
          elseif($f > $b)
          {
               print "-1";
               break;
          }
     }
}
?>

<?php

$input = explode(" ", trim(fgets(STDIN)));

$setOfNumbers = explode(" ", trim(fgets(STDIN)));

$n = $input[0];
$k = $input[1];

sort($setOfNumbers);

if($k==0){
    if($setOfNumbers[0]<=1){
        print(-1);
    }
    else{
        print($setOfNumbers[0]);
    }
}
else if($setOfNumbers[$k-1] == $setOfNumbers[$k]){
    print(-1);
}
else{
    print($setOfNumbers[$k-1]);
}

<?php

$input = explode(" ", trim(fgets(STDIN)));

$setOfNumbers = explode(" ", trim(fgets(STDIN)));

$n = $input[0];
$k = $input[1];

sort($setOfNumbers);

if($setOfNumbers[$k-1] == $setOfNumbers[$k] || $k == 0){
    print(-1);
}
else{
    print($setOfNumbers[$k-1]);
}

<?php

$input = explode(" ", trim(fgets(STDIN)));

$setOfNumbers = explode(" ", trim(fgets(STDIN)));

$n = $input[0];
$k = $input[1];

sort($setOfNumbers);

if($setOfNumbers[$k-1] == $setOfNumbers[$k]){
    print(-1);
}
else{
    print($setOfNumbers[$k-1]);
}

<?php

$input = explode(" ", trim(fgets(STDIN)));

$setOfNumbers = explode(" ", trim(fgets(STDIN)));

$n = $input[0];
$k = $input[1];

sort($setOfNumbers);

if($k==1){
    if($setOfNumbers[0]<=1){
        print(-1);
    }
    else{
        print($setOfNumbers[0]);
    }
}
else if($setOfNumbers[$k-1] == $setOfNumbers[$k]){
    print(-1);
}
else{
    print($setOfNumbers[$k-1]);
}


<?php

function search($str) {
  // code goes here
  if (substr($str, 0, 4) == "Tetr") {
    return 4;
  }elseif (substr($str, 0, 4) == "Cube") {
    return 6;
  }elseif (substr($str, 0, 4) == "Octa") {
    return 8;
  }elseif (substr($str, 0, 4) == "Dode") {
    return 12;
  }elseif (substr($str, 0, 4) == "Icos") {
    return 20;
  }
}

// keep this function call here
$file = fopen('php://stdin', 'r');
// $file = fopen('input.txt', 'r');
$line = fgets($file);
$sum = 0;
for ($i=0; $i < $line; $i++) {
  $str = fgets($file);
  $sum += search($str);
}
echo $sum;
// $str = fgets($file);
// $arr = explode(' ', $str);
// echo search($str);
?>

<?php
$a = array(Tetrahedron => 4, Cube => 6, Octahedron => 8, Dodecahedron => 12, Icosahedron => 20);
$b = trim(fgets(STDIN));
$c = 0;
for($x = 0; $x < $b; $x++)
{
     $d = trim(fgets(STDIN));
     $c += $a[$d];
}
print $c;
?>

<?php

$data1 = (int) trim(fgets(STDIN));
$data2 = [];
for ($i = 0; $i<$data1; $i++){
	array_push($data2, trim(fgets(STDIN)));
}

$main = new MainClass;

echo $main->solution($data1, $data2);

// End of interface

class MainClass {
	public $problemLink = 'https://codeforces.com/problemset/problem/785/A';
	public $submissionLink = '';

	public function solution($n, $s)
	{
		$res = 0;
			for($i = 0; $i < $n; $i++){
				switch ($s[$i]) {
					case 'Tetrahedron':
						$res = $res + 4;
						break;
					case 'Cube':
						$res = $res + 6;
						break;
					case 'Octahedron':
						$res = $res + 8;
						break;
					case 'Dodecahedron':
						$res = $res + 12;
						break;
					case 'Icosahedron':
						$res = $res + 20;
						break;
				}
			}
			return $res;
	}

}

<?php

// Interface of codeforces.com

$data1 = (int) trim(fgets(STDIN));
$data2 = [];
for ($i = 0; $i<$data1; $i++){
	array_push($data2, trim(fgets(STDIN)));
}

echo solution($data1, $data2);

// End of interface

function solution($n, $s){
	$res = 0;
	for($i = 0; $i < $n; $i++){
			switch ($s[$i]) {
				case 'Tetrahedron':
					$res = $res + 4;
					break;
				case 'Cube':
					$res = $res + 6;
					break;
				case 'Octahedron':
					$res = $res + 8;
					break;
				case 'Dodecahedron':
					$res = $res + 12;
					break;
				case 'Icosahedron':
					$res = $res + 20;
					break;
			}
	}
	return $res;
};
?>

<?php
$count = (int) trim(fgets(STDIN));
$array = [
    'Tetrahedron' => 4,
    'Cube' => 6,
    'Octahedron' => 8,
    'Dodecahedron' => 12,
    'Icosahedron' => 20,
];
$sum = 0;
for ($i = 1; $i <= $count; $i++) {
    $sum += $array[trim(fgets(STDIN))];
}

echo $sum;

<?php
$tst = readline();
$ans = 0;
while($tst--)
{
	$str = fgets(STDIN);
	if($str[0] == 'I') $ans += 20;
	else if($str[0] == 'D') $ans += 12;
	else if($str[0] == 'O') $ans += 8;
	else if($str[0] == 'C') $ans += 6;
	else if($str[0] == 'T') $ans += 4;
}
echo $ans."\n";

<?php
fscanf(STDIN, "%d", $n);
$i = array();
for ($j=0; $j<$n; $j++) {
    array_push($i, fscanf(STDIN, "%s"));
}
$const = ["Tetrahedron" => 4, "Cube" => 6, "Octahedron" => 8, "Dodecahedron" => 12, "Icosahedron" => 20];

$total = 0;
for ($k=0; $k<$n; $k++) {
    $total += $const[$i[$k][0]];
}

echo $total;

?>

<?php

// your code goes here

$r = 0;

$n = trim(fgets(STDIN));
$n += 0;

for($i = 0; $i < $n; $i++):
	$v = trim(fgets(STDIN));
	$v = strtolower($v);

	switch($v) {
		case "tetrahedron":
			$r += 4;
			break;
		case "cube":
			$r += 6;
			break;
		case "octahedron":
			$r += 8;
			break;
		case "dodecahedron":
			$r += 12;
			break;
		case "icosahedron":
			$r += 20;
			break;
	}
endfor;

echo $r . PHP_EOL;

<?php
    function pere($a){
        if ($a == 'Tetrahedron'){
            return 4;
        }
        if ($a == 'Cube'){
            return 6;
        }
        if ($a == 'Octahedron'){
            return 8;
        }
        if ($a == 'Dodecahedron'){
            return 12;
        }
        if ($a == 'Icosahedron'){
            return 20;
        }
    }
    fscanf(STDIN, "%d", $n);
    //$v = array();
    $ans = 0;
    for ($i = 0; $i < $n; $i++){
        fscanf(STDIN, "%s", $arr);
        $ans = $ans + pere($arr);
    }
    echo $ans;

<?php
    function pere(&$a){
        if ($a == 'Tetrahedron'){
            return 4;
        }
        if ($a == 'Cube'){
            return 6;
        }
        if ($a == 'Octahedron'){
            return 8;
        }
        if ($a == 'Dodecahedron'){
            return 12;
        }
        if ($a == 'Icosahedron'){
            return 20;
        }
    }
    fscanf(STDIN, "%d", $n);
    //$v = array();
    $ans = 0;
    for ($i = 0; $i < $n; $i++){
        fscanf(STDIN, "%s", $arr);
        $ans = $ans + pere($arr);
    }
    echo $ans;

<?php
fscanf(STDIN,"%d",$n);
$ans=0;
while($n--)
{
    fscanf(STDIN,"%s",$s);
    if($s=='Tetrahedron')
    $ans+=4;
    if($s=='Cube')
    $ans+=6;
    if($s=='Octahedron')
    $ans+=8;
    if($s=='Dodecahedron')
    $ans+=12;
    if($s=='Icosahedron')
    $ans+=20;
}
echo $ans;
?>

<?php
$n=fgets(STDIN);
$result=0;
$shekl=["Tetrahedron" =>4,"Cube"=>6,"Dodecahedron"=>12,"Icosahedron"=>20,"Octahedron"=>8];
for ($i=0;$i<$n;$i++) {
      $a=trim(fgets(STDIN));
      $result+=$shekl[$a];
}
echo $result;

<?php
fscanf(STDIN,"%d",$n);
$totalFaces=0;
for($i=0;$i<$n;$i++)
{
	fscanf(STDIN,"%s",$str[$i]);
	if($str[$i]=="Tetrahedron")
		$totalFaces+=4;
	elseif ($str[$i]=="Cube") {

		$totalFaces+=6;
	}
	elseif ($str[$i]=="Octahedron") {

		$totalFaces+=8;
	}
    	elseif ($str[$i]=="Dodecahedron") {

		$totalFaces+=12;
	}
	else
		$totalFaces+=20;
}
echo $totalFaces;

<?php
fscanf(STDIN, '%d', $a);
$c = 0;
for ($i=0; $i<$a; $i++)
{
    switch(strtolower(trim(fgets(STDIN))))
    {
        case "tetrahedron":
            $c += 4;
            break;
        case "cube":
            $c += 6;
            break;
        case "octahedron":
            $c += 8;
            break;
        case "dodecahedron":
            $c += 12;
            break;
        case "icosahedron":
            $c += 20;
            break;
    }
}
echo $c;

<?php
error_reporting(0);
$handle = fopen("php://stdin", "r");
$data = explode("\n", stream_get_contents(fopen("php://stdin", "r")));
$input = [];

foreach ($data as $index => $line) {
    $input[$index] = explode(" ", trim($line));
}

// Solve past this line
$shapeLibrary = [
    'Tetrahedron'  => 4,
    'Cube'         => 6,
    'Octahedron'   => 8,
    'Dodecahedron' => 12,
    'Icosahedron'  => 20
];
$shapes = array_slice($input, 1);
$output = 0;

foreach ($shapes as $shape) {
    $output += $shapeLibrary[$shape[0]];
}

echo $output;

<?php
$n = fgets(STDIN);
$c = 0;
for($i = 0; $i < $n; $i++) {
    switch(trim(fgets(STDIN))) {
        case 'Tetrahedron':
            $c += 4;
            break;
        case 'Cube':
            $c += 6;
            break;
        case 'Octahedron':
            $c += 8;
            break;
        case 'Dodecahedron':
            $c += 12;
            break;
        case 'Icosahedron':
            $c += 20;
            break;
    }
}
echo $c;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 1:11
 */
class stdIn{var $ntxt = 0;var $nline = 0;var $arr_txt;var $arr_line;var $linex;var $liney;
    function stdIn($local = false){if($local){$dir = fopen("input.txt", 'r');}else{$dir = fopen("php://stdin", 'r');}
        $datatxt = stream_get_contents($dir);$del = Array("\n","\r","\n\r");$data = explode("\n",$datatxt);	$il = 0;$id = 0;
        foreach($data as $line){if(strlen($line) > 0){$line = str_replace($del,'',$line);$dataex[] = $line;$text = explode(" ",$line);
            foreach($text as $txt){$arr_txt[] = $txt;$this->linex[$id] = $il;$this->liney[$il] = $id;$id++;}}$il++;}$this->arr_line = $dataex;$this->arr_txt  = $arr_txt;}
    function G(){$ret = $this->arr_txt[$this->ntxt++];$this->nline = $this->linex[$this->ntxt];return $ret;}
    function GL(){$this->ntxt = $this->liney[$this->nline]+1;return $this->arr_line[$this->nline++];}} /*init*/

$inp = new stdIn(false);
$n = $inp->arr_line[0];
$gran = 0;
for ($i=1;$i<$n+1;$i++){
    $str = $inp->arr_line[$i];
    switch ($str){
        case "Tetrahedron":
            $gran = $gran + 4  ;
            break;
        case "Cube":
            $gran = $gran +  6 ;
            break;
        case "Octahedron":
            $gran = $gran + 8  ;
            break;
        case "Dodecahedron":
            $gran = $gran +  12 ;
            break;
        case "Icosahedron":
            $gran = $gran + 20  ;
            break;

    }
}
echo $gran;


<?php

//მე რა მამღერებს, უძირო ზეცა, ზამბახისფერი (:)

$diadiSityva = 0;

list($n,$k,$m) = explode(" ",trim(fgets(STDIN)));

$names = explode(" ",trim(fgets(STDIN)));

$cost = explode(" ",trim(fgets(STDIN)));

for($i = 0; $i < $n; $i++)
    $tinatini[$names[$i]]=$cost[$i];

for($i = 0; $i < $k; $i++){
    $indexes = explode(" ",trim(fgets(STDIN)));

    $minimumi = 1000000001;

    for($x = 1; $x < count($indexes); $x++)
        $minimumi = min($minimumi,$tinatini[$names[$indexes[$x]-1]]);

    for($x = 1; $x < count($indexes); $x++)
        $tinatini[$names[$indexes[$x]-1]] = $minimumi;
}

$newNames = explode(" ", trim(fgets(STDIN)));

for($i = 0; $i < count($newNames); $i++)
    $diadiSityva+=$tinatini[$newNames[$i]];

echo $diadiSityva;

?>

<?php

//fscanf(STDIN, "%d", $t);
$values = array_map('intval', explode(' ',trim(fgets(STDIN))));
$n = $values[0];
$k = $values[1];
$m = $values[2];

//words
$strings = explode(' ',trim(fgets(STDIN)));
//costs
$price = array_map('intval', explode(' ',trim(fgets(STDIN))));

for($i = 0; $i < $n; $i++) {
	$cost[$strings[$i]] = $price[$i];
}

$mini = max($cost);
while($k--) {
	$words = array_map('intval', explode(' ',trim(fgets(STDIN))));
	$min_cost = $mini;
	//minimum cost
	for($i = 1; $i < count($words); $i++) {
		if ( $price[$words[$i]-1] < $min_cost) {
			$min_cost = $cost[$strings[$words[$i]-1]];
		}
	}
	//update costs
	for($i = 1; $i < count($words); $i++) {
			$cost[$strings[$words[$i]-1]] = $min_cost;
	}
}

$sentence = explode(' ',trim(fgets(STDIN)));
$res = 0;
for($i = 0; $i < $m; $i++) {
	$res += $cost[$sentence[$i]];
}

echo $res."\n";

<?php
list($n,$k,$m) = explode(" ",trim(fgets(STDIN)));
$words = explode(" ",trim(fgets(STDIN)));
$prices = explode(" ",trim(fgets(STDIN)));
$max_val = 1e9;
$group_of_word = array_fill(0,$n,-1);
$min_price_per_group = array_fill(0,$k,$max_val);
for($group=0; $group<$k; $group++){
	$pertenecen = explode(" ",trim(fgets(STDIN)));
	for($index = 1; $index < count($pertenecen); $index++){
		$group_of_word[$words[$pertenecen[$index]-1]] = $group;
		$min_price_per_group[$group] = min($min_price_per_group[$group],$prices[$pertenecen[$index]-1]);
	}
}
$message = explode(" ",trim(fgets(STDIN)));
$ans = 0;
for($i=0; $i<count($message); $i++){
	$ans += $min_price_per_group[$group_of_word[$message[$i]]];
}
print $ans
?>


<?php
$n = trim(fgets(STDIN));
$g = false;
for ($i = 1; $i <= $n; $i++) {
    $s = explode(" ", trim(fgets(STDIN)));
    if (($s[1] >= 2400) and ($s[2] > $s[1])) {
        $g = true;
    }
}
if ($g) {
    print "YES";
} else {
    print "NO";
}
?>

<?php
$dir = fopen("php://stdin", 'r');
$s = stream_get_contents($dir);
$a = explode("\n", $s);
//$s = str_replace("\n", "", $s);
/*
$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$n);
$a = array();
for($a_i = 0; $a_i < $n; $a_i++) {
   $a_temp = fgets($handle);
   $a[] = explode(" ",$a_temp);
  array_walk($a[$a_i],'intval');
}
*/
/*
$n=3;

$a = [
	['Burunduk1', 2400, 2400],
	['BudAlNik', 2390, 2431],
	['subscriber', -2500, -2450]
];
*/
$n=$a[0];
$good = false;
for($i=0; $i<$n ;$i++){
	$x = explode(" ", $a[$i+1]);
	if(intval($x[1]) >= 2400 &&  intval($x[2]) > intval($x[1])){
		$good = true;
		break;
	}
}
if($good){
	print "YES";
}else{
	print "NO";
}

<?php

fscanf(STDIN, "%d\n", $number);
for ($i = 0; $i < $number;$i++) {
    $string = trim(fgets(STDIN));
    $pieces = explode(" ", $string);
    if($pieces[2] > $pieces[1] && $pieces[1] > 2399) {
        echo 'YES';
        die();
    }
}
echo 'NO';

<?php

$n = intval(trim(fgets(STDIN)));

$answer = 'NO';

for( $i=0; $i<$n; $i++ ) {
	$line = trim(fgets(STDIN));
	$outscoredParticipantInfo = explode(' ',$line);

	$before = intval($outscoredParticipantInfo[1]);
	$after = intval($outscoredParticipantInfo[2]);
	if( 2400 <= $before && $before < $after )
	{
		$answer = 'YES';
	}
}

print $answer.PHP_EOL;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$answ="NO";
$i=0;
while ($i<(int)$s) {
	$i++;
	list($name,$before,$after)=explode(" ",trim(fgets($stdin)));
	if($before>=2400&&($after>2400&&$after>$before)){
		$answ="YES";

		break;

	}

}
echo $answ;

<?php
$fp = fopen('php://stdin', 'r');
$n = (int)fgets($fp);
for($i = 0; $i < $n; ++$i) {
	list($name, $before, $after) = explode(' ', fgets($fp));
	$before = intval($before);
	$after = intval($after);
	if ($after > $before && $before >= 2400) {
		die('YES');
	}
}
die('NO');

<?php
$dir = fopen("php://stdin", 'r');
$s = stream_get_contents($dir);
$a = explode("\n", $s);
//$s = str_replace("\n", "", $s);
/*
$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$n);
$a = array();
for($a_i = 0; $a_i < $n; $a_i++) {
   $a_temp = fgets($handle);
   $a[] = explode(" ",$a_temp);
  array_walk($a[$a_i],'intval');
}
*/
/*
$n=3;

$a = [
	['Burunduk1', 2400, 2400],
	['BudAlNik', 2390, 2431],
	['subscriber', -2500, -2450]
];
*/
$n=$a[0];
$good = false;
for($i=0; $i<3 ;$i++){
	$x = explode(" ", $a[$i+1]);
	if(intval($x[1]) >= 2400 &&  intval($x[2]) > intval($x[1])){
		$good = true;
		break;
	}
}
if($good){
	print "YES";
}else{
	print "NO";
}

$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$n);
$arr_temp = fgets($handle);
$arr = explode(" ",$arr_temp);
array_walk($handles,'intval');

$n=3;
$handles = [
	['Burunduk1', 2526, 2537],
	['BudAlNik', 2084, 2214],
	['subscriber', 2833, 2749]
];
$good = false;
for($i=0; $i<3 ;$i++){
	if($handles[$i][1] > 2400 &&  $handles[$i][2] > $handles[$i][1]){
		$good = true;
		break;
	}
}
if($good){
	echo "YES";
}else{
	echo "NO";
}

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$answ="NO";
while (!feof($stdin)) {
	list($name,$before,$after)=explode(" ",trim(fgets($stdin)));
	if($before>=2400&&$after>2400){
		$answ="YES";
	}

}

echo $answ;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$answ="NO";
$i=0;
while ($i<(int)$s) {
	$i++;
	list($name,$before,$after)=explode(" ",trim(fgets($stdin)));
	if($before>=2400&&$after>2400){
		$answ="YES";

		break;

	}

}
echo $answ;

<?php
$fp = fopen('php://stdin', 'r');
$n = (int)fgets($fp);
for($i = 0; $i < $n; ++$i) {
	list($name, $before, $after) = explode(' ', fgets($fp));
	if ($after > $before && $before > 2400) {
		die('YES');
	}
}
die('NO');

<?php
$fp = fopen('php://stdin', 'r');
$n = (int)fgets($fp);
for($i = 0; $i < $n; ++$i) {
	list($name, $before, $after) = explode(' ', fgets($fp));
	if ($after > $before && $before >= 2400) {
		die('YES');
	}
}
die('NO');


<?php
$stdin=fopen('php://stdin','r');
fscanf($stdin,"%d %d",$n,$d);

$h=explode(' ',fgets($stdin));

$ans=0;
foreach($h as $i => $a)
    foreach($h as $j => $b)
        if($i!=$j && abs($a-$b)<=$d) $ans++;

echo $ans;

<?php
// last submit in this semester
$stdin=fopen('php://stdin','r');
fscanf($stdin,"%d %d",$n,$d);

$height=explode(' ',fgets($stdin));

$ans=0;
for($i=0 ;$i<$n ;$i++)
{
	for($j=$i+1 ;$j<$n ;$j++)
	{
		if(abs($height[$i]-$height[$j])<=$d) $ans+=2;
	}
}
printf("%d\n",$ans);

<?php
$stdin=fopen('php://stdin','r');
fscanf($stdin,"%d %d",$n,$d);

$height=explode(' ',fgets($stdin));

$ans=0;
foreach($height as $i => $a)
    foreach($height as $j => $b)
        if($i!=$j && abs($a-$b)<=$d) $ans++;

echo $ans;

<?php

$line0 = trim(fgets(STDIN));
$line1 = trim(fgets(STDIN));

$data = explode(' ', $line0);
$delta = $data[1]; //  разница в росте

$heights = explode(' ', $line1);

for ($j = 0; $j < count($heights); $j++) {
	for ($i = 0; $i < count($heights); $i++) {
		if ($j != $i) {
			$d = abs($heights[$j] - $heights[$i]);
			$pairs[] = $d;
		}
	}
}

$agents = 0;

for ($i = 0; $i < count($pairs); $i++) {
	if ($pairs[$i] <= $delta) {
		$agents = $agents + 1;
	}
}

echo $agents . "\n";

?>

<?php
$stdout = fopen('php://stdout', 'w');
$h = fopen('php://stdin', 'r');

$s1 = trim(fgets($h));
$s = trim(fgets($h));

$vhdannie=explode(' ', $s1);
$n=(int)$vhdannie[0];
$d=(int)$vhdannie[1];
$otryad=explode(' ', $s);
if ((is_integer($n) && $n>=1 && $n<=1000)&&(is_integer($d) && $d>=1 && $d<=exp(9*log(10))))
{ //проверка диапозона для n
    $f=true;
    for ($i=0; $i<=$n-1; $i++)
    {// проверка данных роста солдат
        if (($otryad[$i]<1)||($otryad[$i]>exp(9*log(10))))
        {$f=false;}
    }
    if ($f)
    {
        $count=0;
        for ($i=0; $i<$n-1; $i++)
        {
            for ($j=$i+1; $j<$n; $j++)
            {
                $h=abs($otryad[$i]-$otryad[$j]);
                if ($h<=$d) {$count++;}
            }
        }
        $count=$count*2;
        fputs(STDOUT, "$count");
    }
}
?>

<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');

    $n_d = explode(" ", fgets($stdin));
    $numbers = explode(" ", fgets($stdin));

    $count_pairs=0;
    for($i=0;$i<$n_d[0];++$i){
        for($j=0;$j<$n_d[0];++$j){
            if((abs($numbers[$i]-$numbers[$j]) <= $n_d[1])&&($i!=$j)) $count_pairs++;
        }
    }

    fputs($stdout, $count_pairs++);
?>

<?php
$stdout = fopen('php://stdout', 'w');
fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$s1 = trim(fgets($h));
$s = trim(fgets($h));
$len1 = strlen($s1);
$len = strlen($s);
$r=stripos($s1,' ');
$n=(int)substr($s1, 0, $r);
$d=(int)substr($s1, $r+1, $len1-$r-1);
if (($n>=1 && $n<=1000)&&($d>=1 && $d<=exp(9*log(10))))
	{
for ($i=1; $i<=$n-1; $i++)
{
	$r=stripos($s,' ');
	$mas[$i]=substr($s, 0, $r);
	$s=substr($s, $r+1, $len-$r-1);
	}
	$mas[$n]=$s;
fputs(STDOUT, "Vihodnie dannie:  ");
	$count=0;
	for ($i=1; $i<=$n-1; $i++)
	{
		for ($j=$i+1; $j<=$n; $j++)
		{
			$h=abs($mas[$i]-$mas[$j]);
			if ($h<=$d) {$count++;}
			}
		}
		$count=$count*2;
		fputs(STDOUT, "$count");
	}
	else
	{fputs(STDOUT, "Nevernii diapazon");
		}
?>

<?php
// last submit in this semester
fscanf(STDIN,"%d %d",$n,$d);

$height=array();
for($i=0 ;$i<$n ;$i++)
{
	fscanf(STDIN,"%d",$tmp);
	$height[]=$tmp;
}

$ans=0;
for($i=0 ;$i<$n ;$i++)
{
	for($j=$i+1 ;$j<$n ;$j++)
	{
		if(abs($height[i]-$height[j])<=$d) $ans+=2;
	}
}
printf("%d\n",$ans);

<?php
// last submit in this semester
fscanf(STDIN,"%d %d",$n,$d);

$height=array($n);
for($i=0 ;$i<$n ;$i++) fscanf(STDIN,"%d",$height[$i]);

$ans=0;
for($i=0 ;$i<$n ;$i++)
{
	for($j=$i+1 ;$j<$n ;$j++)
	{
		if(abs($height[$i]-$height[$j])<=$d) $ans+=2;
	}
}
printf("%d\n",$ans);

<?php
// last submit in this semester
fscanf(STDIN,"%d %d",$n,$d);

$height=array($n);
for($i=0 ;$i<$n ;$i++) fscanf(STDIN,"%d",$height[$i]);
for($i=0 ;$i<$n ;$i++) echo $height[$i];

$ans=0;
for($i=0 ;$i<$n ;$i++)
{
	for($j=$i+1 ;$j<$n ;$j++)
	{
		if(abs($height[$i]-$height[$j])<=$d) $ans+=2;
	}
}
printf("%d\n",$ans);

<?php
// last submit in this semester
$stdin=fopen(STDIN,'r');
fscanf($stdin,"%d %d",$n,$d);

$height=explode(' ',fgets($stdin));

$ans=0;
for($i=0 ;$i<$n ;$i++)
{
	for($j=$i+1 ;$j<$n ;$j++)
	{
		if(abs($height[$i]-$height[$j])<=$d) $ans+=2;
	}
}
printf("%d\n",$ans);

<?php
$stdin=fopen('php://stdin','r');
fscanf($stdin,"%d %d",$n,$d);

$height=explode(' ',fgets($stdin));

$ans=0;
foreach($height as $a)
	foreach($height as $b)
		if(abs($a-$b)<=$d) $ans++;

echo $ans;


<?php
$handle = fopen ("php://stdin","r");
$n = fgets($handle);

$n=explode("^",$n);
$left = $n[0];
$right = $n[1];

$sr=0;
$sl=0;
$ctmp=1;

for($i=strlen($left)-1;$i>=0;$i--)
{
        if($left[$i] != "=")
        $sl+=$left[$i]*$ctmp;

$ctmp++;
}
$ctmp=1;
for($i=0;$i<strlen($right);$i++)
{
        if($right[$i] != "=")
        $sr+=$right[$i]*$ctmp;
$ctmp++;
}

if($sr==$sl)
echo 'balance';
else if ($sr>$sl)
echo 'right';
else
echo 'left';

?>

<?php

$a = trim(fgets(STDIN));

while($a[$i] !='^')
   $i++;
 $right = $i;
    $right2 = $i;
while($i>0)
{
    if($a[$j] == '=')
      $temp = 0;
    else
      $temp = $a[$j];

    $totalL = $totalL +($temp * $i);

    $i--;
    $j++;
}
$right++;
while($a[$right])
{
    if($a[$right] == '=')
      $temp = 0;
    else
      $temp = $a[$right];

    $totalR = $totalR +($temp * ($right-$right2));

    $right++;
}

if($totalR > $totalL)
   echo"right";
else if($totalR < $totalL)
    echo"left";
else
    echo"balance";
    ?>

<?php
$str=fgets(STDIN);
$de=explode("^",$str);
$s1=strrev($de[0]);
$s2=$de[1];
$left=0;
$right=0;
for($i=0;$i<strlen($s1);$i++){
    $te=$s1[$i];
    if($te!="="){
        $left+=($i+1)*intval($te,10);
    }
}

for($i=0;$i<strlen($s2);$i++){
    $te=$s2[$i];
    if($te!="="){
        $right+=($i+1)*intval($te,10);
    }
}

if($left==$right) echo "balance";
else if($left>$right) echo "left";
else echo "right";
?>

<?php
error_reporting("off");
//376A: Lever
$lever = trim(fgets(STDIN)); //$lever = "=^==";
$fulcrum = strpos($lever, "^");
$left = substr($lever, 0, $fulcrum);
$right = str_split(substr($lever, $fulcrum + 1));
$left = str_split(strrev($left));
$leftweight = 0;
$rightweight = 0;
foreach ($left as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $leftweight += $value * $pos;
    }
}
foreach ($right as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $rightweight += $value * $pos;
    }
}

if ($leftweight == $rightweight) {
    echo "balance";
} elseif ($leftweight > $rightweight) {
    echo "left";
} else {
    echo "right";
}
?>

<?php
error_reporting("off");
//376C: Divisible by Seven
$pieces = str_split(trim(fgets(STDIN))); //$pieces = str_split("2419323689");
$one = array_search("1", $pieces);
$six = array_search("6", $pieces);
$eight = array_search("8", $pieces);
$nine = array_search("9", $pieces);
unset($pieces[$one]);
unset($pieces[$six]);
unset($pieces[$eight]);
unset($pieces[$nine]);
sort($pieces);
$zeros = count(array_keys($pieces, "0"));
for ($i = 0; $i < $zeros; $i++) {
    unset($pieces[$i]);
}
$whatsleft = implode($pieces);
$modseven = fmod($whatsleft * 10000, 7);

if ($modseven == 0) {
    $special = 1869;
} elseif ($modseven == 1) {
    $special = 8196;
} elseif ($modseven == 2) {
    $special = 8916;
} elseif ($modseven == 3) {
    $special = 1698;
} elseif ($modseven == 4) {
    $special = 6891;
} elseif ($modseven == 5) {
    $special = 9186;
} elseif ($modseven == 6) {
    $special = 6189;
}

echo $whatsleft.$special.str_repeat("0", $zeros);
?>

<?php
error_reporting("off");
//376A: Lever
$lever = trim(fgets(STDIN)); $lever = "=^==";
$fulcrum = strpos($lever, "^");
$left = substr($lever, 0, $fulcrum);
$right = str_split(substr($lever, $fulcrum + 1));
$left = str_split(strrev($left));
$leftweight = 0;
$rightweight = 0;
foreach ($left as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $leftweight += $value * $pos;
    }
}
foreach ($right as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $rightweight += $value * $pos;
    }
}

if ($left == $right) {
    echo "balance";
} elseif ($left > $right) {
    echo "left";
} else {
    echo "right";
}
?>

<?php
error_reporting("off");
//376A: Lever
$lever = trim(fgets(STDIN)); //$lever = "=^==";
$fulcrum = strpos($lever, "^");
$left = substr($lever, 0, $fulcrum);
$right = str_split(substr($lever, $fulcrum + 1));
$left = str_split(strrev($left));
$leftweight = 0;
$rightweight = 0;
foreach ($left as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $leftweight += $value * $pos;
    }
}
foreach ($right as $key => $value) {
    if ($value !== "=") {
        $pos = $key + 1;
        $rightweight += $value * $pos;
    }
}

if ($left == $right) {
    echo "balance";
} elseif ($left > $right) {
    echo "left";
} else {
    echo "right";
}
?>