<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}

				if($count <= 0 || ($count > $tryCount && $tryCount != -1))
				{
					$count = $tryCount;
				}

				if($tryCount == 0)
				{
					break;
				}
			}

			if($count == 0)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1($sequence);

//echo sequence1(explode(' ', '1 3 6 9 12'));

<?php
/**
 * Created by PhpStorm.
 * User: jianzjzhang
 * Date: 2018/5/13
 * Time: 18:32
 */

function minChange($arr)
{
    if(count($arr) < 3){
        return 0;
    }

    $min_count = count($arr) + 1;

    foreach ([-1, 0, 1] as $i){
        foreach ([-1, 0, 1] as $j){
            $first = $arr[0] + $i;
            $second = $arr[1] + $j;

            $counter = 0;

            if($i != 0) $counter++;
            if($j != 0) $counter++;

            $diff = $second - $first;

            $cur = $second;
            $flag = true;
            for($k=1; $k<count($arr)-1; $k++){
                if(($cur + $diff == $arr[$k+1])
                    || ($cur + $diff == $arr[$k+1] - 1)
                    || ($cur + $diff == $arr[$k+1] + 1)){

                    if(!($cur + $diff == $arr[$k+1])){
                        $counter++;
                    }
                    $cur += $diff;
                }
                else{
                    $flag = false;
                    break;
                }
            }

            if($flag){
                $min_count = min($min_count, $counter);
            }
        }
    }

    if($min_count == count($arr) + 1) return -1;
    return $min_count;
}

function main()
{
    $n = intval(fgets(STDIN));
    $arr = array();
    for($i=0; $i<$n-1; $i++){
        $arr[] = intval(stream_get_line(STDIN, 4096, " "));
    }
    $arr[] = intval(stream_get_line(STDIN, 4096, "\n"));

    echo minChange($arr)."\n";
}

main();

<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$tryCount = 0;
			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}

				if($count == 0 || $count > $tryCount)
				{
					$count = $tryCount;
				}

				if($tryCount != -1)
				{
					break;
				}
			}

			if($tryCount == 0)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1($sequence);

//echo sequence1(explode(' ', '24 21 14 10'));

<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$tryCount = 0;
			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}
			}

			$count = $tryCount;

			if($tryCount != -1)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1(sequence);

<?php

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

function check($numbers)
{
    $needChange = 0;

    if (count($numbers) > 2) {

        $diff = $numbers[1] - $numbers[0];

        for ($i = 2; $i < count($numbers); $i++) {

            $prevDiff = $diff;
            $diff = $numbers[$i] - $numbers[$i - 1];

            $c = abs($prevDiff - $diff);

            if ($c <= 4) {
                $needChange += floor($c / 2);
            } else {
                $needChange = -1;
                break;
            }
        }
    }

    echo $needChange, PHP_EOL;
}

fscanf($handle, "%i", $n);

$numbers = explode(' ', fgets($handle));

check($numbers);

<?php

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

function sequence($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

        $a1 = $sequence[0];
        $a2 = $sequence[1];

        $found = false;

        $d1 = 0;
        $d2 = 0;
        $minDiff = null;

        // define first elements
        for ($i = -1; $i < 2; $i++) {

            $a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;
                $r = abs($sequence[2] - ($a1 + 2 * ($a2 - $a1)));

                if ($r <= 1 && ($minDiff === null || $r < $minDiff)) {

                    $found = true;

                    $minDiff = $r;
                    $d1 = $i;
                    $d2 = $j;
                }
            }
        }

        if ($found) {

            $a1 = $sequence[0] + $d1;
            $a2 = $sequence[1] + $d2;

            $count = abs($d1) + abs($d2);

            for ($i = 2; $i < count($sequence); $i++) {

                $diff = abs($sequence[$i] - ($a1 + $i * ($a2 - $a1)));

                if ($diff > 1) {
                    $count = -1;
                    break;
                } else {
                    $count += $diff;
                }
            }

        } else {
            $count = -1;
        }

    }

    return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));

echo sequence($sequence);

<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$tryCount = 0;
			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}

				if($count <= 0 || ($count > $tryCount && $tryCount != -1))
				{
					$count = $tryCount;
				}
			}

			if($tryCount == 0)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1($sequence);

//echo sequence1(explode(' ', '24 21 14 10'));

<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$tryCount = 0;
			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}

				if($count <= 0 || $count > $tryCount)
				{
					$count = $tryCount;
				}

				if($tryCount != -1)
				{
					break;
				}
			}

			if($tryCount == 0)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1($sequence);

//echo sequence1(explode(' ', '24 21 14 10'));

<?php

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

function sequence1($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

		// define first elements
        for ($i = -1; $i < 2; $i++) {

			$tryCount = 0;
			$a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;

				$tryCount = abs($i) + abs($j);

				for ($k = 2; $k < count($sequence); $k++) {

					$diff = abs($sequence[$k] - ($a1 + $k * ($a2 - $a1)));

					if ($diff > 1) {
						$tryCount = -1;
						break;
					} else {
						$tryCount += $diff;
					}
				}

				$count = $tryCount;

				if($tryCount != -1)
				{
					break;
				}
			}

			if($tryCount != -1)
			{
				break;
			}
		}

	}

	return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));
echo sequence1($sequence);

//echo sequence1(explode(' ', '24 21 14 10'));

<?php

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

function sequence($sequence)
{
    $count = 0;

    if (count($sequence) > 2) {

        $a1 = $sequence[0];
        $a2 = $sequence[1];

        $found = false;

        // define first elements
        for ($i = -1; $i < 2 && !$found; $i++) {

            $a1 = $sequence[0] + $i;

            for ($j = -1; $j < 2; $j++) {

                $a2 = $sequence[1] + $j;
                $r = abs($sequence[2] - ($a1 + 2 * ($a2 - $a1)));

                if ($r <= 1) {

                    $found = true;
                    $count += abs($i) + abs($j) + $r;
                    break;
                }
            }
        }

        if ($found) {

            for ($i = 3; $i < count($sequence); $i++) {

                $diff = abs($sequence[$i] - ($a1 + $i * ($a2 - $a1)));

                if ($diff > 1) {
                    $count = -1;
                    break;
                } else {
                    $count += $diff;
                }
            }

        } else {
            $count = -1;
        }

    }

    return $count;
}

fscanf($handle, "%i", $n);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));

echo sequence($sequence);


<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($a);
$upper = $sum / 2;

$array1 = array();
$array2 = array();

$sum1 = $sum2 = 0;
for ($i = 0; $i < $n; $i++) {
	$sum1 += $a[$i];
	if ($upper >= $sum1) {
		$array1[$sum1] = 1;
	}
	$sum2 += $a[$n - $i - 1];
	if ($upper >= $sum2) {
		$array2[$sum2] = 1;
	}
}

/*
echo "1: ";
foreach ($array1 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
echo "2: ";
foreach ($array2 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
 */

krsort($array1);

foreach ($array1 as $key => $dummy) {
	if (isset($array2[$key])) {
		echo $key . PHP_EOL;
		exit;
	}
}
echo "0";

<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($a);
$upper = $sum / 2;

$array1 = array();
$array2 = array();

$sum1 = $sum2 = 0;
for ($i = 0; $i < $n; $i++) {
	$sum1 += $a[$i];
	if ($upper >= $sum1) {
		$array1[$sum1] = 1;
	}
	$sum2 += $a[$n - $i - 1];
	if ($upper >= $sum2) {
		$array2[$sum2] = 1;
	}
}

/*
echo "1: ";
foreach ($array1 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
echo "2: ";
foreach ($array2 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
 */

krsort($array1);
krsort($array2);

foreach ($array1 as $key => $dummy) {
	if (isset($array2[$key])) {
		echo $key . PHP_EOL;
		exit;
	}
}
echo "0";

<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($a);
$upper = $sum / 2;

$array1 = array();
$array2 = array();

$sum1 = $sum2 = 0;
for ($i = 0; $i < $n; $i++) {
	$sum1 += $a[$i];
	$sum1 = intval($sum1);
	if ($upper >= $sum1) {
		$array1[$sum1] = 1;
	}
	$sum2 += $a[$n - $i - 1];
	$sum2 = intval($sum2);
	if ($upper >= $sum2) {
		$array2[$sum2] = 1;
	}
}

/*
echo "1: ";
foreach ($array1 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
echo "2: ";
foreach ($array2 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
 */

krsort($array1);
krsort($array2);

foreach ($array1 as $key => $dummy) {
	if (isset($array2[$key])) {
		echo $key . PHP_EOL;
		exit;
	}
}
echo "0";

<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($a);
$upper = $sum / 2;

$array1 = array();
$array2 = array();

$sum1 = $sum2 = 0;
for ($i = 0; $i < $n; $i++) {
	$sum1 += $a[$i];
	$sum1 = floor($sum1);
	if ($upper >= $sum1) {
		$array1[$sum1] = 1;
	}
	$sum2 += $a[$n - $i - 1];
	$sum2 = floor($sum2);
	if ($upper >= $sum2) {
		$array2[$sum2] = 1;
	}
}

/*
echo "1: ";
foreach ($array1 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
echo "2: ";
foreach ($array2 as $key => $dummy) {
echo $key . " ";
}
echo PHP_EOL;
 */

krsort($array1);
krsort($array2);

foreach ($array1 as $key => $dummy) {
	if (isset($array2[$key])) {
		echo $key . PHP_EOL;
		exit;
	}
}
echo "0";


YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES

YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO

YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES

YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES

YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO


<?php

$testsNumber = (int)readline();

for ($i = 0; $i < $testsNumber; $i ++){
    $nameLen = (int)readline();
    $nameStr = readline();

    if ($nameLen != 5){
        print "NO\n";
        continue;
    }

    $nameStr = str_split($nameStr);
    sort($nameStr);
    $nameStr = implode($nameStr);

    if ($nameStr != 'Timru')
        print "NO\n";
    else
        print "YES\n";
}

<?php

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

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

for($i = 0; $i < $cases; $i++)
{
    $length = trim(fgets( $f ));
    $string = trim(fgets( $f ));

    $name = [
        "T" => false,
        "i" => false,
        "m" => false,
        "u" => false,
        "r" => false,
    ];

    if($length != 5)
    {
        echo "NO\n";
        continue;
    }

    foreach(str_split($string) as $c)
    {
        if(array_key_exists($c, $name))
        {
            if($name[$c] == false)
            {
                $name[$c] = true;
            }
            else
            {
                echo "NO\n";
                continue 2;
            }
        }
        else{
            echo "NO\n";
            continue 2;
        }
    }

    echo ((bool)array_product($name) ) ? "YES\n" : "NO\n";
}

?>

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

$loop = true;
$t = $loop ? IO::get() : 1;
while($t--) {
    solve();
}
function solve()
{
    $len = 5;
    $aInner = ['T' => 0, 'i' => 0, 'm' => 0, 'u' => 0, 'r' => 0];

   $n = IO::get();
   $s = IO::get();
   if($n != 5) {
        IO::pr('No');
   } else {
        $b = true;
     for ($i=0; $i<$n; $i++) {
        if(isset($aInner[$s[$i]])) {
          $aInner[$s[$i]] = 1;
        } else {
           $b = false;
           break;
        }
     }
     foreach ($aInner as $k=>$v) {
        if($v === 0) {
           $b = false;
        }
     }
     IO::pr($b ? 'Yes' : 'No');
   }

}

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

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

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

for($i = 0; $i < $cases; $i++)
{
    $length = trim(fgets( $f ));
    $string = trim(fgets( $f ));

    $name = [
        "T" => false,
        "i" => false,
        "m" => false,
        "u" => false,
        "r" => false,
    ];

    if($length != 5)
    {
        echo "NO\n";
    }

    foreach(str_split($string) as $c)
    {
        if(array_key_exists($c, $name))
        {
            if($name[$c] == false)
            {
                $name[$c] = true;
            }
            else
            {
                echo "NO\n";
                continue 2;
            }
        }
        else{
            echo "NO\n";
            continue 2;
        }
    }

    echo ((bool)array_product($name) ) ? "YES\n" : "NO\n";
}

?>


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

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

for ($i = 0; $i < $t; $i++) {
  $str = trim(fgets($file));
  $r = strrev($str);
  $j = 0; $k = 0;
  while ($r[$j] == 'a') { $j++; }
  while ($str[$k] == 'a') { $k++; }

  if ($j == strlen($str)) { echo 'NO'.PHP_EOL; }
  else {
    if ($j == 0 && $k == 0) { echo 'YES'.PHP_EOL; echo 'a'.$str.PHP_EOL; }
    else {
      if ($j >= $k) { echo 'YES'.PHP_EOL;  echo $str.'a'.PHP_EOL; }
      if ($j < $k) { echo 'YES'.PHP_EOL;  echo 'a'.$str.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;
    }
}

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

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $a = str_split(IO::str());
    $n = count($a);
    $s = $e = '';
    $bool = true;
    for ($i = 0; $i < $n; $i++) {
        $f = $a[$i];
        $l = $a[count($a) - $i - 1];
        if ('a' !== $l && $bool) {
            $s .= 'a';
            $bool = false;
        }
        $s .= $f;
    }

    if(!$bool) {
        IO::line('YES');
        IO::line($s);
    } else {
        IO::line('NO');
    }

}

?>

<?php
	fscanf(STDIN, "%d", $t);
	while($t--) {
		fscanf(STDIN, "%s", $s);
		strlen($s)%2 == 0 ? $n=strlen($s)/2 : $n = floor(strlen($s)/2 + 1);
		$no = true;
		for ($i=strlen($s), $k=strlen($s)-1; $i>=$n; $i--, $k--) {
			if ($s[strlen($s)-$i] != 'a') {
				$no = false;
				echo "YES\n";
				for ($j=0; $j<$i; $j++) {
					echo $s[$j];
				}
				echo 'a';
				for ($j=$i; $j<strlen($s); $j++){
					echo $s[$j];
				}
				echo "\n";
				break;

			}
			else if ($s[$k] != 'a'){
				$no = false;
				echo "YES\n";
				$k2 = strlen($s)-$k-1;
				while($k2 > 0){
					$k2--;
					echo $s[$k2];
				}
				echo 'a';
				for ($i=strlen($s)-$k-1; $i<=strlen($s)-1; $i++){
					echo $s[$i];
				}
				echo "\n";
				break;
			}

		}
		if ($no) echo "NO\n";

	}
?>

<?php
	fscanf(STDIN, "%d", $t);
	while($t--) {
		fscanf(STDIN, "%s", $s);
		strlen($s)%2 == 0 ? $n=strlen($s)/2 : $n = floor(strlen($s)/2 + 1);
		$no = true;
		for ($i=strlen($s), $k=strlen($s)-1; $i>=$n; $i--, $k--) {
			if ($s[strlen($s)-$i] != 'a') {
				$no = false;
				echo "YES\n";
				for ($j=0; $j<$i; $j++) {
					echo $s[$j];
				}
				echo 'a';
				for ($j=$i; $j<strlen($s); $j++){
					echo $s[$j];
				}
				echo "\n";
				break;

			}
			else if ($s[$k] != 'a'){
				$no = false;
				echo "YES\n";
				$k2 = strlen($s)-$k-1;
				while($k2 > 0){
					$k2--;
					echo $s[$k2];
				}
				echo 'a';
				for ($i=strlen($s)-$k-1; $i<strlen($s)-1; $i++){
					echo $s[$i];
				}
				echo "\n";
				break;
			}

		}
		if ($no) echo "NO\n";

	}
?>

<?php
	fscanf(STDIN, "%d", $t);
	while($t--) {
		fscanf(STDIN, "%s", $s);
		strlen($s)%2 == 0 ? $n=strlen($s)/2 : $n = floor(strlen($s)/2 + 1);
		$no = true;
		for ($i=strlen($s); $i>=$n; $i--) {
			if ($s[strlen($s)-$i] != 'a') {
				$no = false;
				echo "YES\n";
				for ($j=0; $j<$i; $j++) {
					echo $s[$j];
				}
				echo 'a';
				for ($j=$i; $j<strlen($s); $j++){
					echo $s[$j];
				}
				echo "\n";
				break;
			}
		}
		if ($no) echo "NO\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() {
    $a = str_split(IO::str());
    $n = ceil(count($a) / 2);
    $s = $e = '';
    $bool = true;
    for ($i = 0; $i < $n; $i++) {
       $f = $a[$i];
       $l = $a[count($a) - $i - 1];
       if ('a' !== $l && $bool) {
           $s .= 'a';
           $bool = false;
       }
       $s .= $f;
       $sp = isset($a[count($a) - $i - 2]) ? $a[count($a) - $i - 2] : 'a';
       if ($sp !== 'a' && $bool) {
           $s .= 'a';
           $bool = false;
       }
       if (count($a) - $i - 1 !== $i) {
           $e = $l . $e;
       }
    }

    if(!$bool) {
        IO::line('YES');
        IO::line($s . $e);
    } else {
        IO::line('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() {
    $a = str_split(IO::str());
    $n = ceil(count($a) / 2);
    $s = $e = '';
    $bool = true;
    for ($i = 0; $i < $n; $i++) {
       $f = $a[$i];
       $l = $a[count($a) - $i - 1];
       if ('a' !== $l && $bool) {
           $s .= 'a';
           $bool = false;
       }
       $s .= $f;
       if (count($a) - $i - 1 !== $i) {
           $e = $l . $e;
       }
    }

    if(!$bool) {
        IO::line('YES');
        IO::line($s . $e);
    } else {
        IO::line('NO');
    }

}

?>


<?php

$times = (int)trim(fgets(STDIN));
for ($idx = 0; $idx < $times; ++$idx) {
    $ni[] = (int)trim(fgets(STDIN));
    $ai[] = array_map('intval', explode(' ', trim(fgets(STDIN))));
}
for ($idx = 0; $idx < $times; ++$idx) {
    $n = &$ni[$idx];
    $a = &$ai[$idx];
    $b = $a;
    sort($b);
    $sm = [];
    $tmp = 0;
    for ($i = 0; $i < $n; ++$i) {
        $tmp += $b[$i];
        $sm[] = $tmp;
    }
    $mx = max($b);
    for ($i = $n - 1; $i >= 0; --$i) {
        if ($sm[$i] >= $mx) {
            $mx = $b[$i];
        } else {
            break;
        }
    }
    $ans = [];
    for ($i = 0; $i < $n; ++$i) {
        $a[$i] >= $mx && $ans[] = $i + 1;
    }
    echo count($ans) , PHP_EOL;
    echo implode(' ', $ans) , PHP_EOL;
}

<?php

$times = (int)trim(fgets(STDIN));
for ($idx = 0; $idx < $times; ++$idx) {
    $ni[] = (int)trim(fgets(STDIN));
    $ai[] = array_map('intval', explode(' ', trim(fgets(STDIN))));
}
for ($idx = 0; $idx < $times; ++$idx) {
    $n = &$ni[$idx];
    $a = &$ai[$idx];
    $b = $a;
    sort($b);
    $sm = [$b[0]];
    for ($i = 1; $i < $n; ++$i) {
        $sm[$i] = $sm[$i - 1] + $b[$i];
    }
    $mx = $b[$n - 1];
    for ($i = $n - 1; $i >= 0; --$i) {
        if ($sm[$i] >= $mx) {
            $mx = $b[$i];
        } else {
            break;
        }
    }
    $ans = [];
    for ($i = 0; $i < $n; ++$i) {
        $a[$i] >= $mx && $ans[] = $i + 1;
    }
    echo count($ans) , PHP_EOL;
    echo implode(' ', $ans) , PHP_EOL;
}


<?php
ini_set("display_errors","Off");
error_reporting(0);
$t1=microtime(1);
$stdin=fopen('php://stdin', 'r');
fscanf($stdin, "%d\n",$caseCount);
$arrayAs=[];
function proc($x,$p){
    if($x<10){return [$x,$p];}
    do{$p++;}while(($x/=10)>9);
    return [$x,$p];
}
for($j=0;$j<$caseCount;$j++) {
    fscanf($stdin, "%d %d\n", $x1,$p1);
    fscanf($stdin, "%d %d\n", $x2,$p2);
//    echo "[$x1,$p1]\n";
    list($x1,$p1)=proc($x1,$p1);
//    echo "[$x1,$p1]\n";
    list($x2,$p2)=proc($x2,$p2);
    if($p1>$p2){echo ">";}elseif($p1<$p2){echo "<";}elseif($x1<$x2){echo "<";}elseif($x1>$x2){echo ">";}else{echo "=";}
    echo "\n";
}

<?php

# ...შენ რო გიყურებ ერთ ანიგდოტ მახსენდება ოღონდ სასაცილო არ არი.
# ბალღოო! ჭკვიანად იყავ თორე გიამბობ იცოდე. გიიგე?
#
# თუში მეცხვარე.
# გახსოვდეს ვისი გორისა ხარ

function readArray()
{
    return array_map('intval', explode(' ', trim(readline())));
}

function countLen($num, $additional)
{
    return strlen(strval($num)) + $additional;
}

$n = +readline();

while($n--)
{
    list($a, $aZeros) = readArray();
    list($b, $bZeros) = readArray();

    $aNumLen = countLen($a, $aZeros);
    $bNumLen = countLen($b, $bZeros);

    if($aNumLen > $bNumLen)
    {
        echo '>';
    }
    else if($aNumLen < $bNumLen)
    {
        echo '<';
    }
    else
    {
        while(strlen(strval($a)) !== strlen(strval($b)))
        {
            if(strlen(strval($a)) < strlen(strval($b)))
            {
                $a *= 10;
            }
            else
            {
                $b *= 10;
            }
        }

        if($a > $b)
        {
            echo '>';
        }
        else if($a < $b)
        {
            echo '<';
        }
        else
        {
            echo '=';
        }
    }

    echo "\n";
}

<?php
ini_set("display_errors","Off");
error_reporting(0);
$t1=microtime(1);
$stdin=fopen('php://stdin', 'r');
fscanf($stdin, "%d\n",$caseCount);
$arrayAs=[];
function proc($x,$p){
    if($x<10){return [$x,$p];}
    while(($x/=10)>9){$p++;}
    return [$x,$p];
}
for($j=0;$j<$caseCount;$j++) {
    fscanf($stdin, "%d %d\n", $x1,$p1);
    fscanf($stdin, "%d %d\n", $x2,$p2);
//    echo "[$x1,$p1]\n";
    list($x1,$p1)=proc($x1,$p1);
//    echo "[$x1,$p1]\n";
    list($x2,$p2)=proc($x2,$p2);
    if($p1>$p2){echo ">";}elseif($p1<$p2){echo "<";}elseif($x1<$x2){echo "<";}elseif($x1>$x2){echo ">";}else{echo "=";}
    echo "\n";
}


<?php

$t = trim(fgets(STDIN));

$ans = '';
for ($o = 0; $o < $t; $o++)
{
	$data = explode(" ", trim(fgets(STDIN)));
	$ans .= bcdiv(bcadd($data[0], bcadd($data[1], $data[2])), 2)."\n";
}
echo $ans;

?>

<?php
list($c) = explode(' ', trim(fgets(STDIN)));
for($i = 0; $i < $c; $i++){
    list($a,$y,$z) = explode(' ', trim(fgets(STDIN)));
    $iTotal = bcadd(bcadd($a,$y),$z);
    $iAnswer = bcdiv($iTotal,2);
    echo $iAnswer."\n";
}

<?php
#1196A
$n = trim(fgets(STDIN));
while ($n--) {
    $result = 0;
    $arr = explode(' ', trim(fgets(STDIN)));
    foreach ($arr as $v) {
        $result = bcadd($result, $v);
    }
    echo bcdiv($result, 2) . PHP_EOL;
}


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

    $T = intval(fgets(STDIN));
    while($T --)
    {
        $Hate = trim(fgets(STDIN)) ;

        $len = strlen($Hate) ;

        $prefix_sum = array(
            array_fill(0, $len, 0),
            array_fill(0, $len, 0)
        ) ;

        $suffix_sum = array(
            array_fill(0, $len + 1, 0),
            array_fill(0, $len + 1, 0)
        ) ;

        if($Hate[0] == '0') $prefix_sum[0][0] = 1 ;
        else $prefix_sum[1][0] = 1 ;

        for($i = 1; $i < $len; $i ++)
        {
            $prefix_sum[0][$i] = $prefix_sum[0][$i - 1] ;
            $prefix_sum[1][$i] = $prefix_sum[1][$i - 1] ;

            if($Hate[$i] == '0') $prefix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $prefix_sum[1][$i] ++ ;
        }

        for($i = $len - 1; $i >= 0; $i --)
        {
            $suffix_sum[0][$i] = $suffix_sum[0][$i + 1] ;
            $suffix_sum[1][$i] = $suffix_sum[1][$i + 1] ;

            if($Hate[$i] == '0') $suffix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $suffix_sum[1][$i] ++ ;
        }

        $ans = $len ;
        for($i = 0; $i < $len; $i ++)
        {
            $ans = min($ans, $prefix_sum[1][$i] + $suffix_sum[0][$i + 1]) ;
            $ans = min($ans, $prefix_sum[0][$i] + $suffix_sum[1][$i + 1]) ;
        }

        echo $ans . "\n" ;
    }
?>

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

    $T = intval(fgets(STDIN));
    while($T --)
    {
        $Hate = trim(fgets(STDIN)) ;

        $len = strlen($Hate) ;

        $prefix_sum = array(
            array_fill(0, $len, 0),
            array_fill(0, $len, 0)
        ) ;

        $suffix_sum = array(
            array_fill(0, $len + 1, 0),
            array_fill(0, $len + 1, 0)
        ) ;

        if($Hate[0] == '0') $prefix_sum[0][0] = 1 ;
        else $prefix_sum[1][0] = 1 ;

        if($Hate[$len - 1] == '0') $suffix_sum[0][$len - 1] = 1 ;
        else $suffix_sum[1][$len - 1] = 1 ;

        for($i = 1; $i < $len; $i ++)
        {
            $prefix_sum[0][$i] = $prefix_sum[0][$i - 1] ;
            $prefix_sum[1][$i] = $prefix_sum[1][$i - 1] ;

            if($Hate[$i] == '0') $prefix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $prefix_sum[1][$i] ++ ;
        }

        for($i = $len - 2; $i >= 0; $i --)
        {
            $suffix_sum[0][$i] = $suffix_sum[0][$i + 1] ;
            $suffix_sum[1][$i] = $suffix_sum[1][$i + 1] ;

            if($Hate[$i] == '0') $suffix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $suffix_sum[1][$i] ++ ;
        }

        $ans = $len ;
        for($i = 0; $i < $len; $i ++)
        {
            $ans = min($ans, $prefix_sum[1][$i] + $suffix_sum[0][$i + 1]) ;
            $ans = min($ans, $prefix_sum[0][$i] + $suffix_sum[1][$i + 1]) ;
        }

        echo $ans . "\n" ;
    }
?>

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

    $T = intval(fgets(STDIN));
    while($T --)
    {
        $Hate = trim(fgets(STDIN)) ;

        $len = strlen($Hate) ;

        $prefix_sum = array(
            array_fill(0, $len, 0),
            array_fill(0, $len, 0)
        ) ;

        $suffix_sum = array(
            array_fill(0, $len, 0),
            array_fill(0, $len, 0)
        ) ;

        if($Hate[0] == '0') $prefix_sum[0][0] = 1 ;
        else $prefix_sum[1][0] = 1 ;

        if($Hate[$len - 1] == '0') $suffix_sum[0][$len - 1] = 1 ;
        else $suffix_sum[1][$len - 1] = 1 ;

        for($i = 1; $i < $len; $i ++)
        {
            $prefix_sum[0][$i] = $prefix_sum[0][$i - 1] ;
            $prefix_sum[1][$i] = $prefix_sum[1][$i - 1] ;

            if($Hate[$i] == '0') $prefix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $prefix_sum[1][$i] ++ ;
        }

        for($i = $len - 2; $i >= 0; $i --)
        {
            $suffix_sum[0][$i] = $suffix_sum[0][$i + 1] ;
            $suffix_sum[1][$i] = $suffix_sum[1][$i + 1] ;

            if($Hate[$i] == '0') $suffix_sum[0][$i] ++ ;
            if($Hate[$i] == '1') $suffix_sum[1][$i] ++ ;
        }

        $ans = $len ;
        for($i = 0; $i + 1 < $len; $i ++)
        {
            $ans = min($ans, $prefix_sum[1][$i] + $suffix_sum[0][$i + 1]) ;
            $ans = min($ans, $prefix_sum[0][$i] + $suffix_sum[1][$i + 1]) ;
        }

        echo $ans . "\n" ;
    }
?>


<?php
@error_reporting(0);
$stdin = fopen("input.txt", "r");
$stdout = fopen("output.txt", "w");

$n = intval(fgets($stdin));
$st = trim(fgets($stdin));
fclose($stdin);
for($i = 0; $i < $n / 2; ++ $i) {
	if($st[$i] == 'R' && $st[$i + $n / 2] == 'L'){
		fwrite($stdout, strval($i + $n / 2 + 1) . " " . strval($i + 1) . "\n");
	} else {
		fwrite($stdout, strval($i + 1) . " " . strval($i + 1 + $n / 2) . "\n");
	}
}
fclose($stdout);

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for ( $i = 0; $i < $len/2; $i++ ){

    if ( $pupil[$i] == "R") $result .= ($i+1+$len/2)." ".($i+1);

    else  $result .= ($i+1)." ".($i+1+$len/2);

    if($i < $len) $result .= "\n";

}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for($i = 0; $i < len/2; $i++){
if($pupil[$i] == "R")
$result .= ($i+$len/2+1)." ".($i+1);
else
$result .= ($i+1)." ".($i+$len/2+1);
if($i < $len) $result .= "\n";
}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for($i = 0; $i < len/2; $i++){
if($pupil[$i] == 'R' && $pupil[$i+$len/2] == 'L')
$result .= ($i+$len/2+1).' '.($i+1);
else
$result .= ($i+1).' '.($i+$len/2+1);
if($i < len/2-1) $result .= '\n';
}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for($i = 0; $i < len/2; $i++){
if($pupil[$i] == 'R' && $pupil[$i+$len/2] == 'L')
$result .= ($i+$len/2).' '.$i;
else
$result .= $i.' '.($i+$len/2);
$result .= '\n';
}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for($i = 0; $i < len/2; $i++){
if($pupil[$i] == 'R')
$result .= ($i+$len/2+1)." ".($i+1);
else
$result .= ($i+1)." ".($i+$len/2+1);
if($i < $len) $result .= "\n";
}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
@error_reporting(0);
$stdin = fopen("php://stdin", "r");
$stdout = fopen("php://stdout", "w");

$n = intval(fgets($stdin));
$st = trim(fgets($stdin));
fclose($stdin);
for($i = 0; $i < $n / 2; ++ $i) {
	if($st[$i] == 'R' && $st[$i + $n / 2] == 'L'){
		fwrite($stdout, strval($i + $n / 2 + 1) . " " . strval($i + 1) . "\n");
	} else {
		fwrite($stdout, strval($i + 1) . " " . strval($i + 1 + $n / 2) . "\n");
	}
}
fclose($stdout);

<?php
$aClass = explode("\n", stream_get_contents(fopen("php://stdin", 'r')));
$len = $aClass[0];
$pupil = explode('', $aClass[1]);
for ( $i = 1; $i <= $len/2; $i++ ){
    $a = $len / 2 + $i;
    if ( $pupil[$i] == "R" && $pupil[$a] == "L") echo $i." ".$a;
    else  echo $a." ".$i;
    if($i < $len) echo "\n";
}
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for ( $i = 0; $i < $len/2; $i++ ){

    $a = $len / 2 + $i;

    if ( $pupil[$i] == "L" && $pupil[$a] == "R") echo ($i+1)." ".($a+1);

    else  echo ($a+1)." ".$i;

    if($i < $len) echo $result .= "\n";

}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", stream_get_contents(fopen("php://stdin", 'r')));
$len = $aClass[0];
$pupil = explode('', $aClass[1]);
var_dump($pupil);
for ( $i = 1; $i <= $len/2; $i++ ){
    $a = $len / 2 + $i;
    if ( $pupil[$i] == "R" && $pupil[$a] == "L") echo $i." ".$a;
    else  echo $a." ".$i;
    if($i < $len) echo "\n";
}
?>

<?php
$sNum = file_get_contents("input.txt");
$c = 0;
hexadecimal(1);
function hexadecimal($a){
    global $sNum, $c;
    if($a <= $sNum){
		$c++;
        hexadecimal($a*10);
        hexadecimal($a*10+1);
    }
    return true;
}
$handle = fopen("output.txt", "w");
fwrite($handle, $c);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = explode('', $aClass[1]);
$result = "";

for ( $i = 1; $i <= $len/2; $i++ ){

    $a = $len / 2 + $i;

    if ( $pupil[$i] == "R" && $pupil[$a] == "L") $result .= $i." ".$a;

    else  echo $result .= $a." ".$i;

    if($i < $len) echo $result .= "\n";

}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$sNum = stream_get_contents(fopen("php://stdin", 'r'));
$c = 0;
hexadecimal(1);
function hexadecimal($a){
    global $sNum, $c;
    if($a <= $sNum){
		$c++;
        hexadecimal($a*10);
        hexadecimal($a*10+1);
    }
    return true;
}
echo $c;
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for ( $i = 0; $i < $len/2; $i++ ){

    $a = $len / 2 + $i;

    if ( $pupil[$i] == "L" && $pupil[$a] == "R") $result .= ($i+1)." ".($a+1);

    else  $result .= ($a+1)." ".$i;

    if($i < $len) $result .= "\n";

}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>

<?php
$aClass = explode("\n", file_get_contents("input.txt"));
$len = $aClass[0];
$pupil = $aClass[1];
$result = "";

for ( $i = 0; $i < $len/2; $i++ ){

    $a = $len / 2 + $i;

    if ( $pupil[$i] == "R" && $pupil[$a] == "R") $result .= ($i+1+$len/2)." ".($i+1);

    else  $result .= ($i+1)." ".($i+1+$len/2);

    if($i < $len) $result .= "\n";

}

$handle = fopen("output.txt", "w");
fwrite($handle, $result);
fclose($handle);
?>


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

$loop = true;
$t = $loop ? IO::get() : 1;
while($t--) {
    solve();
}
function solve()
{
   $n = IO::get();
   $s = IO::get();
   $ans = 'NO';
   $q = 0;
   $a = 0;

   for ($i = 0; $i < $n; $i++) {
      if($s[$i] == 'Q') {
           $q++;
      } else {
           if($q > 0) {
             $q--;
           }
      }
   }

   $ans = $q == 0 ? '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

$tc = trim(fgets(STDIN));

while ($tc-- > 0) {
    $messages = trim(fgets(STDIN));
    $dialog = trim(fgets(STDIN));

    $questions = 0;

    for ($i = 0; $i < strlen($dialog); $i++) {
        if ($dialog[$i] === 'Q') {
            $questions++;
        } else if ($questions > 0) {
            $questions--;
        }
    }

    if ($questions === 0) {
        echo "Yes" . PHP_EOL;
    } else {
        echo "No" . PHP_EOL;
    }
}

?>

<?php

//[$a,$b] = array_map('intval', explode(' ', trim(fgets(STDIN))));
//[$s] = explode(' ', trim(fgets(STDIN)));
//$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$h = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$mod = 998244353;
//$mod = 1000000007;
//$alpha = "abcdefghijklmnopqrstuvwxyz";

[$t] = array_map('intval', explode(' ', trim(fgets(STDIN))));

for($i=0;$i<$t;$i++){
    [$n] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    [$s] = explode(' ', trim(fgets(STDIN)));
    $qcnt = 0;
    for($j=0;$j<$n;$j++){
        if($s[$j]=="Q") {
            $qcnt++;
        }
        else {
            $qcnt--;
            if($qcnt < 0) $qcnt = 0;
        }
    }
    if($qcnt > 0) $ans[] = "No";
    else $ans[] = "Yes";
}
echo implode(PHP_EOL,$ans);

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

    $counter = 0;
	for($j = 0; $j < $n; $j++){
		if ($a[$j] == "Q")
		{
			$counter++;
		} else if($a[$j] == "A"){
			if($counter>0)
			{
				$counter--;
			}
		}
    }
	if($counter<=0){
		echo "Yes";
	}
	else{
		echo "No";
	}
    echo "\n";
}

<?php

$tc = trim(fgets(STDIN));

while ($tc-- > 0) {
    $messages = trim(fgets(STDIN));
    $dialog = trim(fgets(STDIN));

    $questions = 0;
    $answers = 0;

    for ($i = 0; $i < strlen($dialog); $i++) {
        if ($dialog[$i] === 'Q') {
            $questions++;
        } else {
            $answers++;
        }
    }

    if ($answers >= $questions) {
        echo "Yes" . PHP_EOL;
    } else {
        echo "No" . PHP_EOL;
    }
}

?>

<?php

//[$a,$b] = array_map('intval', explode(' ', trim(fgets(STDIN))));
//[$s] = explode(' ', trim(fgets(STDIN)));
//$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$h = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$mod = 998244353;
//$mod = 1000000007;
//$alpha = "abcdefghijklmnopqrstuvwxyz";

[$t] = array_map('intval', explode(' ', trim(fgets(STDIN))));

for($i=0;$i<$t;$i++){
    [$n] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    [$s] = explode(' ', trim(fgets(STDIN)));
    $qcnt = 0;
    for($j=0;$j<$n;$j++){
        if($s[$j]=="Q") $qcnt++;
    }
    if($qcnt > ($n-$qcnt)) $ans[] = "No";
    else $ans[] = "Yes";
}
echo implode(PHP_EOL,$ans);


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

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

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

        $ans = min(substr_count($in_str, "0"), substr_count($in_str, "1")) ;

        echo $ans&1 ? "DA\n" : "NET\n" ;
    }
?>


<?php

$n = fgets(STDIN);
$buttons = explode( " ", fgets(STDIN) );

if( $n == 1 )
{
    if( $buttons[0] == 1 )
        echo "YES\n";
    else
        print "NO\n";
}
else{
    if( array_sum($buttons) + 1 == $n )
        print "YES\n";
    else
        print "NO\n";
}

?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
if($a == 1)
{
     if($b[0] == 1)
     {
          print "YES";
     }
     else
     {
          print "NO";
     }
}
else
{
     $c = 0;
     for($x = 0; $x < $a; $x++)
     {
          if($b[$x] == 0)
          {
               $c++;
          }
     }
     if($c == 1)
     {
          print "YES";
     }
     else
     {
          print "NO";
     }
}
?>

<?php

	$totalButton = readline("");
	$buttons = readline("");

	$buttons = explode(" ", $buttons);
	if($totalButton == 1) {
		if((int)$buttons[0] == 1) {
			echo "YES";
		} else {
			echo "NO";
		}
	} else {
		$count = 0;
		foreach($buttons as $button) {
			if((int)$button == 0) {
				$count += 1;
			}
		}
		if($count == 1) {
			echo "YES";
		} else {
			echo "NO";
		}
	}

?>

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

// Your code here
//......
$count =0;
if($n==1)
{
    if($x[0]==1)
    {
        $count= 1;

    }
    else
        $count=0;
}
else{
    for($i =0;$i<$n;$i++){

            if($x[$i]==0)
            {
                $count++;
            }

    }
}

if($count!=1){
    echo 'NO';
}
else
    echo 'YES';

<?php
/**
 * Created by PhpStorm.
 * User: CPU11316-local
 * Date: 6/19/2019
 * Time: 1:45 PM
 */

// Input
$in = 'php://stdin';
$input = fopen($in, "r");
$n = fgets($input);

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

function test($x,$n){
    sort($x);
    if ($x[$n-1] == 0) return false;
    if(array_sum($x) == $n-1) return true;
    if(count($x) == 1) return true;
    return false;
}

if (test($x,$n)){
    echo ("YES");
}
else echo ("NO");

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 1 ){
	echo $arr[0] ? "YES" : "NO";
	die;
}
$count = 0;
foreach ($arr as $number) {
	if($number == 1){
		continue;
	}elseif ($count > 0 )
	{
		echo "NO";die;
	}else {
		$count++;
	}
}
if($count == 0)
{
	echo "NO";
} else {
	echo "YES";
}

?>

<?php
$in = 'php://stdin';
$input = fopen($in, "r");
$n = fgets($input);
$a = explode(" ", trim(fgets($input)));
if ($n == 1) {
    if ($a[0] == 1)
        echo("YES");
    else
        echo("NO");
} else {
    $count = 0;
    for ($i = 0; $i < $n; $i++) {
        if ($a[$i] == 0) {
            $count++;
        }
    }
    if ($count == 1)
        echo("YES");
    else
        echo("NO");
}

<?php
  $n=fgets(STDIN);
  $counterz=0; $counterone=0;
 $arr=explode(" ",trim(fgets(STDIN)));
   for($i=0; $i<count($arr); $i++){
  if($arr[$i]==0) $counterz++;
   else if($arr[$i]==1) $counterone++;
}
 if($counterone==1&& $n==1) {echo "YES"; exit;}
 else if($counterz==1 && $n!=1){echo "YES"; exit;}
 echo"NO";
?>

<?
$stdin = fopen('php://stdin', 'r');
$n =  trim(fgets($stdin));
$buttons = explode(" ",trim(fgets($stdin)));

if(count($buttons)==1){
	if($buttons[0]==1){
		echo "YES";
	}else{
		echo "NO";
	}
}else{
	$r_cnt=0;
	foreach($buttons as $button){
		if($button==0){
			$r_cnt++;
			if($r_cnt>1){
				break;
			}
		}

	}
	if($r_cnt==1){
		echo "YES";
	}else{
		echo "NO";
	}
}

?>

<?php

	$totalButton = readline("");
	$buttons = readline("");

	$buttons = explode(" ", $buttons);
	if((int)$totalButton == 1) {
		if((int)$buttons[0] == 1) {
			echo "YES";
		} else {
			echo "NO";
		}
	} else {
		$count = 0;
		foreach($buttons as $button) {
			if((int)$button == 0) {
				$count += 1;
			}
		}
		if($count > 1) {
			echo "NO";
		} else {
			echo "YES";
		}
	}

?>

<?php

	$totalButton = readline("");
	$buttons = readline("");

	$buttons = explode(" ", $buttons);
	if($totalButton == 1) {
		if((int)$buttons[0] == 1) {
			echo "YES";
		} else {
			echo "NO";
		}
	} else {
		$count = 0;
		foreach($buttons as $button) {
			if((int)$button == 0) {
				$count += 1;
			}
		}
		if($count > 1) {
			echo "NO";
		} else {
			echo "YES";
		}
	}

?>

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

// Your code here
//......
$count =0;
if($n==1)
{
    if($x[$i]==1)
    {
        $count= 1;

    }
    else
        $count=0;
}
else{
    for($i =0;$i<$n;$i++){

            if($x[$i]==0)
            {
                $count++;
            }

    }
}

if($count!=1){
    echo 'no';
}
else
    echo 'yes';

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

// Your code here
//......
$count =0;
if($n==1)
{
    if($x[$i]==1)
    {
        $count= 1;

    }
    else
        $count=0;
}
else{
    for($i =0;$i<$n;$i++){

            if($x[$i]==0)
            {
                $count++;
            }

    }
}

if($count!=1){
    echo 'NO';
}
else
    echo 'YES';

<?php
/**
 * Created by PhpStorm.
 * User: CPU11316-local
 * Date: 6/19/2019
 * Time: 1:45 PM
 */

// Input
$in = 'php://stdin';
$input = fopen($in, "r");
$n = fgets($input);

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

function test($x,$n){
    sort($x);
    if ($x[$n-1] == 0) return false;
    if(array_sum($x) >= $n-1) return true;
    return false;
}

if (test($x,$n)){
    echo ("YES");
}
else echo ("NO");

<?php
/**
 * Created by PhpStorm.
 * User: CPU11316-local
 * Date: 6/19/2019
 * Time: 1:45 PM
 */

// Input
$in = 'php://stdin';
$input = fopen($in, "r");
$n = fgets($input);

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

function test($x,$n){
    sort($x);
    if ($x[$n-1] == 0) return false;
    if(array_sum($x) == $n-1) return true;
    return false;
}

if (test($x,$n)){
    echo ("YES");
}
else echo ("NO");

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 1 && $arr[0] == 0){
	echo "NO";die;
}
$count = 0;
foreach ($arr as $number) {
	if($number == 1){
		continue;
	}elseif ($count > 0 )
	{
		echo "NO";die;
	}else {
		$count++;
	}
}
echo "YES";
?>

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 1 && $arr[0] == 0){
	echo "NO";die;
}
$count = 0;
foreach ($arr as $number) {
	if($number == 1){
		continue;
	}elseif ($count > 0 )
	{
		echo "NO";die;
	}else {
		$count++;
	}
}
if($count == 0)
{
	echo "NO";
} else {
	echo "YES";
}

?>

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 0 && $arr[0] == 0){
	echo "NO";die;
}
$count = 0;
foreach ($arr as $key => $number) {
	if($number){
		continue;
	}
	if($count >0 )
	{
		echo "NO";die;
	}else{
		$count++;
	}
}
echo "YES";
?>

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 0 && $arr[0] == 0){
	echo "NO";die;
}
$count = 0;
foreach ($arr as $key => $number) {
	if($number == 1){
	}elseif ($count >0 )
	{
		echo "NO";die;
	}else {
		$count++;
	}
}
echo "YES";
?>

<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);
if ( count($arr) == 0 && $arr[0] == 0){
	echo "NO";die;
}
$count = 0;
foreach ($arr as $key => $number) {
	if($number == 1){
		continue;
	}elseif ($count > 0 )
	{
		echo "NO";die;
	}else {
		$count++;
	}
}
echo "YES";
?>

<?php
  $n=trim(fgets(STDIN));
  $counterz=0;
  for($i=0; $i<$n; $i++){
    $x=trim(fgets(STDIN));
   if($x==0) $counterz++;
}
  if($counterz==0 && n==1) {echo "YES"; exit;}
 else if($counterz==1){echo "YES"; exit;}
 echo"NO";
?>

<?php
  $n=fgets(STDIN);
  $counterz=0; $counterone=0;
  for($i=0; $i<$n; $i++){
    $x=fgets(STDIN);
   if($x==0) $counterz++;
  if($x==1) $counterone++;
}
  if($counterone==1&& n==1) {echo "YES"; exit;}
 else if($counterz==1 && n!=1){echo "YES"; exit;}
 echo"NO";
?>

<?php
  $n=fgets(STDIN);
  $counterz=0; $counterone=0;
  for($i=0; $i<$n; $i++){
    $x=trim(fgets(STDIN));
   if($x==0) $counterz++;
  if($x==1) $counterone++;
}
  if($counterone==1&& $n==1) {echo "YES"; exit;}
 else if($counterz==1 && $n!=1){echo "YES"; exit;}
 echo"NO";
?>

<?php
  $n=fgets(STDIN);
  $counterz=0; $counterone=0;
  for($i=0; $i<$n; $i++){
    $x=fgets(STDIN);
   if($x==0) $counterz++;
  if($x==1) $counterone++;
}
  if($counterone==1&& $n==1) {echo "YES"; exit;}
 else if($counterz==1 && $n!=1){echo "YES"; exit;}
 echo"NO";
?>


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

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

list($n,$t,$c) = explode(" ",$s);

$s = explode(" ",trim(fgets($f)));

$a = array();
$f = false;
$temp =array();
foreach($s as $i){
    if ($i>$t) {
        if (count($temp)>0)
            $a[] = $temp;
        $temp = array();
    } else {
        $temp[] = $i;
    }
}
$a[] = $temp;

$result = 0;
foreach($a as $i){
    if (count($i)>=$c)
        $result = $result+(count($i)-$c)+1;
}

echo $result;

<?php
$input = "php://stdin";
$text = str_replace("\r", "", file_get_contents($input));
list($s1, $s2) = explode("\n", $text);
list($n, $t, $c) = explode(" ", $s1);
$list = explode(" ", $s2);

$t = (int)$t;
$result = 0;
$startFrom = null;
for ($i = 0; $i < $n; $i++) {
	$val = (int)$list[$i];
    if ($val <= $t) {
		if ($startFrom === null) {
			$startFrom = $i;
		}
	} else {
		if ($startFrom !== null) {
			$len = $i - $startFrom;
			if ($len >= $c) {
				$result += $len-$c+1;
			}
		}
		$startFrom = null;
	}
}

if ($startFrom !== null) {
    $len = $i - $startFrom;
    if ($len >= $c) {
        $result += $len-$c+1;
    }
}

echo $result;

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

	$input = fopen($in, "r");

	list($n, $t, $c) = explode(" ", trim(fgets($input)));

	$a = explode(" ", trim(fgets($input)));
	$a[] = 1000000001;

	$size = 0;
	$possibles = 0;

	for($i=0;$i<=$n;$i++) {
		if ($a[$i] <= $t) {$size++;}
		else {
			if ($c<=$size) $possibles += ($size-$c)+1;
			$size = 0;
		}
	}

	echo $possibles
?>

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

	$input = fopen($in, "r");

	list($n, $t, $c) = explode(" ", trim(fgets($input)));

	$a = explode(" ", trim(fgets($input)));
	$a[] = 10000000001;

	$size = 0;
	$possibles = 0;

	for($i=0;$i<=$n;$i++) {
		if ($a[$i] <= $t) {$size++;}
		else {
			if ($c<=$size) $possibles += ($size-$c)+1;
			$size = 0;
		}
	}

	echo $possibles
?>

<?php

$input = rtrim(fgets(STDIN));
$raw = explode(' ', $input);

$n = (int)$raw[0];
$t = (int)$raw[1];
$c = (int)$raw[2];

$rawData = rtrim(fgets(STDIN));
$rawData = explode(' ', $rawData);

$data = array_pad([], $n + 1, 0);
for ($i = 1; $i <= $n; $i++) {
    $data[$i] = (int) $rawData[$i - 1];
}

$answer = 0;
$dp = array_pad([], $n, 0);
for ($i = 1; $i <= $n; $i++) {
    if ($data[$i] <= $t) {
        $dp[$i] = $dp[$i - 1] + 1;
    } else {
        $dp[$i] = 0;
    }

    if ($dp[$i] >= $c) {
        $answer++;
    }
}

echo $answer . PHP_EOL;

<?php
list($n, $t, $c) = explode(" ", trim(fgets(STDIN)));
$a = explode(" ", trim(fgets(STDIN)));
$ans = 0;
for ($i = 0; $i < count($a); )
{
    if ($a[$i] > $t)
        ++$i;
    $j = $i;
    while ($j < count($a) && $a[$j] <= $t)
        ++$j;
    $ans += max($j - $c - $i + 1, 0);
    $i = $j;
}
print $ans;
?>

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

	$input = fopen($in, "r");

	list($n, $t, $c) = explode(" ", fgets($input));

	$a = explode(" ", fgets($input));
	$a[] = 1000000001;

	$size = 0;
	$possibles = 0;

	for($i=0;$i<=$n;$i++) {
		if ($a[$i] <= $t) {$size++;}
		else {
			if ($c<=$size) $possibles += ($size-$c)+1;
			$size = 0;
		}
	}

	echo $possibles
?>


<?php
$a = trim(fgets(STDIN));
if(bcmod($a, 4) == 0)
{
    print "4";
}
else
{
    print "0";
}
?>


<?php
    $t = trim(fgets(STDIN));
    $arr = [];
    $result = 0;
    for($i = 0; $i < $t*2; $i++){
        $num = trim(fgets(STDIN));
        if($i % 2 != 0){
            array_push($arr,$num);
        }
    }

    function getAnswer($str){
        if(strlen($str) == 1 || strlen($str) == 2){
            echo "YES" . "\n";
            return;
        }
        $charsOk = [];
        for($i = 0; $i < strlen($str); $i++){
            if(in_array($str[$i], $charsOk)){
                continue;
            }
            for($j = 0; $j < strlen($str); $j++){
                if($i == $j){continue;}
                if($str[$i] == $str[$j] && $str[$j] != $str[$j - 1]){
                    echo "NO" . "\n";
                    return;
                }
            }
            array_push($charsOk, $str[$i]);
        }
        echo "YES" . "\n";
    }

    foreach($arr as $val){
        getAnswer($val);
    }
?>

<?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;
    }

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

    public static function dd($val){
        echo $val; exit;
    }
}

$t = IO::str();
$cnt = 0;
while ($t--) {
    $res = array();
    $n = IO::str();
    $s = IO::str();
    $s = str_split($s);

    for ($i = 0; $i < $n-1; $i++){
        if ($i == $n - 1) break;
        if ($s[$i] != $s[$i+1]) {
            if (isset($res[$s[$i]]) || isset($res[$s[$i+1]])) {
                $f[$cnt] = 'NO';
                break;
            }
            $res[$s[$i]] = 1;
        }
    }
    if (!isset($f[$cnt])) {
        $f[$cnt] = 'YES';
    }
    $cnt++;
}

IO::res($f);

<?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() {
    $a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $n = IO::str();
    $s = IO::str();
    $d = str_split($s);
    $last = $d[0];
    $res = [];
    $bool = true;
    foreach ($d as $v) {
        if ($v !== $last && isset($res[$v])) {
            $bool = false;
            break;
        }
        $last = $v;
        $res[$v] = 1;
    }
    if ($bool) {
        IO::yes();
    } else {
        IO::no();
    }

}

?>

<?php

function isPrime($number)
{

    if ($number == 2 || $number == 3)
        return true;

    if ($number % 2 == 0 || $number % 3 == 0)
        return false;

    $divisor = 6;
    while ($divisor * $divisor - 2 * $divisor + 1 <= $number)
    {

        if ($number % ($divisor - 1) == 0)
            return false;

        if ($number % ($divisor + 1) == 0)
            return false;

        $divisor += 6;
    }

    return true;

}

function nextPrime($n)
{
    $n = $n + 1;
    while(!isPrime($n)){
        $n++;
    }

    return $n;
}

function gcd($a, $b)
{
    while($b != 0){
        $t = $a % $b;
        $a = $b;
        $b = $t;
    }
    return $a;
}

for($t = intval(trim(fgets(STDIN))); $t > 0; $t --){
    $n = intval(trim(fgets(STDIN)));

    $string = str_split(trim(fgets(STDIN)));
    $occurrences = [];
    $flag = 1;

    foreach ($string as $i => $char){
        if(isset($occurrences[$char])){
            if($string[$i] !== $string[$i - 1]){
                echo "NO\n";
                $flag = 0;
                break;
            }
        }

        $occurrences[$char] = 1;
    }

    if($flag)
        echo "YES\n";
}

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

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

for ($i = 0; $i < $t; $i++) {
  $n = trim(fgets($file));
  $s = trim(fgets($file));
  $v = array();

  $f = $s[0]; $v[$s[0]] = 1;
  for ($j = 0; $j < $n; $j++) {
    if ($s[$j] != $f) { $f = $s[$j]; $v[$s[$j]]++; }
  }
  rsort($v);

  if ($v[0] > 1) { echo 'NO'.PHP_EOL; }
  else { echo 'YES'.PHP_EOL; }
}

?>


<?php
$a = trim(fgets(STDIN));
$b = array();
for($x = $a - 1; $x >= 0; $x--)
{
     $c = trim(fgets(STDIN));
     $b[$x] = $c;
}
ksort($b);
$d = array_unique($b);
$e = array_keys($d);
for($x = 0; $x < count($e) - 1; $x++)
{
     print $d[$e[$x]] . "\n";
}
print $d[$e[$x]];
?>

<?php

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

$map = [];
while ($n--) {
    fscanf(STDIN, '%s', $key);

    if (isset($map[$key])) {
        unset($map[$key]);
    }

    $map[$key] = 1;
}

$value = end($map);
while ($key = key($map)) {
    echo $key . PHP_EOL;
    $value = prev($map);
}

<?php
$lenght = trim(fgets(STDIN));
$array = [];
while($line = fgets(STDIN)){
    $array[] = trim($line);
}
$array_r = array_reverse($array);
$length = count($array_r);
for($i=0; $i<$length; $i++){
    $newArray[$array_r[$i]] = '';
}
foreach($newArray as $key => $v)echo $key."\n";
?>

<?
fgets(STDIN);
$a = [];
while(!feof(STDIN)) $a[] = trim(fgets(STDIN));
print implode("\n", array_unique(array_reverse($a), SORT_STRING));

<?php
    $n = fgets(STDIN);
    $name = array();
    for ($i = 0; $i < $n; $i++) $name[] = trim(fgets(STDIN));
    $ans = ""; $cur = array();
    while (count($name) > 0){
        $s = "";
        if (!isset($cur[$s = array_pop($name)])) {
            $ans .= $s . "\n";
            $cur[$s] = 1;
        }
    }
    echo $ans;

<?php
$num = intval(fgets(STDIN));
for ($i = 0; $i < $num; $i++) {
	$to[trim(fgets(STDIN))] = $i;
}
arsort($to);
foreach ($to as $k => $v) echo $k . PHP_EOL;

<?php
$n = (int)fgets(STDIN);

$chats = [];
for ($i = 0; $i < $n; $i++) {
  $name = trim(fgets(STDIN));
  $chats[$name] = $i;
}
arsort($chats);
echo implode("\n", array_keys($chats)), "\n";

<?php

$n = trim(fgets(STDIN));
$arr = array();
for ($i = 0; $i < $n; $i++)
{
    $arr[] = trim(fgets(STDIN));
}
krsort($arr);
$arr = array_unique($arr);
foreach ($arr as $value)
{
        echo $value."\r";
}

<?

$n = (int) fgets(STDIN);

$list = [];
for ($i = 0; $i < $n; $i++) {
    $title = trim(fgets(STDIN));
    $list[$title] = $i;
}

arsort($list);

echo implode(chr(10), array_keys($list));

<?
	$count = fgets(STDIN);
	$items = [];

	for ($i = 0; $i < $count; ++$i) {
		$items[] = trim(fgets(STDIN));
	};

	$users = [];

	for ($i = 0; $i < $count; ++$i) {
		$user = $items[$i];
		$users[$user] = $i;
	}

	arsort($users);

	foreach ($users as $user => $i) {
		echo $user . PHP_EOL;
	}

?>

<?
$stdin = fopen('php://stdin', 'r');
$num = trim(fgets($stdin));
$arr = array();
$arr2 = array();
$max = 0;
for($i = 0; $i < $num; $i++){
    $k = trim(fgets($stdin));
    $arr[$i] = $k;
    if($arr2[$arr[$i]] != 1){
         $arr2[$arr[$i]] = 1;
         $max++;
    }
}
$j = 0;
$stdout = fopen('php://stdout', 'w');
for($i = $num - 1; $i >= 0; $i--){
    if($arr2[$arr[$i]] != 2){
         $arr2[$arr[$i]] = 2;
         fwrite($stdout, $arr[$i]."\n");
         $j++;
         if($max == $j) break;
    }
}
fclose($stdout);

?>

<?php

$num = intval(fgets(STDIN));
for ($i = 0; $i < $num; $i++) {
	$to[trim(fgets(STDIN))] = $i;
}

foreach ($to as $k => $v) echo $k . PHP_EOL;

<?php

$str = '8
alina
maria
ekaterina
darya
darya
ekaterina
maria
alina';

$arr = explode("\n", $str);

for ($i = 1; $i < count($arr); $i++) $to[$arr[$i]] = $i;

foreach ($to as $k => $v) echo $k . PHP_EOL;

<?
$stdin = fopen('php://stdin', 'r');
$num = trim(fgets($stdin));
$arr = array();

for($i = 0; $i < $num; $i++){
    $k = trim(fgets($stdin));
    $key = array_search($k, $arr);
    if($key !== false){
        array_splice($arr, $key, 1);
    }
    array_unshift($arr, $k);
}

$stdout = fopen('php://stdout', 'w');
for($i = 0; $i < count($arr); $i++){
    fwrite($stdout, $arr[$i]);
}
fclose($stdout);

?>


<?php

function run(){
    $n = trim(fgets(STDIN));
    $arr = explode(' ', trim(fgets(STDIN)));
    $m = trim(fgets(STDIN));
    $brr = explode(' ', trim(fgets(STDIN)));
    rsort($arr); rsort($brr);
    if($arr[0] > $brr[0]){
         echo "Alice\nAlice\n";
    }
    else if($arr[0] < $brr[0]){
         // echo "Bob\nBob\n";
         echo str_repeat("Bob\n", 2);
    }
    else{
         echo "Alice\nBob\n";
    }
}

$test_cases = trim(fgets(STDIN));
while($test_cases--){
    run();
}
?>

<?php
    $t = trim(fgets(STDIN));
    for($t1 = 1; $t1 <= $t; $t1++) {
        $n = trim(fgets(STDIN));
        $a = explode(' ', trim(fgets(STDIN)));

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

        $maxA = max($a);
        $maxB = max($b);

        if ($maxA >= $maxB) {
            echo 'Alice' . PHP_EOL;
        } else {
            echo 'Bob' . PHP_EOL;
        }

        if ($maxB >= $maxA) {
            echo 'Bob' . PHP_EOL;
        } else {
            echo 'Alice' . PHP_EOL;
        }

    }
?>

<?php
$no = 'NO';
$yes = 'YES';
$mod = 1000000007;
$intMaxValue = 2147483646; //2147483647
$alph = 'abcdefghijklmnopqrstuvwxyz';
$inter = "\n";
define("INTMAXVALUE",     2147483646);

   $t = IO::getInt();
//   $point = ord('a') + ord('b') ;

   for($q=0; $q <$t; $q++) {
       $ans = 0;
       $n = IO::getInt();
       $a = IO::getArray();
       $m = IO::getInt();
       $b = IO::getArray();

       $aMax = max($a);
       $bMax = max($b);
       //Alice
       if($aMax > $bMax) {
            IO::pr('Alice');
            IO::pr('Alice');
       } elseif($aMax == $bMax) {
           IO::pr('Alice');
           IO::pr('Bob');

       }else {
            IO::pr('Bob');
            IO::pr('Bob');
       }

   }

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

     public static function getArray()
     {
         return explode(' ', trim(fgets(STDIN)));
     }
     public static function pr($s)
     {
         if(is_array($s)) {
             echo implode( ' ', $s), PHP_EOL;
         } else {
             echo $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;
     }
 }

 class Algor {
    public static function isPrime($n) {
         $d = 2;
         while ($n % $d != 0) {
         $d += 1;
         }

        return $d == $n;
    }

     public static function fabicon($n, $a) {
         if($n <= 1) {
             return $a[$n];
         }
         for($i=2; $i<=$n; $i++) {
             $a[$i] = $a[$i-1] + $a[$i-2];
         }

         return $a[$n];
     }

     function getRotate($a, $s, $e, $ind) {
         $ar = [];
         for ($i= $s; $i<=$e; $i++) {
             $ar[$i] = $a[$i];
             $j = $i + $ind > $e ? $i + $ind - $e - 1 : $i + $ind;
             // echo $i, ' ', $j, ' ', $j < $i ? $ar[$j] : $a[$j] , "\n";
             $a[$i] = $j < $i ? $ar[$j] : $a[$j];
         }
         return $a;
     }

}

class bigOperation {
    public static function  isBigNumber($n)
    {
        return bccomp($n, INTMAXVALUE) == 1;
    }
    // bcadd — Сложить 2 числа произвольной точности
    public static function  bcAdd($x, $y)
    {
        return bcadd($x, $y);
    }
// bccomp — Сравнение двух чисел произвольной точности
//return 1 if x>y, 0= x==y, -1 x < y
    public static function  bcComp($x, $y)
    {
        return bccomp($x, $y);
    }
// bcdiv — Операция деления для чисел произвольной точности
    public static function  bcDiv($x, $y)
    {
        return bcdiv($x, $y);
    }
// bcmod — Получает остаток от деления чисел с произвольной точностью
    public static function  bcMod($x, $y)
    {
        return bcmod($x, $y);
    }
// bcmul — Умножение двух чисел с произвольной точностью
    public static function  bcMul($x, $y)
    {
        return bcmul($x, $y);
    }
// bcpow — Возведение в степень чисел с произвольной точностью
    public static function  bcPow($x, $y)
    {
        return bcpow($x, $y);
    }
// bcpowmod — Возводит одно число в степень другого и возвращает остаток от деления результата на третье число
// bcscale — Задает количество чисел после десятичной точки по умолчанию для всех bc math функций.
// bcsqrt — Извлекает квадратный корень из числа с произвольной точностью
    public static function  bcSqrt($x, $y)
    {
        return bcsqrt($x, $y);
    }
// bcsub — Вычитает одно число с произвольной точностью из другого
    public static function  bcSub($x, $y)
    {
        return bcsub($x, $y);
    }
    public static function getMaxValue($x, $y) {
        return bccomp($x, $y) == 1 ? $x : $y;
    }
    public static function getMinValue($x, $y) {
        return bccomp($x, $y) == 1 ? $y : $x;
    }

    public static function getDareje($n, $k) {
        if($k == 0) {
            return 1;
        }
        return bcmul($n, self::getDareje($n, $k-1));
    }
}

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

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

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

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

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

        return $aResult;

    }
}

class SolveArchive
{

}


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

// Codeforces Problem 218A
// Codeforces Contest 134 Div 2 Problem A
$raw = g();
$n = $raw[0];
$k = $raw[1];
$raw = g();
for ($x = 0; $x < $n; $x++) {
	$lo[$x] = $raw[2 * $x];
	$hi[$x] = $raw[2 * $x + 1];
}
$lo[$n] = $raw[2 * $n];

$ct = $k;
$res = "";
for ($x = 0; $x < $n; $x++) {
	$res .= $lo[$x] . " ";
	if (($hi[$x] > $lo[$x] + 1) && ($hi[$x] > $lo[$x + 1] + 1) && ($ct > 0)) {
		$res .= ($hi[$x] - 1) . " ";
		$ct--;
	} else {
		$res .= $hi[$x] . " ";
	}
}
$res .= $lo[$n];

echo $res;

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


<?php
function read() {
  return trim(fgets($GLOBALS['file'])) ;
}
function readInt() {
  return (int) read() ;
}
function readStrs() {
  return explode(" ",read()) ;
}
function readIntArray() {
  return array_map('intval', readStrs());
}
function readAsArray() {
  return str_split(read()) ;
}
function puts($arg) {
  if($arg === true) print_r("true");
  elseif($arg === false) print_r("false");
  else {
    print_r($arg) ;
  }
  print_r("\n") ;
}
$file = (file_exists("input.txt")) ? fopen("input.txt","r") : STDIN ;

//-----------------------------------//

function fi($arr, $ele) {
    for($i=0;$i<count($arr);$i++) {
        if($arr[$i] == $ele) {
            return $i ;
        }
    }
}

$t = readInt() ;
while($t--) {
    [$n,$k] = readIntArray();
    $arr = readIntArray();
    $brr = [] ;
    foreach ($arr as $e) {
        $brr[] = $e ;
    }
    $swapa = 0 ;
    sort($brr) ;
    for($i=0;$i<$k;$i++) {
        $ind = fi($arr,$brr[$i]);
        if($ind > $k-1) {
            $swapa += 1 ;
        }
    }
    puts($swapa);
}

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

$t; $n; $k; $arr;
fscanf($cin, "%d\n", $t);
for ($T = 0; $T < $t; $T++) {
    fscanf($cin, "%d %d\n", $n, $k);
    $perm = explode(" ", trim(fgets($cin)));
    $ans = 0;
    for ($i = 1; $i <= $k; $i++) {
        if ($perm[$i-1] > $k) $ans++;
    }
    fprintf($cout, "%d\n", $ans);
} ?>


<?php

// https://codeforces.com/problemset/problem/118/B

/*
 Example: (input=2)

    0
  0 1 0
0 1 2 1 0
  0 1 0
    0
*/

/*
 Example: (input=3)

      0
    0 1 0
  0 1 2 1 0
0 1 2 3 2 1 0
  0 1 2 1 0
    0 1 0
      0
*/

function getRowData(int $number): array
{
    $numberOfColumns = (($number * 2) + 1);
    $rowData = [];
    $clonedNumber = $number - 1;

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

        if ($i <= $number) {
            array_push($rowData, $i);
        } else {
            array_push($rowData, $clonedNumber);
            $clonedNumber--;
        }
    }

    return $rowData;
}

function getRowDataAccordingToRowPosition(int $number, int $rowPosition): array
{
    if ($rowPosition <= $number)
        return getRowData($rowPosition);

    return getRowData((($number * 2)) - $rowPosition);
}

function getNumberOfNeededSpaces(int $number, int $rowPosition): int
{
    if ($rowPosition === $number)
        return 0;

    if ($rowPosition < $number)
        return ($number - $rowPosition) * 2;

    return ($rowPosition - $number) * 2;
}

function getUserInput(): int
{
    $handle = fopen("php://stdin","r");
    return (int) fgets($handle);
}

$number = getUserInput();
$numberOfRows = (($number * 2) + 1);
$matrix = [];

/**
 * Filling the matrix with row data
 * Ex: [[0], [0, 1, 0],..]
 */
for ($i=0;$i<$numberOfRows;$i++) {
    array_push($matrix, getRowDataAccordingToRowPosition($number, $i));
}

/**
 * Printing the matrix data based on needed spaces
 */
foreach ($matrix as $rowPosition => $rowData) {
    echo str_repeat(" ", getNumberOfNeededSpaces($number, $rowPosition));
    echo implode(' ', $rowData);
    echo "\n";
}

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);

$max=$lines;

for ($l=0; $l<=$max; $l++)
{
    $line=str_repeat(" ", ($max-$l)*2);
    $line.=($l==0)?0:(implode(" ", range(0, $l))." ".implode(" ", range($l-1, 0)));
    $res[]=$line;
}
for ($l=$lines-1; $l>=0; $l--)
{
    $line=str_repeat(" ", ($max-$l)*2);
    $line.=($l==0)?0:(implode(" ", range(0, $l))." ".implode(" ", range($l-1, 0)));
    $res[]=$line;
}
echo implode("\n", $res);

?>

<?php
error_reporting("off");
//118B: Present from Lena
$n = trim(fgets(STDIN)); //$n = 3;
$rows = array();
for ($i = 0; $i <= $n; $i++) {
    $um = $n - $i;
    $numpadding = $um * 2;
    $padding = "";
    for ($er = 0; $er < $numpadding; $er++) {
        $padding .= " ";
    }
    $rows[$i] .= $padding;
    for ($j = 0; $j <= $i; $j++) {
        $rows[$i] .= $j." ";
    }
    for ($k = $i - 1; $k >= 0; $k--) {
        $rows[$i] .= $k." ";
    }
    $rows[$i] = substr($rows[$i], 0, -1);
}
for ($j = $n - 1; $j >= 0; $j--) {
    $rows[] = $rows[$j];
}
foreach ($rows as $value) {
    echo $value."\n";
}
?>

<?php

$n = (int)fgets(STDIN);

$lines = array();

for ($i=0; $i<=$n; $i++)
{
    $sl = str_pad ('', ($n - $i)*2, ' ', STR_PAD_LEFT);
    for ($j=0; $j<=$i; $j++)
    {
        $sl.= $j.' ';
    }

    $sl = rtrim($sl);
    $sr = substr($sl, 0, strlen($sl) - 1);
    $sr = trim(strrev($sr));
    $s = $sl.' '.$sr;
    $s = rtrim($s);

    $lines[] = $s;

    echo $s.PHP_EOL;
}

for ($i=$n-1; $i>=0; $i--)
{
    echo $lines[$i];
    if ($i !== 0)
        echo PHP_EOL;
}

<?php
error_reporting("off");
//118B: Present from Lena
$n = trim(fgets(STDIN)); //$n = 3;
$rows = array();
for ($i = 0; $i <= $n; $i++) {
    $um = $n - $i;
    $numpadding = $um * 2;
    $padding = "";
    for ($er = 0; $er < $numpadding; $er++) {
        $padding .= " ";
    }
    echo $padding;
    $rows[$i] .= $padding;
    for ($j = 0; $j <= $i; $j++) {
        $rows[$i] .= $j." ";
    }
    for ($k = $i - 1; $k >= 0; $k--) {
        $rows[$i] .= $k." ";
    }
    $rows[$i] = substr($rows[$i], 0, -1);
}
for ($j = $n - 1; $j >= 0; $j--) {
    $rows[] = $rows[$j];
}
foreach ($rows as $value) {
    echo $value."\n";
}
?>

<?php
error_reporting("off");
//118B: Present from Lena
$n = trim(fgets(STDIN)); //$n = 3;
$rows = array();
for ($i = 0; $i <= $n; $i++) {
    $um = $n - $i;
    $numpadding = $um * 2;
    $padding = "";
    for ($er = 0; $er < $numpadding; $er++) {
        $padding .= " ";
    }
    echo $padding;
    $rows[$i] .= $padding;
    for ($j = 0; $j <= $i; $j++) {
        $rows[$i] .= $j." ";
    }
    for ($k = $i - 1; $k >= 0; $k--) {
        $rows[$i] .= $k." ";
    }
    $rows[$i] .= substr($padding, 1);
}
for ($j = $n - 1; $j >= 0; $j--) {
    $rows[] = $rows[$j];
}
foreach ($rows as $value) {
    echo $value."\n";
}
?>


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
list($c, $d) = explode(" ", trim(fgets(STDIN)));
$e = array_slice($b, $c - 1);
$f = array_slice($e, 0, $d - 1 - ($c - 1));
$g = array_sum($f);
print $g;
?>

<?php
    $fp = fopen('php://stdin', 'r');
    $n = rtrim(fgets($fp));
    $years = explode(' ', rtrim(fgets($fp)));
    list($from, $to) = explode(' ', rtrim(fgets($fp)));
    $cnt = 0;
    for($i = $from; $i < $to; $i++) {
        $cnt += $years[$i-1];
    }
    echo $cnt;
?>

<?php
    //$handle = @fopen("input.txt", "r");
    $n = trim(fgets(STDIN));
    $t = explode(' ', trim(fgets(STDIN)));

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

    $res = 0;
    for ($i = $a - 1; $i < $b - 1; $i++) {
        $res += $t[$i];
    }
    echo "{$res}\n";

<?php
$file=STDIN;
$n=fgets($file);
$a=explode(" ",fgets($file));
list($st,$fn)=fscanf($file,"%d %d");
--$st;--$fn;
$ans=0;
for($i=$st;$i<$fn;++$i)
    $ans+=$a[$i];
printf("%d\n",$ans);
?>

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

    $n = fgets($stdin);
    $weights = explode(" ", preg_replace("/\s+/", " ", fgets($stdin)));
    $wants = explode(" ", preg_replace("/\s+/", " ", fgets($stdin)));

    $verdict = 0;
    for($i=$wants[0];$i<$wants[1];++$i){
        $verdict+=$weights[$i-1];
    }

    fputs($stdout, $verdict);
?>

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

for ($i = $a; $i < $b; $i++)
{
    $k += $mas[$i - 1];
}
echo $k;
?>

<?php

fscanf(STDIN, "%d\n", $ranks);
$years = trim(fgets(STDIN));
$position = trim(fgets(STDIN));

$years = explode(' ', $years);
$position = explode(' ', $position);
$sum = 0;

for ($i = $position[0] - 1; $i < $position[1] - 1; $i++) {
    $sum = $years[$i] + $sum;
}

echo $sum;

?>

<?php
$stdout = fopen('php://stdout', 'w');
//fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$n =(int)trim(fgets($h));
$s = trim(fgets($h));
$s1 = trim(fgets($h));
$len = strlen($s);
$len1 = strlen($s1);
if ($n>=2 && $n<=100)
    {
        $f=true;
for ($i=1; $i<=$n-2; $i++)
{
    $r=stripos($s,' ');
    $mas[$i]=substr($s, 0, $r);
    if (($mas[$i]<1) || ($mas[$i]>100))
    {$f=false;}
    $s=substr($s, $r+1, $len-$r-1);
    }
    $mas[$n-1]=$s;
    if (($mas[$n-1]<1) || ($mas[$n-1]>100))
    {$f=false;}
$r=stripos($s1,' ');
$a=substr($s1, 0, $r);
$b=substr($s1, $r+1, $len1-$r-1);
if (($a<1)||($b<=$a)||($b>$n)){$f=false;}
    if ($f)
    {

    $count=0;
    for ($i=$a; $i<=$b-1; $i++)
    {
        $count=$count+$mas[$i];
        }
fputs(STDOUT, "$count");
    }
    /*else
    {fputs(STDOUT, "Nevernii diapozon");}*/
    }
/*else
    {fputs(STDOUT, "Число должно быть из диапозона 2<=n<=100");}*/
?>

<?php
fscanf(STDIN, "%d", $n);
$items = explode(" ",trim(fgets(STDIN)));
fscanf(STDIN, "%d %d", $a, $b);

for ($i=$a;$i<$b;$i++)
  $cnt += $items[$i-1];

echo $cnt;
?>

<?php
$n=fgets(STDIN);
$arr=array();
$arr=explode(' ',trim(fgets(STDIN)));
$arr2=explode(' ',trim(fgets(STDIN)));
$count=0;
for($i=$arr2[0];$i<$arr2[1];$i++){
    $count+=$arr[$i-1];
}
printf ('%.0f',$count);
?>

<?php

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

$r = 0;
for($i=$a;$i<$b;$i++) $r+=$d[$i-1];

print $r;
?>

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

<?php
$file=fopen("input.txt","r");//STDIN;
$n=fgets($file);
$a=explode(" ",fgets($file));
list($st,$fn)=fscanf($file,"%d %d");
--$st;--$fn;
$ans=0;
for($i=$st;$i<$fn;++$i)
    $ans+=$a[$i];
printf("%d\n",$ans);
?>

<?php

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

    $n = fgets($stdin);
    $weights = explode(" ", fgets($stdin));
    $wants = explode(" ", fgets($stdin));

    $verdict = 0;
    for($i=$wants[0];$i<$wants[1];++$i){
        $verdict+=$weights[$i-1];
    }

    fputs($stdout, $verdict);
?>

<?php
$stdout = fopen('php://stdout', 'w');
fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$n = trim(fgets($h));
$s = trim(fgets($h));
$s1 = trim(fgets($h));
$len = strlen($s);
$len1 = strlen($s1);
if ($n>=2 && $n<=100)
	{
		$f=true;
for ($i=1; $i<=$n-2; $i++)
{
	$r=stripos($s,' ');
	$mas[$i]=substr($s, 0, $r);
	if (($mas[$i]<1) || ($mas[$i]>100))
	{$f=false;}
	$s=substr($s, $r+1, $len-$r-1);
	}
	$mas[$n-1]=$s;
	if (($mas[$n-1]<1) || ($mas[$n-1]>100))
	{$f=false;}
	if ($f)
	{
$r=stripos($s1,' ');
$a=substr($s1, 0, $r);
$b=substr($s1, $r+1, $len1-$r-1);
fputs(STDOUT, "Vihodnie dannie:  ");
	$count=0;
	for ($i=$a; $i<=$b-1; $i++)
	{
		$count=$count+$mas[$i];
		}
fputs(STDOUT, "$count");
	}
	else
	{fputs(STDOUT, "Nevernii diapozon");}
	}
else
	{fputs(STDOUT, "����� ������ ���� �� ��������� 2<=n<=100");}
?>


<?php
fscanf(STDIN, "%d", $n);
$a = array_map("intval", explode(' ', fgets(STDIN)));
$s = array_sum($a);
$pref = 0;
$ans = 0;
for ($i = 0; $i < $n - 1; $i++) {
	$pref += $a[$i];
	if ($pref * 2 == $s)
		$ans++;
}
print($ans."\n");
?>


<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d %d", $n, $k);
$a = explode(" ", trim(fgets(STDIN)));

arsort($a);
// var_dump($a);

$cnt = 0;
foreach ($a as $key => $val) {
	$cnt++;
	$score += $val;
	$pos[] = $key;
	if ($cnt == $k) {
		break;
	}

}
// echo "pos:";
sort($pos);
// var_dump($pos);
$s[0] = -1;
for ($i = 0; $i < $k - 1; $i++) {
	$s[$i + 1] = $pos[$i];
}
$s[$k] = $n - 1;
for ($i = 0; $i < $k; $i++) {
	$ans[] = $s[$i + 1] - $s[$i];
}
// var_dump($s);
echo $score . PHP_EOL;
echo implode(" ", $ans);


<?php
    function check($c){
        $arr = ['a','e','i','o','u'];
        foreach ($arr as $a) {
            if ($c == $a) return 1;
        }
        return 0;
    }

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

    if (strlen($s) != strlen($t)){
        echo 'No';
        return;
    }

    for($i = 0; $i < strlen($s); $i++){
        if (check($s[$i]) != check($t[$i])) {
            echo 'No';
            return;
        }
    }

    echo 'Yes';

<?php

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

$a1111 = new A1111($s, $t);
echo $a1111->handle();

class A1111{

    private $s;
    private $t;

    public function __construct($s, $t){
        $this->s = $s;
        $this->t = $t;
    }

    public function handle(){
        if($this->isLengthDifferent()){
            return "No";
        }

        for($i = 0; $i < strlen($this->s); $i++){
            if($this->isVowel($this->s[$i]) && $this->isConsonent($this->t[$i])){
                return 'No';
            }
            if($this->isConsonent($this->s[$i]) && $this->isVowel($this->t[$i])){
                return 'No';
            }
        }

        return 'Yes';
    }

    private function isLengthDifferent(){
        return strlen($this->s) !== strlen($this->t);
    }

    private function isVowel($c){
        return in_array($c, ['a', 'e', 'i', 'o', 'u']);
    }

    private function isConsonent($c){
        return ! $this->isVowel($c);
    }
}

<?php
	static $va = array('a', 'e', 'i', 'o', 'u');
	//$va = "aeiou";
	fscanf(STDIN, "%s", $s);
	fscanf(STDIN, "%s", $t);
	if(strlen($s)!=strlen($t)) {
		echo 'No';
		exit(0);
	}
	$l = strlen($s);
	for($i=0;$i<$l;$i++) {
		if(in_array($s[$i], $va) && in_array($t[$i], $va)) continue;
		if(!in_array($s[$i], $va) && !in_array($t[$i], $va)) continue;
		echo 'No';
		exit(0);
	}
	echo 'Yes';
?>

<?php

class Main
{
    protected const VOWELS = [
        'a', 'e', 'i', 'o', 'u',
    ];

    public function run(string $stdin): string
    {
        [$s, $t] = array_map('trim', explode("\n", trim($stdin)));
        $length = strlen($s);

        if ($length !== strlen($t)) {
            return 'No';
        }

        for ($i = 0; $i < $length; $i++) {
            if (!self::charCompare($s[$i], $t[$i])) {
                return 'No';
            }
        }

        return 'Yes';
    }

    protected static function charCompare(string $a, string $b): bool
    {
        return in_array($a, self::VOWELS, true) === in_array($b, self::VOWELS, true);
    }
}

echo (new Main)->run(file_get_contents('php://stdin'));

<?
$stdin = fopen('php://stdin', 'r');
ini_set('display_errors', '1');
function read() {
    return trim(fgets(STDIN));
}
$t1 = microtime(true);
$debag = 0;
/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
$str1 = str_split(read());
$str2 = str_split(read());
$gl = ['a', 'e', 'i', 'o', 'u'];
$arr1 = [];
$arr2 = [];

$l1 = count($str1);
$l2 = count($str2);
if ($l1 === $l2) {
    for ($i = 0; $i < $l2; $i++) {
        if (in_array($str1[$i], $gl)) {
            $arr1[] = 0;
        } else {
            $arr1[] = 1;
        }

        if (in_array($str2[$i], $gl)) {
            $arr2[] = 0;
        } else {
            $arr2[] = 1;
        }

    }
    if ($arr1 === $arr2) {
       echo 'Yes';
    } else {
        echo 'No';
    }

} else {
    echo 'No';
}

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
if ($debag === 1) {
    echo '<hr>' . round(microtime(true) - $t1, 3) . ' sec';
}

<?php
fscanf(STDIN,"%s",$s);
$lenS=strlen($s);
fscanf(STDIN,"%s",$t);
$lenT=strlen($t);
$decision=false;
if($lenS==$lenT)
{
	$vowel="aeiou";
	$count=0;
	for ($i=0; $i <$lenS; $i++)
	 {
		if((substr_count($vowel,$s[$i])==1&&substr_count($vowel,$t[$i])==1)||(substr_count($vowel,$s[$i])!=1&&substr_count($vowel,$t[$i])!=1))
			$count++;
		if($count==$lenS)
			$decision=true;
	 }
}
echo $decision?"YES":"NO";

<?php

function check($c)
{
if($c=='a' || $c=='e' || $c=='i' || $c=='o' || $c=='u')
return 1;
else
return 0;
}

$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
$A=strlen($a);
$B=strlen($b);
if($A!=$B)
echo "No";
else
{
for($i=0;$i<$A;$i++)
{
if(check($a[$i])!=check($b[$i]))
{
echo "No";
return;
}
}
echo "Yes";
}
?>

<?php

$a = trim(fgets(STDIN)); //"ua";
$b = trim(fgets(STDIN)); //"akm";

if(strlen($a) != strlen($b)) {
    echo "No";
    die;
}

$vowels = [ 'a', 'e', 'i', 'o' , 'u' ];

for($i = 0; $i < strlen($a); $i++) {
    if( in_array($a[$i], $vowels) && in_array($b[$i], $vowels)) {
        continue;
    }

    if(!in_array($a[$i], $vowels) && !in_array($b[$i], $vowels)) {
        continue;
    }

    echo "No";
    die;
}

echo "Yes";

<?php

// run on php 7.2.13

function println($s)
{
    print $s . PHP_EOL;
}

function main()
{
    $s = trim(fgets(STDIN));
    $t = trim(fgets(STDIN));

    $ans = solve($s, $t);
    println($ans);
}

function solve(string $s, string $t)
{
    // http://php.net/manual/ja/function.preg-replace.php

    $c = '/[^aeiou]/';
    $v = '/[aeiou]/';
    $normalizedS = preg_replace($v, 'V', preg_replace($c, 'C', $s));
    $normalizedT = preg_replace($v, 'V', preg_replace($c, 'C', $t));
    if ($normalizedS === $normalizedT) {
        return 'Yes';
    } else {
        return 'No';
    }
}

main();

<?php

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

$a1111 = new A1111($s, $t);
echo $a1111->handle();

class A1111{

    private $s;
    private $t;

    public function __construct($s, $t){
        $this->s = $s;
        $this->t = $t;
    }

    public function handle(){
        if($this->isLengthDifferent()){
            return "No";
        }

        for($i = 0; $i < strlen($this->s); $i++){
            if($this->isVowel($this->s[$i]) && $this->isConsonent($this->t[$i])){
                return 'No';
            }
            if($this->isConsonent($this->s[$i]) && $this->isVowel($this->t[$i])){
                return 'No';
            }

            return 'Yes';
        }
    }

    private function isLengthDifferent(){
        return strlen($this->s) !== strlen($this->t);
    }

    private function isVowel($c){
        return in_array($c, ['a', 'e', 'i', 'o', 'u']);
    }

    private function isConsonent($c){
        return ! $this->isVowel($c);
    }
}

<?php
	static $va = array('a', 'e', 'i', 'o', 'u');
	//$va = "aeiou";
	fscanf(STDIN, "%s", $s);
	fscanf(STDIN, "%s", $t);
	$l = min(strlen($s), strlen($t));
	for($i=0;$i<$l;$i++) {
		if(in_array($s[$i], $va) && in_array($t[$i], $va)) continue;
		if(!in_array($s[$i], $va) && !in_array($t[$i], $va)) continue;
		echo 'No';
		exit(0);
	}
	echo 'Yes';
?>

<?php
    function check($c){
        $arr = ['a','e','i','o','u'];
        foreach ($arr as $a) {
            if ($c == $a) return 1;
        }
        return 0;
    }

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

    if (strlen($s) != strlen($t)){
        echo 'No';
        return;
    }

    for($i = 0; $i < strlen($s); $i++){
        if (check($s[$i]) != check($s[$i])) {
            echo 'No';
            return;
        }
    }

    echo 'Yes';

<?php

class main
{
    protected const VOWELS = [
        'a', 'e', 'i', 'o', 'u',
    ];

    public function run(string $stdin)
    {
        var_dump($stdin);die();
        [$s, $t] = explode("\n", trim($stdin));
        $length = strlen($s);

        if ($length !== strlen($t)) {
            return 'No';
        }

        for ($i = 0; $i < $length; $i++) {
            if (!$this->charCompare($s[$i], $t[$i])) {
                return 'No';
            }
        }

        return 'Yes';
    }

    public function charCompare(string $a, string $b): bool
    {
        return in_array($a, self::VOWELS, true) === in_array($b, self::VOWELS, true);
    }
}

echo (new main)->run(file_get_contents('php://stdin'));

<?php

class main
{
    protected $vowels = [
        'a', 'e', 'i', 'o', 'u',
    ];

    public function run(string $stdin)
    {
        [$s, $t] = explode("\n", trim($stdin));
        $length = strlen($s);

        if ($length !== strlen($t)) {
            return 'No';
        }

        for ($i = 0; $i < $length; $i++) {
            if (!$this->charCompare($s[$i], $t[$i])) {
                return 'No';
            }
        }

        return 'Yes';
    }

    public function charCompare(string $a, string $b): bool
    {
        return in_array($a, $this->vowels, true) === in_array($b, $this->vowels, true);
    }
}

echo (new main)->run(file_get_contents('php://stdin'));

<?php

function check($c)
{
if($c=='a' || $c=='e' || $c=='i' || $c=='o' || $c=='u')
return 1;
else
return 0;
}

$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
$A=strlen($a);
$B=strlen($b);
if($A!=$B)
echo "No";
else
{
for($i=0;$i<$A;$i++)
{
if(check(a[$i])!=check(b[$i]))
{
echo "No";
return;
}
}
echo "Yes";
}
?>

<?php

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

$msl = min(strlen($a), strlen($b));
$vowels = [ 'a', 'e', 'i', 'o' , 'u' ];

for($i = 0; $i < $msl; $i++) {
    if( in_array($a[$i], $vowels) && in_array($b[$i], $vowels)) {
        continue;
    }

    if(!in_array($a[$i], $vowels) && !in_array($b[$i], $vowels)) {
        continue;
    }

    echo "No";
    die;
}

echo "Yes";


<?php
    define ("TEST", false);
    if (TEST) $GLOBALS['file'] = fopen('input.txt', 'r');
    else $GLOBALS['file'] = fopen('php://stdin', 'r');
    function debug($var){echo '<pre>'; print_r($var); echo '</pre>';}
    function read_str(){return trim(fgets($GLOBALS['file']));}
    function read_array(){return explode(' ', read_str());}
    /***************************************************************/
    list($n, $m) = read_array();
    $timer = 0;
    $result=array();
    $start = microtime(true);

    $students = array();
    for ($i=1; $i<=$n; $i++)
    {
        $student = array();
        list($student['time'], $student['loc']) = read_array();
        $student['i'] = $i;
        $students[] = $student;
    }

    $chunks = array_chunk($students, $m);

    function sf($a,$b)
    {
        if ($a['loc'] < $b['loc']) return -1;
        if ($a['loc'] > $b['loc']) return 1;
        return 0;
    }

    foreach($chunks as $chunk)
    {
        $last_time = end($chunk); $last_time = $last_time['time'];if ($last_time > $timer) $timer += $last_time - $timer;
        //uasort($chunk, 'sf');

        $locs = array();
        foreach($chunk as $st)
        {
            $l = $st['loc'];
            $locs[$l][] = $st['i'];
        }
        ksort($locs);

        $prev_loc = 0;
        foreach($locs as $loc=>$sts)
        {
            $count = count($sts);
            $timer += $loc - $prev_loc;
            $prev_loc = $loc;
            foreach($sts as $i) $result[$i] = $timer;

            $timer += 1 + floor($count/2);
        }
        $timer += $loc;
    }

    for($i=1; $i<=$n; $i++) echo $result[$i].' ';

<?php
error_reporting(0);

$fp = fopen('php://stdin','r');
list($n, $m) = explode( " ",trim( str_replace( "\r\n", '', fgets($fp) ) ) );

$time = 0;
$taxi = array();
$exit = array();
$seatBusy = 0;
$i = 1;
while( $n-- ){
	list($t, $x) = explode( " ",trim( str_replace( "\r\n", '', fgets($fp) ) ) );
	if( $time < $t )
	{
		$time = $t;
	}
	$seatBusy++;
	$taxi[$x][] = $i;
	if( $seatBusy == $m || $n == 0 )
	{
		ksort($taxi);
		$extTime = 0;
		foreach($taxi as $key => $val)
		{
			$countEl = count($val);
			foreach($val as $v)
			{
				$exit[$v] = $key + $time + $extTime;
			}
			$extTime += floor(1 + $countEl / 2);
		}
		$time += $extTime + $key * 2;
		$seatBusy = 0;
		$taxi = array();
	}
	$i++;
}
ksort($exit);
echo implode(' ', $exit);
fclose($fp);
?>