p_id
stringlengths
6
6
language
stringclasses
10 values
status
stringclasses
2 values
code
stringlengths
1
563k
prompt
stringlengths
113
563k
answer
stringclasses
2 values
p02718
PHP
Accepted
<?php // $n = (int)trim(fgets(STDIN)); $input = explode(' ', trim(fgets(STDIN))); $n = (int)$input[0]; $m = (int)$input[1]; $input = explode(' ', trim(fgets(STDIN))); $sum = 0; $a_list =[]; foreach ($input as $v) { $a_list[] = (int)$v; $sum += (int)$v; } $limit = $sum / (4 * $m); rsort($a_list); if ($a_list[$m-1] < $limit) { echo 'No'; }else { echo 'Yes'; }
Here is a piece of code written in PHP: <?php // $n = (int)trim(fgets(STDIN)); $input = explode(' ', trim(fgets(STDIN))); $n = (int)$input[0]; $m = (int)$input[1]; $input = explode(' ', trim(fgets(STDIN))); $sum = 0; $a_list =[]; foreach ($input as $v) { $a_list[] = (int)$v; $sum += (int)$v; } $limit = $sum / (4 * $m); rsort($a_list); if ($a_list[$m-1] < $limit) { echo 'No'; }else { echo 'Yes'; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03136
PHP
Accepted
<?php $a = trim(fgets(STDIN)); $N = explode(" ",trim(fgets(STDIN))); sort($N); $ans = 0; foreach($N as $value){ $ans += $value; } $ans -= $N[$a-1]; if ($ans> $N[$a-1]){ echo "Yes"; }else{ echo "No"; }
Here is a piece of code written in PHP: <?php $a = trim(fgets(STDIN)); $N = explode(" ",trim(fgets(STDIN))); sort($N); $ans = 0; foreach($N as $value){ $ans += $value; } $ans -= $N[$a-1]; if ($ans> $N[$a-1]){ echo "Yes"; }else{ echo "No"; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02627
PHP
Accepted
<?php $a = str_split(trim(fgets(STDIN))); if (ctype_upper($a[0])) { echo 'A'; } else { echo 'a'; }
Here is a piece of code written in PHP: <?php $a = str_split(trim(fgets(STDIN))); if (ctype_upper($a[0])) { echo 'A'; } else { echo 'a'; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02570
PHP
Accepted
<?php // Your code here! $s = explode(' ',fgets(STDIN)); if($s[0] / $s[2] <= $s[1]){ echo 'Yes'; } else { echo 'No'; } ?>
Here is a piece of code written in PHP: <?php // Your code here! $s = explode(' ',fgets(STDIN)); if($s[0] / $s[2] <= $s[1]){ echo 'Yes'; } else { echo 'No'; } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03470
PHP
Accepted
<?php fscanf(STDIN, '%d', $n); //if ($n === 1) { // echo 1 . PHP_EOL; // return; //} $d = []; for ($i = 1;$i <=$n;$i++) { $d[trim(fgets(STDIN))] = 0; } //arsort($d); echo count($d).PHP_EOL; //$cnt = 1; //$now = $d[0]; // //for ($i = 0; $i < $n; $i++) { // if ($now > $d[$i]) { // $cnt++; // } // $now = $d[$i]; // //} // //echo $cnt.PHP_EOL;
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%d', $n); //if ($n === 1) { // echo 1 . PHP_EOL; // return; //} $d = []; for ($i = 1;$i <=$n;$i++) { $d[trim(fgets(STDIN))] = 0; } //arsort($d); echo count($d).PHP_EOL; //$cnt = 1; //$now = $d[0]; // //for ($i = 0; $i < $n; $i++) { // if ($now > $d[$i]) { // $cnt++; // } // $now = $d[$i]; // //} // //echo $cnt.PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03239
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $n, $t); $c_arr = []; $t_arr = []; for ($i = 0; $i < $n; ++$i) { $inputs = explode(' ', trim(fgets(STDIN))); $c_arr[] = $inputs[0]; $t_arr[] = $inputs[1]; } $min = 1001; $exists = false; for ($i = 0; $i < $n; ++$i) { if ($t_arr[$i] <= $t) { if ($c_arr[$i] < $min) { $min = $c_arr[$i]; $exists = true; } } } echo $exists ? $min : 'TLE';
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $n, $t); $c_arr = []; $t_arr = []; for ($i = 0; $i < $n; ++$i) { $inputs = explode(' ', trim(fgets(STDIN))); $c_arr[] = $inputs[0]; $t_arr[] = $inputs[1]; } $min = 1001; $exists = false; for ($i = 0; $i < $n; ++$i) { if ($t_arr[$i] <= $t) { if ($c_arr[$i] < $min) { $min = $c_arr[$i]; $exists = true; } } } echo $exists ? $min : 'TLE'; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03486
PHP
Accepted
<?php $s = rtrim(fgets(STDIN)); $t = rtrim(fgets(STDIN)); for($i=0; $i<strlen($s); $i++) { $spart[$i] = $s[$i]; } for($i=0; $i<strlen($t); $i++) { $tpart[$i] = $t[$i]; } sort($spart); rsort($tpart); $stop = ""; $tbottom = ""; for($i=0; $i<strlen($s); $i++) { $stop .= $spart[$i]; } for($i=0; $i<strlen($t); $i++) { $tbottom .= $tpart[$i]; } $beforeArray = array($stop, $tbottom); $afterArray = array($stop, $tbottom); sort($afterArray); if($s==$t) { echo("No"); } elseif($beforeArray[0] == $afterArray[0]) { echo("Yes"); } else { echo("No"); }
Here is a piece of code written in PHP: <?php $s = rtrim(fgets(STDIN)); $t = rtrim(fgets(STDIN)); for($i=0; $i<strlen($s); $i++) { $spart[$i] = $s[$i]; } for($i=0; $i<strlen($t); $i++) { $tpart[$i] = $t[$i]; } sort($spart); rsort($tpart); $stop = ""; $tbottom = ""; for($i=0; $i<strlen($s); $i++) { $stop .= $spart[$i]; } for($i=0; $i<strlen($t); $i++) { $tbottom .= $tpart[$i]; } $beforeArray = array($stop, $tbottom); $afterArray = array($stop, $tbottom); sort($afterArray); if($s==$t) { echo("No"); } elseif($beforeArray[0] == $afterArray[0]) { echo("Yes"); } else { echo("No"); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03102
PHP
Accepted
<?php fscanf(STDIN, "%d %d %d", $N, $M, $C); $b = explode(" ", trim(fgets(STDIN))); $result=0; for ($i=0; $i < $N; $i++) { $sum=0; $input = explode(" ", trim(fgets(STDIN))); for ($j=0; $j < $M; $j++) { $sum += $input[$j] * $b[$j]; } if ($sum+$C>0) { $result++; } } echo $result;
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d %d", $N, $M, $C); $b = explode(" ", trim(fgets(STDIN))); $result=0; for ($i=0; $i < $N; $i++) { $sum=0; $input = explode(" ", trim(fgets(STDIN))); for ($j=0; $j < $M; $j++) { $sum += $input[$j] * $b[$j]; } if ($sum+$C>0) { $result++; } } echo $result; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03161
PHP
Accepted
<?php fscanf(STDIN,"%d %d",$n,$k); $h = explode(' ',trim(fgets(STDIN))) ; $dp[0] = 0 ; for($i=1;$i<$n;++$i){ $dp[$i] = 1000000000 ; } for($i=1;$i<$n;++$i){ $list=[$dp[$i]]; for($j=1;$j<=$i&&$j<$k+1;++$j){ $list[] = $dp[$i-$j]+abs($h[$i]-$h[$i-$j]) ; //var_dump($list); } $dp[$i] = min($list) ; //var_dump($dp) ; } echo $dp[$n-1] ;
Here is a piece of code written in PHP: <?php fscanf(STDIN,"%d %d",$n,$k); $h = explode(' ',trim(fgets(STDIN))) ; $dp[0] = 0 ; for($i=1;$i<$n;++$i){ $dp[$i] = 1000000000 ; } for($i=1;$i<$n;++$i){ $list=[$dp[$i]]; for($j=1;$j<=$i&&$j<$k+1;++$j){ $list[] = $dp[$i-$j]+abs($h[$i]-$h[$i-$j]) ; //var_dump($list); } $dp[$i] = min($list) ; //var_dump($dp) ; } echo $dp[$n-1] ; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03563
PHP
Accepted
<?php error_reporting(0); $R = trim(fgets(STDIN)); $G = trim(fgets(STDIN)); //$A = explode(" ",trim(fgets(STDIN))); //list($N,$M) = explode(" ",trim(fgets(STDIN))); printf("%d\n",$G+($G-$R));
Here is a piece of code written in PHP: <?php error_reporting(0); $R = trim(fgets(STDIN)); $G = trim(fgets(STDIN)); //$A = explode(" ",trim(fgets(STDIN))); //list($N,$M) = explode(" ",trim(fgets(STDIN))); printf("%d\n",$G+($G-$R)); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02972
PHP
Accepted
<?php $n=trim(fgets(STDIN)); $a=explode(" ",trim(fgets(STDIN))); $m=0; $i=$n-1; while($i>=0){ if($a[$i]%2==1){ ++$m; $ans[]=$i+1; $p=floor(sqrt($i+1)); $j=1; while($j<=$p){ if(($i+1)%$j==0){ ++$a[$j-1]; ++$a[(($i+1)/$j)-1]; } ++$j; } if($p*$p==$i+1){ ++$a[$p-1]; } } --$i; } echo $m. PHP_EOL; if($m!=0){ echo join(" ",$ans); }
Here is a piece of code written in PHP: <?php $n=trim(fgets(STDIN)); $a=explode(" ",trim(fgets(STDIN))); $m=0; $i=$n-1; while($i>=0){ if($a[$i]%2==1){ ++$m; $ans[]=$i+1; $p=floor(sqrt($i+1)); $j=1; while($j<=$p){ if(($i+1)%$j==0){ ++$a[$j-1]; ++$a[(($i+1)/$j)-1]; } ++$j; } if($p*$p==$i+1){ ++$a[$p-1]; } } --$i; } echo $m. PHP_EOL; if($m!=0){ echo join(" ",$ans); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02847
PHP
Accepted
<?php $n = trim(fgets(STDIN)); $week = [ 'SUN' => 7, 'MON' => 6, 'TUE' => 5, 'WED' => 4, 'THU' => 3, 'FRI' => 2, 'SAT' => 1 ]; echo $week[$n] . "\n";
Here is a piece of code written in PHP: <?php $n = trim(fgets(STDIN)); $week = [ 'SUN' => 7, 'MON' => 6, 'TUE' => 5, 'WED' => 4, 'THU' => 3, 'FRI' => 2, 'SAT' => 1 ]; echo $week[$n] . "\n"; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02401
PHP
Accepted
<?php while (($line = trim(fgets(STDIN)))) { sscanf($line, '%d %s %d', $a, $op, $b); switch ($op) { case '+': $result = $a + $b; break; case '-': $result = $a - $b; break; case '*': $result = $a * $b; break; case '/': $result = $a / $b; break; default: break 2; } echo (int)$result, PHP_EOL; }
Here is a piece of code written in PHP: <?php while (($line = trim(fgets(STDIN)))) { sscanf($line, '%d %s %d', $a, $op, $b); switch ($op) { case '+': $result = $a + $b; break; case '-': $result = $a - $b; break; case '*': $result = $a * $b; break; case '/': $result = $a / $b; break; default: break 2; } echo (int)$result, PHP_EOL; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03316
PHP
Accepted
<?php fscanf(STDIN, "%d", $N); $array = str_split(strval($N)); $sum = array_sum($array); echo $N % $sum == 0 ? "Yes" . "\n" : "No" . "\n";
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d", $N); $array = str_split(strval($N)); $sum = array_sum($array); echo $N % $sum == 0 ? "Yes" . "\n" : "No" . "\n"; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03501
PHP
Accepted
<?php fscanf(STDIN,"%d%d%d",$t,$a,$b); echo min($t*$a,$b);
Here is a piece of code written in PHP: <?php fscanf(STDIN,"%d%d%d",$t,$a,$b); echo min($t*$a,$b); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02262
PHP
Accepted
<?php fscanf(STDIN, '%d', $N); $nums = array(); for ($i = 0; $i < $N; $i++) { fscanf(STDIN, '%d', $n); $nums[] = $n; } list($m, $G, $cnt, $nums) = shellSort($nums, $N); echo "$m\n"; echo join(' ', $G)."\n"; echo "$cnt\n"; foreach ($nums as $num) { echo "$num\n"; } function insertionSort($A, $n, $g, &$cnt) { for ($i = $g; $i < $n; $i++) { $val = $A[$i]; $j = $i - $g; while ($j >= 0 && $A[$j] > $val) { $A[$j+$g] = $A[$j]; $j -= $g; $cnt++; } $A[$j+$g] = $val; } return $A; } function shellSort($A, $n) { // h_{i+1} = 3 h_{i} + 1 ( 1 <= $h <= $n ) $G = array(); for ($h = 1; $h <= $n; $h = 3*$h+1) { $G[] = $h; } $G = array_reverse($G); $cnt = 0; foreach ($G as $g) { $A = insertionSort($A, $n, $g, $cnt); } return array(count($G), $G, $cnt, $A); }
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%d', $N); $nums = array(); for ($i = 0; $i < $N; $i++) { fscanf(STDIN, '%d', $n); $nums[] = $n; } list($m, $G, $cnt, $nums) = shellSort($nums, $N); echo "$m\n"; echo join(' ', $G)."\n"; echo "$cnt\n"; foreach ($nums as $num) { echo "$num\n"; } function insertionSort($A, $n, $g, &$cnt) { for ($i = $g; $i < $n; $i++) { $val = $A[$i]; $j = $i - $g; while ($j >= 0 && $A[$j] > $val) { $A[$j+$g] = $A[$j]; $j -= $g; $cnt++; } $A[$j+$g] = $val; } return $A; } function shellSort($A, $n) { // h_{i+1} = 3 h_{i} + 1 ( 1 <= $h <= $n ) $G = array(); for ($h = 1; $h <= $n; $h = 3*$h+1) { $G[] = $h; } $G = array_reverse($G); $cnt = 0; foreach ($G as $g) { $A = insertionSort($A, $n, $g, $cnt); } return array(count($G), $G, $cnt, $A); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03609
PHP
Accepted
<?php error_reporting(0); list($x,$t) = explode(" ",trim(fgets(STDIN))); printf("%d\n",max($x-$t,0));
Here is a piece of code written in PHP: <?php error_reporting(0); list($x,$t) = explode(" ",trim(fgets(STDIN))); printf("%d\n",max($x-$t,0)); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03338
PHP
Accepted
<?php $stdin = fopen('php://stdin', "r"); fscanf($stdin, "%d", $n); fscanf($stdin, "%s", $s); $result = 0; for ($i=1; $i<=$n; $i++) { // 前半の文字をkeyにする $before = substr($s, 0, $i); $beforeArr = []; for ($j=0; $j<$i; $j++) { $beforeArr[$before[$j]] = $before[$j]; } // 後半の文字をkeyにする $after = substr($s, $i, $n-$i); $afterArr = []; for ($j=0; $j<$n-$i; $j++) { $afterArr[$after[$j]] = $after[$j]; } // 両方に含まれる文字の数を数える $count = 0; foreach ($beforeArr as $moji) { if (isset($afterArr[$moji])) { $count++; } } // 大きい方を保存 if ($result < $count) { $result = $count; } } echo $result.PHP_EOL;
Here is a piece of code written in PHP: <?php $stdin = fopen('php://stdin', "r"); fscanf($stdin, "%d", $n); fscanf($stdin, "%s", $s); $result = 0; for ($i=1; $i<=$n; $i++) { // 前半の文字をkeyにする $before = substr($s, 0, $i); $beforeArr = []; for ($j=0; $j<$i; $j++) { $beforeArr[$before[$j]] = $before[$j]; } // 後半の文字をkeyにする $after = substr($s, $i, $n-$i); $afterArr = []; for ($j=0; $j<$n-$i; $j++) { $afterArr[$after[$j]] = $after[$j]; } // 両方に含まれる文字の数を数える $count = 0; foreach ($beforeArr as $moji) { if (isset($afterArr[$moji])) { $count++; } } // 大きい方を保存 if ($result < $count) { $result = $count; } } echo $result.PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02768
PHP
Accepted
<?php define('MOD', 10**9+7); //error_reporting(0); //$N = trim(fgets(STDIN)); list($n,$a,$b) = explode(" ",trim(fgets(STDIN))); //$X = array_map('intval',explode(" ",trim(fgets(STDIN)))); //function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;} //function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;} // $t = powerm(2,$n)-1; $nca = nCm($n,$a); $ncb = nCm($n,$b); printf("%d\n",subm(subm($t,$nca),$ncb)); //https://atcoder.jp/contests/abc145/submissions/8474723 define('MOD', 10**9+7); //足し算 function addm($a, $b){ return ($a + $b) % MOD; } //引き算 function subm($a, $b){ return ($a + MOD - $b) % MOD; } //掛け算 function mulm($a, $b){ return ($a * $b) % MOD; } //割り算 function divm($a, $b){ return mulm($a, powerm($b, MOD - 2)); } //累乗 function powerm($a, $b){ if($b == 0)return 1; if($b & 1)return (powerm($a, $b>>1)**2 % MOD) * $a % MOD; return powerm($a, $b>>1)**2 % MOD; } //階乗 function factorialm($a){ if($a == 0)return 1; return factorialm($a - 1) * $a % MOD; } //順列 function nPm($n, $m){ if($m == 0)return 1; return nPm($n, $m - 1) * ($n - $m + 1) % MOD; } //組み合わせ function nCm($n, $m){ $m = min($m, $n-$m); return divm(nPm($n, $m), factorialm($m)); }
Here is a piece of code written in PHP: <?php define('MOD', 10**9+7); //error_reporting(0); //$N = trim(fgets(STDIN)); list($n,$a,$b) = explode(" ",trim(fgets(STDIN))); //$X = array_map('intval',explode(" ",trim(fgets(STDIN)))); //function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;} //function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;} // $t = powerm(2,$n)-1; $nca = nCm($n,$a); $ncb = nCm($n,$b); printf("%d\n",subm(subm($t,$nca),$ncb)); //https://atcoder.jp/contests/abc145/submissions/8474723 define('MOD', 10**9+7); //足し算 function addm($a, $b){ return ($a + $b) % MOD; } //引き算 function subm($a, $b){ return ($a + MOD - $b) % MOD; } //掛け算 function mulm($a, $b){ return ($a * $b) % MOD; } //割り算 function divm($a, $b){ return mulm($a, powerm($b, MOD - 2)); } //累乗 function powerm($a, $b){ if($b == 0)return 1; if($b & 1)return (powerm($a, $b>>1)**2 % MOD) * $a % MOD; return powerm($a, $b>>1)**2 % MOD; } //階乗 function factorialm($a){ if($a == 0)return 1; return factorialm($a - 1) * $a % MOD; } //順列 function nPm($n, $m){ if($m == 0)return 1; return nPm($n, $m - 1) * ($n - $m + 1) % MOD; } //組み合わせ function nCm($n, $m){ $m = min($m, $n-$m); return divm(nPm($n, $m), factorialm($m)); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02717
PHP
Accepted
<?php $array = explode(" ", trim(fgets(STDIN))); echo $array[2] . " " . $array[0] . " " . $array[1] . "\n";
Here is a piece of code written in PHP: <?php $array = explode(" ", trim(fgets(STDIN))); echo $array[2] . " " . $array[0] . " " . $array[1] . "\n"; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03493
PHP
Accepted
<?php $s = str_split(fgets(STDIN)); $ans = 0; if($s[0] == "1")$ans++; if($s[1] == "1")$ans++; if($s[2] == "1")$ans++; echo $ans; ?>
Here is a piece of code written in PHP: <?php $s = str_split(fgets(STDIN)); $ans = 0; if($s[0] == "1")$ans++; if($s[1] == "1")$ans++; if($s[2] == "1")$ans++; echo $ans; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p00425
PHP
Accepted
<?php //??????????????\??? $up=1; $south=2; $east=3; $west=4; $north=5; $down=6; $ans=1; $tmp; $count=0; //?????§??§5??????????????????????????????????????? while($count<5){ //??????????????°?????????????????? $stdin=trim(fgets(STDIN)); //??????????????°???0??????break if($stdin==0){ break; } if($stdin<=10000){ //??????????????°??????????????? for($i=0;$i<$stdin;$i++){ $diceRoll=trim(fgets(STDIN)); //??????????????§?????????????????? switch($diceRoll){ case"North": $tmp=$up; $up=$south; $south=$down; $down=$north; $north=$tmp; break; case"South": $tmp=$up; $up=$north; $north=$down; $down=$south; $south=$tmp; break; case"West": $tmp=$up; $up=$east; $east=$down; $down=$west; $west=$tmp; break; case"East": $tmp=$up; $up=$west; $west=$down; $down=$east; $east=$tmp; break; case"Right": $tmp=$south; $south=$east; $east=$north; $north=$west; $west=$tmp; break; case"Left": $tmp=$south; $south=$west; $west=$north; $north=$east; $east=$tmp; break; default: } //??????????????°???????????? $ans+=$up; } //???????????? echo $ans."\n"; //????????? $up=1; $south=2; $east=3; $west=4; $north=5; $down=6; $ans=1; //????????????????????°???????????? $count++; } }
Here is a piece of code written in PHP: <?php //??????????????\??? $up=1; $south=2; $east=3; $west=4; $north=5; $down=6; $ans=1; $tmp; $count=0; //?????§??§5??????????????????????????????????????? while($count<5){ //??????????????°?????????????????? $stdin=trim(fgets(STDIN)); //??????????????°???0??????break if($stdin==0){ break; } if($stdin<=10000){ //??????????????°??????????????? for($i=0;$i<$stdin;$i++){ $diceRoll=trim(fgets(STDIN)); //??????????????§?????????????????? switch($diceRoll){ case"North": $tmp=$up; $up=$south; $south=$down; $down=$north; $north=$tmp; break; case"South": $tmp=$up; $up=$north; $north=$down; $down=$south; $south=$tmp; break; case"West": $tmp=$up; $up=$east; $east=$down; $down=$west; $west=$tmp; break; case"East": $tmp=$up; $up=$west; $west=$down; $down=$east; $east=$tmp; break; case"Right": $tmp=$south; $south=$east; $east=$north; $north=$west; $west=$tmp; break; case"Left": $tmp=$south; $south=$west; $west=$north; $north=$east; $east=$tmp; break; default: } //??????????????°???????????? $ans+=$up; } //???????????? echo $ans."\n"; //????????? $up=1; $south=2; $east=3; $west=4; $north=5; $down=6; $ans=1; //????????????????????°???????????? $count++; } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03860
PHP
Accepted
<?php fscanf(STDIN,'%s %s %s',$AtCoder,$s,$Contest); // echo $s; $s_top = substr($s,0,1); // echo $s_top; $AtCoder = "A"; $Contest = "C"; echo $AtCoder . $s_top . $Contest; ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN,'%s %s %s',$AtCoder,$s,$Contest); // echo $s; $s_top = substr($s,0,1); // echo $s_top; $AtCoder = "A"; $Contest = "C"; echo $AtCoder . $s_top . $Contest; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03778
PHP
Accepted
<?php fscanf(STDIN, "%d%d%d", $W, $a, $b); $length = $a-$b; $ans = abs($length) - $W; if(abs($length) <= $W){ echo 0; }else{ echo abs($ans); } ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d%d%d", $W, $a, $b); $length = $a-$b; $ans = abs($length) - $W; if(abs($length) <= $W){ echo 0; }else{ echo abs($ans); } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03672
PHP
Accepted
<?php class In { private $buf = []; private $count = 0; private $pointer = 0; public function nextLine() { $ret = ''; if($this->hasNext()){ while($this->hasNext()){ $ret .= $this->next(); } }else{ $ret = trim(fgets(STDIN)); } return $ret; } public function next() { if(!$this->hasNext()) { $str = trim(fgets(STDIN)); $this->buf = explode(' ',$str); $this->count = count($this->buf); $this->pointer = 0; } return $this->buf[$this->pointer++]; } public function hasNext() { return $this->pointer < $this->count; } public function nextInt() { return (int)$this->next(); } public function nextDouble() { return (double)$this->next(); } } class Out { public function println($str = '') { echo $str . PHP_EOL; } } $in = new In(); $out = new Out(); $S = $in->next(); $L = strlen($S); for ($i = floor($L/2)-1;$i >= 1;$i--) { $a = substr($S,0,$i); $b = substr($S,$i,$i); if (strcmp($a,$b) === 0) { $out->println($i*2); break; } } ?>
Here is a piece of code written in PHP: <?php class In { private $buf = []; private $count = 0; private $pointer = 0; public function nextLine() { $ret = ''; if($this->hasNext()){ while($this->hasNext()){ $ret .= $this->next(); } }else{ $ret = trim(fgets(STDIN)); } return $ret; } public function next() { if(!$this->hasNext()) { $str = trim(fgets(STDIN)); $this->buf = explode(' ',$str); $this->count = count($this->buf); $this->pointer = 0; } return $this->buf[$this->pointer++]; } public function hasNext() { return $this->pointer < $this->count; } public function nextInt() { return (int)$this->next(); } public function nextDouble() { return (double)$this->next(); } } class Out { public function println($str = '') { echo $str . PHP_EOL; } } $in = new In(); $out = new Out(); $S = $in->next(); $L = strlen($S); for ($i = floor($L/2)-1;$i >= 1;$i--) { $a = substr($S,0,$i); $b = substr($S,$i,$i); if (strcmp($a,$b) === 0) { $out->println($i*2); break; } } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03393
PHP
Accepted
<?php $stdins = []; while($line=fgets(STDIN)){ $stdins[] = trim($line); } for($index=0;$index<count($stdins);$index++){ if($index > 0) printf("\n"); $S = $stdins[$index]; $keys = []; $keys["a"] = false; $keys["b"] = false; $keys["c"] = false; $keys["d"] = false; $keys["e"] = false; $keys["f"] = false; $keys["g"] = false; $keys["h"] = false; $keys["i"] = false; $keys["j"] = false; $keys["k"] = false; $keys["l"] = false; $keys["m"] = false; $keys["n"] = false; $keys["o"] = false; $keys["p"] = false; $keys["q"] = false; $keys["r"] = false; $keys["s"] = false; $keys["t"] = false; $keys["u"] = false; $keys["v"] = false; $keys["w"] = false; $keys["x"] = false; $keys["y"] = false; $keys["z"] = false; $length = strlen($S); for($i=0;$i<$length;$i++) { $keys[$S[$i]] = true; } $found = false; foreach($keys as $key=>$value){ if(!$value){ $found = true; break; } } if($found){ print($S.$key); }else{ $found = false; for($i=strlen($S)-1;$i>=0;$i--){ $p = ord($S[$i]); for($j=$p+1;$j<=ord("z");$j++){ if(!$keys[chr($j)]){ $found = true; print(substr($S, 0, $i).chr($j)); break; } if($found) break; } $keys[chr($p)] = false; if($found) break; } if(!$found){ print("-1"); } } }
Here is a piece of code written in PHP: <?php $stdins = []; while($line=fgets(STDIN)){ $stdins[] = trim($line); } for($index=0;$index<count($stdins);$index++){ if($index > 0) printf("\n"); $S = $stdins[$index]; $keys = []; $keys["a"] = false; $keys["b"] = false; $keys["c"] = false; $keys["d"] = false; $keys["e"] = false; $keys["f"] = false; $keys["g"] = false; $keys["h"] = false; $keys["i"] = false; $keys["j"] = false; $keys["k"] = false; $keys["l"] = false; $keys["m"] = false; $keys["n"] = false; $keys["o"] = false; $keys["p"] = false; $keys["q"] = false; $keys["r"] = false; $keys["s"] = false; $keys["t"] = false; $keys["u"] = false; $keys["v"] = false; $keys["w"] = false; $keys["x"] = false; $keys["y"] = false; $keys["z"] = false; $length = strlen($S); for($i=0;$i<$length;$i++) { $keys[$S[$i]] = true; } $found = false; foreach($keys as $key=>$value){ if(!$value){ $found = true; break; } } if($found){ print($S.$key); }else{ $found = false; for($i=strlen($S)-1;$i>=0;$i--){ $p = ord($S[$i]); for($j=$p+1;$j<=ord("z");$j++){ if(!$keys[chr($j)]){ $found = true; print(substr($S, 0, $i).chr($j)); break; } if($found) break; } $keys[chr($p)] = false; if($found) break; } if(!$found){ print("-1"); } } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02622
PHP
Accepted
<?php fscanf(STDIN, "%s", $S); fscanf(STDIN, "%s", $T); printf("%d", array_sum(array_map(function($x, $y){return ($x !== $y) * 1;}, str_split($S), str_split($T))));
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%s", $S); fscanf(STDIN, "%s", $T); printf("%d", array_sum(array_map(function($x, $y){return ($x !== $y) * 1;}, str_split($S), str_split($T)))); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02933
PHP
Accepted
<?php $a = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); if($a>=3200){ echo $s; }else{ echo 'red'; }
Here is a piece of code written in PHP: <?php $a = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); if($a>=3200){ echo $s; }else{ echo 'red'; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02899
PHP
Accepted
<?php $n = intval(fgets(STDIN)); $a = explode(" ", trim(fgets(STDIN))); $result = []; for($i=0; $i<$n; $i++){ $jun = $a[$i]; $result[$jun] = $i+1; } $str = ""; for($i=0; $i<$n; $i++){ $str .= $result[$i+1]." "; } echo substr($str, 0, -1);
Here is a piece of code written in PHP: <?php $n = intval(fgets(STDIN)); $a = explode(" ", trim(fgets(STDIN))); $result = []; for($i=0; $i<$n; $i++){ $jun = $a[$i]; $result[$jun] = $i+1; } $str = ""; for($i=0; $i<$n; $i++){ $str .= $result[$i+1]." "; } echo substr($str, 0, -1); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02910
PHP
Accepted
<?php $s = trim(fgets(STDIN)); $flag = true; for($i=0; $i<strlen($s); $i++){ if($i%2==0){ if($s[$i] == "L") $flag = false; } else { if($s[$i] == "R") $flag = false; } } if($flag){ echo "Yes"; }else{ echo "No"; }
Here is a piece of code written in PHP: <?php $s = trim(fgets(STDIN)); $flag = true; for($i=0; $i<strlen($s); $i++){ if($i%2==0){ if($s[$i] == "L") $flag = false; } else { if($s[$i] == "R") $flag = false; } } if($flag){ echo "Yes"; }else{ echo "No"; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03697
PHP
Accepted
<?php list($a,$b) = explode(" ",trim(fgets(STDIN))); $ans = $a + $b; if($ans < 10){ echo $ans; }else{ echo "error"; } ?>
Here is a piece of code written in PHP: <?php list($a,$b) = explode(" ",trim(fgets(STDIN))); $ans = $a + $b; if($ans < 10){ echo $ans; }else{ echo "error"; } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02389
PHP
Accepted
<?php $line = readline(); readline_add_history($line); $inputs = explode(" ", $line); $a = intval($inputs[0]); $b = intval($inputs[1]); $s = $a * $b; $r = $a + $a + $b + $b; exit($s . " " . $r . "\n"); ?>
Here is a piece of code written in PHP: <?php $line = readline(); readline_add_history($line); $inputs = explode(" ", $line); $a = intval($inputs[0]); $b = intval($inputs[1]); $s = $a * $b; $r = $a + $a + $b + $b; exit($s . " " . $r . "\n"); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03284
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $n, $k); echo $n % $k === 0 ? "0" : "1";
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $n, $k); echo $n % $k === 0 ? "0" : "1"; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02789
PHP
Accepted
<?php fscanf(STDIN, "%s %s", $n, $m); echo $n - $m <= 0 ? 'Yes' : 'No';
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%s %s", $n, $m); echo $n - $m <= 0 ? 'Yes' : 'No'; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02399
PHP
Accepted
<?php $line = readline(); readline_add_history($line); $inputs = explode(" ", $line); $a = intval($inputs[0]); $b = intval($inputs[1]); $d = floor($a / $b); $r = $a % $b; $f = $a / $b; printf("%d %d %f\n", $d, $r, $f);
Here is a piece of code written in PHP: <?php $line = readline(); readline_add_history($line); $inputs = explode(" ", $line); $a = intval($inputs[0]); $b = intval($inputs[1]); $d = floor($a / $b); $r = $a % $b; $f = $a / $b; printf("%d %d %f\n", $d, $r, $f); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02993
PHP
Accepted
<?php fscanf(STDIN, "%s", $S); echo($S[0] === $S[1] || $S[1] === $S[2] || $S[2] === $S[3]) ? 'Bad' : 'Good';
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%s", $S); echo($S[0] === $S[1] || $S[1] === $S[2] || $S[2] === $S[3]) ? 'Bad' : 'Good'; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02396
PHP
Accepted
<?php for ($i = 1; $i <= 10000; $i++) { $input = trim(fgets(STDIN)); if($input == 0){ break; } echo 'Case '. $i. ': '. $input .PHP_EOL; }
Here is a piece of code written in PHP: <?php for ($i = 1; $i <= 10000; $i++) { $input = trim(fgets(STDIN)); if($input == 0){ break; } echo 'Case '. $i. ': '. $input .PHP_EOL; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03000
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $n, $x); $l = explode(" ", trim(fgets(STDIN))); $now = 0; for($i=0; $i<$n; $i++){ $now += $l[$i]; if($now > $x){ echo $i+1; exit; } } echo $n + 1;
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $n, $x); $l = explode(" ", trim(fgets(STDIN))); $now = 0; for($i=0; $i<$n; $i++){ $now += $l[$i]; if($now > $x){ echo $i+1; exit; } } echo $n + 1; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03023
PHP
Accepted
<?php list($n) = ints(); echo 180 * ($n - 2); function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); }
Here is a piece of code written in PHP: <?php list($n) = ints(); echo 180 * ($n - 2); function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03326
PHP
Accepted
<?php list($n, $m) = ints(); for ($i = 0; $i < $n; ++$i) list($x[], $y[], $z[]) = ints(); $max = PHP_INT_MIN; for ($i = 0; $i < 2 ** 3; ++$i) { for ($j = 0; $j < 3; ++$j) { if ($i >> $j & 1) { $d[$j] = 1; } else { $d[$j] = -1; } } for ($j = 0; $j < $n; ++$j) $t[$j] = $d[0] * $x[$j] + $d[1] * $y[$j] + $d[2] * $z[$j]; list($_x, $_y, $_z) = [$x, $y, $z]; array_multisort($t, SORT_DESC, $_x, $_y, $_z); $_x = array_slice($_x, 0, $m); $_y = array_slice($_y, 0, $m); $_z = array_slice($_z, 0, $m); $max = max($max, score([array_sum($_x), array_sum($_y), array_sum($_z)])); } echo $max; function score($a) { return array_sum(array_map('abs', $a)); } function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); }
Here is a piece of code written in PHP: <?php list($n, $m) = ints(); for ($i = 0; $i < $n; ++$i) list($x[], $y[], $z[]) = ints(); $max = PHP_INT_MIN; for ($i = 0; $i < 2 ** 3; ++$i) { for ($j = 0; $j < 3; ++$j) { if ($i >> $j & 1) { $d[$j] = 1; } else { $d[$j] = -1; } } for ($j = 0; $j < $n; ++$j) $t[$j] = $d[0] * $x[$j] + $d[1] * $y[$j] + $d[2] * $z[$j]; list($_x, $_y, $_z) = [$x, $y, $z]; array_multisort($t, SORT_DESC, $_x, $_y, $_z); $_x = array_slice($_x, 0, $m); $_y = array_slice($_y, 0, $m); $_z = array_slice($_z, 0, $m); $max = max($max, score([array_sum($_x), array_sum($_y), array_sum($_z)])); } echo $max; function score($a) { return array_sum(array_map('abs', $a)); } function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03011
PHP
Accepted
<?php fscanf(STDIN, "%d %d %d", $p, $q, $r); $array = [$p, $q, $r]; sort($array); echo $array[0] + $array[1]; ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d %d", $p, $q, $r); $array = [$p, $q, $r]; sort($array); echo $array[0] + $array[1]; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03399
PHP
Accepted
<?php // A fscanf(STDIN, '%d', $a); fscanf(STDIN, '%d', $b); fscanf(STDIN, '%d', $c); fscanf(STDIN, '%d', $d); echo min($a, $b) + min($c, $d);
Here is a piece of code written in PHP: <?php // A fscanf(STDIN, '%d', $a); fscanf(STDIN, '%d', $b); fscanf(STDIN, '%d', $c); fscanf(STDIN, '%d', $d); echo min($a, $b) + min($c, $d); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03293
PHP
Accepted
<?php $n = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); for($i=0; $i<strlen($n); $i++){ $nn[$i] = $n[$i]; $ss[$i] = $s[$i]; } $ans = 'No'; for($i=0; $i<strlen($n); $i++){ array_unshift($nn, $nn[count($nn)-1]); array_pop($nn); if ($nn == $ss){ $ans = 'Yes'; break; } } echo $ans; ?>
Here is a piece of code written in PHP: <?php $n = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); for($i=0; $i<strlen($n); $i++){ $nn[$i] = $n[$i]; $ss[$i] = $s[$i]; } $ans = 'No'; for($i=0; $i<strlen($n); $i++){ array_unshift($nn, $nn[count($nn)-1]); array_pop($nn); if ($nn == $ss){ $ans = 'Yes'; break; } } echo $ans; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03779
PHP
Accepted
<?php list($n) = explode(" ", trim(fgets(STDIN))); $x=0; for($i=1;$i<=$n;$i++){ $x+=$i; if($n<=$x){ echo $i; exit; } }
Here is a piece of code written in PHP: <?php list($n) = explode(" ", trim(fgets(STDIN))); $x=0; for($i=1;$i<=$n;$i++){ $x+=$i; if($n<=$x){ echo $i; exit; } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02901
PHP
Accepted
<?php define("MOD", 10**9+7); fscanf(STDIN, "%d%d", $N, $M); $dp = array_fill(0, 2**$N, 10**18); $dp[0] = 0; for($i = 0; $i < $M; $i++){ fscanf(STDIN, "%d%d", $a, $b); $c = array_map("intval", explode(" ", trim(fgets(STDIN)))); $mask = 2**$N-1; foreach($c as $cc){ $cc--; $mask = $mask ^ (1 << $cc); } for($j = 0, $J = 2**$N; $j < $J; ++$j){ $new = $dp[$j&$mask] + $a; if($dp[$j] > $new){ $dp[$j] = $new; } } } if($dp[2**$N-1] == 10**18){ echo -1;exit; } echo $dp[2**$N-1];
Here is a piece of code written in PHP: <?php define("MOD", 10**9+7); fscanf(STDIN, "%d%d", $N, $M); $dp = array_fill(0, 2**$N, 10**18); $dp[0] = 0; for($i = 0; $i < $M; $i++){ fscanf(STDIN, "%d%d", $a, $b); $c = array_map("intval", explode(" ", trim(fgets(STDIN)))); $mask = 2**$N-1; foreach($c as $cc){ $cc--; $mask = $mask ^ (1 << $cc); } for($j = 0, $J = 2**$N; $j < $J; ++$j){ $new = $dp[$j&$mask] + $a; if($dp[$j] > $new){ $dp[$j] = $new; } } } if($dp[2**$N-1] == 10**18){ echo -1;exit; } echo $dp[2**$N-1]; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03036
PHP
Accepted
<?php // $n = (int)trim(fgets(STDIN)); $input = explode(' ', trim(fgets(STDIN))); $r = (int)$input[0]; $d = (int)$input[1]; $x = (int)$input[2]; $results = []; $prev = $x; for ($i=0; $i < 10; $i++) { $tmp = $prev * $r - $d; $results[] = $tmp; $prev = $tmp; } echo implode(PHP_EOL, $results);
Here is a piece of code written in PHP: <?php // $n = (int)trim(fgets(STDIN)); $input = explode(' ', trim(fgets(STDIN))); $r = (int)$input[0]; $d = (int)$input[1]; $x = (int)$input[2]; $results = []; $prev = $x; for ($i=0; $i < 10; $i++) { $tmp = $prev * $r - $d; $results[] = $tmp; $prev = $tmp; } echo implode(PHP_EOL, $results); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03293
PHP
Accepted
<?php $s = trim(fgets(STDIN)); $t = trim(fgets(STDIN)); $a = $s; $b = ''; for ($i = 0; $i < strlen($s); $i++) { $b = $a[strlen($s) - 1]; for ($j = 0; $j < strlen($s) - 1; $j++) { $b .= $a[$j]; } if ($b === $t) { echo 'Yes' . PHP_EOL; exit(); } $a = $b; } echo 'No' . PHP_EOL;
Here is a piece of code written in PHP: <?php $s = trim(fgets(STDIN)); $t = trim(fgets(STDIN)); $a = $s; $b = ''; for ($i = 0; $i < strlen($s); $i++) { $b = $a[strlen($s) - 1]; for ($j = 0; $j < strlen($s) - 1; $j++) { $b .= $a[$j]; } if ($b === $t) { echo 'Yes' . PHP_EOL; exit(); } $a = $b; } echo 'No' . PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03043
PHP
Accepted
<?php list($n, $k) = explode(" ", trim(fgets(STDIN))); $ans = 0; for ($i=1; $i<=$n; $i++) { $x = intdiv($k+$i-1, $i); $p = ceil(log($x, 2)); // echo $p.PHP_EOL; $ans += (1 / $n) * pow(1/2, $p); } echo $ans;
Here is a piece of code written in PHP: <?php list($n, $k) = explode(" ", trim(fgets(STDIN))); $ans = 0; for ($i=1; $i<=$n; $i++) { $x = intdiv($k+$i-1, $i); $p = ceil(log($x, 2)); // echo $p.PHP_EOL; $ans += (1 / $n) * pow(1/2, $p); } echo $ans; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03573
PHP
Accepted
<?php fscanf(STDIN, '%d %d %d', $a, $b, $c); if ($a === $b) { echo $c; } else { if ($a === $c) { echo $b; } else { echo $a; } } echo PHP_EOL;
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%d %d %d', $a, $b, $c); if ($a === $b) { echo $c; } else { if ($a === $c) { echo $b; } else { echo $a; } } echo PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03087
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $N, $Q); fscanf(STDIN, "%s", $S); $ans = []; $sum = array_pad(array(), $N, 0); for ($i = 1; $i < $N; $i++) { $sum[$i] = $sum[$i - 1] + ($S[$i - 1] . $S[$i] === 'AC'); } for ($i = 0; $i < $Q; $i++) { fscanf(STDIN, "%d %d", $l, $r); $ans[] = $sum[$r - 1] - $sum[$l - 1]; } echo implode(PHP_EOL, $ans);
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $N, $Q); fscanf(STDIN, "%s", $S); $ans = []; $sum = array_pad(array(), $N, 0); for ($i = 1; $i < $N; $i++) { $sum[$i] = $sum[$i - 1] + ($S[$i - 1] . $S[$i] === 'AC'); } for ($i = 0; $i < $Q; $i++) { fscanf(STDIN, "%d %d", $l, $r); $ans[] = $sum[$r - 1] - $sum[$l - 1]; } echo implode(PHP_EOL, $ans); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02844
PHP
Accepted
<?php $n = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); $result = 0; for ($l = 0;$l < 10;$l++) { if (strpos($s,"$l") !== false) { $chk1 = substr($s,strpos($s,"$l") + 1); for ($c = 0;$c < 10;$c++) { if (strpos($chk1,"$c") !== false) { $chk2 = substr($chk1,strpos($chk1,"$c") + 1); for ($r = 0;$r < 10;$r++) { if (strpos($chk2,"$r") !== false) { $result++; } } } } } } echo $result.PHP_EOL; ?>
Here is a piece of code written in PHP: <?php $n = trim(fgets(STDIN)); $s = trim(fgets(STDIN)); $result = 0; for ($l = 0;$l < 10;$l++) { if (strpos($s,"$l") !== false) { $chk1 = substr($s,strpos($s,"$l") + 1); for ($c = 0;$c < 10;$c++) { if (strpos($chk1,"$c") !== false) { $chk2 = substr($chk1,strpos($chk1,"$c") + 1); for ($r = 0;$r < 10;$r++) { if (strpos($chk2,"$r") !== false) { $result++; } } } } } } echo $result.PHP_EOL; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02829
PHP
Accepted
<?php fscanf(STDIN, "%d", $A); fscanf(STDIN, "%d", $B); if($A == 1 && $B ==2 || $A == 2 && $B ==1){ echo 3; }else if($A == 2 && $B ==3 || $A == 3 && $B ==2){ echo 1; } else{ echo 2; } ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d", $A); fscanf(STDIN, "%d", $B); if($A == 1 && $B ==2 || $A == 2 && $B ==1){ echo 3; }else if($A == 2 && $B ==3 || $A == 3 && $B ==2){ echo 1; } else{ echo 2; } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02693
PHP
Accepted
<?php fscanf(STDIN, "%d ", $k); fscanf(STDIN, "%d %d", $a ,$b); $flg = false; for($i= $a; $i <= $b ;$i++){ if($i % $k == 0){ echo 'OK'; $flg = true; break; } } if(!$flg){ echo 'NG'; } ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d ", $k); fscanf(STDIN, "%d %d", $a ,$b); $flg = false; for($i= $a; $i <= $b ;$i++){ if($i % $k == 0){ echo 'OK'; $flg = true; break; } } if(!$flg){ echo 'NG'; } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02409
PHP
Accepted
<?php fscanf(STDIN, '%d', $n); $fill10 = array_fill(0, 10, 0); $dorm = array($fill10, $fill10, $fill10); $arr = array($dorm, $dorm, $dorm, $dorm); for ($i = 0; $i < $n; $i++) { fscanf(STDIN, '%d %d %d %d', $b, $f, $r, $v); $arr[$b - 1][$f - 1][$r - 1] += $v; } foreach ($arr as $i => $dorm) { foreach ($dorm as $arr2) { printf(' %s%s', implode(' ', $arr2), PHP_EOL); } if ($i !== 3) { echo str_repeat('#', 20), PHP_EOL; } }
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%d', $n); $fill10 = array_fill(0, 10, 0); $dorm = array($fill10, $fill10, $fill10); $arr = array($dorm, $dorm, $dorm, $dorm); for ($i = 0; $i < $n; $i++) { fscanf(STDIN, '%d %d %d %d', $b, $f, $r, $v); $arr[$b - 1][$f - 1][$r - 1] += $v; } foreach ($arr as $i => $dorm) { foreach ($dorm as $arr2) { printf(' %s%s', implode(' ', $arr2), PHP_EOL); } if ($i !== 3) { echo str_repeat('#', 20), PHP_EOL; } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03785
PHP
Accepted
<?php $data = explode(" ", trim(fgets(STDIN))); $n = $data[0]; $c = $data[1]; $k = $data[2]; for($i=0;$i<$n;$i++){ $t[$i] = trim(fgets(STDIN)); } sort($t); $x = $t[0]; $y = 0; $ans = 1; for($i=0;$i<$n;$i++){ if($y >= $c || $t[$i] > $x + $k){ $x = $t[$i]; $y = 1; $ans++; } else $y++; } echo $ans; ?>
Here is a piece of code written in PHP: <?php $data = explode(" ", trim(fgets(STDIN))); $n = $data[0]; $c = $data[1]; $k = $data[2]; for($i=0;$i<$n;$i++){ $t[$i] = trim(fgets(STDIN)); } sort($t); $x = $t[0]; $y = 0; $ans = 1; for($i=0;$i<$n;$i++){ if($y >= $c || $t[$i] > $x + $k){ $x = $t[$i]; $y = 1; $ans++; } else $y++; } echo $ans; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03145
PHP
Accepted
<?php list($a, $b, $_) = explode(" ", trim(fgets(STDIN))); echo $a * $b / 2;
Here is a piece of code written in PHP: <?php list($a, $b, $_) = explode(" ", trim(fgets(STDIN))); echo $a * $b / 2; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02390
PHP
Accepted
<?php $time = trim(fgets(STDIN)); $hour = floor($time /( 60 * 60)); $minutes = floor(($time % (60 * 60)) / 60); $seconds = floor($time % 60); echo "$hour:$minutes:$seconds" , PHP_EOL;
Here is a piece of code written in PHP: <?php $time = trim(fgets(STDIN)); $hour = floor($time /( 60 * 60)); $minutes = floor(($time % (60 * 60)) / 60); $seconds = floor($time % 60); echo "$hour:$minutes:$seconds" , PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02582
PHP
Accepted
<?php // Your code here! $data = fgets(STDIN); $now = 0; $ans = 0; $t = str_split($data); foreach($t as $char) { if($char == "R") { $now += 1; } else { $now = 0; } $ans = max($now,$ans); } echo $ans; ?>
Here is a piece of code written in PHP: <?php // Your code here! $data = fgets(STDIN); $now = 0; $ans = 0; $t = str_split($data); foreach($t as $char) { if($char == "R") { $now += 1; } else { $now = 0; } $ans = max($now,$ans); } echo $ans; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03494
PHP
Accepted
<?php $sc = new Scanner(); $in_count = $sc->nextInt(); $num_arr = array(); for ($i = 0; $in_count > $i; $i++) { array_push($num_arr, $sc->nextInt()); } $exe_count = 0; $end = false; while (!$end) { $ret = in_odd_check($num_arr); if ($ret === true) { $end = true; } else { $num_arr = $ret; $exe_count++; } } out::println($exe_count); function in_odd_check($arr) { $ret = array(); foreach ($arr as $k => $v) { if ($v % 2 != 0) { $ret = true; break; } else { $ret[$k] = $v / 2; } } return $ret; } class Scanner { private $arr = []; private $count = 0; private $pointer = 0; public function next() { if ($this->pointer >= $this->count) { $str = trim(fgets(STDIN)); $this->arr = explode(' ', $str); $this->count = count($this->arr); $this->pointer = 0; } $result = $this->arr[$this->pointer]; $this->pointer++; return $result; } public function hasNext() { return $this->pointer < $this->count; } public function nextInt() { return (int)$this->next(); } public function nextDouble() { return (double)$this->next(); } } class out { public static function println($str = "") { echo $str . PHP_EOL; } }
Here is a piece of code written in PHP: <?php $sc = new Scanner(); $in_count = $sc->nextInt(); $num_arr = array(); for ($i = 0; $in_count > $i; $i++) { array_push($num_arr, $sc->nextInt()); } $exe_count = 0; $end = false; while (!$end) { $ret = in_odd_check($num_arr); if ($ret === true) { $end = true; } else { $num_arr = $ret; $exe_count++; } } out::println($exe_count); function in_odd_check($arr) { $ret = array(); foreach ($arr as $k => $v) { if ($v % 2 != 0) { $ret = true; break; } else { $ret[$k] = $v / 2; } } return $ret; } class Scanner { private $arr = []; private $count = 0; private $pointer = 0; public function next() { if ($this->pointer >= $this->count) { $str = trim(fgets(STDIN)); $this->arr = explode(' ', $str); $this->count = count($this->arr); $this->pointer = 0; } $result = $this->arr[$this->pointer]; $this->pointer++; return $result; } public function hasNext() { return $this->pointer < $this->count; } public function nextInt() { return (int)$this->next(); } public function nextDouble() { return (double)$this->next(); } } class out { public static function println($str = "") { echo $str . PHP_EOL; } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03210
PHP
Accepted
<?php fscanf(STDIN, "%d", $a); fscanf(STDIN, "%d", $a); if ($a == 7 || $a == 5 || $a == 3) { echo 'YES'; } else { echo 'NO'; }
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d", $a); fscanf(STDIN, "%d", $a); if ($a == 7 || $a == 5 || $a == 3) { echo 'YES'; } else { echo 'NO'; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p00121
PHP
Accepted
<?php // AOJ 0121 // @kankichi573 // 2014/6/22 P.E $a=array(0,1,2,3,4,5,6,7); $tesuu=array(0); function swap($a,$pos,$offset) { $wk=$a[$pos]; $a[$pos]=$a[$pos+$offset]; $a[$pos+$offset]=$wk; return($a); } function prepare($a,$te,$pos) { global $tesuu; //echo implode($a).": $te \n"; if($te>40) return; //$pos=search_zero($a); if(($pos % 4) < 3) { $b=$a; $b=swap($b,$pos,1); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos+1); } } if(($pos % 4) > 0) { $b=$a; $b=swap($b,$pos,-1); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos-1); } } if($pos > 3) { $b=$a; $b=swap($b,$pos,-4); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos-4); } } if($pos < 4) { $b=$a; $b=swap($b,$pos,4); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos+4); } } } $tesuu[implode($a)]=1; prepare($a,1,0); while($input=fscanf(STDIN,"%d %d %d %d %d %d %d %d")) { //echo "input=>".implode($input)."\n"; fprintf(STDOUT,"%d\n",$tesuu[implode($input)]-1); } return(0); ?>
Here is a piece of code written in PHP: <?php // AOJ 0121 // @kankichi573 // 2014/6/22 P.E $a=array(0,1,2,3,4,5,6,7); $tesuu=array(0); function swap($a,$pos,$offset) { $wk=$a[$pos]; $a[$pos]=$a[$pos+$offset]; $a[$pos+$offset]=$wk; return($a); } function prepare($a,$te,$pos) { global $tesuu; //echo implode($a).": $te \n"; if($te>40) return; //$pos=search_zero($a); if(($pos % 4) < 3) { $b=$a; $b=swap($b,$pos,1); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos+1); } } if(($pos % 4) > 0) { $b=$a; $b=swap($b,$pos,-1); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos-1); } } if($pos > 3) { $b=$a; $b=swap($b,$pos,-4); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos-4); } } if($pos < 4) { $b=$a; $b=swap($b,$pos,4); $mystring=implode($b); if(empty($tesuu[$mystring]) || $tesuu[$mystring] > $te) { $tesuu[$mystring] = $te+1; prepare($b,$te+1,$pos+4); } } } $tesuu[implode($a)]=1; prepare($a,1,0); while($input=fscanf(STDIN,"%d %d %d %d %d %d %d %d")) { //echo "input=>".implode($input)."\n"; fprintf(STDOUT,"%d\n",$tesuu[implode($input)]-1); } return(0); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03806
PHP
Accepted
<?php declare(strict_types=1); class M { public $a, $b, $c; public function __construct($a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; } public function add($x) { $a = $this->a + $x->a; $b = $this->b + $x->b; $c = $this->c + $x->c; return new M($a, $b, $c); } public function is_generative() { return $this->a === $this->b; // && $this->c > 0; } } fscanf(STDIN, "%i %i %i", $n, $ma, $mb); for ($i = 0; $i < $n; ++$i) { fscanf(STDIN, "%i %i %i", $a, $b, $c); $store[$i] = new M($a * $mb, $b * $ma, $c); } $minimize = function (&$value, $candidate) { if (!isset($value) || $value > $candidate) { $value = $candidate; } }; $dp[0][0][0] = 0; for ($i = 0; $i < $n; ++$i) { $other_hand = $i & 1 ^ 1; unset($dp[$other_hand]); foreach ($dp[$i & 1] as $a => $inner) { foreach ($inner as $b => $c) { $minimize($dp[$other_hand][$a][$b], $c); $bought = (new M($a, $b, $c))->add($store[$i]); if (isset($answer) && $bought->c >= $answer) { continue; } if ($bought->is_generative()) { $minimize($answer, $bought->c); } else { $minimize($dp[$other_hand][$bought->a][$bought->b], $bought->c); } } } } echo ($answer ?? -1),PHP_EOL;
Here is a piece of code written in PHP: <?php declare(strict_types=1); class M { public $a, $b, $c; public function __construct($a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; } public function add($x) { $a = $this->a + $x->a; $b = $this->b + $x->b; $c = $this->c + $x->c; return new M($a, $b, $c); } public function is_generative() { return $this->a === $this->b; // && $this->c > 0; } } fscanf(STDIN, "%i %i %i", $n, $ma, $mb); for ($i = 0; $i < $n; ++$i) { fscanf(STDIN, "%i %i %i", $a, $b, $c); $store[$i] = new M($a * $mb, $b * $ma, $c); } $minimize = function (&$value, $candidate) { if (!isset($value) || $value > $candidate) { $value = $candidate; } }; $dp[0][0][0] = 0; for ($i = 0; $i < $n; ++$i) { $other_hand = $i & 1 ^ 1; unset($dp[$other_hand]); foreach ($dp[$i & 1] as $a => $inner) { foreach ($inner as $b => $c) { $minimize($dp[$other_hand][$a][$b], $c); $bought = (new M($a, $b, $c))->add($store[$i]); if (isset($answer) && $bought->c >= $answer) { continue; } if ($bought->is_generative()) { $minimize($answer, $bought->c); } else { $minimize($dp[$other_hand][$bought->a][$bought->b], $bought->c); } } } } echo ($answer ?? -1),PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03186
PHP
Accepted
<?php $n = explode(" ",fgets(STDIN)); $a = intval($n[0]); $b = intval($n[1]); $c = intval($n[2]); $ans = 0; if(($a+$b)>$c-2){ $ans = $b+$c; }else{ $ans = $b*2 + $a + 1; } echo $ans;
Here is a piece of code written in PHP: <?php $n = explode(" ",fgets(STDIN)); $a = intval($n[0]); $b = intval($n[1]); $c = intval($n[2]); $ans = 0; if(($a+$b)>$c-2){ $ans = $b+$c; }else{ $ans = $b*2 + $a + 1; } echo $ans; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03288
PHP
Accepted
<?php // A fscanf(STDIN, '%d', $r); if ($r < 1200) $ans = 'ABC'; elseif ($r < 2800) $ans = 'ARC'; else $ans = 'AGC'; echo $ans;
Here is a piece of code written in PHP: <?php // A fscanf(STDIN, '%d', $r); if ($r < 1200) $ans = 'ABC'; elseif ($r < 2800) $ans = 'ARC'; else $ans = 'AGC'; echo $ans; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03835
PHP
Accepted
<?php /** * @see: https://atcoder.jp/contests/abc051/tasks/abc051_b */ function getInput(): array { return array_map('intval', explode(' ', trim(fgets(STDIN)))); } function calculate(int $K, int $S): int { $numberOfTriples = 0; for ($X = 0; $X <= $K; $X++) { for ($Y = 0; $Y <= $K; $Y++) { $Z = $S - $X - $Y; if (0 <= $Z && $Z <= $K) { $numberOfTriples++; } } } return $numberOfTriples; } list($K, $S) = getInput(); $result = calculate($K, $S); echo $result . PHP_EOL;
Here is a piece of code written in PHP: <?php /** * @see: https://atcoder.jp/contests/abc051/tasks/abc051_b */ function getInput(): array { return array_map('intval', explode(' ', trim(fgets(STDIN)))); } function calculate(int $K, int $S): int { $numberOfTriples = 0; for ($X = 0; $X <= $K; $X++) { for ($Y = 0; $Y <= $K; $Y++) { $Z = $S - $X - $Y; if (0 <= $Z && $Z <= $K) { $numberOfTriples++; } } } return $numberOfTriples; } list($K, $S) = getInput(); $result = calculate($K, $S); echo $result . PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02711
PHP
Accepted
<?php fscanf(STDIN, '%s', $n); echo ($n[0] == '7' || $n[1] == '7' || $n[2] == '7') ? 'Yes' : 'No', PHP_EOL;
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%s', $n); echo ($n[0] == '7' || $n[1] == '7' || $n[2] == '7') ? 'Yes' : 'No', PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03089
PHP
Accepted
<?php $n = trim(fgets(STDIN)); $array = explode(" ", trim(fgets(STDIN))); for($i = 0; $i < $n; $i++){ for($j = count($array) - 1; $j >= 0 ; $j--){ if($array[$j] == $j + 1){ unset($array[$j]); $array = array_values($array); $stack[] = ($j + 1); break; } if($j == 0){ echo -1; exit; } } } echo implode("\n", array_reverse($stack));
Here is a piece of code written in PHP: <?php $n = trim(fgets(STDIN)); $array = explode(" ", trim(fgets(STDIN))); for($i = 0; $i < $n; $i++){ for($j = count($array) - 1; $j >= 0 ; $j--){ if($array[$j] == $j + 1){ unset($array[$j]); $array = array_values($array); $stack[] = ($j + 1); break; } if($j == 0){ echo -1; exit; } } } echo implode("\n", array_reverse($stack)); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02952
PHP
Accepted
<?php $n = int(); $count = 0; for($i = 1; $i <= $n; $i++){ if(strlen($i) % 2 == 1)$count++; } echo $count; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } function o(...$val){ if(count($val)==1)$val = array_shift($val); $trace = debug_backtrace(); echo $trace[0]['line'].")"; if(is_array($val)){ if(count($val) == 0){ echo "empty array"; }elseif(!is_array(current($val))){ echo "array:"; echo implode(" ", $val)."\n"; }else{ echo "array:array\n"; foreach($val as $row){ echo implode(" ", $row)."\n"; } } }else{ echo $val."\n"; } }
Here is a piece of code written in PHP: <?php $n = int(); $count = 0; for($i = 1; $i <= $n; $i++){ if(strlen($i) % 2 == 1)$count++; } echo $count; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } function o(...$val){ if(count($val)==1)$val = array_shift($val); $trace = debug_backtrace(); echo $trace[0]['line'].")"; if(is_array($val)){ if(count($val) == 0){ echo "empty array"; }elseif(!is_array(current($val))){ echo "array:"; echo implode(" ", $val)."\n"; }else{ echo "array:array\n"; foreach($val as $row){ echo implode(" ", $row)."\n"; } } }else{ echo $val."\n"; } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02767
PHP
Accepted
<?php $n = trim(fgets(STDIN)); $array_pos = explode(" ", fgets(STDIN)); $sum_sqr=0; for($i=0;$i<$n;$i++) { $sum_sqr = $sum_sqr+ $array_pos[$i]; } $p1 = floor($sum_sqr / $n); $p2 = $p1+1; $cost1 = 0; $cost2 = 0; for($i=0;$i<$n;$i++) { $cost1 = $cost1 + pow($array_pos[$i]-$p1, 2); $cost2 = $cost2 + pow($array_pos[$i]-$p2, 2); } echo $cost1 > $cost2 ? $cost2 : $cost1;
Here is a piece of code written in PHP: <?php $n = trim(fgets(STDIN)); $array_pos = explode(" ", fgets(STDIN)); $sum_sqr=0; for($i=0;$i<$n;$i++) { $sum_sqr = $sum_sqr+ $array_pos[$i]; } $p1 = floor($sum_sqr / $n); $p2 = $p1+1; $cost1 = 0; $cost2 = 0; for($i=0;$i<$n;$i++) { $cost1 = $cost1 + pow($array_pos[$i]-$p1, 2); $cost2 = $cost2 + pow($array_pos[$i]-$p2, 2); } echo $cost1 > $cost2 ? $cost2 : $cost1; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03778
PHP
Accepted
<?php fscanf(STDIN, "%s %s %s", $w, $a, $b); if($a>$b){ $tmp = $a; $a = $b; $b = $tmp; } if($a + $w >= $b){ $res = 0; }elseif($a + $w < $b){ $res = $b - ($a + $w); } echo $res ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%s %s %s", $w, $a, $b); if($a>$b){ $tmp = $a; $a = $b; $b = $tmp; } if($a + $w >= $b){ $res = 0; }elseif($a + $w < $b){ $res = $b - ($a + $w); } echo $res ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03086
PHP
Accepted
<?php $s = trim(fgets(STDIN)); $arr = str_split($s); $count = 0; $max = 0; for($i=0; $i<count($arr); $i++){ if($arr[$i] == 'A' || $arr[$i] == 'C' || $arr[$i] == 'G' || $arr[$i] == 'T'){ $count++; }else{ $count = 0; } $max = max($max, $count); } echo $max; ?>
Here is a piece of code written in PHP: <?php $s = trim(fgets(STDIN)); $arr = str_split($s); $count = 0; $max = 0; for($i=0; $i<count($arr); $i++){ if($arr[$i] == 'A' || $arr[$i] == 'C' || $arr[$i] == 'G' || $arr[$i] == 'T'){ $count++; }else{ $count = 0; } $max = max($max, $count); } echo $max; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p00001
PHP
Accepted
<?php $t = array(); for($i = 0; $i < 10; $i++){ fscanf(STDIN, "%d", $t[$i]); } rsort($t); for($i = 0; $i < 3; $i++){ echo $t[$i] . "\n"; }
Here is a piece of code written in PHP: <?php $t = array(); for($i = 0; $i < 10; $i++){ fscanf(STDIN, "%d", $t[$i]); } rsort($t); for($i = 0; $i < 3; $i++){ echo $t[$i] . "\n"; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02969
PHP
Accepted
<?PHP $r = fgets(STDIN); $ans = 3 * $r * $r; echo $ans; ?>
Here is a piece of code written in PHP: <?PHP $r = fgets(STDIN); $ans = 3 * $r * $r; echo $ans; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p00006
PHP
Accepted
<?php fscanf(STDIN, "%s", $word); $word = str_split($word); $rev = array_reverse($word); echo implode('', $rev) . PHP_EOL;
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%s", $word); $word = str_split($word); $rev = array_reverse($word); echo implode('', $rev) . PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02921
PHP
Accepted
<?php $s = str_split(trim(fgets(STDIN))); $t = str_split(trim(fgets(STDIN))); $match = 0; for ($i = 0; $i < 3; $i++) { if ($s[$i] == $t[$i]) { $match++; } } echo $match;
Here is a piece of code written in PHP: <?php $s = str_split(trim(fgets(STDIN))); $t = str_split(trim(fgets(STDIN))); $match = 0; for ($i = 0; $i < 3; $i++) { if ($s[$i] == $t[$i]) { $match++; } } echo $match; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03840
PHP
Accepted
<?php fscanf(STDIN, '%d %d %d %d %d %d %d', $i, $o, $t, $j, $l, $s, $z); $result = floor($i/2)*2+$o*1+floor($j/2)*2+floor($l/2)*2; $i_block = floor($i/2); $j_block = floor($j/2); $l_block = floor($l/2); $i_mod = $i - $i_block*2; $l_mod = $l - $l_block*2; $j_mod = $j - $j_block*2; $result_a = $result; $result_b = 0; if ($i != 0 && $j != 0 && $l != 0) { if ($i_mod == 0) { $i_block--; } if ($l_mod == 0) { $l_block--; } if ($j_mod == 0) { $j_block--; } $result_b = $i_block*2+$o*1+$j_block*2+$l_block*2+3; } echo max($result_a, $result_b);
Here is a piece of code written in PHP: <?php fscanf(STDIN, '%d %d %d %d %d %d %d', $i, $o, $t, $j, $l, $s, $z); $result = floor($i/2)*2+$o*1+floor($j/2)*2+floor($l/2)*2; $i_block = floor($i/2); $j_block = floor($j/2); $l_block = floor($l/2); $i_mod = $i - $i_block*2; $l_mod = $l - $l_block*2; $j_mod = $j - $j_block*2; $result_a = $result; $result_b = 0; if ($i != 0 && $j != 0 && $l != 0) { if ($i_mod == 0) { $i_block--; } if ($l_mod == 0) { $l_block--; } if ($j_mod == 0) { $j_block--; } $result_b = $i_block*2+$o*1+$j_block*2+$l_block*2+3; } echo max($result_a, $result_b); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03129
PHP
Accepted
<?php /*atcoder.php*/ $at = new Atcoder(); $at->main(); unset($at); class Atcoder{ private function arrayIn(){ $buf = explode(" ", fgets(STDIN)); return $this->killNewLine($buf); } private function killNewLine($buf = null){ $buf = str_replace("\r\n", "", $buf); $buf = str_replace("\n", "", $buf); $buf = str_replace("\r", "", $buf); return $buf; } public function main(){ $s = $this->arrayIn(); $n = $s[0]; $k = $s[1]; if(0 != ($n % 2)){ $n++; } switch ($n){ case ( 2 ) : if ( 1 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 4 ) : if ( 2 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 6 ) : if ( 3 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 8 ) : if ( 4 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 10 ) : if ( 5 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 12 ) : if ( 6 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 14 ) : if ( 7 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 16 ) : if ( 8 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 18 ) : if ( 9 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 20 ) : if ( 10 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 22 ) : if ( 11 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 24 ) : if ( 12 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 26 ) : if ( 13 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 28 ) : if ( 14 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 30 ) : if ( 15 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 32 ) : if ( 16 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 34 ) : if ( 17 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 36 ) : if ( 18 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 38 ) : if ( 19 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 40 ) : if ( 20 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 42 ) : if ( 21 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 44 ) : if ( 22 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 46 ) : if ( 23 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 48 ) : if ( 24 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 50 ) : if ( 25 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 52 ) : if ( 26 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 54 ) : if ( 27 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 56 ) : if ( 28 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 58 ) : if ( 29 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 60 ) : if ( 30 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 62 ) : if ( 31 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 64 ) : if ( 32 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 66 ) : if ( 33 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 68 ) : if ( 34 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 70 ) : if ( 35 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 72 ) : if ( 36 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 74 ) : if ( 37 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 76 ) : if ( 38 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 78 ) : if ( 39 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 80 ) : if ( 40 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 82 ) : if ( 41 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 84 ) : if ( 42 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 86 ) : if ( 43 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 88 ) : if ( 44 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 90 ) : if ( 45 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 92 ) : if ( 46 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 94 ) : if ( 47 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 96 ) : if ( 48 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 98 ) : if ( 49 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 100 ) : if ( 50 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } } } } ?>
Here is a piece of code written in PHP: <?php /*atcoder.php*/ $at = new Atcoder(); $at->main(); unset($at); class Atcoder{ private function arrayIn(){ $buf = explode(" ", fgets(STDIN)); return $this->killNewLine($buf); } private function killNewLine($buf = null){ $buf = str_replace("\r\n", "", $buf); $buf = str_replace("\n", "", $buf); $buf = str_replace("\r", "", $buf); return $buf; } public function main(){ $s = $this->arrayIn(); $n = $s[0]; $k = $s[1]; if(0 != ($n % 2)){ $n++; } switch ($n){ case ( 2 ) : if ( 1 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 4 ) : if ( 2 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 6 ) : if ( 3 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 8 ) : if ( 4 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 10 ) : if ( 5 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 12 ) : if ( 6 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 14 ) : if ( 7 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 16 ) : if ( 8 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 18 ) : if ( 9 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 20 ) : if ( 10 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 22 ) : if ( 11 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 24 ) : if ( 12 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 26 ) : if ( 13 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 28 ) : if ( 14 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 30 ) : if ( 15 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 32 ) : if ( 16 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 34 ) : if ( 17 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 36 ) : if ( 18 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 38 ) : if ( 19 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 40 ) : if ( 20 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 42 ) : if ( 21 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 44 ) : if ( 22 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 46 ) : if ( 23 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 48 ) : if ( 24 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 50 ) : if ( 25 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 52 ) : if ( 26 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 54 ) : if ( 27 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 56 ) : if ( 28 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 58 ) : if ( 29 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 60 ) : if ( 30 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 62 ) : if ( 31 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 64 ) : if ( 32 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 66 ) : if ( 33 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 68 ) : if ( 34 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 70 ) : if ( 35 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 72 ) : if ( 36 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 74 ) : if ( 37 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 76 ) : if ( 38 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 78 ) : if ( 39 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 80 ) : if ( 40 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 82 ) : if ( 41 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 84 ) : if ( 42 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 86 ) : if ( 43 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 88 ) : if ( 44 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 90 ) : if ( 45 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 92 ) : if ( 46 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 94 ) : if ( 47 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 96 ) : if ( 48 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 98 ) : if ( 49 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } break; case ( 100 ) : if ( 50 >= $k ) { echo "YES\n"; }else{ echo "NO\n"; } } } } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02693
PHP
Accepted
<?php fscanf(STDIN, "%d", $k); fscanf(STDIN, "%d %d", $a, $b); for ($i = $a; $i <= $b; $i++) { if (($i % $k) === 0) { echo "OK\n"; exit; } } echo "NG\n";
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d", $k); fscanf(STDIN, "%d %d", $a, $b); for ($i = $a; $i <= $b; $i++) { if (($i % $k) === 0) { echo "OK\n"; exit; } } echo "NG\n"; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02765
PHP
Accepted
<?php $sor = readline(); $ex = explode(" ", $sor); $n = $ex[0]; $k = $ex[1]; if($n >= 10){ echo $k; }else{ echo $k+(100*(10-$n)); }
Here is a piece of code written in PHP: <?php $sor = readline(); $ex = explode(" ", $sor); $n = $ex[0]; $k = $ex[1]; if($n >= 10){ echo $k; }else{ echo $k+(100*(10-$n)); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03795
PHP
Accepted
<?php $n = intval(trim(fgets(STDIN))); $ans = 800*$n - 200*floor($n/15); print("$ans\n"); ?>
Here is a piece of code written in PHP: <?php $n = intval(trim(fgets(STDIN))); $ans = 800*$n - 200*floor($n/15); print("$ans\n"); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02388
PHP
Accepted
<?php $x= trim(fgets(STDIN)); echo pow($x,3); echo PHP_EOL;
Here is a piece of code written in PHP: <?php $x= trim(fgets(STDIN)); echo pow($x,3); echo PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03834
PHP
Accepted
<?php fscanf(STDIN,'%s',$H); for ($i=0; $i <=18 ; $i++) { // code... if($i!=5&&$i!=13){ echo $H[$i]; }else{ echo " "; } } ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN,'%s',$H); for ($i=0; $i <=18 ; $i++) { // code... if($i!=5&&$i!=13){ echo $H[$i]; }else{ echo " "; } } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03359
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $a, $b); if ($a <= $b) { echo $a . PHP_EOL; } else { echo ($a - 1) . PHP_EOL; }
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $a, $b); if ($a <= $b) { echo $a . PHP_EOL; } else { echo ($a - 1) . PHP_EOL; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03705
PHP
Accepted
<?php list($n, $a, $b) = ints(); if ($a > $b) exit('0'); if ($a === $b) exit('1'); if ($n === 1) exit('0'); echo ($b - $a) * ($n - 2) + 1; function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); }
Here is a piece of code written in PHP: <?php list($n, $a, $b) = ints(); if ($a > $b) exit('0'); if ($a === $b) exit('1'); if ($n === 1) exit('0'); echo ($b - $a) * ($n - 2) + 1; function ints() { return array_map('intval', explode(' ', trim(fgets(STDIN)))); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02886
PHP
Accepted
<?php $N = fgets(STDIN); $d = fgets(STDIN); $arrayD = explode(" ", $d); $result = 0; for ($i = 0; $i < $N - 1; $i ++) { for ($j = $i + 1; $j < $N; $j ++) { $result += $arrayD[$i] * $arrayD[$j]; } } echo $result;
Here is a piece of code written in PHP: <?php $N = fgets(STDIN); $d = fgets(STDIN); $arrayD = explode(" ", $d); $result = 0; for ($i = 0; $i < $N - 1; $i ++) { for ($j = $i + 1; $j < $N; $j ++) { $result += $arrayD[$i] * $arrayD[$j]; } } echo $result; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03501
PHP
Accepted
<?php list($n,$a,$b)=explode(" ",trim(fgets(STDIN))); echo min($n*$a,$b);
Here is a piece of code written in PHP: <?php list($n,$a,$b)=explode(" ",trim(fgets(STDIN))); echo min($n*$a,$b); Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03062
PHP
Accepted
<?php $n=trim(fgets(STDIN)); $a=explode(" ",trim(fgets(STDIN))); sort($a); $m=0; $ans=0; $r=100000000000; $i=0; while($i<$n){ if($a[$i]<0){ ++$m; $ans+=(int)abs($a[$i]); $r=-$a[$i]; }else{ $ans+=(int)$a[$i]; $r=min($r,$a[$i]); } ++$i; } if($m%2==1){ $ans-=(int)$r*2; } echo $ans;
Here is a piece of code written in PHP: <?php $n=trim(fgets(STDIN)); $a=explode(" ",trim(fgets(STDIN))); sort($a); $m=0; $ans=0; $r=100000000000; $i=0; while($i<$n){ if($a[$i]<0){ ++$m; $ans+=(int)abs($a[$i]); $r=-$a[$i]; }else{ $ans+=(int)$a[$i]; $r=min($r,$a[$i]); } ++$i; } if($m%2==1){ $ans-=(int)$r*2; } echo $ans; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p01513
PHP
Accepted
<?php while (fscanf(STDIN, "%d", $N) && $N) { $P = array(); for ($i = 0; $i < $N; $i++) { $tmp = explode(' ', trim(fgets(STDIN))); array_shift($tmp); $P[] = $tmp; } $tmp = explode(' ', trim(fgets(STDIN))); array_shift($tmp); $L = $tmp; $id = -1; for ($i = 0; $i < count($P); $i++) { $flg = true; foreach ($L as $v1) { $found = false; foreach ($P[$i] as $v2) { if ($v1 == $v2) { $found = true; break; } } if (!$found) { $flg = false; break; } } if ($flg) { if ($id != -1) { $id = -1; break; } $id = $i + 1; } } print $id . "\n"; }
Here is a piece of code written in PHP: <?php while (fscanf(STDIN, "%d", $N) && $N) { $P = array(); for ($i = 0; $i < $N; $i++) { $tmp = explode(' ', trim(fgets(STDIN))); array_shift($tmp); $P[] = $tmp; } $tmp = explode(' ', trim(fgets(STDIN))); array_shift($tmp); $L = $tmp; $id = -1; for ($i = 0; $i < count($P); $i++) { $flg = true; foreach ($L as $v1) { $found = false; foreach ($P[$i] as $v2) { if ($v1 == $v2) { $found = true; break; } } if (!$found) { $flg = false; break; } } if ($flg) { if ($id != -1) { $id = -1; break; } $id = $i + 1; } } print $id . "\n"; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02389
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $a, $b); printf("%d %d", $a*$b , $a*2 + $b*2); ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $a, $b); printf("%d %d", $a*$b , $a*2 + $b*2); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03036
PHP
Accepted
<?php $rdx = explode(' ', trim(fgets(STDIN))); $r = $rdx[0]; $d = $rdx[1]; $x = $rdx[2]; for($i=0; $i<10; $i++){ if ($i !== 0) echo "\n"; $x = $x*$r-$d; echo $x; } ?>
Here is a piece of code written in PHP: <?php $rdx = explode(' ', trim(fgets(STDIN))); $r = $rdx[0]; $d = $rdx[1]; $x = $rdx[2]; for($i=0; $i<10; $i++){ if ($i !== 0) echo "\n"; $x = $x*$r-$d; echo $x; } ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03186
PHP
Accepted
<?php $input = trim(fgets(STDIN)); $input = explode(" ", $input); $A = $input[0]; $B = $input[1]; $C = $input[2]; $cnt = 0; if($C <= ($A+$B)) $cnt = $B + $C; else $cnt = ($A+$B+1) +$B; echo $cnt; ?>
Here is a piece of code written in PHP: <?php $input = trim(fgets(STDIN)); $input = explode(" ", $input); $A = $input[0]; $B = $input[1]; $C = $input[2]; $cnt = 0; if($C <= ($A+$B)) $cnt = $B + $C; else $cnt = ($A+$B+1) +$B; echo $cnt; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02843
PHP
Accepted
<?php $X = trim(fgets(STDIN)); //list($m2,$d2) = explode(" ",trim(fgets(STDIN))); //$A = explode(" ",trim(fgets(STDIN))); $amari = $X % 100; $syo = intdiv($X , 100); $syo = $syo * 5; if ($amari <= $syo) { printf("1\n"); } else { printf("0\n"); }
Here is a piece of code written in PHP: <?php $X = trim(fgets(STDIN)); //list($m2,$d2) = explode(" ",trim(fgets(STDIN))); //$A = explode(" ",trim(fgets(STDIN))); $amari = $X % 100; $syo = intdiv($X , 100); $syo = $syo * 5; if ($amari <= $syo) { printf("1\n"); } else { printf("0\n"); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02947
PHP
Accepted
<?php function checkData($dataA, $dataB){ if(count($dataA)!=count($dataB)){ return false; } $ret = true; foreach($dataA as $key=>$num){ if(!isset($dataB[$key]) || $dataB[$key]!=$num){ $ret = false; break; } } return $ret; } $n = intval(fgets(STDIN)); $data = []; for($i=0; $i<$n; $i++){ $tmp = []; $str = trim(fgets(STDIN)); for($j=0; $j<10; $j++){ $abc = $str[$j]; if(isset($tmp[$abc])){ $tmp[$abc]++; }else{ $tmp[$abc] = 1; } } ksort($tmp); $str2 = ""; foreach($tmp as $key=>$num){ $str2 .= $key.$num; } if(isset($data[$str2])){ $data[$str2]++; }else{ $data[$str2] = 1; } } $count = 0; foreach($data as $dataNum){ if($dataNum > 1){ $count += ($dataNum * ($dataNum-1) / 2); } } echo $count."\n"; /* $count = 0; for($i=0; $i<$n-1; $i++){ $tmpCount=0; $groupCount for($j=$i+1; $j<$n; $j++){ if(checkData($data[$i], $data[$j])){ $count++; } } } }*/
Here is a piece of code written in PHP: <?php function checkData($dataA, $dataB){ if(count($dataA)!=count($dataB)){ return false; } $ret = true; foreach($dataA as $key=>$num){ if(!isset($dataB[$key]) || $dataB[$key]!=$num){ $ret = false; break; } } return $ret; } $n = intval(fgets(STDIN)); $data = []; for($i=0; $i<$n; $i++){ $tmp = []; $str = trim(fgets(STDIN)); for($j=0; $j<10; $j++){ $abc = $str[$j]; if(isset($tmp[$abc])){ $tmp[$abc]++; }else{ $tmp[$abc] = 1; } } ksort($tmp); $str2 = ""; foreach($tmp as $key=>$num){ $str2 .= $key.$num; } if(isset($data[$str2])){ $data[$str2]++; }else{ $data[$str2] = 1; } } $count = 0; foreach($data as $dataNum){ if($dataNum > 1){ $count += ($dataNum * ($dataNum-1) / 2); } } echo $count."\n"; /* $count = 0; for($i=0; $i<$n-1; $i++){ $tmpCount=0; $groupCount for($j=$i+1; $j<$n; $j++){ if(checkData($data[$i], $data[$j])){ $count++; } } } }*/ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02922
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $A, $B); $tap = 0; $hole = 1; while ($hole < $B) { $tap++; $hole = $hole -1 + $A; } echo ($tap); ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $A, $B); $tap = 0; $hole = 1; while ($hole < $B) { $tap++; $hole = $hole -1 + $A; } echo ($tap); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03495
PHP
Accepted
<?php $input = explode(' ', trim(fgets(STDIN))); $n = (int)$input[0]; $k = (int)$input[1]; $input = explode(' ', trim(fgets(STDIN))); $cnt = []; foreach ($input as $val) { $tmp = (int)$val; if (isset($cnt[$tmp])) { $cnt[$tmp]+=1; }else{ $cnt[$tmp]=1; } } $variety = count($cnt); $diff = $variety - $k; if ($diff<=0) { echo 0; exit(); }else{ sort($cnt); $sum = 0; $count = 0; foreach ($cnt as $value) { $sum += $value; ++$count; if ($count === $diff) { break; } } echo $sum; }
Here is a piece of code written in PHP: <?php $input = explode(' ', trim(fgets(STDIN))); $n = (int)$input[0]; $k = (int)$input[1]; $input = explode(' ', trim(fgets(STDIN))); $cnt = []; foreach ($input as $val) { $tmp = (int)$val; if (isset($cnt[$tmp])) { $cnt[$tmp]+=1; }else{ $cnt[$tmp]=1; } } $variety = count($cnt); $diff = $variety - $k; if ($diff<=0) { echo 0; exit(); }else{ sort($cnt); $sum = 0; $count = 0; foreach ($cnt as $value) { $sum += $value; ++$count; if ($count === $diff) { break; } } echo $sum; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02594
PHP
Accepted
<?php $input_line = trim(fgets(STDIN)); if ($input_line >= 30) { echo('Yes'); } else { echo('No'); }; ?>
Here is a piece of code written in PHP: <?php $input_line = trim(fgets(STDIN)); if ($input_line >= 30) { echo('Yes'); } else { echo('No'); }; ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03814
PHP
Accepted
<?php $s=fgets(STDIN); $a=-1; for($i=0;$i<strlen($s);$i++) { if($a<0&&$s[$i]=='A')$a=$i; if($s[$i]=='Z')$z=$i; } echo $z-$a+1;
Here is a piece of code written in PHP: <?php $s=fgets(STDIN); $a=-1; for($i=0;$i<strlen($s);$i++) { if($a<0&&$s[$i]=='A')$a=$i; if($s[$i]=='Z')$z=$i; } echo $z-$a+1; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02719
PHP
Accepted
<?php fscanf(STDIN, "%d %d", $N, $K); if(abs($N - $K) > $K){ $N = $N%$K; } $ans = $N; while(abs($N-$K) < $ans){ $N = abs($N-$K); $ans = $N; } echo ($ans); ?>
Here is a piece of code written in PHP: <?php fscanf(STDIN, "%d %d", $N, $K); if(abs($N - $K) > $K){ $N = $N%$K; } $ans = $N; while(abs($N-$K) < $ans){ $N = abs($N-$K); $ans = $N; } echo ($ans); ?> Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p02767
PHP
Accepted
<?php $n=trim(fgets(STDIN)); $x=explode(" ",trim(fgets(STDIN))); sort($x); $i=$x[0]; $ans=pow(10,10); while($i<=$x[$n-1]){ $sum=0; $j=0; while($j<$n){ $sum+=pow(($x[$j]-$i),2); ++$j; } if($sum<$ans){ $ans=$sum; } ++$i; } echo $ans;
Here is a piece of code written in PHP: <?php $n=trim(fgets(STDIN)); $x=explode(" ",trim(fgets(STDIN))); sort($x); $i=$x[0]; $ans=pow(10,10); while($i<=$x[$n-1]){ $sum=0; $j=0; while($j<$n){ $sum+=pow(($x[$j]-$i),2); ++$j; } if($sum<$ans){ $ans=$sum; } ++$i; } echo $ans; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes
p03148
PHP
Accepted
<?php const D_MAX = 1000000005; fscanf(STDIN, "%d %d", $N, $K); $G = []; for ($i = 0; $i < $N; ++$i) { fscanf(STDIN, "%d %d", $t, $d); if (!isset($G[$t])) { $G[$t] = [$d]; } else { $G[$t][] = $d; } } $B = []; foreach ($G as &$arr) { rsort($arr); for ($i = 0; $i < count($arr); ++$i) { if ($i == 0) { $B[] = [$arr[$i], 1]; } else { $B[] = [$arr[$i], 0]; } } } usort($B, function ($a, $b) { return $a[0] < $b[0]; }); $basep = 0; $type = 0; $q1 = new SplPriorityQueue(); for ($i = 0; $i < $K; ++$i) { $b = $B[$i]; $basep += $b[0]; if ($b[1] == 1) ++$type; $q1->insert($b, -1 * ($b[0] + D_MAX * $b[1])); } $q2 = new SplPriorityQueue(); for ($i = $K; $i < $N; ++$i) { $b = $B[$i]; $q2->insert($b, $b[0] + D_MAX * $b[1]); } $ans = $basep + pow($type, 2); while (1) { if (!$q1->valid()) break; $x = $q1->extract(); if ($x[1] == 1) continue; if (!$q2->valid()) break; $y = $q2->extract(); if ($y[1] == 0) continue; /* echo "x: [" . $x[0] . ", " . $x[1] . "], y: [" . $y[0] . ", " . $y[1] . "]", PHP_EOL; */ $basep -= $x[0]; $basep += $y[0]; ++$type; $ans = max($ans, $basep + pow($type, 2)); } echo (int) $ans, PHP_EOL;
Here is a piece of code written in PHP: <?php const D_MAX = 1000000005; fscanf(STDIN, "%d %d", $N, $K); $G = []; for ($i = 0; $i < $N; ++$i) { fscanf(STDIN, "%d %d", $t, $d); if (!isset($G[$t])) { $G[$t] = [$d]; } else { $G[$t][] = $d; } } $B = []; foreach ($G as &$arr) { rsort($arr); for ($i = 0; $i < count($arr); ++$i) { if ($i == 0) { $B[] = [$arr[$i], 1]; } else { $B[] = [$arr[$i], 0]; } } } usort($B, function ($a, $b) { return $a[0] < $b[0]; }); $basep = 0; $type = 0; $q1 = new SplPriorityQueue(); for ($i = 0; $i < $K; ++$i) { $b = $B[$i]; $basep += $b[0]; if ($b[1] == 1) ++$type; $q1->insert($b, -1 * ($b[0] + D_MAX * $b[1])); } $q2 = new SplPriorityQueue(); for ($i = $K; $i < $N; ++$i) { $b = $B[$i]; $q2->insert($b, $b[0] + D_MAX * $b[1]); } $ans = $basep + pow($type, 2); while (1) { if (!$q1->valid()) break; $x = $q1->extract(); if ($x[1] == 1) continue; if (!$q2->valid()) break; $y = $q2->extract(); if ($y[1] == 0) continue; /* echo "x: [" . $x[0] . ", " . $x[1] . "], y: [" . $y[0] . ", " . $y[1] . "]", PHP_EOL; */ $basep -= $x[0]; $basep += $y[0]; ++$type; $ans = max($ans, $basep + pow($type, 2)); } echo (int) $ans, PHP_EOL; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
Yes