<?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 123 Division 2 Problem B
function func($in) {
$balls = $in[0];
$baskets = $in[1];

$str = "";
for ($x = 1; $x <= $baskets; $x++) {
	if ($x % 2 == 0) {
		if ($baskets % 2 == 0) {
			$str .= (($baskets + $x) / 2) . "\n";
		} else {
			$str .= (($baskets - $x + 1) / 2) . "\n";
		}
	} else {
		if ($baskets % 2 == 0) {
			$str .= (($baskets - $x + 1) / 2) . "\n";
		} else {
			$str .= (($baskets + $x) / 2) . "\n";
		}
	}
}

$res = "";
while ($balls >= $baskets) {
	$res .= $str;
	$balls -= $baskets;
}
$strs = explode("\n", $str);
for ($x = 0; $x < $balls; $x++) {
	$res .= $strs[$x] . "\n";
}
return substr($res, 0, strlen($res) - 1);
}

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

<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$n = (int)$Input->in();
	$m = (int)$Input->in();

	$r = $m % 2;

	if ($r === 0) {

		$first = intval($m / 2);
		$basket = $first;
		$sum = 2 * $first + 1;

		for ($i = 0; $i < $n; $i++)
		{
			if ($i % 2 === 0)
			{
				print($basket);

			} else {

				print($sum - $basket);

				if ($sum - $basket === $m) $basket = $first;
				else $basket -= 1;
			}

			if ($i != $n - 1) print("\n");
		}

	} else {

		$first = intval($m / 2) + 1;
		$basket = $first;
		$sum = 2 * $first;
		$flag = 1;

		for ($i = 0; $i < $n; $i++)
		{
			if ($flag === 1)
			{
				print($sum - $basket);

				if ($sum - $basket === $m) $basket = $first;
				else {
					$basket -= 1;
					$flag = 0;
				}

			} else {

				print($basket);
				$flag = 1;
			}

			if ($i != $n - 1) print("\n");
		}
	}
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$n = (int)$Input->in();
	$m = (int)$Input->in();

	$baskets = array_fill(1, $m, 0);

	for ($i = 0; $i < $n; $i++)
	{
		$min_ball = min($baskets);
		$min_middle = 10E5 + 1;
		$pos = -1;

		for ($j = 1; $j <= $m; $j++)
		{
			if ($baskets[$j] === $min_ball)
			{
				if (abs(intval(($m + 1) / 2)) - $j < $min_middle)
				{
					$pos = $j;
					$min_middle = abs(intval(($m + 1) / 2)) - $j;
				}
			}
		}

		$baskets[$pos]++;

		print($pos);

		if ($i !== $n -1) print("\n");
	}
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$n = (int)$Input->in();
	$m = (int)$Input->in();

	$r = $m % 2;

	if ($r === 0) {

		$first = intval($m / 2);
		$basket = $first;
		$sum = 2 * $first + 1;

		for ($i = 0; $i < $n; $i++)
		{
			if ($i % 2 === 0)
			{
				print($basket);

			} else {

				print($sum - $basket);

				if ($sum - $basket === $m) $basket = $first;
				else $basket -= 1;
			}

			if ($i != $n - 1) print("\n");
		}

	} else {

		$first = intval($m / 2) + 1;
		$basket = $first;
		$sum = 2 * $first;

		for ($i = 0; $i < $n; $i++)
		{
			if ($i % 2 === 0)
			{
				print($sum - $basket);

				if ($sum - $basket === $m) $basket = $first;
				else $basket -= 1;

			} else {

				print($basket);
			}

			if ($i != $n - 1) print("\n");
		}
	}
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$n = (int)$Input->in();
	$m = (int)$Input->in();

	$baskets = array_fill(1, $m, 0);

	for ($i = 0; $i < $n; $i++)
	{
		$min_ball = min($baskets);
		$min_middle = 10E5 + 1;
		$pos = -1;

		for ($j = 1; $j <= $m; $j++)
		{
			if ($baskets[$j] === $min_ball)
			{
				if (abs(intval(($m + 1) / 2) - $j) < $min_middle)
				{
					$pos = $j;
					$min_middle = abs(intval(($m + 1) / 2) - $j);
				}
			}
		}

		$baskets[$pos]++;

		print($pos);

		if ($i !== $n -1) print("\n");
	}
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){

	//$Input = new Input("input.txt");
	$Input = new Input();

	$n = (int)$Input->in();
	$m = (int)$Input->in();

	$r = $m % 2;

	if ($r === 0) {

		$first = intval($m / 2);
		$basket = $first;
		$sum = 2 * $first + 1;

		for ($i = 0; $i < $n; $i++)
		{
			if ($i % 2 === 0)
			{
				print($basket);

			} else {

				print($sum - $basket);
				$basket -= 1;

				if ($basket === 0) $basket = $first;
			}

			if ($i != $n - 1) print("\n");
		}

	} else {

		$first = intval($m / 2) + 1;
		$basket = $first;
		$sum = 2 * $first;

		for ($i = 0; $i < $n; $i++)
		{
			if ($i % 2 === 0)
			{
				print($sum - $basket);
				$basket -= 1;

				if ($basket === 0) $basket = $first;

			} else {

				print($basket);
			}

			if ($i != $n - 1) print("\n");
		}
	}
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");
			$contents = stream_get_contents($this->handle);

		} else {

			$contents = stream_get_contents(STDIN);

		}

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?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 123 Division 2 Problem B
function func($in) {
$balls = $in[0];
$baskets = $in[1];

$str = "";
for ($x = 1; $x <= $baskets; $x++) {
	if ($x % 2 == 0) {
		if ($baskets % 2 == 0) {
			$str .= (($baskets + $x) / 2) . "\n";
		} else {
			$str .= (($baskets - $x + 1) / 2) . "\n";
		}
	} else {
		if ($baskets & 2 == 0) {
			$str .= (($baskets - $x + 1) / 2) . "\n";
		} else {
			$str .= (($baskets + $x) / 2) . "\n";
		}
	}
}

$res = "";
while ($balls >= $baskets) {
	$res .= $str;
	$balls -= $baskets;
}
$strs = explode("\n", $str);
for ($x = 0; $x < $balls; $x++) {
	$res .= $strs[$x] . "\n";
}
return substr($res, 0, strlen($res) - 1);
}

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


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

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

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

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

        for($i = 0; $i < $n; $i ++) $numbers[$i] = intval($numbers[$i]) ;
        sort($numbers) ;

        $ans = array() ;

        if($n & 1)
        {
            $l = $n / 2 - 1 ;
            $r = $n / 2 + 1 ;

            array_push($ans, $numbers[$n/2]) ;
        }
        else
        {
            $l = $n / 2 - 1 ;
            $r = $n / 2 ;
        }

        while($l >= 0)
        {
            array_push($ans, $numbers[$l], $numbers[$r]) ;

            $l -- ;
            $r ++ ;
        }

        echo implode(" ", $ans) . "\n" ;
    }
?>

<?php
for ($t = intval(fgets(STDIN)); $t > 0; $t--){
    $size = intval(fgets(STDIN));
    $array = explode(" ", trim(fgets(STDIN)));
    sort($array);
    if($size % 2 == 0){
        for($i = $size / 2; $i < $size; $i++){

            echo $array[$i]." ".$array[$size - $i - 1]." ";
        }
        echo "\n";
    }

    else{
        echo $array[floor($size / 2)]." ";
        for($i = floor($size / 2) + 1; $i < $size; $i++){

            echo $array[$i]." ".$array[$size - $i - 1]." ";
        }
        echo "\n";
    }

}

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

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

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

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

        for($i = 0; $i < $n; $i ++) $numbers[$i] = intval($numbers[$i]) ;
        sort($numbers) ;

        $min_pos = 1 ;
        $min_val = $numbers[1] - $numbers[0] ;

        for($i = 1; $i < $n; $i ++)
        {
            if($numbers[$i] - $numbers[$i - 1] < $min_val)
            {
                $min_val = $numbers[$i] - $numbers[$i - 1] ;
                $min_pos = $i ;
            }
        }

        $ans = array() ;
        array_push($ans, $numbers[$min_pos - 1], $numbers[$min_pos]) ;

        $l = $min_pos - 2 ;
        $r = $min_pos + 1 ;
        $len = 2 ;

        for($i = 2; $i < $n; $i ++)
        {
            $tmp_a = PHP_INT_MAX ;
            $tmp_b = PHP_INT_MAX ;

            if($l >= 0)
            {
                $tmp_a = $ans[$len - 1] - $numbers[$l] ;
                if($tmp_a < 0) $tmp_a = -$tmp_a ;
            }
            if($r < $n)
            {
                $tmp_b = $ans[$len - 1] - $numbers[$r] ;
                if($tmp_b < 0) $tmp_b = -$tmp_b ;
            }

            if($tmp_a < $tmp_b)
            {
                array_push($ans, $numbers[$l]) ;
                $l -- ;
                $len ++ ;
            }
            else
            {
                array_push($ans, $numbers[$r]) ;
                $r ++ ;
                $len ++ ;
            }
        }

        echo implode(" ", $ans) . "\n" ;
    }
?>


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

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

for ($i = 0; $i < $t; $i++) {
  $n = trim(fgets($file));
  $d = decbin($n);
  $b = ''; $c ='';

  for ($j = 1; $j < strlen($d); $j++) { $b .= '1'; }

  $b = bindec($b);
  echo $b.PHP_EOL;
}

?>

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

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

for ($i = 0; $i < $t; $i++) {
  $n = trim(fgets($file));
  $d = decbin($n);
  $b = ''; $c ='';

  for ($j = 0; $j < strlen($d); $j++) {
    if ($d[$j] == '0') { $b .= '1'; }
    else { $b .= '0'; }
  }
  $b = ltrim($b, "0");
  $b = bindec($b);
  if ($n > 3) echo $b + 1;
  else echo $b;
  echo PHP_EOL;
}

?>

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

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

for ($i = 0; $i < $t; $i++) {
  $n = trim(fgets($file));
  $d = decbin($n);
  $b = ''; $c ='';

  for ($j = 0; $j < strlen($d); $j++) {
    if ($d[$j] == '0') { $b .= '1'; }
    else { $b .= '0'; }
  }
  $b = ltrim($b, "0");
  $b = bindec($b);
  if ($b != 1) echo $b + 1;
  else echo 1;
  echo PHP_EOL;
}

?>


<?php

error_reporting(0);

solve();

function solve(){
	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();
	$M = (int)$Input->in();

	for ($i = 0; $i < $N; $i++) {
		$temp = $Input->in();
		$len = strlen($temp);

		for ($j = 0; $j < $len; $j++) {
			if ($temp[$j] === "*") {
				$posX[] = $i;
				$posY[] = $j;
			}
		}
	}

	for ($i = 0; $i < count($posX) - 1; $i++) {
		if ($posX[$i]!== $posX[$i + 1] && $posY[$i] !== $posY[$i + 1] && $flag !== 1) {
			$dia_pos[] = $i;
			$dia_pos[] = $i + 1;
			$flag = 1;
		}
	}

	if (count($dia_pos) !== 2) {
		$no_dia_pos = 1;
		$dia_pos[] = 0;
		$dia_pos[] = 2;
	} else {
		$no_dia_pos = 3 - array_sum($dia_pos);
	}
	$ans[0] = $posX[$dia_pos[0]] + $posX[$dia_pos[1]] - $posX[$no_dia_pos] + 1;
	$ans[1] = $posY[$dia_pos[0]] + $posY[$dia_pos[1]] - $posY[$no_dia_pos] + 1;
	print($ans[0]. " ". $ans[1]);
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");

			if (!feof($this->handle)) $contents = stream_get_contents($this->handle);
		} else $contents = stream_get_contents(STDIN);

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){
	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();
	$M = (int)$Input->in();

	for ($i = 0; $i < $N; $i++) {
		$temp = $Input->in();
		$len = strlen($temp);
		for ($j = 0; $j < $len; $j++) {
			if ($temp[$j] === "*") $pos[] = $i. $j;
		}
	}

	for ($i = 0; $i < count($pos); $i++) {
		if ($pos[$i][0] !== $pos[$i + 1][0] && $pos[$i][1] !== $pos[$i + 1][1] && $flag !== 1) {
			$dia_pos[] = $i;
			$dia_pos[] = $i + 1;
			$flag = 1;
		}
	}

	if (count($dia_pos) !== 2) {
		$no_dia_pos = 1;
		$dia_pos[] = 0;
		$dia_pos[] = 2;
	} else {
		$no_dia_pos = 3 - array_sum($dia_pos);
	}
	$ans[0] = $pos[$dia_pos[0]][0] + $pos[$dia_pos[1]][0] - $pos[$no_dia_pos][0] + 1;
	$ans[1] = $pos[$dia_pos[0]][1] + $pos[$dia_pos[1]][1] - $pos[$no_dia_pos][1] + 1;
	print($ans[0]. " ". $ans[1]);
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");

			if (!feof($this->handle)) $contents = stream_get_contents($this->handle);
		} else $contents = stream_get_contents(STDIN);

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){
	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();
	$M = (int)$Input->in();

	for ($i = 0; $i < $N; $i++) {
		$temp = $Input->in();
		$len = strlen($temp);
		for ($j = 0; $j < $len; $j++) {
			if ($temp[$j] === "*") $pos[] = $i. $j;
		}
	}

	for ($i = 0; $i < count($pos); $i++) {
		if ($pos[$i][0] !== $pos[$i + 1][0] && $pos[$i][1] !== $posos[$i + 1][1] && $flag !== 1) {
			$dia_pos[] = $i;
			$dia_pos[] = $i + 1;
			$flag = 1;
		}
	}

	if (count($dia_pos) !== 2) {
		$no_dia_pos = 1;
		$dia_pos[] = 0;
		$dia_pos[] = 2;
	} else {
		$no_dia_pos = 3 - array_sum($dia_pos);
	}
	$ans[0] = $pos[$dia_pos[0]][0] + $pos[$dia_pos[1]][0] - $pos[$no_dia_pos][0] + 1;
	$ans[1] = $pos[$dia_pos[0]][1] + $pos[$dia_pos[1]][1] - $pos[$no_dia_pos][1] + 1;
	print(implode($ans). " ");
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");

			if (!feof($this->handle)) $contents = stream_get_contents($this->handle);
		} else $contents = stream_get_contents(STDIN);

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){
	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();
	$M = (int)$Input->in();

	for ($i = 0; $i < $N; $i++) {
		$temp = $Input->in();
		$len = strlen($temp);
		for ($j = 0; $j < $len; $j++) {
			if ($temp[$j] === "*") $pos[] = $i. $j;
		}
	}

	for ($i = 0; $i < count($pos); $i++) {
		if ($pos[$i][0] !== $pos[$i + 1][0] && $pos[$i][1] !== $posos[$i + 1][1] && $flag !== 1) {
			$dia_pos[] = $i;
			$dia_pos[] = $i + 1;
			$flag = 1;
		}
	}

	if (count($dia_pos) !== 2) {
		$no_dia_pos = 1;
		$dia_pos[] = 0;
		$dia_pos[] = 2;
	} else {
		$no_dia_pos = 3 - array_sum($dia_pos);
	}
	$ans[0] = $pos[$dia_pos[0]][0] + $pos[$dia_pos[1]][0] - $pos[$no_dia_pos][0] + 1;
	$ans[1] = $pos[$dia_pos[0]][1] + $pos[$dia_pos[1]][1] - $pos[$no_dia_pos][1] + 1;
	print($ans[0]. " ". $ans[1]);
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");

			if (!feof($this->handle)) $contents = stream_get_contents($this->handle);
		} else $contents = stream_get_contents(STDIN);

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>

<?php

error_reporting(0);

solve();

function solve(){
	//$Input = new Input("input.txt");
	$Input = new Input();

	$N = (int)$Input->in();
	$M = (int)$Input->in();

	for ($i = 0; $i < $N; $i++) {
		$temp = $Input->in();
		$len = strlen($temp);
		for ($j = 0; $j < $len; $j++) {
			if ($temp[$j] === "*") $pos[] = $i. $j;
		}
	}

	for ($i = 0; $i < count($pos) - 1; $i++) {
		if ($pos[$i][0] !== $pos[$i + 1][0] && $pos[$i][1] !== $pos[$i + 1][1] && $flag !== 1) {
			$dia_pos[] = $i;
			$dia_pos[] = $i + 1;
			$flag = 1;
		}
	}

	if (count($dia_pos) !== 2) {
		$no_dia_pos = 1;
		$dia_pos[] = 0;
		$dia_pos[] = 2;
	} else {
		$no_dia_pos = 3 - array_sum($dia_pos);
	}
	$ans[0] = $pos[$dia_pos[0]][0] + $pos[$dia_pos[1]][0] - $pos[$no_dia_pos][0] + 1;
	$ans[1] = $pos[$dia_pos[0]][1] + $pos[$dia_pos[1]][1] - $pos[$no_dia_pos][1] + 1;
	print($ans[0]. " ". $ans[1]);
}

class Input{
	private $handle = "";
	private $values = array();
	private $index = 0;

	public function __construct($localfile){

		if (is_file($localfile)) {

			$this->handle = fopen($localfile, "r");

			if (!feof($this->handle)) $contents = stream_get_contents($this->handle);
		} else $contents = stream_get_contents(STDIN);

		$no_newlines = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->values = explode(" ", $no_newlines);
	}

	public function in(){

		return $this->values[$this->index++];

	}

	public function close(){

		if (is_file($localfile) && feof($this->handle)) fclose($this->handle);

	}
}

?>


<?php
$n = explode(' ', trim(fgets(STDIN)));
$link = array();
for($i=0; $i<$n[1];$i++) {
    $in = explode(' ',trim(fgets(STDIN)));
    $link[$in[0]][] = $in[1];
    $link[$in[1]][] = $in[0];
}
$r = 0;

while (1) {
    $dissmiss = array();
    foreach ($link as $key => $val) {
        if(count($val) == 1) {
            $dissmiss[] = $key;
        }
    }
    if(count($dissmiss) == 0) {
        break;
    }
    foreach ($dissmiss as $child) {
        if(!isset($link[$child])) {
            continue;
        }
        $pair = implode('',$link[$child]);
        if(!isset($link[$pair])) {
            continue;
        }
        $key  = array_search($child, $link[$pair]);
        if($key === FALSE) {
            continue;
        }
        if(count($link[$pair]) == 1) {
            unset($link[$pair]);
        }
        else {
            unset($link[$pair][$key]);
        }

        unset($link[$child]);
    }
    $r++;
}
echo($r);

<?php

$s = fgets(STDIN, 1024);
$t = explode(' ', $s);
$n = intval($t[0]);
$m = intval($t[1]);
$ban = $all = $links = array();

for($i = 0; $i < $m; $i++) {
	$s = fgets(STDIN, 1024);
	$t = explode(' ', $s);
	$links[] = array(intval($t[0]), intval($t[1]));
}

$ans = 0;
while (true) {
	$bad = false;
	$a = array();
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) $a[$v[0]] = 0;
		if(!isset($a[$v[1]])) $a[$v[1]] = 0;
		$a[$v[0]]++;
		$a[$v[1]]++;
	}
	foreach($a AS $k => $v) {
		if ($v >= 2) continue;
		$bad = true;
		$ban[] = $k;
		unset($a[$k]);
	}
	if (!$bad) break;
	$ans++;
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) unset($links[$k]);
		if(!isset($a[$v[1]])) unset($links[$k]);
	}
}
echo($ans);
?>

<?php
$count=explode(' ',trim(fgets(STDIN)));
$link_count = intval(trim($count[1]));
$child_count = intval(trim($count[0]));
$link = array();
for($i=0;$i<$link_count;$i++) {
    $input=explode(' ',trim(fgets(STDIN)));
    $n1=intval(trim($input[0]));
    $n2=intval(trim($input[1]));
    $link[$n1][]=$n2;
    $link[$n2][]=$n1;
}
$result = 0;
$completed = false;
while($completed === false) {
    $excl = array();
    foreach($link as $k => $v) {
        if(count($v) === 1) {
            $excl[$k] = reset($v);
        }
    }
    if(count($excl) > 0) {
        foreach($excl as $k => $v) {
            if(isset($link[$v])) {
                sort($link[$v]);
                for($i=0;$i<count($link[$v]);$i++) {
                    if($link[$v][$i] === $k) {
                        unset($link[$v][$i]);
                        if(count($link[$v]) < 1) {
                            unset($link[$v]);
                            break;
                        }
                    }
                }
            }
            if(isset($link[$k])) {
                unset($link[$k]);
            }
        }
        $result ++;
    }
    else {
        $completed = true;
    }
}

echo( $result );

<?php

$s = fgets(STDIN, 1024);
list($n, $m) = explode(' ', $s);
$ban = $links = array();

for($i = 0; $i < $m; $i++) {
	$s = fgets(STDIN, 1024);
	$t = explode(' ', $s);
	$links[] = array(intval($t[0]), intval($t[1]));
}

while (true) {
	//var_export($links);
	$bad = false;
	$a = array();
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) $a[$v[0]] = 0;
		if(!isset($a[$v[1]])) $a[$v[1]] = 0;
		$a[$v[0]]++;
		$a[$v[1]]++;
	}
	foreach($a AS $k => $v) {
		if ($v >= 2) continue;
		$bad = true;
		$ban[] = $k;
		unset($a[$k]);
	}
	if (!$bad) break;
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) unset($links[$k]);
		if(!isset($a[$v[1]])) unset($links[$k]);
	}
}
echo($n - count($ban));
?>

<?php

$s = fgets(STDIN, 1024);
list($n, $m) = explode(' ', $s);
$ban = $links = array();

for($i = 0; $i < $m; $i++) {
	$s = fgets(STDIN, 1024);
	$t = explode(' ', $s);
	$links[] = array(intval($t[0]), intval($t[1]));
}

while (true) {
	//var_export($links);
	$bad = false;
	$a = array();
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) $a[$v[0]] = 0;
		if(!isset($a[$v[1]])) $a[$v[1]] = 0;
		$a[$v[0]]++;
		$a[$v[1]]++;
	}
	foreach($a AS $k => $v) {
		if ($v >= 2) continue;
		$bad = true;
		$ban[] = $k;
		unset($a[$k]);
	}
	if (!$bad) break;
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) unset($links[$k]);
		if(!isset($a[$v[1]])) unset($links[$k]);
	}
}
if(count($ban) > 0) echo('0'); else echo($n - count($ban));
?>

<?php

$s = fgets(STDIN, 1024);
$t = explode(' ', $s);
$n = intval($t[0]);
$m = intval($t[1]);
$ban = $all = $links = array();

for($i = 0; $i < $m; $i++) {
	$s = fgets(STDIN, 1024);
	$t = explode(' ', $s);
	$links[] = array(intval($t[0]), intval($t[1]));
}

while (true) {
	$bad = false;
	$a = array();
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) $a[$v[0]] = 0;
		if(!isset($a[$v[1]])) $a[$v[1]] = 0;
		$a[$v[0]]++;
		$a[$v[1]]++;
	}
	foreach($a AS $k => $v) {
		if ($v >= 2) continue;
		$bad = true;
		$ban[] = $k;
		unset($a[$k]);
	}
	if (!$bad) break;
	foreach($links AS $k => $v) {
		if(!isset($a[$v[0]])) unset($links[$k]);
		if(!isset($a[$v[1]])) unset($links[$k]);
	}
}
if ($m == $n) {
	echo(count($ban));
} else {
	echo($n - count($ban));
}
?>


<?php
fscanf(STDIN,"%d %d",$strSize,$k);
fscanf(STDIN,"%s",$str);
$alpha='abcdefghijklmnopqrstuvwxyz';
$ans=array();
//$ans[]=0;
$max=0;
for ($i=0; $i <26 ; $i++)
{  $cnt=0;
    $ans[$i]=0;
    for ($j=0; $j <$strSize ; $j++)
    {
        if($str[$j]==$alpha[$i])
         {
            $cnt++;
            if($cnt==$k)
             {
                $ans[$i]++;
                $cnt=0;
             }
         }
         else
            $cnt=0;
    }
    if($ans[$i]>$max)
        $max=$ans[$i];

}
echo $max;
//print_r($ans);

<?php
   fscanf(STDIN, "%d %d", $n, $k);
   fscanf(STDIN, "%s", $s);

   $A = array();
   $sx = 0;
   while($sx<$n) {
      $cc = $s[$sx];
      $cn = 1;
      $ex = $sx;
      if($k>1) {
         for($ex=$sx+1; $ex<$n; $ex++) {
            if($cc!=$s[$ex]) break;
            $cn++;
            if($cn==$k) break;
         }
      }
      if($cn==$k) {
         if(array_key_exists($cc, $A)) $A[$cc]++;
         else $A[$cc] = 1;
         $sx = $ex+1;
      }
      else $sx = $ex;
   }
   if(count($A)==0) echo "0";
   else {
      arsort($A, SORT_NUMERIC);
      //print_r($A);
      reset($A);
      echo current($A);
   }
?>

<?php
   fscanf(STDIN, "%d %d", $n, $k);
   fscanf(STDIN, "%s", $s);

   $A = array();
   $sx = 0;
   while($sx<$n) {
      $cc = $s[$sx];
      $cn = 1;
      for($ex=$sx+1; $ex<$n; $ex++) {
         if($cn==$k) {
            if(array_key_exists($cc, $A)) $A[$cc]++;
            else $A[$cc] = 1;
            $ex++;
            break;
         }
         if($cc!=$s[$ex]) break;
         $cn++;
      }
      $sx = $ex;
   }
   if(count($A)==0) echo "0";
   else {
      arsort($A, SORT_NUMERIC);
      //print_r($A);
      reset($A);
      echo current($A);
   }
?>

<?php
fscanf(STDIN,"%d %d",$n,$k);
fscanf(STDIN,"%s",$str);
$splitByOne=str_split($str);
//print_r($splitByOne);
$splitByK=str_split($str,$k);
//print_r($splitByK)
$uniqueAlph=array_values(array_unique($splitByOne));
$max=0;
for ($l=0; $l <count($uniqueAlph) ; $l++)
 { $lcount=0;
	for ($i=0; $i <count($splitByK) ; $i++)
		{     $count=0;
			for ($j=0; $j <$k ; $j++)
			{
				if($splitByK[$i][$j]==$uniqueAlph[$l])
				{
					$count++;
					if($count==$k)
                      $lcount++;

				}
			}
		}
		if($lcount>$max)
			$max=$lcount;
}
echo "$max";

<?php
fscanf(STDIN,"%d %d",$n,$k);
fscanf(STDIN,"%s",$str);
$lcount=array();
$str1=str_split($str,$k);
//print_r($str1);
$a=array();
for ($i=0; $i <26 ; $i++)
 {
	$a[$i]=0;
 }
 //print_r($a);
for ($i=0; $i <count($str1); $i++)
 {
    if(count(array_unique(str_split($str1[$i])))==1)
    {

			     if(implode(array_unique(str_split($str1[$i])))=='a'&&strlen($str1[$i])==$k)
			     {
			            $a[0]++;
			     }
			     if(implode(array_unique(str_split($str1[$i])))=='b' &&strlen($str1[$i])==$k)
			      {
			        	$a[1]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='c'&&strlen($str1[$i])==$k)
			      {
			        	$a[2]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='d'&&strlen($str1[$i])==$k)
			      {
			        	$a[3]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='e'&&strlen($str1[$i])==$k)
			      {
			        	$a[4]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='f'&&strlen($str1[$i])==$k)
			      {
			        	$a[5]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='g'&&strlen($str1[$i])==$k)
			      {
			        	$a[6]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='h'&&strlen($str1[$i])==$k)
			      {
			        	$a[7]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='i'&&strlen($str1[$i])==$k)
			      {
			        	$a[8]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='j'&&strlen($str1[$i])==$k)
			      {
			        	$a[9]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='k'&&strlen($str1[$i])==$k)
			      {
			        	$a[10]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='l'&&strlen($str1[$i])==$k)
			      {
			        	$a[11]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='m'&&strlen($str1[$i])==$k)
			      {
			        	$a[12]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='n'&&strlen($str1[$i])==$k)
			      {
			        	$a[13]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='o'&&strlen($str1[$i])==$k)
			      {
			        	$a[14]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='p'&&strlen($str1[$i])==$k)
			      {
			        	$a[15]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='q'&&strlen($str1[$i])==$k)
			      {
			        	$a[16]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='r'&&strlen($str1[$i])==$k)
			      {
			        	$a[17]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='s'&&strlen($str1[$i])==$k)
			      {
			        	$a[18]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='t'&&strlen($str1[$i])==$k)
			      {
			        	$a[19]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='u'&&strlen($str1[$i])==$k)
			      {
			        	$a[20]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='v'&&strlen($str1[$i])==$k)
			      {
			        	$a[21]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='w'&&strlen($str1[$i])==$k)
			      {
			        	$a[22]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='x'&&strlen($str1[$i])==$k)
			      {
			        	$a[23]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='y'&&strlen($str1[$i])==$k)
			      {
			        	$a[24]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='z'&&strlen($str1[$i])==$k)
			         $a[25]++;
    }

 }
echo max($a);

<?php
fscanf(STDIN,"%d %d",$strSize,$k);
fscanf(STDIN,"%s",$str);
$splitedStr=str_split($str,$k);
$ara=array();
for ($i=0; $i <count($splitedStr) ; $i++)
 {
	if(array_key_exists($splitedStr[$i],$ara))
		   $ara[$splitedStr[$i]]+=1;
		else
		{
			if(count(array_unique(str_split($splitedStr[$i])))==1)
			     $ara[$splitedStr[$i]]=1;
		}
 }
 if(count($ara)==0)
 	echo "0";

else
 echo max($ara);

<?php
fscanf(STDIN,"%d %d",$n,$k);
fscanf(STDIN,"%s",$str);
$lcount=array();
$str1=str_split($str,$k);
//print_r($str1);
$a=array();
for ($i=0; $i <26 ; $i++)
 {
	$a[$i]=0;
 }
 //print_r($a);
for ($i=0; $i <count($str1); $i++)
 {
    if(count(array_unique(str_split($str1[$i])))==1)
    {

			     if(implode(array_unique(str_split($str1[$i])))=='a')
			     {
			            $a[0]++;
			     }
			     if(implode(array_unique(str_split($str1[$i])))=='b')
			      {
			        	$a[1]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='c')
			      {
			        	$a[2]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='d')
			      {
			        	$a[3]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='e')
			      {
			        	$a[4]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='f')
			      {
			        	$a[5]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='g')
			      {
			        	$a[6]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='h')
			      {
			        	$a[7]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='i')
			      {
			        	$a[8]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='j')
			      {
			        	$a[9]++;
			      }
			     if(implode(array_unique(str_split($str1[$i])))=='k')
			      {
			        	$a[10]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='l')
			      {
			        	$a[11]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='m')
			      {
			        	$a[12]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='n')
			      {
			        	$a[13]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='o')
			      {
			        	$a[14]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='p')
			      {
			        	$a[15]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='q')
			      {
			        	$a[16]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='r')
			      {
			        	$a[17]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='s')
			      {
			        	$a[18]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='t')
			      {
			        	$a[19]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='u')
			      {
			        	$a[20]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='v')
			      {
			        	$a[21]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='w')
			      {
			        	$a[22]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='x')
			      {
			        	$a[23]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='y')
			      {
			        	$a[24]++;
			      }
			      if(implode(array_unique(str_split($str1[$i])))=='z')
			         $a[25]++;
    }

 }
echo max($a);


<?php
function team($n){

echo $n;
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);
$r=0;
for($i=0;$i<$n;$i++){
fscanf($stdin,"%d %d %d",$a,$b,$c);
if ($a + $b + $c >= 2)
        $r++;
}
team($r);
?>

<?php
    $fp = fopen('php://stdin', 'r');
    $n = rtrim(fgets($fp));
    $tasks = array();
    $cnt = 0;
    while(!feof($fp))
        $tasks[] = explode(' ', rtrim(fgets($fp)));
    for($i = 0; $i < $n; $i++)
        if(array_sum($tasks[$i]) >= 2)
            $cnt++;
    echo $cnt;
?>

<?php
    function readFiles ($dir) {
        return file($dir, FILE_IGNORE_NEW_LINES);
    }
    $dir = 'php://stdin';
    $data = readFiles($dir);
    $n = $data[0];
    for ($i = 1; $i < count($data); $i++) {
        $data[$i] = explode(' ', $data[$i]);
    }
    $counter = 0;
    for ($i = 1; $i < count($data); $i++) {
        if (2 <= (int)array_count_values($data[$i])['1']) {
            $counter++;
        }
    }
    echo $counter;

<?php
	$total = 0;
	$n = fgets(STDIN);
	for ($x = 0; $x < $n; $x++) {
		$val = substr_count(fgets(STDIN),'1');
		if ($val > 1) $total++;
	}
	echo $total;
?>

<?php
while($str = fgets(STDIN)) $arr[] = explode(' ', trim($str));
if(!isset($arr)) {
    $arr[] = explode(' ', '2 4');
}
$out = 0;
for($i=1; $i<sizeof($arr); $i++) {
    $sum = $arr[$i][0] + $arr[$i][1] + $arr[$i][2];
    if($sum>=2) $out++;
}
echo $out;
?>

<?php

fscanf(STDIN, "%d", $n);
$ans = 0;
for($i=0; $i<$n; $i++){
    $in = explode(' ', trim(fgets(STDIN)));
    $ans += (array_sum($in) >=2) ? 1 : 0;
}
printf("%d",$ans);
?>

<?php
$input = STDIN;
$output = STDOUT;

fscanf($input,"%d",$n);
$solvedProblems = 0;
for($i=0; $i<$n; ++$i) {
    fscanf($input,"%d%d%d",$Petya,$Vasya,$Tonya);
    $count = $Petya + $Vasya + $Tonya;
    if($count >= 2) {
        ++$solvedProblems;
    }
}
fprintf($output,"%d",$solvedProblems);

?>

<?php
fscanf(STDIN,"%d",$n);
$a=array();
$ans=0;
foreach (range(1,$n) as $i)
{
    fscanf(STDIN,"%d%d%d",$x,$y,$z);
    if ($x+$y+$z>=2) $ans++;
}
fprintf(STDOUT,"%d\n",$ans);
?>

<?php

# https://codeforces.com/contest/231/problem/A
# A. Team
# sample input =>
//3
//1 1 0
//1 1 1
//1 0 0
# sample output => 2
# scihesham

    $tests_num = trim(fgets(STDIN));
    $sum = 0;

    for($i=0; $i<$tests_num; $i++){
       list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));
       $a + $b + $c > 1 ? $sum+=1 : '';
    }
    echo $sum;

?>

<?php

$result = 0;
$n = readline();

for ( $i = 0; $i < $n; $i++ ) {
	list($p, $v, $t) = explode(' ', readline());
	if ( $p + $v + $t >= 2 ) {
		$result++;
	}
}
echo $result;

<?php

$n = readline();
$p = 0;
while ($n > 0) {
    $inputs = (explode(" ",readline()));
    if(array_sum($inputs) >= 2){
        $p += 1;
    }
    $n--;
}

echo $p;

?>

<?

$num = (int)trim(fgets(STDIN));

$result = 0;
for($i = 0; $i < $num; $i ++) {
    if(array_sum(explode(' ', trim(fgets(STDIN)))) >= 2){
        $result++;
    }
}

echo $result;

<?
$n=trim(fgets(STDIN));
$z=0;
for($i=0;$i<$n;$i++)
    {
        $p=explode(" ",trim(fgets(STDIN)));
        foreach($p as $v)$s[$v]++;
        if($s[1]>=2)++$z;
        unset($s);
    }
   echo $z;
?>

<?php
$a = trim(fgets(STDIN));
for($c=0; $c<$a; ++$c)
{
    $b[$c] = trim(fgets(STDIN));
    $e = explode(" ", $b[$c]);
    if(array_sum($e)>=2)
    {$d += 1;}else{$d += 0;}
}
echo $d;
?>

<?php

function read() {

    fscanf(STDIN, "%d", $n);

    $arr = array();

    for ($i = 0; $i < $n; $i++) {
        $numbers = explode(" ", fgets(STDIN));
        $arr[] = $numbers;
    }
    return $arr;
}

function isValid($numbers) {

    $result = array_sum($numbers);
    return $result >= 2;
}

$arr = read();
$filtered = array_filter($arr, "isValid");

echo count($filtered);

<?php
$a = array();
fscanf(STDIN, "%d", $n);
for ($i = 0; $i < $n; $i++) {
	$a[] = explode(" ", trim(fgets(STDIN)));
}
$result = 0;
foreach ($a as $task) {
	if (($task[0] && $task[1]) || ($task[1] && $task[2]) || ($task[0] && $task[2]))
		$result++;
}

fprintf(STDOUT, $result);

<?php
while (fscanf(STDIN, "%d", $n)){
    $ac = 0;
    while ($n--){
        $line = stream_get_line(STDIN, 65535, "\n");
        $question = explode(" ", $line);
        if (array_sum($question) > 1){
            ++$ac;
        }
    }
    echo $ac . "\n";
}

<?php

fscanf(STDIN, "%d\n", $number);
$i = 0;
$counter = 0;

while($i<$number && $line = trim(fgets(STDIN))){

	if($line == '1 1 1' || $line == '1 1 0' || $line == '1 0 1' || $line == '0 1 1') $counter++ ;
}

fwrite(STDOUT, $counter."\n");

<?php
while($item = trim(fgets(STDIN))){
    $data[] = (int)str_replace(' ', '', $item);
}

$result = 0;
$count = array_shift($data);

foreach($data as $res) {
    if($res >= 101 || $res === 11) {
        $result++;
    }
}

echo $result;

<?php

$is_first = true;
$tasks_count = 0;
while ($row = fgets(STDIN)) {
    if ($is_first === true) {
        $is_first = false;
        continue;
    }
    if (substr_count($row, '1') >= 2) {
        $tasks_count++;
    }
}
echo $tasks_count;

<?php
	fscanf(STDIN, '%d', $num);
	$solve = 0;
	$arr = [];
	while (fscanf(STDIN, '%d %d %d', $arr[0], $arr[1], $arr[2])){
		$yes = 0;
		foreach ($arr as $key => $value) {
			if($value == 1) $yes++;
		}
		if($yes >= 2) $solve++;
		$arr = [];
	}
	echo $solve;
?>

<?php
$n = (int)readline();
$output = 0;
for($i = 0; $i < $n; $i++) {
    $input = str_replace(' ', '',readline());
    $input == 11 || $input > 100 ? $output += 1 : 1;
}
echo $output;

<?php
$dir = fopen("php://stdin", 'r');;
$input= file('php://stdin');
$c=trim($input[0]);
$w= 0;
for ($i=1 ;$i <= $c ;$i++ ){
    $arr= explode(' ', trim($input[$i]));
    $arr=array_count_values($arr);
    if ($arr[1] >= 2){
        $w ++;
    }
}
echo $w;

<?php
    $n = trim(fgets(STDIN));
    $result = 0;
    for($i = 0; $i < $n; $i++){
        $args[$i] = explode(" ", trim(fgets(STDIN)));
        if($args[$i][0]+$args[$i][1]+$args[$i][2] >= 2) $result++;
    }
    fwrite(STDOUT, $result++);

<?php

//=====================================
// link: https://codeforces.com/contest/231/problem/A
//=====================================

// get inputs
$number_of_problems = trim(fgets(STDIN));

$implemention = 0;

for ($i=0; $i < $number_of_problems; $i++) {
    $approvals = array_sum(explode(' ', trim(fgets(STDIN))));

    if($approvals >= 2) {
        $implemention++;
    }
}

echo $implemention . "\n";

<?php
	$n = trim(fgets(STDIN));
	$i = 0;
	$num = 0;
	while($i<$n)
	{
		$str = trim(fgets(STDIN));
		$nilai = explode(" ",$str);
		if(array_sum($nilai)>1)
			$num = $num + 1;
		$i++;
	}
	echo $num;
?>

<?php
$problems_num = fgets(STDIN);
$vote_result=0;
for ($i=0; $i < $problems_num; $i++) {
	$vote = explode(' ', fgets(STDIN));
	if ($vote[0]+$vote[1]+$vote[2]>=2)
		$vote_result+=1;
}
echo $vote_result;
?>

<?php
$n = trim(fgets(STDIN));
$ret = 0;
for($i=0;$i<$n;$i++){
  list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));
  if ($a + $b + $c >=2) $ret++;
}

echo $ret . PHP_EOL;

<?php
fscanf(STDIN,"%d",$n);
$a=array();
$ans=0;
foreach (range(1,$n) as $i)
{
    fscanf(STDIN,"%d%d%d",$x,$y,$z);
    if ($x+$y+$z>=2) $ans++;
}
fprintf(STDOUT,"%d\n",$ans);
?>

<?php
$n = trim(fgets(STDIN));
$sum = 0;

for($i = 0;$i < $n;$i++){
    $arr = explode(" ", trim(fgets(STDIN)));
    if(array_sum($arr) > 1){
        $sum++;
    }
}

print $sum

?>

<?php
$counter=0;
fscanf(STDIN, "%d",$n);
for ($i=0; $i < $n; $i++) {
	fscanf(STDIN,"%d %d %d",$v,$p,$t);
	if (($v+$p+$t)>1)
		$counter++;
}
echo $counter;
?>

<?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($p, $v, $t)
{
    return ($p + $v + $t) >= 2;
}

$c = 0;

list($n) = fscanf($input, "%d\n");

for ($i = 0; $i < $n; ++$i) {
    list($p, $v, $t) = fscanf($input, "%d %d %d\n");

    $c += foo($p, $v, $t) ? 1 : 0;
}

fwrite($output, $c);

<?php

    $dir = fopen("php://stdin", 'r');
    $input = stream_get_contents($dir);

// $input = '3
// 1 0 1
// 0 1 1
// 0 0 0';

$arr = explode(PHP_EOL, $input);
$k = 0;
for($i=0;$i<$arr[0];$i++){
    if(array_sum(array_map('intval', explode(' ', $arr[$i+1]))) >= 2)
        $k++;
}

echo $k;

<?php
// http://codeforces.com/problemset/problem/231/A

// initialize answer
$number_of_problems_to_implement = 0;

// INPUT
// The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest.
fscanf(STDIN, "%d", $n);

// Then n lines contain three integers each.
for ($i=0; $i < $n; $i++)
{
	// The numbers on the lines are separated by spaces. Each integer is either 0 or 1
	fscanf(STDIN, "%d %d %d", $integers_matrix[$i][0], $integers_matrix[$i][1], $integers_matrix[$i][2] );

	// If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view.

	// they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution:
	if
	(	( 1 == $integers_matrix[$i][0] && 1 == $integers_matrix[$i][1] )
	||	( 1 == $integers_matrix[$i][0] && 1 == $integers_matrix[$i][2] )
	||	( 1 == $integers_matrix[$i][1] && 1 == $integers_matrix[$i][2] )
	)
	{
		$number_of_problems_to_implement++;
	}

}

//Output: Print a single integer — the number of problems the friends will implement on the contest.
echo $number_of_problems_to_implement;

?>

<?php
$lines = (int)fgets(STDIN);
if($lines >= 1 && $lines <= 1000)
{
    $problems = [];
    for($i = 0;$i < $lines; $i++)
        $problems[$i] = fgets(STDIN);
    $submissions = 0;

    foreach($problems as $problem)
    {
        $checker1 = $problem[0] == 1 || $problem[0] == 0;
        $checker2 = $problem[2] == 1 || $problem[2] == 0;
        $checker3 = $problem[4] == 1 || $problem[4] == 0;
        if($checker1 && $checker2 && $checker3)
        {
            $petya = (int)$problem[0];
            $vasya = (int)$problem[2];
            $tonya = (int)$problem[4];
            if(($petya + $vasya + $tonya) >= 2)
            {
                $submissions++;
            }
        }
        else
        {
            echo "Not valid input\n";
            break;
        }

    }
    echo $submissions;

}
else
{
    echo "Not valid input\n";
}

?>

<?php
    $n = fgets(STDIN);
    $sum = 0;
    for($i = 0; $i < $n; ++$i)
    {
        $mass = explode(" ", fgets(STDIN));
        $ones = 0;
        for($key = 0; $key < 3; ++$key)
        {
            if($mass[$key] == 1){$ones++;}
        }
        if($ones >= 2){$sum ++;}
    }
    echo $sum;
?>

<?php
$n = trim(fgets(STDIN));
$tasks = array();

for( $i=0; $i<$n; $i++ )
{
    $tasks[$i] = explode(' ',trim(fgets(STDIN)));
}

//print_r($tasks);

$task_with_solution = 0;

for( $i=0; $i<$n; $i++ )
{
    $task_count = 0;
    foreach( $tasks[$i] as $task)
    {
        $task_count = $task + $task_count;
    }

    if( $task_count >= 2 ){
        $task_with_solution++;
    }
}
echo $task_with_solution;

<?
$a = trim(fgets(STDIN));
$res = 0;
for($i = 0; $i < $a; $i++){
    $tmp = explode(' ', trim(fgets(STDIN)));
    if(array_sum($tmp) > 1)
        $res++;
}
echo $res;

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

$problemsOk = 0;

for ($i = 1; $i <= $lines; $i++) {
    $problem = trim(fgets(STDIN));
    $cP = 0;
    if($problem[0] == 1) $cP++;
    if($problem[2] == 1) $cP++;
    if($problem[4] == 1) $cP++;

    if($cP >= 2) $problemsOk++;
}
echo $problemsOk."\n";

<?php
$n = trim(fgets(STDIN));
$counter = 0;
for ($i = 1; $i <= $n; $i++)
{
    list($a, $b, $c) = explode(' ', trim(fgets(STDIN)));
    if (($a+$b+$c) > 1) $counter++;
}

echo $counter;

<?php

$num = readline();

$des = 0;
for($i = 0; $i < $num; $i++) {
    $str = readline();

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

    $f = array_filter($arr);

    if(count($f) >= 2) {
        $des++;
    }
}

echo $des;

<?php
$n = (fgets(STDIN));
$summSolution=0;
for ($i=0;$i<$n;$i++)
{
    $peopleVote = explode(" ",fgets(STDIN));
    if (($peopleVote[0]+$peopleVote[1]+$peopleVote[2])>=2)
    {
        $summSolution++;
    }
}
echo $summSolution;
?>

<?php

function getStdIn(bool $asInt = false): array
{
    $stdIn = explode(' ', trim(fgets(STDIN)));

    if ($asInt) {
        foreach ($stdIn as $key => $value) {
            $stdIn[$key] = (int)$value;
        }
    }

    return $stdIn;
}

function stdOut($output)
{
    fwrite(STDOUT, $output);
}

function solve(): void
{
    // 3 people
    // 2 have to be sure
    // n problems
    [$n] = getStdIn(true);
    $solved = 0;
    for ($i = 0; $i < $n; $i++) {
        if (array_sum(getStdIn(true)) >= 2) {
            ++$solved;
        }
    }
    stdOut($solved);
}

solve();

<?php

/**
 * @return int
 */
function getInt() {
    return (int) trim(fgets(STDIN));
}

/**
 * @return string
 */
function getStr() {
    return (string) trim(fgets(STDIN));
}

/**
 * @return array
 */
function getRow($len) {
    return array_slice(explode(' ', trim(fgets(STDIN))), 0, $len);
}

const N = "\n";

/*** SOLVING */

$n = getInt();
$count = 0;

for ($i = 0; $i < $n; $i++) {
    $point = array_reduce(getRow(3), function($sum, $v) {
        return $sum += $v;
    });
    if ($point >= 2) {
        $count++;
    }
}

echo $count;

<?php
$countTask = 0;
$count = trim(fgets(STDIN));
$data = array();
for ($i=0;$i<$count;$i++){
    $data[$i] = explode(" ", trim(fgets(STDIN)));
    $col[$i] = 0;
    foreach ($data[$i] as $o[$i]) {
        if ($o[$i]) {
            $col[$i]++;
        }
    }
    if ($col[$i]>=2) {
        $countTask++;
    }
}
echo $countTask;

<?php
	$n=fgets(STDIN);
	$cnt=0;
	for($i=1;$i<=$n;$i++)
	{
		list($a,$b,$c)=explode(' ',fgets(STDIN));
		if($a+$b+$c>=2)
			$cnt++;
	}
	echo $cnt;
?>

<?php
  //$file = fopen("/home/py/PHPtraing/input.txt", "r");
  $file = STDIN;
  $n = (int) fgets($file);
  $ans = 0;
  for ($i=0; $i < $n; $i++) {
  	$a = explode(" ", fgets($file));
  	$num = array_sum($a);
  	if ($num>1)
  		$ans++;
  }

  print $ans;

 fclose($file);

?>

<?php

$f = fopen("php://stdin", 'r');
$n = intval(trim(fgets($f)));

$result = 0;

for ($j = 0; $j < $n; $j++) {
    $arr = fscanf($f, "%d %d %d");
    if ($arr[0] + $arr[1] + $arr[2] > 1) $result++;
}

fclose($f);

print $result;

<?php
$n = trim(fgets(STDIN));
$pro = [];
for ($i = 0; $i<$n ; $i++){
	$input = fgets(STDIN);
	array_push($pro, $input);
}
$res = 0;
for ($i = 0; $i<$n ; $i++){
	$inputs = explode(' ',$pro[$i]);
	$sum = $inputs[0] + $inputs[1] + $inputs[2];
	if($sum > 1){
		$res++;
	}

}
echo $res;

?>

<?php
$_fp = fopen("php://stdin", "r");
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
fscanf($_fp,"%d",$problem);

$solved = 0;
$i = 0;

while (!feof($_fp) AND $i < $problem) {
    $solution[$i] = fgets($_fp);
    $i += 1;
}

for ($i=0; $i < $problem; $i++)
{
    $arr_solution = str_split($solution[$i]);
    $count_solution = 0;

    for ($j=0; $j < 5; $j += 2)
    {
        if($arr_solution[$j] > 0)
        {
            $count_solution += 1;
        }
    }
    if($count_solution > 1)
    {
        $solved += 1;
    }
}
echo $solved;

?>

<?php

function gaber( $n1 , $n2 , $n3 )
{
     if( $n1 == 1 && $n2 == 1)
     {
          return 1 ;
     }
     if( $n1 == 1 && $n3==1)
     {
          return 1 ;
     }
     if( $n2 == 1 && $n3==1)
     {
          return 1 ;
     }
     return 0 ;
}

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

fscanf( $stdin , "%d" , $n) ;

$result = 0 ;

for( $i=0 ; $i<$n ; $i++ )
{
     fscanf( $stdin , "%d %d %d" , $n1 , $n2 , $n3 ) ;
     $result += intval( gaber( $n1 , $n2 , $n3 ) ) ;
}

echo $result ;

//$arr = array_map('intval', preg_split('/ /', $ar_temp, -1, PREG_SPLIT_NO_EMPTY) );
fwrite ( $stdout , $result . "\n" ) ;

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

?>

<?php

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

$problems = 0;

$i = 0;
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%d %d %d\n", $petya, $vasya, $tonya);

    if (($petya + $vasya + $tonya) >= 2) {
        $problems++;
    }
}

echo $problems;

?>

<?php

fscanf(STDIN, "%d\n", $number);

if ($number <= 0){
    exit;
}
$sRes = array();
for ($i = 0; $i <= 8; $i++){
    $sRes[decbin($i)] = 0;
}

while($number > 0){
    $number--;
    $line = trim(fgets(STDIN));
    $line = str_replace(' ', '', $line);

    $line = (int)$line;

    $sRes[$line]++;
}

print($sRes[11] + $sRes[110] + $sRes[101] + $sRes[111]);

<?php
// https://codeforces.com/problemset/problem/231/A
$n = fgets(STDIN);
$out = 0;
for($i = 0; $i < $n; ++$i) {
	fscanf(STDIN, "%d%d%d", $p, $v, $t);
	if($p+$v+$t > 1) ++$out;
}
echo $out;

<?php

$input = trim(fgets(STDIN));
$numberOfInputs = (int)$input;
$result = 0;

for ($count = 0; $count < $numberOfInputs; $count++) {
    $string = trim(fgets(STDIN));
    list($a, $b, $c) = explode(" ", $string);
    if (((int)$a + (int)$b + (int)$c) > 1)
        $result++;
}
printf("%s\n", $result);

<?php
$total = 0;
$hitung = 0;
$n = trim(fgets(STDIN));
while($n--)
{
    $s = fgets(STDIN);
    $s = explode(' ', $s);
    if (array_sum($s) > 1)
        $total++;
}
print $total;

?>

<?php
    $f = fopen('php://stdin', 'r');
    $cnt = (int)fgets($f);
    $ount = 0;
    for ($i = 0; $i < $cnt; $i++) {
        $out+= array_sum(explode(" ", str_replace(["\r", "\n"], "", fgets($f)))) > 1 ? 1 : 0;
    }
    echo $out;
?>

<?php
/**
 * Created by IntelliJ IDEA.
 * User: 低调的程序员
 * Date: 2015/4/25
 * Time: 1:17
 */

while(fscanf(STDIN,"%d",$n)){
    $ans=0;
    while($n-->0){
        fscanf(STDIN,"%d%d%d",$p,$v,$t);
        if(($p+$v+$t)>1)$ans++;
    }
    fprintf(STDOUT,"%d\n",$ans);
}

<?php

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

//Get The First Line Of Code.
$n = explode("\n",$input)[0];

$sum = array();

$count = 0;

//Get The Rest Of The Inputs.
//Calculate Each Line Sum.
for($i = 0;$i < $n;$i++) {

    array_push($sum,0);

    for($ii = 0;$ii < 3;$ii++) {

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

        $sum[$i] += explode(" ",$inner_input)[$ii];

    }

    //Check If More Than Two Are Sure About The Answer.
    if($sum[$i] > 1) {

        $count++;

    }

}

//Return The Output.
echo $count;

?>

<?php
$n=trim(fgets(STDIN));
$hasil=0;
$i=0;
while ($i<$n) {
	$a=explode(" ",fgets(STDIN));
	if(array_sum($a)>=2)
		$hasil=$hasil+1;
	$i++;
}
echo $hasil;
?>

<?php
$n=trim(fgets(STDIN));
$hasil=0;
$i=0;
while ($i<$n) {
	$a=explode(" ",fgets(STDIN));
	/*if(array_sum($a)>=2)*/
	if($a[0]+$a[1]+$a[2] >= 2)
		$hasil=$hasil+1;
	$i++;
}
echo $hasil;
?>

<?php
// 231A Команда

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

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

$out = 0;

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

    $input_line = fgets($in);

    list($p, $v, $t) = split(" ", $input_line);
    //    $t = substr($t, 0, 1);
    $p = (int) $p;
    $v = (int) $v;
    $t = (int) $t;

    if (($p + $v + $t) > 1) $out++;
}

echo $out;

?>

<?php
    $in = 'php://stdin';
    //$in = 'input.txt';
    $input = fopen($in, "r");
    $n = trim(fgets($input));

    $c = 0;
    for ($j=0;$j<$n;$j++) {
        $task = array_count_values(explode(' ',trim(fgets($input))));
        if ($task[1]>1) $c++;
    }
    echo $c;
?>

<?php

class Solution
{
    public function solve()
    {
        fscanf(STDIN, '%d', $n);

        $count = 0;
        while ($n--) {
            fscanf(STDIN, '%d %d %d', $a, $b, $c);
            $count+=$a + $b + $c >= 2;
        }

        echo $count . PHP_EOL;
    }
}

$sol = new Solution();
$sol->solve();

<?php
while($str = fgets(STDIN)){
	$array[] = explode(' ', trim($str));
}
if(!isset($array)) {
	$array[] = explode(' ', '2 4');
}
$out = 0;
for($i=1; $i<sizeof($array); $i++) {
	$sum = $array[$i][0] + $array[$i][1] + $array[$i][2];
	if($sum>1) {
		$out++;
	}
}
echo $out;
?>

<?php
$n = trim(fgets(STDIN));
$total= 0 ;
for ($i=0; $i<$n; $i++) {

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

if (array_sum ( $ar )>1 ) { $total++;}
}
echo $total;

?>

<?php

/**
 * @author Pablo Digiani <p.digiani@gmail.com>
 * @link https://codeforces.com/problemset/problem/231/A
 * @version 1.0
 *
 *
 *
 */

$problems = readline();

$implementations = 0;
for ($n = 1; $n <= $problems; $n++){
	if(array_sum(explode(' ', readline())) >= 2) $implementations++;
}
echo $implementations;

<?php

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

$cpt=0;
$cptFound=0;
while(($line = fgets($fp)) !== false) {
    if($cpt>0){
        $line=explode(' ',$line);
        $cpt1=0;
        foreach($line as $l){
            if($l==1) $cpt1++;
        }
        if($cpt1>=2) $cptFound++;
    }
    $cpt++;
}
echo $cptFound;

<?php

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

$first=true;
$cptFound=0;
while(($line = fgets($fp)) !== false) {
    if(!$first){
        $line=explode(' ',$line);
        $cpt1=0;
        foreach($line as $l){
            if($l==1) $cpt1++;
        }
        if($cpt1>=2) $cptFound++;
    }
    $first=false;
}
echo $cptFound;

<?php

$f = fopen('php://stdin', 'r');
//$f = fopen('5.txt', 'r');
$a = explode(" ",trim(fgets($f)));
$a = (int)$a[0];
$ans = 0;
while($a--){
    $och = trim(fgets($f));
    $int = explode(" ", $och);
    $total = 0;
    foreach ($int as $item){
        $total += (int)$item;
    }
    if($total >= 2){
        $ans++;
    }
}

echo $ans;

<?php
fscanf(STDIN,'%d', $n);
$count = 1;
$out = 0;
while($count++ <= $n){
    $counter = 0;
    list($f, $s, $th) = explode(' ', fgets(STDIN));
    if($f == 1){
        $counter++;
    }
    if($s == 1){
         $counter++;
    }
    if($th == 1){
         $counter++;
    }
    if($counter >= 2){
        $out++;
    }
}
echo $out;

<?php

$inputString = fgets(STDIN);

$n = (int) $inputString;

$answer = 0;
for ($i = 1; $i <= $n; $i++) {
    $inputString = fgets(STDIN);
    $opinions    = explode(' ', $inputString);

    $knowAnswer = 0;
    foreach ($opinions as $opinion) {
        if (rtrim($opinion) == '1') {
            $knowAnswer++;
        }
    }

    if ($knowAnswer > 1) {
        $answer++;
    }
}

echo $answer . PHP_EOL;

<?php
fscanf(STDIN, '%d\n', $n);	// получаем цифру - количество будущих строк
$line = array();
$strings = array();			// массив всех строчек
$result = array();

$m = array();  		// массив цифер в каждой строчке - вложенный массив

for($i = 0; $i < $n; $i++) {	// считываем n строк
	$strings[$i] = fgets(STDIN);	// теперь $strings - двумерный массив строк
	}

	for($i = 0; $i < count($strings); $i++) {
		$strings[$i] = explode(' ', $strings[$i]);		// расфигачиваем каждую строку на отдельнцые кусочки-цифры
		if(array_sum($strings[$i]) > 1){		// если сумма строки >= 2  -
			array_push($result, $strings[$i]);		// добавляем ее в массив результата
		}
	}

printf(count($result));

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

$solutionCount = 0;
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, '%d %d %d', $a, $b, $c);
    if ($a + $b + $c >= 2) $solutionCount++;
}

echo $solutionCount;

<?php
$a = trim(fgets(STDIN));
for($c=0; $c<$a; ++$c)
{
    $b[$c] = trim(fgets(STDIN));
    $e = explode(" ", $b[$c]);
    if(array_sum($e)>=2)
    {$d += 1;}
}
echo $d;
?>

<?php

function read() {
    fscanf(STDIN, "%d", $n);
    $arr = array();
    for ($i = 0; $i < $n; $i++) {
        $numbers = explode(" ", fgets(STDIN));
        $arr[] = $numbers;
    }
}

function isValid($numbers) {

    $result = array_sum($numbers);
    return $result >= 2;
}

$arr = read();
$filtered = array_filter($arr, "isValid");

echo count($filtered);

<?php
$a = array();
fscanf(STDIN, "%d", $n);
for ($i = 0; $i < $n; $i++) {
	$a[] = explode(" ", trim(fgets(STDIN)));
}
$result = 0;
foreach ($a as $task) {
	if (($task[0] && $task[1]) || ($task[1] && $task[2]) || ($task[0] && $task[1]))
		$result++;
}

fprintf(STDOUT, $result);

<?php
while($item = trim(fgets(STDIN))){
    $data[] = (int)str_replace(' ', '', $item);
}

$result = 0;
$count = array_shift($data);

foreach($data as $res) {
    if($res === 101 || $res === 11 || $res === 110) {
        $result++;
    }
}

echo $result;

<?php
while($item = trim(fgets(STDIN))){
    $data[] = (int)str_replace(' ', '', $item);
}

$result = 0;
$count = array_shift($data);

foreach($data as $res) {
    if($res > 101 || $res === 11) {
        $result++;
    }
}

echo $result;

<?php
$n = (fgets(STDIN));
$summSolution=0;
for ($i=0;$i<$n;$i++)
{
    $peopleVote = explode(" ",fgets($resource));
    if (($peopleVote[0]+$peopleVote[1]+$peopleVote[2])>=2)
    {
        $summSolution++;
    }
}
echo $summSolution;
?>

<?php
$_fp = fopen("php://stdin", "r");
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
fscanf($_fp,"%d",$problem);

$solved = 0;

for ($i=0; $i < $problem; $i++)
{
    fscanf($_fp,"%s",$solution[$i]);

    $arr_solution = str_split($solution[$i]);

    $count_solution = 0;

    for ($j=0; $j < 5; $j += 2)
    {
        if($solution[$i][$j] > 0)
        {
            $count_solution += 1;
        }
    }
    if($count_solution > 1)
    {
        $solved += 1;
    }
    echo "\n";
}

echo $solved;
?>

<?php

$input = trim(fgets(STDIN));
$numberOfInputs = (int)$input;
$result = 0;

for ($count = 0; $count < $numberOfInputs; $count++) {
    $string = trim(fgets(STDIN));
    list($a, $b, $c) = explode(" ", $string);
    if (((int)$a + (int)$b + (int)$c) > 1)
        $result++;
}
foreach ($resultArray as $result) {
    printf("%s\n", $result);
}

<?php
$total = 0;
$hitung = 0;
fscanf(STDIN, "%d", $n);
while($n--)
{
    fscanf(STDIN, "%s", $s);
    $s = explode(' ', $s);
    foreach ($s as $arr){
        if ($arr == '1')
            $hitung++;
    }
    if ($hitung > 1)
        $total++;
    $hitung = 0;
}
print $total;

?>

<?php
$total = 0;
$hitung = 0;
fscanf(STDIN, "%d", $n);
while($n--)
{
    fscanf(STDIN, "%s", $s);
    print $s;
    $s = explode(' ', $s);
    foreach ($s as $arr){
        if ($arr == 1)
            $hitung++;
    }
    if ($hitung > 1)
        $total++;
    $hitung = 0;
}
print $total;

?>

<?php
$total = 0;
$hitung = 0;
fscanf(STDIN, "%d", $n);
while($n--)
{
    fscanf(STDIN, "%s", $s);
    $s = explode(' ', $s);
    foreach ($s as $arr){
        if ($arr == 1)
            $hitung++;
    }
    if ($hitung > 1)
        $total++;
    $hitung = 0;
}
print $total;

?>

<?php
fscanf(STDIN, "%d", $n);
while($n--)
{
    $total = 0;
    $hitung = 0;
    fscanf(STDIN, "%s", $s);
    $s = explode(' ', $s);
    foreach ($s as $arr){
        if ($arr == 1)
            $hitung++;
    }
    if ($hitung > 1)
        $total++;
    $hitung = 0;
}
print $total;

?>

<?php
$n=trim(fgets(STDIN));
$hasil=0;
$i=0;
while ($i<$n) {
	$a=explode(" ",fgets(STDIN));
	if(array_sum($a))
		$hasil=$hasil+1;
	$i++;
}
echo $hasil;
?>

<?php
$n=trim(fgets(STDIN));
$hasil=0;
$i=0;
while ($i<$n) {
	$a=explode(" ",fgets(STDIN));
	/*if(array_sum($a)>=2)*/
	if($a[0]+$a[1]+a[2] >= 2)
		$hasil=$hasil+1;
	$i++;
}
echo $hasil;
?>

<?php
while($str = fgets(STDIN)){
	$array[] = explode(' ', trim($str));
}
if(!isset($array)) {
	$array[] = explode(' ', '2 4');
}
$out = 0;
for($i=1; $i<sizeof($array); $i++) {
	$sum = $array[$i][0] + $array[i][1] + $array[$i][2];
	if($sum>1) {
		$out++;
	}
}
echo $out;
?>

<?php
$n = trim(fgets(STDIN));
for ($i=0; $i<$n; $i++) {

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

if (array_sum ( $ar )>1 ) { $total++;}
}
echo $total;

?>

<?php

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

$first=true;
$cptFound=0;
while(($line = fgets($fp)) !== false) {
    if(!$first){
        $first=false;
        $line=explode(' ',$line);
        $cpt1=0;
        foreach($line as $l){
            if($l==1) $cpt1++;
        }
        if($cpt1>=2) $cptFound++;
    }
}
echo $cptFound;

<?php

//$f = fopen('php://stdin', 'r');
$f = fopen('5.txt', 'r');
$a = explode(" ",trim(fgets($f)));
$a = (int)$a[0];
$ans = 0;
while($a--){
    $och = trim(fgets($f));
    $int = explode(" ", $och);
    $total = 0;
    foreach ($int as $item){
        $total += (int)$item;
    }
    if($total >= 2){
        $ans++;
    }
}

echo $ans;

<?php

$inputString = fgets(STDIN);

$n = (int) $inputString[0];

$answer = 0;
for ($i = 1; $i <= $n; $i++) {
    $inputString = fgets(STDIN);
    $opinions    = explode(' ', $inputString);

    $knowAnswer = 0;
    foreach ($opinions as $opinion) {
        if (rtrim($opinion) == 1) {
            $knowAnswer++;
        }
    }

    if ($knowAnswer > 1) {
        $answer++;
    }
}

echo $answer . PHP_EOL;

<?php
function team($n,$in){
for($i=0;$i<$n;$i++){
    for($j=0;$j<3;$j++){
        echo $in[$j]." ";
    }
    echo PHP_EOL;
}
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);
$in=array();
for($j=0;$j<3;$j++){
    fscanf($stdin,"%b",$in);
}
team($n,$in);
?>

<?php
function team($n){
$in=array();
$stdin = fopen("php://stdin","r");
for($i=0;$i<$n;$i++){
for($j=0;$j<3;$j++){
    fscanf($stdin,"%d",$in[$j]);
}
}
for($i=0;$i<$n;$i++){
    for($j=0;$j<3;$j++){
        echo $in[$j]." ";
    }
    echo PHP_EOL;
}
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);

team($n);
?>

<?php
function team($n){
    $r=0;
for($i=0;$i<$n;$i++){
    fscanf($stdin,"%d %d %d",$a, $b, $c);
    if ($a + $b + $c >= 2)
         $r++;
    }
echo $r;
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);
team($n);
?>

<?php
function team($n,$in){
for($i=0;$i<$n;$i++){
    for($j=0;$j<3;$j++){
        echo $in[$j]." ";
    }
    echo PHP_EOL;
}
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);
$in=array();
for($j=0;$j<3;$j++){
    fscanf($stdin,"%d",$in);
}
team($n,$in);
?>

<?php
function team($n){
    $r=0;
for($i=0;$i<$n;$i++){
    fscanf($stdin,"%d%d%d",$a,$b,$c);
    if ($a + $b + $c >= 2)
         $r++;
        break;
    }
echo $r;
}
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%d",$n);
team($n);
?>

<?php
    function readFiles ($dir) {
        return file($dir, FILE_IGNORE_NEW_LINES);
    }
    $dir = 'php://stdin';
    $data = readFiles($dir);
    $n = $data[0];
    for ($i = 1; $i < count($data); $i++) {
        $data[$i] = explode(' ', $data[$i]);
    }
    $counter = 0;
    for ($i = 1; $i < count($data); $i++) {
        if (2 >= array_count_values($data[$i])[1]) {
            $counter++;
        }
    }
    echo $counter;


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


<?php

fscanf(STDIN, '%s', $n);

fprintf(STDOUT, "%d\n", intval($n / 2));

for ($i = 0; $i + $i < $n - 3; $i++) {
    if ($i) {
        fprintf(STDOUT, ' ');
    }

    fprintf(STDOUT, '2');
}

if ($n > 3) {
    fprintf(STDOUT, ' ');
}

fprintf(STDOUT, "%d\n", 2 + $n % 2);

<?php
$a = trim(fgets(STDIN));
$b = $a % 2;
if($b == 0)
{
     $c = $a / 2;
     $d = array_fill(0, $c, 2);
     print count($d) . "\n";
     print implode(" ", $d);
}
else
{
     $a -= 3;
     $c = $a / 2;
     $d = array_fill(0, $c, 2);
     array_unshift($d, 3);
     print count($d) . "\n";
     print implode(" ", $d);
}
?>

<?php
$num = (int) trim(fgets(STDIN));
$add = 0;
if ($num%2 == 0) {
    $count = $num/2;
} else {
    $count = ($num-3)/2;
    $add = 1;
}
echo $count + $add . "\n";
for ($i = 0; $i < $count; $i++) {
    echo '2 ';
}
if ($add) {
    echo '3';
}

<?php

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

echo intval($n / 2) . PHP_EOL;

for ($k = 0; $k < $n; $k += 2) {
    if ($k) {
        echo ' ';
    }

    if ($n - $k == 3) {
        echo 3;
        break;
    }

    echo 2;
}

echo PHP_EOL;

<?php

fscanf(STDIN, '%s', $n);

for ($i = 0; $i + $i < $n - 3; $i++) {
    if ($i) {
        fprintf(STDOUT, ' ');
    }

    fprintf(STDOUT, '2');
}

if ($n > 3) {
    fprintf(STDOUT, ' ');
}

fprintf(STDOUT, "%d\n", 2 + $n % 2);

<?php

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

for ($k = 0; $k < $n; $k += 2) {
    if ($k) {
        echo ' ';
    }

    if ($n - $k == 3) {
        echo 3;
        break;
    }

    echo 2;
}

echo PHP_EOL;


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

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

  $r = 0;
  for ($j = 0; $j < $n; $j++) {
    $ans1 = sqrt($a[$j]);
    $v1 = round($ans1);
    if ($ans1 != $v1) { $r = 1; break; }
  }

  if ($r == 1) { echo 'YES'.PHP_EOL; }
  else { echo 'NO'.PHP_EOL; }
}
?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

$t = IO::str();

while ($t--) {
    $n = IO::str();
    $arr = IO::arr();
    $a = true;
    foreach ($arr as $ar) {
        $num = sqrt($ar);
//        echo $num; exit;
        if (strpos($num, '.')) {
            $res[] = 'YES';
            $a = false;
            break;
        }
    }
    if ($a) {
        $res[] = 'NO';
    }
}

foreach ($res as $r) {
    echo $r . "\n";
}

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
        $x = sqrt($a[$i]);
        if (strpos((string)$x, '.') !== false) {
            $bool = true;
            break;
        }
    }
    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
        $x = sqrt($a[$i]);
        if (strpos((string)$x, '.') !== false) {
            $bool = true;
            break;
        }
        $x = -1;
        for ($j = $i + 1; $j < $n; $j++) {
            if ($i == $j) {
                continue;
            }
            $z = $a[$i] * $a[$j];
            if ($x == -1) {
                $x = $a[$i] * $a[$j];
            } else {
                $x = $x * $a[$j];
            }
            $y = sqrt($x);
            $zy = sqrt($z);
            if (strpos((string)$y, '.') !== false || strpos((string)$zy, '.') !== false) {
                $bool = true;
                break;
            }
        }
        if ($bool) {
            break;
        }
    }

    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
        $x = sqrt($a[$i]);
        if ((int)$x != $x) {
            $bool = true;
            break;
        }
        $x = -1;
        for ($j = 0; $j < $n; $j++) {
            if ($i == $j) {
                continue;
            }
            $z = $a[$i] * $a[$j];
            if ($x == -1) {
                $x = $a[$i] * $a[$j];
            } else {
                $x = $x * $a[$j];
            }
            $y = sqrt($x);
            $zy = sqrt($z);
            if ((int)$y != $y || (int)$zy != $zy) {
                $bool = true;
                break;
            }
        }
        if ($bool) {
            break;
        }
    }

    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
//        $x = sqrt($a[$i]);
//        if ((int)$x != $x) {
//            $bool = true;
//            break;
//        }
        $x = -1;
        for ($j = 0; $j < $n; $j++) {
            if ($i == $j) {
                continue;
            }
            $z = $a[$i] * $a[$j];
            if ($x == -1) {
                $x = $a[$i] * $a[$j];
            } else {
                $x = $x * $a[$j];
            }
            $y = sqrt($x);
            $zy = sqrt($z);
            if ((int)$y != $y || (int)$zy != $zy) {
                $bool = true;
                break;
            }
        }
        if ($bool) {
            break;
        }
    }

    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
        $x = sqrt($a[$i]);
        if ((int)$x != $x) {
            $bool = true;
            break;
        }
        $x = -1;
        for ($j = 0; $j < $n; $j++) {
            if ($i == $j) {
                continue;
            }
            if ($x == -1) {
                $x = $a[$i] * $a[$j];
            } else {
                $x = $x * $a[$j];
            }
            $y = sqrt($x);
            if ((int)$y != $y) {
                $bool = true;
                break;
            }
        }
        if ($bool) {
            break;
        }
    }

    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;

$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $bool = false;
    for ($i = 0; $i < $n; $i++) {
        $x = sqrt($a[$i]);
        if ((int)$x != $x) {
            $bool = true;
            break;
        }
        $x = -1;
        for ($j = 0; $j < $n; $j++) {
            if ($i == $j) {
                continue;
            }
            if ($x == -1) {
                $x = $a[$i] * $a[$j];
            } else {
                $x = $x * $a[$j];
            }
            if ((int)$x != $x) {
                $bool = true;
                break;
            }
        }
        if ($bool) {
            break;
        }
    }

    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>


<?php
/*****************************************/
class InputReader {protected $_fh;public function __construct($fileHandler = STDIN){$this->_fh = $fileHandler;}
	public function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}
	public function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}
	public function readArrayOfFloat($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (float)$item;}return $a;}
	public function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}
}

/* Perform action N times. Can return values in array */
function ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}

/* Integral. Keys preserved. By reference. */
function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}

/* Difference. Keys preserved. By reference. */
function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}

function bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}
/*****************************************/

$ir = new InputReader();

/* TASK */

$n = $ir->readInt();
$a = $ir->readArrayOfInt($n, 1);

$s = 0.0;
$m = 0;
for ($i=1; $i<=$n; $i++) {
	$ai = $a[$i];
	if (!isset($b[$ai])) {
		$b[$ai] = [];
	}

	$b[$ai][] = $i;

	if ($m < $ai) {
		$m = $ai;
	}
	$s += $ai;
}

$items = [];

// delete max element
for ($i=1; $i<=$n; $i++) {
	$ind = ($s - $a[$i])/2;
	if (intval($ind) == $ind) {
		if (isset($b[$ind]) && !($ind==$a[$i] && count($b[$ind])==1)) {
			$items[] = $i;
		}
	}
}

echo count($items) . "\n";
echo implode(' ', $items);


<?php
fscanf(STDIN,"%d %d",$n,$k);
$height = fgets(STDIN);
$height = explode(' ',$height);
$height_count = array();
$minn = 2e5 + 100;
$maxx = 0;
for($i = 0;$i < $n;$i++)
{
    $height[$i] = intval($height[$i]);
    $minn = min($minn,$height[$i]);
    $maxx = max($maxx,$height[$i]);
}
$maxx -= $minn;
for($i = 0;$i < $n;$i++)
{
    $height[$i] -= $minn;
    if(!isset($height_count[$height[$i]])) {
        $height_count[$height[$i]] = 1;
    } else $height_count[$height[$i]]++;
}
for($i = $maxx-1;$i >= 1;$i--)
{
    if(!isset($height_count[$i])) {
        $height_count[$i] = $height_count[$i+1];
    } else {
        $height_count[$i] += $height_count[$i+1];
    }
}
for($i = $maxx-1;$i >= 1;$i--)
{
    $height_count[$i] += $height_count[$i+1];
}
$cnt = 0;
$height_count[$maxx + 1] = 0;
$up = $maxx + 1;
$low = $maxx;
while($up > 1)
{
    while($low >= 1&&$height_count[$low] - $height_count[$up] <= $k)
    {
        $low--;
    }
    $cnt++;
    $up = $low + 1;
}
echo $cnt."\n";


<?php
function init(&$h,&$w){
    $pic = array();
    for ($i=0; $i<$h; $i++){
        $line = trim(fgets(STDIN));
        $pic[$i] = array();
        for ($j=0; $j<$w; $j++){
            $pic[$i][$j] = $line[$j];
        }
    }
    return $pic;
}
function pic_gen($h,$w){
    $pic = array();
    for ($i=0; $i<$h; $i++)
        $pic[$i] = array();
    return $pic;
}

function draw(&$input_pic,&$h,&$w){
    for ($i=0; $i<$h; $i++){
        for ($j=0; $j<$w; $j++){
            printf("%s",$input_pic[$i][$j]);
        }
        printf("\n");
    }
}

function rotate(&$input_pic,&$h,&$w){
    $pic_rotate = pic_gen($w,$h);
    for ($i=0; $i<$w; $i++)
        for ($j=$h-1; $j>=0; $j--)
            $pic_rotate[$i][($h-1)-$j]=$input_pic[$j][$i];
    list($h,$w) = array($w,$h);
    $input_pic = $pic_rotate;
}

function div($int,$divider){
    return (($int-($int%$divider))/$divider);
}

function reflect(&$input_pic,&$h,&$w){
    $pic_reflect = pic_gen($h,$w);
    for ($i=0; $i<$h; $i++)
        for ($j=0; $j<$w; $j++)
            $pic_reflect[$i][$j]=$input_pic[$i][($w-1)-$j];
    $input_pic = $pic_reflect;
}
function zoom(&$input_pic,&$h,&$w){
    list($h,$w) = array(2*$h,2*$w);
    $pic_zoom = pic_gen($h,$w);
    for ($i=0; $i<$h; $i++)
        for ($j=0; $j<$w; $j++)
            $pic_zoom[$i][$j]=$input_pic[div($i,2)][div($j,2)];
    $input_pic = $pic_zoom;
}

list($w,$h) = explode(" ",trim(fgets(STDIN)));
$pic = init($h,$w);
rotate($pic,$h,$w);
reflect($pic,$h,$w);
zoom($pic,$h,$w);
draw($pic,$h,$w);

<?php
list($w,$h) = explode(' ',rtrim(fgets(STDIN)));
$matrixStart = array();
for($i = 0; $i < $h; $i++){
    $string = rtrim(fgets(STDIN));
    for($j = 0; $j < $w; $j++){
        $matrixStart[$i][$j] = $string[$j];
    }
}
for ($i = 0; $i < $w; $i++)
{
    $str= '';
    for($j = 0; $j < $h; $j++){
        $str .= $matrixStart[$j][$i].$matrixStart[$j][$i];
    }
    echo $str."\n".$str."\n";
}
?>

<?php

    $FINP = STDIN;

    $tmp = explode( ' ', fgets($FINP));

    $w = (int)$tmp[0]; $h = (int)$tmp[1];

    $newImg = array_fill( 0, 2*$w, array_fill( 0, 2*$h, '.' ) );

    for($i=0;$i<$h;$i++){
        $str = fgets($FINP);
        for($j=0;$j<$w;$j++){
            if( $str[$j] == '.' ) continue;
            $newY = 2*$i;
            $newX = 2*$j;
            $newImg[$newX][$newY] = $newImg[$newX][$newY+1] = $newImg[$newX+1][$newY] = $newImg[$newX+1][$newY+1] = '*';
        }
    }

    for( $i=0;$i<2*$w;$i++ ){
        print implode('',$newImg[$i]) . "\n";
    }

<?php
list($width, $height) = explode(' ', fgets(STDIN));
for ($row = 0; $row < $height; $row++) {
	$line[$row] = fgets(STDIN);
}
for ($col = 0; $col < $width; $col++) {
	$flag = 0;
	while ($flag < 2) {
		for ($row = 0; $row < $height; $row++) {
			echo $line[$row][$col], $line[$row][$col];
		}
		echo "\n";
		$flag++;
	};
}
?>

<?php

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

$w = $exp[0];
$h = $exp[1];

unset($exp);

$lines = array();

for($i = 0; $i < $h; $i++){
    $exp = str_split(fgets(STDIN));

    $z = 0;
    for($j = 0; $j < $w; $j++){
        if(!isset($lines[$z])){
            $lines[$z] = array();
            $lines[$z+1] = array();
        }
        array_unshift($lines[$z], $exp[$j], $exp[$j]);
        array_unshift($lines[$z+1], $exp[$j], $exp[$j]);
        $z += 2;
    }
}

$last = $w*2;
for($i = 0; $i < $last; $i++){
    echo implode('', array_reverse($lines[$i]));
    if($i != $last) echo "\n";
}

<?php
function init(&$h,&$w){
	$pic = array();
	for ($i=0; $i<$h; $i++){
		$line = trim(fgets(STDIN));
		$pic[$i] = array();
		for ($j=0; $j<$w; $j++){
			$pic[$i][$j] = $line[$j];
		}
	}
	return $pic;
}

function draw(&$input_pic,&$h,&$w){
	for ($i=0; $i<$h; $i++){
		for ($j=0; $j<$w; $j++){
			printf("%s",$input_pic[$i][$j]);
		}
		printf("\n");
	}
}

function rotate(&$input_pic,&$h,&$w){
	$pic_rotate = array();
	for ($i=0; $i<$w; $i++)
		$pic_rotate[$i] = array();

	for ($i=0; $i<$w; $i++)
		for ($j=$h-1; $j>=0; $j--)
			$pic_rotate[$i][($h-1)-$j]=$input_pic[$j][$i];
	list($h,$w) = array($w,$h);
	$input_pic = $pic_rotate;
}

function div($int,$divider){
	return (($int-($int%$divider))/$divider);
}

function reflect(&$input_pic,&$h,&$w){
	$pic_reflect = array();
	for ($i=0; $i<$h; $i++)
		$pic_reflect[$i] = array();
	for ($i=0; $i<$h; $i++)
		for ($j=0; $j<$w; $j++)
			$pic_reflect[$i][$j]=$input_pic[$i][($w-1)-$j];
	$input_pic = $pic_reflect;
}
function zoom(&$input_pic,&$h,&$w){
	list($h,$w) = array(2*$h,2*$w);
	$pic_zoom = array();
	for ($i=0; $i<$h; $i++)
		$pic_zoom[$i] = array();
	for ($i=0; $i<$h; $i++)
		for ($j=0; $j<$w; $j++)
			$pic_zoom[$i][$j]=$input_pic[div($i,2)][div($j,2)];
	$input_pic = $pic_zoom;
}

list($w,$h) = explode(" ",trim(fgets(STDIN)));
$pic = init($h,$w);
rotate($pic,$h,$w);
reflect($pic,$h,$w);
zoom($pic,$h,$w);
//printf("%dx%d\n",$h,$w);
draw($pic,$h,$w);


<?php
fscanf(STDIN, "%d", $t);
while ($t--) {
    fscanf(STDIN, "%s", $s);
    printf("%s\n", ['no', 'yes']['yes' == strtolower($s)]);
}

<?php

fscanf(STDIN, "%d", $t);
for($i=1; $i<=$t; $i++)
{
	fscanf(STDIN, "%s", $inputString);
	$inputString = strtoupper($inputString);
	if($inputString == 'YES'){
		printf("YES \n");
	}else{
		print("NO \n");
	}
}

?>

<?php

    $rowLength = (int) fgets(STDIN);
    for ($i = 0; $i < $rowLength; $i++) {
        $yes = trim(fgets(STDIN));
        if (strcasecmp('yes', $yes) === 0) {
            echo('YES'.PHP_EOL);
        } else {
            echo('NO'.PHP_EOL);
        }
    }

<?php

$cnt = readline();
$res = array();
while ($cnt--) {
    $s = readline();

    if (strtolower($s) == 'yes') {
        $res[] = 'YES';
    } else {
        $res[] = 'NO';
    }
}

foreach ($res as $ss) {
    echo $ss . "\n";
}

<?php $t = (int)readline();
for ($i = 0; $i < $t; $i++) {
    $s = strtoupper(readline());
    if ($s == "YES") {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
} ?>

<?php
$a = trim(fgets(STDIN));
for($x = 1; $x <= $a; $x++)
{
     $b = strtolower(trim(fgets(STDIN)));
     if($b == "yes")
     {
          print "YES\n";
     }
     else
     {
          print "NO\n";
     }
}
?>

<?php

$n = readline();
while($n--)
{
	$s = readline();
	$s = strtolower($s);
	if($s == 'yes')
		echo "YES\n";
	else
		echo "NO\n";
}

<?php
$n = ReadLine();
for ($i = 0; $i < $n; $i++) {
    $s = (string) ReadLine();
    $s = strtoupper($s);
    if ($s == "YES") {
        echo "YES\n";
    }else {
        echo "NO\n";
    }
}

<?php

$t = readline();
$t = intval($t);

$i = 0;
$inputs = [];

while($i++ < $t) {
    array_push($inputs, readline());
}

foreach($inputs as $in) {
    if(strtoupper(trim($in)) === "YES") {
        echo "YES" . PHP_EOL;
    } else {
        echo "NO" . PHP_EOL;
    }
}

<?php
$test_case  = readline('test case: ');
for($i=0;$i<$test_case;$i++){
	$str  = readline('string: ');
	if($str) {
		$str = strtoupper($str);
	}
	if($str == 'YES') {
		echo "YES\n";
	} else {
		echo "NO\n";
	}
}

<?php

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

function readInt() {
	return (int) read() ;
}

function readStrs() {
	return explode(" ",read()) ;
}

function readIntArray() {
	return array_map('intval', readStrs());
}

function readAsArray() {
	return str_split(read()) ;
}

function printLine($arg) {
	// if($arg) print_r("true");
	// elseif(!$arg) print_r("false");
	// else {
		print_r($arg) ;
	// }
	print_r("\n") ;
}

$t = readInt() ;

while($t--) {
	$inp = read() ;
	if(strtolower($inp) === "yes") {
		// printLine(strtolower($inp));
		printLine("YES") ;
	}
	else {
		printLine("NO") ;
	}
}

<?php
$mod = 1000000007;
$intMaxValue = 2147483646; //2147483647

$loop = true;
$t = $loop ? IO::get() : 1;
while($t--) {
    solve();
}

function solve()
{
    $s = IO::get();
    $sNew = strtoupper($s);
    $ans = $sNew == 'YES' ? 'YES' : 'NO';
    IO::pr($ans);

}

class IO {
    public static function get()
    {
        return trim(fgets(STDIN));
    }

    public static function getArray()
    {
        return explode(' ', trim(fgets(STDIN)));
    }
    public static function pr($s)
    {
        echo $s, PHP_EOL;
    }
    public static function prArray($s)
    {
        echo implode( ' ', $s), PHP_EOL;
    }
    public static function getMinValue($x, $y) {
        return $x > $y ? $y : $x;
    }
    public static function getMaxValue($x, $y) {
        return $x > $y ? $x : $y;
    }
}

<?php

fscanf(STDIN, "%d", $t);
for($i=1; $i<=$t; $i++)
{
	fscanf(STDIN, "%s", $inputString);
	$inputString = strtoupper($inputString);
	if($inputString == 'YES'){
		printf("YES");
	}else{
		print("NO");
	}
}

?>

<?php

fscanf(STDIN, "%d", $t);
for($i=1; $i<=$t; $i++)
{
	fscanf(STDIN, "%s", $inputString);
	$inputString = strtoupper($inputString);
	if($inputString == 'YES'){
		printf("Yes");
	}else{
		print("No");
	}
}

?>

		<form name="form1" id="form1" method = "POST">
			Test Cases : <input type = "text" name = "testCase" id="testCase" value="" />

			Input String : <input type = "text" name = "inputString" id = "inputString" />

			<input type = "button" name = "save" value = "save" onclick = "validation()" />
			<input type = "button" name = "reset" value = "reset" onclick = "resetForm()" />
			<?php
			echo "

 Your result will be Displyed here";
			?>

		</form>

<?php

    $rowLength = (int) fgets(STDIN);
    for ($i = 0; $i < $rowLength; $i++) {
        $yes = fgets(STDIN);
        if (strcasecmp('yes', $yes)) {
            echo('YES'.PHP_EOL);
        } else {
            echo('NO'.PHP_EOL);
        }
    }

<?php

$cnt = readline();

while ($cnt--) {
    $s = readline();

    if (strtolower($s) == 'yes') {
        echo 'YES';
    } else {
        echo 'NO';
    }
}


<?php
error_reporting("off");
//365A: Good Number
//Lesson of the day: If you're nesting a for loop inside a for loop, you cannot use the same loop counter variable name. The compiler will be extremely unhappy.
//$array = array("1", "10");
list($n, $k) = explode(" ", trim(fgets(STDIN))); //$n = 2; $k = 1;
$kgood = 0;
for ($i = 0; $i < $n; $i++) {
    $hasdigits = TRUE;
    $line = trim(fgets(STDIN)); //$line = $array[$i];
    $explode = str_split($line);
    for ($j = 0; $j <= $k; $j++) {
        if (!in_array($j, $explode)) {
            $hasdigits = FALSE;
            break;
        }
    }
    if ($hasdigits == TRUE) {
        $kgood++;
    }
}

echo $kgood;
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$e = range(0, $b);
$g = 0;
for($x = 1; $x <= $a; $x++)
{
    $c = trim(fgets(STDIN));
    $d = str_split($c);
    $f = array_intersect($e, $d);
    if(count($f) >= count($e))
    {
        $g++;
    }
}
print $g;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$n=$input[0][0];
$k=$input[0][1];
unset($input[0]);
for ($i=0; $i<=$k;$i++) {
    $arrk[]=$i;
}
$res=0;
for ($i=1;$i<=$n;$i++) {
    $input[$i]=array_unique(str_split($input[$i]));
    sort($input[$i]);
    if (array_intersect($input[$i],$arrk)== $arrk) $res++;
}
echo $res;
?>

<?php
function has ($a, $k) {
    // printf ("%d %d %d\n", $a, $k, $a % 10);
    if ($a < 10) return (int) $a == (int) $k;
    return ((int) $a % 10 == (int) $k) || has ($a / 10, $k);
}

function is_good ($a, $k) {
    for ($i = 0; $i <= $k; $i++) {
        if (!has ($a, $i)) return false;
    }
    return true;
}

fscanf(STDIN, "%d %d", $n, $k);
$tot = 0;
for ($i = 0; $i < $n; $i++) {
    fscanf (STDIN, "%d", $a);
    if (is_good($a, $k)) $tot++;
}
printf ("%d\n", $tot);
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$e = range(0, $b);
$g = 0;
for($x = 1; $x <= $a; $x++)
{
    $c = trim(fgets(STDIN));
    $d = str_split($c);
    $f = array_intersect($d, $e);
    if(count($f) >= count($e))
    {
        $g++;
    }
}
print $g;
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$e = range(0, $b);
$g = 0;
for($x = 1; $x <= $a; $x++)
{
    $c = trim(fgets(STDIN));
    $d = str_split($c);
    $f = array_intersect($d, $e);
    if(count($f) <= count($e))
    {
        $g++;
    }
}
print $g;
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$e = range(0, $b);
$g = 0;
for($x = 1; $x <= $a; $x++)
{
    $c = trim(fgets(STDIN));
    $d = str_split($c);
    $f = array_intersect($d, $e);
    if(count($f) == count($e))
    {
        $g++;
    }
}
print $g;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$n=$input[0][0];
$k=$input[0][1];
unset($input[0]);
for ($i=0; $i<=$k;$i++) {
    $arrk[]=$i;
}
$res=0;
for ($i=1;$i<=$n;$i++) {
    $input[$i]=array_unique(str_split($input[$i]));
    sort($input[$i]);
    if ($input[$i] == $arrk) $res++;
}
echo $res;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$n=$input[0][0];
$k=$input[0][1];
unset($input[0]);
for ($i=0; $i<=$k;$i++) {
	$arrk[]=$i;
}
foreach ($input as $item) {
	str_split($item);
	if (!array_diff($item,$arrk)) $res++;
}
echo $res;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$k=$input[0][1];
unset($input[0]);
$res=0;
for ($i=0; $i<=$k;$i++) {
    $arrk[]=$i;
}
foreach ($input as $item) {
    $item=str_split($item);
    if ($item==$arrk) $res++;
}
echo $res;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$n=$input[0][0];
$k=$input[0][1];
unset($input[0]);
for ($i=0; $i<=$k;$i++) {
	$arrk[]=$i;
}
foreach ($input as $item) {
	str_split($item);
	if (!array_diff($item,$arrk)) $i++;
}
echo $i;
?>

<?php
while($s = fgets(STDIN)){
    $input .= $s;
}
$input = explode("\r\n", $input);
$input[0]=explode(" ", $input[0]);
$n=$input[0][0];
$k=$input[0][1];
unset($input[0]);
for ($i=0; $i<=$k;$i++) {
    $arrk[]=$i;
}
foreach ($input as $item) {
    str_split($item);
    if (!array_diff($item,$arrk)) $res++;
}
echo $res-1;
?>


<?php

class Solution
{
    protected function solve($s)
    {
        $check = false;
        for ($i = 0; $i < strlen($s); $i++) {
            if ($s[$i] == 'a') {
                if ($check) {
                    return $s;
                }

                continue;
            }

            $s[$i] = chr(ord($s[$i])-1);
            $check = true;
        }

        if (!$check) {
            $s[strlen($s) - 1] = 'z';
        }

        return $s;
    }

    public function run()
    {
        $s = trim(fgets(STDIN));
        echo $this->solve($s) . PHP_EOL;
    }
}

$sol = new Solution();
$sol->run();

<?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 */
	$str = readString($f);
	$len = strlen($str);
	$min = false;
	for ($i = 0; $i < $len; $i++) {
		if ($str[$i] == 'a') {
			continue;
		}
		$replaceTo = false;
		for ($j = $i; $j < $len; $j++) {
			if ($str[$j] == 'a') {
				$replaceTo = $j;
				break;
			}
		}
		if ($replaceTo == false) {
			$replaceTo = $len;
		}
		$replace = substr($str, $i, $replaceTo - $i);
		$_len = strlen($replace);
		$_str = '';
		for ($k = 0; $k < $_len; $k++) {
			$c = ord($replace[$k]) - 1;
			if ($replace[$k] == 'a') {
				$c = ord('z');
			}
			$_str .= chr($c);
		}

		$min = substr($str, 0, $i) . $_str . substr($str, $replaceTo);
		break;
	}
	if ($min === false) {
		$min = $str;
		$min[strlen($min) - 1] = 'z';
	}
	echo $min;
	/* / end body */
}

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

<?php

class Solution
{
    protected function solve($s)
    {
        $len = strlen($s);
        $was = false;
        for ($i = 0; $i < $len; $i++) {
            if ($s[$i] == 'a') {
                if ($was) {
                    return $s;
                }

                continue;
            }

            $was = true;
            $s[$i] = chr(ord($s[$i]) - 1);
        }

        if (!$was) {
            $s[$len-1] = 'z';
        }

        return $s;
    }

    public function run()
    {
        $s = trim(fgets(STDIN));

        echo $this->solve($s) . PHP_EOL;
    }
}

$sol = new Solution();
$sol->run();

<?php

class Solution
{
    protected function solve($s)
    {
        $len = strlen($s);
        $was = false;
        for ($i = 0; $i < $len; $i++) {
            if ($s[$i] == 'a') {
                if ($was) {
                    return $s;
                }

                continue;
            }

            $was = true;
            $s[$i] = chr(ord($s[$i]) - 1);
        }

        return $s;
    }

    public function run()
    {
        fscanf(STDIN, '%s', $s);

        echo $this->solve($s) . PHP_EOL;
    }
}

$sol = new Solution();
$sol->run();

<?php

class Solution
{
    protected function solve($s)
    {
        $len = strlen($s);
        $was = false;
        for ($i = 0; $i < $len; $i++) {
            if ($s[$i] == 'a') {
                if ($was) {
                    return $s;
                }

                continue;
            }

            $was = true;
            $s[$i] = chr(ord($s[$i]) - 1);
        }

        return $s;
    }

    public function run()
    {
        $s = fgets(STDIN);

        echo $this->solve($s) . PHP_EOL;
    }
}

$sol = new Solution();
$sol->run();