<?php
	function check($x)
	{
		$n = strlen($x);
		for ($i = 0; $i < $n; ++$i)
		{
			if ($x[$i] == 1) continue;
			if ($x[$i] == 4)
			{
				if ($i > 0 && $x[$i - 1] == 1) continue;
				if ($i - 1 > 0 && $x[$i - 1] == 4 && $x[$i - 2] == 1) continue;
			}
			return false;
		}
		return true;
	}

	$input = fgets(STDIN);
	if (check($input)) echo "YES";
	else echo "NO";
	echo "\n";

?>


<?php
$a=trim(fgets(STDIN));
if(preg_match('/^(14|1|144)+$/',&a))echo "YES";
else echo "NO";
echo '<br/>';
?>


<?php
$a=trim(fgets(STDIN));
if(preg_match('/^(14|1|144)+$/',$a))echo "YES";
else echo "NO";
echo '<br/>';
?>


<?php
$input = fgets(STDIN);
$res= $input + 1;
if ($res%2 == 0) {
    echo 0;
} else {
    echo 1;
}


<?php

$n = fgets(STDIN);
$s = fgets(STDIN);

echo array_reduce(array_map(function ($ones) {
    return strlen($ones);
}, explode('0', $s)), function ($number, $digit) {
    $number *= 10;
    return $number + $digit;
}, 0);


<?php
define("_DEBUG", 1);

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

if (!_DEBUG) $str = fgets($fp);
else
	$str = '9';

$n = (int)$str;

if (!_DEBUG)
{
	$str = fgets($fp);
}
else
{
	$str = '110011101';
}

$mas = explode('0', $str);
$res = '';
for ($i = 0; $i < sizeof($mas); $i++)
{
	$res .= strlen($mas[$i]);
}

echo $res;
?>


<?php
$pokemons = array("vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon");
$num = (int)trim(fgets(STDIN));
$str = trim(fgets(STDIN));

print 'jolteon';
?>


<?php
fscanf(STDIN,"%d",$n);
$str=trim(fgets(STDIN));
$trgetStr="";
for ($i=0; $i <strlen($str) ; $i++)
{
	if($str[$i]=='.')
		continue;
	else
		$trgetStr.=$str[$i];

}
$eve=[
		 0=>"vaporeon",
		 1=>"jolteon",
		 2=>"flareon",
		 3=>"espeon",
		 4=>"umbreon",
		 5=>"leafeon",
		 6=>"glaceon",
		 7=>"sylveon"
    ];

   $flag=0;
   $max=0;
for ($i=0; $i <count($eve) ; $i++)
{   $count=0;
   for ($j=0; $j <5 ; $j++)
    {

   	   if($eve[$i][$j]==$trgetStr[$count])
   	   {

   	   	   $count++;
   	   	  // $str3=$eve[$i];

   	   	   if($count==strlen($trgetStr))
   	   	   {
             //echo "$str3\n";
   	   	   	$flag=1;
   	   	   	break;
   	   	   }
   	   }

    }
          if($count>=$max)
          {
          	$max=$count;
          	$str3=$eve[$i];
          }
          //echo "$max\n";

   if($flag==1)
   	break;

}
echo "$str3\n";


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = array();
for($x = 1; $x <= 2; $x++)
{
     $d = str_split(trim(fgets(STDIN)));
     if($x == 1)
     {
          array_push($c, $d[0]);
          array_push($c, $d[$a - 1]);
     }
     if($x == 2)
     {
          array_push($c, $d[0]);
          array_push($c, $d[$b - 1]);
     }
}
$e = array_unique($c);
if(count($e) == 4)
{
     print "YES";
}
else
{
     print "NO";
}
?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
list($m, $n) = explode(" ", trim(fgets($file)));
$x = trim(fgets($file));
$y = trim(fgets($file));

$t = $x[0] . $y[0] . $x[$m - 1] . $y[$n - 1];
if ($t == '<v>^' || $t == '>^<V') {
    echo "YES";
}else{
    echo "NO";
}


<?php
error_reporting(0);
$lines = explode("\n", file_get_contents("php://stdin"));

$lines[0] = explode(" ", $lines[0]);

$horiz = str_split($lines[1]);
$vert = str_split($lines[2]);

array_pop($horiz);

if($horiz[0]=="<" && $vert[0]=="^") {
    echo "NO";exit();
}
if($horiz[count($horiz)-1]==">" && $vert[count($vert)-1]=="v") {
    echo "NO";exit();
}

if($horiz[0]==">" && $vert[count($vert)-1]=="^") {
    echo "NO";exit();
}
if($horiz[count($horiz)-1]=="<" && $vert[0]=="v") {
    echo "NO";exit();
}

echo "YES";
?>


<?php
    $n = trim(fgets(STDIN));
    $a = str_split(trim(fgets(STDIN)));
    $bStart = false;
    $i = 0;
    foreach ($a AS $v) {
        if ($v == '+' && !$bStart) {
            $bStart = true;
        }

        if ($bStart) {
            if ($v == '+') {
                $i++;
            } else {
                $i--;
            }
        }
    }
    echo $i;
?>


<?php
list($n, $b, $p) = explode(" ", trim(fgets(STDIN)));
$y = $p * $n;
$x = ($n - 1) * (2*$b + 1);

print(number_format($x, $y));


<?php
// $n = 3;
// $d = 30;
// $arr = array(2,2,1);

$dir = fopen("php://stdin", 'r');
// $dir = fopen('text.txt', 'r');
$line1 = trim(fgets($dir));
$line1 = explode(' ', $line1);
$n = $line1[0];
$d = $line1[1];
$line2 = trim(fgets($dir));
$line2 = explode(' ', $line2);
$arr = array();
foreach ($line2 as $key => $value) {
    array_push($arr, $value);
}

// var_dump($arr,$n,$d);
// echo stream_get_contents($dir);

function devu($n,$d,$arr){
    $t = 0;
    $jok = -2;
    foreach ($arr as $key => $value) {
        $t += $value;
        $jok += 2;
    }
    $count = count($arr);
    $t = ($count-1)*10 + $t;
    if($d < $t)
        return -1;

    $l = intval(($d-$t)/5);

    $jok += $l;

    return $jok;
}

?>


<?php

$f = fopen ("php://stdin", 'r' ) ;
$lines = file("php://stdin");

function parseint($n){
    return(intval($n));
}

$n_time = array_map("parseint", explode(" ",(strval($lines[0]))));
$n = $n_time[0];
$times = $n_time[1];

$t = array_map("parseint", explode(" ",(strval($lines[1]))));

$song_duration = array_sum($t) + (10 * ($n - 1));
if($song_duration > $times){
    print "-1" ;

}
else{
    print ($times - array_sum($t))/5 ;
}

?>


<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}
function getStringList($number = 1){
    $chunk = "%s ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

function task(array $times, $d)
{
    $party_time = 0;
    $churu_jokes = 0;
    foreach ($times as $t) {
        $party_time += $t + 10;
        $churu_jokes += 2;
    }

    $party_time -= 10;
    $churu_jokes -= 2;
    $free_time = $d - $party_time;

    if ($party_time > $d or $free_time % 5 != 0) {
        return -1;
    }

    $churu_jokes += $free_time / 5;

    return $churu_jokes;
}

list($n, $d) = getIntList(2);
$minutes = getIntList($n);

echo task($minutes, $d) . PHP_EOL;
?>


<?php
$a = " " . trim(fgets(STDIN));
$b = "CODEFORCES";
$c = strpos($a, $b);
if(($c == 1) || ($c == (strlen($a) - 10)))
{
    print "YES";
}
else
{
    $d = array("C", "CO", "COD", "CODE", "CODEF", "CODEFO", "CODEFOR", "CODEFORC", "CODEFORCE");
    $e = array("ODEFORCES", "DEFORCES", "EFORCES", "FORCES", "ORCES", "RCES", "CES", "ES", "S");
    $f = 0;
    for($x = 0; $x < 9; $x++)
    {
        $g = substr($a, 1, $x + 1);
        $h = substr($a, strlen($a) - 9 + $x);
        if(($g == $d[$x]) && ($h == $e[$x]))
        {
            $f = 1;
            break;
        }
    }
    if($f == 1)
    {
        print "YES";
    }
    else
    {
        print "NO";
    }
}
?>


<?PHP

$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$initialBanner = fgets($fileIN);
$searchCodeforces = "CODEFORCES";

$sufixe = array();
$prefixe = array();

$l = 0;
$r = 0;
while ($l < min(strlen($searchCodeforces), strlen($initialBanner))) {
    if ($initialBanner[$l] == $searchCodeforces[$l]) {
        ++$l;
    } else {
        break;
    }
}

while ($r < min(strlen($searchCodeforces), strlen($initialBanner))) {
    if ($initialBanner[strlen($initialBanner) - $r - 1] == $searchCodeforces[strlen($searchCodeforces) - $r - 1]) {
        ++$r;
    } else {
        break;
    }
}

if ($l + $r >= 10) {
    fprintf($fileOUT, "YES\n");
} else {
    fprintf($fileOUT, "NO\n");
}

fclose($fileIN);
fclose($fileOUT);

?>


<?php
$s = trim(fgets(STDIN));
if (preg_match('#^(CODEFORCES\w+|\w+CODEFORCES|CODE\w+FORCES)$#s', $s)) {
  echo "YES\n";
} else {
  echo "NO\n";
}


<?php
$s = trim(fgets(STDIN));
$answer = 'NO';
// Ответ по умолчанию
$s = strstr($s,"C");
if($s) {
	$s = strstr($s,"O");
	if($s) {
		$s = strstr($s,"D");
		if($s) {
			$s = strstr($s,"E");
			if($s) {
				$s = strstr($s,"F");
				if($s) {
					$s = strstr($s,"O");
					if($s) {
						$s = strstr($s,"R");
						if($s) {
							$s = strstr($s,"C");
							if($s) {
								$s = strstr($s,"E");
								if($s) {
									$s = strstr($s,"S");
									if($s) {
										// Если все условия выполнились
										$answer = 'YES';
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
print($answer);
?>


<?php
$_fp = fopen("php://stdin", "r");

$input = trim(preg_replace('/\s+/', ' ', fgets($_fp)));
$vowels = ['A', 'O', 'Y', 'E', 'U', 'I'];
// echo str_replace($input[0], '.r', $input);
// die;

$newString = $input;
for ($i=0; $i < count($vowels); $i++)
{
    $newString = str_replace($vowels[$i], '', $newString);
    $newString = str_replace(strtolower($vowels[$i]), '', $newString);
}

for ($i=0; $i < strlen($newString); $i++)
{
    if(!strpos($newString[$i], '.'))
    {
        $newString = str_replace($newString[$i], "." . $newString[$i], $newString);
    } else {
        continue;
    }
}

echo $newString;


<?php
$a=str_replace("
","",fgets(STDIN));
$a=strtolower($a);
$a=str_replace(array("a","e","i","o","u","y"),"",$a);
$a=str_split($a);
$a=implode(".",$a);
echo $a;

?>


<?php

$str = fgets(STDIN, 1000);
$len = strlen($str);
if($len>=1 && $len<=100){
	$vowels = "AOYEUIaoyeui";
	if(preg_match('/[a-zA-Z]+/', $str)){
		$str = preg_replace('/[^AOYEUIaoyeui\\s]/', '.$0', $str);
		$str = preg_replace('/[AOYEUIaoyeui]/i', '', $str);
		echo strtolower($str);
	}
}

?>


<?php
	$baru='';

	$a=strtolower(trim(fgets(STDIN)));

	$v=array('a','o','y','e','u','i');

	$y=strlen($a);

	$baru=str_ireplace($v,'',$a);

	for($i=0;$i<=strlen($baru);$i++)
	{
		$baru="." . $baru;
	}

	echo $baru;

?>


<?php
$input = rtrim(fgets(STDIN));
$string = strtolower($input);
$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U", " ");
$noVowels = str_replace($vowels, "", $string);
$outputString = "";
for($x=0;$x<strlen($noVowels);$x++){
  $outputString=$outputString.".".$noVowels[$x];
}
echo $outputString;


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

    $str = preg_replace("/[aeouiy]+/i", "", $str);

    foreach (str_split($str) as $ch) {
        echo ".".$ch;
    }
?>


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

fscanf($fr, "%s", $str);

$str = strtolower($str);

$vowels = array("a", "e", "i", "o", "u");

$str = str_replace($vowels, "", $str);
$output = "";

for($i=0; $i < strlen($str); $i++) {
	$output .= "." . $str[$i];
}

fprintf($fw, $output);

fclose($fr);
fclose($fw);


<?php
$cin = fopen("php://stdin","r");
$input = fgets($cin,128);

$r = explode("+", trim($input));
sort($r, SORT_NUMERIC);

var_dump($r);
echo implode("+", $r);


<?php
	$in = explode('+',fgets(STDIN));
	sort($in);
	echo implode('+',$in);


<?php
    $str = fgets(STDIN);
    $str = explode("+", $str);
    sort($str);
    echo implode("+", $str);
?>


<?php $s = stream_get_contents(STDIN);$s = preg_split('/\+/', $s);sort($s);echo join('+', $s);


<?php
		function read_stdin()
	{
	        $fr=fopen("php://stdin","r");   // open our file pointer to read from stdin
	        $input = fgets($fr,128);        // read a maximum of 128 characters
	        $input = rtrim($input);         // trim any trailing spaces.
	        fclose ($fr);                   // close the file handle
	        return $input;                  // return the text entered
	}
	$string = read_stdin();
	$result = explode('+', $string);
	sort($result,SORT_NUMERIC);
	for($i=0;$i<$result.length();$i++){
		echo $result[$i].'+';
	}

 ?>


<?php
		function read_stdin()
	{
	        $fr=fopen("php://stdin","r");   // open our file pointer to read from stdin
	        $input = fgets($fr,128);        // read a maximum of 128 characters
	        $input = rtrim($input);         // trim any trailing spaces.
	        fclose ($fr);                   // close the file handle
	        return $input;                  // return the text entered
	}
	$string = read_stdin();
	$result = explode('+', $string);
	sort($result,SORT_NUMERIC);
	for($i=0;$i<count($result);$i++){
		if($i==(count($result)-1))
			echo $result;
		else
			echo $result[$i].'+';
	}

 ?>


$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) != 'yes'){
    echo "ABORTING!\n";
    exit;
}
echo $line;


<?php
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
$val = 0;
$counter = 1;
for($val<intval($line)) {
    $val = ($counter*($counter+1))/2;
}
if ($val == intval($line)) {
    print 'YES';
} else {
    print 'NO';
}


<?php
while($line = fgets(STDIN)){
    $lines[] = $line;
}

$length = $lines[0];
$str = $lines[1];
$newstr = '';

for($i = 0; $i < $length; $i++) {
    if($i == 0) {
        $newStr .= $str[$i];
        $last = $str[$i];
    }
    if ($last != $str[$i]) {
        $newStr .= $str[$i];
    }
    $last = $str[$i];
}

echo $length - strlen($newstr);


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = array_unique($b);
sort($c);
if($b[0] == 0)
{
     print count($c) - 1;
}
else
{
     print count($c);
}
?>


<?php
    $n = fgets(STDIN);
    $a = array_unique(explode(" ", (int)fgets(STDIN)));

    foreach ($a AS $k => $v) {
        if ($v == 0) {
            unset($a[$k]);
        }
    }

    funcMax($a, array());
    function funcMax($arr, $count) {
        $max = max($arr);
        $count[$max] = $max;
        foreach ($arr AS $key => $val) {
            if ($val == $max) {
                unset($arr[$key]);
            }
        }

        if (count($arr)) {
            funcMax($arr, $count);
        } else {
            echo count($count);
        }
    }

?>


<?php
while($s = fgets(STDIN)){
        $input .= $s;
}
$input = explode("\r\n", $input);
$digits = explode (" ", $input[0]);
unset ($input);
$a=$digits[0];
$b=$digits[1];
$r=$digits[2];
unset ($digits);

$ab= $a*$b;
$s= $r*2*$r*2;
$res= floor($ab/$s);
if ($res%2==0) {
echo "Second";
}
else echo "First";
?>


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Actual function for problem
function func($in) {
if ((2 * $in[0] < $in[2]) || (2 * $in[1] < $in[2])) {return "Second";} else return {"First";}
}

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


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Actual function for problem
function func($in) {
if ((2 * $in[0] < $in[2]) || (2 * $in[1] < $in[2])) {return "Second";} else {return "First";}
}

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


<?php
list($a, $b, $r) = explode(' ',trim(fgets(STDIN)));

if(2 * $r >= min($a, $b)) print 'Second'; else print 'First';
?>


<?php
list($prob, $min)=explode(" ",trim(fgets(STDIN)));

if ($min > 240) {

    echo 0;
}

$turbo=240 - $min;

for ($i=1; $i <= $prob; $i++) {

      $num += $i * 5;

      if ($i == $prob and $num < $turbo) {

          echo $i;
      }elseif ($num == $turbo) {
        echo $i;
    }elseif ($num > $turbo) {

        echo $i - 1;
        break;
    }

    }
?>


<?php
    $input = fgets(STDIN);
    $input = str_replace(' ', '', $input);
    $input = strtolower($input);
    $inputArray = str_split($input);
    $sizeArray = count($inputArray);
    $array = array("a", "e", "i", "o", "u", "y");
    $ban = false;
    foreach ($array as $key=>$valor) {
        if ($valor == $inputArray[$sizeArray-2]) {
            $ban = true;
            break;
        }
    }
    if ($ban) {
        echo "YES";
    }else{
        echo "NO";
    }
?>


<?php //http://rextester.com php 7.0.8
list($Parent,$Childs)=explode(' ',fgets(STDIN));
if($Parent<1&$Childs>0){echo'Impossible';return;}
$min=$Parent;
if($Childs>$Parent)$min=$Childs;
$max=$Parent;
if($Childs>0)$max+=$Childs-1;
echo $min.' '.$max;


<?php //http://rextester.com php 7.0.8
list($Parent,$Childs)=explode(' ',trim(fgets(STDIN)));
if($Parent<1&$Childs>0){echo'Impossible';return;}
$min=$Parent;
if($Childs>$Parent)$min=$Childs
$max=$Parent;
if($Childs>0)$max+=$Childs-1;
echo $min.' '.$max;


<?php //rextester.com:7.0.8--codeforces:7.0.12
list($a,$b)=explode(' ',fgets(STDIN));
if($a<1&$b>0){echo'Impossible';return;}
if($b!=0)$d=$a+$b-1;else$d=$a;echo max($a,$b).' '.$d;


<?php
  list( $grownups, $childs ) = explode( ' ', file_get_contents( "php://stdin" ) );

  if( $grownups == 0 )
      die( "Impossible" );

  $grownups = (int)$grownups;
  $childs   = (int)$childs;

  $min = 0;
  $max = 0;

  if( $grownups > $childs )
      $min = $grownups;
  else
      $min = $grownups + abs( $grownups - $childs );

  $max = $grownups + ( $childs > 0 ? $childs - 1 : 0 );

  echo $min, ' ', $max;


<?php

$n = (readline() - 1);
$input = (explode(" ",readline()));

for($i = 0; $i < $n; $i++){
    for($x = 0; $x < $n-1; $x++) {
        if($input[$x] > $input[$x+1]){
            $z = $input[$x];
            $input[$x] = $input[$x+1];
            $input[$x+1] = $z;
        }
    }
}

$output = implode(" ", $input);

print $output;

?>


<?php
$n=trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));

sort($a);
for($i=0;$i<$n;$i++)
{
echo $a[$i];
}
?>


<?php
    $arr = explode(" ", trim(fgets(STDIN)));
    sort($arr);
        for ($i = 0; $i < count($arr); $i++){
            echo ($arr[$i] . " ");
        }


<?php
$n= trim(fgets(STDIN));
$stolb = explode(" ",trim(fgets(STDIN)));
asort($stolb);
foreach ($stolb as $key)echo $key;


<?php
$n = fgets(STDIN);
$array = explode(" ", fgets(STDIN));
sort($array);
for($i=0;$i<$n;$i++){
    echo $array[$i]. ' ';
}


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
for($x = 1; $x <= 10000; $x++)
{
    if($b[0] > $b[1])
    {
        $b[0] = $b[0] - $b[1];
        rsort($b);
    }
    else
    {
        break;
    }
}
print array_sum($b);
?>


#!/usr/bin/env php
<?php
$count = trim(fgets(STDIN));

$line = trim(fgets(STDIN));
$array = array_map('intval', explode(' ', $line));

for(;;) {
	rsort($array);
	if ($array[0] !== $array[$count - 1] && $array[1] !== 0) {
		$array[0] = $array[0] - $array[1];
	} else {
		echo array_sum($array);exit();
	}
}


#!/usr/bin/env php
<?php
$count = trim(fgets(STDIN));

$line = trim(fgets(STDIN));
$array = array_map('intval', explode(' ', $line));

for(;;) {
	rsort($array);
	if ($array[0] !== $array[$count - 1]) {
		$array[0] = $array[0] - $array[1];
	} else {
		echo array_sum($array);exit();
	}
}


<?php
fscanf(STDIN,"%d",$lenth);
fscanf(STDIN,"%s",$str);
//echo substr_count($str,'BA');
for($i=0;$i<$lenth-1;$i++)
{
   $str1[$i]=$str[$i].$str[$i+1];
}
print_r(current(array_keys(array_count_values($str1))));


fscanf(STDIN,"%d\n",$length);
fscanf(STDIN,"%s\n",$string);

$output = [];

foreach (range(0, $length-2) as $index) {
    $subString = $string[$index].$string[$index+1];
    if(!isset($output[$subString])) {
        $output[$subString] = 0;
    }

    $output[$subString]++;

}

echo array_search(max($output),$output);


<?php

$stdin = fopen('php://stdin', 'r');
$type = trim(fgets($stdin));
$summ = 0;
for ($i = 2; $i < $num; $i++) {
    $summ += get_summ($num, $i);
}
$count = $num - 2;
for ($i = $count; $i > 0; $i--) {
    if ($summ % $i == 0 && $count % $i == 0) {
        $summ /= $i;
        $count /= $i;
    }
}

echo $summ . '/' . $count;

function get_summ($num, $base) {
    $result = 0;
    while ($num) {
        $result += $num % $base;
        $num = floor($num / $base);
    }
    return $result;
}


<?php

/*
 * http://codeforces.ru/problemset/problem/1/A
 */

function howMuch($side, $plate)
{
    return ($side % $plate == 0) ? $side/$plate : (parseInt($side/$plate) + 1);
}

$line = trim(file_get_contents('php://stdin'));
$data = explode(' ', $line);

echo howMuch($data[0], $data[2]) * howMuch($data[1], $data[2]);


<?php

/*
 * http://codeforces.ru/problemset/problem/1/A
 */

function howMuch($side, $plate)
{
    return ($side % $plate == 0) ? $side/$plate : (parseInt($side/$plate) + 1);
}

$line = trim(file_get_contents('php://stdin'));
$data = explode(' ', $line);

echo howMuch($data[0], $data[2]) * howMuch($data[1], $data[]);


<?php
error_reporting(0);
$dir = fopen("php://stdin", 'r');}
$datatxt = stream_get_contents($dir);
$text = explode(" ",$line);
$file = ceil($text[0]/$text[2])*ceil($text[1]/$text[2]);
echo $file;
?>


<?php
	fsanf(STDIN, %d, $m);
	fsanf(STDIN, %d, $n);
	fsanf(STDIN, %d, $a);

	printf ("%.0f",ceil($n/$a) * ceil($m/$a));
?>


<?php

function getSquare($n, $m, $a) {
	$result = 0;
	for($i = 0; $i < $n; $i+= $a) {
		for($j = 0; $j < $m; $j+= $a) {
			$result++;
		}
	}

	return $result;
}

if (!defined("TEST")) {

    $input = '';
    while(!feof(STDIN)) {
        $input .= fread(STDIN, 8192);
    }

    list($n, $m, $a) = sscanf($input, "%d %d %d");

    echo getSquare($n, $m, $a);
}


<?php
$board = array();
function calc()
{
    for ($i = 0; $i < 8; $i++)
    {
        $board[$i] = rtrim(fgets(STDIN));
    }
    if (dfs(7, 0, 0)) echo "WIN\n";
    else echo "LOSE\n";
}

function dfs($y, $x, $turn)
{
    if ($y - $turn >= 0 && $board[$y - $turn][$x] == 'S') return false;
    if ($turn >= 8) return true;
    for ($vy = -1; $vy <= 1; $vy++)
    {
        for ($vx = -1; $vx <= 1; $vx++)
        {
            $ny = $y + $vy;
            $nx = $x + $vx;
            if ($ny < 0 || $ny >= 8 || $nx < 0 || $ny >= 8) continue;
            if ($ny - $turn >= 0 && $board[$ny - $turn][$nx] == 'S') continue;
            if (dfs($ny, $nx, $turn + 1)) return true;

        }
    }
    return false;
}

calc();
?>


<?php
$area = array();
for( $i=0; $i<8; $i++) {
    $area[$i] = trim(fgets(STDIN));
}

$x = 0;
$y = 7;
$i = 0;
while(1) {
    if( is_free_point(($x+1),($y-1),$area) &&
        !is_danger_point(($x+1),($y-1),$area) ) {
        set_round($x,$y,$x+1,$y-1,$area);
        $x++;$y--;
    }
    else if( is_free_point(($x+1),($y),$area) &&
        !is_danger_point(($x+1),($y),$area) ) {
        set_round($x,$y,$x+1,$y,$area);
        $x++;
    }
    else if( is_free_point(($x),($y-1),$area) &&
        !is_danger_point(($x),($y-1),$area) ) {
        set_round($x,$y,$x,$y-1,$area);
        $y--;
    }
    else {
        set_round($x,$y,$x,$y,$area);
    }
}

function set_round($x1, $y1, $x2, $y2, &$area) {
    if($x2==7 && $y2==0) {
        die('WIN');
    }
    else {
        $area[$y1][$x1] = '.';
        $area[$y2][$x2] = 'M';
    }
    move_enemy($area);
}

function move_enemy(&$area) {
    for($x=0;$x<8;$x++) {
        for($y=7;$y>=0;$y--) {
            if(in_array($area[$y][$x], array('S'))) {
                $area[$y][$x] = '.';
                if($y+1 <= 7) {
                    if(in_array($area[$y+1][$x], array('M'))) {
                        die('LOSE');
                    }
                    $area[$y+1][$x] = 'S';
                }
            }
        }
    }
}

function is_free_point($x,$y, $area) {
    if(valid_point($x, $y)) {
        if(in_array($area[$y][$x], array('.','A','M'))) {
            return TRUE;
        }
    }
    return FALSE;
}

function is_danger_point($x,$y,$area) {
    if( valid_point($x,($y-1) ) === FALSE || is_free_point($x, ($y-1) , $area) ) {
        return FALSE;
    }
    return TRUE;
}

function valid_point($x,$y) {
    if($x > 7 || $y > 7 || $x < 0 || $y < 0) {
        return FALSE;
    }
    return TRUE;
}


<?php

define("CHARACTER_LIST", ['a', 'b', 'c', 'd', 'f', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']);

$word = trim(fgets(STDIN));

$wordLetters = str_split($word);

$prevPosition = 0;
$steps = 0;
foreach ($wordLetters as $letter) {
  $letterNumber = array_search($letter, CHARACTER_LIST);

  $stepsCount = abs($letterNumber - $prevPosition);

  if ($stepsCount >= 13) {
    $actualStepsCount = count(CHARACTER_LIST) - $stepsCount;
    $steps += $actualStepsCount;

    $prevPosition = $letterNumber;
  } else {
    $actualStepsCount = $stepsCount;
    $steps += $actualStepsCount;

    $prevPosition = $letterNumber;
  }
}

echo $steps;


<?php
$line = trim(fgets(STDIN));
function dis($a,$b){
    if(ord($a)> ord($b)){
        $tmp = $a;
        $a = $b;
        $b = $tmp;
    }
    $i = abs(intval(ord($a) - ord($b)));
    $j = abs(intval(ord($a) - ord('a'))) + abs(intval(ord('z')) - ord($b));
//    echo "a: $a  b: $b" . PHP_EOL;
//    echo "i: $i  j: $j " . PHP_EOL;
    return min($i,$j);
}
$current = 'a';
$sum = 0;
foreach(str_split($line) as $c){
    $sum += dis($c,$current);
    $current = $c;
}
echo $sum . PHP_EOL;
exit;


<?php
list($a,$b,$n)=explode(" ", trim(fgets(STDIN)));
function nod($a, $b) {
    while ($a != $b)
        if ($a>$b)
            $a -= $b;
        else
            $b -= $a;
    return $a;
}
function lite($a,$b,$n){
   $f=nod($a,$n);
   if (($n-$f)==0) return 0;
   $f1=nod($b,$n);
   if (($n-$f-$f1)==0) return 1;
   return lite($a,$b,$n-=($f+$f1));
}
print lite($a, $b, $n);
?>


<?php
list($a, $b, $n) = explode(' ', trim(fgets(STDIN)));

$k = $a;
$nn = $n;
$sem = true;

while ($n > 0)
{
    while ($k != $n)
    {
        if ($k > $n)
            $k -= $n;
        else
            $n -= $k;
    }

    if ($sem)
    {
        $sem = false;
        $k = $b;
        $m++;
    }
    else
    {
        $sem = true;
        $k = $a;
        $l++;
    }

    $n = $nn - $n;
    $nn = $n;
}
if ($k == max($k, $l))
    echo "0";
else
    echo "1";
?>


<?php

list($n, $p, $k) = array_map('intval', explode(' ', fgets(STDIN)));
$result = array();
if($p - $k > 1){
    array_push($result, '<<');
    for($i=$p-$k; $i<$p; $i++){
        array_push($result, $i);
    }
}else{
    for($i=$p-$k; $i<$p; $i++){
        if($i > 0)
        array_push($result, $i);
    }
}
array_push($result, "($p)");
if($p + $k < $n){
    for($i=$p+1; $i<=$p + $k; $i++){
        array_push($result, $i);
    }
    array_push($result, '>>');
}else{
    for($i=$p+1; $i<$p + $k; $i++){
        if($i <=$n)
        array_push($result, $i);
    }
}

print(implode(' ', $result));


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


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

$string = stream_get_contents($dir);
//$arr = explode (" ",$string);

list ($aa,$bb,$cc) = explode (" ",$string);
if ($aa > $bb) {
    $totalLength = $bb*2+1+$cc*2;
}
if ($aa < $bb) {
    $totalLength = $aa*2+1+$cc*2;
}
if ($aa == $bb){
    $totalLength = $aa+$bb+$cc*2;
}
echo "$string".PHP_EOL;
echo($totalLength . PHP_EOL);


<?php
    $input = (int)file_get_contents("php://stdin");
    $i=0;
    $step=0;
    while(1)
    {
        $i+=$step;
        if($i%2==$input%2 && $input<=$i)
        {
            echo($step);
            break;
        }
        $step++;
    }
?>


<?php

	$f = file_get_contents('php://stdin');
	$f = explode(' ', $f);

	$n = intval( $f[0] );
	$m = intval( $f[1] );
	$a = intval( $f[2] );

	// $f = ceil( $n / $a ) * ceil( $m / $a );
	// printf( "%u" , $f );

	// $r = gmp_mul( gmp_div_q($n, $a, GMP_ROUND_PLUSINF) , gmp_div_q($m, $a, GMP_ROUND_PLUSINF) );
	// echo gmp_strval($r);

	$f = s_mult_ent( ceil( $n / $a ) , ceil( $m / $a ) );
	printf( "%s" , $f );

	function s_mult_ent( $a , $b ){
		$a = array_reverse( str_split( ''.$a ) );
		$b = array_reverse( str_split( ''.$b ) );

		if (count($a) < count($b) ){
			$tmp = $a;
			$a = $b;
			$b = $tmp;
		}

		for ( $i = count($b) ; $i < count($a) ; $i ++ ){
			$b[$i] = '0';
		}

		$c = array();
		$r = array();

		for ($i = 0; $i < count($a) ; $i++) {
			$tmp = intval( $a[$i] ) * intval( $b[$i] );
			if ( isset( $c[ $i ] ) )
				$tmp += $c[ $i ];

			$r[$i] = ( $tmp % 10 );
			$c[$i + 1 ] = ( $tmp - $r[$i] ) / 10;
		}
		if (isset( $c[ count($a) ] ) )
			$r[ count($a) ] = $c[ count($a) ]

		$r = array_reverse( $r );
		$r = implode( '', $r );

		return $r;
	}


<?php

	$f = file_get_contents('php://stdin');
	$f = explode(' ', $f);

	$n = intval( $f[0] );
	$m = intval( $f[1] );
	$a = intval( $f[2] );

	// $f = ceil( $n / $a ) * ceil( $m / $a );
	// printf( "%d" , $f );

	$r = gmp_mul( gmp_div_q($n, $a, GMP_ROUND_PLUSINF) , gmp_div_q($m, $a, GMP_ROUND_PLUSINF) );
	echo gmp_strval($r);


<?php

	$f = file_get_contents('php://stdin');
	$f = explode(' ', $f);

	$n = intval( $f[0] );
	$m = intval( $f[1] );
	$a = intval( $f[2] );

	// $f = ceil( $n / $a ) * ceil( $m / $a );
	// printf( "%u" , $f );

	// $r = gmp_mul( gmp_div_q($n, $a, GMP_ROUND_PLUSINF) , gmp_div_q($m, $a, GMP_ROUND_PLUSINF) );
	// echo gmp_strval($r);

	/*
	echo (2*10).'
'. s_mult_ent(2 , 10) . '
';
	echo (9999*10).'
'. s_mult_ent(9999 , 10). '
';
	echo (99*99).'
'. s_mult_ent(99 , 99). '
';
	echo (99*22).'
'. s_mult_ent(99 , 22). '
';
	*/

	$f = s_mult_ent( ceil( $n / $a ) , ceil( $m / $a ) );
	printf( "%s" , $f );

	function s_mult_ent( $a , $b ){
		$r = 0;
		for( $i = 0;  $i < $a ; $i ++ ) {
			$r = s_sum_ent( $r , $b );
		}
		return $r;
	}

	function s_sum_ent( $a , $b ){
		$a = array_reverse( str_split( ''.$a ) );
		$b = array_reverse( str_split( ''.$b ) );

		if (count($a) < count($b) ){
			$tmp = $a;
			$a = $b;
			$b = $tmp;
		}

		for ( $i = count($b) ; $i < count($a) ; $i ++ ){
			$b[$i] = '0';
		}

		$c = array();
		$r = array();

		for ($i = 0; $i < count($a) ; $i++) {
			$tmp = intval( $a[$i] ) + intval( $b[$i] );
			if ( isset( $c[ $i ] ) )
				$tmp += $c[ $i ];

			$r[$i] = ( $tmp % 10 );
			$c[$i + 1 ] = ( $tmp - $r[$i] ) / 10;
		}
		if (isset( $c[ count($a) ] ) )
			$r[ count($a) ] = $c[ count($a) ];

		$r = array_reverse( $r );
		foreach ($r as $key => &$value) {
			if ($value == '0')
				$value = '';
			elseif( $value != '' )
				break;

		}
		$r = implode( '', $r );

		return $r;
	}


<?php
	$input = explode(" ",trim(fgets(STDIN)));
	if($input[0]==$input[1]==$input[3])
		echo "1";
	else
		echo ceil($input[0]/$input[2])+ceil($input[1]/$input[2]);
?>


<?php

 list($square_width, $square_height, $tile_dimension) = explode(' ', fgets(STDIN));

 $needed_tiles = (ceil($square_width/$tile_dimension)*ceil($square_height/$tile_dimension)) (int);

 echo($needed_tiles);

?>


<?php

    $main = trim(fgets(STDIN));
    $arr = explode(" ", $main);

    $n = (int)$arr[0];
    $m = (int)$arr[1];
    $a = (int)$arr[2];
    $d = (int)$arr[2];
    $y = (int)$arr[2];

    $resn = 1;
    $resm = 1;

    while ($a < $n){
        $a += $y;
        $resn++;
    }
    while ($d < $m){
        $d += $y;
        $resm++;
    }

    $result = $resn * $resm;
    fwrite(STDOUT,$result);

?>


<?php
$_fp = fopen("php://stdin", "r");

$n = (int) trim(fgets($_fp));

$a = explode(' ', trim(fgets($_fp)));

rsort($a);

$count = 0;
foreach ($a as $item) {
    if ($n <= 0) {
        break;
    }
    $n -= $item;
    $count++;
}
if ($count < 12) {
    echo $count;
} else {
    echo '-1';
}


<?php
$_fp = fopen("php://stdin", "r");

$n = (int) trim(fgets($_fp));

$a = explode(' ', trim(fgets($_fp)));

rsort($a);

$count = 0;
$i =0;
while($n > 0) {
    $n -= $a[$i];
    $i++;
    $count++;
    if ($n == 0) {
        break;
    }
}

echo $count;


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Codeforces Contest 127 Division 2 Problem A
function func($in) {
$len = strlen($in);
$asc = 97;		// ord("A")
$count = 0;
for ($x = 0; $x++; $x < $len) {
	if (ord(substr($len, $x, 1)) > $asc) {
		$asc = ord(substr($len, $x, 1));
		$count = 1;
	} else if (ord(substr($len, $x, 1)) = $asc) {
		$count++;
	}
}
return str_repeat(chr($asc), $count);
}

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


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Codeforces Contest 127 Division 2 Problem A
function func($in) {
$len = strlen($in[0]);
$asc = 97;		// ord("A")
$count = 0;
for ($x = 0; $x < $len; $x++) {
	if (ord(substr($len, $x, 1)) > $asc) {
		$asc = ord(substr($len, $x, 1));
		$count = 1;
	} else if (ord(substr($len, $x, 1)) == $asc) {
		$count++;
	}
}
return str_repeat(chr($asc), $count);
}

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


<?php

list($n, $a, $x, $b, $y) = explode(' ', trim(fgets(STDIN)));

$fr1 = false;
$fr2 = false;
$ans = 'NO';

while(!$fr1 && !$fr2){

	if($a != $x){
		if($a == $n){
			$a = 1;
		}else{
			$a++;
		}
	}else{
		$fr1 = true;
	}

	if($b != $y){
		if($b == 1){
			$b = $n;
		}else{
			$b--;
		}
	}else{
		$fr2 = true;
	}

	if($a == $b) $ans = 'YES';
}

echo $ans;


<?php
/*	$input = "2 2
..
..";*/
	$input = file_get_contents("php://stdin");
	$split_text = explode(" ",$input);
	$split_text[0] = $split_text[0]-'0';
	$split_text[1] = $split_text[1]-'0';
	if($split_text[0]>=0 && $split_text[1]>=0){
		$result = $split_text[0] + $split_text[1];
		echo '0 '.$result.' '.$result.' 0';
	}
	elseif ($split_text[0]<0 && $split_text[1]>=0) {
		$result = abs($split_text[0]) + $split_text[1];
		echo '-'.$result.' 0 0'.$result;
	}elseif ($split_text[0]<0 && $split_text[1]<0) {
		$result = $split_text[0] + $split_text[1];
		echo $result.' 0 0 '.$result;
	}else{
		$result = $split_text[0] + abs($split_text[1]);
		echo '0 -'.$result.' '.$result.' 0';
	}


<?php
$f = fopen( 'php://stdin', 'r' );
$a = explode(' ', fgets($f));
// a[0] la so phan trong hop(section)
// a[1] la so hat (nut)
// a[2] la so lan chia (divisor)
// a[3] la so hat trong phan (nut in section)

// tinh so section
$section_necessary = ($a[1] % $a[3] == 0) ? ($a[1] / $a[3]) : (round($a[1] / $a[3]) + 1);
$so_hop_chia_toi_da = floor($a[2] / ($a[0]-1));
$so_hop_duoc_chia = ceil($a[2] / ($a[0]-1));
$so_phan_duoc_tao_ra = $so_hop_chia_toi_da * $a[0] + $a[2] - $so_hop_chia_toi_da * ($a[0]-1) + 1;
if ($section_necessary <= $so_phan_duoc_tao_ra)
    echo ceil($section_necessary/$a[0]);
else {
    if( $so_hop_duoc_chia == $so_hop_chia_toi_da)
        echo $so_hop_chia_toi_da + ($section_necessary - $so_hop_chia_toi_da * 3);
    else
        echo $so_hop_duoc_chia + $section_necessary - $so_phan_duoc_tao_ra;
}


<?php

list($maxSections, $numberOfNuts, $numberOfDivisors, $sectionCapacity) = explode(" ", trim(fgets(STDIN)));

$numberOfBoxes = 1;
$sections = 0;
$nuts = 0;
while($numberOfNuts > 0)
{
	if($nuts < $sectionCapacity)
	{
		++$nuts;
		--$numberOfNuts;
		continue;
	}

	if($sections < $numberOfDivisors && $sections < $maxSections)
	{
		$nuts = 0;

		++$sections;
		--$numberOfDivisors;
		continue;
	}
	++$numberOfBoxes;
	$sections = 0;
	$nuts = 0;
}

echo $numberOfBoxes . PHP_EOL;


<?php
	$total = 0;
	list($k,$n,$w) = explode(' ',fgets(STDIN));
	for ($x = 1; $x <= $w; $x++) {
		$total += ( $x * $k );
	}
	echo abs($n - $total);


<?php
	$input = trim(fgets(STDIN));
	$val = explode(" ",$input);

	for($i=1;$i<$val[2];$i++)
		$harga_pisang = $harga_pisang + ($i * $val[0]);
	echo ($val[1]>$harga_pisang)?"0":($harga_pisang - $val[1]);
?>


<?php

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

fscanf($stdin, "%d%d%d", $k, $n, $w);
//fscanf($stdin, "%d", $n);
//fscanf($stdin, "%d", $w);

/*echo $k."\n";
echo $n;
echo $w;
*/
$sum = 0;

for($i=1; $i<=$w ;$i++){
	$sum += $i*$k;
}
if($n > $sum) fwrite($stdout, 0);

fwrite($stdout,$sum - $n);

fclose($stdin);
fclose($stdout);

 ?>


<?php
$line = explode(" ",fgets(STDIN));
$summ=0;
for ($i=1;$i<=$line[2];$i++)
{
    $summ+=$i*$line[0];
}
echo $summ-$line[1];


<?php
$a = trim(fgets(STDIN));
$b = bcmull($a, 8);
print $b[strlen($b) - 1];
?>


<?php
$num=trim(fgets(STDIN));
$pow= pow(1378 , $num);
echo substr($pow, -1);
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
rsort($c);
$d = 0;
for($x = 1; $x <= $a; $x++)
{
     $e = $c;
     $f = 0;
     $g = 0;
     $i = 0;
     while(TRUE)
     {
          $f = count(array_slice($e, 0, $x)) * $i;
          $i++;
          $h = array_sum(array_slice($e, 0, $x)) - $f;
          if($h <= 0)
          {
               break;
          }
          $g += $h;
          if($g >= $b)
          {
               $d = $x;
               break;
          }
          array_splice($e, 0, $x);
          if(count($e) == 0)
          {
               break;
          }
     }
     if($d != 0)
     {
          break;
     }
}
if($d == 0)
{
     print "-1";
}
else
{
     print $d;
}
?>


<?php

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

$year = 0;
while ($a >= $b) {
    $a *= 3;
    $b *= 2;

    $year++;
}

echo $year;


<?php
$a = rtrim(fgets(STDIN));
$b = rtrim(fgets(STDIN));
$i=0;
while($a<=$b)
{
    $a *=3;
    $b *=2;
    $i++;
}
echo $i;


<?php

function check($d,$s)
{
    $c=0;
    while($d<$s)
    {
        $d=$d*3;
        $s=$s*2;
        $c++;
    }
    return $c;
}
function solve()
{
    $server="php://stdin";
    $local="input.txt";
    $handle = fopen($server, "r");
    $d=0,$s=0;
    fscanf($handle, "%d %d", $d,$s);
    printf("%d", check($d,$s));
}

solve();
?>


<?php

function check($d,$s)
{
    $c=0;
    while($d<$s)
    {
        $d=$d*3;
        $s=$s*2;
        $c++;
    }
    return $c;
}
function solve()
{
    $server="php://stdin";
    $local="input.txt";
    $handle = fopen($server, "r");
    $d=0;$s=0;
    fscanf($handle, "%d %d", $d,$s);
    printf("%d", check($d,$s));
}

solve();
?>


<?php

//First Get The Input.
$input = file_get_contents("php://stdin");

$n1 = explode(" ",$input)[0];
$n2 = explode(" ",$input)[1];

$x = ($n2 * 2) / ($n1 * 3);

$x = $x * $x;

echo ceil($x);


<?php
	$temp = fopen("php://stdin","r");

	$a = intval(fgets($temp));
	$b = intval(fgets($temp));

	$counter = 0;

	while(true)
	{
		$a *= 3;
		$b *= 2;
		$counter++;

		if($a > $b)
		{
			echo $counter;
			break;
		}
	}

?>


<?php

$str = readline();

$arr = explode(' ', $str);

$counter = 0;

while($arr[0]<=$arr[1]) {
    $arr[0]*3;
    $arr[1]*2;
    $counter++;
}

echo $counter;


<?php
list ($a, $b, $s) = explode(" ", trim(fgets(STDIN)));

$min = $a + $b;
if ($s < $min) {
  echo "No\n";
} else {
  $diff = $s - $min;
  if ($diff % 2 == 0) {
    echo "Yes\n";
  } else {
    echo "No\n";
  }
}


<?php

$flag = 1; //must be not zero for STDIN
$in = 'php://stdin';
if (!$flag)
{
    $in = "in.data";
}
$fd = fopen($in, "r");
fscanf($fd, "%d %d %d\n", $a, $b, $s);
$a = abs($a);
$b = abs($b);
$ab = $a + $b;
if (($ab == $s) || ($ab < ($s - 1)))
{
    print "Yes\n";
}
else
{

    print "No\n";
}
?>


<?php
// Example for test php input output

list($a, $b, $s) = explode(" ", trim(fgets(STDIN)));

$a = abs($a);
$b = abs($b);

$resultOk = "Yes";
$resultNo = "No";
//fprintf(STDOUT, "%1.0f\n", $resultOk);
if ((($a+$b) == $s) || ((($a+$b) < $s) && ($s % 2 == 0)) )  {
    echo $resultOk;
} else {
    echo $resultNo;
}


<?php

list($a, $b, $s) = readInput();
if ($s < $a + $b) {
	echo "No";
} else {
	if (($s - $a - $b) % 2 == 0) {
		echo "Yes";
	} else {
		echo "No";
	}
}

function readInput() {
	$row = explode(" ", trim(fgets(STDIN)));
	$a = $row[0];
	$b = $row[1];
	$s = $row[2];
	return array($a, $b, $s);
}

?>


<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);
$dum= explode("\n",$n);
$argv=explode(" ", $dum[0]);

$iA = (int)$argv[0];
$iB = (int)$argv[1];
$iS = (int)$argv[2];

$iS = $iS - $iA - $iB;

echo $iS > -1 && $iS % 2 == 0 ? 'Yes' : 'No';


<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);
$dum= explode("\n",$n);
$argv=explode(" ", $dum[0]);

$iA = (int)$argv[0];
$iB = (int)$argv[1];
$iS = (int)$argv[2];

$iCount = $iS;
$iSa = 0;
$iSb = 0;
for ($i = 1; $i <= $iS; $i++)
{
    if($iSa == $iA)break;
    $iSa += $iA < $iSa ? -1 : 1;
    $iCount--;
}

for ($i = 1; $i <= $iS; $i++)
{
    if($iSb == $iB)break;
    $iSb += $iB < $iSb ? -1 : 1;
    $iCount--;
}

echo $iSa == $iA && $iSb == $iB && $iCount % 2 == 0 ? 'Yes' : 'No';


<?php
	$matrix = array();
	array_push($matrix,explode(fgets(STDIN)));
	array_push($matrix,explode(fgets(STDIN)));
	array_push($matrix,explode(fgets(STDIN)));
	array_push($matrix,explode(fgets(STDIN)));
	array_push($matrix,explode(fgets(STDIN)));
	for ($x = 0; $x < 5; $x++) {
		for ($y = 0; $y < 5; $y++) {
			if ($matrix[$x][$y] == 1) {
				echo abs(2 - $x) + abs(2 - $y)
				break;
			}
		}
		if ($matrix[$x][$y] == 1) {
			break;
		}
	}


<?php
	$i = 0;
	$x = 0;
	$y = 0;
	while($i<5)
	{
		$str = trim(fgets(STDIN));
		$cari = strpos($str,"1");
		if($cari !== FALSE)
		{
			$y = $i;
			$x = $cari;
			break;
		}
		$i++;
	}
	echo abs(2-$y) + abs(2-$x);
?>


<?php

function dd(...$args)
{
    var_dump(...$args);
    die;
}

define('TXTIN', fopen('input.txt', 'r'));
define('TXTOUT', fopen('output.txt', 'w'));

//$input = TXTIN;
$input = STDIN;
//$output = TXTOUT;
$output = STDOUT;

function foo($items, $i, &$a)
{
    $answer = null;

    foreach ($items as $j => $item) {
        if ($item == 1) {
            $answer = $a[$i][$j];

            break;
        }
    }

    return $answer;
}

$r = 0;
$a = [
    [4, 3, 2, 3, 4],
    [3, 2, 1, 2, 3],
    [2, 1, 0, 1, 2],
    [3, 2, 1, 2, 3],
    [4, 3, 2, 3, 4],
];

for ($i = 0; $i < 5; $i++) {
    $s = fscanf($input, "%d %d %d %d %d\n");

    $r = foo($s, $i, $a);

    if ($r) {
        break;
    }
}

fwrite($output, $r);


<?php
$str = '';
$place = 0;
for ($i = 0; $i < 5; $i++) {
    $str .= trim(fgets(STDIN)) . " ";
}
$str = trim($str);
$arr_str = explode(" ", $str);
for ($i = 0; $i < count($arr_str); $i++) {
    if ($arr_str[$i] != 0) {
        $place = $i + 1;
    }
}
$number_of_cycle = (integer)(abs(13 - $place)/5) + abs(13 - $place)%5;
print($number_of_cycle);


<?php
$i = 1;
$arr_nilai = array();
while($i<6)
{
	$a = trim(fgets(STDIN));
	$ax = explode(' ', $a);
	for($j=1;$j<6;$j++)
	{
		if($ax[$j-1]=='1')
		{
			$posisi_x = $i;
			$posisi_y = $j;
		}
	}
}
echo abs(3 - $posisi_x) + abs(3-$posisi_y);

?>


<?php

error_reporting(0);
$stdin = fopen("php://stdin", "r");

$arr = array();
$res = 0;

for ($i = 0; $i <= 4; $i++) {
    fscanf($stdin, "%[^\n]", $arr_temp);
    $arr[] = array_map('intval', preg_split('/ /', $arr_temp, -1, PREG_SPLIT_NO_EMPTY));
}

for($i = 0; $i<=4; $i++)
{
	for($j=1; $j<=5; $j++)
	{
		if($arr[$i][$j] == 1)
		{
			$res = abs($i-2) + abs($j-2);
		}
	}
}

echo $res."\n";

fclose($stdin);


<?php
	for($i = 0; $i<5; $i++){
		$input = trim(fgets(STDIN));
		$arr = explode(' ', $input);
		if(array_search('1', $arr)){
			$idx = array_search('1', $arr);
			echo abs(2-$i) + abs(2 - $idx);
			break;
		}
	}
?>


<?php
$board = array();
for ($i = 0; $i < 8; $i++)
{
    $board[$i] = rtrim(fgets(STDIN));
}
$ret = 0;
for (int $i = 0; $i < 8; $i++)
{
    $flag = true;
    $flag2 = true;
    for ($j = 0; $j < 8; $j++)
    {
        if ($board[$i][$j] == 'W') $flag = false;
        if ($board[$j][$i] == 'W') $flag2 = false;
    }
    if ($flag) $ret++;
    if ($flag2) $ret++;
}
if ($ret == 16) $ret = 8;
echo "ret\n";
?>


<?php
$board = array();
for ($i = 0; $i < 8; $i++)
{
    $board[$i] = rtrim(fgets(STDIN));
}
$ret = 0;
for ($i = 0; $i < 8; $i++)
{
    $flag = true;
    $flag2 = true;
    for ($j = 0; $j < 8; $j++)
    {
        if ($board[$i][$j] == 'W') $flag = false;
        if ($board[$j][$i] == 'W') $flag2 = false;
    }
    if ($flag) $ret++;
    if ($flag2) $ret++;
}
if ($ret == 16) $ret = 8;
echo "ret\n";
?>


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

$counter = 0;
while( $line = fgets( $f ) ) {
  if ($counter == 1) {
      $nutsLine = $line;
  }
  $counter ++ ;
}

$nuts = explode(' ', $nutsLine);
$length = sizeof($nuts);
$vars = 0;
$countMode = false;
$tempVars = 0;
$zero = true;
foreach($nuts as $nut) {
    if ($nut == '1') {
        $zero = false;
    }
}
if ($zero) {
    echo '0';
    die();
}
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        // $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

    if ($countMode && ($nuts[$i] == '1')) {
        $vars = $vars + $tempVars;
        if ($tempVars > 0) {
            $vars ++;
        }
        $tempVars = 0;
        $countMode = false;
        if ($nuts[$i+1] == '0') {
            $countMode = true;
        }
    }
}
if ($vars == 0) {
    echo '1';
} else {
    echo $vars;
}

?>


fscanf(STDIN, "%s", $str);
echo preg_match_all("/(C{1,5})|(P{1,5})/", $str, $matchesarray);


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$a++;
while(TRUE)
{
     $c = $a % $b;
     if($c == 0)
     {
          print $a;
          break;
     }
     else
     {
          $a++;
     }
}
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
if($a <= $b)
{
     print $b * 2;
}
elseif($a > $b)
{
     $c = $a % $b;
     if($c == 0)
     {
          print $a + $b;
     }
     else
     {
          $d = $b - $c;
          print $a + $d;
     }
}
?>


<?php
$dir = fopen("php://stdin", 'r');
$s = stream_get_contents($dir);
$s = str_replace("\n", "", $s);
//$s="472747";
$s_array=str_split($s);

$lucky=array();
$subs="";

for ($i=0; $i < count($s_array); $i++) {
	if($s_array[$i]=="4" || $s_array[$i]=="7"){
		//echo $s_array[$i]."\n";
		//$subs.= $s_array[$i];
		/*save and check next*/
		if(!isset($s_array[$i])){
			$lucky[$s_array[$i]]=1;
		}else{
			$lucky[$s_array[$i]]++;
		}
	}else{
		//$subs="";
	}

}
//echo count($lucky);
if(!count($lucky)){
	echo -1;
}else{
	$bigger=0;
	$bigger_key=-1;
	foreach ($lucky as $key => $value) {
		if($value > $bigger){
			$bigger = $value;
			$bigger_key = $key;
		}
	}
}
echo $bigger_key;


<?php
fscanf(STDIN, %d %d %d, $m, $n, $a);

$width=ceil($m/$a);
$height=ceil($n/$a);
printf("%.0f", $width*$height) ;
?>


<?PHP

$fileIN = fopen("php://stdin", "r");
// $fileIn = file_get_contents('stdin');

$lineIn = fgets($fileIN);
$dataIn = explode(" ", $lineIn);

$n = $dataIn[0];
$m = $dataIn[1];
$a = $dataIn[2];

//fscanf(STDIN, "%d %d %d\n", $n, $m, $a);
$fileOut = fopen("php://stdout", "w");
$rs = ceil($n / $a) * ceil($m / $a);
fwrite($fileOut, number_format($rs, 0, '', ''););
fwrite($fileOut, "\n");
fclose($fileOut);

?>


<?php
    fscanf(STDIN, "%d %d %d", $m, $n, $a);
    $answer = (long)( ceil($n/$a)) * (ceil($m/$a) );
    printf("%.0f",$answer);
?>


<?php
$n = readline();
echo floor($n / 5) +
     floor($n % 5 / 4) +
     floor($n % 4 / 3) +
     floor($n % 3 / 2) +
     $n % 1;


<?php
	$input_line = = explode(" ", trim(fgets(STDIN)));
	$puzzle_pieces = explode(" ", trim(fgets(STDIN)));
	sort($puzzle_pieces);
	echo $puzzle_pieces[($input_line[0]-1)] - $puzzle_pieces[0];
?>


<?php
	$input_line = explode(" ", trim(fgets(STDIN)));
	$puzzle_pieces = explode(" ", trim(fgets(STDIN)));
	sort($puzzle_pieces);
	echo $puzzle_pieces[($input_line[0]-1)] - $puzzle_pieces[0];
?>


<?php
$n = explode(" ",fgets(STDIN));
$line = explode(" ",fgets(STDIN));
sort($line);
array_splice($line,$n[0]);
echo $line[count($line)-1]-$line[0];


<?php
fscanf(STDIN, '%d%d', $n, $m);
$puzzles_sets = explode(" ", trim(fgets(STDIN)));
$buf = 0;
for ($i = 0; $i < $m - 1; $i++) {
    for ($j = 0; $j < $m - $i - 1; $j++) {
        if ($puzzles_sets[$j] > $puzzles_sets[$j+1]) {
            $buf = $puzzles_sets[$j+1];
            $puzzles_sets[$j+1] = $puzzles_sets[$j];
            $puzzles_sets[$j] = $buf;
        }
    }
}
$arr_min = array();
for ($i = 0; $i < $m - $n + 1; $i++) {
    $arr_min[$i]['difference'] = $puzzles_sets[$i+$n-1] - $puzzles_sets[$i];
    $arr_min[$i]['first'] = $i;
}
$min = min($arr_min);
$k = $min['first'];
print($k);


<?php
$n=explode(" ", trim(fgets(STDIN)));
$f=explode(" ", trim(fgets(STDIN)));
$i=0;
while ($i < $n[0]) {
	$new[$i]=$f[$i];
	$i++;
}
sort($new);
echo $new[$n[0]-1] - $new[0];

?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
list($n, $m) = explode(" ", trim(fgets($file)));
$iArray = explode(" ", trim(fgets($file)));

asort($iArray);
array_unshift($iArray, "TDS");
array_shift($iArray);
$min = $iArray[$n - 1] - $iArray[0];

for ($i = 1; $i <= $n - $m; $i++) {

    if ($iArray[$i + $n - 1] - $iArray[$i] < $min) {
        $min = $iArray[$i + $n - 1] - $iArray[$i];
    }
}
echo $min;


<?php
# $n=number of copybooks she has, $a,$b,$c 1, 2 and 3 copybook pack cost, $k = need to buy
list($n, $a, $b, $c) = explode(" ", trim(fgets(STDIN)));
$k = 4 - ($n % 4);
if ($k == 4) {
	die("0\n");
}
$cost = array();

switch ($k) {
	case 1:
		$cost[] = $a;
		$cost[] = $c * 3;
		$cost[] = $b + ($a * 3);
		$cost[] = $b + $c;
		break;

	case 2:
		$cost[] = $a * 2;
		$cost[] = $b;
		$cost[] = $c * 2;
		break;
	case 3:
		$cost[] = $a * 3;
		$cost[] = $b + $a;
		$cost[] = $c;
		break;
}
asort($cost);
print_r($cost);

// foreach ($cost as $c) {
// 	die($c."\n");
// }
//die($cost[0]."\n");


<?php
list($num, $a, $b, $c)=explode(" ", trim(fgets(STDIN)));
$x=0;
while (TRUE) {
    if (($num + $x) % 4 == 0) {
        //echo $x;
        break;
    }else $x++;
}
if ($x == 0) {
    echo 0;
}elseif ($x == 3) {
  if ($a + $b > $c and $c < (3 * $a)) {
echo $c;
}elseif ($b + $a < (3 * $a)) {

    echo $a + $b;
}else echo 3 * $a;

}elseif ($x == 2) {
    if ($b < (2 * $a) and $b < 2 * $c) {
    echo $b;
    }elseif (2 * $c < $x * $a) { echo 2 * $c; }else echo $x * $a ;
}else echo $x * $a;

?>


<?php
$arr = explode(" ", trim(fgets(STDIN)));
if(strcmp ($arr[0], $arr[1]))
 print $arr[0];
else
 print $arr[1];
?>


<?php
$h = fopen("php://stdin", "r");

$line=fgets($h);
$line_arr=explode(' ', $line);
$a=$line_arr[0];
$b=$line_arr[1];

if($a==$b)
	echo $a;
else
	echo 1;


<?php

$in = array_map('intval', explode(' ', fgets(STDIN)));
$a = $in[0];
$b = $in[1];

$hour = $a;
$remain = 0;

do {
  $a = make($a + $remain, $b);
  $hour += $a;
  $remain = remain($a, $b);
} while ($a > 0);

function make($a, $b) {
  return (int) ($a / $b);
}

function remain($a, $b) {
  return $a > $b ? $a % $b : 0;
}

echo $hour;


<?php
$s = explode(' ', trim(fgets(STDIN)));
$f = $s[0];
$nf = $s[1];
$h = 0;
for($i = 0; true; $i++){
    $nh = floor($f/pow($nf, $i));
    if($nh >= 1){
        $h += $nh;
    } else {
        echo $h;
        return;
    }

}


<?php
list($f, $nf) = explode(' ', trim(fgets(STDIN)));
$h = $f;
while($f>=$nf){
    $t = floor($f/$nf);
    $r = $f%$nf;
    $h += $t;
    $a = $t + $r;
}
echo $h;


<?php
// 379A 	  Новогодние свечки

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

$input_line = fgets($in);
//$input_line = substr($input_line, 0, strlen($input_line)-2);

list($a, $b) = preg_split('/ /', $input_line, -1, PREG_SPLIT_NO_EMPTY);

$a = (int) $a;
$b = (int) $b;

$col = 0;
$end = 0;

while ( $a >= 1 ) {
echo "a=$a b=$b col=$col end=$end \n";
    $col += $a;
    $end += $a % $b;
    $a = intval($a / $b);

    if (($end / $b) >= 1) {
        $a +=  ($end - ($end % $b)) / $b;
        $end = $end % $b;
    }
}

echo $col;

?>


<?php

$line = trim(fgets(STDIN));
list($a, $b) = explode(' ', $line);

$a = intval($a);
$b = intval($b);

$answer = $a;

while ($a > 0) {
  $a = intval($a / $b);
  $answer += $a;
}

print $answer;


<?php

$arr = array();
while ($line = trim(fgets(STDIN)))
    $arr[] = $line;

list($a, $b) = explode(' ', $arr[0]);

function RecCount($count, $step){
    if($count >= $step)
        return $count + RecCount((int) ($count / $step), $step);
    return $count;
}
echo RecCount($a, $b);


<?php

$in = fopen("php://stdin", "r");

$n = trim(fgets($in));

list($a, $b) = explode(" ",trim(fgets($in)));

$n = $a;

while($a>$b){
    $t = floor($a/$b);
    $r = $a%$b;
    $n += $t;
    $a = $t + $r;

}

echo "$n\n";


<?php
$handle = fopen ("php://stdin","r");
$lines = array();
$lines[0] = fgets($handle);
$lines[1] = fgets($handle);
fclose($handle);

$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = (int)$v_girl_fingers[$i];
	$m_boy_finger = (int)$m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( $v_girl_finger >= (ceil($m_boy_finger/2)-1) && $v_girl_finger <= ($m_boy_finger + 2) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);


<?php
list($al, $ar) = explode(' ',trim(fgets(STDIN)));
list($bl, $br) = explode(' ',trim(fgets(STDIN)));

if(($bl - $ar <= 3 && $ar - $bl <= 1 ) || ($br - $al <= 3 && $al - $br <= 1 ))
 print 'YES'; else print 'NO';
?>


<?php
fscanf(STDIN, '%s\n', $line);

if(ctype_upper($line)){
	$line = strtolower($line);
	$result = $line;
	//$result = ucfirst($line);
	//printf("Строка состояла только из верхнего регистра");
}elseif(ctype_upper(substr($line, 1)) && (ctype_lower(substr($line, 0, 1)))){
	$line = strtolower($line);
	//$result = $line;
	$result = ucfirst($line);
	//printf("Строка состояла из нижнего регистра первой буквы");
 }

 else{
 	$result = $line;
 	//printf("Строку не меняем");
 }

printf($result);


<?php
fscanf(STDIN, '%s', $string);

function getUpperChars($string) {
    $arr = array();
    for ($i = 0; $i < strlen($string); $i++) {
        if (!ctype_upper($string[$i])) {
            $arr[] = $i;
        }
    }

    return $arr;
}

function changeChars($string) {
    for ($i = 0; $i < strlen($string); $i++) {
        if (ctype_upper($string[$i])) {
            $string[$i] = strtolower($string[$i]);
        } else {
            $string[$i] = strtoupper($string[$i]);
        }
    }

    return $string;
}

$arr = getUpperChars($string);

if (empty($array) || (count($arr) == 1 && in_array(0, $arr))) {
    $string = changeChars($string);
}

echo $string;


<?php

$str = trim(fgets(STDIN));
$arr = str_split($str);
$cond1 = 0;
$cond2 = 0;
$flag1 = $flag2 = 0;
//  ABC
// aABC
// ==> Change case, Ignore otherwise

if(ctype_lower($arr[0])) {
    $cond1 = true;
}

if(ctype_upper($arr[0])) {
    $cond2 = true;
}

if($cond1) {
    for($i=1; $i<count($arr); $i++) {
        if(ctype_upper($arr[$i])) {
            $flag1++;
        }
    }
}

if($cond2) {
    // echo "Cond2";
    for($i=0; $i<count($arr); $i++) {
        if(ctype_upper($arr[$i])) {
            $flag2++;
        }
    }
}

if( ctype_lower($arr[0]) && $flag1 == strlen($str) - 1 && strlen($str) > 1) {
    $str = strtolower($str);
    echo ucwords($str)."\n";
} else if(ctype_upper($arr[0]) && $flag2 == strlen($str)) {
    $str = strtolower($str);
    echo $str."\n";
} else {
    echo $str."\n";
}


<?php

$codesList = array(
	'a'=> ord('a'),
	'A' => ord('A')
	);

	$decodesList = array();

function code($char)
{
	return isset($codesList[$char]) ? $codesList[$char] : ($codesList[$char] = ord($char));
}

function opposite($char)
{
	if(!isset($decodesList[$char]))
	{
		$base = code('a') - code('A');

		$charCode = code($char);
		$decodesList[$char] = chr($charCode >= code('a') ? $charCode - $base : $charCode + $base);
	}

	return $decodesList[$char];
}

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

$result = trim(fgets($stdin));
$str = str_split($result);

$isWrong = false;

if((code($str[0]) >= code('a') && (!isset($str[1]) || code($str[1]) < code('a'))) || (code($str[0]) < code('a') && isset($str[1]) && code($str[1]) < code('a')))
{
	$isWrong = true;
	for($i = 2; $i < count($str); $i++)
	{
		if( code($str[$i]) >= code('a'))
		{
			$isWrong = false;
			break;
		}
	}
}

if($isWrong )
{
	$result = '';

	foreach($str as $char)
	{
		$result .= opposite($char);
	}
}

echo $result;


<?php
	$i = trim(fgets(STDIN));
	if(preg_match('/\A[a-z]{1}[A-Z]+\z/', $i) == 1){
		echo ucfirst(strtolower($i));
	} else if(preg_match('/\A[A-Z]+\z/', $i) == 1){
		echo strtolower($i);
	} else {
		echo $i;
	}
?>


<?php
	$i = trim(fgets(STDIN));
	if(preg_match('/\A[a-z]+[A-Z]+[a-z].\z/', $i) == 1){
		echo ucfirst(strtolower($i));
	} else if(preg_match('/[A-Z]+/', $i) == 1){
		echo strtolower($i);
	} else {
		echo $i;
	}/
?>


<?php
	$in = explode(' ',fgets(STDIN));
	$board = (int)$in[0] * (int)$in[1];
	if ($board % 2 == 0) echo (int)($board / 2);
	else ceil($board / 2) - 1;
	?>


<?php
$array = explode(' ', trim(fgets(STDIN)));

$count = (floor($array[0] / 2) * floor($array[1] / 1));
echo $count;


<?php

    $result = trim(fgets(STDIN));
    list($M,$N) = explode(' ',$result);

    $env = $M * $N;
    $dom = $env/2;
    echo $dom;

?>


<?php
    $input = trim(fgets(STDIN));
    $arr = explode(' ', $input);

    echo $arr[0] * $arr[1] / 2;


<?php
list($h,$w) = explode(" ",trim(fgets(STDIN)));
echo round($h*$w/2, 0) ."\n";


<?php
    $str = fgets(STDIN);
    $str = explode(" ", $str);
    echo $str[0]*floor(($str[1]/2)) + floor($str[0]/2);
?>


<?php

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

$s = ($m*$n);

if( $s > 1 )
{
    echo intVal($s/2);
}


<?php
    fscanf ( STDIN, "%d %d", $n, $m );
    echo $n * $m / 2;
?>


<?php
$s = explode(" ", trim(fgets(STDIN)));
$a = ($s[0] * $s[1]) + ($s[3] * 2);
$b = ($s[0] * $s[2]) + ($s[4] * 2);
if ($a == $b)
    echo "Friendship";
else if ($a > $b)
    echo "First";
else
    echo "Second";
?>


<?php

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

fscanf($stdin, "%d%d", $Ax, $Ay);
fscanf($stdin, "%d%d", $Bx, $By);
fscanf($stdin, "%d%d", $Cx, $Cy);

$Cx -= $Bx;
$Cy -= $By;
$Bx -= $Ax;
$By -= $Ay;

$a = $Ax*$By - $Ay*$Bx;

if ($a > 0)
{
    fwrite($stdout, "LEFT");
}
else if ($a < 0)
{
    fwrite($stdout, "RIGHT");
}
else
{
    fwrite($stdout, "TOWARDS");
}


<?php
$n = trim(fgets(STDIN));
$has = array_unique(str_split($n));
print (5 - count($has));
?>


<?php
$length=fgets(STDIN);
$string=fgets(STDIN);
$strout = '';
$i = 1;

while ($length > 0) {
    $strout .= substr($strin, 0, 1);
    $strin = substr($strin, $i, $length - $i);
    $length -= $i;
    $i++;
}

echo $strout;


<?php

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

$s = [];
for ($i = 0; $i < $n; $i++) {
    $s[] = $t[$i];
    $i += $i;
}

echo implode($s);

?>


<?php
$n=fgets(STDIN);
$input=str_split(fgets(STDIN));
$res=null;
for ($i=0;$i<$n; $i+=$i+1) {
      $res.=$input[$i];
}
echo $res;


<?php

$in = 'php://stdin';
//	$in = 'input.txt';
$fi = fopen($in, 'r');
$ostatok = fgets($fi)*1;
//$k =fgets($fi)*1;

$list_100 = floor($ostatok / 100);
$ostatok = $ostatok - (100 * $list_100);

$list_20 = floor($ostatok / 20);
$ostatok = $ostatok - (20 * $list_20);

$list_10 = floor($ostatok / 10);
$ostatok = $ostatok - (10 * $list_10);

$list_5 = floor($ostatok / 5);
$ostatok = $ostatok - (5 * $list_5);

$list_1 = floor($ostatok / 1);
$ostatok = $ostatok - (1 * $list_1);
//
//echo $list_100 + $list_20 + $list_10 + $list_5 + $list_1;


<?php
$a=readline();
$str=str_split($a);
$k=count($str);
for($i=0;$i<count($str)-1;$i++){
    for($j=$i+1;$j<count($str);$j++){
        if($str[$i]==$str[$j]){
            $k--;
        }
    }
}
if($k%2==1)
echo "IGNORE HIM!";
else
echo "CHAT WITH HER!";


$dir = fopen("php://stdin", 'r');;
$input= file('php://stdin');
$str= trim($input[0]);
$s=[];
for($i=0,$c=strlen($str);$i<$c;$i++){
    $s[]= $str[$i];
}
$s= array_unique($s);
if (count($s) % 2 == 0){
    echo "CHAT WITH HER!";
}else{
    echo "IGNORE HIM!";
}


echo strlen(trim(fgets(STDIN)))%2==0?"CHAT WITH HER!":"IGNORE HIM!";


<?php
$input=trim(fgets(STDIN));
$array=[];
$x=0;
$array=str_split($input);
for ($i=0; $i <count($array);$i++) {
      for ($j=0;$j<$i;$j++) {
            if($array[$i] == $array[$j])
            $x++;
      }
}
if($x % 2 == 1){
      echo "CHAT WITH HER!
      ";
}else{
      echo "IGNORE HIM!";
}


<?php
$IN = STDIN;
fscanf($IN, "%d", $n);
$needval = $n-10;

if ($needval==10)
  echo 15;
elseif ((0<$needval)&&($needval<22))
  echo 4;
else
  echo 0;

?>


<?php

function debug($data, $die = true) {
    echo '<pre>';

    if (is_array($data)) {
        print_r($data);
    } else {
        var_dump($data);
    }

    if ($die) {
        die();
    }

    echo '</pre>';
}

function stdin() {
    $stdin = @fopen('data.txt', 'r');
    if (!$stdin) {
        $stdin = fopen('php://stdin', 'r');
    }

    return $stdin;
}

function g() {
    global $stdin;
    return trim(fgets($stdin));
}

$stdin = stdin();
/****************************************************** Solving block *****************************************************/
$id = g();

$word = "[a-z0-9_]{1,16}";
$correct = preg_match("/^$word@(($word\.)+$word)(\/$word)?$/i", $id, $matches);
$correct = $correct && strlen($matches[1]) && strlen($matches[1]) < 33;

echo $correct ? 'YES' : 'NO';

?>


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Actual function for problem
function func($in) {
$tot = $in[0] * $in[2];
$dl = round($tot / $in[1] + 0.5);
return $dl - $in[1];
}

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


<?php
fscanf(STDIN,"%d %d",$arrSize,$k);
$arr=explode(' ',trim(fgets(STDIN)));
$j=0;
$flag=0;
for ($i=0; $i <$arrSize ; $i++)
{
	if($arr[$i]>$k)
	{
		$pos1[$j++]=$i;
		if(count($pos1)==2)
		{
            echo $arrSize-1-($pos1[1]-$pos1[0]);
            $flag=1;
			break;
        }
	}

}
if($flag==0)
echo "$arrSize";


<?php
$dir                = fopen("php://stdin", 'r');
$contents           = stream_get_contents($dir);
$inputs             = explode("\n",$contents);
$problemsCount      = substr($inputs[0], 0, 1);
$solverSkill        = substr($inputs[0], 2);
$problemDifficulty  = array_map('intval', explode(' ', $inputs[1]));
echo getMaximumProblems($problemsCount, $problemDifficulty, $solverSkill);

function getMaximumProblems($problemsCount, $problemDifficulty, $solverSkill)
{
    $maximumSolvedProblems    = 0;
    $firstProblemDifficulty   = $problemDifficulty[0];
    $lastProblemDifficulty    = $problemDifficulty[$problemsCount - 1];
    if($firstProblemDifficulty > $solverSkill && $lastProblemDifficulty  > $solverSkill)
    {
        return 0;
    }

    for($problemsCounter = 0; $problemsCounter < $problemsCount; $problemsCounter++)
    {
        if($problemDifficulty[$problemsCounter] <= $solverSkill)
        {
            $maximumSolvedProblems++;
            unset($problemDifficulty[$problemsCounter]);
        }

        if($problemDifficulty[$problemsCounter] > $solverSkill)
        {
            break;
        }
    }

    if(count($problemDifficulty) > 0) {
        $reversedArray  = array_reverse($problemDifficulty);
        for($problemsCounter = 0; $problemsCounter < count($problemDifficulty); $problemsCounter++)
        {
             if($reversedArray[$problemsCounter] <= $solverSkill)
            {
                $maximumSolvedProblems++;
                unset($reversedArray[$problemsCounter]);
            }

            if($reversedArray[$problemsCounter] > $solverSkill)
            {
                break;
            }
        }
    }

    return $maximumSolvedProblems;
}
?>


<?php
list($s)=explode(" ", trim(fgets(STDIN)));
$n=0;
while(strlen($s)-$n>0):
   $a=substr($s, $n, 1);
if (ord($a)<91) $a=chr(ord($a)+32);
switch ($a){
case "a": case'y':case'i':case'o':case'e':case'o': $a='.';}
print $a;
$n++;
endwhile;
?>


<?php

$line = trim(fgets(STDIN));
$string = strtolower($line);
$string = preg_replace('/[aeiou]/', '', $string);
echo '.' . implode('.', str_split($string)) . PHP_EOL;


<?php
    $line = fgets(STDIN);
    $line = strtolower($line);

    $m = array('a','e','i','o','u','y');
    $line = str_replace($m, '', $line);

    $ary = str_split($line);
    $line = implode('.', $ary);

    echo '.'.$line;


<?php

$str = trim(fgets(STDIN));

$arGlasn = array("a", "o", "y", "e", "u", "i");

$str = strtolower($str);
$str = str_replace($arGlasn, '', $str);
$newStr = '';
for ($i = -; $i <= count($str)-1; $i++)
	$newStr = '.'.$str[$i];

echo $newStr;


<?php

$vowels = array("A", "O", "Y", "E", "U", "I", "a", "o", "y", "e", "u", "i");

$str = str_replace("\n", "", fgets(STDIN));
$len = strlen($str);
for ($i=0; $i<$len; $i++) {
    if (in_array($str[$i], $vowels)) {
        continue;
    }
    echo 'a';
}
echo PHP_EOL;


<?php
$str=strtolower(trim(fgets(STDIN)));
//$vowel="";
$cons="";
for ($i=0; $i <strlen($str); $i++)
{
	# code...

	if($str[$i]=='a'||$str[$i]=='e'||$str[$i]=='i'||$str[$i]=='o'||$str[$i]=='u')
		//$vowel.=$str[$i];
	//echo "vowel";
		continue;
	else
		$cons.=".$str[$i]";

	//echo "cons";
}

	# code
   echo "$cons";
	//echo strlen($cons);


<?php
while($s = fgets(STDIN)){
        $input .= $s;
}
$input = explode("\r\n", $input);
$digits = explode (" ", $input[0]);
$n=$digits[0];
$m=$digits[1];
$result=0;
for ($i=0;$i<33;$i++) {
    $t=$i*$i;
    if ($t*$t-2*$t*$m+$m*$m+$i-$n === 0) {
        $result++;
    }
}
echo $result;
?>


<?php

$nums = stream_get_contents(fopen("php://stdin", 'r'));
$nums = explode(" ", $nums);
$result = 0;
for($i = 1; $i <= 1000; $i++){
	for($k = 1; $k <= 1000; $k++){
		if((pow($i, 2) + $k) == $nums[0]) $result++;
		if((pow($m, 2) + $n) == $nums[1]) $result++;
	}
}

echo floor($result/2);

?>


<?php
fscanf(STDIN, "%d %d", $n, $m);
if($n >= $m){
    $result = $m - $n;
}else{
    $result = 0;
    while($m != $n){
        if($m % 2 == 1 || $m < $n){
            $m++;
        }else{
            $m = $m/2;
        }
        $result++;
    }
}
echo $result;


<?php

$input_desc = fopen("php://stdin", "r");

$first_string = trim(fgets($input_desc));

fclose($input_desc);

$numbers = explode(' ', $first_string);

$numbers = array_filter(array_map('trim', $numbers));

$distance = (int)array_pop($numbers);

define('RIGHT_BORDER', 10 ** 9);

if ($numbers[0] - $numbers[1] >= $distance
    && $numbers[1] - $numbers[2] >= $distance
    && $numbers[2] - $numbers[0] >= $distance) {
    echo 0;
    exit();
}

$left = min($numbers);
$right = max($numbers);
if ($right === $left) {
    $middle = $left;
} else {

    $middle = false;

    foreach ($numbers as $number) {
        if ($number < $right && $number > $left) {
            $middle = $number;
        }
    }
    if ($middle === false) {
        $right_keys = array_keys($numbers, $right);
        if (count($right_keys) > 1) {
            $middle = $right;
        } else {
            $middle = $left;
        }
    }
}

$current_left_distance = $middle-$left;
$current_right_distance = $right-$middle;

$result = ($distance-$current_left_distance) + ($distance-$current_right_distance);
echo $result;
exit;


<?php

function ropewalkers($str = '')
{
    $arr = explode(' ', $str);
    $d = $arr[count($arr)-1];
    unset($arr[count($arr)-1]);

    $result = 0;
    sort($arr);
    for ($i = 0; $i < count($arr); $i++) {
        if (isset($arr[$i+1]) && abs($arr[$i] - $arr[$i+1]) < $d) {
            $result += $d - abs(($arr[$i] - $arr[$i+1]));
        }
    }
    return $result;
}


<?php
$a = explode(" ", trim(fgets(STDIN)));
$b = array_sum($a);
$c = floor($b / 3);
print $c;
?>


<?php

$in = 'php://stdin';
//$in = 'input.txt';

$arr = file($in);
//$data = file_get_contents($in);
//$r = fopen($in, 'r');

$allpoints = array();
$xx = 0; $yy = 0;
while ($line = trim(array_shift($arr))) {
	list ($x1, $y1, $x2, $y2) = explode(' ', $line);
	if ($x1 != $x2 && $y1 != $y2) {
		die('NO');
	}
	if ($x1 == $x2 && $y1 == $y2) {
		die('NO');
	}
	if ($x2 < $x1) {
		list($x1, $x2) = array($x2, $x2);
	} else if ($x1 == $x2) {
		$xx++;
	}
	if ($y2 < $y1) {
		list($y1, $y2) = array($y2, $y1);
	} else if ($y1 == $y2) {
		$yy++;
	}
	$minx = isset($minx) ? ($x1 < $minx ? $x1 : $minx) : $x1;
	$maxx = isset($maxx) ? ($x2 > $maxx ? $x2 : $maxx) : $x2;
	$miny = isset($miny) ? ($y1 < $miny ? $y1 : $miny) : $y1;
	$maxy = isset($maxy) ? ($y2 > $maxy ? $y2 : $maxy) : $y2;
	$allpoints = array_merge($allpoints, array("$x1 $y1", "$x2 $y2"));
}
if ($minx == $maxx || $miny == $maxy) {
	die('NO');
}

if ($xx != 2 || $yy != 2) {
	die('NO');
}

$counts = array_count_values($allpoints);
if (count($counts) != 4) {
	die('NO');
}
foreach ($counts as $val) {
	if ($val != 2) {
		die('NO');
	}
}

echo 'YES';
//fclose($r);


<?php

class Segment {
	public function __construct($a) {
		if ($a[0] < $a[2] || ($a[0] == $a[2] && $a[1] < $a[3]))
			$this->a = $a;
		else
			$this->a = array($a[2], $a[3], $a[0], $a[1]);
	}
	public static function create($a, $b, $c, $d) {
		return new Segment(array($a, $b, $c, $d));
	}
	// public function __is_equal($other) {
	// 	return $this->a == $other->a;
	// }
	public function __toString() {
		return implode(', ', $this->a);
	}
}

$sa = array();
$M = 10**9;
$min_x = $M; $max_x = -$M;
$min_y = $M; $max_y = -$M;
for ($i = 0; $i < 4; $i++) {
	$a = array_map("intval", explode(' ', fgets(STDIN)));
	$min_x = min($min_x, min($a[0], $a[2]));
	$max_x = max($max_x, max($a[0], $a[2]));
	$min_y = min($min_y, min($a[1], $a[3]));
	$max_y = max($max_y, max($a[1], $a[3]));
	$sa[$i] = new Segment($a);
}
$sb = array(
	Segment::create($min_x, $min_y, $max_x, $min_y),
	Segment::create($min_x, $min_y, $min_x, $max_y),
	Segment::create($max_x, $max_y, $max_x, $min_y),
	Segment::create($max_x, $max_y, $min_x, $max_y)
);
$equal = (array_diff($sa, $sb) == array());
print($equal && $min_x != $max_x && $min_y != $max_y ? "YES\n" : "NO\n");
?>


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

list($n,$m) = explode(' ', trim(fgets(MY_STDIN)));
$a = explode(' ', trim(fgets(MY_STDIN)));
var_dump($a);
$aa = array_fill(1, $n, 0);
foreach ($a as $k) {
    for ($i = $k; $i <= $n; $i++) {
        if ($aa[$i] == 0) {
            $aa[$i] = $k;
        }
    }
}
echo join(' ', $aa);


<?php
$sNum = stream_get_contents(fopen("php://stdin", 'r'));
$d = 0;
for ( $i = 1; $i <= (int)$sNum; $i++ ) if( preg_match('/^([0-1])+$/', $i) ) $d++;
echo $d;
?>


<?php
	$str = fopen("php://stdin", 'r');
	$n = stream_get_contents($str);
	$token = explode("\n",$n);

	$iPreNum = intval($token[0]);
	$iMidNum = intval($token[1]);
	$iFrontNum = intval($token[2]);

	$iSum[0] = $iPreNum + $iMidNum + $iFrontNum;
	$iSum[1] = ($iPreNum + $iMidNum) * $iFrontNum;
	$iSum[2] = $iPreNum * ($iMidNum + $iFrontNum);
	$iSum[3] = 2 * 3;

	$iFinalAns = $iSum[0];

	for ($i = 1; $i <= 3; $i++)	{
		echo $iSum[$i]."\n";
		if ($iSum[$i] > $iFinalAns)
			$iFinalAns = $iSum[$i];
	}

	echo $iFinalAns."\n";
?>


<?php
	$str = fopen("php://stdin", 'r');
	$n = stream_get_contents($s);
	$token = explode("\n",$n);
	$iPreNum=$dum[0];
	$iMidNum=$dum[1];
	$iFrontNum=$dum[2];

	echo $iPreNum." ".$iMidNum." ".$iFrontNum}."<br>";
?>


<?php
	$a = trim(fgets(STDIN));
	$b = trim(fgets(STDIN));
	$c = trim(fgets(STDIN));
	$data[] = $a+$b*$c;
	$data[] = ($a+$b)*$c;
	$data[] = $a*$b+$c;
	$data[] = $a*($b+$c)
	echo max($data);
?>


<?php
	$a = trim(fgets(STDIN));
	$b = trim(fgets(STDIN));
	$c = trim(fgets(STDIN));
	$data[] = $a+$b*$c;
	$data[] = ($a+$b)*$c;
	$data[] = $a*$b+$c;
	$data[] = $a*($b+$c);
	echo max($data);
?>


<?php
    fscanf(STDIN, "%d", $a);
   fscanf(STDIN, "%d", $b);
   fscanf(STDIN, "%d", $c);
   $ans1 = $a + $b * $c;
   $ans2 = $a * ($b + $c);
   $ans3 = $a * $b * $c;
   $ans4 = ($a + $b) *$c;
   echo max($ans1, $ans2, $ans3, $ans4);


<?php

$stdin = fopen("php://stdin", "r");
$stdout = fopen("php://stdout", "w");

fscanf($stdin, "%s %s %s", $r1, $r2, $r3);

function check() {
    global $r1, $r2, $r3;
    return ($r1[0] == $r3[2]) &&
    ($r1[1] == $r3[1]) &&
    ($r1[2] == $r3[0]) &&
    ($r2[0] == $r2[2]);
}

if(check()) {
    fprintf($stdout, "YES");
} else {
    fprintf($stdout, "NO");
}

fclose($stdin);
fclose($stdout);


<?php
$stdout = fopen('php://stdout', 'w');
fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$n = trim(fgets($h));
if (($n>=1)&($n<=exp(5*log(10))))
{
	for($i=1; $i<=$n; $i++)
	{
		$s = trim(fgets($h));
		$user[$i]=$s;
		}
		fputs(STDOUT, "Vihodnie dannie:  ");
		$k[$user[1]]=0;
		fputs(STDOUT, "OK ");
		for ($i=2; $i<=$n; $i++)
		{
			$f=false;
			for ($j=1; $j<=$i-1; $j++)
			{
				if ($user[$i]==$user[$j]) {$f=true; $k[$user[$i]]++; break;}
				else {$k[$user[$i]]=0;}
				}
				if ($f==false)
					{
						fputs(STDOUT, "OK ");
						}
						else
						{
							$s=$user[$i];
							$s.=$k[$user[$i]];
							fputs(STDOUT, "$s");
							fputs(STDOUT, " ");
							}
			}
	}
	else
	{fputs(STDOUT, "������ ����� ������ ���� �� ��������� 1<=n<=10^5");
?>


<?php
list($x, $y, $z) = explode(' ', trim(fgets(STDIN)));
$iDiv = $x - $y;
if($iDiv > 0 && $iDiv > $z){
    echo '+';
} elseif($iDiv > 0 && $iDiv < $z){
    echo '?';
} elseif ($iDiv > 0 && $iDiv <= $z){
    echo '?';
}

elseif ($iDiv == 0 && $iDiv <= $z){
    echo '?';
}

elseif ($iDiv < 0 && $iDiv > $z){
    echo '-';
} elseif($iDiv < 0 && $iDiv < $z){
    echo '?';
} elseif($iDiv < 0 && $iDiv <= $z){
    echo '?';
}

 elseif ($iDiv == 0 && $z == 0){
    echo '0';
}


<?php
    $n = trim(fgets(STDIN));
    $ans = 0;
    $sum = 0;
	for ($i = 1; $sum < $n; $i++) {
		$sum += ($sum+$i);
		$ans++;
	}
	echo $ans;
?>


<?php

###### IO ######
error_reporting(E_ALL);
#error_reporting(0);

function readString($f) {
	$r = array(
		"\r" => '',
		"\n" => '',
	);
	return strtr(fgets($f), $r);
}

function readNumString($f) {
	return trim(fgets($f));
}

function stringToArray($str) {
	return str_split($str);
}

function readNum($f, $is_int = false) {
	$v = readNumString($f);
	return $is_int ? intval($v) : floatval($v);
}

function readStringExplode($f, $delimiter = ' ') {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = 'trim';
	return array_map($callf, $return);
}

function readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = $is_int ? 'intval' : 'floatval';
	return array_map($callf, $return);
}

###### /IO ######

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	$n = readNum($f);
	$nums = array(1 => 1);
	$row = 1;
	$max = 1;
	while (true) {
		$total = array_sum($nums);
		$row++;
		$nums[$row] = $total + $row;
		if($total+$row>$n){
			break;
		}
		$max++;
	}
	echo $max;
	/* / end body */
}

if (empty($is_test))
	getAnswer();


<?php
// 492A     Ваня и кубики
$in = fopen("php://stdin", 'r');

$input_line = fgets($in);
$n = (int) $input_line;

//    list($xi, $yi, $zi) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$s = 0;

for ($i=1; $s <= $n; $i++) {
    $s += $i;
    $n -= $s;
}

echo $i - 1;

?>


<?php
$a = str_split(trim(fgets(STDIN)));
$b = array_unique($a);
if(count($b) == 1)
{
     print "0";
}
else
{
     $c = floor(count($a) / 2);
     $d = 0;
     $e = count($a) - 1;
     $f = 0;
     for($x = 0; $x < $c; $x++)
     {
          if($a[$d] != $a[$e])
          {
               $f = 1;
               break;
          }
     }
     if($f == 0)
     {
          print count($a) - 1;
     }
     elseif($f == 1)
     {
          print count($a);
     }
}
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = $b / $a;
if($c == 3)
{
    print "0";
}
elseif($c == 2)
{
    print $a;
}
else
{
    $d = ceil($c);
    $e = $d - $c;
    print $a * $e;
}
?>


<?php
list ($n1, $n2, $k1, $k2) = explode(' ', trim(fgets(STDIN)));

if ($n2 > $n1) {
  echo "Second\n";
} else {
  echo "First\n";
}


<?php
$fp = fopen("php://stdin", 'r');
$str = fgets($fp, 256);
//$str = '4';
//$str = '11';
$n = (int)$str;
$str = trim(fgets($fp, 256));
//$str = '****';
//$str = '.*.*...*.*.';
$level = $str;
$need_jump = 4; //Сколько прыжков надо сделать
$max_jump = floor(strlen($level) / $need_jump);
$res = false;
for ($curr_jump = 1; $curr_jump <= $max_jump; $curr_jump++)
{
	for ($step = 0; $step <= strlen($level) - $need_jump*$curr_jump; $step++)
	{
		if ($level[$step] != '*') continue;
		$res = true;
		//echo "\n";
		for ($i = 0; $i <= $need_jump; $i++)
		{
			//echo ($step + $i * $curr_jump + 1)." ";
			if ($level[$step + $i * $curr_jump] != '*')
			{
				$res = false;
				continue;
			}
		}
		if ($res) break;
	}
}
echo $res ? 'yes' : 'no';
?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
$q = trim(fgets($file));
$aArray = explode(" ", trim(fgets($file)));
$b = $aArray[0];
unset($aArray[0]);
$result = 0;
rsort($aArray);
while ($b<=$aArray[0]) {
    $b++;
    $aArray[0]--;
    rsort($aArray);
}


<?php
        $n = trim(fgets(STDIN));
        $a = explode(" ", trim(fgets(STDIN)));
        //print_r($a);
         $x = $a[0];
         $b = array_slice($a,1);
         rsort($b);
         $count = 0;
         print_r($b);
         while($x <= $b[0]){
             $b[0]--;
             $x++;
             $count++;
             rsort($b);
         }
         echo $count."\n";


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
            //$file = fopen('C:\\Users\\mohamed adel\\Desktop\\input.txt', 'r');
            $file = STDIN;
            $n = trim(fgets($file));
            $arr = explode(" ", trim(fgets($file)));
            function max_($n, &$arr){
                $id = 0; $m = $arr[0];
                for($i = 1; $i<$n; $i++){
                    if($arr[$i] >= $m){
                         $m = $arr[$i];
                         $id = $i;
                    }
                }
                return $id;
            }

            $x = $arr[0];
            $id = max_($n, $arr);
            while($id != 0){
                $arr[$id]--;
                $arr[0]++;
                $id = max_($n, $arr);

            }
            print $arr[$id]-$x;
            //print_r($arr);
        ?>
    </body>
</html>


<?php

list($n, $s) = explode("\n", file_get_contents("php://stdin"));

echo preg_replace("/o[go]+/", "***", $s);


<?php

$handle = fopen("php://stdin", "r");

fscanf($handle, "%i %i", $d, $e);

$exs = [];
$req = [];
$open = [];

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

    list($o, $s, $r) = array_map('intval', explode(' ', trim(fgets($handle))));

    $exs[$s] = $i;
    $req[$s] = $r;
    $open[$s] = $o;
}

if (array_sum($req) > $d - $e) {
    echo -1;
    exit;
}

asort($exs);

$schedule = [];

for ($i = 1; $i <= $d; $i++) {

    if (isset($req[$i])) {

        if ($req[$i] != 0) {
            echo -1;
            exit;
        }

        $schedule[] = $e + 1;
    } else {

        $needBrake = true;

        foreach ($exs as $ex => $p) {

            if ($req[$ex] != 0 && $open[$ex] <= $i) {

                $needBrake = false;

                $req[$ex]--;
                $schedule[] = $p + 1;
                break;
            }
        }

        if ($needBrake) {
            $schedule[] = 0;
        }
    }
}

echo implode(' ', $schedule);


<?php

function dd($t) {
    if (is_array($t)) {
        print_r($t);
        die;
    }
    var_dump($t);
    die;
}

// Read
$in = fopen( 'php://stdin', 'r' );
$line = explode(' ', fgets($in));
fclose($in);

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

function getSolution($n, $ribbons)
{
    $dp = array_fill(0, $n+5, -10000);
    foreach ($ribbons as $r) {
        for ($i = $r; $i <= $n; $i++) {
            $dp[$i] = max($dp[$i], $dp[$i-$r] + 1);
        }
    }
    return $dp[$n];
}

// Write
$out = fopen('php://stdout', 'w');
$ribbons = [$a, $b, $c];
$answer = getSolution($n, $ribbons);
fputs($out, $answer);
fclose($out);


<?php
list ($L, $n1, $n2, $n3) = explode(" ", trim(fgets(STDIN)));
$parts = Array($n1, $n2, $n3);
sort($parts);
function f($x, $N, $L)
{
    global $CACH, $parts;
    $CACH[$x] = $N;
    foreach ($parts as $part)
        if (($CACH[$x + $part] < $N + 1) && ($x + $part <= $L)) {
            if ($x + $part == $L){
                echo $N+1;
                exit();
            }

            f($x + $part, $N + 1, $L);
        }
}
f(0, 0, $L);
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$a *= 4;
$c = explode(" ", trim(fgets(STDIN)));
$d = array();
for($x = 0; $x < $b; $x++)
{
     $e = ceil($c[$x] / 2);
     $d[$x] = $e;
}
$f = array_sum($d);
if($a == $b)
{
     $g = $b / 4;
     $h = $b * 2 - $g;
     $i = array_sum($c);
     if($i <= $h)
     {
          print "YES";
     }
     else
     {
          print "NO";
     }
}
else
{
     if($f <= $a)
     {
          print "YES";
     }
     else
     {
          print "NO";
     }
}
?>


<?php
function input()
{
    while (($line = fgets(STDIN)) != PHP_EOL) {
        yield $line;
    }
}

function put($r)
{
    echo $r . PHP_EOL;
}

$COUNT = 0;
foreach (input() as $line) {
    if ($COUNT == 0) {
        list($n, $s) = explode(' ', $line);
        ++$COUNT;
        continue;
    }
    $q = $line;

    for($i = 0; $i<$s; ++$i) {
        for($j = strlen($q)-1; $j>0; --$j) {
            if ( $q[$j] == 'G' && $q[$j-1] == 'B') {
                $z = $q[$j-1];
                $q[$j-1] = $q[$j];
                $q[$j] = $z;
            }
        }
    }

    put($q);

    if (++$COUNT > 1) {
        break;
    }

}


<?php
	list($n,$t) = explode(fgets(STDIN));
	$var = str_split(fgets(STDIN));
	for ($x=0;$x<$t;$x+) {
		for($y=count($var)-1;$y>0;$y--) {
			if ($var[$y] == 'G' && $var[$y-1] == 'B') {
				$var[$y] = 'B';
				$var[$y-1] = 'G';
			}
		}
	}
	echo implode('',$var);


<?php
	list($n,$t) = explode(' ',trim(fgets(STDIN)));
	$var = str_split(trim(fgets(STDIN)));
	for ($x=0;$x<$t;$x++) {
		for($y=0;$y<count($var);$y++) {
			if ($var[$y] == 'B' && $var[$y+1] == 'G') {
				$var[$y] = 'G';
				$var[$y+1] = 'B';
			}
		}
	}
	echo implode('',$var);


<?php
$a = trim(fgets(STDIN));
$b = 1;
$c = 1;
while(TRUE)
{
     if($a <= $b)
     {
          print $c;
          break;
     }
     else
     {
          $c++;
          $b += $c;
     }
}
?>


<?php
$IN = STDIN;
fscanf($IN, "%d %d %d %d %d %d", $k1, $k2, $k3, $k4, $a, $b);
$min = min(array($k1, $k2, $k3, $k4));
if ($min>$b)
   echo $b-$a;
elseif (($min>$a)&&($min<$b))
  echo $min - $a;
else
    echo 0;
?>


<?php

	list($n,$k)=explode(' ',fgets(STDIN));

	$a=explode(' ',fgets(STDIN));

	$ke=$k-1;
	$score=$a[$ke];
	$jlh=0;
	$x=count($a)

	if ($score > 0)
	{
		for($i=0;$i<=$x;$i++)
		{
			if($a[$i] >= $score)
			{
				$jlh=$jlh+1;
			}
		}
	}

	echo $jlh;

?>


<?php
	$jumlah = 0;

	$nilai_x2 = explode(" ",$fgets(STDIN));
	$nilai_y2 = explode(" ",$fgets(STDIN));

	$posisi = intval($nilai_x2[1]) - 1;

	$nilai_pembanding = $nilai_y2[$posisi];

	foreach($nilai_y2 as $value)
	{
		if((intval($value) >= intval($nilai_pembanding)) && intval($value) != 0)
			$jumlah = $jumlah + 1;
	}

	echo $jumlah;

?>


<?php

// следующий раунд

fscanf(STDIN, '%d%d\n', $n, $k);

$participants = array();
$line = fgets(STDIN);
$points = explode(' ', $line);
$result = array();

// $points[$k] - позиция $k

for($i = 0; $i < $n; $i++) {
	if ($points[$i] > 0) {
		if($points[$i] >= $points[$k]) {
			array_push($result, $points[$i]);
		}
	}
}

printf(count($result));


<?php

function answer ($res) {
    echo $res;
    exit();
}

$nk = explode(' ', fgets(STDIN));
$scores = explode(' ', fgets(STDIN));

$n = (int)$nk[0];
$k = (int)$nk[1];

if(array_key_exists($k-1, $scores) && ($n >= 1 && $n <= 50) && ($k <= $n && $k >= 1) && count($scores) >= $n) {
    $needle = (int)$scores[$k-1];
} else {
    answer(0);
}

if($needle <= 0 || $needle > 100) {
    answer(0);
}

$passed = 0;

for($i=0; $i < count($scores); $i++) {
    $score = (int)$scores[$i];

    if($score >= $needle && $score > 0 && $score <= 100) {
        $passed++;
    }
}

answer($passed);


<?php
	$in = fopen("input.txt", "r");
	$out = fopen("output.txt", "w");
	$a = array();

	$n = (int) fgets($in);
	$m = (int) fgets($in);
	$mxRes = 0;
	$i = 0;

	for ($i = 0; $i < $n; $i++) {
		$a[$i] = (int) fgets($in);

		// fwrite($out, $a[$i]);
		if ($a[$i] > $mxRes) {
			$mxRes = $a[$i];
		}
	}
	$res2 = $mxRes + $m;
	$res1 = $mxRes + (int)($m / $n) + ($m % $n != 0);

	fwrite($out, $res1." ".$res2);
	// echo $res1." ".$res2;

	// while(!feof($in)) {
	// 	$a[$cnt++] = fgets($in);
 //  		// echo fgets($in) . "
";
	// }

	// for ($i = 0; $i < $cnt; $i++) {
	// 	# code...
	// 	echo $a[$i]."
";
	// }
	// while () {
	// 	$cnt++;
	// 	$text = fgets($in);
	// 	fwrite($out, $text);
	// }

	// $text = fgets($in);

	// fwrite($out, $text);

	fclose($in);
	fclose($out);
 ?>


<?php
	$a = array();

	$n = (int) fgets(STDIN);
	$m = (int) fgets(STDIN);
	$mxRes = 0;
	$i = 0;

	for ($i = 0; $i < $n; $i++) {
		$a[$i] = (int) fgets(STDIN);

		if ($a[$i] > $mxRes) {
			$mxRes = $a[$i];
		}
	}
	$res2 = $mxRes + $m;
	$res1 = $mxRes + (int)($m / $n) + ($m % $n != 0);

	//fwrite($out, $res1." ".$res2);
        print $res1 . " " . $res2;

	//fclose($in);
	//fclose($out);
 ?>


<?php

fscanf(STDIN,"%d%d",$n,$m);
echo min($n,$m,($n+$m)/3);


<?php
list($n, $k) = explode(' ', trim(fgets(STDIN)));
$a = explode(' ', trim(fgets(STDIN)));

$c = 0;

foreach ($a as $value)
	if ($value > 0 && $value >= $a[$k])
		$c++;
	else
		break;
echo $c;


<?php
$pl    = (int)fgets(STDIN);
$place = (int)fgets(STDIN);
$balls = fgets(STDIN);

$ballsArray = explode(' ', $balls);

$count = $ballsArray[$place-1] > 0 ? $ballsArray[$place-1] : 0;
for ($i = $place; ($i >= $pl) || ($ballsArray[$i] == $ballsArray[$place-1]); $i++) {
    if ($ballsArray[$i]) {
        $count++;
    }
}

echo $count;


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

    for($i=2;$i<strlen($string);++$i){
        for($j=0;$j<$i-1;++$j){
            $tmp[]=substr($string, $j, $i-$j);
        }
    }

    $curMaxLen=0;
    $count = array_count_values($tmp);
    foreach($tmp as $elem){
        if(($count[$elem]>=2)&&($curMaxLen<strlen($elem))) $curMaxLen=strlen($elem);
    }

    fputs($stdout, $curMaxLen);

?>


<?php

$str = trim(fgets(STDIN));

$hasSubstr = array();

$maxLen = 0;

for ($pos = 0; $pos < strlen($str); $pos++) {
    for ($len = 1; $len <= strlen($str) - $pos; $len++)  {
        $substr = substr($str, $pos, $len);
        if (isset($hasSubstr[$substr])) {
            echo "Checking substr: " . $substr . "\n";
            if ($len > $maxLen) $maxLen = $len;
        }
        else
        {
            $hasSubstr[$substr] = true;
            echo "Adding substr: " . $substr . "\n";
        }
    }
}
/*
function findPairs($string) {
    for ($i = 0; $i < strlen($string); $i++) {
        for ($j = 1; $j < strlen($string) - $i; $j++) {
            if ($string[$i] == $string[$i + $j]) {
                $pairs[] = array($i, $i + $j);
                $len = 1;
            }
        }
    }
    return $pairs;
}

function findLength($array, $string) {
    foreach ($array as $value) {
        if (max($value) > $last) $last = max($value);
    }
    for ($i = 0; $i <= strlen($string) - $last; $i++) {
        for ($j = 1; $j < strlen($string); $j++) {
            $index0 = $array[$i][0];
            $index1 = $array[$i][1];
                if ($string[$index0 + $j] == $string[$index1 + $j]) $len = $j + 1;
            else break;
        }
    }
    return $len;
}

$length = findLength(findPairs($line), $line);
*/
print($maxLen);

?>


<?php
$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
$c=trim(fgets(STDIN));
$arr=array();
$arr[0]=$a + $b * $c;
$arr[1]=$a * ($b + $c);
$arr[2]=$a * $b * $c;
$arr[3]=($a + $b) * $c;

echo max($arr);

?>


<?php
$variant = [];
$result = 0;

fscanf(STDIN, "%d\n", $variant[0]);
fscanf(STDIN, "%d\n", $variant[1]);
fscanf(STDIN, "%d\n", $variant[2]);

// визначити найбільше число
// додати два менших і помножити на більше
if($variant[0] == max($variant)){
	//максимальное число находится в начале
	$result = $variant[0] * ($variant[1] + $variant[2]);
	//echo "first if";
} elseif($variant[2] == max($variant)) {
	// максимальное значение в хвосте
	$result = ($variant[0] + $variant[1]) * $variant[2];
	//echo "second if";
} else {
	// максимальное значение находится в середине
	// (тестирую, можно ли дважды юзать умножение)
	$result = $variant[0] * $variant[1] * $variant[2];
	//echo "third if - else";
}

print_r($result);


<?php
$n = 2; //0 ≤ n < 1000000000

function soroban09($int)
{

    if ($int == 0) {
        $int = 'O-|-OOOO';
    }
    if ($int == 1) {
        $int = 'O-|O-OOO';
    }
    if ($int == 2) {
        $int = 'O-|OO-OO';
    }
    if ($int == 3) {
        $int = 'O-|OOO-O';
    }
    if ($int == 4) {
        $int = 'O-|OOOO-';
    }
    if ($int == 5) {
        $int = '-O|-OOOO';
    }
    if ($int == 6) {
        $int = '-O|O-OOO';
    }
    if ($int == 7) {
        $int = '-O|OO-OO';
    }
    if ($int == 8) {
        $int = '-O|OOO-O';
    }
    if ($int == 9) {
        $int = '-O|OOOO-';
    }
    return $int;

}

$n = intval($n);

if ($n < 0) {
    die('n must be positive integer value');
} elseif ($n >= 1000000000) {
    die('n must be <1000000000');
}

$n = array_reverse(array_map('intval', str_split($n)));

foreach ($n as $srb) {
    echo soroban09($srb) . "\n";
}


<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');
    $matrix[0] = fgets($stdin);
    $matrix[1] = fgets($stdin);
    $matrix[2] = fgets($stdin);

    function illegal(){
        fputs(fopen('php://stdout', 'w'), "illegal");
        exit();
    }

    function checkingForWinner($matr, $nulls, $crosses){
        $won = null;

        for($i=0; $i<3; ++$i){
            if(($matr[$i][0]==$matr[$i][1])&&($matr[$i][1]==$matr[$i][2])){
                if($matr[$i][0]==".") continue;

                if($won != null) illegal();
                $won = $matr[$i][0]=="X" ? "first" : "second";

                if(($won=="first")&&($nulls == $crosses)) illegal();

                else if(($won=="second")&&($nulls < $crosses)) illegal();
            }
        }

        if($won!=null){
            fputs(fopen('php://stdout', 'w'), "the " . $won . " player won");
            exit();
        }
    }

    //Checking for legacy
    $nulls = 0;
    $crosses = 0;
    $reversed = array();

    for($i=0; $i<3; ++$i){
        for($j=0; $j<3; ++$j){
            if($matrix[$i][$j] == "0") $nulls++;
            else if($matrix[$i][$j] == "X") $crosses++;

            $reversed[$j][$i] = $matrix[$i][$j];
        }
    }

    if(($crosses - $nulls != 1)&&($crosses - $nulls != 0)) illegal();

    checkingForWinner($matrix, $nulls, $crosses);
    checkingForWinner($reversed, $nulls, $crosses);

    //checking the crosses for winner
    if((($matrix[0][0]==$matrix[1][1])&&($matrix[1][1]==$matrix[2][2]))||
    (($matrix[0][2]==$matrix[1][1])&&($matrix[1][1]==$matrix[2][0]))){
        $won = $matr[1][1]=="X" ? "first" : "second";

        if(($won == "first")&&($nulls == $crosses)) illegal();

        else if(($won=="second")&&($nulls < $crosses)) illegal();

        fputs($stdout, "the " . $won . " player won");
        return;
    }

    if($nulls + $crosses > 8) {
        fputs($stdout, "draw");
        return;
    }

    if($crosses > $nulls) {
        fputs($stdout, "second");
    } else {
        fputs($stdout, "first");
    }
?>


<?php

$a = array();

fscanf(STDIN, "%s", $a[0]);
fscanf(STDIN, "%s", $a[1]);
fscanf(STDIN, "%s", $a[2]);

function demX($a, $d) {
	$dem = 0;
	for ($i = 0; $i < 3; $i++) {
		for ($j = 0; $j < 3; $j++) {
			if ($a[$i][$j] == $d) {
				$dem++;
			}
		}
	}
	return $dem;
}

function checkwin($a, $b, $c, $d) {
	return ($a == $d && $b == $d && $c == $d);
}

function checkwin2($a, $b, $c, $d) {
	return checkwin($a[0], $a[1], $a[2], $d) || checkwin($b[0], $b[1], $b[2], $d) || checkwin($c[0], $c[1], $c[2], $d) || checkwin($a[0], $b[0], $c[0], $d) || checkwin($a[1], $b[1], $c[1], $d) || checkwin($a[2], $b[2], $c[2], $d) || checkwin($a[0], $b[1], $c[2], $d) || checkwin($a[2], $b[1], $c[0], $d);
}

function tinh($a) {
	$dem1 = demX($a, 'X');
	$dem2 = demX($a, '0');
	if ($dem1 - $dem2 > 1 || $dem2 - $dem1 > 1) {
		return "illegal";
	} else {
		if (checkwin2($a[0], $a[1], $a[2], 'X')) {
			if (checkwin2($a[0], $a[1], $a[2], '0')) {
				return "illegal";
			} else {
				if ($dem1 > $dem2) {
					return "the first player won";
				} else {
					return "illegal";
				}
			}
		} else {
			if (checkwin2($a[0], $a[1], $a[2], '0')) {
				if ($dem1 == $dem2) {
					return "the second player won";;
				} else {
					return "illegal";
				}
			} else {
				if ($dem1 + $dem2 == 9) {
					return "draw";
				} else {
					if ($dem1 > $dem2) {
						return "second";
					} else if ($dem1 == $dem2) {
						return "first";
					} else {
						return "illegal";
					}
				}
			}
		}
	}
}

echo tinh($a);


<?php
$line0 = trim(fgets(STDIN));
$line1 = trim(fgets(STDIN));
$line2 = trim(fgets(STDIN));

$line0 = str_split($line0);
$line1 = str_split($line1);
$line2 = str_split($line2);

$data = array_merge($line0, $line1, $line2);

$counts = array();
$counts['X'] = 0;
$counts['O'] = 0;
$counts['.'] = 0;

foreach ($data as $value) {
    $counts[$value]++;
}

$illegal = false;
$draw = false;

// illegal

if (abs($counts['X'] - $counts['0']) > 1 || $counts['0'] > $counts['X']) $illegal = true;

// defining if someone won

function fullRow($array, $rowNum, $sign) {
    $index = $rowNum * 3;

    if ($array[$index] == $sign && $array[$index + 1] == $sign && $array[$index + 2] == $sign) return true;
    else return false;
}

function fullCol($array, $colNum, $sign) {
    if ($array[$colNum] == $sign && $array[$colNum + 3] == $sign && $array[$colNum + 6] == $sign) return true;
    else return false;
}

function fullDiag1($array, $sign) {
    if ($array[0] == $sign && $array[4] == $sign && $array[8] == $sign) return true;
    else return false;
}

function fullDiag2($array, $sign) {
    if ($array[2] == $sign && $array[4] == $sign && $array[6] == $sign) return true;
    else return false;
}

function playerWon($array, $sign) {
    for ($i = 0; $i < 3; $i++)
    {
        if (fullCol($array, $i, $sign)) return true;
        if (fullRow($array, $i, $sign)) return true;
    }

    if (fullDiag1($array, $sign) || fullDiag2($array, $sign)) return true;
    else return false;
}

$xWon = playerWon($data, 'X');
$oWon = playerWon($data, '0');

if ($xWon and $oWon) $illegal = true;

// draw

if ($illegal) echo 'illegal';
else if ($xWon || $oWon)
{
        if ($xWon) echo 'the first player won';
        else echo 'the second player won';
}
else
{
    if ($counts['X'] + $counts['0'] == 9)
    {
        echo 'draw';
    }
    else
    {
        if ($counts['X'] > $counts['0']) echo 'second';
        if ($counts['X'] <= $counts['0']) echo 'first';
        //else echo 'first';
    }
}

?>


<?php
/** chaotic_iak's solution in PHP 5.4 to the problem 322B (Round 190 Div 2 Problem B) in Codeforces **/

/** Module for retrieving input **/

// If this is a local test (a variable declared in a specialized page to open this script), open from localtest.txt instead of php://stdin (because I'm too lazy to supply the arguments by stdin)
if (isset($localtest)) {$stdin = fopen("localtest.txt", "r");} else {$stdin = fopen("php://stdin", "r");}

// A function to retrieve the next line. Takes one optional argument $single, which should be true if the next line (based on problem's specification) has only one number/string/whatever, so I don't have to do silly things like $raw = g(); $num = $raw[0];
function g($single = false) {

	// Take the global $stdin variable aka the file handler so we can access it from this function
	global $stdin;

	// Take the input from the handler, trim it, and explode it based on space (" 1 2 3 " becomes array("1", "2", "3")); trim is usually to remove trailing \r
	$input = explode(" ", trim(fgets($stdin)));

	// If the line is not a single number, return the whole array, otherwise simply return the single string that we exploded for nothing
	if (!$single) {return $input;} else {return $input[0];}
}

/** Imported functions from chaotic_iak's library **/
// none

/** chaotic_iak's solution **/
// This is a competitive programming solution. The code is not remarked (because I want speed).

$raw = g();
$r = $raw[0];
$g = $raw[1];
$b = $raw[2];

$min = ($r < $g) ? $r : $g;
$min = ($min < $b) ? $min : $b;

$r -= $min;
$g -= $min;
$b -= $min;
$res = $min;
$max = 0;

for ($i = 0; $i < 3; $i++) {
	$r += $i;
	$g += $i;
	$b += $i;
	$res += (($r - ($r % 3)) / 3) + (($g - ($g % 3)) / 3) + (($b - ($b % 3)) / 3) - $i;
	$max = ($max < $res) ? $res : $max;
	$res = $min;
	$r -= $i;
	$g -= $i;
	$b -= $i;
}

echo $max;


<?php

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

    $n = fgets($stdin);

    $count_final=0;// кол-во почти простых чисел
    //каждое число проверяем на почти простоту
    for($i=1;$i<=$n;++$i){
        $list_divided = array();
        $cur = $i;
        for($j=2; $j<$n/2;++$j){
            if(count($list_divided) == 2) break;
            foreach($list_divided as $tmp){
                if(fmod($cur, (double)$tmp)==0){
                    $j++;
                    break;
                }
            }
            if(fmod($cur, (double)$j) == 0){
                $list_divided[]=$j;
                while(fmod($cur,(double)$j) == 0){
                    $cur/=$j;
                }
                if(($cur == 1)&&(count($list_divided)==2)){
                    $count_final++;
                    break;
                }
            }
        }
    }
    fputs($stdout, $count_final);

?>


<?php
function gcd ($x , $y)
{
   if($x < $y)
   {
     $tmp = $x ;
     $x = $y;
     $y = $tmp;
   }
  if($x%$y == 0)
      return $y;
  return gcd($x%$y , $y);
}
fscanf(STDIN , "%d%d%d" , $x,$y,$n);
$lcm =($x * $y)/ gcd($x,$y);
echo $n / $lcm;


<?php

$number = readline();

$stringNumbers = array(
    1 => 'one',
    2 => 'two',
    3 => 'three',
    4 => 'four',
    5 => 'five',
    6 => 'six',
    7 => 'seven',
    8 => 'eight',
    9 => 'nine',
    10 => 'ten',
    11 => 'eleven',
    12 => 'twelve',
    13 => 'thirteen',
    15 => 'fifteen'
);

$stringFirstNumbers = array(
    1 => '',
    2 => 'twenty',
    3 => 'thirty',
    4 => 'forty',
    5 => 'fifty',
    6 => 'sixty',
    7 => 'seventy',
    8 => 'eighty',
    9 => 'ninety',
);

if ($number <= 13 || $number == 15)
    echo $number == 0 ? 'zero' : $stringNumbers[$number];

else {
    $firstNumber = $number / 10;
    $secondNumber = $number % 10;

    if ((int)$firstNumber == 1) echo $stringNumbers[(int)$secondNumber].'teen';

    else echo $stringNumbers[(int)$secondNumber] ? $stringFirstNumbers[(int)$firstNumber].'-'.$stringNumbers[(int)$secondNumber] : $stringFirstNumbers[(int)$firstNumber];
}


<?php
// Входящее число: [0 < s < 99]
$s = fgets(STDIN);
// Список числе от 1 до 19, 20, 30, 40, 50, 60, 70, 80, 90
$numbers = array('0' => 'zero', '1' => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', '8' => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety');
// Если число меньше или равно 19
if ($s <= 19) {
	$result = $numbers[$s];
} else {
	// Проверяем второй символ введенного числа
	if($s[1]==0) {
		// Если 0, то выводим из массива
		$result = $numbers[$s];
	} else {
		// Если нет, то собираем число
		$first_number = $numbers[$s[0].'0'];
		$second_number = $numbers[$s[1]];
		$result = $first_number.'-'.$second_number;
	}
}
printf($result);
?>