{"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "46c3148a4f59ec73baf8bb37c52377fd", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "difficulty": 2100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ($k+1)/2 * $k+1) {$r = -1; }\n else \n {\n while(($l-$r)<0)\n {\n $mid = floor(($l + $r ) / 2); \n //$Mmid = (($mid*($mid+1)/2)-$mid +1) ; \n $Mmid = ($k+$k -$mid +1)/2 *$mid ; \n if ($n <= $Mmid)\n {\n $r = $mid; \n }\n else\n {\n $l = $mid+1; \n } \n } \n }\n if($n==$k+1) $r = 1;\n if($n==1) $r = 0;\n // echo $l.PHP_EOL.$r.PHP_EOL;\n\n\n\n\n\n\n echo $r;\n ", "lang_cluster": "PHP", "tags": ["math", "binary search"], "code_uid": "3bb0db9d98ea542a85e1aa79f545a6b9", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b[$x + 1]) && ($c == 0))\n {\n $c = 2;\n }\n }\n elseif($c == 1)\n {\n if(($b[$x] < $b[$x + 1]) && ($c == 1))\n {\n $d = 1;\n break;\n }\n elseif(($b[$x] == $b[$x + 1]) && ($c == 1))\n {\n $c = 1;\n }\n elseif(($b[$x] > $b[$x + 1]) && ($c == 1))\n {\n $c = 2;\n }\n }\n elseif($c == 2)\n {\n if(($b[$x] < $b[$x + 1]) && ($c == 2))\n {\n $d = 1;\n break;\n }\n elseif(($b[$x] == $b[$x + 1]) && ($c == 2))\n {\n $d = 1;\n break;\n }\n elseif(($b[$x] > $b[$x + 1]) && ($c == 2))\n {\n $c = 2;\n }\n }\n}\nif($d == 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ddc25b27ded42b14c28f300c4cfa4a52", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if($b[$x] == \"1\")\n {\n $f++;\n }\n if(($b[$x] == \"1\") && ($e == \"0\"))\n {\n unset($b[$x]);\n }\n else\n {\n $e = 1;\n }\n}\nif($a == $f)\n{\n $f--;\n}\nfor($x = 0; $x < count($b); $x++)\n{\n if($b[$x] == \"0\")\n {\n $c++;\n $d = 1;\n array_push($g, $c);\n }\n if(($b[$x] == \"1\") && ($d == \"1\"))\n {\n $c--;\n }\n if($c < \"1\")\n {\n $d = 0;\n }\n}\nrsort($g);\nprint $g[0] + $f;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "dp", "implementation"], "code_uid": "d61b2691472344cd2b976583004af738", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $ans) $ans = $t;\n\t}\necho $ans;\n\t\n?>", "lang_cluster": "PHP", "tags": ["brute force", "dp", "implementation"], "code_uid": "426ae67e9e795523637dcc03adedcbe3", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$max) {$max=$c;} \n //echo $i.'-'.$j.'='.$c.\"\\n\";\n }\n\n}\necho $max;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "dp", "implementation"], "code_uid": "56e17746581ffe4b79e91686735b60b6", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $j-1) {\n $ones += $a[$k];\n }\n }\n $answer = max($answer, $ones);\n }\n}\n\nprint $answer;\n\nfunction line() {\n return trim(fgets(STDIN));\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "dp", "implementation"], "code_uid": "145c23562d49323ab2d3ecc2d32a05ff", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp", "implementation"], "code_uid": "769f33bb8f3bce4b21e486f432e087d5", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "4e4d252a5742142274bc2b0c8e7d8753", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25\n", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "197220f54e03cc353d0088da40660b4a", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "0cd08b42d02c7a033b6efeda384fb661", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "2b1e80d68517d347f1d9bf90cee5e84a", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "d3839bc4fec1a23982d529f488222a78", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "5d99a99c50e7c73b57d03bd73e37526c", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "b3eeca81dc6f9f4b4adaa7a3bbe508cc", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "a94d4a76b551b9a393ce79b0c301d659", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "3c78c1d53449b11a3343f0ea2c1e8ad7", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n $j = current($i);\n print $j;\n}\nelse\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "8a0c3133b6f9d80e290f33831a21f06b", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0) break;\n $t2[$k] = $d + $k*$c;\n if(in_array($t2[$k], $t1)){\n $ok = $t2[$k];\n }\n }\n return $ok;\n}\nlist($a, $b) = explode(\" \", trim(fgets(STDIN)));\nlist($c, $d) = explode(\" \", trim(fgets(STDIN)));\necho ab($a,$b,$c,$d);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "bf76582e0da62d3531545bafe1c08228", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d) {\n $d += $c;\n }\n else {\n $b += $a;\n }\n $i++;\n}\necho -1;", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "9c3638bdd60712ef8d55839ef03d48d5", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n reset($ee);\n echo current($ee);\n } else {\n echo \"-1\";\n }\n \n echo PHP_EOL;", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "f0b6af41778b3ff926ac0ccc073ef139", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "474e76948143b5336f05556f6c39bf58", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\n $d++;\n $n--;\n\n if (($d % $m)==0){\n $n++;\n }\n\n}\n\necho $d;\n\n\n\n\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "4a7fb1ca156de767e2b666ab19389ad2", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "53d9fa64e35b539686619abdf28913d1", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $n--;\n if (!($day % $m)) $n++;\n $day++;\n}\n\necho $day - 1;\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "09dc324cbef9419da6a0ca4f48dc3e45", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "17179b4aef3d3382d93355a8863f0393", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $out += $n;\n\n $ost += $n % $m;\n $n = intval( $n / $m );\n\n if ($ost >= $m) {\n $n ++;\n $ost -= $m;\n }\n}\n\necho $out;\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "9fe5a178f5707540a96be291a5dcea11", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2) {\n\techo \"YES\\n\";\n} else {\n\techo \"NO\\n\";\n}", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "0609c16100be42a58dc2a9c61a792bba", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "8143a6134e5b1760864ea4a195a1db55", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "ded185a036eed0d5d9de1da010c905e1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "2dd8704fd6b367795b405f5fea4675e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2 && $w % 2 == 0) echo \"YES\";\n\telse echo \"NO\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "937a4f81c313fc42944badbe5b54a760", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "2) {\n echo 'YES';\n} else {\n echo 'NO';\n}", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "6f8b9e3d8338de8f5ae63892d2c6a3e2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "2f66419551c776ccaa620b4f13b6e886", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "14e0d7694f6ed505b692d92f64018f39", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n\tif (intval($Line2[$place-1]) <= $value and $value!=0) {\n\t\t$advancers+=1;\n\t}\n}\n//print_r($Line2);\necho intval( $advancers);\n ?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d7614faab9efdc3b5c06d06a2d9b01a5", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $nums[$n[1]-1]) {\n $reg++;\n }\n }\n}\necho $reg;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b3151bc13866e065ac620e4db9e4c0b4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0; $i--) if ($arr[$i]==0) break;\n\telse if ($i>=count($arr)-$k) $ans++;\n\telse if ($arr[$i]==$arr[$i+1]) $ans++;\n\telse break;\n\techo $ans;\n\tfclose($file);\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e645c2faccbc421dc0242b48ff6f02f4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c && (int)$b[$i] < (int)$b[$c]) break;\n\tif((int)$b[$i] > 0 && (int)$b[$i] >= (int)$b[$c]) $n++;\n}\nprintf(\"%d\", $n);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d34fd9a10d590045db92425a0bcc2d50", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$less_score && $each>0)\n $winner++;\n}\n \necho $winner;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e3d23a8c17e7c64e8903399f57f2ac19", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$arr[$k-1] && $arr[$i] > 0)\n $c++;\n}\nprint ($c);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2ad5006565ab5d939fa768f5a5c497c4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) {\n\tfor ($i=$k; $i<=$n; $i++) {\n\t\tif ($points[$i] < $ptsToNextRound) {\n\t\t\tbreak;\n\t\t}\n\t\t$maxParticipants = $i;\n\t}\n}\n\n$cntToNextRound = 0;\nfor ($i=1; $i<=$maxParticipants; $i++) {\n\tif ($points[$i]>0) {\n\t\t$cntToNextRound++;\n\t}\n}\n\necho $cntToNextRound . PHP_EOL;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a68bbe75b56b4612b04e59a0af9ec9f8", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $template && $item > 0) ? true : false;\n});\necho count($result);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "23c03c91bbc972e4aa4d2e8ddfa7563e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\n if($input2[$x]>=$input2[$k-1]){\n $c++;\n }\n \n }\n}\necho $c;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a0d6e3a3797dcfc5fbbba730de84999c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$score)) $sum++; else;\n}\n\nfputs(STDOUT, \"$sum\");\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0a2cc6830bd9c7e0b1ea2b24d6b5ba10", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n $Ts /= $q;\n $t++;\n }\n\n echo $t;\n}\n\n$file = STDIN;\nlist($T, $S, $q) = explode(\" \", trim(fgets($file)));\npowCounter($T, $S, $q);\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "05706fc5b87df435899e1c1a35d04ee5", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n $Ts /= $q;\n $t++;\n }\n\n return $t;\n}\n\n//$file = fopen('input.in', 'r');\n$file = STDIN;\nlist($T, $S, $q) = explode(\" \", trim(fgets($file)));\necho powCounter($T, $S, $q);", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a549fecc6d2817147bd69d0d03129c25", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n $Ts /= $q;\n $t++;\n }\n\n echo $t;\n}\n\n//$file = fopen('input.in', 'r');\n$file = STDIN;\nlist($T, $S, $q) = explode(\" \", trim(fgets($file)));\npowCounter($T, $S, $q);\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "dbc21b7d149d7819a977f32bbba0b86f", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n $Ts /= $q;\n $t++;\n }\n\n return $t;\n}\n\n$file = STDIN;\nlist($T, $S, $q) = explode(\" \", trim(fgets($file)));\necho powCounter($T, $S, $q);", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f4793a133d6d8fa476f9070ccf7c0163", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bd04f25ac92a8a631b178a69ceaf7576", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2ea56eea8f5dbcb6c5e5e46b4ed50e1c", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "83209a8d760dfb5b77bea5734e96b135", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "465bc9ff862f77e36a128e97e2b8d475", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "be01029333ef866c6bf3fdb49d515706", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "30f596f52599daa87e5713302a2eab5a", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "906e5adc30ef88135591b224d13c6672", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d9a6bd597b3305762ef1a236b0362833", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0;$i--)\n\tif(($n-$i)%$m==0){\n\t\t$ans = (int)($n-$i);\n break;\n\t}\necho $ans;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "fc2cc3e46d9f999178a39a730e845eea", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "bc4a65e55a15721cc3c3db59522e7080", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "4ad3a22358d09c88fc3745ad6d0de076", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n){\n --$stairs;\n break;\n }\n ++$j;\n }\n while($j%$m){\n ++$j; \n }\n echo $j;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a909765d471116ae55dc9ede34fd8d63", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $i + $j))\n {\n $res = $i + $j;\n }\n }\n}\necho $res;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2d1b496743a7b5ae7633e369f3c52aa8", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "87fa8b4e10d180a70a511049ff4852fb", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "b89af6e0927edba5c4590461a6c1c200", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "a4d8d9ebdb353d15b84b28d8471c539d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "58b55d7dc0b314c637bc257ba1123b01", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1 )\n{\n echo intVal($s/2);\n}else{\n echo 0;\n}\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "b47829f6d085aed015486470dcc4ab8e", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n $stdIn[$key] = (int)$value;\n }\n }\n\n return $stdIn;\n}\n\nfunction stdOut($output)\n{\n fwrite(STDOUT, $output);\n}\n\nfunction solve(): void\n{\n [$m, $n] = getStdIn(true);\n $fields = (int)($m * $n / 2);\n stdOut($fields);\n}\n\nsolve();\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "61554b52a26879f62a5e5a842b3bd55a", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "9c62322e80b93dd97adacf659812d895", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0)&&($chek_x<=$max_x)&&($chek_y>=0)&&($chek_y<=$max_y)){\n if ($field[$chek_y][$chek_x]==\"W\"){\n $field[$chek_y][$chek_x]=\".\";\n $cnt++;\n break ;\n }\n }\n }\n }\n}\n \n$cnt=0;\nfor ($x=0;$x<$XX;$x++)\n for ($y=0;$y<$YY;$y++)\n Find_and_mark($x,$y,$XX-1,$YY-1,$cnt,$field);\n\necho $cnt; \n \n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5e1b77ef6a0e5cd68069481cf791e417", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "260f8f887c9091ef55d491d13289fcad", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "333b78b89a8854a09e321b475bbf4ca2", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9f2511fd4b8b55bc76c5b121a44f3177", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b9838d681b079523c3c0cc75635f7a01", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "747103bc26805576887a11e8f96201fd", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "03da5d2fdd5435c39643d626d9a6f546", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \"\", \"O\" => \"\", \"Y\" => \"\", \"E\" => \"\", \"U\" => \"\", \"I\" => \"\", \"a\" => \"\", \"o\" => \"\", \"y\" => \"\", \"e\" => \"\", \"u\" => \"\", \"i\" => \"\");\n\n$str = strtolower($str);\n$str = trim(strtr($str, \"AOYEUIaoyeui\", \" \"));\n$str = str_replace(\" \", \"\", $str);\n\nfor ($i = 0; $i < strlen($str); $i++)\n{\n $new_str .= \".\" . $str[$i];\n}\necho $new_str;\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "1d41d70eea1e738687398e7df6a662e5", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n{\n print \"0\";\n}\nelseif($c <= $d)\n{\n print \"-1\";\n}\nelseif($c > $d)\n{\n while(TRUE)\n {\n $a -= $d * 12;\n $a += $c * 12;\n $e++;\n if($a >= $b)\n {\n break;\n }\n }\n print $e;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a41af79b3f0eb225e8765f3eade51a1b", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1) {$j=7-$j; \nif(($j%2)==0) { print (($j/2).\"/\".\"3\");};\nif(($j%3)==0) { print (($j/3).\"/\".\"2\");};}\n?>", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "e94e885517d3a257edc6b0d2aa722ded", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $w) $m = $y; else $m = $w;\nswitch($m){\n case 1: print '1/1'; break;\n case 2: print '5/6'; break;\n case 3: print '2/3'; break;\n case 4: print '1/2'; break;\n case 5: print '1/3'; break;\n case 6: print '1/6'; break;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "128a811cd3b8e2ec23edeeafd29d65f4", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "aa7bb077cecb2dba14d259a69aa4da8b", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "565ddf9cd34c8be099c7d71aa9b8733c", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "4154c11287ea44fd48489b814b1d0b05", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "b7f5bbe05ef4f7fc7781e5c3f0078b93", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "49d30a3e7f252ff0cd87ea98ce6e5d14", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction nod($a, $b) {\n\twhile ($a <> 0 && $b <> 0) {\n\t\tif ($a > $b)\n\t\t\t$a = $a % $b;\n\t\telse\n\t\t\t$b = $b % $a;\n\t\t$nod = $a + $b;\n\t}\n\treturn $nod;\n}\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\tlist($n1, $n2) = readStringExplodeNum($f, ' ', true);\n\n\t$goodCnt = 6 - max($n1, $n2) + 1;\n\t$nod = nod($goodCnt, 6);\n\t$base = 6;\n\t$goodCnt/=$nod;\n\t$base/=$nod;\n\n\techo \"{$goodCnt}/{$base}\";\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "21ccb12b2f4d40c4ecbedc1be6a09c10", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "d1f0a4e4027740b72465f8202cfe84c1", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "='a' && $ss[$i] <= 'z')){\n\t\t\t$dd = false;\n\t\t\twhile (!($ss[$i] >='a' && $ss[$i] <= 'z'))\n\t\t\t\t$i++;\n\t\t}\n\t}\n\t//echo $ss.'|'.$s1.'|'.$s2.'
';\n\t$rec = 0;\n\t$i=0;\n\twhile ($s1[$i] == $s2[$i] && $i $s2[$i])\n\t\tprint '1';\n\telse\n\t\tprint '-1';\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "57eb2c5bee5de5fdc8d9f313442ece75", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ord($str2[$i])%32)\n\t{\n\t\techo \"1\\n\";\n\t\t$cndtn = 1;\n\t\tbreak;\n\t}\n}\n\tif($cndtn == 0)\n\t\techo \"0\\n\";\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "bc7305be527fbcc7388a218390b1d763", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n echo \"1\";\nelse\n echo \"-1\";\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "7e5ca3ef57b7bf3edf6a45b88b07e505", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n2) print 1;\nelse print -1;\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "55f50b846b8a1531c8c1ba5dc70af114", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $s2) {\n return 1;\n } else {\n return 0;\n }\n}\n\n$a = trim(fgets(STDIN));\n$b = trim(fgets(STDIN));\n\necho solution($a, $b);\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "1d95d474dbe7963e5ff609a04fd71155", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b)\n\techo 1;\nelse\n\techo -1;", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "8f54695bcf732220a0aa501e7a9481be", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ord($data[1][$i])) {\n $value = 1;\n break;\n } elseif (ord($data[0][$i]) < ord($data[1][$i])) {\n $value = -1;\n break;\n }\n }\n\n echo $value;\n}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b040d1563bf311a7d858adc830d6fcbc", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $secondString) ? '1' :\n ( ($secondString > $firstString) ? '-1' : '0' );\necho PHP_EOL;\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "58bb2fc583e5b61fb1e6b3a96a26586b", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "62bd99c669ebfc13e1100e1799f2d699", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $col[$i]){\n $t = $col[$i + 1];\n $col[$i + 1] = $col[$i];\n $col[$i] = $t;\n\n $end = false;\n }\n }\n}while(!$end);\n\n$col = array_reverse($col);\nw(implode(' ', $col));", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "8374b5f55c6688004d35e1d7d9649005", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $g)\n {\n $f[$x]++;\n }\n }\n $g--;\n}\nprint implode(\" \", $f);\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "a1401134a1797cb0122678e6da11a8b0", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "ecabfd571a553012ba3621051403b436", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1,\n// DURING => 1\n// );\n// $tb_arr = array(\n// FREQ => 1,\n// DURING => 1\n// );\n// $ta_start = 23 * 60 + 59;\n\necho get_count($ta_arr, $tb_arr, $ta_start) . PHP_EOL;\n\nfunction get_count($ta_arr, $tb_arr, $ta_start)\n{\n $tb_start = get_start($ta_start, $tb_arr);\n\n $ta_end = get_end($ta_start, $ta_arr[DURING]);\n\n $count = ceil(($ta_end - $tb_start) / $tb_arr[FREQ]);\n\n debug(\" check between time $tb_start and $ta_end. Initial count: $count\" );\n\n // meet at start staion\n if (is_station($ta_start-$tb_arr[DURING], $tb_arr[FREQ]))\n {\n $count--;\n }\n\n return intval($count);\n}\n\n// get the most recent meetable bus start time\nfunction get_start($start, $t_arr)\n{\n global $ts;\n\n if ($start - $t_arr[DURING] > $ts)\n {\n $start_time = $start - $t_arr[DURING];\n\n if ( (($start_time - $ts) % $t_arr[FREQ]) == 0)\n {\n return $start_time;\n }\n else\n {\n return $ts + ceil(($start_time - $ts) / $t_arr[FREQ]) * $t_arr[FREQ];\n }\n }\n else\n return $ts;\n}\n\nfunction get_end($start, $during)\n{\n global $te;\n\n if ($start + $during <= $te)\n return $start + $during;\n else\n return $te + 1;\n}\n\nfunction is_station($t, $freq)\n{\n global $ts, $te;\n\n if ($t<$ts || $t > $te)\n return false;\n\n if ((($t - $ts) % $freq) == 0)\n {\n debug(\"meet in station at time: $t, freq: $freq\");\n return true;\n }\n else\n return false;\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "96739907a3b89ede2664697aaf6d2902", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1439)\n {\n unset($h[$i - 1]);\n break;\n }\n else\n {\n $j += $c;\n $h[$i] = $j;\n $i++;\n }\n}\n$k = array_reverse($h);\n$l = array();\nfor($x = 0; $x < count($k); $x++)\n{\n $l[$x] = $k[$x] + $d;\n}\n$m = 0;\nfor($x = 0; $x < count($k); $x++)\n{\n if(($k[$x] < $g) && ($l[$x] > $f))\n {\n $m++;\n }\n}\nprint $m;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c69ebacf67a5107e26b19006a72ecc54", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1,\n// DURING => 1\n// );\n// $tb_arr = array(\n// FREQ => 1,\n// DURING => 1\n// );\n// $ta_start = 23 * 60 + 59;\n\necho get_count($ta_arr, $tb_arr, $ta_start) . PHP_EOL;\n\nfunction get_count($ta_arr, $tb_arr, $ta_start)\n{\n $tb_start = get_start($ta_start, $tb_arr);\n\n $ta_end = get_end($ta_start, $ta_arr[DURING]);\n\n $count = ceil(($ta_end - $tb_start) / $tb_arr[FREQ]);\n\n debug(\" check between time $tb_start and $ta_end. Initial count: $count\" );\n\n // meet at start staion\n if (is_station($ta_start-$tb_arr[DURING], $tb_arr[FREQ]))\n {\n $count--;\n }\n\n return intval($count);\n}\n\n// get the most recent meetable bus start time\nfunction get_start($start, $t_arr)\n{\n global $ts;\n\n if ($start - $t_arr[DURING] > $ts)\n {\n $start_time = $start - $t_arr[DURING];\n\n if ( (($start_time - $ts) % $t_arr[FREQ]) == 0)\n {\n return $start_time;\n }\n else\n {\n return $ts + ceil(($start_time - $ts) / $t_arr[FREQ]) * $t_arr[FREQ];\n }\n }\n else\n return $ts;\n}\n\nfunction get_end($start, $during)\n{\n global $te;\n\n if ($start + $during < $te)\n return $start + $during;\n else\n return $te;\n}\n\nfunction is_station($t, $freq)\n{\n global $ts, $te;\n\n if ($t<$ts || $t > $te)\n return false;\n\n if ((($t - $ts) % $freq) == 0)\n {\n debug(\"meet in station at time: $t, freq: $freq\");\n return true;\n }\n else\n return false;\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fb19db64df26abb82a3678fe34e2ffa0", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5f8772f949932d0bf437c5913647ba92", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "28586611fa391b00774e5348793c66f0", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6ecb1cfb9ce7f6c9bdefd24cd85d3ffa", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n if($s % 10 != 4 && $s % 10 != 7) \n return false;\n $s = intval($s / 10);\n }\n return true;\n}\n\nfscanf(STDIN, \"%s\", $s);\necho islucky(substr_count($s, '4') + substr_count($s, '7')) ? \"YES\" : \"NO\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "88792ef09cdae1a21777b4dab049b489", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 7){\n\t\t$digit = 0;\n\t\tbreak;\n\t}\n\telse if ($arr == \"4\" || $arr == \"7\")\n\t\t$digit++;\n}\nif ($digit == 4 || $digit == 7)\n\techo \"YES\";\nelse\n\techo \"NO\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "eec1bfa7d8d3c5a804b6aaca1d1c8b48", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) $A++;\n echo $A;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1bc7e52614e4eb065a19cdac1f58d782", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "33fb3f5d4ba81d3097893561a3743f9a", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1e4d53ffc41f3ccbf3205c62fcab2092", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e9d72a8ea0770bbbd33a358444511f3d", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "18628274fa6adb4968f0f8aa488c3200", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "cf489fd2782fbfc632f60e411a565422", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "83ed1860c0e754352b0ea43e568d81d4", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=1) {\n$str=str_replace(str_repeat(' ', $i), ' ', $str);\n$i--;\n}\n$str=trim($str);\necho $str;\n?>", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "5a7ec5c32f89ce2f8449dfb8ca6cc882", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "e7293e83beb28714c4249f20b21df0f5", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "cff8b53e441c731c0e27ea84f887fbe5", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "69f3a21575f6b2d25bc64733a973f8e9", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "56df2968b75a4645360dc61d76bfb096", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ad0fbe1c451d3035c7b9699459a60493", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "dfa086b56fedf505fadeb88e6f92ac04", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "40719a732083b6ce2854e23aa1dd8eea", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ? \"YES\" : \"NO\");\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6cfb39d957839ea47fa433827fae51c2", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e08939f816798d7c731b0bb0fe5aaa67", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "eff68db5666a2fc79c5246025a525c7a", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "be94e38b275959da64535d26bab79d43", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n\t\t$res = ($n % 2) . $res;\n\t\t$n = ($n - ($n % 2)) / 2;\n\t}\n\t$res = $n . $res;\n\t$res = str_repeat(\"0\", $dig - strlen($res)) . $res;\n\treturn $res;\n}\n\nfor ($i = 1; $i <= 9; $i++) {\n\tfor ($j = 1; $j <= 9; $j++) {\n\t\t$nums[] = str_repeat($i, $j);\n\t}\n}\n$nums[] = \"1000000000\";\n\nfor ($len = 2; $len <= 9; $len++) {\n\tfor ($i = 1; $i < pow(2, $len) - 1; $i++) {\n\t\t$j = tobin($i, $len);\n\t\tfor ($x = 1; $x <= 9; $x++) {\n\t\t\tfor ($y = 0; $y < $x; $y++) {\n\t\t\t\tif (($y != 0) || (substr($j, 0, 1) == \"1\")) {\n\t\t\t\t\t$s = \"\";\n\t\t\t\t\tfor ($k = 0; $k < strlen($j); $k++) {\n\t\t\t\t\t\t$s .= (substr($j, $k, 1) == \"1\" ? $x : $y);\n\t\t\t\t\t}\n\t\t\t\t\t$nums[] = $s;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n$raw = g();\n$n = $raw[0];\n\n$ct = 0;\nforeach ($nums as $val) {\n\tif ($n >= $val) {$ct++;}\n}\n\necho $ct;\n\n// End of submission file\n// Submission by chaotic_iak\n?>", "lang_cluster": "PHP", "tags": ["brute force", "dfs and similar", "bitmasks"], "code_uid": "b91643bc000305f6bbaa97ab689db9f3", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n) return 0;\n\tglobal $s;\n\tif (isset($s[$num]) == FALSE) {\n\t\t$s[$num] = 1;\n\t}\n\t$num = $num * 10;\n\tdfs($num + $i);\n\tdfs($num + $j);\n}\n\nfor ($i = 0; $i < 10; ++ $i) {\n\tfor ($j = 0; $j < 10; ++ $j) {\n\t\tdfs($i);\n\t}\n}\nprintf(\"%d\\n\", count($s));\n\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "dfs and similar", "bitmasks"], "code_uid": "ba1db65a0cc6c706a5bba7bb7c4df6c1", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a3b37a1ded147ee6ecba1ea88f0d9603", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $i -= $k) {\n $array[$i] = 0;\n }\n for ($i = $b; $i <= count($array); $i += $k) {\n $array[$i] = 0;\n }\n return abs(array_sum($array));\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "818741c0be006b29d19acae561e570b8", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\nfunction stdin() {\n $stdin = @fopen('data.txt', 'r');\n if (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n }\n\n return $stdin;\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\n$path = g();\n$path = preg_replace('/\\/{2,}/', '/', $path);\n\n$strlen = strlen($path);\nif(strlen($path) > 1 && substr($path, $strlen-1) == '/') {\n $path = substr($path, 0, $strlen-1);\n}\n\necho $path;\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9aa8176e1f4726c05701d3d6b5310b9d", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "033a5f90c11d8c5f0bc350372ee50942", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "286e7e6a08b470558b0cff5d93354a72", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bb07fb3da8a4ea44419f7f1cf25f2095", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "88b36f172324a7456d403ae23c3cb089", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "5ba219115bad14627d4db41c93437bff", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3b032174e247bff2d567b60ba4afa1a2", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0))\n{\n $e = abs($a) + $c;\n}\nelseif(($a >= 0) & ($c < 0))\n{\n $e = $a + abs($c);\n}\nelseif(($a >= 0) && ($c >= 0))\n{\n $e = max($a, $c) - min($a, $c);\n}\nif(($b < 0) && ($d < 0))\n{\n $a = abs($b);\n $c = abs($d);\n $f = max($b, $d) - min($b, $d);\n}\nelseif(($b < 0) && ($d >= 0))\n{\n $f = abs($b) + $d;\n}\nelseif(($b >= 0) & ($d < 0))\n{\n $f = $b + abs($d);\n}\nelseif(($b >= 0) && ($d >= 0))\n{\n $f = max($b, $d) - min($b, $d);\n}\nprint max($e, $f);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "102fc03cc932d6e544b08eb62f0d62e4", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $xx1) {\n echo $yy1;\n} else {\n echo $xx1;\n}", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7ba0f18d63603c504a3ef50ec4cb2f69", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a2627fadb58be22318398a403937a674", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= count($mas) - 1 - $i; $j--)\n {\n $pb += $mas[$i][$j];\n $mas[$i][$j] = 0;\n }\n}\n\n$seredina = floor($n / 2);\n\n for ($j = 0; $j < $n; $j++)\n {\n $gr_sr += $mas[$seredina][$j];\n $mas[$seredina][$j] = 0;\n }\n\n\n for ($i = 0; $i < $n; $i++)\n {\n $vr_sr += $mas[$i][$seredina];\n $mas[$i][$seredina] = 0;\n }\n\n\necho $gl + $pb + $gr_sr + $vr_sr;\n?> ", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e6ac0eaff927527101dc19bd30961f49", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e1c52a1191f9f69ce00e39c95642043f", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1a82a57e7eb81f69a3817268050cb2f7", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ef19bb9260e2641a81c51644ba3a0fff", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $arr[$idxMax] )\n\t $idxMax = $i;\n\tif( $arr[$i] < $arr[$idxMin] )\n\t $idxMin = $i;\n }\n \n $dis = abs($idxMax - $idxMin);\n for( $i = 0; $i < $n; $i++) \n if( abs( $i - $idxMin ) > $dis )\n\t $dis = abs( $i - $idxMin );\n\t\n for( $i = 0; $i < $n; $i++) \n if( abs( $i - $idxMax ) > $dis )\n\t $dis = abs( $i - $idxMax );\n printf(\"%d\",$dis); \n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "5af921cd5a0639641db0d156fc1672c8", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d)\n{\n $e = ($a - 1) - $d;\n print max($c, $e);\n}\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "b8110a51829df5efdce4a5617bf995e5", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "103076ff736b7193c715c3ad3671e235", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "57727d6348ee520a3c009c6e8c18a029", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "7b65b59f956bdc8b7513da622e761689", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $sVal){\n if($sVal == $aInTable[0] || $sVal == $aInTable[1])\n {\n $bExist = true;\n }\n }\n}\n\necho $bExist ? 'YES' : 'NO';", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "812e0b7d1ecf5f3e5489f7e5fb89d4f5", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "d89bff5093fffcde02bd93be79248089", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "69fa44caf4c80b276d14c1cc00b35caf", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "cd2492c227941b9b7772ff8f0fb8d260", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a1473025640d417a6eb69b1d65708c09", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "279700062a258291727d49bf58321409", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\".$ans[$i].\", \\n\";\n }\n}\n\nfunction GetSum(){\n global $prime;\n global $sum;\n global $p;\n $prime_len = count($prime);\n $cnt = 0;\n for($i = 0 ; $i < $prime_len ; $i++){\n if($p[$prime[$i] + $prime[$i+1] + 1]){ // 和也要是素数\n $sum[$cnt++] = $prime[$i] + $prime[$i+1] + 1;\n //echo \"sum = \".$sum[$cnt-1].\"\\n\";\n }\n }\n}\n\nfunction GetPrime(){\n global $prime; \n global $p;\n $end = 1e4;\n $p = memset($p,1 , $end);\n $p[1] = 0;\n for ($i = 2 ; $i < $end/2 ; $i ++){\n if($p[$i])\n for ($j = $i+$i ; $j < $end ; $j += $i){\n if($p[$j])\n $p[$j] = 0;\n }\n }\n $cnt = 0;\n for($i = 2 ; $i < $end ; $i++){\n if($p[$i]){\n $prime[$cnt++] = $i;\n //echo $i.\",\"; \n }\n } \n //echo \"count:\".count ($prime);\n}\n\n\n\nfunction memset($arr , $value , $length){\n for ($i = 0 ; $i < $length ; $i++){\n array_push($arr,$value);\n }\n return $arr;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "df5efe2ab898619cba3c08421e1e1513", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\nfunction stdin() {\n $stdin = @fopen('data.txt', 'r');\n if (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n }\n\n return $stdin;\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\nlist($n, $k) = explode(' ', g());\n\n$simple = array(3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097);\n\n$sum = 0;\n$temp = 2;\n\nforeach($simple as $item) {\n $number = $temp + $item + 1;\n\n if($number > $n) break;\n\n if(in_array($number, $simple)) $sum++;\n\n $temp = $item;\n}\n\necho $sum >= $k ? 'YES' : 'NO';\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "a8e2ac6cba73869750d1df7dcec4073d", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$explode[1]) $pos='YES';\n\t\t}\n\t\t}\n\t}\n\tif($k<$explode[1]) $pos='NO'; else $pos='YES';\n\tif($explode[1]==0)$pos='YES';\n\t $File = \"php://stdout\"; \n $Handle = fopen($File, 'w'); \n fwrite($Handle, $pos);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "592f17462c8ad20b296ca152d65eb832", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "89e7e0a89d68166ad2e6feabffeae5d0", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $primes[$length-1] ) {\n break;\n }\n if (in_array($primes[$i] + $primes[$i+1] + 1,$primes)) {\n $count++;\n }\n}\nif ($count>=$k) {\n echo 'YES';\n} else {\n echo 'NO';\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "f28977a002ca5cdea5663cdc7af3cfb0", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 25){echo \"YES\"; }else{ echo \"NO\";};", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b533624c0c06c225ab8a121df6f92f96", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "52ae697d737474e8b2a95cb7cae43b3d", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \n ", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "a1c3586130e13a4b8bfc1f191601deac", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2ec44be790ba140e01760542230aa9aa", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) $i++;\n\necho $i == 26 ? \"YES\" : \"NO\";\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "79855a0105263d3d15082a9685c81020", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=26) echo \"YES\";\nelse echo \"NO\";\n\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "98537e829ad8be99e93356b6f238916d", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d) {\n return -1;\n }\n\n $churu = 2 * (count($minutes)-1);\n $churu += intval(floor(($d-$devu)/5));\n\n return $churu;\n}\nlist($n, $d) = getIntList(2);\n$minutes = getIntList($n);\n$result = task($minutes, $d);\nanswer($result);", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "933cf34cd3bdfba2740d8b2401eb9e46", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n array_push($arr, $value);\n}\n\n// var_dump($arr,$n,$d);\n// echo stream_get_contents($dir);\n\nfunction devu($n,$d,$arr){\n $t = 0;\n $jok = -2;\n foreach ($arr as $key => $value) {\n $t += $value;\n $jok += 2;\n }\n $count = count($arr);\n $t = ($count-1)*10 + $t;\n if($d < $t)\n return -1;\n\n\n $l = intval(($d-$t)/5);\n\n $jok += $l;\n\n return $jok;\n}\n\necho devu($n,$d,$arr);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "b1abc778b6f1313f77b6254b683b3aee", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n array_push($arr, $value);\n}\n\n// var_dump($arr,$n,$d);\n// echo stream_get_contents($dir);\n\nfunction devu($n,$d,$arr){\n $t = 0;\n $jok = -2;\n foreach ($arr as $key => $value) {\n $t += $value;\n $jok += 2;\n }\n $count = count($arr);\n $t = ($count-1)*10 + $t;\n if($d < $t)\n return -1;\n\n\n $l = intval(($d-$t)/5);\n\n $jok += $l;\n\n return $jok;\n}\n\necho devu($n,$d,$arr);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5adffb432f37c75dc3e87e8e0e02a7f4", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d) {\n return -1;\n }\n\n $churu_jokes = ($songs -1 ) * 2;\n $churu_jokes += intval(floor($d - $party_time) / 5);\n\n return $churu_jokes;\n}\n\n\nlist($n, $d) = getIntList(2);\n$minutes = getIntList($n);\n\necho task($minutes, $d) . PHP_EOL;\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5e95368f02de1168f05abb7d0ef272b2", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n print \"-1\";\n}\nelse\n{\n $f = $b - $e;\n $g = floor($f / 5);\n $h = $d / 5;\n print $g + $h;\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "412d7c227b523922ae5399d236916844", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= (int)$restrict[$j][0] && $i + 1 <= (int)$restrict[$j][1] && (int)$restrict[$j][2] < $minn) {\n $profit = (int)$restrict[$j][2] * $restrict[$j][2];\n $temp = ($temp > $profit) ? $profit : $temp;\n $minn = $restrict[$j][2];\n $isrestrict = true;\n }\n }\n if (!$isrestrict) {\n $max += $hotel[1] * $hotel[1];\n } else {\n $max += $temp;\n }\n}\necho $max; // your code goes here \n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d1f51eed6ec1979e4262c055b25e016e", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= (int)$restrict[$j][0] && $i + 1 <= (int)$restrict[$j][1] && (int)$restrict[$j][2] <= $minn) {\n $profit = (int)$restrict[$j][2] * (int)$restrict[$j][2];\n if ($minn == (int)$restrict[$j][2]) {\n $temp = ($temp < $profit) ? $profit : $temp;\n } else {\n $temp = $profit;\n }\n \n $minn = (int)$restrict[$j][2];\n $isrestrict = true;\n }\n }\n if (!$isrestrict) {\n $max += $hotel[1] * $hotel[1];\n } else {\n $max += $temp;\n }\n}\necho $max; // your code goes here \n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d1700cf34346e28c87732f4816a656c6", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "445345c3f249f760f01c70d62c95e333", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "30498537c52f9ef1c70ad866984d7340", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a9dcdf15a889ae0202817ad130ba9a44", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings"], "code_uid": "1ce9b2735ecc17911086b446b15df70c", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;}\n\tpublic function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}\n\tpublic function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}\n\tpublic function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}\n}\n\n/* Perform action N times. Can return values in array */\nfunction ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}\n\n/* Integral. Keys preserved. By reference. */\nfunction cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}\n\n/* Difference. Keys preserved. By reference. */\nfunction diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}\n\nfunction bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}\n\nclass PrimeUtils {static protected $divisors = [1 => [1=>true],2 => [1=>true, 2=>true],];static protected $primes = []; \n\tstatic public function primes($limit){$a = str_repeat(chr(85), ($limit>>3) + 1);$a[0] = chr(83);for ($i=3; $i*$i < $limit; $i+=2) {if (ord($a[$i>>3]) & (1<<($i%8))) {;} else {for ($k=$i; $k*$i<$limit; $k++) {$n = $k*$i;$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));}}}yield 2;for ($i=3; $i<$limit; $i+=2) {if (!(ord($a[$i>>3]) & (1<<($i%8)))) {yield $i;}}}\n\tstatic public function divisors($n, $lp = 2) {if (isset(self::$divisors[$n])) {return self::$divisors[$n];}if (empty(self::$primes)) {$primes = [];foreach (self::primes(1e3) as $prime) {$primes[$prime] = $prime;}self::$primes = $primes;}$r = [];foreach (self::$primes as $p) {if ($p>=$lp) {if ($n < $p*$p) {$r = [1=>true, $n=>true];break;} elseif ($n%$p==0) {foreach([1, $p] as $pre) {foreach(self::divisors(intdiv($n,$p), $p) as $nxt=>$v) {$r[$nxt*$pre] = true;}}break;}}}self::$divisors[$n] = $r;return self::$divisors[$n];}\n}\n\n/*****************************************/\n\n$ir = new InputReader();\n\n/* TASK */\n\n$n = $ir->readInt();\n$a = $ir->readArrayOfInt($n);\n\nsort($a);\n$cnt = 0;\n\nfor ($i=0; $i", "lang_cluster": "PHP", "tags": ["sortings"], "code_uid": "241dc685bf9e832c01cb37b845d71d4c", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c57d37010c2e4183c0b0ea6429645d0a", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "71c99e263a4de3ce72997885cc2451dc", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n break;\n }\n}\n\nfor($i = 0; $i", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "513c8c75f75c7684f9192a9360000b8c", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';print_r($var);echo '';} \n function read_line()\n { \n if(DEBUG) { $file = $GLOBALS['file'];$line = trim(fgets($file));}\n else $line = trim(fgets(STDIN));\n return $line;\n }\n function get_array($line){return explode(' ', $line);}\n function read_array(){return get_array(read_line());} \n //echo \"$s\\n\";\n /*****************************************************************/\n \n $line1 = read_line();\n $line2 = read_line();\n $len = strlen($line1);\n \n for ($i=0; $i<$len; $i++)\n {\n $char1 = $line1[$i];\n $char2 = $line2[$i];\n \n if($char1 == $char2) echo '0';\n else echo '1';\n }\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2fa4a49781d2f721bd51cc5dc40aea09", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "8e3ab8efa11443645476701c5780748d", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "aa900bd2d62c20b06ac31507e942a5dd", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n \n $half = ceil($n/2);\n if($k<=$half){\n $num = 2*$k-1;\n }else{\n $num = 2*($k-$half);\n }\n echo $num.\"\\n\";\n }\n $n = $k = null;\n }\n ?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "9749abbeb72729f6c93e3210b14a0dd2", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n{\n printf(\"%.0f\", ($b - $c) * 2);\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "6edcb202b3bf3a923a543f7331ff3f95", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "1d966f2a4084d475cefefa2acc25adbb", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "2f702232ebf74bde8366fb4b799851d1", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "f5154cc230da9a2d5e62fcfc998235ce", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\n$stdin = @fopen('data.txt', 'r');\nif (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n/****************************************************** Solving block *****************************************************/\n$board = array();\n\nfor ($i = 0; $i < 8; $i++) {\n $board[] = g();\n}\n\n$xCnt = 0;\n$yCnt = 0;\nfor ($i = 0; $i < 8; $i++) {\n $xLine = 1;\n $yLine = 1;\n\n for ($j = 0; $j < 8; $j++) {\n if(substr($board[$i], $j, 1) == 'W') {\n $xLine = 0;\n }\n if(substr($board[$j], $i, 1) == 'W') {\n $yLine = 0;\n }\n }\n\n $xCnt += $xLine;\n $yCnt += $yLine;\n}\n\nif($xCnt < 8) {\n echo $xCnt + $yCnt;\n} else {\n echo 8;\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "7dfaca9c0cf15ac058701d5f5ba09a8c", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "4bdda571fb39fb42789c89fe1b254225", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "bc5b032234e948e72c25559deb53b18b", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "b73125c2c984942671b77e6cb846773d", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "873815654e2d0c817fd7fcde7e258bbb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "3e02ad9ec9716867e5e0d0f35b88fbd7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "53b303c62a2a85d4585c893990b31dbb", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "f9b3ebb367038513198102a98eb84abe", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $size) return ceil($m / $size);\n\tif ($m <= $size && $n > $size) return ceil($n / $size);\n\tif ($size == 1){ echo sprintf('%.0f', $m*$n); die; }\n\tif ($m > $size && $n > $size && $size != 1){\n\t\t$fulln = floor($n / $size);\n\t\t$fullm = floor($m / $size);\n\t\t$total = $fulln * $fullm;\n\t\tif ($n % $size != 0) $total += $fullm;\n\t\tif ($m % $size != 0) $total += $fulln;\n\t\tif ($n % $size != 0 && $m % $size != 0) $total++;\n\t\treturn sprintf('%.0f',$total);\n\t}\n}", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "0d695af86b8ef74d0d8b8177d608d172", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n*/\n?>\n\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "bff85bec0f05556a4fe250cf3d1aef69", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ba909bc4d79274a195992e4289c06c38", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b850ca296815d615a97d94b3be9b30d3", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d58e59f03291c5f99fc7326c50feddd3", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "2cfa5e92cd4a936b43e592d126a8c3c4", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "4e0b0486f421e6ea5f3b751f22e0eb6e", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "3341ce7c53f42b76af0c3d30809a3c06", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "tok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t$this->token = strtok($this->tok);\n\t\treturn $thisToken;\n\t} \n\t\t\n\tpublic function nextFloat() {\n\t\treturn (float)$this->nextToken();\n\t}\n\t\n\tpublic function nextInt() {\n\t\treturn (int)$this->nextToken();\n\t}\n}\n\nfunction solve(){\n\n/* basic coding (this code is not best, because changing token and float is not good)\n\t$vp = (float)strtok(rtrim(fgets(STDIN, 10), \"\\n\"), \" \");\n\t$vd = (float)strtok(\" \");\n\t$t = (float)strtok(\" \");\n\t$f = (float)strtok(\" \");\n\t$c = (float)strtok(\" \");\n*/\n\t//use Token class(advatage of using this class is changing token and float is more easy)\t\n\t//$Token = new Token(rtrim(fgets(STDIN, 5), \"\\n\"), \" \");\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$k = $Token->nextInt();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$l = $Token->nextInt();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$m = $Token->nextInt();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$n = $Token->nextInt();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$d = $Token->nextInt();\n\t\n\t$int_count = 0;\n\tfor ($i = 1; $i <= $d; $i++) {\n\t\tif ($i % $k === 0 || $i % $l === 0 || $i % $m === 0 || $i % $n === 0) {\n\t\t\t$int_count++;\n\t\t}\n\t}\n\t\n\tprintf('%d', $int_count);\n}\n\nfunction run(){\n\tsolve();\n}\n\nob_end_clean();\nrun();\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "758de3c939901ababe75880b243a9f94", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ? gcd($n, $m % $n) : $m;\n}\n\nfunction lcm($m, $n) {\n return $m / gcd($m, $n) * $n;\n}\n\n\nfscanf(STDIN, \"%d\", $k);\nfscanf(STDIN, \"%d\", $l);\nfscanf(STDIN, \"%d\", $m);\nfscanf(STDIN, \"%d\", $n);\nfscanf(STDIN, \"%d\", $d);\n$result = intval($d/$k) \n + intval($d/$l) \n + intval($d/$m) \n + intval($d/$n)\n - intval($d/lcm($k, $l))\n - intval($d/lcm($k, $m))\n - intval($d/lcm($k, $n))\n - intval($d/lcm($l, $m))\n - intval($d/lcm($l, $n))\n - intval($d/lcm($m, $n))\n + intval($d/lcm(lcm($k, $l), $m))\n + intval($d/lcm(lcm($k, $l), $n))\n + intval($d/lcm(lcm($k, $m), $n))\n + intval($d/lcm(lcm($l, $m), $n))\n - intval($d/lcm(lcm($k, $l), lcm($m, $n)));\necho $result.\"\\n\";", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "bdb144989070968a3c6b022e6b20bd89", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n\t\tif($input % $value == 0){\n\t\t\techo \"YES\";die();\n\t\t}\n\t}\n\techo \"NO\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "db6cf67b9908b64d3a0c8476d40e7f82", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0)echo \"YES\";\nelse echo \"NO\";", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "aa1f52db22f1b3e4536574c869f01675", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "3d89d3e01a10864548ea5df0d48344e7", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n echo (\"YES\");\n else \n echo (\"NO\");\n ", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "c9de2f5e1af0f31e3b3d70a8db415337", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "453450c3a7d191a87865c9c7adcd058e", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $p + 1; $i--){\n $stop = FALSE;\n for($j = 2 ; $j <= min(sqrt($i), $p); $j++){\n if($i % $j == 0){\n $stop = TRUE;\n break;\n }\n }\n if(!$stop){\n echo $i;\n exit;\n }\n}\necho '-1';", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "3d4dc57df6efc6d42a60ac0dad739b2e", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $p; $n--) {\n $b = true;\n if ($n%2 == 0) {\n continue;\n }\n for ($i = 3; $i <= $p; $i = $i+2) {\n if ($n/$i < sqrt($n)) {\n break;\n } else if ($n%$i == 0) {\n $b = false;\n break;\n }\n }\n if ($n > $p && $b) {\n $k = $n;\n break;\n }\n }\n\n echo $k;\n \n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "21ef3f3b214278b631e9fdd29fc9e29b", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 7) {print 'YES'; exit(0);}\n}\n\nprint 'NO';\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "118fccefd6896732634437c36072e30e", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b5c9cbacc88e15a55fab8c6a65f54873", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "13fc2c5e41e4560173db920a45e070c7", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "7240c99e7716df68e0b44ba1a32f5c70", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 7)\n {\n $flag = 1;\n break;\n }\n }\n if($flag == 0)\n echo \"NO\";\n else echo \"YES\";\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "7ed0e0f338eaba6136ba7ad440cebf69", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "290e13a20e4988b32853afc890c18785", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; ++$i,--$j) {\n if ( $line1[$i] !== $line2[$j]) {\n echo \"NO\";\n die();\n }\n }\n echo \"YES\";\n\n if (++$COUNT > 1) {\n break;\n }\n}\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "3020c8764ee2f330ce3c81a40896bc79", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "ce1c7c09ce0fa7ccc2ee6c5a4fc58acb", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "82bb38a72083fd4216ff143e09aa27d2", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $i--) { \n\t$reversed_word .= $word[$i];\n}\nif ($trans == $reversed_word)\n\techo \"YES\";\nelse\n\techo \"NO\";", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2bd530dc0e49b373992a67cf1dba0cfb", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2f994a2cef0ed3f9eb986294a3ac7421", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "reverse($str1, $str2);\n\n//\n//class CF41ATest extends PHPUnit_Framework_TestCase{\n// public function setUp(){\n// \n// }\n// \n// public function tearDown(){\n// \n// }\n// \n// public function testTranslation(){\n// $translation = new Translation();\n// $result = $translation->reverse('code', 'edoc');\n// $this->assertInternalType('string', $result);\n// $this->assertNotEmpty($result);\n// $this->assertEquals(\"YES\\n\", $result);\n// \n// \n// $result = $translation->reverse('abb', 'aba');\n// $this->assertInternalType('string', $result);\n// $this->assertNotEmpty($result);\n// $this->assertEquals(\"NO\\n\", $result);\n// \n// $result = $translation->reverse('code', 'code');\n// $this->assertInternalType('string', $result);\n// $this->assertNotEmpty($result);\n// $this->assertEquals(\"NO\\n\", $result);\n// }\n//}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "306ad87d72042bebc2afccc9528d6031", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "549bfeafc61f73c0f0f4bd4d0eaa177e", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "c98fa7d210f6f0817b39f3dca60184bb", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && abs($xy) <= $z)? '?' : ($xy < 0 ? '-' : ($xy > 0 ? '+' : '0'));\n", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "51453946124e456e44c9f5d13d104f6a", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) echo \"+\";\nelse echo \"-\";\n?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "1d627d236cf8d0a66f4e32886b39d2c7", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y + $z) {\n echo '+';\n} elseif ($y > $x + $z) {\n echo '-';\n} elseif ($z == 0) {\n echo '0';\n} else {\n echo '?';\n}", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "1b637258808490edeb27b17134af0b26", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $iDiv > $z){\n echo '+';\n} elseif($iDiv > 0 && $iDiv < $z){\n echo '?';\n} elseif ($iDiv > 0 && $iDiv <= $z){\n echo '?';\n}\n\n\nelseif ($iDiv == 0 && $iDiv < $z){\n echo '?';\n}\n\nelseif ($iDiv < 0 && abs($iDiv) > $z){\n echo '-';\n} elseif($iDiv < 0 && abs($iDiv) < $z){\n echo '?';\n} elseif($iDiv < 0 && abs($iDiv) <= $z){\n echo '?';\n}\n\n elseif ($iDiv == 0 && $z == 0){\n echo '0';\n}\n\n\n\n\n\n", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "18dfba599c5f42eff98d563ec7801d16", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n if($res > $a[2]) { echo '+';}\n elseif($res <= $a[2]) { echo '?';}\n } elseif ( $res < 0) {\n if(abs($res) > $a[2]) { echo '-';}\n elseif(abs($res) <= $a[2]) { echo '?';}\n } elseif( $res == 0) { echo '?';}\n } else {\n if ($res > 0) { echo '+';}\n elseif ($res < 0) { echo '-';}\n elseif($res == 0) { echo '0';}\n }\n \n\n ?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "74683d48fa9c3aa60ff2acb6c5d3b592", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b - $a)\n {\n print \"?\";\n }\n else\n {\n print \"-\";\n }\n}\nelseif($a == $b)\n{\n if($c == 0)\n {\n print \"0\";\n }\n else\n {\n print \"?\";\n }\n}\nelseif($a > $b)\n{\n if($c >= $a - $b)\n {\n print \"?\";\n }\n else\n {\n print \"+\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "0300905410cdeab70268048c5f365703", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $m && $p > $n2) {\n echo '+';\n} else if ($n1 < $m && $n2 > $p) {\n echo '-';\n} else {\n echo '?';\n}", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "cd93c973f23873827ad766bf5dd875f2", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y ? \"+\" : \"-\";\n }\n else\n {\n if($x > $y + $z) return \"+\";\n\n if($y > $x +$z) return \"-\";\n\n return \"?\";\n }\n\n}\n\n", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "518173e40d6d4e37f96de36d796bc8d2", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "e8d6f15147877a8ba9266523b32fbb5e", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "da9e5f22f0baa1b3849c73795fbd371d", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "3ef166a93ad3ca949ddc807339038847", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "05e26d3b5b5e0c7b6a32ea408bf9f533", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "9de0d3caf1590e698453be2d94bf1d7c", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "daf02d57b3c6c01ebe34a5614a408789", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f7345ac98edce3853bfb6c24f93f8774", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "5b2de3ef2f666b187ed2ed62bc474a23", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "b029638e0e4b2ab18d023fb8103c722c", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $out = '1' . str_repeat('+1' , $c1 - 1);\n}\n\nif ($c2 > 0) {\n if (strlen($out) > 0) {\n $out .= str_repeat('+2' , $c2);\n } else {\n $out = '2' . str_repeat('+2' , $c2 - 1);\n }\n}\n\nif ($c3 > 0) {\n if (strlen($out) > 0) {\n $out .= str_repeat('+3' , $c3);\n } else {\n $out = '3' . str_repeat('+3' , $c3 - 1);\n }\n}\n\necho $out;\n\n?>", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "cbd57297ac58741e22dd8a0942a535ad", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "66a0f90d754618e1e77f8baca1b4680a", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "0e4d5f5e2982967aae115fa0d3e08aa3", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "69cfbd33dd0d9d6585506d1c71e43838", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6f5c2ce2fa45ac9680ca9dcffe311cce", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c5e04cc833d6726cd53cda176ef626c2", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fe3984c19e4b3d3779a267f3f2bc5427", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d0d046ebce205cc1da9dba17424fd32a", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\";\n }\n return $num;\n}\n \n// keep this function call here\n$file = fopen('php://stdin', 'r');\n// $file = fopen('input.txt', 'r');\n$str = fgets($file);\n$arr = explode(' ', $str);\necho wrongSubtraction($arr[0], $arr[1]); \n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bac40ea7baba048f6a54e5c29d3bf6a0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "66ecb3b4a859f9e6eff409fa10c155cf", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 100) { \n $n -= 100;\n }\n else if ($n >= 20) { \n $n -= 20;\n }\n else if ($n >= 10) { \n $n -= 10;\n }\n else if ($n >= 5) { \n $n -= 5;\n }\n else if ($n >= 1) { \n $n -= 1;\n }\n $total++;\n}\n\necho $total;\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "d2342a0a4c30408915fb7de5ac2b81b2", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=20)\n{\n $n-=20;\n $sum++;\n}\nwhile($n>=10)\n{\n $n-=10;\n $sum++;\n}\nwhile($n>=5)\n{\n $n-=5;\n $sum++;\n}\n$sum+=$n;\n\necho $sum;\n\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "fa8b5ebe13954113ada5e45a2ff75613", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0; $i--){\n $result+=floor($arr[0]/$note[$i]);\n $arr[0]%=$note[$i];\n }\n \n echo $result;\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "e876bb64dadf9400a7c1d30bffad1e96", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 100)\n{\n $c = floor($a / 100);\n $a %= 100;\n $b += $c;\n}\nif($a >= 20)\n{\n $c = floor($a / 20);\n $a %= 20;\n $b += $c;\n}\nif($a >= 10)\n{\n $c = floor($a / 10);\n $a %= 10;\n $b += $c;\n}\nif($a >= 5)\n{\n $c = floor($a / 5);\n $a %= 5;\n $b += $c;\n}\nif($a >= 1)\n{\n $c = floor($a / 1);\n $a %= 1;\n $b += $c;\n}\nprint $b;\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "61daa950a4e687b8b016d9bf01266daf", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "c1edcd6cbd68fc472b546cd1d0f2c818", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "04a6892848d305a014148ec0cf76742a", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "e91a8e385ab0a321ca437ec889942de2", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "2d083ad499a89d0c5f4b51d38bc66781", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "840f78e9de0ea8aea2caec072677e483", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y ){\n\n preg_match_all('/[0-9]/',$new_year,$m);\n $m = array_unique($m[0]);\n\n if( strlen($y) == sizeof($m) ){\n echo implode('',$m);\n break;\n }else{\n $new_year++;\n }\n}\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "3a2db1fc03674b6b5fb62f00ab07a563", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "884177b7a7185999c5c821f57589309e", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $count1){\n $b=false;\n }else {\n $i++;\n }\n }\n echo $i;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b20dc48ffcc747dd2f35638581ad192b", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "301e9768db471df173526d5e644014f7", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $k = $max;\n } else {\n $sum2 = 0; \n foreach ($a AS $i) {\n $sum2 += ceil(abs($r / $n)) + $max - $i;\n }\n if ($sum2 == $sum) {\n $k = ceil(abs($r / $n)) + $max +1;\n } else {\n $k = ceil(abs($r / $n)) + $max;\n }\n }\n \n echo $k;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "28f77cc1b46fef2bb7b7bcadfe67130e", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n break;\n }\n else\n {\n $d++;\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "8082282ada43c336c8746fe7a2465b43", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $k = $max;\n } else {\n $sum2 = 0; \n foreach ($a AS $i) {\n $sum2 += ceil(abs($r / $n)) + $max - $i;\n }\n if ($sum2 == $sum) {\n $k = ceil(abs($r / $n)) + $max +1;\n } else {\n $k = ceil(abs($r / $n)) + $max;\n }\n }\n \n echo $k;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "4524050b5dd28db6460dab286e17a307", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $count1){\n $b=false;\n }else {\n $imax++;\n }\n }\n echo $imax;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "9d027ecdf59d6b78ee9d957aa52b979f", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $count1){\n $b=false;\n }else {\n $i++;\n }\n }\n echo $i;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7a9842617c9995174e547e9b154b30ad", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "8db524b0c352c378b49006221521de80", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "735c78c075e9b4a1d3649f98fae66a6d", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1 ) {\n $col += $a;\n $end += $a % $b;\n $a = intval($a / $b);\n\n if (($end / $b) >= 1) {\n $a += ($end - ($end % $b)) / $b;\n $end = $end % $b;\n }\n}\n\necho $col;\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "26ef518cec871eb05f5dbe5a2bf181a9", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n\t$n+= $a;\n\t$c+= $a;\n\n\t$a = floor($c / $b);\n\t$c = $c % $b;\n}\n\nprint $n;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "96cf3bba25a37dc669a34bb75bd16014", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\n $time = $a + $time;\n $os = $os + $a;\n $a = 0;\n\n $a = floor($os/$b);\n $os = $os % $b;\n }\n\n echo $time;\n\n\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "dc1da4b1b3f8d5f8272950d1728aa7f5", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $step)\n return $count + RecCount((int) (($count + $free) / $step), $step, ($count + $free) % $step);\n return $count;\n}\necho RecCount($a, $b, 0);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "69036999f61766bf756c4e00afa04174", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b) {\n $answer += intval($a / $b);\n $a = intval($a / $b) + ($a % $b);\n}\n\nprint $answer;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "372ce9892d1b9525dfe24228dec2221b", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ab51a88784e11eb22bb52a4042b18330", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $m){\n\t$count += floor($sisa / $m) * $m;\n\t$sisa = floor($sisa / $m) + ($sisa % $m);\n}\necho $count + $sisa;\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "95be3cdc1a2503f5823128ff8bdd830f", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $c = intVal($a / $b);\n $h += $c;\n \n $a -= $c * $b;\n $a += $c;\n}\n\necho $h;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f159d62ffc6dc5d983767ad35a78b305", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b){\n $a += $left;\n $left = 0;\n }\n\n $left += $a % $b;\n $a = intdiv($a, $b);\n// echo $a . \"\\n\";\n\n\n}\nif($left >= $b){\n $count++;\n}\necho $count;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6420fb68b5d185a6e713a00506ac2336", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "ec413ff47b5ec6a433f02f51f57b0d7d", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "a3a3668b0afbe8f9577fa4e65e19fcf3", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "03672850dc20de81ed5814f38db6b17b", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "ee97ef7d4f4727d7c037bb98f19de078", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "da33f7c2931e5cb84afa8e546b5c9f85", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 4) $i=5;\n elseif ($dis > 3) $i=4;\n elseif ($dis > 2) $i=3;\n elseif ($dis > 1) $i=2;\n else $i=1;\n\n walk($dis-$i, $w+1);\n }\n walk($dis,$w);\n\n\n if ((--$count) == 0) {\n break;\n }\n}\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "a35e6852f5fe3c4af7671471178849b3", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 4) $i=5;\n elseif ($dis > 3) $i=4;\n elseif ($dis > 2) $i=3;\n elseif ($dis > 1) $i=2;\n else $i=1;\n\n return walk($dis-$i, $w+1);\n }\n put(walk($dis,$w));\n\n\n if ((--$count) == 0) {\n break;\n }\n}\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "ba1c3725941b7ef55ec37cb20a318e67", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i) {\n $x -= $i;\n $s += 1;\n }\n}\necho $s;\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "7af93bcfd80fafda86fe7c43cbf4c36b", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $i--) {\n $walk += floor($nr / $i);\n $nr = $nr % $i;\n}\n\necho $walk;", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "bd1186f77b25275b5033e2129db6b993", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "9ef16fa0eca1c25dd1c98158dc691457", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "d802575d2966f471e1dc8783aaeab5b6", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a)\n {\n $b -= $c;\n print $a - $b;\n break;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "88b9a71e900dd982a4c264f8888708db", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "65b594de0cf4f18904bd8b2897bc4bf2", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test)\n\t\t$stream = $f;\n\telse\n\t\t$stream = STDIN;\n\t/* begin body */\n\tlist($price, $r) = readStringExplodeNum($stream, ' ', true);\n\tfor ($i = 1; $i <= 10; $i++) {\n\t\t$amount = $i * $price;\n\t\t\n\t\tif ($amount % 10 == $r || $amount % 10 == 0) {\n\t\t\techo $i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "ee8cf51c51f6db973de7353a41255a93", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "e28a70c136a0aee9980dc994ae5c34c2", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "2341856ea5916e25c9b5393d0dfcf5fe", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "14372f47d06fc381f69a21082a0993ca", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max) {\n $max = intval(substr($string, 0, strlen($string)-1));\n}\n$lastChar = $string[strlen($string)-1];\n$temp_string = substr($string, 0, strlen($string)-2);\nif (intval($temp_string.$lastChar) > $max) {\n $max = intval($temp_string.$lastChar);\n}\n\necho $max.\"\\n\";\n", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "2822342c7d8a7620282905d18ace42dc", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "(substr($account,0,-1)))$account = substr($account,0,-2).substr($account,-1);\n else $account = substr($account,0,-1);\n}\nif ($account==-0)$account=0;\necho $account;", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "45e7825a5479ea7c144a44e4bb0f2ccf", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $input[$ch - 2]) {\n print(substr($input, 0, $ch - 1));\n } else {\n $res = str_split($input);\n if ($ch == 3 && $res[$ch-1] == 0) {\n $res[0] = \"\"; \n } else {\n //\n }\n $res[$ch - 2] = \"\";\n print(implode($res));\n }\n} else {\n print($input);\n}", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "6120753f7a0b570727e8ea8e5ebdc7c3", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0)\n{\n print $a;\n}\nelseif(($a < 0) && (strlen($a) == 2))\n{\n print \"0\";\n}\nelseif(($a < 0) && (strlen($a) > 2))\n{\n $b = str_split($a);\n $b = array_slice($b, 1);\n $c = $b;\n unset($c[count($c) - 1]);\n unset($b[count($b) - 2]);\n $f = \"-\" . implode($c);\n $g = \"-\" . implode($b);\n if($f == \"-0\")\n {\n $f = 0;\n }\n if($g == \"-0\")\n {\n $g = 0;\n }\n if($f >= $g)\n {\n print $f;\n }\n else\n {\n print $g;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "a40666cb7c798d5db383372953a7ecfd", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0) {\n echo $deposit;\n} else {\n if (abs($deposit) >= 100) {\n $deposit_without_to = floor(abs($deposit) / 100);\n } else {\n $deposit_without_to = \"\";\n }\n $tens_ones = abs($deposit) % 100;\n $tens = floor($tens_ones / 10);\n $ones = $tens_ones % 10;\n if ($tens >= $ones) {\n $tens = \"\";\n } else {\n $ones = \"\";\n }\n if (\"-\" . $deposit_without_to . $tens . $ones == \"-0\")\n {\n echo \"0\";\n } else {\n echo \"-\" . $deposit_without_to . $tens . $ones;\n }\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "b3935a9487d574e6d1937cbaeb074ff8", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$x && $y>=$z) $x = $y;\n if ($z>=$x && $z>=$y) $x = $z;\n\n\n}\n\nif ($x!='-0')\necho $x;\nelse echo 0;", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "81a145e06cda257609f704d805048914", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n\t{\n\t\t$needArrow = true;\n\t\tfor ($j = 1; $j <= $shift; $j++)\n\t\t{\n\t\t\t$leftPage = $currentPage - $j;\n\t\t\t$result = \"$leftPage \" . $result;\n\t\t\tif ($leftPage === 1)\n\t\t\t{\n\t\t\t\t$needArrow = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ($needArrow)\n\t\t{\n\t\t\t$result = '<< ' . $result;\n\t\t}\n\t}\n\n\t# making right\n\tif ($currentPage < $totalPages)\n\t{\n\t\t$needArrow = true;\n\t\tfor ($j = 1; $j <= $shift; $j++)\n\t\t{\n\t\t\t$nextPage = $currentPage + $j;\n\t\t\t$result .= \" $nextPage\";\n\t\t\tif ($nextPage === $totalPages)\n\t\t\t{\n\t\t\t\t$needArrow = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ($needArrow)\n\t\t{\n\t\t\t$result .= ' >>';\n\t\t}\n\t}\n\treturn $result;\n}\n\n\nfwrite(STDOUT, getResult(fgets(STDIN)));", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "68cc07403d47dd517b53a64d310ce34d", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1){\n array_push($result, '<<');\n for($i=$p-$k; $i<$p; $i++){\n array_push($result, $i);\n }\n}else{\n for($i=$p-$k; $i<$p; $i++){\n if($i > 0)\n array_push($result, $i);\n }\n}\narray_push($result, \"($p)\");\nif($p + $k < $n){\n for($i=$p+1; $i<=$p + $k; $i++){\n array_push($result, $i);\n }\n array_push($result, '>>');\n}else{\n for($i=$p+1; $i<=$p + $k; $i++){\n if($i <=$n)\n array_push($result, $i);\n }\n}\n\nprint(implode(' ', $result));", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0f299b8aabf1951e3cdc37a0c4bb8a93", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": ">\n * Когда посетитель кликает кнопку \"<<\", он переходит на страницу 1; \n * когда посетитель кликает кнопку \">>\", он переходит на страницу n. \n * Если посетитель кликает некоторое число, он переходит на соответствующую страницу.\n * \n * Чтобы навигация по сайту выглядела более презентабельно, требуется, чтобы выполнялись условия:\n * Если страница номер 1 отображается в навигации, то кнопку \"<<\" отображать не надо.\n * Если страница номер n отображается в навигации, то кнопку \">>\" отображать не надо.\n * Если номер страницы меньше 1 или больше n, ее в навигации отображать не надо. \n * \n * Вам заданы числа n, k, p. Помогите ainta, напишите программу, \n * которая выведет строку навигации по заданным параметрам. \n * Обратите внимание на тестовые примеры для лучшего понимания условия.\n * \n * Входные данные\n * В первой и единственной строке содержатся три целых числа n, p, k (3 ≤ n ≤ 100; 1 ≤ p ≤ n; 1 ≤ k ≤ n)\n * \n * Выходные данные\n * Выведите надлежащую строку навигации. Следуйте формату вывода из тестовых примеров.\n*/\n\ndefine('DEBUG', 0);\n\nfunction doLog($log) {\n\tif (DEBUG) {\n\t\techo \"[\" . microtime(true) .\"] \" . $log;\n\t}\n}\n\nfunction solve($n, $p, $k) \n{\n\t$leftPagesCount = min($k, $p-1);\n\t$rightPagesCount = min($k, $n-$p);\n\t$leftTags = ($leftPagesCount < $p-1);\n\t$rightTags = ($rightPagesCount < $n-$p);\n\t\n\t\n\t$elements = [];\n\t\n\t// fill elements list\n\tif ($leftTags) {\n\t\t$elements[] = '<<';\n\t}\n\t\n\tif ($leftPagesCount > 0) {\n\t\tfor ($i = $leftPagesCount; $i>0; $i--) {\n\t\t\t$elements[] = $p-$i;\n\t\t}\n\t}\n\t\n\t$elements[] = \"($p)\";\n\t\n\tif ($rightPagesCount > 0) {\n\t\tfor ($i = 1; $i<=$rightPagesCount; $i++) {\n\t\t\t$elements[] = $p+$i;\n\t\t}\n\t}\n\n\tif ($rightTags) {\n\t\t$elements[] = '>>';\n\t}\n\t\n\treturn implode(' ', $elements);\n}\n\nlist($n, $p, $k) = explode(' ', trim(fgets(STDIN)));\n\n$result = solve($n, $p, $k);\n\ndoLog($result . \"\\n\");\n\necho $result;\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8b59ddf79bdab70b0d7c2fb7b1f57407", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n print \"NO\";\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7c1806ced68ac7eaf2bb5d91447a2512", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0){\n\t\n\t$c++;\n\t$r -= $c*5;\n}\n\necho min($n, $c-1);\n\n\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "feae3b37d2c2fb48f16d97319bf993a8", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n break;\n }\n}\nprint min($a, $d - 1);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "f2aad6332997dea7b5fa9967cce08cd9", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 240) break;\n\t\t$c = $i;\n\t}\n\techo $c;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "9d4054c69c7be81102ba569f3e9a820d", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $p && $n > 0) {\n $ans++;\n $n--;\n $t -= $p;\n $p += 5;\n }\n\n echo $ans;\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "add2ce29011823d32352f5958879b72d", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "e7d9f2ddd56fa5b1bddab083e4187681", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$cntL)echo strtoupper($str);\nelse echo strtolower($str);", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "6185a1f26440bbc58aed5a26c5c7a3a7", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " (strlen($str) - $upper) ? strtoupper($str) : strtolower($str));\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "06d670ee917a6cb15abf48b465bbd784", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$cnt1)\n\techo strtolower($str);\nelse\n echo\tstrtoupper($str);", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "d8dedbcbaf45c5ec8baf4dfadae00d61", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=ord(\"a\")?$cnt++:\"\";\necho $cnt>=(strlen($s)-$cnt)?strtolower($s):strtoupper($s); \n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "c2536367f6cae88b746ff2e084fc00f9", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $toUpper){\n $str = strtoupper($str);\n}\nelse{\n $str = strtolower($str);\n}\necho($str);\n\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b6836c294599d4fef0e9d30548d9187a", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "='a' && $c <= 'z') $count_lower++;\n}\n$count_upper = strlen($line) - $count_lower;\nif($count_lower >= $count_upper){\n echo strtolower($line);\n}else{\n echo strtoupper($line);\n}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "23410992dfcd914e5428a356c5d34d8e", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " strlen($str) / 2)\n $str = strtoupper($str);\nelse\n $str = strtolower($str);\n \necho $str\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "8a1a2d79b80389dea0ea79bdb7ace9f6", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "d54fb8f4a0d94676d95c40696e2e28a2", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $totalPages ) {\n echo $i+1;break;\n }\n }\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7ce6565c0e65ca423e69cded69f68d0c", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val) {\n// echo \"fruits[\" . $key . \"] = \" . $val . \"\\n\";\n//}\n\n$fr = fopen(\"php://stdin\", \"r\");\n$n = (int) fgets($fr);\n$arr = fgets($fr);\nfclose($fr);\n$arr = explode(' ', $arr);\n\n$sum = 0;\nfor ($i = 0; $i < 7; $i+= 1) {\n// $arr[$i] = (int) $arr[$i];\n $sum+=$arr[$i];\n}\n$mod = $n % $sum;\nif($mod==0)\n $mod=$sum;\n$sum2=0;\n//echo $mod;\nfor ($i = 0; $i < 7; $i+= 1) {\n $sum2+=$arr[$i];\n if($sum2>=$mod)\n break;\n}\necho $i+1;\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "364c30a68933806a0f4d1d2db2987369", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n $n -= $mas[$i];\n $k = $i + 1;\n if ($i + 1 == count($mas))\n $i = -1;\n\n $i++;\n \n}\necho $k;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1cbea93f6956c0a6eb24a1be0de018e0", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val) {\n// echo \"fruits[\" . $key . \"] = \" . $val . \"\\n\";\n//}\n\n$fr = fopen(\"php://stdin\", \"r\");\n$n = (int) fgets($fr);\n$arr = fgets($fr);\nfclose($fr);\n$arr = explode(' ', $arr);\n\n$sum = 0;\nfor ($i = 0; $i < 7; $i+= 1) {\n $arr[$i] = (int) $arr[$i];\n $sum+=$arr[$i];\n}\n$mod = $n % $sum;\nif($mod==0)\n $mod=$sum;\n$sum2=0;\n//echo $mod;\nfor ($i = 0; $i < 7; $i+= 1) {\n $sum2+=$arr[$i];\n if($sum2>=$mod)\n break;\n}\necho $i+1;\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ac08ff5f3aca6aedf93f930d9bb0a487", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "6)\n $i = 0;\n $counter += (int)$page_reading_speed[$i];\n }\n echo ($i+1);\n exit;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7eb29f88fad250ed080202c1bfdd1b8b", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n if($i == 7) $i = 0;\n $n = $n - $w[$i];\n $i++;\n}\necho $i . PHP_EOL;\nexit;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7b0226f5a2ccb5e2a0e0a2c0231c7759", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n $total+=$value;\n if($total>=$page_in_week){\n $res = $key+1;\n $check=true;\n break;\n }\n }\n}else {\n foreach($day as $key => $value) {\n $total+=$value;\n if($total>=$du){\n $res = $key+1;\n break;\n }\n }\n}\necho $res;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4107e543ed7cf18a530569686c689832", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$mod)\n break;\n}\necho $i+1;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1c84dd6f9c5bb4d19ff1f1fae865dcda", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e30bdc067c65099cd6a2fd7fd8b1ec22", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $y--)\n{\n if($c[$y] == 1)\n {\n break;\n }\n}\n$d = array_slice($c, 0, $y + 1);\nif(count($c) == 0)\n{\n print \"0\";\n}\nelse\n{\n $e = count($d);\n $f = 0;\n $g = 0;\n for($x = 0; $x < $e - 1; $x++)\n {\n if(($d[$x] == 0) && ($d[$x + 1] == 0))\n {\n $f++;\n $g = 1;\n }\n elseif($g == 1)\n {\n $f++;\n $g = 0;\n }\n }\n print $e - $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6bfc3801a6c74f5d46b386ea5e7390cf", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $puzzles_sets[$j+1]) {\n $buf = $puzzles_sets[$j+1];\n $puzzles_sets[$j+1] = $puzzles_sets[$j];\n $puzzles_sets[$j] = $buf;\n }\n }\n}\n$arr_min = array();\nfor ($i = 0; $i < $m - $n + 1; $i++) {\n $arr_min[$i]['difference'] = $puzzles_sets[$i+$n-1] - $puzzles_sets[$i];\n $arr_min[$i]['first'] = $i;\n}\n$min = min($arr_min);\n$res = $min['difference'];\nprint($res);", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "ade94e0d67c44328c87cadf33ad03202", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "776ecf7f3be45e5f2d02272d1fd0bf68", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "a68a310620fd4b1c7fe74b6628f01f50", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "d02d68980dfff98e43930f57fceb648d", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "eceac61f7228e350d1050a04836690ae", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $y--)\n {\n $g -= $x;\n if(((($f * $d) + ($g * $e)) == $a) && (($f + $g) == $b))\n {\n $h = 1;\n break;\n }\n }\n if($h == 1)\n {\n break;\n }\n $g = $b;\n }\n for($x = 1; $x <= $f; $x++)\n {\n array_push($i, $d);\n }\n for($x = 1; $x <= $g; $x++)\n {\n array_push($i, $e);\n }\n for($x = 0; $x < count($i); $x++)\n {\n if($i[$x] == \"2\")\n {\n $j++;\n }\n }\n print $j;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "fc434e4e3589a53d7f90023db3f4d8d3", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1,'.'=>-1);\n$s = '';\nfor($i =0;$i<4;$i++)\n\t$s .= trim(fgets(STDIN));\nfor($i=0;$i<3;$i++)\n\tfor($j=0;$j<3;$j++)\n\t\tif(abs($m[$s[$i*4+$j]]+$m[$s[$i*4+$j+1]]+$m[$s[($i+1)*4+$j]]+$m[$s[($i+1)*4+$j+1]])>=2&&$a = \"YES\")\n\t\t\tbreak 2;\necho $a;\nreturn;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "997c3e76cae95ddede871a01fb561a6c", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3) || ($p >= 3))\n {\n $r = 1;\n break;\n }\n else\n {\n $o = 0;\n $p = 0;\n }\n}\nif($r == 1)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "efbbe97f86f0658aed162ea5db3f51ed", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3 || ($a[$i][$j] == '.') + ($a[$i+1][$j] == '.') + ($a[$i][$j+1] == '.') + ($a[$i+1][$j+1] == '.') >= 3) {\n\t\t\t\t$chk = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\techo ($chk) ? 'YES' : 'NO';\n?> ", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "bbe5d360274d655e92945fbe62127e31", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "185a87cdc79ab8edb9aff77962200d4c", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3|| $tmp <= 1){\n\t\t\t\t$ok=true;\n\t\t\t//\tprint(\"yes\");\n\t\t\t}\n\t\t}\n\t//\tprint_r($pre);\n\t\tfor ($i=0;$i<$sz;++$i) $pre[$i] = $cur[$i];\n\t//\tprint_r($pre);\n\t}\n\n\techo($ok==true ? \"YES\":\"NO\");\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "1dd80d051a40c093612272d6c7ecb137", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "f4c8926508ed3781a1def54c982e7711", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d30e1e6baa16b21df7aa7c7ccaa787c3", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ba07ef510404bdd578ba907653838d1f", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "9b4642d7274fd6a9aee21c24c145a2ea", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "1d601a0af32ec380d5add6063b501556", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "ddeddd91e49cf9907472e9ef11433751", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "20e80e5341db319fcc404bdb1b45941c", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "644f07e18d8d4ab0d590d4ef9e2c471b", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $longestWordLength) {\n $longestWordLength = strlen($word);\n \n }\n}\necho $longestWordLength.\" \".$countword2;\n?>", "lang_cluster": "PHP", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "607b0396d7e927737bebdf422df50139", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction pass_compare($p1, $p2) {\n\t$l1 = strlen($p1);\n\t$l2 = strlen($p2);\n\tif ($l1 > $l2) {\n\t\treturn 1;\n\t} elseif ($l1 < $l2) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test)\n\t\t$stream = $f;\n\telse\n\t\t$stream = STDIN;\n\t/* begin body */\n\treadString($stream);\n\t$baseStr = readString($stream) . '_';\n\t$len = strlen($baseStr);\n\n\t$isInS = false;\n\t$maxWord = '';\n\t$wordsInS = array();\n\t$isDoingWord = false;\n\t$currentWord = '';\n\tfor ($i = 0; $i < $len; $i++) {\n\t\tif (in_array($baseStr[$i], array('(', ')', '_'))) {\n\n\t\t\tif (!empty($currentWord)) {\n\t\t\t\tif ($isInS) {\n\t\t\t\t\t$wordsInS[] = $currentWord;\n\t\t\t\t} elseif (strlen($currentWord) > strlen($maxWord)) {\n\t\t\t\t\t$maxWord = $currentWord;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$isDoingWord = false;\n\t\t\t$currentWord = '';\n\t\t\tif ($baseStr[$i] == '(') {\n\t\t\t\t$isInS = true;\n\t\t\t} elseif ($baseStr[$i] == ')') {\n\t\t\t\t$isInS = false;\n\t\t\t}\n\t\t} else {\n\t\t\t$isDoingWord = true;\n\t\t\t$currentWord.=$baseStr[$i];\n\t\t}\n\t}\n\techo strlen($maxWord) . ' ' . count($wordsInS);\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "ad8c433dfdb26bf84c4b47ebca280477", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "ee95e0ebd73e8714481166eeae7344e1", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5f99e4737fd30bece28b675e11298f05", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=2)\n {\n $a[0]-=$m;\n $x=$a[0];\n $y=$b[0];\n for($i=1;$i<$n;$i++)\n {\n $a[$i-1]=$a[$i];\n $b[$i-1]=$b[$i];\n } \n if($x>0)\n {\n $a[$n-1]=$x;\n $b[$n-1]=$y;\n } \n else\n {\n $n--;\n }\n }\n echo $b[0]+1;\n ?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "aa5d9ea564fee6e17dae6c4860eb630c", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n $c[$y] -= $b;\n }\n else\n {\n array_unshift($d, $y + 1);\n $c[$y] = 1000000;\n } \n }\n $e = array_unique($d);\n if(count($e) == $a)\n {\n break;\n }\n}\nprint $d[0];\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ab181ed5f5362239a8a7ce2d78d13273", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "6bb0f589454710f354f106b8f3ed275b", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "28144215a7fee82e1264e5540e364967", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "1b653239cb81c445b40806957b1b17f8", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "d8fab0e300593718ef0591319d5badfa", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "3236ed4bf74386f1dce3b7fa2a8f133b", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "ea37f7d4b04b7ade861f7b4987cead13", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "c3bf7539aa82cc9f7016c79dea4d9036", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "ab58fed29c41096becb238799afab48a", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \"Sheldon\", 2 => \"Leonard\", 3 => \"Penny\", 4 => \"Rajesh\", 5 => \"Howard\");\n\n$n = (int) fgets($inputStream);\n\n$out = $ret[f($n)];\nfwrite($outputStream, $out);\n\nif (getenv('APPLICATION_ENV') == 'development') {\n fclose($inputStream);\n fclose($outputStream);\n}", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "90bf98c5121308a0808a459f3ed7d5d1", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $base){\n $N -= $base;\n $base *= 2;\n}\nprintf(\"%s\\n\",$Ans[getAns($N,$base)]);\n\n/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2439c176f0a54a307043c79c1dc1c860", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 5)\n{\n $a -= 5;\n $a /= 2;\n}\n\necho $mas[$a];\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "fb49a1807010207f6b5c08811152d4c5", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "5) { $n -= 5; $n /= 2; }\nprint $a[ceil($n)-1];", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "24d77b4cec63827d752296b35155dafe", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';print_r($var);echo '';} \n function read_line()\n { \n if(DEBUG) { $file = $GLOBALS['file'];$line = trim(fgets($file));}\n else $line = trim(fgets(STDIN));\n return $line;\n }\n function get_array($line){return explode(' ', $line);}\n function read_array(){return get_array(read_line());} \n //echo \"$s\\n\";\n /*****************************************************************/\n \n $n = read_line();\n //$n = 1802;\n \n $people[] = 'Sheldon';\n $people[] = 'Leonard';\n $people[] = 'Penny';\n $people[] = 'Rajesh';\n $people[] = 'Howard'; \n \n if($n<=5)\n {\n echo $people[$n-1];\n die;\n }\n \n $k=1;\n $sum = 5;\n $sum_next = 15;\n \n while($sum_next<$n)\n { \n $k++;\n $sum = $sum_next;\n $sum_next = $sum + 5*pow(2,$k);\n }\n \n $o = $n-$sum;\n \n $k = pow(2,$k);\n \n $a = ceil($o/$k);\n echo $people[$a-1];\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "49c40c80d8b6499ad0694e470cc74edc", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $i_d){\n\t\t$c = $c - $i_d;\n\t\t$i_d = $i_d * 2;\n\t}\n\telse{\n\t\t\n\t\t$where = ($c / ($i_d/5));\n\t\tif($where <= 1){echo \"Sheldon\";}\n\t\telseif($where <= 2){echo \"Leonard\";}\n\t\telseif($where <= 3){echo \"Penny\";}\n\t\telseif($where <= 4){echo \"Rajesh\";}\n\t\telseif($where <= 5){echo \"Howard\";}\n\t\telse{echo \"erorrr\";}\n\t\tgoto end;\n\t}\n\t\n}\nend:\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ef0a7de61756eadbe45119ca94c91e50", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $min) {\n if ($level) {\n $pow *= 2;\n }\n \n $min = 10 * $pow - 5;\n $level++;\n}\n\nwhile ($in + $pow <= $min) {\n $min -= $pow;\n $result--;\n}\n\necho($names[$result]);", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "0f9e3169d0156cfd04806bdc5b7d54f0", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $min) {\n $min = 10 * pow(2, $level) - 5;\n $level++;\n}\n\n$range = pow(2, $level - 1);\n\nwhile ($in + $range <= $min) {\n $min -= $range;\n $result--;\n}\n\necho($names[$result]);\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "8e57b8f2138f90147058876f8d1ee970", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 8)\n {\n $b -= 8;\n $d += $c[$x] - 8;\n }\n else\n {\n $d += $c[$x];\n if($d > 8)\n {\n $b -= 8;\n $d -= 8;\n }\n else\n {\n $b -= $d;\n $d = 0;\n }\n }\n if($b <= 0)\n {\n $e = 1;\n break;\n }\n}\nif($e == 0)\n{\n print \"-1\";\n}\nelse\n{\n print $x + 1;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c918b71f3222ba26123df82699049f9b", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "8){\n\t\t$sum+=8;\n\t\t$arr[$i+1]+=($arr[$i] - 8);\n\t}\n\telse{\n\t\t$sum+=$arr[$i];\n\t}\n\t//print $sum . ' ';\n\tif($sum>=$val[1]){\n\t\t$hold = $i+1;\n\t\tbreak;\n\t}\n\n}\nprint $hold;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "345a25c5aa452b8d5edb4c1d6892cac0", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "068c3e9abbea1547dbc7245922c0a307", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "88e90d5893d33e23a8807f31ac916a80", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5dc634c162396c198ca7fa5c8af1404c", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n ", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e53b382183bab2e5c83858209b7f1bf6", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3f16f67d699dd39311c54a005aea2357", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9483bb94f8deca50641d098ba533d7dd", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $out = 'First';\n} else {\n $out = 'Second';\n}\n\necho $out;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "bcc5f24d7c8d4158be576d3407a249e2", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $n2 > 0);\n\nif ($n1 == 0)\n\t$result = 'Second';\nelse\n\t$result = 'First';\n\n\nfprintf(STDOUT, $result);", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "ca0e101cd0162c09e119b7bd35ebf573", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $n1) {\n echo \"Second\\n\";\n} else {\n echo \"First\\n\";\n}", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "031bdee4d97793674c5bd1ee83a63726", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n{\n print \"Second\";\n}\nelse\n{\n print \"First\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "525c9378f1953ce30ab3133c2271df05", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n2 ? \"First\" : \"Second\") . PHP_EOL;\n\nfunction getLine()\n{\n return trim(fgets(STDIN));\n}", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "aea84ecc62895f3d3e37397adbdf494e", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n2 ? \"First\" : \"Second\");\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "6dd04cfe81801a559c2f4a177da0f2ce", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $prompt[1]) {\n echo \"First\";\n}else{\n echo \"Second\";\n}", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "c1d41d9a72e64f4ece8610b97de7adfc", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "39790cc078a9aa6b8b493c9fb1441ad2", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0){\n $a = $n;\n $b = $k[$cur];\n if ($a > $b) $a ^= $b ^= $a ^= $b;\n for($i = $b; $i >= 1; $i--) \n if(($b%$i==0)&&($a%$i==0)) {$turn = $i; break;}\n if($turn<=$n) {$n-=$turn; $cur ^= 1;} else break; \n }\n $cur ^= 1;\n echo $cur;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "52ee239f2e00e60843dc689cfd36e736", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $j) return gcd($i % $j, $j); else return gcd($i, $j % $i);\n}\n\nlist($a, $b, $n) = explode(' ',trim(fgets(STDIN)));\n\n$r = 1;\nwhile($n > 0){\n if($r == 1) $n -= gcd($n, $a); else $n -= gcd($n, $b);\n $r = 1 - $r;\n}\n\nprint $r;\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2645971c562cdc3fce2453cf3aa9b99b", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n if(!$player) {\n $c = $a;\n } else {\n $c = $b;\n }\n $n -= NWD($c, $n);\n $player = !$player;\n}\n\necho intVal(!$player);\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8ff70e396e1fcf30bcb534c1a9e5e0ca", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b)\n $a -= $b;\n else\n $b -= $a;\n return $a;\n}\nfunction lite($a,$b,$n){\n $f=nod($a,$n);\n if (($n-$f)==0) return 0;\n $f1=nod($b,$n-$f);\n if (($n-$f-$f1)==0) return 1;\n return lite($a,$b,$n-=($f+$f1));\n} \nprint lite($a, $b, $n);\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "029b543be8abbd7d545cb78588cdd17d", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a) {$tmp=$b; $b=$a; $a=$tmp; unset($tmp);}\n if ($b==0) $b=$a;\n while ($a%$b>0){\n $r=$a%$b;\n $a=$b;\n $b=$r; \n }\n return $b; \n }\n //\n \n while (1==1){\n $nod=gcd($a,$n);\n $n=$n-$nod;\n if ($n<0) {print(1); break;}\n \n $nod=gcd($b,$n);\n $n=$n-$nod;\n if ($n<0) {print(0); break;}\n }\n \n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0885d5415c02af865b76d5f9447d8f21", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "e6a6b084fc0e8243438cd2a5d1f3d9f1", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "6691d5734a6790023d0720db9ee91b6d", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "215f4e690fc2f02f3263c9031a36ee4c", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "79897c50a8d157a42e6648164853ba33", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b0a98a611658d761c9aa7da910384626", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d94408637b365d5f4482c9c2a4d460af", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4a9e80b9b1d5af63ddc04e1372a2a431", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n $q = $x % 10;\n $x /= 10;\n if($q == 0) continue;\n $res += $q * $pow;\n $pow *= 10;\n }\n return $res;\n }\n //$in = fopen(\"input.in\", \"r\");\n $in = fopen(\"php://stdin\", \"r\");\n $x = fgets($in);\n $y = fgets($in);\n \n if(f($x) + f($y) == f($x + $y)) echo \"YES\";\n else echo \"NO\";\n \n fclose($in);\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f3d62e0a2a05e5073c90e39b188297ba", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "#!/usr/bin/php\n", "lang_cluster": "PHP", "tags": ["greedy", "strings", "implementation"], "code_uid": "44f46f02ca239f2ff8cc807667813c20", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "'w','w'=>'e','e'=>'r','r'=>'t','t'=>'y','y'=>'u','u'=>'i','i'=>'o','o'=>'p','p'=>'a','a'=>'s','s'=>'d','d'=>'f','f'=>'g','g'=>'h','h'=>'j','j'=>'k','k'=>'l','l'=>';',';'=>'z','z'=>'x','x'=>'c','c'=>'v','v'=>'b','b'=>'n','n'=>'m','m'=>',',','=>'.','.'=>'/','/'=>'q'];\n$array2=array_flip($array);\nfor ($i=0; $i ", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "819131b274d2f4aa4233e8f992101323", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3c9d3a70382e0378506b69f79c975032", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3d1bf095e50a806f2929b15f1e62e03e", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$key) {\n $keysindex[$key] = $index;\n}\n \n \nif($shift == \"L\") {\n foreach(str_split($str) as $char) {\n echo $keysraw[$keysindex[$char]+1];\n }\n} \n\nif($shift == \"R\") {\n foreach(str_split($str) as $char) {\n echo $keysraw[$keysindex[$char]-1];\n }\n} \necho \"\\n\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "342cd1eafbfd4e42bf30ccfba4fa9308", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b665ba990495c1660d66b2759c2d2906", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0 && $i + $t < count($keys))\n $mapp[$keys[$i]] = $keys[$i + $t];\n }\n \n $in = str_split(fgets(STDIN));\n \n $out = \"\";\n \n for ($i = 0; $i < count($in); ++$i) {\n $out .= $mapp[$in[$i]];\n }\n \n echo $out;\n \n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "246dc082535f2915bed6db3ecc42c723", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6d57034f290f292aa06340dda2072234", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $x--)\n{\n $d = $a % $x;\n $e = $a / $x;\n if(($d == 0) && ($e != 1))\n {\n $c[count($c)] = $e;\n }\n}\nfor($x = 0; $x < count($c); $x++)\n{\n $f = $c[$x];\n $g = substr($b, 0, $f);\n $h = strrev($g);\n $i = substr($b, $f);\n $b = $h . $i;\n}\nprint $b;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fa941342be26c04c9945b8eea5dbad35", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "67eec583c0470211dd9fa5c6f1eceea3", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "5df12ae2892bd6b4a5629c4cf8ed692d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "7d312476aec47d796d58edcbe274ebb9", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "8971c64c754761274097ec37559339cb", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "5e6a55f83c93609997559ec5bcb787bf", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "f28b446f923708b358244aafade74471", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "60be02eae7cd927dbeb3188a6dc85076", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 4,\n\t2 => 4,\n\t3 => 4,\n\t4 => 4,\n\t5 => 4,\n\t6 => 4,\n\t7 => 4,\n\t8 => 4,\n\t9 => 4,\n\t10 => 15,\n\t11 => 4,\n);\n\nif (isset($map[$num])) {\n\techo $map[$num];\n} else {\n\techo 0;\n}\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "66bb02468a0ef3db143d6fcdeb6e439c", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e71ca2e34cddd3bc5d83abae0d552e53", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n {\n print \"15\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "164b34e47c4912a8aa3379e5cb4217ca", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n for ($i = $a; ; $i++) {\n $c++;\n if ($i > $n) $i = 1;\n if ($c == $b) {\n $k = $i + 1;\n if ($k == $n + 1) $k = 1;\n break;\n }\n }\n} else if ($b < 0) {\n for ($i = $a; ; $i--) {\n $c++;\n if ($i == 0) $i = $n;\n if ($c == abs($b)) {\n $k = $i - 1;\n if ($k == 0) $k = $n;\n break;\n }\n }\n} else if ($b == 0) {\n $k = $a;\n}\nprint $k;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7ae936cb4a0d6a0a3bfc768857d49682", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n $d -= $b;\n $e = $d % $a;\n if($e == 0)\n {\n print $a;\n }\n else\n {\n print $a - $e;\n }\n }\n}\nelseif($c == 0)\n{\n print $b;\n}\nelseif($c > 0)\n{\n $d = $a - $b;\n if($c <= $d)\n {\n print $b + $c;\n }\n elseif($c > $d)\n {\n $c -= $d;\n $e = $c % $a;\n if($e == 0)\n {\n print $a;\n }\n else\n {\n print $e;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "8f09e4bb4ae51822faeba43e3facce4e", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "92af8ea8c6353e4bd35470fbd8991656", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n print $c;\n}\nelseif($a == 2)\n{\n $e = $b;\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n print $c;\n}\nelseif($a == 3)\n{\n $e = $b;\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n print $c;\n}\nelseif($a == 4)\n{\n $e = $b;\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 1)\n {\n $c++;\n $b -= 1;\n $d = floor($b / 5);\n $c += $d;\n }\n print $c;\n}\nelseif($a == 5)\n{\n $e = $b;\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 1)\n {\n $c++;\n $b -= 1;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 5)\n {\n $d = floor($b / 5);\n $c += $d;\n }\n print $c;\n}\nelseif($a > 5)\n{\n $e = $b;\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 1)\n {\n $c++;\n $b -= 1;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 5)\n {\n $d = floor($b / 5);\n $c += $d;\n }\n $f = floor($a / 5);\n $g = $a % 5;\n $c *= $f;\n if($g == 1)\n {\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n }\n elseif($g == 2)\n {\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n }\n elseif($g == 3)\n {\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n }\n elseif($g == 4)\n {\n $b = $e;\n if($b >= 4)\n {\n $c++;\n $b -= 4;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 3)\n {\n $c++;\n $b -= 3;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 2)\n {\n $c++;\n $b -= 2;\n $d = floor($b / 5);\n $c += $d;\n }\n $b = $e;\n if($b >= 1)\n {\n $c++;\n $b -= 1;\n $d = floor($b / 5);\n $c += $d;\n }\n }\n print $c;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "number theory"], "code_uid": "6bf99713ab89d2aa92be6c5b7edc0f8a", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "number theory"], "code_uid": "4a25702bcd9a08012114aca25057f1c2", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "68ba9f66644f68dbe66fbb5b699cddba", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bc68583a4adc6b46980228c5999a8cbe", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\n\t\techo $sum/5;\n\t}\n\telse{\n\t\techo \"-1\";\n\t}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2165e1ef736a2c4e8bd73560940159f2", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && !($sum % 5) ? $sum / 5 : '-1';\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "654409e10c2b0865d6e52d802e5fe168", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n echo $sum / 5;\n}else{\n echo -1;\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6b9ff799fb25e60c722071b18d0789ef", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $s % 5 == 0)\n {\n fprintf(STDOUT, \"%d\\n\", $s / 5);\n }\n else {\n fprintf(STDOUT, \"-1\\n\");\n }\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c01b732da7420b51a1f4f1697b2e7875", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2b854a87b95dc517340f034d10fb2255", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "28a4239a06fb4f60f35d884e0457e2cb", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "af5f90557ddc60d2ea9af6d181de4756", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c5e5d1fb740408e61ec030f7b6e9b017", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3)) {\n $contador = $contador - 2;\n }\n\n if (($values[$x] != \"x\") && $aux < 3) {\n $contador = $contador - $aux;\n }\n if (($values[$x] != \"x\")) {\n $aux = 0;\n }\n\n}\nif ($aux < 3 && $values[$longitud - 1] == \"x\") {\n $contador = $contador - $aux;\n}\n\nif ($aux >= 3 && $values[$longitud - 1] == \"x\") {\n $contador = $contador - 2;\n}\n\necho $contador;\n", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "e3a2e48452665b5bc1b8d702b78c4e05", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2)\n\t\t$x++;\n}\necho $x;\n?>", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "9088b08eb6712f78544985aa853e17ba", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "solution($data1, $data2);\n\n// End of interface\n\n\nclass MainClass {\n\t// 978В.File name\n\t//public $problemLink = 'https://codeforces.com/problemset/problem/978/B';\n\t//public $submissionLink = '';\n\n\tpublic function solution($n, $string)\n\t{\n\t\t$res=0;\n\t\t$counter=0;\n\t\tfor ($i=0; $i<$n; $i++){\n\t\t\tif ($string[$i] === 'x'){\n\t\t\t\t$counter++;\n\t\t\t} else {\n\t\t\t\t$counter=0;\n\t\t\t}\n\t\t\tif($counter>2){\n\t\t\t\t$res++;\n\t\t\t}\n\t\t}\n\t\treturn $res;\n\t}\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "5ebecea7ac9bb5958365c6f6ec28c716", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "1c899e586d4d6ca988ff2487342b99cd", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "solution($data1, $data2);\n\n// End of interface\n\n\nclass MainClass {\n\t// 978В.File name\n\t//public $problemLink = 'https://codeforces.com/problemset/problem/978/B';\n\t//public $submissionLink = '';\n\n\tpublic function solution($n, $arrayOfStrings)\n\t{\n\t\t$res=0;\n\t\t$counter=0;\n\t\tforeach ($arrayOfStrings as $value){\n\t\t\tif ($value === 'x'){\n\t\t\t\t$counter++;\n\t\t\t} else {\n\t\t\t\t$counter=0;\n\t\t\t}\n\t\t\tif($counter>2){\n\t\t\t\t$res++;\n\t\t\t}\n\t\t}\n\t\treturn $res;\n\t}\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "ce81467586216d02bef7db5445c1436a", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "solution($data1, $data2);\n\n// End of interface\n\n\nclass MainClass {\n\t// 978В.File name\n\t//public $problemLink = 'https://codeforces.com/problemset/problem/978/B';\n\t//public $submissionLink = '';\n\n\tpublic function solution($n, $string)\n\t{\n\t\t$res=0;\n\t\tfor ($i=0; $i<$n; $i++){\n\t\t\tif (substr($string, $i-1, 3) === 'xxx'){\n\t\t\t\t$res++;\n\t\t\t}\n\t\t}\n\t\treturn $res;\n\t}\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "58a01c3e14a9c372f71a669864f57b43", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2) {\n $total += $sum - 2;\n }\n $sum = 0;\n }\n}\nif ($sum > 2) {\n $total += $sum - 2;\n}\n\necho $total;", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "4d98566dcc7622fa984b4639ae0e0283", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "b9b0dabf901de9372d6625df5cd88c74", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n{\n $d = $a + ($b - $a); // min\n}\nelse\n{\n $d = $a; // min\n}\nif(($a == 0) && ($b != 0))\n{\n print \"Impossible\";\n}\nelse\n{\n print $d . \" \" . $c;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "69ad9ee35f08a586659ba53c66b474eb", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\n$max=$grown_ups+$children-1;\nif($children==0)$max=$grown_ups;\necho max($grown_ups,$children).' '.$max;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "710dff8b52386f9c033f443f55947389", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\n$min=$Parent;\nif($Childs>$Parent){$min=$Childs;}\n$max=$Parent;\nif($Childs>0)$max+=$Childs-1;\necho $min.' '.$max;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "8a2a9f4252a08c19cee19c5a9e774123", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\n$d=$a+$b-1;\nif($b==0)$d=$a;\necho max($a,$b).' '.$d;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "97778c5cf890cd4b0f8705b54b526b58", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n{\n $d = $a + ($b - $a); // min\n}\nelse\n{\n $d = $a; // min\n}\nif(($a == 0) && ($b != 0))\n{\n print \"Impossible\";\n}\nelse\n{\n print $d . \" \" . $c;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "fc3ed66e287a1179bb0a916337f8eebd", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n echo 'Impossible';\n return;\n}\n\n$min = $Parent;\nif ($Childs - $Parent > 0) $min += $Childs - $Parent;\n\n$max = $Parent;\nif ($Childs > 0) $max += $Childs - 1;\n\necho $min . ' ' . $max;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "2f425ef746b3472de10515d5279243dc", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $Parent)\n $min = $Parent + ($Childs - $Parent);\nelse\n $min = $Parent;\n\nif ($Parent == 0 && $Childs != 0)\n echo \"Impossible\";\nelse\n print $min . ' ' . $max;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "041a5b87322a2607bd26defe96f7d1b9", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\n$d=$a;\nif($b>0)$d+=$b-1;\necho max($a,$b).' '.$d;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "5981ba9f952ffea3c17efcbd1e62f77d", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\nif($b!=0)$d=$a+$b-1;else$d=$a;echo max($a,$b).' '.$d;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "dbfa901b8aba4fe3c982d591c14687ff", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){echo'Impossible';return;}\n$c=$a;\nif($b>$a){$c=$b;}\n$d=$a;\nif($b>0)$d+=$b-1;\necho$c.' '.$d;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "ac31f63282c7ef5f9655dea376b70921", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n {\n $e = $b % $x;\n if($e == 0)\n {\n $c++;\n }\n }\n}\nprint $c;\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "2b4f556d05f62b13806c36fece16a73f", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "1a799b65159e007c1bcda7334d301dc4", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $d) && ($g <= $d + $e))\n{\n $h = $d + $e;\n $i = $h - $g;\n print number_format(($a / $c) + $i, 8, \".\", \"\");\n}\nelseif($g > ($d + $e))\n{\n $h = $g % ($d + $e);\n print number_format(($a / $c) + $h, 8, \".\", \"\");\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "217273b406e852de2d975eb58352156a", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $g - $EPS ? $T - $t : 0.0));\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b2f188b7295185867f0cd778c4ddfbe3", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1, 3 => 1, 5 => 1, 7 => 1, 9 => 1);\n$c = array(\"a\" => 1, \"e\" => 1, \"i\" => 1, \"o\" => 1, \"u\" => 1);\n$d = 0;\nfor($x = 0; $x < strlen($a); $x++)\n{\n if(($b[$a[$x]] == TRUE) || ($c[$a[$x]] == TRUE))\n {\n $d++;\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "aa80b463ffe6d46ad407cc555d159d8a", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $h[$x + 1])\n {\n $i = 1;\n }\n}\nif($e != count($d))\n{\n print \"need tree\";\n}\nelseif(($e == count($d)) && ($e != count($c)) && ($i != 0))\n{\n print \"both\";\n}\nelseif(($e == count($d)) && ($i != 0))\n{\n print \"array\";\n}\nelseif(($e == count($d)) && ($i == 0))\n{\n print \"automaton\";\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "5a6633890f4494b3aba717321850cc47", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0))\n{\n $a += 3;\n print \"1 \" . ($a - 3) / 2;\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "a4aad2f8a3caf073c36fdb7e01b6a7cd", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $sum){\n fwrite($stdout, 0); \n}else{\n fwrite($stdout,$sum - $n);\n}\n\nfclose($stdin);\nfclose($stdout);\n \n ?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "df98bfc19dd1b5908572d9ec0049e5bd", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n) {\n\techo $s - $n;\n} else {\n\techo 0;\n}", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "e2d36a47b7e058e024c49f4b0b253a1a", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0) {\n \n return ($sum - $m);\n \n }else {\n \n return 0;\n \n }\n \n}\n\n//Explode The Given Input.\n$input = explode(\" \",$input);\n\necho find_how_much($input[0],$input[1],$input[2]);\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "31b45ebfd80376dc02f6819f38e407fd", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n){\n echo $total-$n;\n}else{\n echo \"0\";\n}", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "544ba93c9f588f021d3325431090187c", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0){\n return $sum - $n . \"\\n\";\n } else {\n return \"0\\n\";\n }\n \n }\n}\n\n$obj = new SolierAndBananas();\nfscanf(STDIN, \"%d %d %d\", $k, $n, $w);\necho $obj->index($k, $n, $w);", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "2877948d52b5279dae7696ba827bceec", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a[1]){\n\techo $hitung-$a[1];\n}else{\n\techo 0;\n}\n\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "372cb7ca1325dae9c0434dfbfc57cfde", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $nr[1])\n echo $sum - $nr[1];\nelse\n echo 0;", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "1a56908b91aa9218d93bf0cacb8b0f6d", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $input[1] ? $price - $input[1] : 0;", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "2802c5d120e1b7f0229b25cf99ff4c65", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "9519d2cd149a3861239c33d26461db59", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2625db3bad47499f6fdc373b09a072cb", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$pos_T && $canJump==0) ||($pos_G<$len && $nchar[$pos_G]=='#'))\n {\n echo 'NO';break;\n } \n }\n \n }else{\n while($pos_G>=$pos_T){\n\n if($pos_G==$pos_T){\n $canJump =1;\n echo 'YES';\n break;\n } \n $pos_G = $pos_G-$k;\n if(($pos_G<$pos_T && $canJump==0) ||($pos_G>-1 && $nchar[$pos_G]=='#'))\n {\n echo 'NO';break;\n } \n \n }\n }\n}\n\n\n$nk = trim(fgets(STDIN));\n$nchar = trim(fgets(STDIN));\n \nfindCanJump($nk,$nchar);\n\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2bdf3ee02665bc2a0475988c4f689fd4", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $y -= $b)\n{\n if(($c[$y] == FALSE) || ($c[$y] == \"#\"))\n {\n break;\n }\n elseif($c[$y] == \"T\")\n {\n $d = 1;\n }\n}\nfor($y = $x; $y < $a; $y += $b)\n{\n if(($c[$y] == FALSE) || ($c[$y] == \"#\"))\n {\n break;\n }\n elseif($c[$y] == \"T\")\n {\n $d = 1;\n }\n}\nif($d == 1)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "ccc844b015680a66f7d3f817a88e60e7", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b708f47dbe7661b3029955ee1c5d589f", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a81b9110ca2e22f4c802b68112fbac91", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3e8a83398519baedbb1fbbdea5c80cf4", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n\t\t$result = abs(2-$y_num) + abs(2-$x_num);\n\t\techo $result;\n\t}\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6f2956182f5adac5736acc2e36c04592", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "98a965d6b8621c1cb7a30be7b9224734", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b2b9dc7b1ee80208b2b80ca05647116b", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $s[0]){\n $s[0] = strtoupper($s[0]); \n if (!isset($s[1])){ \n echo $s . \"\\n\";\n goto a;\n }\n if (isset($s[1]) && 'A' <= $s[1] && 'Z' >= $s[1]){\n for ($i = 1; $i < $length; ++$i){ \n if ('a' <= $s[$i] && 'z' >= $s[$i]){\n echo $temp . \"\\n\";\n goto a;\n }\n $s[$i] = strtolower($s[$i]);\n }\n echo $s . \"\\n\";\n } else {\n echo $temp . \"\\n\";\n goto a;\n } \n \n } else {\n for ($i = 0; $i < $length; ++$i){\n if (('A' <= $s[$i] && 'Z' >= $s[$i])){\n $s[$i] = strtolower($s[$i]);\n } else {\n echo $temp . \"\\n\";\n goto a;\n }\n }\n echo $s . \"\\n\";\n }\n a:\n}\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "45d48f531aa853030ff63932aea6c440", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "6d5eaeaf2e0486920e0c0773028398e3", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 'A' && $v <= 'Z') $n++;\n\t}\n\tif ($var[0] >= 'a' && $var[0] <= 'z') {\n\t\tif (/*$n == 1 ||*/$n == $m - 1) {\n\t\t\techo ucwords(strtolower($in));\t\n\t\t} else {\n\t\t\techo $in;\n\t\t}\n\t} else if ($n == $m) {\n\t\techo strtolower($in);\t \n\t} else {\n\t\techo $in;\n\t}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9bfff4b8443e7a5bb144f6794ebeeba1", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "a9626ab6320fbd73145c5a2e76c85855", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a6e3e2afdf3a4248c892a6b094f262c3", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "eb4226e626c1c77f4609b9ab792f4c82", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "f40e848b79711a11931240461ddb1f8a", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "971862ed8561998de632562c9e9c371d", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $value <= $k && abs($key - $m + 1)*10 < $min) {\n $min = abs($key - $m + 1)*10;\n }\n}, ARRAY_FILTER_USE_BOTH);\n\necho $min;", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "719d171df25b08d030639236df57830e", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $hh[$i] <= $m)\n\t{\n\t\t$b = min($b, abs($c - ($i + 1)) );\n\t}\n}\n\necho ($b * 10) . PHP_EOL;", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "052a407c51fe461fdbbd6abb183c30ef", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if(($d[$x] != 0) && ($d[$x] <= $c))\n {\n $e += 10;\n $i = 1;\n break;\n }\n else\n {\n $e += 10;\n }\n}\n$f = 0;\nfor($x = $b; $x < $a; $x++)\n{\n if(($d[$x] != 0) && ($d[$x] <= $c))\n {\n $f += 10;\n $j = 1;\n break;\n }\n else\n {\n $f += 10;\n }\n}\nif($i == 0)\n{\n print $f;\n}\nelseif($j == 0)\n{\n print $e;\n}\nelse\n{\n $g = min($e, $f);\n $h = max($e, $f);\n if($g == 0)\n {\n print $h;\n }\n else\n {\n print $g;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "baa124d1195db051760102eb45f5c90b", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "games"], "code_uid": "4be140dbbb7f17a0a0e4e67c7fd5953f", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$s) {\necho \"Second\";\n}\nelse echo \"First\";\n?>\n", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "games"], "code_uid": "a212a1ae68d846eab67d1e39720edb10", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " min($a, $b)) print 'Second'; else print 'First';\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "games"], "code_uid": "9919d8e64aa90d6ece03e2b7b3d37b7e", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "1c6ad04aadf7c3731a546858f732b2b0", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2) {\n\t\techo 'NO';\n\t\treturn;\n\t}\n\n\t$c = $line[$i];\n\tif ($c == 1) {\n\t\t$count4 = 0;\n\t\tcontinue;\n\t}\n\n\tif ($c == 4) {\n\t\t$count4++;\n\t\tcontinue;\n\t}\n\n\techo 'NO';\n\treturn;\n}\n\necho ($count4 > 2) ? 'NO' : 'YES';\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "7b838d27738c4314bfb1ba3a89ff5374", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $x[$i - 1] == 1) continue;\n\t\t\t\tif ($i - 1 > 0 && $x[$i - 1] == 4 && $x[$i - 2] == 1) continue;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\n\n\t$input = trim(fgets(STDIN));\n\tif (check($input)) echo \"YES\";\n\telse echo \"NO\";\n\techo \"\\n\";\n\n\t\n\t\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "53f3a55bf18881b6f1c70b1ad30b93a6", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "cc24cb76d01ba5852316f6eb0bc38822", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n \t \t \t \t \t\t \t\t \t \t", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "02b22d16cef8a756bc21bcd76d33d751", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "4cf1a6d8d53756c122301d57a72683fe", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "7930f3f8e8194b8b3ba29e2ec793ece8", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1 && (substr($n,$i-2,1) . substr($n,$i-1,1) . substr($n,$i,1)== \"444\")) //444\n {\n echo \"NO\";\n return;\n }\n\n\n}\n}\n\necho \"YES\";\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "4620ece5497abee2ebe17b6f21ac80f1", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "947d85ec0496ace0ddf7218a2b29b1b7", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n if ($value != \"1\" && $value != \"4\") \n $condition = false;\n\n if (empty($currentSequence) || valid($currentSequence)) {\n $currentSequence = $currentSequence . $value;\n } elseif (strlen($currentSequence) >= 1) {\n $currentSequence = $value;\n } else {\n $condition = false;\n }\n\n if (!valid($currentSequence)) {\n $currentSequence = $value;\n if (!valid($currentSequence)) {\n $condition = false;\n }\n }\n}\n\necho $condition === true ? \"YES\\n\" : \"NO\\n\";\n\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "0abefb6e6fcd66b8832422f996a86038", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "a6a356a25b612399db8a81c93dbc3684", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d[0])\n {\n break;\n }\n else\n {\n $c++;\n $d[0]--;\n $e++;\n rsort($d);\n }\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "fd6a8aa94b7c7f9edeecc694ac5e7c82", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n = $m){\n $m = $arr[$i];\n $id = $i;\n }\n }\n return $id;\n }\n\n $x = $arr[0];\n $id = max_($n, $arr);\n while($id != 0){\n $arr[$id]--;\n $arr[0]++;\n $id = max_($n, $arr);\n \n }\n print $arr[$id]-$x;\n //print_r($arr);\n ?>\n\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "49b77edd966facf8754b14737e75a60a", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "20f04211ac285d28356a629b2c693f46", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $q) {\n $max = $n;\n break;\n}\nwhile ($b - $max <=0) {\n $t = floor($max - $b) + 1;\n if ($t<=$aArray[$max]) {\n $result = $result + $t;\n break;\n } else {\n $b += $aArray[$max];\n $result += $aArray[$max];\n if (isset($aArray[$max-1])) {\n $aArray[$max - 1] += $aArray[$max];\n unset($aArray[$max]);\n } else {\n $aArray[$max - 1] = $aArray[$max];\n }\n $max--;\n }\n}\n\necho $result;\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "91c93da50a8e78b6c3750c792e8ebba3", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "22f43a4500582eeb57d94c8dc0c27bdb", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d1d24fedd713c880af07f855d9885467", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c3c01855f73779ab89cadaa9b70be23f", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "20336bf48df08645643392882a6ec595", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;\n\t}\n\t\n\tpublic function readInt() \n\t{\n\t\t$d = trim(fgets($this->_fh));\n\t\t\n\t\treturn (int)$d;\n\t}\n\t\n\tpublic function readArrayOfInt($size, $indexFrom = 0) \n\t{\n\t\t$a = [];\n\t\t$ind = $indexFrom;\n\t\tforeach (explode(' ', fgets($this->_fh)) as $item) {\n\t\t\t$a[$ind++] = (int)$item;\n\t\t}\n\t\t\n\t\treturn $a;\n\t}\n\t\n\tpublic function readArrayOfString($size, $indexFrom = 0) \n\t{\n\t\t$a = [];\n\t\t$ind = $indexFrom;\n\t\tforeach (explode(' ', fgets($this->_fh)) as $item) {\n\t\t\t$a[$ind++] = $item;\n\t\t}\n\t\t\n\t\treturn $a;\n\t}\n}\n\nfunction ntimes($n, $func, $returnResults = false) {\n\t$a = [];\n\tfor ($i=1; $i<=$n; $i++) {\n\t\t$result = $func();\n\t\t\n\t\tif ($returnResults) {\n\t\t\t$a[$i] = $result;\n\t\t}\n\t}\n\t\n\treturn $a;\n}\n\n\n$ir = new InputReader();\n\n$n = $ir->readInt();\n$a = $ir->readArrayOfInt($n,1);\n$a[0] = 0;\n$a[$n+1] = 1001;\n\n$max = 0;\n$total = 0;\nfor ($i = 1; $i<=$n; $i++) {\n\tif (($a[$i+1] - $a[$i-1]) == 2) {\n\t\t$total++;\n\t}\n\telse {\n\t\t$max = max([$max, $total]);\n\t\t$total = 0;\n\t}\n}\n\n$max = max([$max, $total]);\necho $max;\n\n\n\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "7b80e69702c3f9c27c3242c58a21208f", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if($b[$x] == $e)\n {\n $d++;\n $e--;\n }\n else\n {\n $d--;\n $e2 = 1;\n break;\n }\n}\nif($e2 == 0)\n{\n $d--;\n}\n$f = 0;\n$g = 0;\nfor($x = 0; $x < $a - 1; $x++)\n{\n if($b[$x + 1] - $b[$x] == 1)\n {\n $g++;\n }\n elseif($g > 0)\n {\n $f = max($f, $g - 1);\n $g = 0;\n }\n}\nif($g > 0)\n{\n $f = max($f, $g - 1);\n}\nprint max($c, $d, $f);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "8143e8d0ba4183af2876ccd2b6ef551e", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n ", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "cb8a9c73f6ab3213e877e49ffa472b4e", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $x--)\n{\n $b = $b + ($x * $c);\n $c++;\n}\nprint $a + $b;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "de43a02d99961f472a2685d3334c45e9", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "bdf2f62051955703b1391072be592b12", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1;$i--){\n $summ += ($rinc*($i-1)+1);\n $rinc++;\n \n}\n\necho $summ+1;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f098ba989952b94a2fb5f7862804cf65", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n ", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2062703ad84cd43f8e651bd0c99f684e", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3b968ef448b5890ae2648e69996ae42d", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "15b8c7231e68eb678c0e11a385414526", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "518c580ba1f33863fb2ddf4f1361ed75", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 OR $kcnt>0) $cnt = $cnt+1;\n\necho $cnt\n \n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "bb08e03f349aa86ded3c053444857be7", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $char) {\n\t$newArr = $sArr;\n\tif ($char == \"V\") {\n\t\t$newChar = \"K\";\n\t} else {\n\t\t$newChar = \"V\";\n\t}\n\t$newArr[$key] = $newChar;\n\t$candidates[] = implode($newArr);\n}\n\n$candidateCount = [];\nforeach($candidates as $candidate) {\n\t$candidateCount[] = substr_count($candidate, \"VK\");\n}\n\necho max($candidateCount);", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "7d9532a17f4c16d69f00804103b90c20", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "e94725812f0e27bba0711afc0b6ca8d0", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 OR $k>0) echo \"\".($c+1);\n else\n echo \"\".$c;\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "ae7194bf768e1dcdbb9b827fb270d93c", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "dp", "implementation"], "code_uid": "53a67f5fe0ed97d3dc97af1c4d1bad29", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "dp", "implementation"], "code_uid": "525b9aed0c93f556e869b97efe11a822", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "dp", "implementation"], "code_uid": "0a8978967f3cf3ec84841da59ff8a210", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $resultHeight)\n\t\t$result = -1;\n\t\n\techo $result;\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "476c15c2a49e31f902fd6c115fa692bd", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0))\n {\n print \"-1\";\n break;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "0f71ffd744f3793613f4b5c4d207fd24", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$k) break;}\n\nprint $i+1;\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "ff36ce905a9713c12662083479d4a010", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && isset($a[$x])){\n $count++;\n $k-=$a[$x];\n $x++;\n}\n\nif ($k>0){\n $count = -1;\n}\n\necho $count;\n\n", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "e112023b6cd7aea29bc7971d1aa6a9dc", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $k )\n {\n $tmp=1;\n break;\n }\n }\n if ($k == 0)\n echo 0;\n else if ( $tmp == 1)\n echo $i+1;\n else\n echo -1;\n?>\n", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "d2b707b4a16cf05d8dcbba6a1b36cf28", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "number theory", "brute force"], "code_uid": "9c6ca40befebee6c9022ef112d74ff7d", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a)\n{\n if(($d < $b) && ($e < $b))\n {\n print \"NO\";\n }\n else\n {\n $f = $d % $b;\n $g = $e % $b;\n if(($f == 0) || ($g == 0))\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a27f9ced7439ec2290ae37fffb25c37e", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $t + $p && ($w -$t) % $p == 0) || \n($w >= $t + $p + 1 && ($w -$t -1) % $p == 0)) \necho 'YES';\nelse echo 'NO';", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7f6b4cb09f53727efb5840a3d7c21655", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n $a -= 2;\n if($e == 0)\n {\n $d += 30;\n $e = 1;\n }\n else\n {\n $d += 1;\n }\n if(($a <= 0) && ($b <= 0) && ($c <= 0))\n {\n break;\n }\n }\n else\n {\n $d += 1;\n }\n if($b > 0)\n {\n $b -= 2;\n if($e == 0)\n {\n $d += 30;\n $e = 1;\n }\n else\n {\n $d += 1;\n }\n if(($a <= 0) && ($b <= 0) && ($c <= 0))\n {\n break;\n }\n }\n else\n {\n $d += 1;\n }\n if($c > 0)\n {\n $c -= 2;\n if($e == 0)\n {\n $d += 30;\n $e = 1;\n }\n else\n {\n $d += 1;\n }\n if(($a <= 0) && ($b <= 0) && ($c <= 0))\n {\n break;\n }\n }\n else\n {\n $d += 1;\n }\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "12599a22eeecc51e30934371f3a1ad8b", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d - $e) {\n echo -1;\n exit;\n}\n\n\nksort($exs);\n\n$schedule = [];\n\nfor ($i = 1; $i <= $d; $i++) {\n\n if (isset($req[$i])) {\n\n if ($req[$i] != 0) {\n echo -1;\n exit;\n }\n\n $schedule[] = $e + 1;\n } else {\n\n $needBrake = true;\n\n foreach ($exs as $ex => $p) {\n\n if ($req[$ex] != 0 && $open[$ex] <= $i) {\n\n $needBrake = false;\n\n $req[$ex]--;\n $schedule[] = $p + 1;\n break;\n }\n }\n\n if ($needBrake) {\n $schedule[] = 0;\n }\n }\n}\n\necho implode(' ', $schedule);\n", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "5d05d030f481b76938ff1f8119bffa8a", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0 ; $i--)\n { \n \t $count=0;\n\n\t for ($j=0; $j =0 ; $i--)\n{\n\tif($i==0)\n\t\techo \"$targetArr[$i]\";\n\n else\n \techo $targetArr[$i].' ';\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4b0c86edadaf6fd3d4c1b25727d4f44f", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $i--) {\n if (!isset($new[$array[$i]])) {\n $new[$array[$i]] = 1;\n }\n }\n\n echo count($new), PHP_EOL, implode(' ', array_reverse(array_keys($new))), PHP_EOL;\n}\n\nfscanf($handle, \"%i\", $n);\n$expenditure_temp = fgets($handle);\n$expenditure = explode(\" \", $expenditure_temp);\n$expenditure = array_map('intval', $expenditure);\nremoveDuplicates($expenditure);\n\n\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5839d269d6aa9f2c8d821f83c1ba8847", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bc92ea7b51766efb386090730aeea2af", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$Bob)\n\t{\n\t\techo $i+1;\n\t\tbreak;\n\t}\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "668db48e009cfb32538fd0f925ecc247", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e2484f1219d8c24fa011b4efac121750", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $x[1])\n\t\tdie(\"$i\\n\");\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "75776cbed9748025f91468588cd4bed0", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a){\n $b = $b * 2;\n $a = $a * 3;\n $n ++;\n }\n echo ($n);\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8647e6e5e581fa67468cd461a43e22ee", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "21a3b337b4f4ef1303f21e37de096915", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a) $n++;\nif ($c <> $a and $c <> $b) $n++;\nif ($d <> $a and $d <> $b and $d <> $c) $n++;\n$n = 4 - $n;\necho \"$n\\n\";\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "39e3c82674d9c232d42b87310628916b", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e40df23a231a93524c90ff197eeef4fd", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b9a558131564ac0953b13fece84eb728", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "46e26603bc0e888490211222132249e9", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "12e70fe6e73cc305303584e262488958", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $el){\n\t\tif ($el >= 4){\n\t\t\t$hasFoot = true;\n\t\t\tif ($el >= 5) $head = $k;\n\t\t\tif ($el == 6) $body = $k; \n\t\t}else{\n\t\t\tif ($el == 2){\n\t\t\t\t$head = $body = $k;\n\t\t\t}else{\n\t\t\t\tif ($head == 0) $head = $k;\n\t\t\t\telse $body = $k;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\techo $hasFoot ? $body == $head ? 'Elephant' : 'Bear' : 'Alien';\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "86e7169cbd3706026c983629b15b2bb9", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 4) $k++;\n\tif($a[$i] == 2) $q++;\n}\nif($k && $q){\n\techo \"Elephant\";\n}else if($k)\n\techo \"Bear\";\nelse echo \"Alien\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "57e39d71498daec3463a420649c6c3e2", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "375ede75ee582b38db1371a054cec22a", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0){\n\t$w .= substr($in,0,$r+1);\n}\n$w .= '.ru';\n$in = substr($in,($r+3));\n\nif($in<>''){\n\t$w .= '/'.$in;\n}\n\necho $w;\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "8b9710b4ea8cd4a5dc5f84b9e5e4e484", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0){\n $ans .= substr($cin,0,$ru+1);\n}\n$ans .= '.ru';\n$cin = substr($cin,($ru+3));\n\nif($cin<>''){\n $ans .= '/'.$cin;\n}\n\necho $ans;\n\n?>\n\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "e76eb5c39ea29b4c1591a4dcf90a0f75", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \n ", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "b5249a7e0f20a6a9711832b673d67294", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$k && $i+$k>$j && $j+$k>$i;\n}\n\nfunction seg($i,$j,$k){\n return $i+$j==$k || $i+$k==$j || $j+$k==$i;\n}\n\nlist($a, $b, $c, $d) = explode(' ', trim(fgets(STDIN)));\n\n\nif(tri($a,$b,$c) or tri($a,$b,$d) or tri($a,$c,$d) or tri($b,$c,$d)){\n print 'TRIANGLE';\n exit(0);\n}\n\nif(seg($a,$b,$c) or seg($a,$b,$d) or seg($a,$c,$d) or seg($b,$c,$d)){\n print 'SEGMENT';\n exit(0);\n}\n\nprint 'IMPOSSIBLE';\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "e0ba7feee54e9aad5c0b43f1f336f7dd", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= (max($a, $b) - min($a, $b) + 1)) && ($c <= ($a + $b - 1))) || (($d >= (max($a, $b) - min($a, $b) + 1)) && ($d <= ($a + $b - 1))))\n{\n print \"TRIANGLE\";\n}\nelseif((($b >= (max($a, $c) - min($a, $c) + 1)) && ($b <= ($a + $c - 1))) || (($d >= (max($a, $c) - min($a, $c) + 1)) && ($d <= ($a + $c - 1))))\n{\n print \"TRIANGLE\";\n}\nelseif((($b >= (max($a, $d) - min($a, $d) + 1)) && ($b <= ($a + $d - 1))) || (($c >= (max($a, $d) - min($a, $d) + 1)) && ($c <= ($a + $d - 1))))\n{\n print \"TRIANGLE\";\n}\nelseif((($a >= (max($b, $c) - min($b, $c) + 1)) && ($a <= ($b + $c - 1))) || (($d >= (max($b, $c) - min($b, $c) + 1)) && ($d <= ($b + $c - 1))))\n{\n print \"TRIANGLE\";\n}\nelseif((($a >= (max($b, $d) - min($b, $d) + 1)) && ($a <= ($b + $d - 1))) || (($c >= (max($b, $d) - min($b, $d) + 1)) && ($c <= ($b + $d - 1))))\n{\n print \"TRIANGLE\";\n}\nelseif((($a >= (max($c, $d) - min($c, $d) + 1)) && ($a <= ($c + $d - 1))) || (($b >= (max($c, $d) - min($c, $d) + 1)) && ($b <= ($c + $d - 1))))\n{\n print \"TRIANGLE\";\n}\n// SEGMENT --------------------------------------------------\nelseif((($c == (max($a, $b) - min($a, $b))) || ($c == ($a + $b))) || (($d == (max($a, $b) - min($a, $b))) || ($d == ($a + $b))))\n{\n print \"SEGMENT\";\n}\nelseif((($b == (max($a, $c) - min($a, $c))) || ($b == ($a + $c))) || (($d == (max($a, $c) - min($a, $c))) || ($d == ($a + $c))))\n{\n print \"SEGMENT\";\n}\nelseif((($b == (max($a, $d) - min($a, $d))) || ($b == ($a + $d))) || (($c == (max($a, $d) - min($a, $d))) || ($c == ($a + $d))))\n{\n print \"SEGMENT\";\n}\nelseif((($a == (max($b, $c) - min($b, $c))) || ($a == ($b + $c))) || (($d == (max($b, $c) - min($b, $c))) || ($d == ($b + $c))))\n{\n print \"SEGMENT\";\n}\nelseif((($a == (max($b, $d) - min($b, $d))) || ($a == ($b + $d))) || (($c == (max($b, $d) - min($b, $d))) || ($c == ($b + $d))))\n{\n print \"SEGMENT\";\n}\nelseif((($a == (max($c, $d) - min($c, $d))) || ($a == ($c + $d))) || (($b == (max($c, $d) - min($c, $d))) || ($b == ($c + $d))))\n{\n print \"SEGMENT\";\n}\n// IMPOSSIBLE --------------------------------------------------\nelse\n{\n print \"IMPOSSIBLE\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "351a10bb8304e824796e68d2ce089823", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c;\n}\n\nfunction is_segment($a, $b, $c) {\n return $a + $b == $c;\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "5b95d295f783c657265f58b214e7e7c8", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $tri[2] )\n\t\t{\n\t\t\tdie('TRIANGLE');\n\t\t\t$sol = max($sol, TRI);\n\t\t}\n\t\telseif ( ($tri[0] + $tri[1]) == $tri[2] )\n\t\t\t$sol = max($sol, SEG);\n\t\telse\n\t\t\t$sol = max($sol, IMP);\n\t}\n\tswitch ($sol)\n\t{\n\t\tcase TRI:\n\t\t\techo 'TRIANGLE';\n\t\t\tbreak;\n\t\tcase SEG:\n\t\t\techo 'SEGMENT';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\techo 'IMPOSSIBLE';\n\t\t\tbreak;\n\t}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "1e0f364203e9f05436106f3d1b1d5930", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d[$i])\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t$tri = true;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t} else if ($d[$j] + $d[$k] == $d[$i] || $d[$j] + $d[$i] == $d[$k] || $d[$i] + $d[$k] == $d[$j])\n\t\t\t\t{\n\t\t\t\t\t$seg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} \n\t}\n\n\tif ($tri) print(\"TRIANGLE\");\n\telse if ($seg) print(\"SEGMENT\");\n\telse print(\"IMPOSSIBLE\");\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "d20f29a176dd262577b655c381e9ea42", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\n$stdin = @fopen('data.txt', 'r');\nif (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n/****************************************************** Solving block *****************************************************/\n$sticks = explode(' ', g());\nsort($sticks);\nlist($a, $b, $c, $d) = $sticks;\n\nfunction triangle($a, $b, $c) {\n return $a + $b > $c;\n}\n\nfunction segment ($a, $b, $c) {\n return $a + $b == $c;\n}\n\n$triangle = triangle($a, $b, $c) || triangle($b, $c, $d);\n$segment = segment($a, $b, $c) || segment($b, $c, $d);\n\nif($triangle) {\n echo 'TRIANGLE';\n} else if($segment) {\n echo 'SEGMENT';\n} else {\n echo 'IMPOSSIBLE';\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "fafb881d4bb3dc2468447731d479be3f", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \"January\", 2 => \"February\", 3 => \"March\", 4 => \"April\", 5 => \"May\", 6 => \"June\", 7 => \"July\", 8 => \"August\", 9 => \"September\", 10 => \"October\", 11 => \"November\", 12 => \"December\");\nfscanf(STDIN, \"%s\", $name);\nfscanf(STDIN, \"%d\", $plus);\n$current = array_search($name, $months);\n$current += $plus;\nwhile($current>12) $current -= 12;\necho $months[$current];\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b761980358a437ee1d89cdf9b942d47e", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "74e24d476b31cc3498c66bb902c4de5f", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "greedy"], "code_uid": "0b38ac1596e0f83eb6afde52606b80fa", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "11fa48dc114449f270f183c453317c9c", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ae672f156636a74f9b12d1e9f748ab50", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b1ceda7eb17298c139267a5e58603a79", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5b029a6a88ab698361fb4d21556ac5bf", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "de38c74b31a3a025a92b0a70d05ebcdb", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= ($f2 + $e2))\n {\n $e = ($m1[0] + $m1[1]) / 2; // числа всречи\n $f = $m1[0] - $e; // количество ходов до чисел встречи\n if($m1[2] < $f)\n {\n $g = $f - $m1[2];\n $d = $m1[2] + (($m1[0] - $m1[2]) - ($m1[1] + $m1[2])) + $m1[1] + $m1[2];\n print $d; \n }\n else\n {\n $d = $f + $e;\n print $d;\n }\n }\n elseif(($f1 + $e1) < ($f2 + $e2))\n {\n $e = ($m1[1] + $m1[2]) / 2; // числа всречи\n $f = $m1[1] - $e; // количество ходов до чисел встречи\n if($m1[0] < $f)\n {\n $g = $f - $m1[0];\n $d = $m1[0] + (($m1[1] - $m1[0]) - ($m1[2] + $m1[0])) + $m1[2] + $m1[0];\n print $d; \n }\n else\n {\n $d = $f + $e;\n print $d;\n }\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "d35eafde20ced3af17b9856fa3497a81", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "b17f13b988776bb2de6f7eca73490a3a", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "c4b4cd4a4854f3f1bf645b7244f1a46b", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n $d = floor($c[$x] / 14);\n $e = $c[$x] % 14;\n $c[$x] = 0;\n $f = $x + 1;\n if($f == 14)\n {\n $f == 0;\n }\n $g = 1;\n while(TRUE)\n {\n if($f == 14)\n {\n $f = 0;\n }\n $c[$f] += $d;\n if($e > 0)\n {\n $c[$f]++;\n $e--;\n }\n $f++;\n if($g == 14)\n {\n break;\n }\n else\n {\n $g++;\n }\n }\n $h = 0;\n for($y = 0; $y < 14; $y++)\n {\n $i = $c[$y] % 2;\n if($i == 0)\n {\n $h += $c[$y];\n }\n }\n $b[count($b)] = $h;\n }\n}\nprint max($b);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "5abb7d7ccf2a2408ef788ebc880bae52", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n\t\t\t\tif ($a_min == 8) $a_min = $j;\n\t\t\t\t$a[$i] = $j;\n\t\t\t}\n\n\t\t\t$b[$i] = -1;\n\t\t}\n\t\telseif ($s[$i] == 'B') {\n\t\t\t$b[$i] = 7-$j;\n\n\t\t\tif ($a[$i] == 8) $a[$i] = -1;\n\t\t}\n\t}\n}\n\n\n$a_min = 8;\n$b_min = 8;\nfor ($j = 0; $j < 8; $j++) {\n\tif ($a[$j] > 0 and $a[$j] < $a_min) $a_min = $a[$j];\n\tif ($b[$j] > 0 and $b[$j] < $b_min) $b_min = $b[$j];\n}\n\nif ($b_min < $a_min) print 'B'; else print 'A';\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "52fd3e73d204c1e67a4db0e34cc58c04", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n for($y = 7; $y >= 0; $y--)\n {\n if($c[$x][$y] == \"B\")\n {\n $g[$x] = 7 - $y;\n break;\n }\n elseif($c[$x][$y] == \"W\")\n {\n break;\n }\n }\n}\n$h = min($f);\n$i = min($g);\nif($h <= $i)\n{\n print \"A\";\n}\nelse\n{\n print \"B\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e7d3e86295da7a0b89b341ce5c4c76b1", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\"){\n$checka = \"1\";\n}\n\n\n//check4\n$nnbv1 = $ver[$tver-1];\n$nnbv2 = $hor[$thor-1];\nif($nnbv1 == \"v\" && $nnbv2 == \">\"){\n$checka = \"1\";\n}\nif($checka == \"1\"){\necho \"NO\";\n}else{\necho \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "53b22ddc0ad95db1215e24dd97777866", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\" && $vert[count($vert)-1]==\"v\") {\n echo \"NO\";exit();\n}\n\nif($horiz[0]==\">\" && $vert[count($vert)-1]==\"^\") {\n echo \"NO\";exit();\n}\nif($horiz[count($horiz)-1]==\"<\" && $vert[0]==\"v\") {\n echo \"NO\";exit();\n}\n\necho \"YES\";\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "9010a8bc7c887320577b567eb9b9cdd5", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\") || ($ver[0]==\"v\" && $hor[$n-1]==\"<\") || ($ver[$m-1]==\"v\" && $hor[$n-1]==\">\") ){\n\techo \"NO\\n\";\n}\nelse{\n\techo \"YES\\n\";\n}\n\n", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "22833a636eb901f289ae04f8840e4f44", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "^' || $t == '>^\") && ($e[2] == \"v\") && ($e[3] == \"^\")) || (($e[0] == \">\") && ($e[1] == \"<\") && ($e[2] == \"^\") && ($e[3] == \"v\")))\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "754a595454875bb62635092445108d34", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["expression parsing"], "code_uid": "d8e8e8e9639bfa39692dff031e9853a6", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "bd13b19ec1ed3bc8166ce115c7137b88", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "e59e082badfd7cceac05cacb30ccd13a", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3)\n{\n $b = $a % 3;\n $c = floor($a / 3);\n if($b == 0)\n {\n print ($c * 2);\n }\n else\n {\n print ($c * 2 + 1);\n }\n}\nelse\n{\n print \"1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "eb87d3b8b02e2bd3788eb0bd6b0fb89d", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0))\n {\n $j = abs($f) + $g;\n }\n elseif(($f >= 0) && ($g > 0))\n {\n $j = $g - $f;\n }\n if(($h < 0) && ($i < 0))\n {\n $k = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $k = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $k = $i - $h;\n }\n print $j * $k;\n }\n}\nelseif($a > 2)\n{\n list($b, $c) = explode(\" \", trim(fgets(STDIN)));\n list($d, $e) = explode(\" \", trim(fgets(STDIN)));\n list($f, $g) = explode(\" \", trim(fgets(STDIN)));\n if(($b == $d) && ($c == $g))\n {\n $h = min($c, $e);\n $i = max($c, $e);\n $j = min($b, $f);\n $k = max($b, $f);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n elseif(($b == $d) && ($e == $g))\n {\n $h = min($c, $e);\n $i = max($c, $e);\n $j = min($d, $f);\n $k = max($d, $f);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n elseif(($b == $f) && ($c == $e))\n {\n $h = min($c, $g);\n $i = max($c, $g);\n $j = min($b, $d);\n $k = max($b, $d);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n elseif(($b == $f) && ($g == $e))\n {\n $h = min($c, $g);\n $i = max($c, $g);\n $j = min($d, $f);\n $k = max($d, $f);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n elseif(($d == $f) && ($e == $c))\n {\n $h = min($g, $e);\n $i = max($g, $e);\n $j = min($b, $d);\n $k = max($b, $d);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n elseif(($d == $f) && ($g == $c))\n {\n $h = min($e, $g);\n $i = max($e, $g);\n $j = min($b, $f);\n $k = max($b, $f);\n if(($h < 0) && ($i < 0))\n {\n $l = abs($h) - abs($i);\n }\n elseif(($h < 0) && ($i >= 0))\n {\n $l = abs($h) + $i;\n }\n elseif(($h >= 0) && ($i > 0))\n {\n $l = $i - $h;\n }\n if(($j < 0) && ($k < 0))\n {\n $m = abs($j) - abs($k);\n }\n elseif(($j < 0) && ($k >= 0))\n {\n $m = abs($j) + $k;\n }\n elseif(($j >= 0) && ($k > 0))\n {\n $m = $k - $j;\n }\n print $l * $m;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["geometry", "implementation"], "code_uid": "85f8254774a80b5c4a5b33432122dd96", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["geometry", "implementation"], "code_uid": "5d98758906362865897b3ad85ebba611", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $m){\n $result = $n - $m;\n}else{\n $result = 0;\n while($m != $n){\n if($m % 2 == 1 || $m < $n){\n $m++;\n }else{\n $m = $m/2;\n }\n $result++;\n }\n}\necho $result;", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "0f0d17652ce6e9c88a089d72d1be15a6", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 10000) return;\n\tglobal $s;\n\tif (isset($s[$p]) && $s[$p] <= $v) return;\n\t$s[$p] = $v;\n\tcalc($p - 1, $v + 1);\n\tcalc($p * 2, $v + 1);\n}\ncalc($from, 0);\necho $s[$to];\n", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "f52ef494b2cb46aca940549c451bb3b4", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $m){\n $result = $n - $m;\n}else{\n $result = 0;\n while($m != $n){\n if($m % 2 == 1 || $m < $n){\n $m++;\n }else{\n $m = $m/2;\n }\n $result++;\n }\n}\necho $result;", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "29038f00ed2d50bb2c4adc219dd5403e", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a)\n {\n if(($d != 0) && (ceil($d) == $d))\n {\n $b++;\n $f++;\n }\n elseif(($d != 0) && (ceil($d) != $d))\n {\n $b = ceil($b);\n $f++;\n }\n }\n }\n }\n else\n {\n $b++;\n $f = 1;\n for($x = 1; $x <= 100; $x++)\n {\n $b /= 2;\n $d = $b % 2;\n if($b == $a)\n {\n print $f + $x;\n break;\n }\n elseif($b < $a)\n {\n $e = $a - $b;\n print $e + $f + $x;\n break;\n }\n elseif($b > $a)\n {\n if(($d != 0) && (ceil($d) == $d))\n {\n $b++;\n $f++;\n }\n elseif(($d != 0) && (ceil($d) == $d))\n {\n $b = ceil($b);\n $f++;\n }\n }\n }\n }\n}\nelseif($a == $b)\n{\n print \"0\";\n}\nelseif($a > $b)\n{\n print $a - $b;\n}\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "5d7df7ac90bbec89116ccfb3b9c3183b", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["bitmasks"], "code_uid": "c1339a233e93bc02b168f6c2c73832f4", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["bitmasks"], "code_uid": "480121f9bc1f1f5643aba73970ed6d66", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 2) {\n $r = $n % 2;\n if ($r == 1) {\n $result++;\n }\n $n -= $r;\n $n /= 2;\n}\n$result++;\necho $result;", "lang_cluster": "PHP", "tags": ["bitmasks"], "code_uid": "c05b5a1c6707ae7d60c246752ee08e91", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $mxRes) {\n\t\t\t$mxRes = $a[$i];\n\t\t}\n\t}\n\t$res2 = $mxRes + $m;\n\tsort($a);\n\tfor ($i = 0; $i < $n; $i++) { \n\t\tif ($a[$i] != $mxRes && $m > 0) {\n\n\t\t\tif ($m >= $mxRes - $a[$i]) {\n\t\t\t\t\n\t\t\t\t$m -= ($mxRes - $a[$i]);\n\t\t\t\t$a[$i] = $mxRes;\n\t\t\t} else {\n\t\t\t\t$a[$i] += $m;\n\t\t\t\t$m = 0;\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ($m > 0) {\n\t\t$res1 = $mxRes + (int)($m / $n) + ($m % $n != 0);\n\t} else {\n\t\t$res1 = $mxRes;\n\t}\n\tprint( $res1.\" \".$res2);\n\n\n ?>", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "facf4cd69b4d38c577347f4508b9facb", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "3359a8b3bd228b21d8bbdf3d80a523ce", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "7d0cb429593d19d8f3aa45eb5dc77ce2", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$max)\n\t $max=$cnt;\n\n\n\n }\n echo \"$max\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3d1c2b0ce37d761860f4a01e1ecd8614", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "eb477fb34362b4482477e85e616b4caf", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "93caad1728d8af9891c2bd1d389c0561", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max){\n $max= $current;\n }\n $current=1;\n }\n else{\n $current++;\n }\n}\n\n\n\nif($current > $max){\n $max = $current;\n}\necho $max;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "66789b50b5e140daae87bd25fe2bf41c", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0e8bea39504d55e4805f9c6d931cd2cb", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a0a791c9177ef2f61c2e05e88cf47389", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $strout .= substr($strin, 0, 1);\n $strin = substr($strin, $i, $length - $i);\n $length -= $i;\n $i++;\n}\n\necho $strout;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c4c2a13be3bde6b4955d79c33c7ef828", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "5ddce32f114c6a0a704d3c1c749bf5d1", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "58a2bdbfff6116870854b9fc08d786ea", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "75ccd79fc0eb2f8dbcf1bdc244d02d04", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "0e3ac99eeffaf4bba96de43b1ca8f6d9", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "fca62666bda64b125fff16530933eb32", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= strlen($word)) {\n \n return \"YES\";\n \n }else {\n \n return \"NO\";\n \n }\n\n}\n\necho func($input);\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "daa9ea9d15177b10f220b9dc0067be69", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "988e16075f178b07563d819ee5b6e289", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val2){\n $res = \">\";\n}else{\n $res = \"<\";\n}\n\nfwrite(STDOUT, $res);\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "64c82fb01465b66f3ca6aed14c2c1e64", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $number2) {\n $sign = '>';\n} else {\n $sign = '<';\n}\necho $sign;\n//echo \"$number1$sign$number2\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "79547d5f07c59dc8723810cf1ce283a9", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $h)\n{\n print \">\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "9b79a2da484be472771fd8722a303c32", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $l)\n\t\t\t$ans=$ans+1;\n\t}\n}\nprintf(\"%d\",$ans);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f3f3f623c0eccea922fd0d0dd7fcd57c", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $l)) $ans++;\n }\n}\nprintf(\"%d\",$ans);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b927f8c08c39dbee2dfb86293de5ce33", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$m && $c[$i]<=$n)\n $ans = $ans + 1;\n }\n // printf($m); \n // echo($m);\n // if ($m == 1) $ans = $ans - 1;\n echo $ans;\n \n \n \n \n //echo $x;\n \n \n \n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "5349b724adb146f9e8229a091376f348", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $l)\n $ans++;\n $cur*=3;\n }\n $beg*=2;\n } \n echo $ans;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6c2688843e99b177a2a74af35859c4e2", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n\tif ($l <= $key && $key <= $r) {\n\t\t$answer += 1;\n\t}\n}\necho $answer;", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b990bff912a4be71d1468dea2f122e01", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n\t{\n\t\t$d = intdiv($d, 3);\n\t\t$cnt++;\n\t}\n\treturn $cnt;\n}\n\nfunction pw3bet($l, $r)\n{\n\treturn (pw3up($r) - pw3up($l - 1));\n}\n\nfunction f($l, $r)\n{\n\tif($r < $l)\n\t\treturn 0;\n\tif($l == $r && $l % 2 == 1)\n\t\treturn pw3bet($l, $r);\n\treturn (pw3bet($l, $r) + f(intdiv(($l + 1),2), intdiv($r,2)));\n}\n\n\n$fl = STDIN;\nlist($l, $r) = explode(\" \", fgets(STDIN));\n$l = (int) $l;\n$r = (int) $r;\n\nprintf(\"%d\\n\", f($l, $r))\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "9fa2ee2e9faec842071d0b6efb652683", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n {\n $ans++;\n }\n}\nprint $ans;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c7ae0443b98d8fcac37061216694d394", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $l && $p2 * $p3 <= $r)\n ++$ans;\n\necho $ans . \"\\n\";", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "fc49fa2463585b1f2cecaef101a150ef", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $l && $x <= $r) {\n\t\t\t$ans++;\n\t\t}\n\t}\n}\n \nfprintf(STDOUT, \"%d\\n\", $ans);", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b79c00215b163c8bb8ec11f25ff90cd0", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if($a[$x] == 0)\n {\n $b++;\n }\n else\n {\n break;\n }\n}\nif($b == 0)\n{\n $c = strrev($a);\n if($a == $c)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\nelse\n{\n $c = strrev($a);\n for($x = 1; $x <= $b; $x++)\n {\n $c .= \"0\";\n }\n $d = strrev($c);\n if($c == $d)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "de93b323a57470c0ec43fbc19f674675", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "1936f0c4e269fb6374970aabf014f9eb", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0;$i--)\n{\n if($a[$i]!=0){ \n break;\n }\n}\n$c=$i+1;\n//echo $c;\n//print_r($a);\n$sum=0;\nfor($i=0;$i<(int)($c/2);$i++)\n{\n //echo $a[$i].\"/\".$a[($c-1-$i)].\"\\n\";\n if($a[$i]!=$a[($c-1-$i)]) \n {$sum=1;\n break; }\n\n}\n//echo $sum;\nif($sum) echo \"NO\";\n else echo \"YES\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c1b76d85dc7ef9211859ec5ee0782a72", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n $sum += $b;\n } else {\n $sum += $n * $a;\n }\n\n echo $sum . PHP_EOL;\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c4c25d0614f55db5acc79f3ec52a2dbe", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a){\n echo $n*$a;\n exit;\n}\nelse{\n\t$count=0;\n\twhile($n-$m>0){\n $n-=$m;\n $count+=$b;\n\t}\n\techo $n*$a<$b? ($n*$a+$count):($b+$count); \n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9598e61b77898ec41e5f2a925a2b0bf2", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a688a332263ae7c4f922e3c6a4758962", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6e8a05e8e93eaadff4ec24f2138cb70f", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $m) {\n if ($b/$m < $a) {\n if ($b < ($n%$m)*$a) {\n $res = intdiv($n, $m)*$b + $b;\n print($res);\n } else {\n $res = intdiv($n, $m)*$b +($n%$m)*$a; \n print($res);\n }\n } else {\n print($n*$a);\n }\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a4c6838a316c3e1e1ae2d022fcfec4fe", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "games"], "code_uid": "704e1186d08d0206ceede338e2140500", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7b9557d9cb136d7d0b26f017c04debef", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "03064e3dba687f4e6108faba4e7ff20e", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "58e8186093fe80a2c20c2ecddc498f9a", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "dba0af8e56dfaf66daceede20900432e", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "40eac14403e6704fd931e6418d7571ad", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "implementation"], "code_uid": "1d597d32887f82c6fdf94815fa54c0b6", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "implementation"], "code_uid": "e9f678bb9c893c6388ee3e5478350626", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $rad) {\n echo 'Limak';\n} elseif ($rad > $lim) {\n echo 'Radewoosh';\n} else {\n echo 'Tie';\n}\n\nif (LOCAL_ENV) {\n echo PHP_EOL, $lim, PHP_EOL, $rad;\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "96cbe28c8e57a4845e1936dfe73d3835", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0; $i--)\n{\n\t$j += $t[$i];\n\t$r += max(0, $p[$i]-($c*$j));\n}\n\necho (($l>$r)?\"Limak\":(($l<$r)?\"Radewoosh\":\"Tie\"));", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1af226fd35ae4702a2da684fd380ed07", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n $j += $d[$x];\n $k = $c[$x] - ($b * $j);\n $l = max(0, $k);\n $i += $l;\n}\nif($e > $i)\n{\n print \"Limak\";\n}\nelseif($e == $i)\n{\n print \"Tie\";\n}\nelseif($e < $i)\n{\n print \"Radewoosh\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "eeb3e5633c72aa7b06e56dafd0eb166d", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $perm) {\n $score = 0;\n for ($i = 0; $i < $n; $i++) {\n for ($j = $i; $j < $n; $j++) {\n $score += min(array_slice($perm, $i, $j - $i + 1));\n }\n }\n $scores[$score][] = $permI;\n}\n\nkrsort($scores);\necho implode(\" \", $allP[$scores[key($scores)][$m - 1]]), \"\\n\";\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "068f725793dd34fa45281d16d52b2e0b", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "9c70409728944fe36b895e3513e3a50a", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a) | ($sumTop % 2 != $sumBot % 2))\n {\n $res = -1;\n break;\n }\n else\n {\n $sumTop += $dBot[$up] - $dTop[$up];\n $sumBot += $dTop[$up] - $dBot[$up];\n }\n \n }\n\n printf($res);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3f62efffa06d5b7e87f6af81bc54a829", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $right[$i]) ? true : false;\n }\n\n if ($more) {\n if ($left[$i] < $right[$i]) {\n $verdict = \"NO\";\n break;\n }\n } else {\n if ($left[$i] > $right[$i]) {\n $verdict = \"NO\";\n break;\n }\n }\n \n}\n\nfunction array_sort(&$array) {\n $array_count = count($array);\n for ($i=0; $i<$array_count; $i++) {\n for ($j=$i; $j<$array_count-1; $j++) {\n if ($array[$j+1] > $array[$i]) {\n $tmp = $array[$j+1];\n $array[$j+1] = $array[$i];\n $array[$i] = $tmp;\n }\n }\n }\n return false;\n}\n\n\n\n fputs(STDOUT, $verdict);\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "b3185c4bc5b8075f85d9aaaf381a200b", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $sides[1][$i]){ $leftSideLess = false; break;}\n}\n\n\nsort($sides[0]);\nsort($sides[1]);\n$leftSideBigger = true;\nfor($i = 0; $i < $n; $i++) {\n if($sides[0][$i] <= $sides[1][$i]){$leftSideBigger = false; break;}\n}\n\n//var_dump($number);\n//var_dump($sides[0]);\n//var_dump($sides[1]);\n\nif($leftSideBigger || $leftSideLess)echo\"YES\";\nelse echo\"NO\";\n\n\n\n\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "4bbf7cfb28dae91fa605becc62a031f1", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $mas2[$i])\n {\n $k++;\n }\n else if ($mas1[$i] == $mas2[$i])\n {\n $result = true;\n }\n else\n {\n $m++;\n }\n}\nif ($result)\n{\n echo \"NO\";\n}\nelse\n{\n if ($k == $string1 or $m == $string1)\n {\n echo \"YES\";\n }\n else\n {\n echo \"NO\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "451426032ad8f7e063e6100ab617fae1", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $right[$i] )\n\t{\n\t\t$res[0]++;\n\t} else if ( $left[$i] < $right[$i] ) {\n\t\t$res[1]++;\n\t}\n}\n\nif( $res[0] == $count || $res[1] == $count ){\n\techo 'YES';\n} else {\n\techo 'NO';\n}\n\nfclose($fp);\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "b1f3eec11b4312fafa620cb68d21e058", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d[$x])\n {\n $f++;\n }\n}\nif(($e == $a) || ($f == $a))\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "ced3e00073c1c38df0405b256b1d1141", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$s[1][$i]) $rm = false;\n if($s[0][$i]<$s[1][$i]) $rp = false;\n if($s[0][$i]==$s[1][$i]) {print 'NO'; exit(0);}\n}\n\nif($rm||$rp) print 'YES'; else print 'NO';\n\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "f3252722b09261a31bfcc841ee23a546", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$s[1][$i]) $chek = true; else $chek = false;\n }\n if ($chek == true AND $s[0][$i]>$s[1][$i]) $out = true; elseif ($chek == true AND $s[0][$i]<=$s[1][$i]) {$out = false; break;}\n if ($chek == false AND $s[0][$i]<$s[1][$i]) $out = true; elseif ($chek == false AND $s[0][$i]>=$s[1][$i]) {$out = false; break;}\n}\nif ($out==true) echo \"YES\"; else {echo \"NO\";}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "75707c9c5889dd7212e3446014ec6fbf", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\t$inp_arr = str_split(rtrim($Scanner->Scan()));\n\t\n\tfor ($i = 0; $i < $inp_n; $i++) {\n\t\t$inp_arr1[] = $inp_arr[$i];\n\t}\n\tfor ($i = $inp_n; $i < 2 * $inp_n; $i++) {\n\t\t$inp_arr2[] = $inp_arr[$i];\n\t}\n\t\n\tsort($inp_arr1);\n\tsort($inp_arr2);\n\t$LUCY= false;\n\tif ($inp_n === 1 && $inp_arr1[0] === $inp_arr2[0]) $LUCY = true;\n\tfor ($i = 1; $i < $inp_n; $i++) {\n\t\tif ($inp_arr1[0] < $inp_arr2[0]) {\n\t\t\tif ($inp_arr1[$i] >= $inp_arr2[$i]) {\n\t\t\t\t$LUCY= true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} elseif ($inp_arr1[0] > $inp_arr2[0]) {\n\t\t\tif ($inp_arr1[$i] <= $inp_arr2[$i]) {\n\t\t\t\t$LUCY= true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} elseif ($inp_arr1[0] === $inp_arr2[0]) {\n\t\t\t$LUCY= true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ($LUCY) {\n\t\tprint(\"NO\");\n\t} else {\n\t\tprint(\"YES\");\n\t}\n\t$Scanner->close();\n}\n\nob_end_clean();\nsolve();\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\nclass Scanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $Id = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link or ''php://stdin' err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\n\t\t//err $c_row = array(\"\\n\", \"\\r\", \"\\r\\n\");\n\t\t$c_row = array(\"\\r\\n\", \"\\r\", \"\\n\");\n\t\t$contents = str_replace($c_row, \" \", $contents);\n\t\t$this->Scanners = explode(\" \", $contents);\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Id;\n\t\t$sc = $this->Scanners[$x];\n\t\t$this->Id = ++$x;\n\t\treturn $sc;\n\t}\n\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\n/*\n====begin=====\n\n//input $inp_ or upper\n//block $temp_\n//two block$ttemp_\n//as \t $as_\n//instance $(Upper)\n//ref $ref\n//class menba $^Upper\n\n====end=======\n\n===== class begin =====\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\n//ref \"#109_div2_B_1230942 laurenceHR\"\nclass LineScanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $LineIds_Of_ScanIds= array();\n\tprivate $LinesScanners = array();\n\tprivate $LastScanIds_Of_LineIds = array();\n\tprivate $Scan_number = 0;\n\tprivate $Scanline_number = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\t\t\n\t\t$temp_lines = explode(\"\\n\", $contents);\n\t\t$temp_linescanners = array();\n\t\t$temp_x = 0;\n\t\t$temp_y = 0;\n\t\t//--attention for initting of array--(these is not needed but for easily reading)//\n\t\t$ttemp_scanners = array();\n\t\t//$del = Array(\"\\n\",\"\\r\",\"\\n\\r\");\n\t\tforeach ($temp_lines as $as_line) {\n\t\t\tif (strlen($as_line) === 0) {\n\t\t\t\tprint(\"input err\");\n\t\t\t}\n\t\t\t\n\t\t\t//$as_line = str_replace($del,'',$as_line);\n\t\t\t$temp_linescanners[] = $as_line;\n\t\t\t$ttemp_line_scanners = explode(\" \", $as_line);\n\t\t\t//$ttemp_scanners = array();\n\t\t\tforeach ($ttemp_line_scanners as $as_sc) {\n\t\t\t\t$ttemp_scanners[] = $as_sc;\n\t\t\t\t$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;\n\t\t\t\t$temp_x++;\n\t\t\t}\n\t\t\t$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;\n\t\t\t$temp_y++;\n\t\t}\n\t\t$this->Scanners = $ttemp_scanners;\n\t\t$this->LinesScanners = $temp_linescanners;\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"scan err\");\n\t\t}\n\t\t\t\t\n\t\t$sc = $this->Scanners[$x];\n\t\t//--attention for ++$x//\n\t\t//$this->Scan_number = $x++;\n\t\t$this->Scan_number = ++$x;\n\t\t$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];\n\t\treturn $sc;\n\t}\n\t\n\tfunction LineScan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"linescan err\");\n\t\t}\n\t\t\n\t\t$lsc = $this->LinesScanners[$y];\n\t\t$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;\n\t\t$this->Scanline_number = $y + 1;\n\t\treturn $lsc;\n\t}\n\t\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\nclass Token{\n\tprivate $token;\n\tprivate $tok;\n\t\n\tpublic function __construct($str_line, $tok) {\n\t\t$this->tok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t$this->token = strtok($this->tok);\n\t\treturn $thisToken;\n\t} \n\t\t\n\tpublic function nextFloat() {\n\t\treturn (float)$this->nextToken();\n\t}\n\t\n \tpublic function nextInt() {\n\t\treturn (int)$this->nextToken();\n\t}\n\t\n\tpublic function nextIntArray() {\n\t\t$temp_arr = array();\n\t\t$flag = -1;\n\t\twhile ($flag !== 1) {\n\t\t\t$thisToken = $this->nextToken();\n\t\t\tif ($thisToken !== false) {\n\t\t\t\t$temp_arr[] = $thisToken;\n\t\t\t} else {\n\t\t\t\t$flag = 1;\n\t\t\t}\n\t\t}\n\t\treturn $temp_arr;\n\t}\n\n\tpublic function nnextIntArray($num) {\n\t\t$temp_arr = array();\n\t\tfor ($i = 0; $i < $num; $i++) {\n\t\t\t$temp_arr[] = (int)$this->token;\n\t\t}\n\t\treturn $temp_arr;\n\t}\n}\n===== class end ======\n\n=== function begin ===\n\nfunction get_line() {\n $stdin = fopen(\"php://stdin\", \"r\"); \n $line = rtrim($stdin, \"\\n\"); \n fclose($stdin); \n return $line; \n}\n\nfunction num_printf($i){\n\tif (is_float($i)) {\n\t\tprintf(\"%.0f\", $i);\n\t}\n\tif (is_int($i)) {\n\t\tprintf(\"%d\", $i);\n\t}\n}\n\nfunction array_printf(array $array) {\n\t\t$message = \"\";\n\t\tforeach ($array as $value) {\n\t\t\t$message .= \"$value\" . \" \";\n\t\t}\n\t\t$message = rtrim($message);\n\t\tprintf('%s', $message);\n}\n\n== function end ======\n*/\n\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "db5cb3c11fe270894d6aa78e668b5614", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$b[$i]) {$o1=0;break;}\nfor($i=0;$i<$n;$i++) if($a[$i]<=$b[$i]) {$o2=0;break;}\necho ($o1||$o2)?\"YES\":\"NO\"\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "40abee385f463f1f2b0c29dc55a53448", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$c[$i])$ls=false;\n if($b[$i]<=$c[$i])$gr=false;\n}\nif($gr||$ls)$is=true;\necho $is?'YES':'NO';", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "aad18f51b993323e2b74cc39c6c742b3", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "08b42fa1a44a4ca719b8b198c2793735", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n $b) list($a,$b) = array($b,$a);\n\techo floor(($a + min($b,$a*2))/3);\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "1f3ed7678fca881c3d3cb39cce53c71d", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $m > 0){\n $n--;\n $m--;\n if(($n == 0 && $m > 0) || ($n > 0 && $m == 0)){\n $i++;\n break;\n } elseif($n == 0 && $m == 0){\n break;\n }\n if($n < $m){\n $m--;\n } else {\n $n--;\n }\n $i++;\n }\n \n fwrite(STDOUT, $i);\n ?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "68edc18c4db47543d87e8144207e13a3", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "d2b1b0607ddaeb4ea9941c3fbbd5033c", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n {\n $c++;\n $a -= 2;\n $b -= 1;\n }\n elseif($a < $b)\n {\n $c++;\n $a -= 1;\n $b -= 2;\n }\n}\nprint $c;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "39c6a9f048221464029d78f27104f011", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) list($a,$b) = array($b,$a);\n\techo floor(($a + min($b,$a*2))/3);\n?> ", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "8f411c1d9560cc7007d5d74759e25093", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "5fda38abf6a001e319ad2233ef116ca2", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "25c361273204b694d4954daceb7264d7", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "6fc9fee21689ce4a90b7af052c6c4d40", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "f22c2c6778e7a69c88eec65cfb534da1", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "89cf3d1022fed4bdf59d87fc7904b725", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "50d9da6c638a018766edb8ef93239c6e", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "76af769c21860fffdbc718eccc68344f", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "edd32b9b8a5e92cc8626aaf9f26b2042", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n $d -= 3;\n $f--;\n if(($f == 0) && ($d == $b))\n {\n $e = 1;\n break;\n }\n elseif(($f == 0) && ($d != $b))\n {\n break;\n }\n }\n }\n if($e == 0)\n {\n print \"NO\\n\";\n }\n else\n {\n print \"YES\\n\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5959b2156ec88d6f9e9d16dda4bb0124", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "ff52ef3a0bf9004f35f0de0f5e83439e", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3)? 'YES'.PHP_EOL : 'NO'.PHP_EOL;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\techo ($div >= 5)? 'YES'.PHP_EOL : 'NO'.PHP_EOL;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "4e02a000de6047bf1baef05792dc09ec", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b531a2ab7ecda1541f0c04734d13018d", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$d)$d++;\nif($d<=$b)echo(\"0\");\nelse echo($d-$b);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d1a54645eacc86e8cdd54cb03741e11f", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "929917999df39db7cb3771e795432b66", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c2bad43742ba23d4b1a0dad210de89ba", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ff47d0013b338a5bdec68b5cac8c8b22", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$y)?0:ceil($n*$y/100) - $x;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f511362b7164dc07bdcd13ac82ce4f36", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "40c2ac4e5846b1bd2df125a7bb7c7291", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a44ea4fa94c7ac3fedfbb21f15a67373", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c7f6c58955e5ab4e9ee6ac37058b1cc6", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$max)\n\t \t$max=$array[$i][$j];\n\t}\n}\necho \"$max\";\n//print_r($array);", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "d55acb86d9ba1d94e0135da46a6405eb", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value){\n\t\t$ans = max($value);\n\t}\n\t//$ans = max($array);\n\t//var_dump($ans);\n\techo $ans;\n\n ?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c0cdccf56b4492699437ad2523889f26", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "e31e96b3bcd7a6405199b26de2a914ef", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "0e9db01e4701adb3eabf89b0929240a3", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "473bebc05b609da634a54cc19e3750bf", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "fb9b0dbf03df1376db40f8954a319091", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "fe36111536fed8960ad784a73031ed1a", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "de6ce5fcd8c696f435a9efc2480ff5ac", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "5f401e4936dd03052aaa9c28d1fe1929", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "1e0b26e464307474ddf5db3580954459", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "89cc546a8480da8e20848611d73d6c47", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "6ce909b6e0defdcef6467a5439dc7f97", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0)) {\n $result++;\n }\n }\n}\necho $result;\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "017af207b2d8e83f69716922edd9b191", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "b39ee6d69927b986d33d1c7166220e81", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": ">1)die(strval($m-1));\nprint($m>$n+1>>1?$m-1:$m+1);", "lang_cluster": "PHP", "tags": ["constructive algorithms", "games", "math", "greedy", "implementation"], "code_uid": "4bed59e8c9782ee77289991490f17724", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 7) $cur_d = 1;\n }\n} else {\n for ($i = 0; $i < 12; $i++) {\n if ($n <= $m[$i]) $s++;\n }\n}\necho $s;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6ff98c48e56ea1a3a5e09a0e20d6c22c", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fd716e41e7174045bbbfff2db082fc67", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 7) {\n $cur_d = 1;\n }\n\n }\n}\nif ($word == \"month\") {\n for ($i = 0; $i < 12; $i++) {\n if ($n <= $m[$i]) {\n $s++;\n }\n }\n}\necho $s;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6efaad7b8ada068975be2dae70562dc5", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "456ff5e701b6d97057986da22c44ce2b", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max) $max = $cur;\n\t\t} else {\n\t\t\t$cur = 0;\t\t\t\n\t\t}\n\t}\n\tif ($max > $b) {\n\t\t$poss = false;\n\t}\n\t\n\tif ($poss == true) {\n\t\techo 'YES';\n\t} else {\n\t\techo 'NO';\n\t}\n?>", "lang_cluster": "PHP", "tags": ["dp"], "code_uid": "8321d77db89c338dc0bccec9b53111bd", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $st[$i - 1] == 'N') $num = 0;\n if (($i + $k < $n) && ord($st[$i + $k]) == ord('N')) $num = 0;\n if ($num == 1) $ans = 1;\n }\n \n $num = 0; $res = 0;\n for ($i = 0; $i < $n; $i ++) {\n if ($st[$i] == 'N')\n $num ++;\n else {\n if ($num > $res) $res = $num;\n $num = 0;\n }\n }\n if ($num > $res) $res = $num;\n \n if ($ans == 1 && $k >= $res) {\n fprintf(STDOUT, \"YES\");\n }\n else {\n fprintf(STDOUT, \"NO\");\n }\n?> ", "lang_cluster": "PHP", "tags": ["dp"], "code_uid": "215e560376605609d4c7fa0817934c86", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= (ceil($m_boy_finger/2)-1) && $v_girl_finger <= ($m_boy_finger + 1) ) {\n\t\techo \"YES\";\n\t\texit(0);\n\t}\n}\n\necho \"NO\";\nexit(0);\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "0c47c1a45b6b9c373577b4c5e613ba87", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $e - 2) && ($d <= $f))\n {\n print \"YES\";\n }\n else\n {\n $g = $b;\n $g++;\n $h = $g * 2;\n if(($c >= $g - 2) && ($c <= $h))\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "8821e3d99e54e5dd8172462f486c39c0", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "dc5b439bd00b13121bc3df12e501bfb8", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp"], "code_uid": "4be895c3e62da3e79382c2ad51c106ad", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp"], "code_uid": "ff1407122b40c8df4aa8a527208f1cb2", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "greedy", "dp", "implementation"], "code_uid": "af64560fa752d7a5fc99f7ba8a689ab3", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "728b077276ba8ef4ceb7f4ecb4c4cea7", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n print \"No\";\n}\nelse\n{\n print \"Yes\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4723f108b84d9f882df1d6983852be57", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $n ? 'YES' : 'NO';\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fc66988fcdba17a34bee3977a3d8e172", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "896f46bbf2bf47e6d64eff0bc3c36e6f", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $m || $n > $k) {\n echo 'No';\n} else {\n echo 'Yes';\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fbc02c27cb551aba2b8a5b0696a0f2a7", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $n || $simple_del > 2) break;\n if($n%$sn==0) $simple_del++;\n }\n if($simple_del == 2) return true;\n return false;\n}\n$lines = @file(\"php://stdin\");\n$limit = $lines[0];\n$simple_nums = [2,3];\nfor($i = 5; $i <= $limit/2; $i+=2){\n $simple = true;\n for($j=3; $j <= $i/2; $j++){\n if($i%$j == 0) {\n $simple = false;\n break;\n }\n }\n if($simple) $simple_nums[] = $i;\n}\n\n$count = 0;\nfor($i=1; $i <= $limit; $i++){\n if(isAlmostSimple($i, $simple_nums)) $count++;\n}\necho $count;", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "d9c989b1dc0e06fc387149c101dc8e52", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "c33819ba4bf999815ff5b6101b2184a2", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "5a029c49fb9e954d30ad4f3b35597b4b", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "0643cbbb5b28b3ee76a94d4ff1cb3b34", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "8) exit;\n\nforeach($names as $k=>$v){\nif(strlen($v)==$num){\n$temp=0;\nfor($i=0;$i<=strlen($str)-1;$i++){\n\nif($v[$i]==$str[$i] || $str[$i]=='.'){\n$temp++;\n}\n\n}\nif($temp==$num){$rezult=$v;}\n}\n}\n\nprint $rezult;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "6b353354bc3996d195fc9c0a388719f9", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\"vaporeon\",\n\t\t 1=>\"jolteon\",\n\t\t 2=>\"flareon\", \n\t\t 3=>\"espeon\", \n\t\t 4=>\"umbreon\",\n\t\t 5=>\"leafeon\", \n\t\t 6=>\"glaceon\", \n\t\t 7=>\"sylveon\"\n ];\n $ev1=\"vaporeon\";\n $ev2=\"jolteon\";\n $ev3=\"flareon\";\n $ev4=\"espeon\";\n $ev5=\"umbreon\";\n $ev6=\"leafeon\";\n $ev7=\"glaceon\";\n $ev8=\"sylveon\";\nif($str=='......')\necho \"espeon\";\nelseif ($str=='........')\n {\n \techo \"vaporeon\";\n\t# code...\n}\n\n\n\nelse\n{\n\n\n \n \n $flag=0;\n $max=0;\n //$length=9;\n $trgetStr=findTrgtStr($str);\nfor ($i=0; $i =$max&&strlen($eve[$i])==$n)\n {\n \t$max=$count;\n \t//$length=strlen($eve[$i]);\n \t$str3=$eve[$i];\n }\n //echo \"$max\\n\";\n\n \n \n}\t\nprint_r($str3);\n}\n\nfunction findTrgtStr($str)\n{\n\t$trgetStr=\"\";\nfor ($i=0; $i $name){\n if($pos[$k] && $s[$i]!=$name[$i]){\n $pos[$k] = 0;\n $c--;\n }\n }\n if($c==1){\n break;\n }\n }\n }\n\n for($i=0; $i<$n; $i++){\n if($pos[$i]){\n echo $names[$i];\n break;\n }\n }\n\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "7c769f29f1811fc5d805066a7fd15b69", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "7a18305220b5f628909a04dc8ddda6cd", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\"vaporeon\",\n\t\t 1=>\"jolteon\",\n\t\t 2=>\"flareon\", \n\t\t 3=>\"espeon\", \n\t\t 4=>\"umbreon\",\n\t\t 5=>\"leafeon\", \n\t\t 6=>\"glaceon\", \n\t\t 7=>\"sylveon\"\n ];\n\nif($str=='......')\necho \"espeon\";\nelseif ($str=='........')\n {\n \techo \"vaporeon\";\n\t# code...\n}\n\n\n\nelse\n{\n\n\n \n \n $flag=0;\n $max=0;\n //$length=9;\n $trgetStr=findTrgtStr($str);\nfor ($i=0; $i =$max&&strlen($eve[$i])==$n)\n {\n \t$max=$count;\n \t//$length=strlen($eve[$i]);\n \t$str3=$eve[$i];\n }\n //echo \"$max\\n\";\n\n \n \n}\t\nprint_r($str3);\n}\n\nfunction findTrgtStr($str)\n{\n\t$trgetStr=\"\";\nfor ($i=0; $i 0,1 => 0,2 => 0,3 => 0,4 => 0,5 => 0,6 => 0,7 => 0,8 => 0,9 => 0);\n$b = array(\"6\", \"2\", \"5\", \"5\", \"4\", \"5\", \"6\", \"3\", \"7\", \"6\");\nlist($c, $d) = explode(\" \", trim(fgets(STDIN)));\nif(($c == 1) && ($d == 1000000))\n{\n print \"28733372\";\n}\nelseif(($c == 2) && ($d == 1000000))\n{\n print \"28733370\";\n}\nelseif(($c == 1) && ($d == 999999))\n{\n print \"28733334\";\n}\nelse\n{\n for($x = $c; $x <= $d; $x++)\n {\n $e = str_split($x);\n for($y = 0; $y < count($e); $y++)\n {\n $a[$e[$y]]++;\n }\n }\n $f = 0;\n for($x = 0; $x <= 9; $x++)\n {\n $g = $a[$x] * $b[$x];\n $f += $g;\n }\n print $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "da5bec6ef3c28c528eb5838bb47e4879", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0,1 => 0,2 => 0,3 => 0,4 => 0,5 => 0,6 => 0,7 => 0,8 => 0,9 => 0);\n$b = array(\"6\", \"2\", \"5\", \"5\", \"4\", \"5\", \"6\", \"3\", \"7\", \"6\");\nlist($c, $d) = explode(\" \", trim(fgets(STDIN)));\n//\nif(($c == 1) && ($d == 1000000))\n{\n print \"28733372\";\n}\nelseif(($c == 2) && ($d == 1000000))\n{\n print \"28733370\";\n}\nelseif(($c == 1) && ($d == 999999))\n{\n print \"28733334\";\n}\nelse\n{\n for($x = $c; $x <= $d; $x++)\n {\n $e = str_split($x);\n for($y = 0; $y < count($e); $y++)\n {\n $a[$e[$y]]++;\n }\n }\n $f = 0;\n for($x = 0; $x <= 9; $x++)\n {\n $g = $a[$x] * $b[$x];\n $f += $g;\n }\n print $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "71e487a1f04a1bd36f00d26804379347", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n //print $m . \" \";\n $cont += $numbers[$m % 10];\n $m = (int) ($m / 10);\n }\n }\n print $cont;\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5c46167be36cf3fa07d44ad9acb3f4cb", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 6,\n 1 => 2,\n 2 => 5,\n 3 => 5,\n 4 => 4,\n 5 => 5,\n 6 => 6,\n 7 => 3,\n 8 => 7,\n 9 => 6,\n ];\n $res = 0;\n for($i = $a ; $i <= $b ; $i++){\n $num = $i;\n while($num){\n //var_dump($num);\n $res += $tbl[(int)$num % 10];\n $num = (int)((int)($num)/10);\n }\n }\n fprintf(STDOUT, \"%d\" , $res);\n exit();\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3d6ba3c438a31fe0ade87829f0279332", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $y--)\n {\n if($b % $y == 0)\n {\n array_push($c, $y);\n $b = $y;\n break;\n }\n }\n}\nprint implode(\" \", $c);\n?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "56d790172bf2843c5ab2d46ed11c50d3", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1) {\n for($i=2;$i<=$n;++$i) if($n%$i==0) { $n/=$i; break; }\n echo \"$n \";\n}", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "bbe66e9b73afa895cf6be777076a4b86", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 60)\n{\n $f = $e % 60;\n $g = floor($e / 60);\n $h = $b + $f;\n if($h >= 60)\n {\n $i = $h % 60;\n $j = floor($h / 60);\n $a += ($g + $j);\n $b = 0;\n $b += $i;\n }\n else\n {\n $a += $g;\n $b += $f;\n }\n if(strlen($a) == 1)\n {\n $a = \"0\" . $a;\n }\n if(strlen($b) == 1)\n {\n $b = \"0\" . $b;\n }\n print $a . \":\" . $b;\n}\nelse\n{\n $b += $e;\n if($b >= 60)\n {\n $i = $b % 60;\n $j = floor($b / 60);\n $a += ($g + $j);\n $b = 0;\n $b += $i;\n }\n if(strlen($a) == 1)\n {\n $a = \"0\" . $a;\n }\n if(strlen($b) == 1)\n {\n $b = \"0\" . $b;\n }\n print $a . \":\" . $b;\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "15f7ea03b3bceb0f15f26d7881260930", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 60)\n{\n $f = $e % 60;\n $g = floor($e / 60);\n $h = $b + $f;\n if($h >= 60)\n {\n $i = $h % 60;\n $j = floor($h / 60);\n $a += ($g + $j);\n $b = 0;\n $b += $i;\n }\n else\n {\n $a += $g;\n $b += $f;\n }\n if(strlen($a) == 1)\n {\n $a = \"0\" . $a;\n }\n if(strlen($b) == 1)\n {\n $b = \"0\" . $b;\n }\n print $a . \":\" . $b;\n}\nelse\n{\n $b += $e;\n if($b >= 60)\n {\n $i = $b % 60;\n $j = floor($b / 60);\n $a += ($g + $j);\n $b = 0;\n $b += $i;\n }\n if(strlen($a) == 1)\n {\n $a = \"0\" . $a;\n }\n if(strlen($b) == 1)\n {\n $b = \"0\" . $b;\n }\n print $a . \":\" . $b;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "51b529bceefc125ab652a8f1e3255f6e", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $v)\n if ($v > $max) {\n $r = $k;\n $max = $v;\n }\n\necho $r;\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "86ef7d135fad68aa54a021e2b4bd1494", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$biceps && $chest>$back ){\n echo 'chest';\n }\nelseif ($biceps>$chest && $biceps>$back ) {\n echo 'biceps';\n}else {\n echo 'back';\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "35e906d9c480d80cac6a75eaeed69e46", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $e)\n{\n if($d > $f)\n {\n print \"chest\";\n }\n else\n {\n print \"back\";\n }\n}\nelse\n{\n if($e > $f)\n {\n print \"biceps\";\n }\n else\n {\n print \"back\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2aa01ffcc1365b23d46041cb0b4f9712", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b[1] && $b[0] > $b[2]) echo \"chest\";\nelse if($b[1] > $b[0] && $b[1] > $b[2]) echo \"biceps\";\nelse echo \"back\";\n\t\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7e636532ebe4d100355f6ffa1b9ac1f1", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f) && ($c <= $g) && ($d >= $g))\n {\n $h = 1;\n break;\n }\n else\n {\n $f += $e;\n $g++;\n }\n}\nif($h == 0)\n{\n print \"NO\";\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["two pointers", "brute force"], "code_uid": "59a34eb524a89d2a6e4d676c6d126146", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $f)\n{\n print \"Misha\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "64aaa25ec09556456ac1988a73d04bba", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $res2)\n echo \"Misha\".PHP_EOL;\n if($res1 < $res2)\n echo \"Vasya\".PHP_EOL;\n if($res1 == $res2)\n echo \"Tie\".PHP_EOL;\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e2afa353f21d58ec147dd775d2fc9323", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $f)\n{\n print \"Misha\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "62fb8d3941881869f36eb22a6e17eb4e", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $r[1]) {\n echo \"Misha\";\n} \nif ($r[0] < $r[1]) {\n echo \"Vasya\"; \n}\nif ($r[0] == $r[1]) {\n echo \"Tie\";\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4dc9f26369a0d6c75f99d7273595e561", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "b7269d731d51ee116c9dd459bfd10275", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 2 && $y >= 2) {\n $x-=2;\n $y-=2;\n return true;\n } else if ($x >= 1 && $y >= 12) {\n $x-=1;\n $y-=12;\n return true;\n } else if ($x >= 0 && $y >= 22) {\n $y-=22;\n return true;\n } else {\n return false;\n }\n}\n\nfunction doit2(& $x, & $y) {\n if ($x >= 0 && $y >= 22) {\n $y-=22;\n return true;\n } else if ($x >= 1 && $y >= 12) {\n $x-=1;\n $y-=12;\n return true;\n } else if ($x >= 2 && $y >= 2) {\n $x-=2;\n $y-=2;\n return true;\n } else {\n return false;\n }\n}\n\nfunction doit(){\n $var = fgets(STDIN);\n $i=0;\n $arr = explode(\" \", $var);\n\n for( ; ;){\n if($i===0){\n if(!doit1($arr[0],$arr[1])){\n print \"Hanako\\n\";\n return ;\n }\n }\n else{\n if(!doit2($arr[0],$arr[1])){\n print \"Ciel\\n\";\n return ;\n }\n }\n $i = ( $i==0 ? 1 : 0 );\n }\n}\n doit();\n?>\n", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "f98736548b12a4873f41f68ce47afb77", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n break;\n }\n else\n {\n $d[count($d)] = $f;\n $f += $a;\n }\n}\nwhile(TRUE)\n{\n if($g > $c)\n {\n break;\n }\n else\n {\n $e[count($e)] = $g;\n $g += $b;\n }\n}\n$h = array_intersect($d, $e);\nprint count($h);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "629f18af3ce69d9f3077c614f517c602", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b){\n $iCount += $b*2 + 1;\n} elseif($a < $b) {\n $iCount += $a*2 + 1;\n} elseif($a == $b){\n $iCount += $a*2;\n}\necho $iCount;", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "c4ef196c3b076be573b3856e75e4e1f7", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "171b72a231614c6ad1d3de11440c2cf2", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a_size)\n {\n $l_length = 2 * $a_size + 1;\n }\n else if($b_size == $a_size)\n {\n $l_length = 2 * $a_size;\n }\n else\n {\n $l_length = 2 * $b_size;\n }\n //echo \"L_length=\".$l_length.PHP_EOL;\n $w_left = $l_length + $c_length;\n //echo \"W_left=\".$w_left.PHP_EOL;\n\n // When right\n $r_length = 0;\n if($a_size > $b_size)\n {\n $r_length = 2 * $b_size + 1;\n }\n else if( $a_size == $b_size)\n {\n $r_length = 2 * $a_size;\n }\n else\n {\n $r_length = 2 * $a_size;\n }\n //echo \"R_length=\".$r_length.PHP_EOL;\n $w_right = $r_length + $c_length;\n //echo \"W_right=\".$w_right.PHP_EOL;\n\n return max($w_right, $w_left);\n}\n\n$n = explode(\" \", trim(fgets(STDIN)));\n\n$a1 = $n[0];\n$b1 = $n[1];\n$c1 = $n[2];\n\necho getMaxLength($a1,$b1,$c1);", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "5cc6287abaed9c4666cd47e8a253efe9", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $bb) {\n $totalLength = $bb*2+1+$cc*2;\n}\nif ($aa < $bb) {\n $totalLength = $aa*2+1+$cc*2;\n}\nif ($aa == $bb){\n $totalLength = $aa+$bb+$cc*2;\n}\necho($totalLength . PHP_EOL);", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "5d43f11988d2743f354ed70ced7c8aa8", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "038a466612ebe0af7ced41acbfca477b", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b)?\"Second\\n\":\"Friendship\\n\"));\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "6a5467cba913e8f5602f8c12938d5649", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $time2) echo 'Second';\nif ($time1 == $time2) echo 'Friendship';", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "22357d6d251c068474cc2f009eef2e03", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "70a5dd8c06b1c195c5c90b9e7cf3e0f9", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= count($comb)) {\n return false;\n }\n $comb[$pos]++;\n if ($comb[$pos] > $orders[$pos]) {\n $comb[$pos] = 0;\n return next_comb($comb, $orders, $pos + 1);\n }\n return true;\n}\n\nif ($a == $b) {\n echo \"infinity\\n\";\n} elseif ($b > $a) {\n echo \"0\\n\";\n} elseif ($a == 1 && $b == 0) {\n echo \"1\\n\"; // fuck :) too lazy to actually fix\n} else {\n $divs = all_divisors($a - $b);\n $divisors = array_keys($divs);\n $orders = array_values($divs);\n $comb = array_fill(0, count($divs), 0);\n $ok = 0;\n do {\n $tryN = 1;\n foreach ($comb as $i => $count) {\n $tryN *= pow($divisors[$i], $count);\n }\n if ($tryN > $b) {\n $ok++;\n }\n } while (next_comb($comb, $orders));\n echo \"$ok\\n\";\n}\n\n", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "4ae9895c406d1f040e8f9098766190ce", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b);\n } else {\n $o += ($i>$b)+((int)($a/$i)>$b);\n }\n }\n }\n printf(\"%d\\n\",$o);\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "939503cd5d70ff23a8d5dde08dcbff9e", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n $rs--;\n }\n }\n }\n fprintf($fileOUT, $rs);\n //echo $rs;\n}\n\nfclose($fileIN);\nfclose($fileOUT);\n?>\n", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "205ee5be37d9ded4f35aefeedd915c6e", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b) : ($i>$b)+(($c/$i)>$b);\n }\n }\n echo $k;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "5c2d39dab58affdf81d3f79612c49efd", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b);\n\t\t\telse\n\t\t\t\t$ans+=($i>$b)+((int)($a/$i)>$b);\n\t\t}\n printf(\"%d\\n\",$ans);\n?>", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "8760cb5984ee790c6cbf57116ea06adf", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "89756404185cd0b5d6ad6037b082b415", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1077b2dadd1bf06491b5ef43120f954e", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b5a9f3b0e0af5f1af7a287412cab77ab", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $h) {\n $h = $v;\n }\n}\necho $h;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ea20d06241f776e6d265961c237e129e", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$max)\n\t \t $max=$cnt;\n\n}\necho \"$max\\n\";\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a6cdcce9c43cfc490289b9156e782484", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "d79d6e43afed51700d149fd5db05840e", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0;$i--) {\n if ($s[$i] == \"G\") {\n if ($s[$i - 1] == \"B\") {\n $r[$i] = $s[$i-1];\n $r[$i-1] = $s[$i];\n }\n }\n }\n $s=$r;\n}\n\necho $r;\n\n?>\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "d2843c34d55571816eb225e8347ef34a", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "40e8b0da9f132f0a7d64cec2149dadc4", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "0cf5d3dc48fb12e5836cbdcc5c82c521", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "2d64435164a4eacc462726e99d7df7ae", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0; --$j) {\n if ( $q[$j] == 'G' && $q[$j-1] == 'B') {\n $z = $q[$j-1];\n $q[$j-1] = $q[$j];\n $q[$j] = $z;\n --$j;\n\n }\n\n }\n }\n\n put($q);\n\n\n if (++$COUNT > 1) {\n break;\n }\n\n}\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "222ae0b1025687adef0491d58ce45946", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0; --$j) {\n if ( $q[$j] == 'G' && $q[$j-1] == 'B') {\n $z = $q[$j-1];\n $q[$j-1] = $q[$j];\n $q[$j] = $z;\n --$j;\n }\n\n }\n }\n\n echo $q;\n\n\n if (++$COUNT > 1) {\n break;\n }\n\n}\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "f741005d8edb47c4f08c819d39cef183", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "7f6c4a72f1ae73ea1f4461152f37ea64", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "5b808c1a1493dbe6c3e984d8fedd14c8", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$others)\n\t\techo strlen($str);\n\telse\n\t\techo ($count*2)-1;", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "e522ca39448540c478b05998aa596be6", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a[1] ? $a[0]+$a[1] : $a[0] * 2 - 1);\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "6c99f2c5e30271097fbae7eeff743069", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " strlen($s)/2) {\n echo strlen($s);\n}\nelse {\n $c = 0;\n for ($i = 0; $i < strlen($s); $i++) {\n if ($s[$i] == 'a') {\n $c++;\n }\n }\n echo $c*2 -1;\n}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "14dca9b766ff42bb27447a0f2b3f4f17", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "270299ad86f543ee2699b693501390bc", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9ce7d1be392b2aa02cc63529496aa359", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "strlen($aa))\n\techo strlen($aa);\nelse echo $cnt+$cnt-1;", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "0dd7a56c902bc10115710b50d6dd5914", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n print strlen($a) - ($c - $b + 1);\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "abe98d516fc35a4f78d2739514c2359e", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "75663690a6554d63fba85747e5e76da1", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n// echo $black;\n if($white == $black){\n fwrite(STDOUT, 'Draw'); \n } elseif($white > $black){\n fwrite(STDOUT, 'White'); \n } else {\n fwrite(STDOUT, 'Black'); \n }\n \n \n ?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4a4749165c55a861577abcdbab68030d", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n print \"White\";\n}\nelseif($a == $b)\n{\n print \"Draw\";\n}\nelseif($a < $b)\n{\n print \"Black\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "012e34c3e9c9a02b912aece13a851b52", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 9,\n 'r' => 5, \n 'b' => 3, \n 'n' => 3, \n 'p' => 1, \n 'k' => 0\n);\n$iW = 0;\n$iB = 0;\nforeach ($a AS $s) {\n for ($i = 0; $i < strlen($s) && $i < 8; $i++) {\n $sL = substr($s, $i, 1);\n if ($sL == '.') {\n continue;\n }\n else if (in_array($sL, $aW)) {\n $iW += $aWeight[strtolower($sL)];\n }\n else if (in_array($sL, $aB)) {\n $iB += $aWeight[$sL];\n }\n \n }\n \n}\n//echo 'White: ' . $iW . \"\\n\";\n//echo 'Black: ' . $iB . \"\\n\";\nif ($iW > $iB) {\n echo 'White';\n}\nelse if ($iW < $iB) {\n echo 'Black';\n}\nelse {\n echo 'Draw';\n}\n\n\nfclose($r);\nexit();\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c16a3bdcba2ba0d68c21e3a98aea6d3a", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $iBlackWeight)\n\t\techo \"White\\n\";\n\telse if ($iWhiteWeight < $iBlackWeight)\n\t\techo \"Black\\n\";\n\telse if ($iWhiteWeight == $iBlackWeight)\n\t\techo \"Draw\\n\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fa59941140a91ec39af9a6b723a1b643", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n echo \"White\";\n} elseif ($w < $b) {\n echo \"Black\";\n} else {\n echo \"Draw\";\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "49132d1836426cc1644a31fe7e44fe41", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b) && ($h <= $c))\n{\n print $h . \" \" . $d . \" \" . $f;\n}\nelseif($h > $c)\n{\n $i = $a - ($c + $f);\n if(($i >= $d) && ($i <= $e))\n {\n print $c . \" \" . $i . \" \" . $f;\n }\n else\n {\n $j = $a - $c - $e;\n print $c . \" \" . $e . \" \" . $j;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "05029fcc935e3015d414255805aa964d", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "de49f8928a864d7da86c7cfdd768c9fc", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7274c39f0fa1a6e49c359eb7b14e3a77", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$t+1) $s = 1;\n if($s!=1) $k++;\n $i++; \n}\necho $k;", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "8b70f5e5a4f751c6e0f6e4f82e248303", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "41e3909b310fbd603f361583e8c4535e", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "9d1a1d60ebaf970fc80c4e7348a06489", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "08c5206863d89e7f3fa6a40b3effcce9", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b745d7da3c5d77e0a08c2afff20a50be", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "784ec84e03bdafcb3df2d60b71f37823", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "245d81d60eeb9dcc95367975acf46812", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "0f4fd84910f5c1d1c5ede8d1d46cb24b", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2)\n break;\n }\n if ($k == 2)\n {\n $mas[$t] = $i;\n $t++; \n } \n}\n\nif (array_search($m, $mas) == array_search($n, $mas) + 1)\n echo \"YES\";\nelse\n echo \"NO\";\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "80a62cd5fa4958a148f57bdfe5019e1b", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i){\n $b -= $i;\n }else{\n\t\t\t\techo 'Valera';\n\t\t\t\treturn 0;\n }\n }else{ // Vladik give first\n if($a >= $i){\n $a -= $i;\n }else{\n echo 'Vladik';\n\t\t\t\treturn 0;\n }\n }\n }\n}\n\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "04dc9396033a0dc40a6db00e92977961", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0 || $b >= 0) \n\t{\n\t\t\n\t\tif ($i % 2 == 0)\n\t\t\t$b -= $i;\n\t\telse\n\t\t\t$a -= $i;\n\t\tif ($a < 0)\n\t\t{\n\t\t\tprint \"Vladik\\n\";\n\t\t\tbreak;\n\t\t}\n\t\telse if ($b < 0)\n\t\t{\n\t\t\tprint \"Valera\\n\";\n\t\t\tbreak;\n\t\t}\n\t\t$i = $i + 1;\n\t}\n}", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "4ed2b731fbaa91c71345d2c3ec495eae", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a[1]){\n print 'Valera';\n}\nelse{\n print 'Vladik';\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "083613a929282ad05c8626fc7080bfda", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b) {\n $n = $a;\n }\n for ($i = 1; $i <= $n+1; $i++) {\n if ($i%2 == 1) {\n \n if ($a < $i) {\n echo 'Vladik';\n break;\n }\n $a = $a - $i;\n } else {\n \n if ($b < $i) {\n echo 'Valera';\n break;\n }\n $b = $b - $i;\n }\n }\n \n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "3afb38ec6c79da13c341e443994b21bc", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "7){\n $coolxcnt++;\n break;\n }\n \n } \n } \n}\necho $coolxcnt;\n\n\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "0a4902166da97bea6cf7e433da27c254", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b)\n echo $b-$a+1;\nelseif (($min>$a)&&($min<$b))\n echo $min - $a;\nelse \n echo 0;\n?>\n", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "535a1f10f8d16143389fcdf3295d9a7d", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "02302a2a9af5e4c36fbde9684e7cef2f", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "4c079a53651933f93bae7b949a6a5a9e", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n{\n $matches += floor($current_participants / 2);\n $current_participants = ceil($current_participants / 2);\n}\n\n$total_bottles = ($matches * ($bottles_per_player * 2)) + $matches;\n$total_towels = ($participants * $towels_per_player);\n\necho $total_bottles . \" \" . $total_towels;\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "aa1ff3b460de1ffab81a4e8910794f8a", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "358ddeb6caaa85d6f7cd829c9ccb7740", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= count($c))\n {\n array_push($c, $b[$y]);\n unset($b[$y]);\n }\n elseif($b[$y] < count($c))\n {\n continue;\n }\n }\n if(count($b) == 0)\n {\n break;\n }\n}\nprint $x;\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "2dec3ba007f38ed5ff77a900cba335e0", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2b95ae7f5b443d92f1959970c7dc7edf", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n $r += $c;\n $c--;\n }\n echo $r.\"\\n\";\n }\n \n \n \n \n \n \n \n?>\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "69bed012f6cea0dbe002b06c9bc53f98", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$c; $i++) {\n $n -= $c;\n $c += $p++;\n}\necho $i;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6f273b213a1dbb2309e0f61dfad04154", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4d3bf6abb13bca02b30d38d5722baba3", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $input && $gfd != 1){\necho $i-1;\n$gfd = 1;\n}\nif($grfd >= $input && $gfd != 1){\necho $i;\n$gfd = 1;\n}\n}\n}\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b1fc09eea15795456d42974a0d071fa3", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a)\n {\n $d--;\n print $d;\n break;\n }\n elseif($e < $a)\n {\n $c++;\n $b += $c;\n $e += $b;\n $d++;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "090d1161d0c4d8a99dba2252b8e24dc3", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0);\n\techo $c-1;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4525292dd49d5185bd126d3319ed5bbd", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n)break;\n}\necho $max-1;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "21761bc302751fc969f28a2dd104440e", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\t$n = readNum($f);\n\t$nums = array(1 => 1);\n\t$row = 1;\n\t$max = 1;\n\twhile (true) {\t\t\n\t\t$row++;\n\t\t$nums[$row]=0;\n\t\tfor($i=1;$i<=$row;$i++){\n\t\t\t$nums[$row]+=$i;\n\t\t}\n\t\t$total = array_sum($nums);\n\t\tif($total>$n){\n\t\t\tbreak;\n\t\t}\n\t\t$max++;\n\t}\n\techo $max;\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "312fb4ebb11a8c357a0d49530f8f6bb6", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; ++$i)\n{\n $cnt += $i;\n $n -= $cnt;\n}\n$i -= 2;\necho \"$i\\n\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ebb939a03d543bf1c33aff0f6a508519", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b0b5917a7ded751e01a98649c670c482", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n {\n $d = $x;\n break;\n }\n array_splice($e, 0, $x);\n if(count($e) == 0)\n {\n break;\n }\n elseif(count($e) < $x)\n {\n for($y = 0; $y < count($e); $y++)\n {\n if($e[$y] - $i > 0)\n {\n $g += $e[$y] - $i;\n }\n else\n {\n break;\n }\n }\n if($g >= $b)\n {\n $d = $x;\n }\n break;\n }\n }\n if($d != 0)\n {\n break;\n }\n}\nif($d == 0)\n{\n print \"-1\";\n}\nelse\n{\n print $d;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "4bca2f49cb7ff741e844a4890873a0d5", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "binary search"], "code_uid": "15fe694e0b0ee96938e3940da8b20c5a", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "binary search"], "code_uid": "102604408105b288bd0b613a80d8ea65", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "x = $x;\n\t\t$this->y = $y;\n\t}\n\tstatic function read() {\n\t\t$x = readInt();\n\t\t$y = readInt();\n\t\treturn new Point($x, $y);\n\t}\n\tfunction eps($d) {\n\t\tfor ($dx = -$d; $dx <= $d; $dx++)\n\t\t\tfor ($dy = -$d; $dy <= $d; $dy++)\n\t\t\t\tif (abs($dx) + abs($dy) <= $d)\n\t\t\t\t\tyield new Point($this->x + $dx, $this->y + $dy);\n\t}\n}\n\nfunction pr($a, $b, $c) {\n\treturn ($a->x - $b->x) * ($c->x - $b->x) + ($a->y - $b->y) * ($c->y - $b->y) == 0;\n}\nfunction area($a, $b, $c) {\n\treturn ($a->x - $b->x) * ($c->y - $b->y) - ($a->y - $b->y) * ($c->x - $b->x);\n}\nfunction isRight($a, $b, $c) {\n\treturn (pr($a, $b, $c) || pr($b, $c, $a) || pr($c, $a, $b)) && area($a, $b, $c) != 0;\n}\nfunction d($a, $b) {\n\treturn abs($a->x - $b->x) + abs($a->y - $b->y);\n}\n\nfunction check($maxDiff) {\n\tglobal $a;\n\tforeach($a[0]->eps($maxDiff) as $p0)\n\t\tforeach($a[1]->eps($maxDiff) as $p1)\n\t\t\tforeach($a[2]->eps($maxDiff) as $p2)\n\t\t\t\tif (isRight($p0, $p1, $p2) && d($p0, $a[0]) + d($p1, $a[1]) + d($p2, $a[2]) <= $maxDiff)\n\t\t\t\t\treturn true;\n\treturn false;\n}\n\n$a = array_map(function() { return Point::read(); }, range(0, 2));\nif (check(0))\n\tprintf(\"RIGHT\\n\");\nelse if (check(1))\n\tprintf(\"ALMOST\\n\");\nelse\n\tprintf(\"NEITHER\\n\");\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "77e1fedbe3089e5a2aae2a99dc295899", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\nfunction stdin() {\n $stdin = @fopen('data.txt', 'r');\n if (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n }\n\n return $stdin;\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\nlist($x1, $y1, $x2, $y2, $x3, $y3) = explode(' ', g());\n\nfunction pifagor($x1, $y1, $x2, $y2, $x3, $y3) {\n if($x1 == $x2 && $y1 == $y2 || $x1 == $x3 && $y1 == $y3 || $x3 == $x2 && $y3 == $y2) {\n return false;\n }\n\n $a = pow(abs($x1-$x2), 2) + pow(abs($y1-$y2), 2);\n $b = pow(abs($x1-$x3), 2) + pow(abs($y1-$y3), 2);\n $c = pow(abs($x3-$x2), 2) + pow(abs($y3-$y2), 2);\n\n $max = $a;\n if($b > $max) $max = $b;\n if($c > $max) $max = $c;\n\n return $max == $a + $b + $c - $max;\n}\n\n$pifagor = pifagor($x1, $y1, $x2, $y2, $x3, $y3);\n\n$almost =\n pifagor($x1+1, $y1, $x2, $y2, $x3, $y3) ||\n pifagor($x1-1, $y1, $x2, $y2, $x3, $y3) ||\n pifagor($x1, $y1+1, $x2, $y2, $x3, $y3) ||\n pifagor($x1, $y1-1, $x2, $y2, $x3, $y3) ||\n\n pifagor($x1, $y1, $x2+1, $y2, $x3, $y3) ||\n pifagor($x1, $y1, $x2-1, $y2, $x3, $y3) ||\n pifagor($x1, $y1, $x2, $y2+1, $x3, $y3) ||\n pifagor($x1, $y1, $x2, $y2-1, $x3, $y3) ||\n\n pifagor($x1, $y1, $x2, $y2, $x3+1, $y3) ||\n pifagor($x1, $y1, $x2, $y2, $x3-1, $y3) ||\n pifagor($x1, $y1, $x2, $y2, $x3, $y3+1) ||\n pifagor($x1, $y1, $x2, $y2, $x3, $y3-1) ||\n\n false;\n\nif($pifagor) {\n echo 'RIGHT';\n} else if($almost) {\n echo 'ALMOST';\n} else {\n echo 'NEITHER';\n}\n\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "7aaefeeaa08f73b2022636fc4ba35cc2", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n if($f < $b)\n {\n $i = (($a - $f) + ($a - $c)) * $d;\n }\n else\n {\n $i = (($a - $f) + ($a - $c)) * $d;\n }\n }\n}\nelseif($g == -1)\n{\n if($b < $c)\n {\n if($f <= $b)\n {\n $i = ($f + $c) * $d;\n }\n else\n {\n $i = ($f + $c) * $d;\n }\n }\n elseif($b > $c)\n {\n if($f < $b)\n {\n $i = ($f + $a + ($a - $c)) * $d;\n }\n else\n {\n $i = ($f - $c) * $d;\n }\n }\n}\nprint min($h, $i);\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "ce0ce293bf37f6c070dbbf58740e0f38", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms", "math", "implementation", "geometry"], "code_uid": "875042fc1ab7173160da1b2f322e5797", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $maxx ? $x2 : $maxx) : $x2;\n\t$miny = isset($miny) ? ($y1 < $miny ? $y1 : $miny) : $y1;\n\t$maxy = isset($maxy) ? ($y2 > $maxy ? $y2 : $maxy) : $y2;\n\t$allpoints = array_merge($allpoints, array(\"$x1 $y1\", \"$x2 $y2\"));\n}\nif ($minx == $maxx || $miny == $maxy) {\n\tdie('NO');\n}\n\nif ($xx != 2 || $yy != 2) {\n\tdie('NO');\n}\n\n$counts = array_count_values($allpoints);\nif (count($counts) != 4) {\n\tdie('NO');\n}\nforeach ($counts as $val) {\n\tif ($val != 2) {\n\t\tdie('NO');\n\t}\n}\n\necho 'YES';\n//fclose($r);\n", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms", "math", "implementation", "geometry"], "code_uid": "4109e712c8fd81f34e69a818f6528037", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n $e[count($e)] = 0;\n break;\n }\n }\n if(($d < $c) && ($d != 0))\n {\n $e[count($e)] = 0;\n }\n $f = array_unique($e);\n $g = array_sum($e);\n if((count($f) == 1) && ($g > 0))\n {\n $h = 1;\n break;\n }\n }\n if($h == 0)\n {\n print \"NO\";\n }\n else\n {\n print \"YES\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a4fe8653a51d16dc419bfe5fdc7fecbf", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5d33054a4b381ac004695b77a572514f", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $unit) {\n break;\n }\n if ($j === $n - 1) {\n $flgLucky = true;\n }\n }\n }\n // var_dump($flgLucky);\n}\n\necho $flgLucky ? \"YES\" : \"NO\";\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "97b00472816876d342e0786b910a1fe4", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "fc1abbba82f7193c3b9f4aea90355956", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " value\n$k;\n$v;\n\nfor ($i = 0; $i < $n; $i++) { \n\tfscanf(STDIN, \"%d%d\", $k, $v);\n\t$colors[$i] = [$k, $v];\n}\n\n\n\n$result = 0;\n\n\n\nfor ($i = 0; $i < $n; $i++) { \n\tfor ($j = 0; $j < $n; $j++) { \n\t\t// проверяем совпадения слева-направо\n\t\tif($colors[$i][0] == $colors[$j][1]){\n\t\t\t$result++;\n\t\t}\n\t}\n\n\t\n\n}\n\n\nfor ($i=0; $i < $n; $i++) { \n\tfor ($j = 0; $j < $n; $j++) { \n\t\t// проверяем совпадения справа-налево\n\t\tif($colors[$i][1] == $colors[$j][0]){\n\t\t\t$result++;\n\t\t}\n\t}\n}\n\n\n\nprint_r($result / 2);", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "606f12c667dfc94d4925857a5a117ceb", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "6969c1be572203c0558ba25cb9aa46ec", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " value\n$k;\n$v;\n\nfor ($i = 0; $i < $n; $i++) { \n\tfscanf(STDIN, \"%d%d\", $k, $v);\n\t$colors[$i] = [$k, $v];\n}\n\n\n\n$result = 0;\n\n\n//todo: добавить встроенный фор, чтобы проверять значения по всей длине столбца\n\nfor ($i = 0; $i < $n; $i++) { \n\tfor ($j = 0; $j < $n; $j++) { \n\t\t// проверяем совпадения слева-направо\n\t\tif($colors[$i][0] == $colors[$j][1]){\n\t\t\t$result++;\n\t\t}\n\t}\n}\n\nprint_r($result);", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "529c51d17b375f6d96e62159e146d2ab", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "2cffa98e3fa6549c302f9684a3d3dade", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "40bd68c251e5a522f596d7e4a68364b8", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "7bd9a874cf4e5b7205514a61634f9d20", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a, 'guest' => $b);\n}\n\n//print_r($teams);\n\n$count = 0;\nfor ($i = 0; $i < $n; $i++) {\n for ($j = 0; $j < $n; $j++) {\n if ($i != $j) {\n if ($teams[$i]['home'] == $teams[$j]['guest']) {\n $count++;\n } \n }\n }\n}\n\necho $count;\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "040ad458b557e82fe7927dbab4c88e25", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0.0000001) {\n $steps += 1;\n}\n\necho \"$steps\\n\";\n", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "f73f08b616db28a9531c16420044a9ae", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "c6dfca51eec7c549ccc413c09554b19e", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "d762924b2615da2f619268c0f4471fe4", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "0abe0134b2ca653d540fe439710d1f15", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n\t\tif ($value != 1) {\n\t\t\tif ($value > 3) $value = 3;\n\t\t\tif ($key * $value > $max) $max = $key * $value;\n\t\t}\n\t}\n\t$asum = array_sum($a);\n\treturn $asum - $max;\n}\n$in = trim(fgets(STDIN));\n$cards = explode(' ', $in);\necho process($cards);\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "937bf7b59cfa2488fd5f693c30bc779e", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $count) {\n if ($count > 3) {\n $count = 3;\n }\n if($count >= 2) {\n $values[] = $key * $count;\n }\n}\n\nif(!empty($values)) {\n echo $allSum - max($values);\n} else {\n echo $allSum;\n}", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "26fe9571b98d918c0de0c83758a34930", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["expression parsing", "implementation"], "code_uid": "2bfe496194a912050ec6485a38234dca", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "9cc71988c8553ca398865d8ead090965", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "d36065594572e82ff4fe61dd94898ca8", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "19b475416a805807ed44eb4ae2a22f8a", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "e72f0221edffa3e2f25cb1ac9180a971", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b);\nwhile(TRUE)\n{\n $b++;\n if($b == $c)\n {\n $f[count($f)] = $b;\n break;\n }\n elseif($b > $a)\n {\n $b = 1;\n $f[count($f)] = $b;\n if($b == $c)\n {\n break;\n }\n }\n else\n {\n $f[count($f)] = $b;\n }\n}\n$g = array(0 => $d);\nwhile(TRUE)\n{\n $d--;\n if($d == $e)\n {\n $g[count($g)] = $d;\n break;\n }\n elseif($d == 0)\n {\n $d = $a;\n $g[count($g)] = $d;\n if($d == $e)\n {\n break;\n }\n }\n else\n {\n $g[count($g)] = $d;\n }\n}\n$h = 0;\nfor($x = 0; $x < min(count($f), count($g)); $x++)\n{\n if($f[$x] == $g[$x])\n {\n $h = 1;\n break;\n }\n}\nif($h == 0)\n{\n print \"NO\";\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "998b2078f1f069869936a050ad4338ae", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "1d929478be8de0dbbd3183051b4f97f4", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0, $y >= 0, $z >= 0; $x--, $y--, $z--)\n{\n $i -= $g;\n $j -= 1;\n $f -= $h;\n if(($i < 0) || ($j < 0) || ($f < 0))\n {\n break;\n }\n else\n {\n $k++;\n }\n}\nprint floor($k / $a);\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "eb79b47e8a97737a862a567d8261238a", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "0ecae343cb05e12e26431869f27208af", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "nextInt();\n\t//$B_first = $Token->nextInt();\n\t\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t//$inp_arr = $Token->nextIntArray(8);\n\t$inp_arr = $Token->nextIntArray();\n\t\n\t$inp_f = $inp_arr[0];\n\t$inp_k = $inp_arr[1];\n\t$inp_l = $inp_arr[2];\n\t$inp_c = $inp_arr[3];\n\t$inp_d = $inp_arr[4];\n\t$inp_p = $inp_arr[5];\n\t$inp_nl = $inp_arr[6];\n\t$inp_np = $inp_arr[7];\n\n\t$drink = (int)(($inp_k * $inp_l) / $inp_nl);\n\t$salt = (int)($inp_p / $inp_np);\n\t$lime = $inp_c * $inp_d;\n\t/*$arr[] = $drink;\n\t$arr[] = $salt;\n\t$arr[] = $lime;\n\t\n\t//$min = min($arr);\n\tif (asort(&$arr) === false) {\n\t\tprint(-1);\n\t\treturn;\n\t}\n\t$min = $arr[0];\n\t\n\t*/\n\t//�ŏ��l�����߂鏈��\n\t//�f�[�^�������Ƃ��A$min = min($arr);\n\t$min = min($drink, $salt, $lime);\n\t$ans = (int)($min / $inp_f);\n\tprintf(\"%d\", $ans);\n\n}\n\nfunction run(){\n\tsolve();\n}\n\nob_end_clean();\nrun();\n\n//input - $inp_\n//block $temp_\n//two block$ttemp_\n//as \t $as_\n//instance $(Upper)\n//ref $ref\n//class menba $_\n\nclass Token{\n\tprivate $token;\n\tprivate $tok;\n\t\n\tpublic function __construct($str_line, $tok) {\n\t\t$this->tok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t$this->token = strtok($this->tok);\n\t\treturn $thisToken;\n\t} \n\t\t\n\tpublic function nextFloat() {\n\t\treturn (float)$this->nextToken();\n\t}\n\t\n \tpublic function nextInt() {\n\t\treturn (int)$this->nextToken();\n\t}\n\t\n\tpublic function nextIntArray() {\n\t\t$temp_arr = array();\n\t\t$flag = -1;\n\t\twhile ($flag !== 1) {\n\t\t\t$thisToken = $this->nextToken();\n\t\t\tif ($thisToken !== false) {\n\t\t\t\t$temp_arr[] = $thisToken;\n\t\t\t} else {\n\t\t\t\t$flag = 1;\n\t\t\t}\n\t\t}\n\t\treturn $temp_arr;\n\t}\n\t\n\tpublic function nnextIntArray($num) {\n\t\t$temp_arr = array();\n\t\tfor ($i = 0; $i < $num; $i++) {\n\t\t\t$temp_arr[] = (int)$this->token;\n\t\t}\n\t\treturn $temp_arr;\n\t}\n}\n/*\nfunction get_line() {\n $stdin = fopen(\"php://stdin\", \"r\"); \n $line = rtrim($stdin, \"\\n\"); \n fclose($stdin); \n return $line; \n}\n*/\n\nfunction num_printf($i){\n\tif (is_float($i)) {\n\t\tprintf(\"%.10f\", $i);\n\t}\n\tif (is_int($i)) {\n\t\tprintf(\"%10d\", $i);\n\t}\n}\n\nfunction array_printf(array $array) {\n\t\t$message = \"\";\n\t\tforeach ($array as $value) {\n\t\t\t$message .= \"$value\" . \" \";\n\t\t}\n\t\t$message = rtrim($message);\n\t\tprintf('%s', $message);\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3207bc84809f643df2bf0cfa33dabda1", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b7ade377c19c2ae477fb6fa00dd6ba6d", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "594618f964efd82dc944d01c5a5bb9b8", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($nr <= $max) );\n}\n\nfunction back($k) {\n global $n;\n global $st;\n if ($k >= $n) {\n if (solution())\n return 1;\n else\n return 0;\n }\n $sol = 0;\n if ($st[$k] == ' ') {\n $st[$k] = '0';\n $sol+= back($k + 1);\n }\n if ($st[$k] == '0') {\n $st[$k] = '1';\n $sol+= back($k + 1);\n }\n $st[$k] = ' ';\n return $sol;\n}\n\n$n = strlen($max);\n$st = str_repeat(' ', $n);\necho back(0);\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "ed5da5bbef29a69c8395729d6521387b", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "2dc4611aa6ba9752550edd5f8883303a", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($nr <= $max) );\n\t}\n\t\n\tfunction back( $k )\n\t{\n\t\tglobal $n;\n\t\tglobal $st;\n\t\tif ($k >= $n)\n\t\t{\n\t\t\tif ( solution() )\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\t}\n\t\t$sol = 0;\n\t\tif ( $st[$k] == ' ' )\n\t\t{\n\t\t\t$st[$k] = '0';\n\t\t\t$sol+= back($k+1);\n\t\t}\n\t\tif ( $st[$k] == '0' )\n\t\t{\n\t\t\t$st[$k] = '1';\n\t\t\t$sol+= back($k+1);\n\t\t}\n\t\t$st[$k] = ' ';\n\t\treturn $sol;\n\t}\n\t$n = strlen($max);\n\t$st = str_repeat(' ', $n);\n\techo back(0);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "65225e4a914be506a41146e36271124c", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($nr <= $max) );\n}\nfunction back($k) {\n global $n;\n global $st;\n if ($k >= $n) {\n if (solution())\n return 1;\n else\n return 0;\n }\n $sol = 0;\n if ($st[$k] == ' ') {\n $st[$k] = '0';\n $sol+= back($k + 1);\n }\n if ($st[$k] == '0') {\n $st[$k] = '1';\n $sol+= back($k + 1);\n }\n $st[$k] = ' ';\n return $sol;\n}\n$n = strlen($max);\n$st = str_repeat(' ', $n);\necho back(0);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "83536f855d65d5cca90d5dd12e3c1662", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=(int)TenToTwo($i)){\n $ans+=1;\n }else{\n break;\n }\n}\nprint($ans.\"\\n\");\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "666a24de111f4cfb3cdceb7b940ef8bd", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "p=\".$p.\"
\";\nfor($i=-$d+1; $i<=$d; $i++){\n if($v+$i == $v2+($t-2-$p)*$d){\n $v = $v+$i;\n $ms += $v;\n// echo $v.'+';\n $p++;\n break;\n }\n}\n//echo \"
p=\".$p.\"
\";\nwhile($p < $t-1){\n $v -= $d;\n $ms += $v;\n// echo $v.'+';\n $p++;\n}\n//echo '
';\necho $ms;\n \n\n\n\n \n\n", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "35e146e990d7b092648ecd0bfc5994c4", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1;$i--)\n{\n if ($m[$i]-$m[$i+1]>$d) {$m[$i]=$m[$i+1]+$d;}\n}\n\n$s=0;\nfor ($i=1;$i<=$t;$i++) \n{ \n //echo $m[$i].' ';\n $s=$s+$m[$i];\n}\n\n\n$stdout=fopen('php://stdout','w');\nfwrite($stdout,$s);\nfclose($stdout);\n\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "1a135c7c6cd88ea9bd36f030a1849e9b", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $int ? $int+=1 : null;\n\n\necho $int;\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "8b73b3ad0febf8a38ae714356ffe98b9", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max) {\n $max = $map[$twoGramm];\n $result = $twoGramm;\n }\n }\n return $result;\n}\n\n$n = intval(fgets(STDIN));\n$s = trim(fgets(STDIN));\nprint solution($s);\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "1f124830dda6ebccb8a1f314282f95e8", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "e9ed3b0ad667f46dbf196345ba579a07", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value){\n if($value > $currentValue){\n $currentValue = $value;\n $mepisShikriki = $key;\n }\n}\n\nprint($mepisShikriki);", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "908b389cc390e9d266f81e2c394f8b05", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y) $r = $r + $a2;\nif ($z1 < 0) $r = $r + $a3;\nif ($z1 > $z) $r = $r + $a4;\nif ($x1 < 0) $r = $r + $a5;\nif ($x1 > $x) $r = $r + $a6;\n\necho \"$r\\n\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "22f52fcd95e3c33421115ae62dcfc8b0", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$x1) $s+=$a6;\n\t if($y>$y1) $s+=$a2;\n\t if($z>$z1) $s+=$a4;\n\t echo $s;\n?>\n\t \t\t\t \t\t\t\t \t \t\t \t\t", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "2ee1158d27fc099a3ba52a77e781dbe8", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y) $ans += $cur;\n\t$cur = in();\n\tif($vz < 0) $ans += $cur;\n\t$cur = in();\n\tif($vz > $z) $ans += $cur;\n\t$cur = in();\n\tif($vx < 0) $ans += $cur;\n\t$cur = in();\n\tif($vx > $x) $ans += $cur;\n\techo $ans;\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "367bbfee6e022caef9523eb38286261b", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n {\n array_push($e, strlen($c[$d[$x]]));\n }\n }\n rsort($e);\n print $e[0];\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "9cde0e099ba0e42d3b497dabf5a7f002", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0)&&($n<=100))\n{\n for($i=0; $i<$n; $i++)\n {\n $c=$s[$i];\n $r=ord($c);\n if (($r<97)||($r>122))\n {\n $f=false;\n }\n }\n if ($f)\n {\n $n=strlen($s);\n //$n1=floor($n/2);\n $k=1;\n for ($i=0; $i<$n; $i++)\n {\n for ($j=1; $j<=$n-$i; $j++)\n {\n $pstr=substr($s,$i,$j); \n $k1=strpos($s,$pstr);\n $k2=strripos($s,$pstr);\n if ($k1!=$k2) {$mas[$k]=strlen($pstr); $k++;}\n }\n }\n $max=0;\n for ($j=1; $j<$k; $j++)\n {\n if ($mas[$j]>$max) {$max=$mas[$j];}\n }\n fputs(STDOUT, \"$max\");\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "e60a02f8e8bb66ca0eb33e79d3722c1b", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $maxLen) $maxLen = $len; \n }\n else\n {\n $hasSubstr[$substr] = true;\n// echo \"Adding substr: \" . $substr . \"\\n\";\n }\n }\n}\n/*\nfunction findPairs($string) {\n for ($i = 0; $i < strlen($string); $i++) {\n for ($j = 1; $j < strlen($string) - $i; $j++) {\n if ($string[$i] == $string[$i + $j]) {\n $pairs[] = array($i, $i + $j); \n $len = 1;\n }\n }\n }\n return $pairs;\n}\n\nfunction findLength($array, $string) {\n foreach ($array as $value) {\n if (max($value) > $last) $last = max($value);\n }\n for ($i = 0; $i <= strlen($string) - $last; $i++) {\n for ($j = 1; $j < strlen($string); $j++) {\n $index0 = $array[$i][0];\n $index1 = $array[$i][1];\n if ($string[$index0 + $j] == $string[$index1 + $j]) $len = $j + 1;\n else break;\n }\n }\n return $len;\n}\n\n$length = findLength(findPairs($line), $line);\n*/\nprint($maxLen);\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "72d24f2f5689e642aeded7c2155274f8", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "4747397c49aa78c885bab4d589795d8d", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\nfunction stdin() {\n $stdin = @fopen('data.txt', 'r');\n if (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n }\n\n return $stdin;\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\n$n = g();\n\n$size = strlen($n);\n\n$max = 0;\nfor($pos = 0; $pos < $size; $pos++) {\n for($len = 1; $len < $size - $pos; $len++) {\n $str = substr($n, $pos, $len);\n $sub = strpos($n, $str, $pos+1);\n\n if($sub !== false && $len > $max) {\n $max = $len;\n }\n }\n}\n\necho $max;\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "349b45b533a8428aa73c83263d9add40", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 5) {\n $pas[0] = 1;\n}\nfor ($i = 0; $i < strlen($password); ++$i) {\n if (ord($password[$i]) >= 65 && ord($password[$i]) <= 90) {\n $pas[1] = 1;\n }\n if (ord($password[$i]) >= 97 && ord($password[$i]) <= 122) {\n $pas[2] = 1;\n }\n if (ord($password[$i]) >= 48 && ord($password[$i]) <= 57) {\n $pas[3] = 1;\n }\n if ($password[$i] == \"!\" || $password[$i] == \"?\" || $password[$i] == \"_\" || $password[$i] == \".\" || $password[$i] == \",\") {\n $pas[4] = 1;\n }\n}\n$sol = 1;\nfor ($i = 0; $i <= 3; ++$i) {\n if ($pas[$i] == 0) {\n $sol = 0;\n }\n}\nif ($sol == 0) {\n fprintf($fileOUT, \"Too weak\\n\");\n} else {\n fprintf($fileOUT, \"Correct\\n\");\n}\nfclose($fileIN);\nfclose($fileOUT);\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bcd64eb3bb6b5e2d6589cb1dc0239905", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 5) && ($e == 1) && ($f == 1) && ($g == 1))\n{\n print \"Correct\";\n}\nelse\n{\n print \"Too weak\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "052ff3ad37daf5bb6b91ccb2920699cd", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5d26e9fcaf89e6d4cea6be240f07d91c", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "a1ed64e93613799af43315b759c30691", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= max(1, $a - 1 - 100000); $x--)\n{\n $c = str_split($x);\n $d = array_sum($c);\n $e = $x + $d;\n if($a == $e)\n {\n $b[count($b)] = $x;\n }\n}\nif(count($b) == 0)\n{\n print \"0\";\n}\nelse\n{\n sort($b);\n print count($b) . \"\\n\";\n for($x = 0; $x < count($b); $x++)\n {\n print $b[$x] . \"\\n\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "7307f926bd4e015cd1fba45f9e66eb15", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "efa7b99dede7240fc3f7fa421a6dde44", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "2d08520220790074a7052cef3b573b4b", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "00a7d9908b45d297f53f94b19a8082b9", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val){\n echo \"Id: $i, Val: $val\\n\";\n}\n*/\n$r = 0;\nfor ($i = 1; $i <= sqrt($num); $i += 1) {\n if ($num % $i == 0) {\n $k = $num / $i;\n //echo \"probando $i $k \\n\";\n $f_i = 0;\n $f_j = 0;\n for ($j = 0; $j <= 9; $j += 1) {\n if (substr_count((string)$num, (string)$j) > 0){\n if (substr_count((string)$i, (string)$j) > 0 and $f_i == 0){\n //echo \"$i\\n\";\n $r++;\n $f_i = 1;\n }\n if (substr_count((string)$k, (string)$j) > 0 and $f_j == 0 and $i != $k) {\n //echo \"$k\\n\";\n $f_j = 1;\n $r++;\n }\n }\n }\n }\n}\necho $r;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7171fb2a70c787c0f0d1eaf7573726b0", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e050cd86d6720e46cb74d74a8940c37d", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a6c06819014c8698d4dd146efb67bf7e", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "1abd57b594081247aefef2b798d29f8d", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "d929b235c3da418a648f39ab790c2aa0", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "7a00b7719be04ae95671d9da280be4c8", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "1f5542da21d0951f6742ab9302795e33", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "62d18063d31fba74366dd035362df362", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1,\n 1 => 1,\n 2 => 2,\n 3 => 6,\n 4 => 24,\n 5 => 120,\n 6 => 720,\n 7 => 5040,\n 8 => 40320,\n 9 => 362880,\n 10 => 3628800\n);\n\n$total = 0;\nfor($i=0;$i$total){\n echo \"0.000000000000\\n\";\n} else {\n $v = pow(0.5,$q)*$n[$q]/($n[$q-$range]*$n[$range]);\n echo $v;\n}\n\n\n\n\n\n\n\n\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "9f94fecbe3ed43abd82c6ab979a475eb", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "b678491ca232047c23292f7130e834f1", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "c70b4a40aa6a114b4d37cf960ade6d6e", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "dp"], "code_uid": "e6d47b761a161ad67588fabac5998a24", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "dp"], "code_uid": "b52a1b173b17a8b4fbb7359703d2f196", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "3){\n if(ceil($n/3)%2==0){\n $m = true;\n }\n $n = $n % 3;\n}\n\n$r = 0;\nif($n==0 || $n==3){\n $r = $y - $x;\n}else if($n==2){\n $r = $y;\n}else if($n==1){\n $r = $x;\n}\n\nif($m){\n $r *= -1;\n}\n$r %= 1000000007;\nif ($r < 0)\n{\n $r += 1000000007;\n}\n\necho \"$r\\n\";", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ad877dbfab13f5aba0f08ddfc47eb777", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\t$inp_K = (int)$Scanner->Scan();\n\t\n\t$start = $inp_N - (int)($inp_N / $inp_K);\n\t//for ($i = 1; $i <= $inp_N; $i++) {\n\tfor ($i = $start; $i <= $inp_N; $i++) {\n\t\t$temp = $i;\n\t\t$sum = 0;\n\t\twhile ($temp !== 0) {\n\t\t\t$sum += $temp;\n\t\t\t//$temp = $temp / $inp_K;\n\t\t\t$temp = (int)($temp / $inp_K);\n\t\t}\t\n\t\t//if ($sum > $inp_N) {\n\t\tif ($sum >= $inp_N) {\n\t\t\t$V = $i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\", $V);\n\t$Scanner->close();\n}\n\nob_end_clean();\nsolve();\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\nclass Scanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $Id = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link or ''php://stdin' err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\n\t\t//err $c_row = array(\"\\n\", \"\\r\", \"\\r\\n\");\n\t\t$c_row = array(\"\\r\\n\", \"\\r\", \"\\n\");\n\t\t$contents = str_replace($c_row, \" \", $contents);\n\t\t$this->Scanners = explode(\" \", $contents);\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Id;\n\t\t$sc = $this->Scanners[$x];\n\t\t$this->Id = ++$x;\n\t\treturn $sc;\n\t}\n\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\n/*\n====begin=====\n\n//input $inp_ or upper\n//block $temp_\n//two block$ttemp_\n//as \t $as_\n//instance $(Upper)\n//ref $ref\n//class menba $^Upper\n\n====end=======\n\n===== class begin =====\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\n//ref \"#109_div2_B_1230942 laurenceHR\"\nclass LineScanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $LineIds_Of_ScanIds= array();\n\tprivate $LinesScanners = array();\n\tprivate $LastScanIds_Of_LineIds = array();\n\tprivate $Scan_number = 0;\n\tprivate $Scanline_number = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\t\t\n\t\t$temp_lines = explode(\"\\n\", $contents);\n\t\t$temp_linescanners = array();\n\t\t$temp_x = 0;\n\t\t$temp_y = 0;\n\t\t//--attention for initting of array--(these is not needed but for easily reading)//\n\t\t$ttemp_scanners = array();\n\t\t//$del = Array(\"\\n\",\"\\r\",\"\\n\\r\");\n\t\tforeach ($temp_lines as $as_line) {\n\t\t\tif (strlen($as_line) === 0) {\n\t\t\t\tprint(\"input err\");\n\t\t\t}\n\t\t\t\n\t\t\t//$as_line = str_replace($del,'',$as_line);\n\t\t\t$temp_linescanners[] = $as_line;\n\t\t\t$ttemp_line_scanners = explode(\" \", $as_line);\n\t\t\t//$ttemp_scanners = array();\n\t\t\tforeach ($ttemp_line_scanners as $as_sc) {\n\t\t\t\t$ttemp_scanners[] = $as_sc;\n\t\t\t\t$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;\n\t\t\t\t$temp_x++;\n\t\t\t}\n\t\t\t$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;\n\t\t\t$temp_y++;\n\t\t}\n\t\t$this->Scanners = $ttemp_scanners;\n\t\t$this->LinesScanners = $temp_linescanners;\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"scan err\");\n\t\t}\n\t\t\t\t\n\t\t$sc = $this->Scanners[$x];\n\t\t//--attention for ++$x//\n\t\t//$this->Scan_number = $x++;\n\t\t$this->Scan_number = ++$x;\n\t\t$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];\n\t\treturn $sc;\n\t}\n\t\n\tfunction LineScan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"linescan err\");\n\t\t}\n\t\t\n\t\t$lsc = $this->LinesScanners[$y];\n\t\t$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;\n\t\t$this->Scanline_number = $y + 1;\n\t\treturn $lsc;\n\t}\n\t\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\nclass Token{\n\tprivate $token;\n\tprivate $tok;\n\t\n\tpublic function __construct($str_line, $tok) {\n\t\t$this->tok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t$this->token = strtok($this->tok);\n\t\treturn $thisToken;\n\t} \n\t\t\n\tpublic function nextFloat() {\n\t\treturn (float)$this->nextToken();\n\t}\n\t\n \tpublic function nextInt() {\n\t\treturn (int)$this->nextToken();\n\t}\n\t\n\tpublic function nextIntArray() {\n\t\t$temp_arr = array();\n\t\t$flag = -1;\n\t\twhile ($flag !== 1) {\n\t\t\t$thisToken = $this->nextToken();\n\t\t\tif ($thisToken !== false) {\n\t\t\t\t$temp_arr[] = $thisToken;\n\t\t\t} else {\n\t\t\t\t$flag = 1;\n\t\t\t}\n\t\t}\n\t\treturn $temp_arr;\n\t}\n\n\tpublic function nnextIntArray($num) {\n\t\t$temp_arr = array();\n\t\tfor ($i = 0; $i < $num; $i++) {\n\t\t\t$temp_arr[] = (int)$this->token;\n\t\t}\n\t\treturn $temp_arr;\n\t}\n}\n===== class end ======\n\n=== function begin ===\n\nfunction get_line() {\n $stdin = fopen(\"php://stdin\", \"r\"); \n $line = rtrim($stdin, \"\\n\"); \n fclose($stdin); \n return $line; \n}\n\nfunction num_printf($i){\n\tif (is_float($i)) {\n\t\tprintf(\"%.0f\", $i);\n\t}\n\tif (is_int($i)) {\n\t\tprintf(\"%d\", $i);\n\t}\n}\n\nfunction array_printf(array $array) {\n\t\t$message = \"\";\n\t\tforeach ($array as $value) {\n\t\t\t$message .= \"$value\" . \" \";\n\t\t}\n\t\t$message = rtrim($message);\n\t\tprintf('%s', $message);\n}\n\n== function end ======\n*/\n\n?>", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "06f20fedac6c4b0476f00e2cf1d1d987", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $n ) break; \n }\n echo $i; \n", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "801367ba5d2a5b23a516843c6fde552c", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ) { \n $x = $x+$y;\n $y = floor($y/$k);\n\n }\n if ($x >= $n) { \n $rr = $mid; \n\n }\n \n else {\n $ll = $mid + 1; \n\n }\n}\necho $ll;\n?>", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "3620eeeb2acd17900a2cec58feba79d4", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "567ced8cb03007adc142e51c1bcab1fe", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $m)\n swap($n, $m);\n \n if ($n & 1)\n fprintf($fo, \"Akshat\");\n else\n fprintf($fo, \"Malvika\");\n \n fclose($fi);\n fclose($fo);\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e28818fad7aaae6c2099c583e007b109", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 'Akshat', 1 => 'Malvika');\n$index = 1;\n\nwhile ($n > 0 && $m > 0) {\n\t$index ^= 1;\n\t$n --;\n\t$m --;\n}\n\nprint $player[$index];\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "332ff59888883b5e0bfc4c2290150ca8", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5463046f78e5d7b83c2c835e2e6de181", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "c9dbe976ab298fd085d3deb60d44d459", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "61669b48cfe39c240e4a0942f532afca", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "f9783f2352fcee2f23762c75a482d0a2", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "43bd5486de68bf2808bbad5fb9f7e5bc", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "8fcb3e5cf79b07862c6e7e9b679ecc3a", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "9aa7631372a824bd439b4294424df3ef", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $joy[1] > 0) {\n $time = $time + 1;\n \n if ($charger == 0) {\n $joy[0]++;\n $joy[1] = $joy[1] - 2;\n } else {\n $joy[1]++;\n $joy[0] = $joy[0] - 2;\n }\n \n if ($joy[0] <= 2) {\n $charger = 0;\n } else if ($joy[1] <= 2) {\n $charger = 1;\n }\n }\n \n echo $time;", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "20ad47532efbaba81f945340c1b7397e", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a2){\n $a1 -= 2;\n $a2 += 1;\n }\n else{\n $a2 -= 2;\n $a1 += 1;\n }\n \n }\n\n\n printf(\"%d\\n\",$count);\n\n\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "f013891f1937048b200d7c8edde42e5f", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "93dee89f5a244e37b5f1952be28f9f4a", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && $a2 > 0 && $a1*$a2 > 1) {\n\tif ($a1 < $a2) {\n\t\t$a1++;\n\t\t$a2 = $a2 - 2;\n\t\t$n++;\n\t} else {\n\t\t$a2++;\n\t\t$a1 = $a1 - 2;\n\t\t$n++;\n\t}\n}\n\nprint $n;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "9edb454a4b76f47ec93b43faf165d4a8", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a2) {$a2+=1;$a1-=2;}\n\t\telse { $a1+=1;$a2-=2;}\n\t\t$c++;\n }\n echo $c;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "625549fc6eb5016026717bde092ec313", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 and $a2 > 0) {\n if ($a1 == 1 and $a2 == 1) {\n break;\n } else if ($a1 <= $a2) {\n $a1 += 1;\n $a2 -= 2;\n } else {\n $a2 += 1;\n $a1 -= 2;\n }\n $m += 1;\n}\nprint $m;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "76ea097752b31966a2e016dddff31a8b", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "8e35952068acb17a371952d33867e366", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " -1 && $iS % 2 == 0 ? 'Yes' : 'No';", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "53ceb07a0c84937a00457c8273a5fe67", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "12c42f2101a96887e7869a52f33bf8f6", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "1dc5e5829ab678ea73d5b1f9bd1e7407", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "135a1d44b9ef5a5a9527b4b3a9070708", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "c4f5df2e93d8c570b44a4a55b4640136", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7773037be9e78336418ba3674ff92783", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "graphs"], "code_uid": "25824d5c024e75627b66cf110ffd69fe", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "graphs"], "code_uid": "a274beb839024251d874f97726f39890", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "fa619a09a1c69d69b5551cc834ab7d04", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n\tfwrite(STDOUT, 1);\n}else{\n\tif($a == 0 && $c == 0 && $d == 0){\n\t\tfwrite(STDOUT, 1);\n\t}else{\n\t\tfwrite(STDOUT, 0);\n\t}\n}\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5a481391ab8dba94e00737cb00e878c9", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " abs ($B - $i)) {\n $Z = $Z + 1;\n }\n}\nprintf (\"%d %d %d\\n\", $X, $Y, $Z);\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "c70dcc8c8195ffe6ba33ebc11d980487", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " abs($a_b[1] - $i )){\n $b_win++;\n \n }\n else{\n $draw++;\n }\n \n \n \n }\n \n print $a_win . \" \" . $draw . \" \" .$b_win ;\n\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "8eeffb94c2faf1483bb92d9baf8ec238", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\n$f = abs(5 - $a);\n$g = abs(5 - $b);\nif($f > $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\n$f = abs(4 - $a);\n$g = abs(4 - $b);\nif($f > $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\n$f = abs(3 - $a);\n$g = abs(3 - $b);\nif($f > $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\n$f = abs(2 - $a);\n$g = abs(2 - $b);\nif($f > $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\n$f = abs(1 - $a);\n$g = abs(1 - $b);\nif($f > $g)\n{\n $c++;\n}\nelseif($f < $g)\n{\n $d++;\n}\nelse\n{\n $e++;\n}\nprint $d . \" \" . $e . \" \" . $c;\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "8b749259ce6259d902fe22038a45172e", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $diffb) {\n $wins ++;\n } else {\n $draw ++;\n }\n}\n\nprint $winf . ' ' . $draw . ' ' . $wins;\n\nfunction getline() {\n return trim(fgets(STDIN));\n}\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "d5cd01e3e7af8857ff08e869f76a49dc", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " abs($b - $j)) {\n\t\t$result[2]++;\n\t}\n\telseif (abs($a - $j) == abs($b - $j)) {\n\t\t$result[1]++;\n\t}\n\n}\n\nprint implode(' ', $result);\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "06ac4678af91687bedcff3cde1c9042f", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " abs( $b - $i ) ) {\n $z = $z + 1;\n }\n }\n printf ( \"%d %d %d\\n\", $x, $y, $z );\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "1f97e9a0cec4b6394fe45fba5ff34667", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "81d0317a4436f250cce23721c2270d95", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "0528dfffb9d27f426c4f5a5eaf4f8ad0", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "54e77d84e6a3e6bb2ae267dc9b81911d", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "2ab779fd952f761bf3a37df9129c9352", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "solution($n);\n\n\nclass MainClass {\n\tpublic $problemLink = 'https://codeforces.com/problemset/problem/935/A';\n\tpublic $submissionLink = '';\n\n\tpublic function solution($n){\n\t\t$res = 0;\n\t\tfor ($i=1; $i<$n; $i++){\n\t\t\tif ($n % $i === 0){\n\t\t\t\t$res++;\n\t\t\t}\n\t\t}\n\treturn $res;\n\t}\n}", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "bff3870ea337a84838132063480eae0b", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "192751a525b0a9a004c2d53c488e57d2", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c8cd5e867e2d0805f532ae3cca4ef14d", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6071afff01ae6b80e3cad1984ed1b5cc", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "bitmasks"], "code_uid": "b1926f7d969e04b65cd1962864fe684f", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "6a9e2b8e4ef8d77795adb067541da4dd", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "a00eaf4787676707734711672c5f5307", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "7b768bc81294281876500de1967cb246", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "2d9fc0aa01c59c6d2e64f0d423398547", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) {\n if($diff>=0 && $diff%$c==0) {\n $appears=true;\n }\n} elseif ($c==0) {\n if($b==$a) \n $appears=true;\n} else {\n if($diff<=0 && $diff%$c==0) {\n $appears=true;\n }\n}\n\nif($appears)\n echo 'YES';\nelse \n echo 'NO';", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "9d381716d4ab95e2b305c4d217af8995", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)) {\n $p = true;\n print \"NO\";\n} else if (($b > $a) and ($c < 0)) {\n $p = true;\n print \"NO\";\n} else if (($a != $b) and ($c == 0)) {\n $p = true;\n print \"NO\";\n}\nif (!$p) {\n $i = ($b - $a) % $c;\n if ($i == 0) {\n print \"YES\";\n } else {\n print \"NO\";\n }\n}\n?>\n\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "4feb778b54bb06de7764fb1dbd2531b5", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2d698f9756c33075ac15e48dc2009e2c", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $i--) {\n if ($summ % $i == 0 && $count % $i == 0) {\n $summ /= $i;\n $count /= $i;\n }\n}\n\necho $summ . '/' . $count;\n\nfunction get_summ($num, $base) {\n $result = 0;\n while ($num) {\n $result += $num % $base;\n $num = floor($num / $base);\n }\n return $result;\n}\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "4552490afdaed7a9eef3693aa7298b57", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\n\n if (is_array($data)) {\n print_r($data);\n } else {\n var_dump($data);\n }\n\n if ($die) {\n die();\n }\n\n echo '';\n}\n\nfunction stdin() {\n $stdin = @fopen('data.txt', 'r');\n if (!$stdin) {\n $stdin = fopen('php://stdin', 'r');\n }\n\n return $stdin;\n}\n\nfunction g() {\n global $stdin;\n return trim(fgets($stdin));\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\n$a = g();\n\nfunction conv($num, $base) {\n $sum = 0;\n\n while($num != 0) {\n $sum += $num % $base;\n $num = (int) ($num / $base);\n }\n\n return $sum;\n}\n\n$sum = 0;\nfor($i = 2; $i < $a; $i++) {\n $sum += conv($a, $i);\n}\n\n$del = $a - 2;\n\nfor($i = $del; $i > 0; $i--) {\n if($del % $i == 0 && $sum % $i == 0) {\n $sum /= $i;\n $del /= $i;\n }\n}\n\necho $sum . '/' . $del;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f11dcf3741610895c302642ac4a5fa2e", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 2; $i--) {\n\t$ac = $a;\n\twhile ($ac > 0) {\n\t\t$sum += ($m = $ac % $i);\n\t\t$ac = ($ac - $m) / $i;\n\t}\n}\n\n$z = $a - 2;\n\n$i = 2;\nwhile ($i <= $z) {\n\twhile (($sum % $i == 0) && ($z % $i == 0)) {\n\t\t$sum /= $i;\n\t\t$z /= $i;\n\t}\n\t$i++;\n}\n\n$output = \"$sum/$z\";\n\necho $output;\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6179221c69d42a13e03f2c6153fe5b1d", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "0cf7de7f8926bdcf46cd0cdacaf013df", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && $i<7) {\n if($input[$i] == $input[$i-1]) {\n $input[$i] = move($input[$i]);\n }\n }\n}\n\n//Final countdown\nif($input[0] == $input[2] && $input[0] == $input[4] && $input[0] == $input[6] && $input[1] == $input[3] && $input[1] == $input[5] && $input[1] == $input[7]) {\n echo \"YES\";\n exit();\n} else {\n echo \"NO\";\n exit();\n}\n\nfunction move($s) \n{\n return substr($s,7,1) . substr($s,0,7);\n}", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "b0f2300845ff77e50557289a2cb0a241", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "aaa572cdeeaf416b263517ef969006b4", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "d6388298cbb3646d672fcf4606b89512", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b))\n{\n $e = $a - $c - 1;\n $f = 60 - ($d - $b);\n if(strlen($e) == 1)\n {\n $g = \"0\" . $e;\n }\n else\n {\n $g = $e;\n }\n if(strlen($f) == 1)\n {\n $h = \"0\" . $f;\n }\n else\n {\n $h = $f;\n }\n print $g . \":\" . $h;\n}\nelseif(($c >= $a) && ($d <= $b))\n{\n $e = 24 + $a - $c;\n $f = $b - $d;\n if(strlen($e) == 1)\n {\n $g = \"0\" . $e;\n }\n else\n {\n $g = $e;\n }\n if(strlen($f) == 1)\n {\n $h = \"0\" . $f;\n }\n else\n {\n $h = $f;\n }\n print $g . \":\" . $h;\n}\nelseif(($c >= $a) && ($d >= $b))\n{\n $e = 24 + $a - $c - 1;\n $f = 60 - ($d - $b);\n if(strlen($e) == 1)\n {\n $g = \"0\" . $e;\n }\n else\n {\n $g = $e;\n }\n if(strlen($f) == 1)\n {\n $h = \"0\" . $f;\n }\n else\n {\n $h = $f;\n }\n print $g . \":\" . $h;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "990c450ad079ed05c998eb5eb54d92be", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;\n\t}\n\t\n\tpublic function readInt() \n\t{\n\t\t$d = trim(fgets($this->_fh));\n\t\t\n\t\treturn (int)$d;\n\t}\n\t\n\tpublic function readArrayOfInt($size, $indexFrom = 0) \n\t{\n\t\t$a = [];\n\t\t$ind = $indexFrom;\n\t\tforeach (explode(' ', fgets($this->_fh)) as $item) {\n\t\t\t$a[$ind++] = (int)$item;\n\t\t}\n\t\t\n\t\treturn $a;\n\t}\n\t\n\tpublic function readArrayOfString($size, $indexFrom = 0) \n\t{\n\t\t$a = [];\n\t\t$ind = $indexFrom;\n\t\tforeach (explode(' ', fgets($this->_fh)) as $item) {\n\t\t\t$a[$ind++] = $item;\n\t\t}\n\t\t\n\t\treturn $a;\n\t}\n}\n\nfunction ntimes($n, $func, $returnResults = false) {\n\t$a = [];\n\tfor ($i=1; $i<=$n; $i++) {\n\t\t$result = $func();\n\t\t\n\t\tif ($returnResults) {\n\t\t\t$a[$i] = $result;\n\t\t}\n\t}\n\t\n\treturn $a;\n}\n\n\nfunction primes($limit)\n{\n\t$a = str_repeat(chr(85), ($limit>>3) + 1);\n\t$a[0] = chr(83);\n\tfor ($i=3; $i*$i < $limit; $i+=2) {\n\t\tif (ord($a[$i>>3]) & (1<<($i%8))) {\n\t\t\t;\n\t\t} else {\n\t\t\tfor ($k=$i; $k*$i<$limit; $k++) {\n\t\t\t\t$n = $k*$i;\n\t\t\t\t$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));\n\t\t\t}\n\t\t}\n\t}\n\n\tyield 2;\n\tfor ($i=3; $i<$limit; $i+=2) {\n\t\tif (!(ord($a[$i>>3]) & (1<<($i%8)))) {\n\t\t\tyield $i;\n\t\t}\n\t}\n}\n\n\n\n\n\n$ir = new InputReader();\n\n$n = abs($ir->readInt());\n$p = [];\nforeach (primes(1e3) as $prime) {\n\t$p[] = $prime;\n}\n\n$powers = [];\nif ($n==1) {\n\t$min = 1;\n\t$steps = 0;\n} elseif ($n==0) {\n\t$min = 0;\n\t$steps = 0;\n} else {\n\twhile ($n>1) {\n\t\t$foundPrime = false;\n\t\tforeach($p as $prime) {\n\t\t\tif ($n%$prime == 0) {\n\t\t\t\t$foundPrime = true;\n\t\t\t\tif (!isset($powers[$prime])) {\n\t\t\t\t\t$powers[$prime] = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$powers[$prime] += 1;\n\t\t\t\t$n /= $prime;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(!$foundPrime) {\n\t\t\tif (!isset($powers[$n])) {\n\t\t\t\t$powers[$n] = 0;\n\t\t\t}\n\t\t\t$powers[$n] += 1;\n\t\t\t$n = 1;\n\t\t}\n\t}\n\t\n\t$min = array_product(array_keys($powers));\n\t\n\t$maxP = max($powers);\n\t$minP = min($powers);\n\t\n\tif ($maxP == 1) {\n\t\t$steps = 0;\n\t} else {\n\t\t$l2 = log($maxP)/log(2);\n\t\t\n\t\t$steps = 1 + (int)$l2;\n\t\tif (intval($l2) < $l2) {\n\t\t\t$steps++;\n\t\t} else {\n\t\t\tif ($maxP==$minP) {\n\t\t\t\t$steps--;\n\t\t\t}\n\t\t}\n\t}\n}\n// factorize and grab max power\n// echo [log2(power)] + 1 \n\necho $min . ' ' . $steps.\"\\n\";\n\n//}\n\n\n\n\n", "lang_cluster": "PHP", "tags": ["math", "greedy", "number theory"], "code_uid": "983d707d5413c5f22c4289fc76fcc7f1", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $m[$c2[0]] && $c1[1] == $c2[1]) || ($c1[1] == $k && $c2[1] == $k && $m[$c1[0]] > $m[$c2[0]])){\n\t\techo 'YES';\n\t}else{\n\t\techo 'NO';\n\t}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0f2e591717b660099d2d5d4586e53396", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $i)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "61fc6c4c503f86cb2ad1d630b5abe5b3", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$d[1])) echo 'YES';\nelseif(($c[0][1]==$k) && ($c[1][1]!=$k)) echo 'YES';\nelse echo 'NO';\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f5c141fcc66a23aecbf0516ca29aecf1", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "fcc412098f1ce5eb31382932fedd0319", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n{\n print \"Need more data\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "457ac63dbbecc2664262ef3d036bfd6d", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "75024e04b853096dd0cf12c96e7ff092", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "f5b9de7b44b4f90b0409adda3529a6af", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a95b8c5625f3f03b001dab136c9f0dfc", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "fc598983d314d2e1f4d7f58736e9da13", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "';\necho 'Лифт между этажами от Маши до этажа = ' . abs($x - $y) * $t2 . '
';\necho 'Время дверей лифта = ' . 3 * $t3 . '
';\necho 'Маша пешком = ' . abs($y - $x) * $t1 . '
';*/\n\n\nif ((abs($z - $x) * $t2 + abs($x - $y) * $t2 + 3 * $t3) <= (abs($y - $x) * $t1)) file_put_contents('php://stdout', 'YES');\nelse file_put_contents('php://stdout', 'NO');\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "52114a1c8f57219cc8ab54bb4d422282", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "abe87468ba9ee036898e1ee1618c03b6", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0 && $board[$y - $turn][$x] == 'S') return false;\n if ($turn >= 8) return true;\n for ($vy = -1; $vy <= 1; $vy++)\n {\n for ($vx = -1; $vx <= 1; $vx++)\n {\n $ny = $y + $vy;\n $nx = $x + $vx;\n if ($ny < 0 || $ny >= 8 || $nx < 0 || $ny >= 8) continue;\n if ($ny - $turn >= 0 && $board[$ny - $turn][$nx] == 'S') continue;\n if (dfs($ny, $nx, $turn + 1)) return true;\n\n }\n }\n return false;\n}\n\ncalc();\n?>\n", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs"], "code_uid": "8c3a055f49186b9c7b138d9a2a754bcc", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0 && $board[$y - $turn][$x] == 'S') continue;\n if ($y - ($turn + 1) >= 0 && $board[$y - ($turn + 1)][$x] == 'S') continue;\n for ($vy = -1; $vy <= 1; $vy++)\n {\n for ($vx = -1; $vx <= 1; $vx++)\n {\n $ny = $y + $vy;\n $nx = $x + $vx;\n if (ok($ny, $nx) && $now[$ny][$nx])\n {\n $next[$y][$x] = true;\n if ($board[$y][$x] == 'A') return true;\n }\n }\n }\n }\n }\n $now = $next;\n }\n return false;\n}\n\nfunction ok($y, $x)\n{\n return $x >= 0 && $y >= 0 && $x < 8 && $y < 8;\n}\n\ncalc();\n?>\n", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs"], "code_uid": "2455024a10ec158b9dca0dc750d5cae4", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0;$y--) {\n if(in_array($area[$round][$y][$x], array('M'))) {\n for($i=-1;$i<2;$i++) {\n for($n=-1;$n<2;$n++) {\n if(($n==0&&$i==0)||($y+$n)<0||($x+$i)<0||($x+$i)>7||($y+$n)>7){\n continue;\n }\n if(in_array($area[$round][$y+$n][$x+$i], array('A'))){\n die('WIN');\n }\n if(in_array($area[$round][$y+$n][$x+$i], array('.'))){\n $area[$round+1][$y+$n][$x+$i] = 'M';\n }\n }\n }\n }\n }\n }\n $round++;\n for($x=0;$x<8;$x++) {\n for($y=7;$y>=0;$y--) {\n if(in_array($area[$round][$y][$x], array('S'))) {\n $area[$round][$y][$x] = '.';\n if(($y+1)>7) {\n continue;\n }\n $area[$round][$y+1][$x] = 'S';\n }\n }\n }\n\n $mcount = 0;\n for($x=0;$x<8;$x++) {\n for($y=7;$y>=0;$y--) {\n if(in_array($area[$round][$y][$x], array('M'))) {\n $mcount++;\n }\n }\n }\n\n /*echo(\"\\n\".'Round: '.$round.\"\\n\");\n for( $i=0; $i<8; $i++) {\n echo($area[$round-1][$i].' '.$area[$round][$i].\"\\n\");\n }\n echo('M:'.$mcount.\"\\n\");*/\n if($mcount==0) {\n die(\"LOSE\");\n }\n}", "lang_cluster": "PHP", "tags": ["dfs and similar", "implementation", "graphs"], "code_uid": "aac5e776d811756576af62a68ffc69f0", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $x--)\n{\n if($x == $b)\n {\n break;\n }\n else\n {\n $e++;\n }\n}\nif($d < $e)\n{\n $f = $e - $d;\n $b += $f;\n for($x = 1; $x <= $f; $x++)\n {\n array_unshift($c, 2);\n }\n}\nelseif($d > $e)\n{\n $f = $d - $e;\n for($x = 1; $x <= $f; $x++)\n {\n array_push($c, 2);\n }\n}\n$g = 0;\n$h = $b - 2;\n$i = $b;\nfor($x = $b - 1; $x >= 0; $x--)\n{\n if($x == ($b - 1))\n {\n if($c[$x] == 1)\n {\n $g++;\n }\n }\n else\n {\n if(($c[$h] == 1) && ($c[$i] == 1))\n {\n $g += 2;\n }\n elseif(($c[$h] == 1) && ($c[$i] == 2))\n {\n $g++;\n }\n elseif(($c[$h] == 2) && ($c[$i] == 1))\n {\n $g++;\n }\n $h--;\n $i++;\n }\n}\nprint $g;\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "51d98f23b2255d3c9ca76ef597ab21cf", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0 && $id2 < $n)\n {\n if($t[$id] == $t[$id2] && $t[$id] != '0')\n {\n $ans ++;\n if($id != $id2)\n $ans ++;\n }\n $id --;\n $id2 ++;\n }\n while($id >= 0) \n {\n $ans += $t[$id] == '1';\n $id --;\n }\n while($id2 < $n) \n {\n $ans += $t[$id2] == '1';\n $id2 ++;\n }\n echo $ans;\n?>\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "0663649e4d56db84f098e6d599bfd9bb", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "3f4c13c68faff0405b02ecca7170f1d6", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "ca9124ca44595f462ddb8bc57d8ca749", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n // $sum += $number % 10;\n // $number /= 10;\n // }\n $number = strval($number);\n for($x = 0; $x < strlen($number); $x++)\n {\n $sum += $number[$x];\n }\n return $sum;\n}\n\nfscanf(STDIN, \"%d\\n\", $k);\n$i = 2;\n$prefect = 19;\nwhile($k > 0){\n if(decompose($prefect) == 10){\n $k--;\n }\n if($k == 0) break;\n $prefect += 9;\n}\necho $prefect;", "lang_cluster": "PHP", "tags": ["brute force", "dp", "binary search", "implementation", "number theory"], "code_uid": "13e72a42d65019a85e7f5f81576c09b0", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 19);\nwhile(TRUE)\n{\n $b += 9;\n $d = 0;\n $b = strval($b);\n for($x = 0; $x < strlen($b); $x++)\n {\n $d += $b[$x];\n }\n if($d == 10)\n {\n $c++;\n $e[$c] = $b;\n }\n if($c == 10000)\n {\n break;\n }\n}\nprint $e[$a];\n?>", "lang_cluster": "PHP", "tags": ["brute force", "dp", "binary search", "implementation", "number theory"], "code_uid": "186375e0bea873d1dfd0a19ff3bdeed3", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test)\n\t\t$stream = $f;\n\telse\n\t\t$stream = STDIN;\n\t/* begin body */\n\t$aPos = str_split('qzawsxedcrfvtgpbyhnujmiklo');\n\tsort($aPos);\n\t$aPos = implode('', $aPos);\n\t$totalLen = strlen($aPos);\n\n\t$inputStr = readString($stream);\n\t$return = 0;\n\twhile (!empty($inputStr)) {\n\t\t$char = $inputStr[0];\n\t\t$pos = strpos($aPos, $char);\n\t\t$left = $totalLen - $pos;\n\t\tif ($pos < $left) {\n\t\t\t$return+=$pos;\n\t\t} else {\n\t\t\t$return+=$left;\n\t\t}\n\t\t$aPos = substr($aPos, $pos) . substr($aPos, 0, $pos);\n\n\t\t$inputStr = substr($inputStr, 1);\n\t}\n\techo $return;\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9eb562a792c7d0b94e332d432a7b4470", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0, \"b\" => 1, \"c\" => 2, \"d\" => 3, \"e\" => 4, \"f\" => 5, \"g\" => 6, \"h\" => 7, \"i\" => 8, \"j\" => 9, \"k\" => 10, \"l\" => 11, \"m\" => 12, \"n\" => 13, \"o\" => 14, \"p\" => 15, \"q\" => 16, \"r\" => 17, \"s\" => 18, \"t\" => 19, \"u\" => 20, \"v\" => 21, \"w\" => 22, \"x\" => 23, \"y\" => 24, \"z\" => 25);\n$c = 0;\n$d = 0;\nfor($x = 0; $x < strlen($a); $x++)\n{\n $e = $b[$a[$x]];\n $f = abs($e - $d);\n $g = abs(26 - $f);\n $c += min($f, $g);\n $d = $e;\n}\nprint $c;\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "017cf5b56f7520c0f4dad17518459788", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ord($b)){\n $tmp = $a;\n $a = $b;\n $b = $tmp;\n }\n $i = abs(intval(ord($a) - ord($b)));\n $j = abs(intval(ord($a) - ord('a'))) + abs(intval(ord('z')) - ord($b)) + 1;\n// echo \"a: $a b: $b\" . PHP_EOL;\n// echo \"i: $i j: $j \" . PHP_EOL;\n return min($i,$j);\n}\n$current = 'a';\n$sum = 0;\nforeach(str_split($line) as $c){\n $sum += dis($c,$current);\n $current = $c;\n}\necho $sum . PHP_EOL;", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "03e85cad55431a5b55c26a65f87dcd3e", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e',\n 6 => 'f', 7 => 'g', 8 => 'h', 9 => 'i', 10 => 'j',\n 11 => 'k', 12 => 'l', 13 => 'm', 14 => 'n', 15 => 'o',\n 16 => 'p', 17 => 'q', 18 => 'r', 19 => 's', 20 => 't',\n 21 => 'u', 22 => 'v', 23 => 'w', 24 => 'x', 25 => 'y',\n 26 => 'z'];\n$stdin = fopen('php://stdin', 'r');\n\n$string = trim(fgets($stdin));\n$pos = 1;\n$count = 0;\nfor ($i = 0; $i < strlen($string); $i++) {\n $newPos = array_search($string[$i], $alphabet);\n if ($newPos > $pos) {\n if ($newPos - $pos > 13) {\n\n $count+= $pos + (26 - $newPos);\n }\n if ($newPos - $pos < 13) {\n\n $count+= $newPos - $pos;\n }\n if ($newPos - $pos == 13) {\n $count+=13;\n }\n $pos = $newPos;\n }\n if ($newPos < $pos) {\n if ($pos - $newPos < 13) {\n $count += $pos - $newPos;\n }\n if ($pos - $newPos > 13) {\n $count+= $newPos + (26 - $pos);\n }\n if ($pos - $newPos == 13) {\n $count+=13;\n }\n $pos = $newPos;\n }\n}\necho $count;\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "1149c1681421ede6c914c0ae651dabcd", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "13)\n {\n \t $k1[$i]=array_keys($split,$concate[$i]);\n \t // print_r($k1);\n \t //$key1=$k1[$i];\n \t //\n \t $k2[$i]=array_keys($split,$concate[$i+1]);\n \t //print_r($k2);\n \t //$key2=$k2[$i];\n \t if($k1[$i]>$k2[$i]){\n\n \t $temp[$i]=$k1[$i];\n \t $k1[$i]=$k2[$i];\n \t $k2[$i]=$temp[$i];\n\n \t }\n\n \t \n \t \n $count+=($k1[$i][0]+26)-$k2[$i][0];\n //echo \"plus=$count\\n\";\n }\n else\n {\n \t \t $k1[$i]=array_keys($split,$concate[$i]);\n \t //$key1=$k1[$i];\n \t //\n \t $k2[$i]=array_keys($split,$concate[$i+1]);\n \t //$key2=$k2[$i];\n\n \t \n $count+=abs($k1[$i][0]-$k2[$i][0]);\n //echo \"minus=$count\\n\";\n\n }\n //print_r($k1);\n // print_r($k2);\n\n}\necho \"$count\";\n\n//print_r($keyDistance);", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "db6a16d905cce9caec3bce3e6cc137bc", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 13) {\n $actualStepsCount = count(CHARACTER_LIST) - $stepsCount;\n $steps += $actualStepsCount;\n\n $prevPosition = $letterNumber;\n } else {\n $actualStepsCount = $stepsCount;\n $steps += $actualStepsCount;\n\n $prevPosition = $letterNumber;\n }\n}\n\necho $steps;\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "142bad49d2332628bacd75ac052ac1ba", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2a53f4b35e936ed4e6270269da51563d", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n \n if ($key == 1) $value3=$value;\n if ($key == 0) $value2=$value;\n if ($key == 2) $value5=$value;\n if ($key == 3) $value6=$value;\n \n \n \n if ($value2 <= $value5 and $value2 <= $value6) {\n $final=$value2 * 256;\n \n }elseif ($value5 < $value2 and $value5 < $value6) {\n \n $final=$value5 * 256;\n \n }elseif ($value6 < $value2 and $value6 < $value5){\n \n $final=$value6 * 256;\n \n }elseif ($value5 == $value6) {\n \n $final= $value5 * 256;\n \n }\n\n $actvalue=$final / 256;\n $ac2=$value2 - $actvalue;\n \n \n if ($actvalue == $value2) {\n $ff =$final ;\n \n }elseif ($value3 < $ac2) {\n $mm=$value3 * 32;\n $ff=$mm + $final;\n \n \n \n }elseif ($ac2 < $value3) {\n $ff = $ac2 * 32 + $final;\n \n }elseif ($ac2 == $value3) {\n \n $ff= $value3 * 32 + $final;\n }\n \n \n\n}\n echo $ff;\n \n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "7ed2afeadf15a6fab51cac8e5a735c75", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "56fbb73cf2cb23edfd907111419f3d28", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n \n if ($key == 1) $value3=$value;\n if ($key == 0) $value2=$value;\n if ($key == 2) $value5=$value;\n if ($key == 3) $value6=$value;\n \n \n \n if ($value2 <= $value5 and $value2 <= $value6) {\n $final=$value2 * 256;\n \n }elseif ($value5 < $value2 and $value5 < $value6) {\n \n $final=$value5 * 256;\n \n }elseif ($value6 < $value2 and $value6 < $value5){\n \n $final=$value6 * 256;\n \n }elseif ($value5 == $value6) {\n \n $final= $value5 * 256;\n \n }\n\n $actvalue=$final / 256;\n $ac2=$value2 - $actvalue;\n \n \n if ($actvalue == $value2) {\n $ff =$final ;\n \n }elseif ($value3 < $ac2) {\n $mm=$value3 * 32;\n $ff=$mm + $final;\n \n \n \n }elseif ($ac2 < $value3) {\n $ff = $ac2 * 32 + $final;\n \n }elseif ($ac2 == $value3) {\n \n $ff= $value3 * 32 + $final;\n }\n \n \n\n}\n echo $ff;\n \n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "673a02db1f9d07ccf23bcaa85b504614", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\nfunction readNumArray($f) {\n\treturn readStringExplodeNum($f, ' ', true);\n}\n\nfunction readArray($f) {\n\treturn readStringExplodeNum($f, ' ');\n}\n\nfunction readTrimString($f) {\n\treturn trim(readString($f));\n}\n\n###### /IO ######\n# for($i=0;$i<$n;$i++)\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\tlist($k2, $k3, $k5, $k6) = readStringExplodeNum($f, ' ', true);\n\t$n256 = min($k2, $k5, $k6);\n\t$k2-=$n256;\n\t$k5-=$n256;\n\t$k6-=$n256;\n\n\t$n32 = min($k2, $k3);\n\techo ($n256 * 256 + $n32 * 32);\n\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "f16050ee738ef6067ee974d57ca16bcf", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $c)\n {\n $d[0] = 4;\n }\n else\n {\n $g = floor($a / $c);\n if($g >= 2)\n {\n $d[0] = 5;\n }\n else\n {\n $d[0] = 6;\n }\n }\n}\nelseif($e == 2)\n{\n if($f >= $c)\n {\n $d[0] = 2;\n }\n else\n {\n $g = floor($a / $c);\n if($g >= 2)\n {\n $d[0] = 3;\n }\n else\n {\n $d[0] = 4;\n }\n }\n}\nelseif($e == 3)\n{\n if(max($f, ($a - $b) / 2) >= $c)\n {\n $d[0] = 2;\n }\n elseif(max($f, $a - $b) >= $c)\n {\n $h = $a - $b;\n $i = $h + $f;\n $j = floor($i / $c);\n if($j == 1)\n {\n $d[0] = 3;\n }\n else\n {\n $d[0] = 2;\n }\n }\n else\n {\n $g = floor($a / $c);\n if($g >= 2)\n {\n $d[0] = 3;\n }\n else\n {\n $d[0] = 4;\n }\n }\n}\nelseif($e >= 4)\n{\n if(($a - ($b * 4)) / 2 >= $c)\n {\n $d[0] = 1;\n }\n else\n {\n $g = floor($a / $c);\n if($g >= 2)\n {\n $d[0] = 2;\n }\n else\n {\n $d[0] = 3;\n }\n }\n}\n$h = floor($a / $c);\n$i = $a % $c;\nif($h == 1)\n{\n if($i < $b)\n {\n $j = floor($a / $b);\n if($j == 1)\n {\n $d[1] = 6;\n }\n elseif(($j == 2) || ($j == 3))\n {\n $d[1] = 4;\n }\n elseif($j >= 4)\n {\n $d[1] = 3;\n }\n }\n elseif($i >= $b * 2)\n {\n $d[1] = 2;\n }\n elseif($i >= $b)\n {\n $j = floor($a / $b);\n if($j == 1)\n {\n $d[1] = 4;\n }\n elseif($j >= 2)\n {\n $d[1] = 3;\n }\n }\n}\nelseif($h >= 2)\n{\n if($i < $b)\n {\n $j = floor($a / $b);\n if($j == 1)\n {\n $d[1] = 6;\n }\n elseif(($j == 2) || ($j == 3))\n {\n $d[1] = 4;\n }\n elseif($j >= 4)\n {\n $d[1] = 3;\n }\n }\n elseif($i >= $b * 2)\n {\n $d[1] = 2;\n }\n elseif($i >= $b)\n {\n $j = floor($a / $b);\n if($j == 1)\n {\n $d[1] = 4;\n }\n elseif($j >= 2)\n {\n $d[1] = 3;\n }\n }\n}\nprint min($d);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "c09e86a0867784f94a198397c2ed5ecc", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max){\n $max = $colorsCount[$color];\n }\n}\n\n$stdout = fopen('php://stdout', 'w');\nfwrite($stdout, ($max <= $countFriends ? \"YES\" : \"NO\"));\nfclose($stdout);", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a929ac1997a4891dbd7a47bb7176469b", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $sNum) {\n echo \"NO\", PHP_EOL;die;\n }\n}\necho \"YES\", PHP_EOL;\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "2c93d8d070934dd2d5e8ee73c16e15c8", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $friendCount) {\n echo 'NO', PHP_EOL; die;\n };\n}\necho 'YES', PHP_EOL;\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c73cb456e5d7e603a8101d4be16c4fb1", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$max) $max = ord($str[$i]);\n}\n\n$ans = '';\nfor ($i = 0;$i", "lang_cluster": "PHP", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "4182a0d25d7ba1138326f9af9dfd8912", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $asc) {\n\t\t$asc = ord(substr($in[0], $x, 1));\n\t\t$count = 1;\n\t} else if (ord(substr($in[0], $x, 1)) == $asc) {\n\t\t$count++;\n\t}\n}\nreturn str_repeat(chr($asc), $count);\n}\n\n// End of submission file\n// Submission by chaotic_iak\n?>", "lang_cluster": "PHP", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "115d1ccab40a082fd7043e66f6ebafbd", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "1d4c7d30eb74f0b466eb344c4348f194", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) && ($f[0] == 0)) || ((strlen($g) > 1) && ($g[0] == 0)) || ((strlen($h) > 1) && ($h[0] == 0)) || ($f > 1000000) || ($g > 1000000) || ($h > 1000000))\n {\n continue;\n }\n else\n {\n $c = 1;\n $b = max($b, $f + $g + $h);\n }\n }\n }\n if($c == 0)\n {\n print \"-1\";\n }\n else\n {\n printf(\"%.0f\", $b);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "de9085218cdf96d6686208fc42eac734", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 21) {print '-1'; exit(0);}\n\n$max = -1;\nfor($i=1;$i<$l-1;$i++){\n for($j=$i+1;$j<$l;$j++){\n $a = substr($s,0,$i);\n $b = substr($s,$i,($j-$i));\n $c = substr($s,$j);\n if($a > 1000000 || $b > 1000000 || $c > 1000000) continue;\n if(($a[0] == '0' && strlen($a) > 1) ||\n ($b[0] == '0' && strlen($b) > 1) ||\n ($c[0] == '0' && strlen($c) > 1)) continue;\n if($max < $a + $b + $c) $max = $a + $b + $c;\n }\n}\n\nprint $max;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "7b312b10996a683ba51b598467e002a6", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 8) return true;\n\telse if ($n === 7 && $str !== \"1000000\") return true;\n\t\n\treturn false;\n}\n\nfunction is_leadingzero($str){\n\t$n = strlen($str);\n\t$str_nums = str_split($str);\n\t\n\tif ($str_nums[0] === \"0\") {\n\t\tif ($n !== 1) return true;\n\t}\n\t\n\treturn false;\n}\n\nfunction solve(){\n\t$Scanner = new Scanner(\"php://stdin\");\n\t//$Scanner = new Scanner(\"input.txt\");\n\t\n\t$S = $Scanner->Scan();\n\t$len = strlen($S);\n\t$max = -1;\n\t\n\tfor ($i = 1; $i <= $len - 2; $i++) {\n\t\t$first = substr($S, 0, $i);\n\t\tif (is_leadingzero($first) || is_length_invalid($first)) continue;\n\n\t\tfor ($j = 1; $j <= $len - $i - 1; $j++) {\n\t\t\t$second = substr($S, $i , $j);\n\t\t\tif (is_leadingzero($second) || is_length_invalid($second)) continue;\n\t\t\t\t\t\n\t\t\tfor ($k = 1; $k <= $len - $i - $j; $k++) {\n\t\t\t\t\t$third = substr($S, $i + $j);\n\t\t\t\t\tif (is_leadingzero($third) || is_length_invalid($third)) continue;\n\t\t\t\t\t$max = max($max, $first + $second + $third);\n\t\t\t}\n\t\t}\n\t}\n\tprint($max);\n\t\n\t$Scanner->Close();\n}\n\nclass Scanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $Id = 0;\n\t\n\tpublic function __construct($opend){\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\t\t$contents = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \" \", $contents);\n\t\t$this->Scanners = explode(\" \", $contents);\n\t}\n\t\n\tpublic function Scan(){\n\t\treturn $this->Scanners[$this->Id++];\n\t}\n\n\tpublic function Close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6e35534c43e126a9e7ddba6a1ef0b50f", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\t$n = readNum($f);\n\t$times = readStringExplodeNum($f, ' ', true);\n\t$f = 0;\n\t$viewTime = 0;\n\tfor ($i = 1; $i <= 90; $i++) {\n\t\tif (in_array($i, $times)) {\n\t\t\t$f = 0;\n\t\t} else {\n\t\t\t$f ++;\n\t\t}\n\n\t\t$viewTime++;\n\t\tif ($f >= 15) {\n\t\t\tbreak;\n\t\t}\n\t}\n\techo $viewTime;\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3f3689b466cbf1c3ca1cadcb770d711b", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 15) return ($start+15) >= 90 ? 90 : $start+15 ;\n $start = $arr[$i];\n }\n return ($arr[$n-1] + 15) >= 90 ? 90 : $arr[$n-1]+15;\n}\n //  Bear and Game\n $in = 'php://stdin';\n $input = fopen($in, \"r\");\n $n = fgets($input);\n $t = [];\n $t = array_merge($t, explode(\" \", trim(fgets($input))));\n echo (test($n,$t));\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9f77a56736665c5af59a7cd80d1c83d6", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "884315522973c7b84f73b94b8ef24e0c", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 15) {\n echo($t[$i] + 15);\n $isTVOff = true;\n break;\n }\n}\nif (!$isTVOff) {\n echo(90);\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ec874e37ef66e30db22cc741e82ba1b0", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 15) {\n echo($tt[$i] + 15);\n $isTVOff = true;\n break;\n }\n}\nif (!$isTVOff) {\n echo(90);\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8dc370cfde0fea9b61219313645839b7", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $min) {\n\t\t$min = (int)$min;\n\t\tif($min - $prevMin > 15) {\n\t\t\t$result = $prevMin + 15;\n\t\t\tbreak;\n\t\t}\n\t\tif($min == 90) {\n\t\t\t$result = 90;\n\t\t\tbreak;\n\t\t}\n\t\tif($key == $count - 1 && $min + 15 < 90) {\n\t\t\t$result = $min + 15;\n\t\t\tbreak;\n\t\t}\n\t\t$prevMin = $min;\n\t}\n\techo $result;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "209ec7e6c4d167570f13fc23cfea9ec5", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 15) break;\n\n $watchTime = $t[$i];\n }\n echo $watchTime+15 > 90 ? 90 : $watchTime+15;\n}\n\nwatchTime($n,$t);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4e6fbc2f2ceebea69bbc5a9d6429eb83", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1){\n break;\n } else {\n $watchTime = $t[$i];\n }\n }\n echo $watchTime+15 > 90 ? 90 : $watchTime+15 ;\n}\n\nwatchTime($n,$t);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "94ffa442cc2f759089e6f3583254b6e7", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " სალაჰ ად-დინ იუსუფ იბნ აიუბი\n\n// ეგვიპტის სულთანი 1171 წლიდან\n// Kingdom of Heaven -ში ერთ-ერთი პერსონაჟი\n// ჯვაროსნულ ლაშქრობებში ფიგურირებდა\n\n\n//\"I am not those men. I AM Sallah Ad Din. Sallah Ad Din!\"\n\n\n$in = fgets(STDIN);\n\n$str = array();\n\n$salahAdDin = 0;\n\nfor($i=0;$i", "lang_cluster": "PHP", "tags": ["brute force", "dp"], "code_uid": "27684d14cbf3656bf11c9e0a66921738", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp"], "code_uid": "01d74d74902e00761852707ebab698d4", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "14534d9d00b9ef4c1bb83336467b4b2d", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "103b7bb2139b69730c1bf160cef498fa", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "2f5a2bc83d04d4f0eb6489db62b7039e", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $y > 0) {\n $answer = array(0, $x + $y, $x + $y, 0);\n}\nelseif ($x > 0 && $y < 0) {\n $answer = array(0, -$x + $y, $x - $y, 0);\n}\nelseif ($x < 0 && $y > 0) {\n $answer = array($x - $y, 0, 0, -$x + $y);\n}\nelseif ($x < 0 && $y < 0) {\n $answer = array($x + $y, 0, 0, $x + $y);\n}\n\nprint implode(' ', $answer);\n\nfunction line() {\n return trim(fgets(STDIN));\n}\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "0f950158a3a6294c77d6be348fa05e01", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) ? 1 : -1;\n$signy = ($y > 0) ? 1 : -1;\n\n$points = array(array(0,0), array(0,0));\n$points[0][0] = $signx * $sum;\n$points[1][1] = $signy * $sum;\n\nif ($points[0][0] < $points[1][0]) {echo $points[0][0] . \" \" . $points[0][1] . \" \" . $points[1][0] . \" \" . $points[1][1];} else {echo $points[1][0] . \" \" . $points[1][1] . \" \" . $points[0][0] . \" \" . $points[0][1];}", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2bbf727629c15c29629e714bd7a386b7", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($b > 0))\n{\n print \"0 \" . $c . \" \" . $c . \" 0\";\n}\nelseif(($a > 0) && ($b < 0))\n{\n print \"0 -\" . $c . \" \" . $c . \" 0\";\n}\nelseif(($a < 0) && ($b > 0))\n{\n print \"-\" . $c . \" 0 0 \" . $c;\n}\nelseif(($a < 0) && ($b < 0))\n{\n print \"-\" . $c . \" 0 0 \" . \"-\" . $c;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f4f253dd82bb3f46e2c8f613b1fdc0de", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0 && $split_text[1]>=0){\n $result = $split_text[0] + $split_text[1];\n echo '0 '.$result.' '.$result.' 0';\n }\n elseif ($split_text[0]<0 && $split_text[1]>=0) {\n $result = abs($split_text[0]) + $split_text[1];\n echo '-'.$result.' 0 0 '.$result;\n }elseif ($split_text[0]<0 && $split_text[1]<0) {\n $result = $split_text[0] + $split_text[1];\n echo $result.' 0 0 '.$result;\n }else{\n $result = $split_text[0] + abs($split_text[1]);\n echo '0 -'.$result.' '.$result.' 0';\n }\n ", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "590b164d5a7304623df109103a24e530", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " = 0 and $b >= 0) \n echo \"0 $r $r 0\\n\";\nelse if ($a < 0 and $b >= 0)\n echo \"-$r 0 0 $r\\n\";\nelse if ($a < 0 and $b < 0)\n echo \"-$r 0 0 -$r\\n\";\nelse \n echo \"0 -$r $r 0\\n\";\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d351061c8b9d6a17a251db12a958329a", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c10aa160bc3450b84906f8148fc3d719", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2,\n 1 => 7,\n 2 => 2,\n 3 => 3,\n 4 => 3,\n 5 => 4,\n 6 => 2,\n 7 => 5,\n 8 => 1,\n 9 => 2\n);\n\n$a[0] = substr($s,0,1);\n$a[1] = substr($s,1,1);\n\n$result = $data[$a[0]]*$data[$a[1]];\n\necho ($result);\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6ab598d32d6cb089abed0dc954296926", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5d6be9d484cf5b9af26116de2f7e1835", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 7) {\n $ret++;\n }\n }\n return $ret;\n}\n\n//echo check($a) * check($b);\n\nfprintf($fileOUT, (check($a) * check($b)) . \"\\n\");\n\nfclose($fileIN);\nfclose($fileOUT);\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b078b4fcc38bbb515213ff5b2cac5de9", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "greedy"], "code_uid": "6d3665590dd82e1b419a5442573466a4", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1; $i--) {\n for ($j = 0; $j < $rArray[$i]; $j++) {\n echo $i;\n }\n}", "lang_cluster": "PHP", "tags": ["math", "sortings", "greedy"], "code_uid": "67761c7db8c77992b76aefeb4130cc5d", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " array(),\n 1 => array(),\n 2 => array(2 => 1),\n 3 => array(2 => 1, 3 => 1),\n 4 => array(2 => 3, 3 => 1),\n 5 => array(2 => 3, 3 => 1, 5 => 1),\n 6 => array(2 => 4, 3 => 2, 5 => 1),\n 7 => array(2 => 4, 3 => 2, 5 => 1, 7 => 1),\n 8 => array(2 => 7, 3 => 2, 5 => 1, 7 => 1),\n 9 => array(2 => 7, 3 => 4, 5 => 1, 7 => 1),\n);\n\n$counts = array(2 => 0, 3 => 0, 5 => 0, 7 => 0);\nforeach (str_split($a) as $dig) {\n foreach ($etalons[$dig] as $num => $count) {\n $counts[$num] += $count;\n }\n}\n\n$asmDigits = array();\nwhile ($counts[7]) {\n $asmDigits[] = 7;\n foreach ($etalons[7] as $num => $count) {\n $counts[$num] -= $count;\n }\n}\nwhile ($counts[5]) {\n $asmDigits[] = 5;\n foreach ($etalons[5] as $num => $count) {\n $counts[$num] -= $count;\n }\n}\nwhile ($counts[3]) {\n $asmDigits[] = 3;\n foreach ($etalons[3] as $num => $count) {\n $counts[$num] -= $count;\n }\n}\nwhile ($counts[2]) {\n $asmDigits[] = 2;\n foreach ($etalons[2] as $num => $count) {\n $counts[$num] -= $count;\n }\n}\n\nrsort($asmDigits);\necho implode('', $asmDigits), \"\\n\";\n\n\n\n", "lang_cluster": "PHP", "tags": ["math", "sortings", "greedy"], "code_uid": "605b766588724563f22b663da08103b1", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "greedy"], "code_uid": "e98f7174dfe5445d84d2a27145e3e982", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "strings"], "code_uid": "35f422a5d4ce03eaf5dc8646eb51b04e", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "strings"], "code_uid": "2cb71bb88004732d078182a211514df5", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "90c1fb690c9a3331ee10dd6421e35cfc", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6f7ca3091637941d6e2ca834866c9786", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$a[1]-0.5){\n print $i;\n break;\n }\n $i++;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ba8fd29e27ae415eb81f52fdb6ef5e50", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1 || $counts['0'] > $counts['X']) $illegal = true;\n\n// defining if someone won\n\nfunction fullRow($array, $rowNum, $sign) {\n $index = $rowNum * 3;\n \n if ($array[$index] == $sign && $array[$index + 1] == $sign && $array[$index + 2] == $sign) return true;\n else return false;\n}\n\nfunction fullCol($array, $colNum, $sign) {\n if ($array[$colNum] == $sign && $array[$colNum + 3] == $sign && $array[$colNum + 6] == $sign) return true;\n else return false;\n} \n\nfunction fullDiag1($array, $sign) {\n if ($array[0] == $sign && $array[4] == $sign && $array[8] == $sign) return true; \n else return false;\n} \n\nfunction fullDiag2($array, $sign) {\n if ($array[2] == $sign && $array[4] == $sign && $array[6] == $sign) return true; \n else return false;\n} \n\nfunction playerWon($array, $sign) {\n for ($i = 0; $i < 3; $i++)\n {\n if (fullCol($array, $i, $sign)) return true;\n if (fullRow($array, $i, $sign)) return true;\n }\n \n if (fullDiag1($array, $sign) || fullDiag2($array, $sign)) return true;\n else return false;\n}\n\n$xWon = playerWon($data, 'X');\n$oWon = playerWon($data, '0');\n\nif (($xWon and $oWon) || (( $oWon && ($counts['0'] + 1 == $counts['X'])) || ($xWon && ($counts['0'] == $counts['X'])))) $illegal = true;\n\n// draw\n\nif ($illegal) echo 'illegal';\nelse if ($xWon || $oWon)\n{\n if ($xWon) echo 'the first player won';\n else echo 'the second player won';\n}\nelse\n{\n if ($counts['X'] + $counts['0'] == 9)\n {\n echo 'draw';\n }\n else\n {\n if ($counts['X'] > $counts['0']) echo 'second';\n if ($counts['X'] <= $counts['0']) echo 'first';\n //else echo 'first';\n }\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "ee9ad15e448f9bb01c562f4efa760ebd", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1 ||$yCount>$xCount){\n echo \"illegal\";\n $gotResult = true;\n}\n\nif(!$gotResult){\n // //horizon\n // $success1 = $board[0][0].$board[1][0].$board[2][0];\n // $success2 = $board[0][1].$board[1][1].$board[2][1];\n // $success3 = $board[0][2].$board[1][2].$board[2][2];\n\n // //vertical\n // $success4 = $board[0][0].$board[0][1].$board[0][2];\n // $success5 = $board[1][0].$board[1][1].$board[1][2];\n // $success6 = $board[2][0].$board[2][1].$board[2][2];\n\n // //diagonal\n // $success7 = $board[0][0].$board[1][1].$board[2][2];\n // $success8 = $board[0][2].$board[1][1].$board[2][0];\n\n $n =count($board[0]);\n\n $xWin = false;\n $yWin = false;\n //Vertical and Horizontal\n //O(n^2)???\n for($i=0;$i<$n;$i++){\n $hStr = \"\";\n $vStr = \"\";\n \n for($j=0;$j<$n;$j++){\n $hStr .= $board[$i][$j];\n $vStr .= $board[$j][$i];\n }\n if($hStr ===\"XXX\" || $vStr ===\"XXX\"){\n $xWin =true;\n }else if($hStr ===\"000\" || $vStr ===\"000\"){\n $yWin =true;\n }\n }\n\n //Diagonal\n //O(n^2)???\n $lDia = \"\";\n $rDia = \"\";\n for($i=0;$i<$n;$i++){\n $lDia .=$board[$i][$i];\n $rDia .=$board[$i][$n-1-$i];\n }\n if($lDia ===\"XXX\" || $rDia===\"XXX\"){\n $xWin = true;\n }else if($lDia ===\"000\" ||$rDia ===\"000\"){\n $yWin = true;\n }\n \n if($xWin && $ywin){\n echo \"illegal\";\n }else if($xWin && $xCount == $yCount){\n echo \"illegal\";\n }else if($yWin && $xCount == ($yCount+1)){\n echo \"illegal\";\n }else if(!$xWin && !$yWin && ($xCount+$yCount)==9){\n echo \"draw\";\n }else if($xWin && !$yWin){\n echo \"the first player won\";\n }else if($yWin && !$xWin){\n echo \"the second player won\";\n }else if($xCount>$yCount){\n echo \"second\";\n }else{\n echo \"first\";\n }\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "e200f6f10c7e9ea125bca3ea971a3774", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1 || $zc > $xc) {print 'illegal'; exit(0);}\n\n$win1 = false; $win2 = false;\n\nif($f1 === 'XXX' || $f2 === 'XXX' || $f3 === 'XXX' || $f1[0].$f2[0].$f3[0] === 'XXX' || $f1[1].$f2[1].$f3[1] === 'XXX' || $f1[2].$f2[2].$f3[2] === 'XXX' || $f1[0].$f2[1].$f3[2] === 'XXX' || $f1[2].$f2[1].$f3[0] === 'XXX') $win1 = true;\n\nif($f1 === '000' || $f2 === '000' || $f3 === '000' || $f1[0].$f2[0].$f3[0] === '000' || $f1[1].$f2[1].$f3[1] === '000' || $f1[2].$f2[2].$f3[2] === '000' || $f1[0].$f2[1].$f3[2] === '000' || $f1[2].$f2[1].$f3[0] === '000') $win2 = true;\n\nif($win1 && $win2) {print 'illegal'; exit(0);}\n\nif($win1 && ($zc == $xc)) {print 'illegal'; exit(0);}\n\nif($win2 && (($zc + 1) == $xc)) {print 'illegal'; exit(0);}\n\nif($win1 && !$win2) {print 'the first player won'; exit(0);}\n\nif(!$win1 && $win2) {print 'the second player won'; exit(0);}\n\nif(!$win1 && !$win2 && ($xc + $zc) == 9) {print 'draw'; exit(0);}\n\nif($xc > $zc) {print 'second'; exit(0);}else{print 'first'; exit(0);}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "ceaed5d368484b3ad91bf9f68166a30a", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1 || $counts['0'] > $counts['X']) $illegal = true;\n\n// defining if someone won\n\nfunction fullRow($array, $rowNum, $sign) {\n $index = $rowNum * 3;\n \n if ($array[$index] == $sign && $array[$index + 1] == $sign && $array[$index + 2] == $sign) return true;\n else return false;\n}\n\nfunction fullCol($array, $colNum, $sign) {\n if ($array[$colNum] == $sign && $array[$colNum + 3] == $sign && $array[$colNum + 6] == $sign) return true;\n else return false;\n} \n\nfunction fullDiag1($array, $sign) {\n if ($array[0] == $sign && $array[4] == $sign && $array[8] == $sign) return true; \n else return false;\n} \n\nfunction fullDiag2($array, $sign) {\n if ($array[2] == $sign && $array[4] == $sign && $array[6] == $sign) return true; \n else return false;\n} \n\nfunction playerWon($array, $sign) {\n for ($i = 0; $i < 3; $i++)\n {\n if (fullCol($array, $i, $sign)) return true;\n if (fullRow($array, $i, $sign)) return true;\n }\n \n if (fullDiag1($array, $sign) || fullDiag2($array, $sign)) return true;\n else return false;\n}\n\n$xWon = playerWon($data, 'X');\n$oWon = playerWon($data, '0');\n\nif (($xWon and $oWon) || (( $oWon && ($counts['0'] + 1 == $counts['X'])) || ($xWon && ($counts['0'] == $counts['X'])))) $illegal = true;\n\n// draw\n\nif ($illegal) echo 'illegal';\nelse if ($xWon || $oWon)\n{\n if ($xWon) echo 'the first player won';\n else echo 'the second player won';\n}\nelse\n{\n if ($counts['X'] + $counts['0'] == 9)\n {\n echo 'draw';\n }\n else\n {\n if ($counts['X'] > $counts['0']) echo 'second';\n if ($counts['X'] <= $counts['0']) echo 'first';\n //else echo 'first';\n }\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "b8e11dfa09a6a72101c5c504ae666c6a", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d)) || (($c <= $d) && ($b > $d)))\n{\n print \"Final!\";\n}\nelse\n{\n $e = range(1, $a);\n $g = 1;\n $h = 0;\n while(TRUE)\n {\n $f = array();\n for($x = 0; $x < count($e) - 1; $x++)\n {\n if((($e[$x] == $b) && ($e[$x + 1] == $c)) || (($e[$x] == $c) && ($e[$x + 1] == $b)))\n {\n $h = 1;\n break;\n }\n elseif((($e[$x] == $b) && ($e[$x + 1] != $c)) || (($e[$x] != $c) && ($e[$x + 1] == $b)))\n {\n $f[count($f)] = $b;\n }\n elseif((($e[$x] != $b) && ($e[$x + 1] == $c)) || (($e[$x] == $c) && ($e[$x + 1] != $b)))\n {\n $f[count($f)] = $c;\n }\n elseif((($e[$x] != $b) && ($e[$x + 1] != $c)) || (($e[$x] != $c) && ($e[$x + 1] != $b)))\n {\n $f[count($f)] = $e[$x];\n }\n $x++;\n }\n if($h == 0)\n {\n $e = $f;\n $g++;\n }\n else\n {\n break;\n }\n }\n print $g;\n}\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "a3cf839a4c38e4f179fd915e44219396", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $i--){\n $w -= 4;\n $h -= 4;\n $result += ($w + $h - 2) * 2;\n}\n\n// echo $result;\nfile_put_contents('php://stdout', $result);\n\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "e146ceb173349aea7a1d14f8a45cc6f3", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "48afe45694bea52f2255a834c4b37a27", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\r\n $ans = $t == 4 ? 2 : 1;\r\n \r\n } else {\r\n $ans = 0;\r\n }\r\n \r\n \r\n \r\n \r\n IO::pr($ans);\r\n \r\n}\r\n \r\n \r\nclass IO {\r\n public static function get()\r\n {\r\n return trim(fgets(STDIN));\r\n }\r\n \r\n public static function getArray()\r\n {\r\n return explode(' ', trim(fgets(STDIN)));\r\n }\r\n public static function pr($s)\r\n {\r\n echo $s, PHP_EOL;\r\n }\r\n public static function prArray($s)\r\n {\r\n echo implode( ' ', $s), PHP_EOL;\r\n }\r\n public static function getMinValue($x, $y) {\r\n return $x > $y ? $y : $x;\r\n }\r\n public static function getMaxValue($x, $y) {\r\n return $x > $y ? $x : $y;\r\n }\r\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "81448db0b498a4f8e8857966c0152574", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $v) {\n if (preg_match(\"/(\\.xx|xx\\.|x\\.x)/\", $v)) {\n echo \"YES\";\n // echo $v;\n exit;\n }\n }\n echo \"NO\";\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "94634852f6165cc4fab4700b1d0ed473", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $y--)\n {\n $h = $e[$x];\n $g[$y][$x] = $h[$y];\n }\n}\n$i = array();\nfor($x = 3; $x >= 0; $x--)\n{\n $j = $g[$x];\n $i[count($i)] = $j;\n}\nfor($x = 0; $x < 4; $x++)\n{\n for($y = 0; $y < 2; $y++)\n {\n if(($i[$x][$y] == \"x\") && ($i[$x][$y + 1] == \"x\") && ($i[$x][$y + 2] == \".\"))\n {\n $f = 1;\n break;\n }\n }\n for($y = 0; $y < 2; $y++)\n {\n if(($i[$x][$y] == \".\") && ($i[$x][$y + 1] == \"x\") && ($i[$x][$y + 2] == \"x\"))\n {\n $f = 1;\n break;\n }\n }\n for($y = 0; $y < 2; $y++)\n {\n if(($i[$x][$y] == \"x\") && ($i[$x][$y + 1] == \".\") && ($i[$x][$y + 2] == \"x\"))\n {\n $f = 1;\n break;\n }\n }\n}\nif(($e[0][1] == \"x\") && ($e[1][2] == \"x\") && ($e[2][3] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[0][1] == \".\") && ($e[1][2] == \"x\") && ($e[2][3] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][1] == \"x\") && ($e[1][2] == \".\") && ($e[2][3] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][0] == \"x\") && ($e[1][1] == \"x\") && ($e[2][2] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[1][1] == \"x\") && ($e[2][2] == \"x\") && ($e[3][3] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[0][0] == \"x\") && ($e[1][1] == \".\") && ($e[2][2] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][1] == \"x\") && ($e[2][2] == \".\") && ($e[3][3] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][0] == \"x\") && ($e[1][1] == \".\") && ($e[2][2] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][1] == \".\") && ($e[2][2] == \"x\") && ($e[3][3] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][0] == \"x\") && ($e[2][1] == \"x\") && ($e[3][2] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[1][0] == \".\") && ($e[2][1] == \"x\") && ($e[3][2] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][0] == \"x\") && ($e[2][1] == \".\") && ($e[3][2] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][2] == \"x\") && ($e[1][1] == \"x\") && ($e[2][0] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[0][2] == \".\") && ($e[1][1] == \"x\") && ($e[2][0] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][2] == \"x\") && ($e[1][1] == \".\") && ($e[2][0] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][3] == \"x\") && ($e[1][2] == \"x\") && ($e[2][1] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[0][3] == \".\") && ($e[1][2] == \"x\") && ($e[2][1] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[0][3] == \"x\") && ($e[1][2] == \".\") && ($e[2][1] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][2] == \"x\") && ($e[2][1] == \".\") && ($e[3][0] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][2] == \"x\") && ($e[2][1] == \".\") && ($e[3][0] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][2] == \".\") && ($e[2][1] == \"x\") && ($e[3][0] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][3] == \"x\") && ($e[2][2] == \"x\") && ($e[3][1] == \".\"))\n{\n $f = 1;\n}\nelseif(($e[1][3] == \".\") && ($e[2][2] == \"x\") && ($e[3][1] == \"x\"))\n{\n $f = 1;\n}\nelseif(($e[1][3] == \"x\") && ($e[2][2] == \".\") && ($e[3][1] == \"x\"))\n{\n $f = 1;\n}\nif($f == 1)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "49a67d618c09daa4471643b27dd58618", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "de2e99fc927faaa7edd0e44c53a1125a", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $aSellMax){\n echo $k;\n} else {\n $iBuyMin = min($aBuy);\n $iSellMax = max($aSell);\n $iCount = floor($k / $iBuyMin);\n $iReminder = $k % $iBuyMin;\n $iTotal = $iCount * $iSellMax + $iReminder;\n echo $iTotal;\n}\n\n\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "e0657e5b5444f3bcda12bee32319eba9", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "4753bdac787686f499ce93870c29065a", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "geometry"], "code_uid": "66722dbe8c7c7e15d85ff04d10be38d1", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "geometry"], "code_uid": "f377ba412cc25f6589a8a0ad168bcb0e", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) { \n\t\tif($value > $bigger){\n\t\t\t$bigger = $value;\n\t\t\t$bigger_key = $key;\n\t\t}\t\t\n\t}\n}\necho $bigger_key;", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "140c2acd1eb15c2a0d21a914e835f04c", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $d) && ($c > 0))\n{\n print \"4\";\n}\nelseif($c < $d)\n{\n print \"7\";\n}\nelseif(($c == \"0\") && ($d == \"0\"))\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "3e2d5539f4e984ddc19115a8aa2a4530", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) { \n\t\tif($value > $bigger){\n\t\t\t$bigger = $value;\n\t\t\t$bigger_key = $key;\n\t\t}\t\t\n\t}\n}\necho $bigger_key;\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "4476f4fc73b8763138c765dcc85440d7", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp", "bitmasks"], "code_uid": "ed32ff648189547506eefde4d6d7229b", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0;$i--) {\n $k = (int)trim(fgets(STDIN));\n $tmp = [];\n foreach ($result as $r) {\n $tmp[] = $r+$k;\n $tmp[] = $r-$k;\n }\n $result = $tmp;\n}\nforeach ($result as $r) {\n if ($r % 360 === 0) {\n echo 'YES';\n exit;\n }\n}\necho 'NO';", "lang_cluster": "PHP", "tags": ["brute force", "dp", "bitmasks"], "code_uid": "0fb000d1d54b9e6293d08ddbd9060bc7", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5eb2bd3e73e68593befa6aa5afcb2815", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "eb4502571f78f83791b8921bc3625db2", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "29f20d0c47edd5d1d851f255bfca3c64", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $solverSkill && $lastProblemDifficulty > $solverSkill)\n {\n return 0;\n }\n for($problemsCounter = 0; $problemsCounter < $problemsCount; $problemsCounter++)\n {\n if($problemDifficulty[$problemsCounter] <= $solverSkill)\n {\n $maximumSolvedProblems++;\n unset($problemDifficulty[$problemsCounter]);\n }\n \n if($problemDifficulty[$problemsCounter] > $solverSkill)\n {\n break;\n }\n }\n \n if(count($problemDifficulty) > 0) {\n $reversedArray = array_reverse($problemDifficulty);\n for($problemsCounter = 0; $problemsCounter < count($problemDifficulty); $problemsCounter++)\n {\n if($reversedArray[$problemsCounter] <= $solverSkill)\n {\n $maximumSolvedProblems++;\n unset($reversedArray[$problemsCounter]);\n }\n \n if($reversedArray[$problemsCounter] > $solverSkill)\n {\n break;\n }\n }\n }\n \n return $maximumSolvedProblems;\n}\n?>\n\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "eed00247725c2c0f9ae7a473b6cfbd65", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$k)\n\t{\n\t\t$pos[$j++]=$i;\n $flag=1;\n\t\n\t}\n}\n//print_r($pos);\nif($flag==1)\n echo $arrSize-1-abs($pos[count($pos)-1]-$pos[0]);\nelse\n echo $arrSize;\n\n\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "139a07695efbb38e087cecf812d575ea", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $c[$e])\n {\n $d++;\n $e++;\n }\n elseif($b >= $c[$f])\n {\n $d++;\n $f--;\n }\n else\n {\n break;\n }\n if(($e == $f) && ($b >= $c[$e]))\n {\n $d++;\n break;\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "5a89169d4dff2033f5eec34d06e769c0", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $f) && ($d > $g))\n{\n $i++;\n}\nif(($a > $h) && ($d > $e))\n{\n $i++;\n}\nif($i == 2)\n{\n print \"Team 1\";\n}\nelse\n{\n $i = 0;\n if(($c > $f) && ($b > $g))\n {\n $i++;\n }\n if(($c > $h) && ($b > $e))\n {\n $i++;\n }\n if($i == 2)\n {\n print \"Team 1\";\n }\n else\n {\n if((($f > $a) && ($g > $d) && ($h > $c) && ($e > $b)) || (($h > $a) && ($e > $d) && ($f > $c) && ($g > $b)))\n {\n print \"Team 2\";\n }\n else\n {\n $i = 0;\n if(($f > $a) && ($g > $d))\n {\n $i++;\n }\n if(($f > $c) && ($g > $b))\n {\n $i++;\n }\n if($i == 2)\n {\n print \"Team 2\";\n }\n else\n {\n $i = 0;\n if(($h > $a) && ($e > $d))\n {\n $i++;\n }\n if(($h > $c) && ($e > $b))\n {\n $i++;\n }\n if($i == 2)\n {\n print \"Team 2\";\n }\n else\n {\n print \"Draw\";\n }\n }\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6679a36f762cd43aaa1796fb72e3e834", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n if(($c[0] == 2) && ($c[1] == 2))\n {\n array_splice($c, 0, 2);\n $c[count($c)] = 3;\n }\n else\n {\n break;\n }\n }\n }\n }\n if($d == 0)\n {\n print \"-1\";\n }\n else\n {\n print count($c);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "ef96bc4ea341cd941e422f23e39b2620", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "deeb2080aa14d8ef54f5db12fbd58398", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1){\n\t\tif($k % 2 == 0 || $k % 3 == 0){\n\t\t\t$k = ($k % 2 == 0 ? $k/2 : $k/3);\n\t\t\t$c++;\n\t\t}else{\n\t\t\t$c = -1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfwrite(STDOUT, $c);\n}else{\n\tfwrite(STDOUT, \"-1\");\n}", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "77c8ac159d24e5eba9531662d0418617", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " \"zero\", 1 => \"one\", 2 => \"two\", 3 => \"three\", 4 => \"four\", 5 => \"five\", 6 => \"six\", 7 => \"seven\", 8 => \"eight\", 9 => \"nine\", 10 => \"ten\", 11 => \"eleven\", 12 => \"twelve\", 13 => \"thirteen\", 14 => \"fourteen\", 15 => \"fifteen\", 16 => \"sixteen\", 17 => \"seventeen\", 18 => \"eighteen\", 19 => \"nineteen\", 20 => \"twenty\", 30 => \"thirty\", 40 => \"forty\", 50 => \"fifty\", 60 => \"sixty\", 70 => \"seventy\", 80 => \"eighty\", 90 => \"ninety\");\n$c = array(2 => \"twenty-\", 3 => \"thirty-\", 4 => \"forty-\", 5 => \"fifty-\", 6 => \"sixty-\", 7 => \"seventy-\", 8 => \"eighty-\", 9 => \"ninety-\");\nif(($a <= 20) || ($a == 30) || ($a == 40) || ($a == 50) || ($a == 60) || ($a == 70) || ($a == 80) || ($a == 90))\n{\n print $b[$a];\n}\nelse\n{\n print $c[$a[0]] . $b[$a[1]];\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c6e7c752254f70cba458132fcec5fa0f", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 'zero', '1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six', '7' => 'seven', '8' => 'eight', '9' => 'nine', '10' => 'ten', '11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' => 'nineteen', '20' => 'twenty', '30' => 'thirty', '40' => 'forty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety');\n// Если число меньше или равно 19\nif ($s <= 19) {\n\t$result = $numbers[$s];\n} else {\n\t// Проверяем второй символ введенного числа\n\tif($s[1]==0) {\n\t\t// Если 0, то выводим из массива\n\t\t$result = $numbers[$s];\n\t} else {\n\t\t// Если нет, то собираем число\n\t\t$first_number = $numbers[$s[0].'0'];\n\t\t$second_number = $numbers[$s[1]];\n\t\t$result = $first_number.'-'.$second_number;\n\t}\n}\nprint($result);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "dbf57c41cbe17b32086b850931eb0354", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "27b3c718adfcbc35514a444fc39054ee", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 'one',\n 2 => 'two',\n 3 => 'three',\n 4 => 'four',\n 5 => 'five',\n 6 => 'six',\n 7 => 'seven',\n 8 => 'eight',\n 9 => 'nine',\n 10 => 'ten',\n 11 => 'eleven',\n 12 => 'twelve',\n 13 => 'thirteen',\n 15 => 'fifteen',\n 18 => 'eighteen',\n);\n\n$stringFirstNumbers = array(\n 1 => '',\n 2 => 'twenty',\n 3 => 'thirty',\n 4 => 'forty',\n 5 => 'fifty',\n 6 => 'sixty',\n 7 => 'seventy',\n 8 => 'eighty',\n 9 => 'ninety',\n);\n\nif ($number <= 13 || $number == 15 || $number == 18)\n echo $number == 0 ? 'zero' : $stringNumbers[$number];\n\nelse {\n $firstNumber = $number / 10;\n $secondNumber = $number % 10;\n\n if ((int)$firstNumber == 1) echo $stringNumbers[(int)$secondNumber].'teen';\n\n else echo $stringNumbers[(int)$secondNumber] ? $stringFirstNumbers[(int)$firstNumber].'-'.$stringNumbers[(int)$secondNumber] : $stringFirstNumbers[(int)$firstNumber];\n}", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "5424812ce4ff6d687644da691bd500e3", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) {\n\t\t\t// Если первая часть слова не в начале, то\n\t\t\t// Разбиваем на 3 части правую часть строки\n\t\t\t// $string = $left.$center.$right;\n\t\t\t// До искомой первая части \n\t\t\t$left = substr($string, 0, $pos);\n\t\t\t// Сама первая часть слова\n\t\t\t$center = substr($string, $pos, $i);\n\t\t\t// Остаток строки (полностью)\n\t\t\t$right = substr($string, ($i+$pos), $string_length);\n\t\t\tif($right) {\n\t\t\t\t// Если существует правая часть, то неподходит, так как придется делить больше\n\t\t\t} else {\n\t\t\t\t// Если правой части нет, то центральная часть должна быть искомым слово\n\t\t\t\tif($center == $word) {\n\t\t\t\t\t$answer = 'YES';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Если первая часть слова в начале, то правая часть строки (с конца) должна быть искомой второй частью слова\n\t\t\t// Обрезок правой строки (на длину слова)\n\t\t\t$right = substr($string, -$second_slice_length, $second_slice_length);\n\t\t\tif($right == $second_slice) {\n\t\t\t\t$answer = 'YES';\n\t\t\t}\n\t\t}\n\t}\n}\n// Вывожу ответ\nprint($answer);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "0d8c95c0ea63c36757c9be8ab52995e7", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "5c1da4358138c801f38f2a4389a618f3", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 10) {\n fprintf($fileOUT, \"YES\\n\");\n} else {\n fprintf($fileOUT, \"NO\\n\");\n}\n\nfclose($fileIN);\nfclose($fileOUT);\n\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "4ac2aaffb3871d878b164ae11b369248", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "459601a5ba198e9a1941c8d8700de554", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\n echo \"YES\";\n exit();\n }\n }\n echo \"NO\";\n \n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "afe36482dd40963a72c66aa0e23f12ad", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "adda8a84ee645f4d7266d1a3e10c348e", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "1e50a6ec8a072db90eb7c8b50c9ead3d", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3bebe99b930b29036f7d53e74de8121a", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "64194f48fd0275bb2690e53d01cde3ae", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "39952d86e389c2eb8253101d0f54b906", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "347ef76d02bb4ce3738e73c76a161d8e", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\t$stream = STDIN;\n\tif ($is_test)\n\t\t$stream = $f;\n\t/* begin body */\n\tlist($_x1, $_x2, $_x3) = readStringExplodeNum($stream, ' ', true);\n\t$x1 = min($_x1, $_x3, $_x2);\n\t$x3 = max($_x1, $_x3, $_x2);\n\t$x2 = ($_x1 + $_x2 + $_x3) - $x1 - $x3;\n\t$minRes = 9999;\n\tfor ($i = $x1; $i < $x3; $i++) {\n\t\t$pointRes = abs($x1 - $i) + abs($x2 - $i) + abs($x3 - $i);\n\t\tif ($pointRes < $minRes) {\n\t\t\t$minRes = $pointRes;\n\t\t}\n\t}\n\techo $minRes;\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "9889aafac8294d2b309208c11c719384", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\t$stream = STDIN;\n\tif ($is_test)\n\t\t$stream = $f;\n\t/* begin body */\n\t$arr = readStringExplodeNum($stream, ' ', true);\n\trsort($arr);\n echo $arr[0] - $arr[2];\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "6dcf38a5e8c5eef236d79bf5df47f849", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "7692ff9805b980efde5f40a61b6adb02", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "5a2325e68890eae08a61296ca9562437", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$m) {\n $max = $n;\n $min = $m;\n } else {\n $max = $m;\n $min = $n;\n }\n \n echo ($max-1).\" \".($min);\n //fclose($out);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation", "games"], "code_uid": "d28f5810bc74ce14c5bf01c539f90748", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b * 2) && ($a >= $c * 2) && ($a >= $d * 2))\n{\n $e++;\n $f = \"A\";\n}\nelseif(($a <= $b / 2) && ($a <= $c / 2) && ($a <= $d / 2))\n{\n $e++;\n $f = \"A\";\n}\nif(($b >= $a * 2) && ($b >= $c * 2) && ($b >= $d * 2))\n{\n $e++;\n $f = \"B\";\n}\nelseif(($b <= $a / 2) && ($b <= $c / 2) && ($b <= $d / 2))\n{\n $e++;\n $f = \"B\";\n}\nif(($c >= $a * 2) && ($c >= $b * 2) && ($c >= $d * 2))\n{\n $e++;\n $f = \"C\";\n}\nelseif(($c <= $a / 2) && ($c <= $b / 2) && ($c <= $d / 2))\n{\n $e++;\n $f = \"C\";\n}\nif(($d >= $a * 2) && ($d >= $b * 2) && ($d >= $c * 2))\n{\n $e++;\n $f = \"D\";\n}\nelseif(($d <= $a / 2) && ($d <= $b / 2) && ($d <= $c / 2))\n{\n $e++;\n $f = \"D\";\n}\nif(($e == 0) || ($e >= 2))\n{\n print \"C\";\n}\nelse\n{\n print $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0820c1e8b305ac08a8f68ca2189410f9", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $B*2 && $A >= $C*2 && $A >= $D*2){\n $nc++;\n $ch = \"A\";\n}\nif($B >= $A*2 && $B >= $C*2 && $B >= $D*2){\n $nc++;\n $ch = \"B\";\n}\nif($C >= $A*2 && $C >= $B*2 && $C >= $D*2){\n $nc++;\n $ch = \"C\";\n}\nif($D >= $A*2 && $D >= $B*2 && $D >= $C*2){\n $nc++;\n $ch = \"D\";\n}\n\nif($A <= $B/2 && $A <= $C/2 && $A <= $D/2){\n $nc++;\n $ch = \"A\";\n}\nif($B <= $A/2 && $B <= $C/2 && $B <= $D/2){\n $nc++;\n $ch = \"B\";\n}\nif($C <= $A/2 && $C <= $B/2 && $C <= $D/2){\n $nc++;\n $ch = \"C\";\n}\nif($D <= $A/2 && $D <= $B/2 && $D <= $C/2){\n $nc++;\n $ch = \"D\";\n}\n\nif($nc==1){\n echo $ch;\n}\nelse{\n echo \"C\";\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "95a19cddecb464ad3911be4c331d3eb2", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "c20ee42ce2dde65cca4606ba8385f384", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "e3ea5a35fa663f9b10500d8c5c9662a8", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "ba9511466b5736c8eb146ce14e27ce99", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "combinatorics", "bitmasks"], "code_uid": "ed50926faea5e9fc90b5aa30234dfc34", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= max($b, $d)) || ($f <= min($b, $d))))\n{\n print \"2\";\n}\nelseif(($c == $e) && (($b >= max($d, $f)) || ($b <= min($d, $f))))\n{\n print \"2\";\n}\nelseif(($a == $e) && (($d >= max($b, $f)) || ($d <= min($b, $f))))\n{\n print \"2\";\n}\nelseif(($b == $d) && (($e >= max($a, $c)) || ($e <= min($a, $c))))\n{\n print \"2\";\n}\nelseif(($d == $f) && (($a >= max($c, $e)) || ($a <= min($c, $e))))\n{\n print \"2\";\n}\nelseif(($b == $f) && (($c >= max($a, $e)) || ($c <= min($a, $e))))\n{\n print \"2\";\n}\nelse\n{\n print \"3\";\n}\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "7b8fe3997a506c004808b3633b2ed831", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= max($aData[$i][$t],$aData[$j][$t])){\n echo 2;\n exit;\n }\n\n }\n }\n}\n\necho 3;\n#var_dump($aData);\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "c5c957d3864ded4ddfdd7b75f1fde555", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a))\n {\n print $x;\n break;\n }\n $c++;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "c068b55f8905da384ffb19083ad27f73", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "34967871f6d3b77aeb041780bdc9a448", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f)\n {\n break;\n }\n}\nprint $x / $b;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "binary search"], "code_uid": "44f68db9f4c1d4d7db80af68254242c1", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "binary search"], "code_uid": "67af2137ac6b124058b6398ebdac0b02", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "a4e4c3dfe0f4d74e86497457935c848f", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ec47c1999d29e7b7c1fda4e57cc328aa", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $e)\n {\n $i = $x;\n }\n $e = max($e, $f);\n}\n$b2 = $b;\n$b2 = array_reverse($b2);\n$g = 0;\n$h = 0;\nfor($x = 0; $x < count($b2); $x++)\n{\n if($b2[$x] == 1)\n {\n $h++;\n }\n else\n {\n $h--;\n }\n if($h >= $g)\n {\n $j = $x;\n }\n $g = max($g, $h);\n}\nif($e >= $g)\n{\n $k = array_slice($b, 0, $i + 1);\n $l = array_slice($b, $i + 1);\n for($x = 0; $x < count($k); $x++)\n {\n if($k[$x] == 1)\n {\n array_splice($k, 0, 1);\n $x--;\n }\n }\n for($x = 0; $x < count($l); $x++)\n {\n if($l[$x] == 0)\n {\n array_splice($l, 0, 1);\n $x--;\n }\n }\n $m = array_merge($k, $l);\n $n = count($m);\n print max($c, $d, $n);\n}\nelse\n{\n $k = array_slice($b2, 0, $j + 1);\n $l = array_slice($b2, $j + 1);\n for($x = 0; $x < count($k); $x++)\n {\n if($k[$x] == 1)\n {\n array_splice($k, 0, 1);\n $x--;\n }\n }\n for($x = 0; $x < count($l); $x++)\n {\n if($l[$x] == 0)\n {\n array_splice($l, 0, 1);\n $x--;\n }\n }\n $m = array_merge($k, $l);\n $n = count($m);\n print max($c, $d, $n);\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6f2b858f382543fac5c50b32c185c76a", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "bf9a9846225a1cac1e5b175526fed037", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b682a8952d0b19c0c1894d5c102940e3", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "edf955facabd66f52ce13ad9d8a6783c", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "#!/usr/bin/env php\n $b[count($b) - 1])\n {\n $b[0] = $b[0] - $b[count($b) - 1];\n rsort($b);\n }\n else\n {\n break;\n }\n}\nprint array_sum($b);\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "88c0862e879c9ac87134fae8cf9c36cd", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7fd0720c19be9c413a41c48266febe65", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26);\n\t$n = trim(fgets(STDIN));\n\t//ACTG\n\t$s = trim(fgets(STDIN));\n\t\n\t$a = str_split($s);\n\t$c = 0; $c_min = PHP_INT_MAX;\n\tfor($i=0; $i<$n-3; $i++){\n\t\t$c += min(26-abs($ALPH[$a[$i]] - $ALPH['A']), abs($ALPH[$a[$i]] - $ALPH['A']));\n\t\t$c += min(26-abs($ALPH[$a[$i+1]] - $ALPH['C']),abs($ALPH[$a[$i+1]] - $ALPH['C']));\n\t\t$c += min(26-abs($ALPH[$a[$i+2]] - $ALPH['T']),abs($ALPH[$a[$i+2]] - $ALPH['T']));\n\t\t$c += min(26-abs($ALPH[$a[$i+3]] - $ALPH['G']),abs($ALPH[$a[$i+3]] - $ALPH['G']));\n\t\t\n\t\t//echo $a[$i].$a[$i+1].$a[$i+2].$a[$i+3].\"\\n\";\n\t\t\n\t\tif($c <= $c_min){\n\t\t\t$c_min = $c;\n\t\t}\n\t\t$c = 0;\n\t}\n\t\n\techo $c_min;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "a0877bf7a61c9301b9192767e3d364c3", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26);\n $n = trim(fgets(STDIN));\n $str = str_split(trim(fgets(STDIN)));\n function find($x, $y,$ARR){\n\tif ($x > $y){\n\t $temp=$x;\n\t $x=$y;\n\t $y=$temp;\n\t}\n\t$j = $ARR[$y]-$ARR[$x];\n\tif ($j>13) $j=26-$j;\n\treturn $j;\n }\n $ans = 2e9;\n\tfor ($i = 0; $i < $n-3; $i++)\n\t\t$ans = min($ans, find($str[$i], 'A',$ARR) + find($str[$i+1], 'C',$ARR) + find($str[$i+2], 'T',$ARR) + find($str[$i+3], 'G',$ARR));\n\techo $ans;\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "6ac479a371fff054b9f7773315a57347", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "13)\n\t\t\n\t\t\t$g1=abs(implode(',',array_keys($split,$str1[0]))-26);\n\t\t\t//echo \"$g1\\n\";\n\t\t\n\t\telse\n\t\t\t$g1=implode(',',array_keys($split,$str1[0]));\n\n\t\tif(implode(',',array_keys($split,$str1[1]))>15)\n\t\t\t$g2=abs(implode(',',array_keys($split,$str1[1]))-28);\n\t\telse\n\t\t\n\t\t\t$g2=abs(implode(',',array_keys($split,$str1[1]))-2);\n\t\t\t//echo \"$g2\\n\";\n\t\t\n\n\t\tif(implode(',',array_keys($split,$str1[2]))<6)\n\t\t\t$g3=abs(implode(',',array_keys($split,$str1[2]))+7);\n\t\telse\n\t\t\t$g3=abs(19-implode(',',array_keys($split,$str1[2])));\n\n\t\tif(implode(',',array_keys($split,$str1[3]))>19)\n\t\t\t$g4=abs(32-implode(',',array_keys($split,$str1[3])));\n\t\telse\n\t\t\t$g4=abs(implode(',',array_keys($split,$str1[3]))-6);\n\t\t$count[$i]=$g1+$g2+$g3+$g4;\n\n\n\t\t\t\n\n\n\t\n\t\n}\necho min($count);\n\n", "lang_cluster": "PHP", "tags": ["brute force", "strings"], "code_uid": "c0162d00cb9f2e7a3b3d1f34e2fcdc00", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $k) $photos++;\n\t\t\t}\n\t\t}\t\t\n\t}\n}\n\nprint $photos;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "39699347c7bb0d7a62ef20ff20875bc6", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 2; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 1; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n if($r + $r2 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 3; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 2; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n if($r + $r2 + $r3 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 4; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 3; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n if($r + $r2 + $r3 + $r4 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 5; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 4; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 6; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 5; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 7; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 6; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 8; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 7; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 9; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 8; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $p9 = $e[$n + 8];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 10; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 9; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $p9 = $e[$n + 8];\n $p10 = $e[$n + 9];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n $r10 = array_sum(array_slice($p10, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 + $r10 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 1; $m <= 10; $m++)\n{\n for($n = 0; $n < $b; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $r = array_sum(array_slice($p, $o, $m));\n if($r >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 2; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 1; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n if($r + $r2 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 3; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 2; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n if($r + $r2 + $r3 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 4; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 3; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n if($r + $r2 + $r3 + $r4 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 5; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 4; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 6; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 5; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $p6 = $i[$n + 5];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 7; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 6; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $p6 = $i[$n + 5];\n $p7 = $i[$n + 6];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 8; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 7; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $p6 = $i[$n + 5];\n $p7 = $i[$n + 6];\n $p8 = $i[$n + 7];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 9; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 8; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $p6 = $i[$n + 5];\n $p7 = $i[$n + 6];\n $p8 = $i[$n + 7];\n $p9 = $i[$n + 8];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 10; $m <= 10; $m++)\n{\n for($n = 0; $n < $b - 9; $n++)\n {\n for($o = 0; $o <= $a - $m; $o++)\n {\n $p = $i[$n];\n $p2 = $i[$n + 1];\n $p3 = $i[$n + 2];\n $p4 = $i[$n + 3];\n $p5 = $i[$n + 4];\n $p6 = $i[$n + 5];\n $p7 = $i[$n + 6];\n $p8 = $i[$n + 7];\n $p9 = $i[$n + 8];\n $p10 = $i[$n + 9];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n $r10 = array_sum(array_slice($p10, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 + $r10 >= $d)\n {\n $l += 1;\n }\n }\n }\n}\nfor($m = 1; $m <= 1; $m++)\n{\n for($n = 0; $n < $a; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $r = array_sum(array_slice($p, $o, $m));\n if($r >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 2; $m <= 2; $m++)\n{\n for($n = 0; $n < $a - 1; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n if($r + $r2 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 3; $m <= 3; $m++)\n{\n for($n = 0; $n < $a - 2; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n if($r + $r2 + $r3 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 4; $m <= 4; $m++)\n{\n for($n = 0; $n < $a - 3; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n if($r + $r2 + $r3 + $r4 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 5; $m <= 5; $m++)\n{\n for($n = 0; $n < $a - 4; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 6; $m <= 6; $m++)\n{\n for($n = 0; $n < $a - 5; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 7; $m <= 7; $m++)\n{\n for($n = 0; $n < $a - 6; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 8; $m <= 8; $m++)\n{\n for($n = 0; $n < $a - 7; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 9; $m <= 9; $m++)\n{\n for($n = 0; $n < $a - 8; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $p9 = $e[$n + 8];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nfor($m = 10; $m <= 10; $m++)\n{\n for($n = 0; $n < $a - 9; $n++)\n {\n for($o = 0; $o <= $b - $m; $o++)\n {\n $p = $e[$n];\n $p2 = $e[$n + 1];\n $p3 = $e[$n + 2];\n $p4 = $e[$n + 3];\n $p5 = $e[$n + 4];\n $p6 = $e[$n + 5];\n $p7 = $e[$n + 6];\n $p8 = $e[$n + 7];\n $p9 = $e[$n + 8];\n $p10 = $e[$n + 9];\n $r = array_sum(array_slice($p, $o, $m));\n $r2 = array_sum(array_slice($p2, $o, $m));\n $r3 = array_sum(array_slice($p3, $o, $m));\n $r4 = array_sum(array_slice($p4, $o, $m));\n $r5 = array_sum(array_slice($p5, $o, $m));\n $r6 = array_sum(array_slice($p6, $o, $m));\n $r7 = array_sum(array_slice($p7, $o, $m));\n $r8 = array_sum(array_slice($p8, $o, $m));\n $r9 = array_sum(array_slice($p9, $o, $m));\n $r10 = array_sum(array_slice($p10, $o, $m));\n if($r + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 + $r10 >= $d)\n {\n $l -= 1;\n }\n }\n }\n}\nprint $l;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "13df18aadf8a255549a6de6a26aed0ba", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "57a6cb6e60705348c8307b5dbc3cabcd", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $i--;\n }\n }\n echo $i;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d08fc0bf2761ee308623e09e3de4888b", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "60f047c05fb0bad09f0c95aaeaa25f04", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "ff2b5f5fa977465e76754f40e63fccb1", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "230c477667ed31ca3780e05f0c3982b2", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2750000){\n\t\t$numb[$r]++;\n\t\t//echo $i . ' ' . round(memory_get_usage()/1048576,2).\" megabytes\\n\"; \n\t}\n\t$i++;\n}\n\n$count = 0;\n$min = min($numb);\nforeach( $numb as $val ){\n\t$count += round($val / $min);\n}\necho $count;\nfclose($fp);\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "7125d6a41cbc324a0856dc5d8cd603bc", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "e62e4bbabb4866b746b1eae88354bead", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=1&&$m<=100000) {\n if($a>=0){\n if($b<=1000){\n if($r[0]<=$m&&$r[0]>=0){ */ \n for($t=0;;$t++){\n if($res==1)break;\n if($r[$t]>$m||$r[$t]<0){break;}\n (int)$r[$t+1]=($r[$t]*$a+$b)%$m; \n \n if($t==1000000){\n for($tx=1;$tx<$t;$tx++){\n // echo $r[$t-$tx].' == '.$r[$t].'-----|||';\n if($r[$t-$tx]==$r[$t]){echo ($tx);$res=1;break;}\n if($res==1)break;\n } \n }elseif($t>1000000){echo 1;$res=1;}\n else{\n if($r[$t+1]==$r[$t]){echo 1;$res=1;break;}\n }\n }\n /* }\n }\n }\n}*/\n?>", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "7b17df71f171dbc7166d9b95f694cb71", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " TRUE);\n $last = $r0;\n while (1) {\n $last = ($a * $last + $b) % $m; \n if (isset($l[$last])) {\n $t = count($l) - array_search($last, array_keys($l));\n return $t;\n }\n $l[$last] = TRUE;\n }\n}\n\nlist($a, $b, $m, $r0) = explode(' ', trim(fgets(STDIN)));\nprint (find_t($a, $b, $m, $r0)) . \"\\n\";", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "004ce3beaf57fd01f5daaaaf86362d9b", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "'; print_r($var); echo '';}\n function read_str(){return trim(fgets($GLOBALS['file']));}\n function read_array(){return explode(' ', read_str());}\n /***************************************************************/\n\n list($a, $b, $m, $r0) = read_array();\n \n $i=0;\n $r[$i] = $r0;\n do\n {\n $i++;\n $r[$i] = ($a*($r[$i-1])+$b)%$m;\n \n \n }\n while($i<2*$m); \n $r = array_reverse($r);\n\n function t($arr, $t)\n {\n for($i=0; $i<$t; $i++)\n {\n if($arr[$i] != $arr[$t+$i]) return false;\n }\n return true;\n }\n \n for ($k=1; $k<=$m; $k++)\n { \n if(t($r, $k))\n {\n echo $k;die();\n } \n }\n", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "5d149ef2928f6c3808c7be434496fdeb", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ad58bb5d731d14999bac184b05cf10ab", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4477c17645322d33a7551b0525df4612", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a42347e6758d69064615eefd9f54f967", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1 && $n < 6) {\n $min = 0;\n $max = 2;\n } else if($n == 6) {\n $min = 1;\n $max = 2;\n } else {\n if(fmod($n, 7) == 0) {\n $min = $n/7*2;\n $max = $n/7*2;\n } else if(fmod($n, 7) == 1) {\n $min = ($n - fmod($n, 7))/7*2;\n $max = ($n - fmod($n, 7))/7*2 + 1;\n } else if(fmod($n, 7) == 6) {\n $min = ($n - fmod($n, 7))/7*2 + 1;\n $max = ($n - fmod($n, 7))/7*2 + 2;\n } else {\n $min = ($n - fmod($n, 7))/7*2;\n $max = ($n - fmod($n, 7))/7*2 + 2;\n }\n }\n \n echo $min. ' ' . $max;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "f2b1ca759daa9f74840fd5c116f33e75", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $c -= 1;\n $max += 1;\n if ($c > 0) {\n $c -= 1;\n $max += 1;\n } else {\n break;\n }\n $c -= 5;\n}\n$c = $n;\nwhile ($c > 0) {\n $c -= 5;\n if ($c > 0) {\n $c -= 1;\n $min += 1;\n }\n if ($c > 0) {\n $c -= 1;\n $min += 1;\n } else {\n break;\n }\n}\nprint $min . \" \" . $max;\n?>\n\n", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "bb4f0beb2eea9a7fa4b8bc421e436aae", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "d7df650ec43aa6b3baf8e0151a24bce8", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "890ff3208c72d6df1e8b1adf5d476cd8", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "8572d5eee8b26158dfc8557448aa5a4c", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "binary search"], "code_uid": "a8eb1d20662040240f4dcd0df6827897", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $price) {\n $hooks[] = array(\n 'id' => $index+1,\n 'price' => $price\n );\n}\n\nusort($hooks, function($a, $b) {\n return ($a['price'] < $b['price']) ? -1 : 1;\n});\n\n$rubles = 0;\n$min = min($m, $n);\nfor ($i = 0; $i < $min; $i++) {\n $rubles += $hooks[$i]['price'];\n}\n\nif ($m > $n) {\n $rubles -= ($m-$n)*$d;\n}\n\necho $rubles.\"\\n\";\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0ba2871ae3d2cf3c1fe65889c9a4be95", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2a066bf0512f71d15b1673f4fe22cc8c", "src_uid": "ba6ff507384570152118e2ab322dd11f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1c142e0be62a5b1f0a61a78bc11f6c58", "src_uid": "59f40d9f35e5fe402112214b42b682b5", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "75563f458f2bd636f15820ca7ed748ac", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8f7f1c25b6ee0f2525c8014dc8e3f0fe", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "modify(\"+{$a} minutes\");\n\nprintf(\"%s\", $timea->format('H:i'));\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "80241ef3c8e6bb503b06a2361c766caa", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "58409377c190455747c95e1b89b126ef", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7d63cff70f39aa795ee5fb82917a6381", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b7ef1808db4a1fe99611b53f19a50f26", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $x--)\n{\n $g = 0;\n for($y = 0; $y < count($e); $y++)\n {\n $h = floor($e[$y] / $x);\n $g += $h;\n if($g >= $a)\n {\n $f = max($f, $x);\n break;\n }\n }\n}\nprint $f;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "3eec080ebbed648a11ce90fc14b5e602", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "20d0a2cbf5dce9190b8e1a4c3f0d7101", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "72ee13f22ac3988532ca34eb592a1c22", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y1) != ($j % 2 == 0) ? 1 : 0), $y2);\n\t\t\t\t\t$f[$i + 1][$j + (($y2 > $y1) != ($j % 2 == 1) ? 1 : 0)][$y2] += $f[$i][$j][$y1];\n\t\t\t\t}\n\t\t}\nprint(array_sum($f[$n][2 * $t]).\"\\n\");\n\n?>\n", "lang_cluster": "PHP", "tags": ["dp"], "code_uid": "0e85010680402398392b432142d4b4de", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "1d045d75eee62ec2efb918dcbb390f30", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$rez)\n $rez=$q;\n}\necho $rez;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "c520721bc847ed1e49b1686c98766a7b", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "binary search", "bitmasks"], "code_uid": "fffb9b7271cd21fde3fb9c31a0cf47e9", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d641707761623a899579d34532171a07", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i)\n{ \n $m = $m - $i;\n if ($i == $n)\n {\n $i = 0;\n }\n $i++;\n $k = $m;\n}\necho $k\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "92727ab9213be67530d4a2286ed54259", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "97e586a410a7135adf071192afa95bc5", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "025eff435f075331bc908695a394867e", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f93a3e30556782d40acb24780b26bbe9", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " trim(fgets(STDIN)))\n echo 'NO' . PHP_EOL;\n else echo 'YES' . PHP_EOL;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bf47503b9ff388bbc60700589539e6b0", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $cups + $medals) ? 'YES' : 'NO';\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "af24cb88e339a0de482bf23d0b2241fb", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n)\n echo 'NO' . PHP_EOL;\n else echo 'YES' . PHP_EOL;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "95c1b24daf36eb9ab91eed7408c74201", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ? 1 : 0);\n$q_b = intval($sum_b / 10) + ($sum_b % 10 > 0 ? 1 : 0);\n\nprint ($q_a + $q_b <= $n) ? 'YES' : 'NO'; \n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "93183a3b14d4472711b0a1753b70576d", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "4){\n $t = (9 - $s[$i]);\n $result=$result.$t;\n } else $result.=$s[$i];\n}\n\nif ($result=='0') exit($s);\n\necho $result;", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "b67485164af3dda6ba33483c1df22a76", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $ch) {\n $ch = (int)$ch;\n if ($ch >= 5) {\n if ($i != 0 || $ch != 9) {\n $ch = 9 - $ch;\n }\n }\n $res .= $ch;\n}\n\necho \"$res\\n\";\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "57253af69982f7816f38cdc1414a7649", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "77c0c496bb3490ffd42d26c9ccf72ec3", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$m*9 || $s<1) {echo \"-1 -1\"; exit;}\n$j=$s;\nfor ($i=1; $i<=$m; $i++){\n\t$a[0]++;\n\tif ($i==$m) $a[$i]=$j;\n\telse{\n\t\tif ($j>9){\n\t\t\t$a[$i]=9;\n\t\t\t$j-=9;\n\t\t}\n\t\telse{\n\t\t\t$a[$i]=$j-1;\n\t\t\t$j=1;\n\t\t}\n\t}\n}\nfor ($i=$a[0]; $i>0; $i--) echo $a[$i];\necho \" \";\n$j=$s;\nfor ($i=1; $i<=$m; $i++){\n\t$b[0]++;\n\tif ($j>9){\n\t\t$b[$i]=9;\n\t\t$j-=9;\n\t}\n\telse{\n\t\t$b[$i]=$j;\n\t\t$j=0;\n\t}\n}\nfor ($i=1; $i<=$b[0]; $i++) echo $b[$i];\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp", "implementation"], "code_uid": "146c79512c1cc583b4ee8d8041118b54", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "e95e9ed0e4bd12642f4f648ac59fbc7b", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n $c = array_slice($c, $d);\n if(count($c) == 1)\n {\n print \"WRONG_ANSWER\";\n }\n else\n {\n for($x = 1; $x <= $d; $x++)\n {\n array_splice($c, 1, 0, \"0\");\n }\n if(implode($c) === $b)\n {\n print \"OK\";\n }\n else\n {\n print \"WRONG_ANSWER\";\n }\n }\n}\nelse\n{\n if(implode($c) === $b)\n {\n print \"OK\";\n }\n else\n {\n print \"WRONG_ANSWER\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "12a0d86153d1442a4f5c5594cd1a238f", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n - $a)\n while ($k > $n - $a)\n $k--;\n \necho $k;\n\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "b8f838613374dbc62f6abb57bb35c45d", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$a&&($n-$i)<=$b) $r++;\nprint $r;\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "81789c6a5404be46055f11bf474b31db", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n{\n print $c + 1;\n}\nelseif($d == $c)\n{\n print $c;\n}\nelse\n{\n print $d;\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "fc59d081613e8f44d5e56ed8347f5098", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "582a020985bf964a11e099b719c686ae", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "d02a3566780b613ad3ae572db0acbad3", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "859d8aaf39d66625466b2ad7c2a3c67a", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " log($y) * $x )\n echo '>';\n else if(log($x) * $y < log($y) * $x)\n echo '<';\n else echo '=';\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "baaa21e1614d5df06c9fa23c0059cc18", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d)\n{\n print \">\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "aac67e77fdb85a113d291af8957a868e", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n {\n $g = ($d + $e - $b) + $f;\n if($g >= $c)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n }\n else\n {\n print \"NO\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "e7bef0ca28017b6036b4a4e6d3bb464a", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a || $x + $y > $a + $b || $x + $y + $z > $a + $b + $c) {\n return 1;\n } else {\n return 0;\n }\n}\n\nlist($x, $y, $z) = explode(' ', trim(fgets(STDIN)));\nlist($a, $b, $c) = explode(' ', trim(fgets(STDIN)));\n\n$ans = solve($x, $y, $z, $a, $b, $c);\necho ['YES', 'NO'][$ans];\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "3e00f056ad80f5b90b9bec55a7af958f", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\".$a);\n\t\t\n\t\tif ($a >= $x) {\n\t\t\t$a -= $x;\n\n\t\t\tif ($a + $b >= $y) {\n\t\t\t\tif ($a + $b - $y + $c >= $z) {\n\t\t\t\t\techo (\"YES\");\n\t\t\t\t} else {\n\t\t\t\t\techo (\"NO\");\n\t\t\t\t}\t\n\n\t\t\t} else {\n\t\t\t\techo (\"NO\");\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\techo (\"NO\");\n\t\t}\n\t}\n\n\n\t#$in = fopen(\"input.txt\", \"r\");\n\t$in = STDIN;\n\tfscanf($in, \"%d%d%d\", $x, $y, $z);\n\tfscanf($in, \"%d%d%d\", $a, $b, $c);\n\n\tsolve($x, $y, $z, $a, $b, $c);\n\n\n\n\n\n\tfclose($in);\n##############################################################################\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "c7ce2c9661315728fb1f0ede2a0ea964", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a ||\n ($y > ($a + $b - $x )) ||\n ($z > ($sAll - $x - $y))\n){\n echo 'NO';\n} else{\n echo 'YES';\n}", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "e2eafe6d3b8e1fcdf84eafb57d623566", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$x) {\n\t\t$a-=$x;\n\t\tif($a+$b>=$y) {\n\t\t\tif($a+$b+$c-$y>=$z) {\n\t\t\t\techo \"YES\";\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t}\n\techo \"NO\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "f7a82e5e9ec79ed4f092febe7f9aeea3", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 3 * $c or $a > $b + $c) {\n if ($b + $c > 3 * $c) {\n echo 3 * $c;\n }else echo $b + $c;\n }else echo $a; \n\n}elseif ($x == 3) {\n if ($a + $b > $c and $c < (3 * $a)) {\necho $c; \n}elseif ($b + $a < (3 * $a)) {\n \n echo $a + $b;\n}else echo 3 * $a;\n \n}elseif ($x == 2) {\n if ($b < (2 * $a) and $b < 2 * $c) {\n echo $b;\n }elseif (2 * $c < $x * $a) { echo 2 * $c; }else echo $x * $a ;\n}\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "b9ff01600328e750f809f9b0ebb4b429", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6adbbc46f7478845e45167c722c45e2b", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "fa0d522b5d91318e1720690b682670a2", "src_uid": "6c85175d334f811617e7030e0403f706", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "8a1e7e141117982053425f58c1353746", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "771a99525bf8feb63461dba47839ad66", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "003246f80004fc2495c3130d0b3fbdb9", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "9013b58187d3f4fa1d297bdb96b9f214", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $h)\n {\n break;\n }\n else\n {\n $i = $h % $b[$g];\n if($i == 0)\n {\n $f[count($f)] = $b[$g];\n $h /= $b[$g];\n }\n else\n {\n $g++;\n }\n }\n }\n $j = array();\n $k = 0;\n $l = $e;\n while(TRUE)\n {\n if($b[$k] > $l)\n {\n break;\n }\n else\n {\n $m = $l % $b[$k];\n if($m == 0)\n {\n $j[count($j)] = $b[$k];\n $l /= $b[$k];\n }\n else\n {\n $k++;\n }\n }\n }\n $n = array_intersect($f, $j);\n if(count($n) == 0)\n {\n break;\n }\n else\n {\n $d--;\n $e++;\n }\n}\nprint $d . \" \" . $e;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "7aed201a14ca569659aa02046da36b08", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && $b <> 0) {\n if ($a > $b)\n $a = $a % $b;\n else\n $b = $b % $a;\n }\n return abs($a + $b);\n}\n\n$input = rtrim(fgets(STDIN));\n$raw = explode(' ', $input);\n\n$n = (int)$raw[0];\n\nfor ($i = (int)($n / 2); $i > 0; $i--) {\n $a = $i;\n $b = $n - $i;\n\n if ($a >= $b) {\n continue;\n }\n\n $gcd = gcd($a, $b);\n\n if ($gcd == 1) {\n echo $a . ' ' . $b . PHP_EOL;\n die;\n }\n}", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "0686e3503f30bae418b2ef652ea3e4ad", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $fra){\n echo \"YES\";\n}else{\n echo \"NO\";\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "855df550d0079e7f1cd87d32e01ff172", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $bad ? \"YES\" : \"NO\"); \n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2d67de37be1f908780a25ab0f3426cf8", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "356df44cf0d657adc69b4b60520f3136", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " substr_count($s, 'FS') ? 'YES' : 'NO';", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2cfba154f0f058785aee3e63337a9ae5", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) ? _merge(array_values($a)) : $a;\n}\n\n$n = trim(fgets(STDIN));\n$arr = array_fill(0, $n, 1);\n$o = _merge($arr);\n\nfor($i=0; $i", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "338426113619628c1ddc237a04a62fde", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "373c0fefc68239345fd318abc00ce4c7", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\nfor($x = 0; $x < count($b); $x++)\n{\n $e[$b[$x]]++;\n $e[$c[$x]]++;\n}\n$f = 0;\nfor($x = 1; $x <= 5; $x++)\n{\n if($e[$x] != 0)\n {\n $g = $e[$x] % 2;\n if($g != 0)\n {\n $f = 1;\n break;\n }\n }\n}\nif($f == 1)\n{\n print \"-1\";\n}\nelse\n{\n $h = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\n $i = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\n for($x = 0; $x < count($b); $x++)\n {\n $h[$b[$x]]++;\n }\n for($x = 0; $x < count($c); $x++)\n {\n $i[$c[$x]]++;\n }\n $j = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\n for($x = 1; $x <= 5; $x++)\n {\n $k += (max($h[$x], $i[$x]) - min($h[$x], $i[$x])) / 2;\n }\n print $k / 2;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "82354442f29559e9625c3dd928872ef7", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;}\n\tpublic function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}\n\tpublic function readString() {$d = trim(fgets($this->_fh));return $d;}\n\tpublic function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}\n\tpublic function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}\n}\n\n/* Perform action N times. Can return values in array */\nfunction ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}\n\n/* Integral. Keys preserved. By reference. */\nfunction cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}\n\n/* Difference. Keys preserved. By reference. */\nfunction diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}\n\nfunction bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}\n\nclass PrimeUtils {static protected $divisors = [1 => [1=>true],2 => [1=>true, 2=>true],];static protected $primes = []; \n\tstatic public function primes($limit){$a = str_repeat(chr(85), ($limit>>3) + 1);$a[0] = chr(83);for ($i=3; $i*$i < $limit; $i+=2) {if (ord($a[$i>>3]) & (1<<($i%8))) {;} else {for ($k=$i; $k*$i<$limit; $k++) {$n = $k*$i;$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));}}}yield 2;for ($i=3; $i<$limit; $i+=2) {if (!(ord($a[$i>>3]) & (1<<($i%8)))) {yield $i;}}}\n\tstatic public function divisors($n, $lp = 2) {if (isset(self::$divisors[$n])) {return self::$divisors[$n];}if (empty(self::$primes)) {$primes = [];foreach (self::primes(1e3) as $prime) {$primes[$prime] = $prime;}self::$primes = $primes;}$r = [];foreach (self::$primes as $p) {if ($p>=$lp) {if ($n < $p*$p) {$r = [1=>true, $n=>true];break;} elseif ($n%$p==0) {foreach([1, $p] as $pre) {foreach(self::divisors(intdiv($n,$p), $p) as $nxt=>$v) {$r[$nxt*$pre] = true;}}break;}}}self::$divisors[$n] = $r;return self::$divisors[$n];}\n}\n\n/*****************************************/\n\n$ir = new InputReader();\n\n/* TASK */\n\n$n = $ir->readInt();\n\n$cnt = 0;\nfor ($a = 1; $a<=$n; $a++) {\n\tfor ($b=$a; $b<=$n; $b++) {\n\t\t$c = $a^$b;\n\t\tif ($c>=$b && $c<=$n && ($c+$a)>$b && ($a+$b)>$c && ($b+$c)>$a) {\n\t\t\t//echo \"$a, $b, $c, \" . ($a^$b^$c) . \"\\n\";\n\t\t\t$cnt++;\n\t\t}\n\t}\n}\n\necho $cnt;\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "d719c47d2a36fde82ba581822cc1d187", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0) {\n if ($d1 == $h || $d2 == $h) {\n if ($d1 == $h) {\n $res = $res - $u1 + $h;\n }\n if ($d2 == $h) {\n $res = $res - $u2 + $h;\n }\n if ($res < 0) {\n $res = 0;\n }\n } else {\n $res += $h;\n }\n $h--;\n}\necho $res;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "77b2082c16cee3ce6020b597f7eceb51", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0; $i--){\n $now += $i;\n if($i == $B1)$now -= $A1;\n if($i == $B2)$now -= $A2;\n if($now < 0)$now = 0;\n}\n\necho $now . \"\\n\";\n\nfunction what($x){fprintf(STDERR, $x . \"\\n\");}\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9a0c90629fd7aebf33669b7e1584f92f", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;}\n\tpublic function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}\n\tpublic function readString() {$d = trim(fgets($this->_fh));return $d;}\n\tpublic function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}\n\tpublic function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}\n}\n\n/* Perform action N times. Can return values in array */\nfunction ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}\n\n/* Integral. Keys preserved. By reference. */\nfunction cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}\n\n/* Difference. Keys preserved. By reference. */\nfunction diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}\n\nfunction bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}\n\nclass PrimeUtils {static protected $divisors = [1 => [1=>true],2 => [1=>true, 2=>true],];static protected $primes = []; \n\tstatic public function primes($limit){$a = str_repeat(chr(85), ($limit>>3) + 1);$a[0] = chr(83);for ($i=3; $i*$i < $limit; $i+=2) {if (ord($a[$i>>3]) & (1<<($i%8))) {;} else {for ($k=$i; $k*$i<$limit; $k++) {$n = $k*$i;$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));}}}yield 2;for ($i=3; $i<$limit; $i+=2) {if (!(ord($a[$i>>3]) & (1<<($i%8)))) {yield $i;}}}\n\tstatic public function divisors($n, $lp = 2) {if (isset(self::$divisors[$n])) {return self::$divisors[$n];}if (empty(self::$primes)) {$primes = [];foreach (self::primes(1e3) as $prime) {$primes[$prime] = $prime;}self::$primes = $primes;}$r = [];foreach (self::$primes as $p) {if ($p>=$lp) {if ($n < $p*$p) {$r = [1=>true, $n=>true];break;} elseif ($n%$p==0) {foreach([1, $p] as $pre) {foreach(self::divisors(intdiv($n,$p), $p) as $nxt=>$v) {$r[$nxt*$pre] = true;}}break;}}}self::$divisors[$n] = $r;return self::$divisors[$n];}\n}\n\n/*****************************************/\n\n$ir = new InputReader();\n\n/* TASK */\n\n$n = $ir->readArrayOfInt(2);\n$s1 = $ir->readArrayOfInt(2);\n$s2 = $ir->readArrayOfInt(2);\n\n$v = $n[0];\nfor ($i=$n[1]; $i>=0; $i--) {\n\t$v += $i;\n\tif ($i == $s1[1]) {\n\t\t$v = max(0, $v-$s1[0]);\n\t}\n\tif ($i == $s2[1]) {\n\t\t$v = max(0, $v-$s2[0]);\n\t}\n}\n\necho $v;\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f5487871e56b1bf4322b53b6015f0365", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "7a3bca7194ef5291c1c2a3e8e0d9437b", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "a0d4c72cc157a2874a6df056ff8620f1", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $j)\n {\n $j = $f[$y];\n }\n if($g[$y] > $k)\n {\n $k = $g[$y];\n }\n }\n if(($b[$x] > $h) && ($b[$x] < $j) && ($c[$x] > $i) && ($c[$x] < $k))\n {\n $o = $b[$x];\n $p = $c[$x];\n }\n $n = $h . \" \" . $i . \" \" . $j . \" \" . $k;\n $l[count($l)] = $n;\n $l2[count($l2)] = $b[$x];\n $l3[count($l3)] = $c[$x];\n $m[$n]++;\n}\n$q = array_unique($l);\nif(count($q) == 1)\n{\n print $o . \" \" . $p;\n}\nelse\n{\n for($x = 0; $x < 4 * $a + 1; $x++)\n {\n if($m[$l[$x]] == 1)\n {\n print $l2[$x] . \" \" . $l3[$x];\n break;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "00f461eb33e93207b9e4e1b3d0fbeae9", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 5)\n {\n $g[count($g)] = $j;\n }\n}\nfor($x = 9; $x >= 0; $x--)\n{\n $h = $x;\n $i = 9;\n $j = array();\n while(TRUE)\n {\n if($i == $x)\n {\n $j[count($j)] = $a[$h][$i];\n break;\n }\n else\n {\n $j[count($j)] = $a[$h][$i];\n $h++;\n $i--;\n }\n }\n if(count($j) >= 5)\n {\n $g[count($g)] = $j;\n }\n}\nfor($x = 0; $x < count($g); $x++)\n{\n $d = $g[$x];\n for($y = 0; $y < 6; $y++)\n {\n $e = 0;\n $f = 0;\n for($z = $y; $z < $y + 5; $z++)\n {\n if($d[$z] == \"X\")\n {\n $e++;\n }\n elseif($d[$z] == \".\")\n {\n $f++;\n }\n }\n if(($e == 4) && ($f == 1))\n {\n $c = 1;\n break;\n }\n }\n if($c == 1)\n {\n break;\n }\n}\n$g = array();\nfor($x = 0; $x < 10; $x++)\n{\n $h = $x;\n $i = 9;\n $j = array();\n while(TRUE)\n {\n if($h == 0)\n {\n $j[count($j)] = $a[$h][$i];\n break;\n }\n else\n {\n $j[count($j)] = $a[$h][$i];\n $h--;\n $i--;\n }\n }\n if(count($j) >= 5)\n {\n $g[count($g)] = $j;\n }\n}\nfor($x = 9; $x >= 0; $x--)\n{\n $h = $x;\n $i = 0;\n $j = array();\n while(TRUE)\n {\n if($h == 9)\n {\n $j[count($j)] = $a[$h][$i];\n break;\n }\n else\n {\n $j[count($j)] = $a[$h][$i];\n $h++;\n $i++;\n }\n }\n if(count($j) >= 5)\n {\n $g[count($g)] = $j;\n }\n}\nfor($x = 0; $x < count($g); $x++)\n{\n $d = $g[$x];\n for($y = 0; $y < 6; $y++)\n {\n $e = 0;\n $f = 0;\n for($z = $y; $z < $y + 5; $z++)\n {\n if($d[$z] == \"X\")\n {\n $e++;\n }\n elseif($d[$z] == \".\")\n {\n $f++;\n }\n }\n if(($e == 4) && ($f == 1))\n {\n $c = 1;\n break;\n }\n }\n if($c == 1)\n {\n break;\n }\n}\nif($c == 1)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "ae37a57ae98bf2a5f466bc4bc9186b9e", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "886e2a6f51a898f1f3eb8e6a7f75899a", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "graphs", "shortest paths"], "code_uid": "551d3c18dac87a2133a97fcdefa5c72e", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n $totalcnt += $StreamA[$i] * $b;\n $totalkorobok += $StreamA[$i];\n if ($totalkorobok > $n) {\n $totalcnt = $totalcnt - ($totalkorobok - $n) * $b;\n echo $totalcnt;\n exit();\n }\n}\necho $totalcnt;\n\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "d05a8fd345f81a8a9bf8a5fa69f8a8c1", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$n) break;\n\t$left_space = $n-$taked_box_cnt;\n\t$taked_box = ($left_space<$box_cnt)?$left_space:$box_cnt;\n\t$taked_box_cnt += $taked_box;\n\t$taked_match_cnt += ($taked_box*$match_cnt);\n\n}\necho $taked_match_cnt;\n", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "177588d95fa54b400add6a025f1b02ab", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $y ? $y : $x;\r\n }\r\n public static function getMaxValue($x, $y) {\r\n return $x > $y ? $x : $y;\r\n }\r\n}", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation", "math"], "code_uid": "6fd755684b0d983e510bf207fdda4fbd", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "7e32c070b5d55170724b85d948deb412", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n{\n for($x = 0; $x < $a - 1; $x++)\n {\n for($x2 = $x + 1; $x2 < $a; $x2++)\n {\n $g = $e[$x] + $e[$x2];\n $h = min($e[$x], $e[$x2]);\n $i = max($e[$x], $e[$x2]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n if($a > 2)\n {\n for($x = 0; $x < $a - 2; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 1; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a; $x3++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3];\n $h = min($e[$x], $e[$x2], $e[$x3]);\n $i = max($e[$x], $e[$x2], $e[$x3]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n if($a > 3)\n {\n for($x = 0; $x < $a - 3; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 2; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 1; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a; $x4++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n if($a > 4)\n {\n for($x = 0; $x < $a - 4; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 3; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 2; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 1; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a; $x5++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n if($a > 5)\n {\n for($x = 0; $x < $a - 5; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 4; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 3; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 2; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 1; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a; $x6++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n if($a > 6)\n {\n for($x = 0; $x < $a - 6; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 5; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 4; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 3; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 2; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 1; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a; $x7++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 7)\n {\n for($x = 0; $x < $a - 7; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 6; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 5; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 4; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 3; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 2; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 1; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a; $x8++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 8)\n {\n for($x = 0; $x < $a - 8; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 7; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 6; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 5; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 4; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 3; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 2; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 1; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a; $x9++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 9)\n {\n for($x = 0; $x < $a - 9; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 8; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 7; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 6; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 5; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 4; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 3; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 2; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 1; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a; $x10++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 10)\n {\n for($x = 0; $x < $a - 10; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 9; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 8; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 7; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 6; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 5; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 4; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 3; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 2; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a - 1; $x10++)\n {\n for($x11 = $x10 + 1; $x11 < $a; $x11++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10] + $e[$x11];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 11)\n {\n for($x = 0; $x < $a - 11; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 10; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 9; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 8; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 7; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 6; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 5; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 4; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 3; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a - 2; $x10++)\n {\n for($x11 = $x10 + 1; $x11 < $a - 1; $x11++)\n {\n for($x12 = $x11 + 1; $x12 < $a; $x12++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10] + $e[$x11] + $e[$x12];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 12)\n {\n for($x = 0; $x < $a - 12; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 11; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 10; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 9; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 8; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 7; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 6; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 5; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 4; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a - 3; $x10++)\n {\n for($x11 = $x10 + 1; $x11 < $a - 2; $x11++)\n {\n for($x12 = $x11 + 1; $x12 < $a - 1; $x12++)\n {\n for($x13 = $x12 + 1; $x13 < $a; $x13++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10] + $e[$x11] + $e[$x12] + $e[$x13];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 13)\n {\n for($x = 0; $x < $a - 13; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 12; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 11; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 10; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 9; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 8; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 7; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 6; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 5; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a - 4; $x10++)\n {\n for($x11 = $x10 + 1; $x11 < $a - 3; $x11++)\n {\n for($x12 = $x11 + 1; $x12 < $a - 2; $x12++)\n {\n for($x13 = $x12 + 1; $x13 < $a - 1; $x13++)\n {\n for($x14 = $x13 + 1; $x14 < $a; $x14++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10] + $e[$x11] + $e[$x12] + $e[$x13] + $e[$x14];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13], $e[$x14]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13], $e[$x14]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if($a > 14)\n {\n for($x = 0; $x < $a - 14; $x++)\n {\n for($x2 = $x + 1; $x2 < $a - 13; $x2++)\n {\n for($x3 = $x2 + 1; $x3 < $a - 12; $x3++)\n {\n for($x4 = $x3 + 1; $x4 < $a - 11; $x4++)\n {\n for($x5 = $x4 + 1; $x5 < $a - 10; $x5++)\n {\n for($x6 = $x5 + 1; $x6 < $a - 9; $x6++)\n {\n for($x7 = $x6 + 1; $x7 < $a - 8; $x7++)\n {\n for($x8 = $x7 + 1; $x8 < $a - 7; $x8++)\n {\n for($x9 = $x8 + 1; $x9 < $a - 6; $x9++)\n {\n for($x10 = $x9 + 1; $x10 < $a - 5; $x10++)\n {\n for($x11 = $x10 + 1; $x11 < $a - 4; $x11++)\n {\n for($x12 = $x11 + 1; $x12 < $a - 3; $x12++)\n {\n for($x13 = $x12 + 1; $x13 < $a - 2; $x13++)\n {\n for($x14 = $x13 + 1; $x14 < $a - 1; $x14++)\n {\n for($x15 = $x14 + 1; $x15 < $a; $x15++)\n {\n $g = $e[$x] + $e[$x2] + $e[$x3] + $e[$x4] + $e[$x5] + $e[$x6] + $e[$x7] + $e[$x8] + $e[$x9] + $e[$x10] + $e[$x11] + $e[$x12] + $e[$x13] + $e[$x14] + $e[$x15];\n $h = min($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13], $e[$x14], $e[$x15]);\n $i = max($e[$x], $e[$x2], $e[$x3], $e[$x4], $e[$x5], $e[$x6], $e[$x7], $e[$x8], $e[$x9], $e[$x10], $e[$x11], $e[$x12], $e[$x13], $e[$x14], $e[$x15]);\n $j = $i - $h;\n if(($g >= $b) && ($g <= $c) && ($j >= $d))\n {\n $f++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n print $f;\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n }\n else\n {\n print $f;\n }\n}\nelse\n{\n print $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "bitmasks"], "code_uid": "2563923e1ec4e60532c0f2cf7340b55c", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "987628cd9a33d409ae9b7271476e8134", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n $b -= $c;\n if($d == 1)\n {\n if($b < $a - $c)\n {\n if($b2 < $a - $c)\n {\n $g = 1;\n }\n elseif($b2 > $a - $c)\n {\n $h++;\n }\n break;\n }\n }\n }\n elseif($b == $c)\n {\n $b = $b2;\n if($d == 1)\n {\n if($b < $a - $c)\n {\n $g = 1;\n break;\n }\n }\n $h++;\n }\n elseif($b < $c)\n {\n $g = 1;\n break;\n }\n }\n else\n {\n $j = $i % 2;\n $i++;\n if($j == 0)\n {\n if($x == $d + 1)\n {\n if($f / 2 > $b)\n {\n $b = $b2;\n $h++;\n }\n break;\n }\n else\n {\n if($f > $b)\n {\n $b = $b2;\n if($b < $f)\n {\n $g = 1;\n break;\n }\n $h++;\n }\n $b -= $f;\n }\n }\n else\n {\n if($x == $d + 1)\n {\n if($e / 2 > $b)\n {\n $b = $b2;\n $h++;\n }\n break;\n }\n else\n {\n if($e > $b)\n {\n $b = $b2;\n if($b < $e)\n {\n $g = 1;\n break;\n }\n $h++;\n }\n $b -= $e;\n }\n }\n }\n}\nif($g == 0)\n{\n print $h;\n}\nelse\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "ac105b1482be97a8dfa00b022b947283", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1){\n if($x[0] > 1){\n if($x[1] == 9){\n $last9StreakPosition = findLast9StreakPosition($x);\n $xMax .= $x[0];\n $xMax .= str_repeat('9', $last9StreakPosition);\n\n $xMaxLen = strlen($xMax);\n if($xLen > $xMaxLen){\n $xMax[$last9StreakPosition] = $xMax[$last9StreakPosition] - 1;\n $xMax .= str_repeat('9', $xLen - $xMaxLen);\n }\n }else{\n $xMax = $x[0] - 1;\n $xMax .= str_repeat('9', $xLen - 1);\n }\n\n $xMaxSum = array_sum(str_split($xMax));\n $xSum = array_sum(str_split($x));\n\n if($xMaxSum > $xSum){\n $xResult = $xMax;\n }\n }else{\n if($x[1] > 0){\n if($x[1] < 8){\n $xMax = $x[0] - 1;\n $xMax .= str_repeat('9', $xLen - 1);\n $xMax = (string)intval($xMax);\n }\n else{\n if($x[1] == 9){\n $last9StreakPosition = findLast9StreakPosition($x);\n $xMax .= $x[0];\n $xMax .= str_repeat('9', $last9StreakPosition);\n\n $xMaxLen = strlen($xMax);\n if($xLen > $xMaxLen){\n $xMax[$last9StreakPosition] = $xMax[$last9StreakPosition] - 1;\n $xMax .= str_repeat('9', $xLen - $xMaxLen);\n }\n }else{\n $xMax = $x[0] - 1;\n $xMax .= str_repeat('9', $xLen - 1);\n $xMax = (string)intval($xMax);\n }\n }\n\n $xMaxSum = array_sum(str_split($xMax));\n $xSum = array_sum(str_split($x));\n\n if($xMaxSum > $xSum){\n $xResult = $xMax;\n }\n }else{\n $xMax .= str_repeat('9', $xLen - 1);\n\n $xMaxSum = array_sum(str_split($xMax));\n $xSum = array_sum(str_split($x));\n\n if($xMaxSum > $xSum){\n $xResult = $xMax;\n }\n }\n }\n}\n\necho $xResult.PHP_EOL;\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "439ce4618b95dbe470b8d88b10bed60d", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c)\n {\n print implode($d);\n }\n else\n {\n print implode($b);\n }\n}\nelseif(strlen($a) > 2)\n{\n $b = str_split($a);\n $c = array_sum($b);\n $d[0] = $b[0] - 1;\n for($x = 1; $x < strlen($a); $x++)\n {\n $d[$x] = 9;\n }\n \n $e = array_sum($d);\n if($e > $c)\n {\n $f = $d;\n $f[0]++;\n $f[1]--;\n if(implode($f) < $a)\n {\n for($x = 1; $x < strlen($a) - 1; $x++)\n {\n $g = $f[$x];\n $h = $f[$x + 1];\n $f[$x] = $h;\n $f[$x + 1] = $g;\n if(implode($f) >= $a)\n {\n $f[$x] = $g;\n $f[$x + 1] = $h;\n if($f[0] == 0)\n {\n $f = array_slice($f, 1);\n }\n print implode($f);\n break;\n }\n }\n }\n else\n {\n if($d[0] == 0)\n {\n $d = array_slice($d, 1);\n }\n print implode($d);\n }\n }\n else\n {\n if($b[0] == 0)\n {\n $b = array_slice($b, 1);\n }\n print implode($b);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "eb69f56b22ce6f8bc8bc559c0b00dab2", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "34f1002e1284ebe349b50707567e8fcb", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1, 2 => 2);\n$c = 2;\nfor($x = 3; $x <= 100; $x++)\n{\n $b[$x] = $b[$x - 1] + $c;\n $b[$x + 1] = $b[$x] + $c;\n $c++;\n $x++;\n}\nprint $b[$a];\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "e5acf907914de7b336aba103430befff", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $point[3][1]) && ($point[4][0] == $point[3][0]);\n\n$h3 = ($point[5][1] < $point[6][1] && $point[6][1] < $point[7][1]) && ($point[5][0] == $point[6][0] && $point[6][0] == $point[7][0]);\n\n$horizon = $h1 && $h2 && $h3;\n\n$v1 = ($point[0][0] < $point[3][0] && $point[3][0] < $point[5][0]) && ($point[0][1] == $point[3][1] && $point[3][1] == $point[5][1]);\n\n$v2 = ($point[6][0] > $point[1][0]) && ($point[6][1] == $point[1][1]);\n\n$v3 = ($point[2][0] < $point[4][0] && $point[4][0] < $point[7][0]) && ($point[2][1] == $point[4][1] && $point[4][1] == $point[7][1]);\n\n$vertical = $v1 && $v2 && $v3;\n\nif ($horizon && $vertical) {\n echo 'respectable';\n} else {\n echo 'ugly';\n}\n\nfunction cmpPoint($x, $y)\n{\n if ($x[0] == $y[0]) {\n if ($x[1] == $y[1]) {\n return 0;\n }\n return ($x[1] < $y[1]) ? -1 : 1;\n } elseif ($x[0] < $y[0]) {\n return -1;\n } else {\n return 1;\n }\n}", "lang_cluster": "PHP", "tags": ["sortings"], "code_uid": "ba43781ab72f03e9338644b209913e3f", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i * 2 && $c >= $i * 4) {\n $max = max($max, $i * 7);\n }\n }\n echo $max.\"\\n\";\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d3b7880e61bef3e6341bd087eb9c4a88", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n if($b > 1)\n {\n if($c > 3)\n {\n $a -= 1;\n $b -= 2;\n $c -= 4;\n $d += 7;\n }\n else\n {\n break;\n }\n }\n else\n {\n break;\n }\n }\n else\n {\n break;\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2fa30762772bb55cb88a88f3e2f226f8", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $d)\n{\n $g = $a - $d;\n $h = floor($g / 2);\n if($b >= $e)\n {\n $i = $b - $e;\n $j = floor($i / 2);\n if($c >= $f)\n {\n print \"Yes\";\n }\n else\n {\n if(($h + $j + $c) >= $f)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n }\n else\n {\n if($c >= $f)\n {\n $k = $c - $f;\n $l = floor($k / 2);\n if(($h + $l + $b) >= $e)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n if(($h + $b) >= $e)\n {\n $o = ($h + $b) - $e;\n if(($o + $c) >= $f)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n print \"No\";\n }\n }\n }\n}\nelse\n{\n if($b >= $e)\n {\n $i = $b - $e;\n $j = floor($i / 2);\n if($c >= $f)\n {\n $m = $c - $f;\n $n = floor($m / 2);\n if(($a + $j + $n) >= $d)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n if(($a + $j) >= $d)\n {\n $p = ($a + $j) - $d;\n if(($p + $c) >= $f)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n print \"No\";\n }\n }\n }\n else\n {\n if($c >= $f)\n {\n $m = $c - $f;\n $n = floor($m / 2);\n if(($a + $n) >= $d)\n {\n $p = ($a + $n) - $d;\n if(($p + $b) >= $e)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n print \"No\";\n }\n }\n else\n {\n print \"No\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e54abb64341f2a1a387b79a6b0aa8774", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) return ($a-$b-($a-$b)%2)/2;\n else \n return $a-$b;\n }\n\n fscanf(STDIN, \"%d%d%d\", $a, $b, $c);\n fscanf(STDIN, \"%d%d%d\", $x, $y, $z);\n //echo $a, $b, $c;\n //echo $x, $y, $z;\n $ans = 0;\n $ans = $ans + gao($a, $x);// echo $ans , \"\\n\";\n $ans += gao($b, $y);// echo $ans , '\\n';\n $ans += gao($c, $z);// echo $ans , '\\n';\n echo $ans >= 0 ? \"Yes\" : \"No\";\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "28f9a1ff4fb7a1a072bf0034526b1c15", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a / 2)\n {\n $e = $b[$x] + $e;\n }\n}\nif(($c > 0) || ($d != $e))\n{\n print(\"NO\");\n}\nelse\n{\n print(\"YES\");\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3977d2a495d99c9c16738927bdc7092d", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1132eb7fcf6ef3fab831d54e8c4e4375", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\t$inp_N = $Scanner->Scan();\n\t$nums = str_split($inp_N);\n\n\t$LUCY = true;\n\tfor ($i = 0; $i < $inp_LEN; $i++) {\n\t\tif ($nums[$i] !== '4' && $nums[$i] !== '7') {\n\t\t\t$LUCY = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tfor ($i = 0; $i < $inp_LEN; $i++) {\n\t\tif ($i < $inp_LEN / 2) $first_sum += $nums[$i];\n\t\telseif ($i >= $inp_LEN / 2) $second_sum += $nums[$i];\n\t}\n\tif ($first_sum !== $second_sum) $LUCY = false;\n\n\tif ($LUCY) print(\"YES\");\n\telseif (!$LUCY) print(\"NO\");\n\n\t$Scanner->close();\n}\n\nob_end_clean();\nsolve();\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\nclass Scanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $Id = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link or ''php://stdin' err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\n\t\t//err $c_row = array(\"\\n\", \"\\r\", \"\\r\\n\");\n\t\t$c_row = array(\"\\r\\n\", \"\\r\", \"\\n\");\n\t\t$contents = str_replace($c_row, \" \", $contents);\n\t\t$this->Scanners = explode(\" \", $contents);\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Id;\n\t\t$sc = $this->Scanners[$x];\n\t\t$this->Id = ++$x;\n\t\treturn $sc;\n\t}\n\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\n/*\n====begin=====\n\n//input $inp_ or upper\n//block $temp_\n//two block$ttemp_\n//as \t $as_\n//instance $(Upper)\n//ref $ref\n//class menba $^Upper\n\n====end=======\n\n===== class begin =====\n\n//error_reporting(0);\n//$Scanner = new Scanner(\"php://stdin\");\n//ref \"#109_div2_B_1230942 laurenceHR\"\nclass LineScanner{\n\tprivate $Stream;\n\tprivate $Scanners = array();\n\tprivate $LineIds_Of_ScanIds= array();\n\tprivate $LinesScanners = array();\n\tprivate $LastScanIds_Of_LineIds = array();\n\tprivate $Scan_number = 0;\n\tprivate $Scanline_number = 0;\n\t\n\tpublic function __construct($opend){\n\t\tif((!is_file($opend) && !is_link($opend)) && $opend !== \"php://stdin\"){\n \t\t\tprint(\"file or link err\");\n \t\t\texit;\n\t\t}\n\t\t\n\t\t$this->Stream = fopen($opend, 'r');\n\t\t$contents = stream_get_contents($this->Stream);\n\t\t\n\t\t$temp_lines = explode(\"\\n\", $contents);\n\t\t$temp_linescanners = array();\n\t\t$temp_x = 0;\n\t\t$temp_y = 0;\n\t\t//--attention for initting of array--(these is not needed but for easily reading)//\n\t\t$ttemp_scanners = array();\n\t\t//$del = Array(\"\\n\",\"\\r\",\"\\n\\r\");\n\t\tforeach ($temp_lines as $as_line) {\n\t\t\tif (strlen($as_line) === 0) {\n\t\t\t\tprint(\"input err\");\n\t\t\t}\n\t\t\t\n\t\t\t//$as_line = str_replace($del,'',$as_line);\n\t\t\t$temp_linescanners[] = $as_line;\n\t\t\t$ttemp_line_scanners = explode(\" \", $as_line);\n\t\t\t//$ttemp_scanners = array();\n\t\t\tforeach ($ttemp_line_scanners as $as_sc) {\n\t\t\t\t$ttemp_scanners[] = $as_sc;\n\t\t\t\t$this->LineIds_Of_ScanIds[$temp_x] = $temp_y;\n\t\t\t\t$temp_x++;\n\t\t\t}\n\t\t\t$this->LastScanIds_Of_LineIds[$temp_y] = $temp_x - 1;\n\t\t\t$temp_y++;\n\t\t}\n\t\t$this->Scanners = $ttemp_scanners;\n\t\t$this->LinesScanners = $temp_linescanners;\n\t}\n\t\n\tfunction Scan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"scan err\");\n\t\t}\n\t\t\t\t\n\t\t$sc = $this->Scanners[$x];\n\t\t//--attention for ++$x//\n\t\t//$this->Scan_number = $x++;\n\t\t$this->Scan_number = ++$x;\n\t\t$this->Scanline_number = $this->LineIds_Of_ScanIds[$x];\n\t\treturn $sc;\n\t}\n\t\n\tfunction LineScan(){\n\t\t$x = $this->Scan_number;\n\t\t$y = $this->Scanline_number;\n\t\tif ($this->LineIds_Of_ScanIds[$x] === false || $this->LastScanIds_Of_LineIds[$y] === false) {\n\t\t\tprint(\"linescan err\");\n\t\t}\n\t\t\n\t\t$lsc = $this->LinesScanners[$y];\n\t\t$this->Scan_number = $this->LastScanIds_Of_LineIds[$y] + 1;\n\t\t$this->Scanline_number = $y + 1;\n\t\treturn $lsc;\n\t}\n\t\n\tfunction close(){\n\t\tfclose($this->Stream);\n\t}\n}\n\nclass Token{\n\tprivate $token;\n\tprivate $tok;\n\t\n\tpublic function __construct($str_line, $tok) {\n\t\t$this->tok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t$this->token = strtok($this->tok);\n\t\treturn $thisToken;\n\t} \n\t\t\n\tpublic function nextFloat() {\n\t\treturn (float)$this->nextToken();\n\t}\n\t\n \tpublic function nextInt() {\n\t\treturn (int)$this->nextToken();\n\t}\n\t\n\tpublic function nextIntArray() {\n\t\t$temp_arr = array();\n\t\t$flag = -1;\n\t\twhile ($flag !== 1) {\n\t\t\t$thisToken = $this->nextToken();\n\t\t\tif ($thisToken !== false) {\n\t\t\t\t$temp_arr[] = $thisToken;\n\t\t\t} else {\n\t\t\t\t$flag = 1;\n\t\t\t}\n\t\t}\n\t\treturn $temp_arr;\n\t}\n\n\tpublic function nnextIntArray($num) {\n\t\t$temp_arr = array();\n\t\tfor ($i = 0; $i < $num; $i++) {\n\t\t\t$temp_arr[] = (int)$this->token;\n\t\t}\n\t\treturn $temp_arr;\n\t}\n}\n===== class end ======\n\n=== function begin ===\n\nfunction get_line() {\n $stdin = fopen(\"php://stdin\", \"r\"); \n $line = rtrim($stdin, \"\\n\"); \n fclose($stdin); \n return $line; \n}\n\nfunction num_printf($i){\n\tif (is_float($i)) {\n\t\tprintf(\"%.0f\", $i);\n\t}\n\tif (is_int($i)) {\n\t\tprintf(\"%d\", $i);\n\t}\n}\n\nfunction array_printf(array $array) {\n\t\t$message = \"\";\n\t\tforeach ($array as $value) {\n\t\t\t$message .= \"$value\" . \" \";\n\t\t}\n\t\t$message = rtrim($message);\n\t\tprintf('%s', $message);\n}\n\n== function end ======\n*/\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c1d621fca8fc79cec28454574de32c25", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $e))\n {\n print \"-1\";\n }\n else\n {\n print \"1\";\n }\n}\nelseif($c > $a)\n{\n $e = floor($c / $a);\n $f = $e % 2;\n $g = ceil($e / 2);\n $h = $e + $g;\n $i = $a / 2;\n $j = ($e / 2) * 3;\n if($f == 0)\n {\n if(($b <= (0 - $a)) || ($b >= $a) || ($b == 0))\n {\n print \"-1\";\n }\n else\n {\n \n if(($b > (0 - $a)) && ($b < 0))\n {\n print $j;\n }\n elseif(($b > 0) && ($b < $a))\n {\n print $j + 1;\n }\n }\n }\n else\n {\n if(($b <= (0 - $i)) || ($b >= $i))\n {\n print \"-1\";\n }\n else\n {\n print $h;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "e8ff1ff89cda2195e67e7f589cfa512e", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["geometry", "implementation"], "code_uid": "b9713dce39590481996122bfef7aba36", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\nfunction readNumArray($f) {\n\treturn readStringExplodeNum($f, ' ', true);\n}\n\nfunction readArray($f) {\n\treturn readStringExplodeNum($f, ' ');\n}\n\nfunction readTrimString($f) {\n\treturn trim(readString($f));\n}\n\n###### /IO ######\n# for($i=0;$i<$n;$i++)\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\t$first = readString($f);\n\t$second = readString($f);\n\t\n\t$dayCount = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);\n\t$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');\n\t$firstIndex = array_search($first, $days);\n\tfor ($m = 0; $m < 11; $m++) {\n\t\t$diff = $dayCount[$m] % 7;\n\t\t$next = ($firstIndex + $diff) % 7;\n\t\tif ($second == $days[$next]) {\n\t\t\techo 'YES';\n\t\t\treturn;\n\t\t}\n\t}\n\techo 'NO';\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1882e01bae7a5ed32699e66d0deaccc4", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 4)\n{\n $c = $b[0];\n $d = $b[1];\n $e = $b[$a - 2];\n $f = $b[$a - 1];\n unset($b[0]);\n unset($b[1]);\n unset($b[$a - 2]);\n unset($b[$a - 1]);\n print $f . \" \" . $d . \" \" . implode(\" \", $b) . \" \" . $e . \" \" . $c;\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "constructive algorithms", "implementation"], "code_uid": "d17f88a8e44493b239d1522bbb086676", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f[count($f) - 1])\n {\n break;\n }\n else\n {\n $i[count($i)] = $h;\n }\n}\n$k = array_merge($f, $i);\nsort($k);\n$l = 0;\n$m = 0;\nfor($x = 0; $x < count($k); $x++)\n{\n $m += $c;\n if(($m >= $a) && ($x != (count($k) - 1)))\n {\n $l = 1;\n break;\n }\n}\nif($l == 0)\n{\n print \"NO\";\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6a8043c233ef441ce90dcfecebea4c6a", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "f0362dcfbac082d838fefa6f92b01f40", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "brute force"], "code_uid": "8c445271211135cb748f38cb70fb2cef", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$s1)\n {\n $range=min($v,min($j,$c));\n $left=min($v,min($j,$c))*$s2;\n $right=min(($j-$range),$t)*$s1;\n echo $left+$right;\n }else\n {\n $range=min($j,$t);\n $left=$range*$s1;\n $right=min(($j-$range),min($v,min($j,$c)))*$s2;\n echo $left+$right;\n }\n\n\n\n}\n\n\nsolve();\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "brute force"], "code_uid": "9dfd1db014c1f13f8f64b5123736465d", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "($n/2)-1; $i--){\n\t\t\t$rev .= $s[$i].$s[$n-$i-1];\n\t\t}\n\t\techo strrev($rev);\n\t}else{\n\t\tfor($i = 0; $i<($n/2); $i++){\n\t\t\t$rev .= $s[$i].$s[$n-$i-1];\n\t\t}\n\t\techo substr(strrev($rev), 1);\n\t}", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "92b5770dda29972f686bfac57c970e4b", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n fwrite($stdout, \"LEFT\"); \n}\nelse if ($a < 0)\n{\n fwrite($stdout, \"RIGHT\");\n}\nelse\n{\n fwrite($stdout, \"TOWARDS\"); \n}", "lang_cluster": "PHP", "tags": ["geometry"], "code_uid": "1931d512e9952192c8bd28f808ab5fea", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 500)\n {\n break;\n }\n}\n$d = array_search($a, $b);\nif($d == TRUE)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "c1601686b0bd65c3bef8de850d81b96e", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $input) {\n echo \"NO\";exit();\n }\n}\n\n", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "bea4b0838935ad409f00e9a177fbcf81", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "math", "brute force"], "code_uid": "c8c039411158c7117eeec43039240fb9", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$b) return 0;\n\tif($b==$a) return $b;\n\tif($b%2==0) return findtt($a,$b/2,$out);\n\tif(strrpos($b,'1')==(strlen($b)-1)&&$b!=1) return findtt($a,(($b-1)/10),$out);\n}\nif(findtt($a,$b,$out)) echo(\"YES\\n\"); else exit(\"NO\\n\");\necho count($out).\"\\n\".implode(' ',array_reverse($out)).\"\\n\";", "lang_cluster": "PHP", "tags": ["dfs and similar", "math", "brute force"], "code_uid": "537438602d119fcf99fd22683e69aac7", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n {\n rsort($c);\n $j = 0;\n for($y = 0; $y < count($c); $y++)\n {\n if($c[$y] < $e[$x])\n {\n $j = 1;\n break;\n }\n }\n if($j == 0)\n {\n $c[count($c)] = $e[$x];\n array_splice($e, $x, 1);\n }\n else\n {\n $c[count($c)] = $e[$x];\n array_splice($e, $x, 1);\n $e[count($e)] = $c[$y];\n array_splice($c, $y, 1);\n break;\n }\n }\n rsort($c);\n $i = array_merge($e, $c);\n print implode($i);\n }\n else\n {\n rsort($c);\n $i = array_merge($e, $c);\n print implode($i);\n }\n }\n else\n {\n print implode($e);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "17810d700c0c7c216796186040646d41", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a270a1b95ac369c2c635ac774d294f25", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0a6d17ffe41cb751788674d6e937ca7e", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "145d7028cfa1ec0e053b0f0dc40856fc", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t/* begin body */\n\t$n = readNum($f);\n\t$str = '';\n\tfor ($i = 1; $i <= 1001; $i++) {\n\t\t$str.=$i;\n\t}\n\techo $str[$n-1];\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8b8cf33473ddf3db5be137601181ec67", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "dac7c795c95f23cb2f829988687a44d6", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a9081fb474e57d396d8b7e70c11fc0f8", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "501da963daa59555bdadddacaae2fa71", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "f5fa28cb2205df618f36706f10bc2327", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $m)\n{\n print $i - $m;\n}\nelse\n{\n print $m - $i;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6cf61b63ea29569deaf9a1c2861c66b4", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "c07cd2ece686b4916c7bf07c76f46210", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["combinatorics"], "code_uid": "881a0ecc1a42a0c44ca258e9c797feb2", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "023acad6cac8a79a1d5cfa87ad387174", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e9c1c3ae6d15a47f64b33af0c0559067", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1000000000) {\n die('n must be <1000000000');\n}\n\n$n = array_reverse(array_map('intval', str_split($n)));\n\nforeach ($n as $srb) {\n echo soroban09($srb) . \"\\n\";\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7c7569b46a8de0850841c1bb810e5fe3", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0)\n {\n $c2--;\n $g++;\n if($a2 == 0)\n {\n break;\n }\n }\n else\n {\n $e2 += $c;\n break;\n }\n }\n $b2 = $b;\n for($x = 1; $x <= $b; $x++)\n {\n $e2 -= $d;\n if($e2 >= 0)\n {\n $b2--;\n $g++;\n if($b2 == 0)\n {\n break;\n }\n }\n else\n {\n $e2 += $d;\n break;\n }\n }\n print $g;\n}\nelse\n{\n $b2 = $b;\n $e2 = $e;\n $g = 0;\n for($x = 1; $x <= $b; $x++)\n {\n $e2 -= $d;\n if($e2 >= 0)\n {\n $b2--;\n $g++;\n if($b2 == 0)\n {\n break;\n }\n }\n else\n {\n $e2 += $d;\n break;\n }\n }\n $a2 = $a;\n for($x = 1; $x <= $a; $x++)\n {\n $e2 -= $c;\n if($e2 >= 0)\n {\n $c2--;\n $g++;\n if($a2 == 0)\n {\n break;\n }\n }\n else\n {\n $e2 += $c;\n break;\n }\n }\n print $g;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "75efa902add78a4232cf9328167b6d60", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\")\n{\n $k = $i[0] > $i[2];\n}\nelse\n{\n $k = $i[0] < $i[2];\n}\nif($i[4] == \">\")\n{\n $l = $i[3] > $i[5];\n}\nelse\n{\n $l = $i[3] < $i[5];\n}\nif($i[7] == \">\")\n{\n $m = $i[6] > $i[8];\n}\nelse\n{\n $m = $i[6] < $i[8];\n}\nif(($k) && ($l) && ($m))\n{\n print \"ABC\"; //////////////////////////////////////////////////\n}\nelse\n{\n for($x = 1; $x <= 3; $x++)\n {\n $f = array_search(\"A\", $e1);\n $g = array_search(\"B\", $e1);\n $h = array_search(\"C\", $e1);\n if($f == TRUE)\n {\n $e1[$f] = 2;\n }\n if($g == TRUE)\n {\n $e1[$g] = 3;\n }\n if($h == TRUE)\n {\n $e1[$h] = 1;\n } \n }\n $i = implode($e1);\n if($i[1] == \">\")\n {\n $k = $i[0] > $i[2];\n }\n else\n {\n $k = $i[0] < $i[2];\n }\n if($i[4] == \">\")\n {\n $l = $i[3] > $i[5];\n }\n else\n {\n $l = $i[3] < $i[5];\n }\n if($i[7] == \">\")\n {\n $m = $i[6] > $i[8];\n }\n else\n {\n $m = $i[6] < $i[8];\n }\n if(($k) && ($l) && ($m))\n {\n print \"CAB\"; //////////////////////////////////////////////////\n }\n else\n {\n for($x = 1; $x <= 3; $x++)\n {\n $f = array_search(\"A\", $e2);\n $g = array_search(\"B\", $e2);\n $h = array_search(\"C\", $e2);\n if($f == TRUE)\n {\n $e2[$f] = 3;\n }\n if($g == TRUE)\n {\n $e2[$g] = 1;\n }\n if($h == TRUE)\n {\n $e2[$h] = 2;\n } \n }\n $i = implode($e2);\n if($i[1] == \">\")\n {\n $k = $i[0] > $i[2];\n }\n else\n {\n $k = $i[0] < $i[2];\n }\n if($i[4] == \">\")\n {\n $l = $i[3] > $i[5];\n }\n else\n {\n $l = $i[3] < $i[5];\n }\n if($i[7] == \">\")\n {\n $m = $i[6] > $i[8];\n }\n else\n {\n $m = $i[6] < $i[8];\n }\n if(($k) && ($l) && ($m))\n {\n print \"BCA\"; //////////////////////////////////////////////////\n }\n else\n {\n for($x = 1; $x <= 3; $x++)\n {\n $f = array_search(\"A\", $e3);\n $g = array_search(\"B\", $e3);\n $h = array_search(\"C\", $e3);\n if($f == TRUE)\n {\n $e3[$f] = 3;\n }\n if($g == TRUE)\n {\n $e3[$g] = 2;\n }\n if($h == TRUE)\n {\n $e3[$h] = 1;\n } \n }\n $i = implode($e3);\n if($i[1] == \">\")\n {\n $k = $i[0] > $i[2];\n }\n else\n {\n $k = $i[0] < $i[2];\n }\n if($i[4] == \">\")\n {\n $l = $i[3] > $i[5];\n }\n else\n {\n $l = $i[3] < $i[5];\n }\n if($i[7] == \">\")\n {\n $m = $i[6] > $i[8];\n }\n else\n {\n $m = $i[6] < $i[8];\n }\n if(($k) && ($l) && ($m))\n {\n print \"CBA\"; //////////////////////////////////////////////////\n }\n else\n {\n for($x = 1; $x <= 3; $x++)\n {\n $f = array_search(\"A\", $e4);\n $g = array_search(\"B\", $e4);\n $h = array_search(\"C\", $e4);\n if($f == TRUE)\n {\n $e4[$f] = 1;\n }\n if($g == TRUE)\n {\n $e4[$g] = 3;\n }\n if($h == TRUE)\n {\n $e4[$h] = 2;\n } \n }\n $i = implode($e4);\n if($i[1] == \">\")\n {\n $k = $i[0] > $i[2];\n }\n else\n {\n $k = $i[0] < $i[2];\n }\n if($i[4] == \">\")\n {\n $l = $i[3] > $i[5];\n }\n else\n {\n $l = $i[3] < $i[5];\n }\n if($i[7] == \">\")\n {\n $m = $i[6] > $i[8];\n }\n else\n {\n $m = $i[6] < $i[8];\n }\n if(($k) && ($l) && ($m))\n {\n print \"ACB\"; //////////////////////////////////////////////\n }\n else\n {\n for($x = 1; $x <= 3; $x++)\n {\n $f = array_search(\"A\", $e5);\n $g = array_search(\"B\", $e5);\n $h = array_search(\"C\", $e5);\n if($f == TRUE)\n {\n $e5[$f] = 2;\n }\n if($g == TRUE)\n {\n $e5[$g] = 1;\n }\n if($h == TRUE)\n {\n $e5[$h] = 3;\n } \n }\n $i = implode($e5);\n if($i[1] == \">\")\n {\n $k = $i[0] > $i[2];\n }\n else\n {\n $k = $i[0] < $i[2];\n }\n if($i[4] == \">\")\n {\n $l = $i[3] > $i[5];\n }\n else\n {\n $l = $i[3] < $i[5];\n }\n if($i[7] == \">\")\n {\n $m = $i[6] > $i[8];\n }\n else\n {\n $m = $i[6] < $i[8];\n }\n if(($k) && ($l) && ($m))\n {\n print \"BAC\"; ///////////////////////////////////////\n }\n else\n {\n print \"Impossible\";\n }\n }\n }\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7ee365fa67770c0783904974268fcd79", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= min($c[$x], $i[$x])) && ($a <= max($c[$x], $i[$x])) && ($b >= min($f[$x], $l[$x])) && ($b <= max($f[$x], $l[$x])))\n {\n break;\n }\n}\nprint $x;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry", "implementation"], "code_uid": "4c6f66d37fe47e61c92136e0a9d5d85e", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && $x<$y && $x>=-$y)\n {\n $k=($y-1)*4 + 2;\n }\n else if ($y<0 && $x>$y && $x<=(-$y+1))\n {\n $k=(-$y)*4;\n }\n else if ($x<0 && $y>=$x && $y<-$x)\n {\n $k=(-$x)*4 -1;\n }\n else\n {\n $k=($x-1)*4 + 1;\n }\n echo $k;\n \n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "geometry", "implementation"], "code_uid": "ae195347e32d8c5e64572b8a996e6e34", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=abs($x))\n{\n if ($y>0)\n $result = 2+(abs($y)-1)*4 - 1 + (($x == abs($y))?0:1);\n else\n $result = 4+(abs($y)-1)*4 - 1 + ($x==-abs($y)&&$x!=0?0:1);\n} else\n{\n if ($x>0)\n $result = 1+(abs($x)-1)*4 - 1 + ($y==-(abs($x)-1)||$y==abs($x)||$y==0&&$x==1?0:1);\n else\n $result = 3+(abs($x)-1)*4 - 1 + (($y == abs($x))?0:1);\n \n}\n\n//output\n$stdout = fopen('php://stdout', 'w');\nfputs ($stdout, $result);\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "geometry", "implementation"], "code_uid": "28c419e755dcb51f399e258ed20e6f47", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31);\n$m_2 = array(1 => 31, 2 => 29, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31);\n$n = 0;\nif($c % 4 == 1)\n{\n if($g[1] <= 12)\n {\n if($g[0] <= $m[intval($g[1])])\n {\n if(($g[0] == 29) && ($g[1] == 2) && ($g[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($g[0] == 29) && ($g[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $g[0];\n $p = $g[1];\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($h[1] <= 12)\n {\n if($h[0] <= $m[intval($h[1])])\n {\n if(($h[0] == 29) && ($h[1] == 2) && ($h[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($h[0] == 29) && ($h[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $h[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $h[0];\n $p = $h[1];\n $r = $h[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($i[1] <= 12)\n {\n if($i[0] <= $m[intval($i[1])])\n {\n if(($i[0] == 29) && ($i[1] == 2) && ($i[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($i[0] == 29) && ($i[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $i[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $i[0];\n $p = $i[1];\n $r = $i[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($j[1] <= 12)\n {\n if($j[0] <= $m[intval($j[1])])\n {\n if(($j[0] == 29) && ($j[1] == 2) && ($j[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($j[0] == 29) && ($j[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $j[0];\n $p = $j[1];\n $r = $j[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($k[1] <= 12)\n {\n if($k[0] <= $m[intval($k[1])])\n {\n if(($k[0] == 29) && ($k[1] == 2) && ($k[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($k[0] == 29) && ($k[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $k[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $k[0];\n $p = $k[1];\n $r = $k[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($l[1] <= 12)\n {\n if($l[0] <= $m[intval($l[1])])\n {\n if(($l[0] == 29) && ($l[1] == 2) && ($l[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($l[0] == 29) && ($l[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $l[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $l[0];\n $p = $l[1];\n $r = $l[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($n == 1)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\nelse\n{\n if($g[1] <= 12)\n {\n if($g[0] <= $m_2[intval($g[1])])\n {\n if(($g[0] == 29) && ($g[1] == 2) && ($g[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($g[0] == 29) && ($g[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $g[0];\n $p = $g[1];\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($h[1] <= 12)\n {\n if($h[0] <= $m_2[intval($h[1])])\n {\n if(($h[0] == 29) && ($h[1] == 2) && ($h[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($h[0] == 29) && ($h[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $h[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $h[0];\n $p = $h[1];\n $r = $h[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($i[1] <= 12)\n {\n if($i[0] <= $m_2[intval($i[1])])\n {\n if(($i[0] == 29) && ($i[1] == 2) && ($i[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($i[0] == 29) && ($i[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $i[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $i[0];\n $p = $i[1];\n $r = $i[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($j[1] <= 12)\n {\n if($j[0] <= $m_2[intval($j[1])])\n {\n if(($j[0] == 29) && ($j[1] == 2) && ($j[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($j[0] == 29) && ($j[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $g[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $j[0];\n $p = $j[1];\n $r = $j[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($k[1] <= 12)\n {\n if($k[0] <= $m_2[intval($k[1])])\n {\n if(($k[0] == 29) && ($k[1] == 2) && ($k[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($k[0] == 29) && ($k[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $k[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $k[0];\n $p = $k[1];\n $r = $k[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($l[1] <= 12)\n {\n if($l[0] <= $m_2[intval($l[1])])\n {\n if(($l[0] == 29) && ($l[1] == 2) && ($l[2] % 4 != 0))\n {\n $n = 0;\n }\n elseif(($l[0] == 29) && ($l[1] == 2))\n {\n $o = 1;\n $p = 3;\n $r = $l[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n else\n {\n $o = $l[0];\n $p = $l[1];\n $r = $l[2] + 18;\n if($c > $r)\n {\n $n = 1;\n }\n elseif($c == $r)\n {\n if($b > $p)\n {\n $n = 1;\n }\n elseif($b == $p)\n {\n if($a >= $o)\n {\n $n = 1;\n }\n }\n }\n }\n }\n }\n if($n == 1)\n {\n print \"YES\";\n }\n else\n {\n print \"NO\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "04ea8126526e3e0568c2df167ed3b4dc", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "250a7168f10b2c97440a3238c6d799e6", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$valor) {\n if ($valor == $inputArray[$sizeArray-2]) {\n $ban = true;\n break;\n }\n }\n if ($ban) {\n echo \"YES\";\n }else{\n echo \"NO\";\n }\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "672f1c653f1ba26d76b0a0c6f1d3e502", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$a[$n-2]&&$a[$n-1]!=15||$a[$n-1]==0){\n echo\"UP\";\n}else{\n echo\"DOWN\";\n}\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e364a1ebbf1b9d1a675fa06afa08c277", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### /IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test)\n\t\t$stream = $f;\n\telse\n\t\t$stream = STDIN;\n\t/* begin body */\n\t$n = readNum($stream);\n\t$nums = readStringExplodeNum($stream, ' ', true);\n\tif ($n == 1) {\n\t\t$num = array_pop($nums);\n\t\tif ($num == 15) {\n\t\t\techo 'DOWN';\n\t\t} elseif ($num == 0) {\n\t\t\techo 'UP';\n\t\t} else {\n\t\t\techo -1;\n\t\t}\n\t} else {\n\n\n\t\t$nums = array_slice($nums, count($nums) - 2);\n\t\t$isDec = true;\n\t\tif ($nums[0] < $nums[1]) {\n\t\t\t$isDec = false;\n\t\t}\n\t\t$nums[2] = $nums[1] + 1;\n\t\tif ($isDec && $nums[1] > 0) {\n\t\t\t$nums[2] = $nums[1] - 1;\n\t\t}\n\t\tif ($nums[2] > 15) {\n\t\t\t$nums[2] = $nums[1] - 1;\n\t\t}\n\n\t\tif ($nums[2] > $nums[1]) {\n\t\t\techo 'UP';\n\t\t} else {\n\t\t\techo 'DOWN';\n\t\t}\n\t}\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9c2f4f89e0bdd4a0e934d9195793c3c0", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $moon[0][$num - 2] or $moon[0][$num - 1] == 0) {\n echo \"UP\";\n}else echo -1; \n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e4affe178df076c0d10bceabbcd74db5", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b[$a - 2])\n {\n print \"UP\";\n }\n elseif($b[$a - 1] < $b[$a - 2])\n {\n print \"DOWN\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "321cccee5a2692790f32cab66d57b611", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "f29f5d9ed8971e19b9a92534182886e9", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $h) && ($a < $i)) || (($b > $h) && ($b < $i)) || (($c > $h) && ($c < $i)))\n{\n if(($a < $h) || ($b < $h) || ($c < $h) || ($a > $i) || ($b > $i) || ($c > $i))\n {\n print \"NO\";\n }\n else\n {\n print \"YES\";\n }\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7b405d115317ee3556469cb7b61c8557", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i)\n {\n $j += $g - $e[$x];\n }\n else\n {\n $j += $e[$x];\n }\n }\n}\nprint $j;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "5dd3df7a2df93eb075110c55ad08554e", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n {\n break;\n }\n}\n\necho ($c == 1) ? \"YES\" : \"NO\";", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "37b4faddf0661dd7c605b3c035a438f9", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "99e0de23342e1eb0b994db3025915930", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1d4f721084b3bd3172264da015b45a06", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "04f1f4a517824d680fd9721d342fb89b", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f)\n {\n $g = $a * $d;\n $b -= $g;\n $c -= $f;\n $e++;\n if($b <= 0)\n {\n break;\n }\n }\n elseif($c > 0)\n {\n $g = ($c + 1) * $d;\n $b -= $g;\n $c = 0;\n $e++;\n if($b <= 0)\n {\n break;\n }\n }\n elseif($c == 0)\n {\n $b -= $d;\n $e++;\n if($b <= 0)\n {\n break;\n }\n }\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "467b03f5ad2b4c3a6813d761545ab42e", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n\tif($nutsInBox < $sectionCapacity)\n\t{\n\t\t++$nutsInBox;\n\t\t--$numberOfNuts;\n\t\tcontinue;\n\t}\n\n\t//echo \"Reached section capacity at $nutsInBox\" . PHP_EOL;\n\t\n\tif($divisorsInBox < ($maxSections - 1) && $numberOfDivisors > 0)\n\t{\n\t\t$nutsInBox = 0;\n\t\t\n\t\t++$divisorsInBox;\n\t\t--$numberOfDivisors;\n\t\tcontinue;\n\t}\n\n\t//echo \"reached divisional capacity with $divisorsInBox\" . PHP_EOL;\n\n\t++$numberOfBoxes;\n\t$divisorsInBox = 0;\n\t$nutsInBox = 0;\n}\n\necho $numberOfBoxes . PHP_EOL;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "1c0c7b7109b6760f0dbdabe2a7b88290", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0) && ($diffy >= 0)) {\n\t\techo \"Yes\"; return 0;\n\t}\n}\necho \"No\";", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "14c8b2ca2dc0c7ea20da377dbf069aa8", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1c2da1a2fdf6ea76397849f47906251e", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "85caa8e7a1eeed03f4ab064fcd76dc3d", "src_uid": "0515ac888937a4dda30cad5e2383164f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a) {\n $result = ((($l + $r) - $diff) / 2 + $a) * 2;\n } else {\n $result = (($l + $r) + $diff) + ($a - $diff) - ($a - $diff) % 2;\n }\n } else if ($l == $r) {\n $result = $l + $l + $a - $a % 2;\n }\n print $result;\n fprintf(STDOUT, \"$d\\n\", $result);\n}", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d8bf3872c046c52163960d7094599725", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "4ab8ff20e686aba2d79b5faf54e10a0a", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "5d587bfce69ccf0cf46f09f24873908b", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n $e = 2;\n break;\n }\n }\n}\nif($e == 0)\n{\n $f = $b % $c;\n}\nelseif($e == 1)\n{\n $f = $b % $c;\n}\nelseif($e == 2)\n{\n $f = $b;\n}\nprint $f;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6e8f3b2475168415d111c7ecc6c15afd", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$b || ($a>50 && sqrt($b)<$a)){\n echo $b;\n}else{\n $s=1;\n for($i=0;$i<$a;$i++)\n {\n $s*=2;\n }\n echo ($s>$b)?$b:$b%$s;\n}\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "49dcdc3cc516bfdcd78565699e624803", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n $c[count($c)] = $d;\n $d = \"\";\n}\n$e = 0;\nfor($x = 0; $x < count($c); $x++)\n{\n $f = array_unique(str_split($c[$x]));\n sort($f);\n if($f[0] == NULL)\n {\n $f = 0;\n }\n else\n {\n $f = count($f);\n }\n $e = max($e, $f);\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "strings", "implementation"], "code_uid": "d6500951fd4f8b23247163662592358e", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "316d5a8ea27d5769ff5b77a76f7a00d4", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a640f980b8fefd26c29aa9f17f537f3c", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "35bbeafeba807ee4de5be85b64ede6fe", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && $x<10) {\n return true;\n } else {\n return false;\n }\n}\n\nfunction checkResult($a, $b, $n, $k, $r, $c, $d) {\n if (($a+$b)==$r[0] \n && ($n+$k)==$r[1]\n && ($a+$n)==$c[0]\n && ($b+$k)==$c[1]\n && ($a+$k)==$d[0]\n && ($b+$n)==$d[1]\n && $a!=$b\n && $a!=$n\n && $a!=$k\n && $b!=$n\n && $b!=$k\n && $n!=$k) {\n \n return true;\n } else {\n return false;\n }\n}\n$file = file('php://stdin');\n$r = explode(' ', $file[0]); \n$c = explode(' ', $file[1]); \n$d = explode(' ', $file[2]);\nif ($r[0]==1 || $r[1]==1 || $d[0]==1 || $d[1]==1 || $c[0]==1 || $c[1]==1){\n echo '-1';\n exit;\n}\nfor ($a=1; $a<=min($r[0]-1, 9); $a++) {\n $b = $r[0]-$a;\n for ($n=1; $n<=min($r[1]-1, 9); $n++) {\n $k = $r[1]-$n;\n if (checkNumber($a) && checkNumber($b) && checkNumber($n) && checkNumber($k) && checkResult($a, $b, $n, $k, $r, $c, $d)) {\n echo \"$a $b\\n\";\n echo \"$n $k\";\n exit;\n }\n }\n}\necho '-1';\n\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "d62afe4af22bc8e3eb64465f23d302fd", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "08f18bb6f635f6705bec7f4f7b4e879d", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "ba78486fc72b86f01e089efc739b019b", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "ae7cf144f4b3c5aa08e7f565691651a1", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$k) {\n\n\tif($min >= $k) {\n\n\t\techo $sum;\n\t\tdie();\n\n\n\t}\n\n}\n\nelse if(($resto1==0) && ($max>=$k)) { \n\techo $sum; die(); }\n\n\t// var_dump($resto1==0,$max>=$k);\n\n\necho \"-1\";\n\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "ba7bb0a01d1384b9dee6ec9fa6187da1", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)) || (($d == 0) && ($g > 0)))\n{\n print \"-1\";\n}\nelseif(($h >= $g) || ($i >= $f))\n{\n print $d + $e;\n}\nelse\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "e9985e4be1bc9e37ae9f82c12bba5a0e", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "ee13e422352ad0849df27a17b09ccde1", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "38c5b7a74dc5b480d3ef834ee75bd350", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f7d9407a5e1a706128b6fb1f4c4f1cf2", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "greedy", "implementation"], "code_uid": "fc45c1a7141712725c7dc96ca1feb1f5", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c58bbc0324b572cc315367e880bfaac8", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dp"], "code_uid": "df9a16a8e8fdc9819e0b06b240e73dc1", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "880faf5891e88744fc06764955f5ea72", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "a979d481d83939dbc0f3d60b8efc7589", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n $f += $a;\n }\n}\nif(($x == $b - 1) && ($i == 0))\n{\n $f += $a;\n}\nelseif(($x == $b - 1) && ($i == 1))\n{\n $f += $h;\n}\n$e[count($e)] = $f;\n$j = array_sum($d);\nfor($x = 0; $x < $a; $x++)\n{\n $c2 = $c;\n $k = 0;\n for($y = 0; $y <= $x; $y++)\n {\n $c2 -= $j;\n if($c2 < 0)\n {\n $c2 += $j;\n break;\n }\n elseif($c2 == 0)\n {\n $k += $b + 1;\n break;\n }\n elseif($c2 > 0)\n {\n $k += $b + 1;\n }\n }\n if($c2 > 0)\n {\n $i = 0;\n for($z = 0; $z < $b; $z++)\n {\n $g = $d[$z] * ($a - $y);\n $c2 -= $g;\n if($c2 < 0)\n {\n $c2 += $g;\n $h = floor($c2 / $d[$z]);\n $k += $h;\n $i = 1;\n break;\n }\n elseif($c2 == 0)\n {\n $k += ($a - $y);\n break;\n }\n elseif($c2 > 0)\n {\n $k += ($a - $y);\n }\n }\n if(($z == $b - 1) && ($i == 0))\n {\n $k += ($a - $y);\n }\n elseif(($z == $b - 1) && ($i == 1))\n {\n $k += $h;\n }\n }\n $e[count($e)] = $k;\n}\nprint max($e);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "41d7c38e4f0124792b122a2fcfa30176", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n {\n $d += 2;\n break;\n }\n else\n {\n $d++;\n $c[0] = $c[1] + $c[2] - 1;\n }\n}\nprint $d;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "042ffa0aceb2fb8c0e97e2601079631b", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e88dfe4372476b18d3478c18fbe1d1c1", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " = $a)\n {\n break;\n }\n else\n {\n $c++;\n }\n}\nprint max($b);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "d9cee6558a2274594797f58402839c42", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\",\"v\", \"<\"];\n$counter_clockwise_stats = array_reverse($clockwise_stats);\n\n\n$is_cw = false;\n$is_ccw = false;\n\n$mod = $n%4;\n$start_pos = array_search($start, $clockwise_stats);\nif($start_pos!==false){\n \t$end_pos = ($start_pos+$mod)%4;\n\tif($end == $clockwise_stats[$end_pos]){\n\t $is_cw = true;\n\t}\n}\n\n$start_pos_ccw = array_search($start, $counter_clockwise_stats);\nif($start_pos_ccw!==false){\n\n\t$end_pos_ccw = ($start_pos_ccw + $mod)%4;\n\tif($end == $counter_clockwise_stats[$end_pos_ccw]){\n\t $is_ccw = true;\n\t}\n}\n\nif($is_cw && $is_ccw)\n{\n echo \"undefined\";\n}elseif($is_cw){\n echo \"cw\";\n}elseif($is_ccw){\n echo \"ccw\";\n}else{\n echo \"undefined\";\n}\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0cc0bea7ac32fa63114f450420599ad9", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\", \"v\", \"<\");\n $e = $c % 4;\n if($b == $d[$e])\n {\n print \"cw\";\n }\n else\n {\n $f = array(\"^\", \"<\", \"v\", \">\");\n $g = $c % 4;\n if($b == $f[$g])\n {\n print \"ccw\";\n }\n }\n}\nelseif($a == \">\")\n{\n $d = array(\">\", \"v\", \"<\", \"^\");\n $e = $c % 4;\n if($b == $d[$e])\n {\n print \"cw\";\n }\n else\n {\n $f = array(\">\", \"^\", \"<\", \"v\");\n $g = $c % 4;\n if($b == $f[$g])\n {\n print \"ccw\";\n }\n }\n}\nelseif($a == \"v\")\n{\n $d = array(\"v\", \"<\", \"^\", \">\");\n $e = $c % 4;\n if($b == $d[$e])\n {\n print \"cw\";\n }\n else\n {\n $f = array(\"v\", \">\", \"^\", \"<\");\n $g = $c % 4;\n if($b == $f[$g])\n {\n print \"ccw\";\n }\n }\n}\nelseif($a == \"<\")\n{\n $d = array(\"<\", \"^\", \">\", \"v\");\n $e = $c % 4;\n if($b == $d[$e])\n {\n print \"cw\";\n }\n else\n {\n $f = array(\"<\", \"v\", \">\", \"^\");\n $g = $c % 4;\n if($b == $f[$g])\n {\n print \"ccw\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "cfe06711b9f67dd6bd6aef4917bb87c8", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a [1])\n$x=$a [1];\nelse\n$x=$a [0];\n$s=1;\n\nfor ($i=2; $i <=$x; $i++)\n$s=$s*$i;\n\necho $s;\n\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "d2e9c1e8d2fc75dccb255365672b2d5b", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "caade5e02c5c217299f4ba91a7e2f0c6", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "f8a98a2ec709835a75aba76aa791e6f5", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a[2])\n{\n print \"0\";\n}\nelse\n{\n $b = $a[2] - ($a[0] + $a[1]) + 1;\n print $b;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "geometry"], "code_uid": "b24eecf6a1bfcb1cdb92730d62386fc5", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "23ac496d35a48701ff4a83030fd9c232", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f184975df1e953d70076805196df3db1", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2 * $k) $good = false;\n}\nif ($good) printf (\"YES\\n\");\nelse printf (\"NO\\n\");\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b1706de20df391b5bd115ee637ada719", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\";\n\tfor($i=0;$i<10;$i++) {\n\t\tprint \"no. \" . $i . \" : \" . $a[$i];\n\t}\n}\n$k = fgets(STDIN);\n$a = array();\nfor($i=0;$i<4;$i++) {\n\t$b = fgets(STDIN);\n\tfor($j=0;$j<4;$j++) {\n\t\tif($b[$j] != '.') {\n\t\t\t$a[$b[$j]] ++;\n\t\t}\n\t}\n}\n#check($k);\n\n$ok = 1;\nfor($i='0';$i<='9';$i++) {\n\tif($a[$i] > 2 * $k) {\n\t\t$ok = 0; break;\n\t}\n}\nif($ok == 1) echo \"YES\"; else echo \"NO\";\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f94d5f42db5dcb817445b1ebfc37f8d1", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $g)\n{\n print \"NO\";\n}\nelse\n{\n print \"YES\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6a42fb7038307466cb5a94706bd1fb24", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f)\n {\n print \"1\";\n }\n else\n {\n if($c[0] >= $f)\n {\n print \"1\";\n }\n else\n {\n $h = 9 - $b[1];\n if($g + $h >= $f)\n {\n print \"2\";\n }\n else\n {\n if($c[0] + $c[1] >= $f)\n {\n print \"2\";\n }\n else\n {\n if($g + $c[0] >= $f)\n {\n print \"2\";\n }\n else\n {\n print \"3\";\n }\n }\n }\n }\n }\n }\n elseif($d > $e)\n {\n $g = 9 - $c[2];\n if($g >= $f)\n {\n print \"1\";\n }\n else\n {\n if($b[0] >= $f)\n {\n print \"1\";\n }\n else\n {\n $h = 9 - $c[1];\n if($g + $h >= $f)\n {\n print \"2\";\n }\n else\n {\n if($b[0] + $b[1] >= $f)\n {\n print \"2\";\n }\n else\n {\n if($g + $b[0] >= $f)\n {\n print \"2\";\n }\n else\n {\n print \"3\";\n }\n }\n }\n }\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "ad5e230f82c37075ed7cd4f0bd5f2b29", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 3)\n {\n print \"-1\";\n }\n else\n {\n sort($b);\n $c = array();\n for($x = 0; $x < $a - 1; $x++)\n {\n if($b[$x + 1] - $b[$x] != 0)\n {\n $c[$x] = $b[$x + 1] - $b[$x];\n }\n }\n $c = array_unique($c);\n sort($c);\n if(count($c) == 0)\n {\n print \"0\";\n }\n elseif(count($c) == 1)\n {\n $d = $c[0];\n $e = array_unique($b);\n if((count($e) == 2) && ($d % 2 == 0))\n {\n print $d / 2;\n }\n else\n {\n print $d;\n }\n }\n else\n {\n print \"-1\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "b9dff670b8cd110a942c0216f2e155aa", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0,\n 'B' => 0,\n 'Y' => 0,\n 'G' => 0\n );\n \n for($i=0; $i<4; $i++)\n $vals[$cons[$i]] = $cnt[$i];\n \n foreach($vals as $x)\n echo $x . \" \";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "number theory"], "code_uid": "0d0639127387817cd6d585f9b8877173", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $dead[0]\n ,$sequence[1] => $dead[1]\n ,$sequence[2] => $dead[2]\n ,$sequence[3] => $dead[3]);\n\nfclose($f);\n\necho $deadByColors[\"R\"].\" \".$deadByColors[\"B\"].\" \".$deadByColors[\"Y\"].\" \".$deadByColors[\"G\"];\n\n\n", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "number theory"], "code_uid": "ddc12c2d0be357fa816ea14a92b9bc94", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d)\n {\n array_push($e, $y - $x);\n break;\n }\n }\n}\nrsort($e);\nprint $e[0];\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "binary search"], "code_uid": "09ba4fec0abf4c1af645e2207de0477c", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a)\n{\n print $f;\n}\nelse\n{\n while(TRUE)\n {\n $g += min($c - $e, $b + ($f * $d) - $e);\n $f++;\n if($g >= $a)\n {\n break;\n }\n }\n print $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ce5a69588726e9109c945cb0ecd8f4a6", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $a[0]) {\n for ($i = 1; $i <= $n; $i++) {\n if (($i - 1) * $i * $a[3]/2 + $i * ($a[1] + $a[3] - $a[4]) + $a[1] >= $a[0]) {\n echo $i + 1;\n break;\n }\n }\n} else {\n echo ceil(($a[0] - ($n - 1) * $n * $a[3]/2 - $n * ($a[1] + $a[3] - $a[4]) - $a[1])/($a[2]-$a[4]))+ $n + 1;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ab255063d2eff85dded77ed0404481eb", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "1e963940689daa31f6633c3e4e6978c2", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=1 || $b[2]>=2 || $b[3]==3 || $b[2]==1 && $b[4]==2)\n echo 'YES';\nelse\n echo 'NO';\n?>", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "21daf0b88233faa786b4c0438739c1a7", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d)\n {\n $e = $b - $d + 1;\n print $e;\n }\n}\nelseif($d == $a)\n{\n if($b < $c)\n {\n $e = $c - $b + 1;\n print $e;\n }\n elseif($b == $c)\n {\n print \"1\";\n }\n elseif($b > $c)\n {\n $e = $b - $c + 1;\n print $e;\n }\n}\nelseif($b <= $c)\n{\n $e = $c - $b + 1;\n $f = $d - $c + 1;\n print $e + $f;\n}\nelseif(($b > $c) && ($b < $d))\n{\n $e = $b - $c + 1;\n $f = $d - $c + 1;\n $g = $e + $f;\n $h = $d - $b + 1;\n $i = $d - $c + 1;\n $j = $h + $i;\n print min($g, $j);\n}\nelseif($b >= $d)\n{\n $e = $b - $d + 1;\n $f = $d - $c + 1;\n print $e + $f;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0030d05eec6d0a3d4e54a75672db0603", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $y--)\n {\n if($h[$y - 1] == $h[$y - 2])\n {\n $i++;\n }\n else\n {\n $i++;\n array_push($j, $i);\n $i = 0;\n array_push($k, $h[$y - 1]);\n }\n }\n $l = 0;\n $m = array();\n $n = array();\n for($y = $e[$x]; $y < $a; $y++)\n {\n if($h[$y + 2] == $h[$y + 3])\n {\n $l++;\n }\n else\n {\n $l++;\n array_push($m, $l);\n $l = 0;\n array_push($n, $h[$y + 2]);\n }\n }\n for($y = 0; $y < min(count($j), count($m)); $y++)\n {\n if(($k[$y] == $n[$y]) && (($j[$y] + $m[$y]) >= 3))\n {\n $g += ($j[$y] + $m[$y]);\n }\n else\n {\n break;\n }\n }\n array_push($f, $g);\n }\n print max($f);\n}\n?>", "lang_cluster": "PHP", "tags": ["two pointers", "brute force"], "code_uid": "39071bd6dd3788d97c3d9262d900a796", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$j) { $i=$i%$j; } else { $j=$j%$i; } }\n return $i+$j;\n}\n\n// uprosh drob\n$nod=nod($x,$y);\nwhile ($nod>1)\n{\n $x=$x/$nod;\n $y=$y/$nod;\n $nod=nod($x,$y);\n}\n$a2=0;\n$b2=0;\nwhile (($a2+$x<=$a)&&($b2+$y<=$b))\n{\n $a2=$a2+$x;\n $b2=$b2+$y;\n}\n\n\n\n\n$stdout=fopen('php://stdout','w');\nfwrite($stdout,$a2.' '.$b2);\nfclose($stdout);\n\n?>", "lang_cluster": "PHP", "tags": ["binary search", "number theory"], "code_uid": "bb8d4128b64874e6a4d7b59e3f88fb78", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "c4f543098757c7cf851f8a452f319055", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $x--)\n{\n $e = substr($b, 0, $x);\n $f = substr($b, $x, $x);\n if($e == $f)\n {\n $d = $x;\n break;\n }\n}\nif($d == 0)\n{\n print $a;\n}\nelse\n{\n $g = $a - $d;\n $g++;\n print $g;\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "25f5b03aafe770a110839020a0ed2695", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "adfd324a0fba2207661354627f6a970d", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a, 1 => $b, 2 => $c);\n $f = array(\"s\", \"m\", \"p\");\n for($w = 0; $w < 3; $w++)\n {\n for($x = 1; $x <= 7; $x++)\n {\n for($y = $x + 1; $y <= 8; $y++)\n {\n for($z = $y + 1; $z <= 9; $z++)\n {\n if(($z - $y > 1) || ($y - $x) > 1)\n {\n break;\n }\n $g = $x . $f[$w];\n $h = $y . $f[$w];\n $i = $z . $f[$w];\n $j = array($g, $h, $i);\n $k = array_intersect($e, $j);\n $l = 3 - count($k);\n $m = min($m, $l);\n }\n }\n }\n }\n}\nprint min($d, $m);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "de20d748d0a5c81efa5c764f9b2241b1", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c[$x])\n {\n $e += $b[$x] - $c[$x];\n }\n}\nif($d <= $e)\n{\n print \"Yes\";\n}\nelse\n{\n print \"No\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "198447c34adc95b6c49941642b59d6ef", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n {\n if($a[$x] == 0)\n {\n $c[count($c)] = $x;\n if(count($c) == 2)\n {\n break;\n }\n }\n }\n if(count($c) == 2)\n {\n $d += (strlen($a) - 1) - $c[0];\n $d += (strlen($a) - 2) - $c[1];\n $b[count($b)] = $d;\n }\n $e = 0;\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 0)\n {\n $e++;\n $f = $x;\n break;\n }\n }\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 5)\n {\n $e++;\n $g = $x;\n break;\n }\n }\n if($e == 2)\n {\n if($f < $g)\n {\n $h += (strlen($a) - 1) - $f;\n $h += (strlen($a) - 2) - ($g - 1);\n }\n else\n {\n $h += (strlen($a) - 1) - $f;\n $h += (strlen($a) - 2) - $g;\n if($g == 0)\n {\n $i = 0;\n for($x = 1; $x < $f; $x++)\n {\n if($a[$x] == 0)\n {\n $i++;\n }\n else\n {\n break;\n }\n }\n }\n $h += $i;\n }\n $b[count($b)] = $h;\n }\n $i2 = 0;\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 5)\n {\n $i2++;\n $j = $x;\n break;\n }\n }\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 2)\n {\n $i2++;\n $k = $x;\n break;\n }\n }\n if($i2 == 2)\n {\n for($x = 0; $x < strlen($a); $x++)\n {\n if($a[$x] == 0)\n {\n $j2++;\n }\n }\n if(strlen($a) == 2)\n {\n $b[count($b)] = 1;\n }\n elseif(strlen($a) - $j2 != 2)\n {\n for($x = 0; $x < strlen($a); $x++)\n {\n if(($a[$x] != 0) && ($x != $j) && ($x != $k))\n {\n $l = $x;\n break;\n }\n }\n if(($l < $j) && ($l < $k))\n {\n if($j < $k)\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n }\n else\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n }\n $b[count($b)] = $m;\n }\n elseif(($l > $j) && ($l > $k))\n {\n if($j < $k)\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n }\n else\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n }\n $m += $l - 2;\n $b[count($b)] = $m;\n }\n elseif(($l > $j) && ($l < $k))\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n $m += $l - 1;\n }\n elseif(($l > $k) && ($l < $j))\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n $m += $l - 1;\n }\n $b[count($b)] = $m;\n }\n }\n $i2 = 0;\n $m = 0;\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 5)\n {\n $i2++;\n $j = $x;\n break;\n }\n }\n for($x = strlen($a) - 1; $x >= 0; $x--)\n {\n if($a[$x] == 7)\n {\n $i2++;\n $k = $x;\n break;\n }\n }\n if($i2 == 2)\n {\n $j2 = 0;\n for($x = 0; $x < strlen($a); $x++)\n {\n if($a[$x] == 0)\n {\n $j2++;\n }\n }\n if(strlen($a) == 2)\n {\n $b[count($b)] = 1;\n }\n elseif(strlen($a) - $j2 != 2)\n {\n for($x = 0; $x < strlen($a); $x++)\n {\n if(($a[$x] != 0) && ($x != $j) && ($x != $k))\n {\n $l = $x;\n break;\n }\n }\n if(($l < $j) && ($l < $k))\n {\n if($j < $k)\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n }\n else\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n }\n $b[count($b)] = $m;\n }\n elseif(($l > $j) && ($l > $k))\n {\n if($j < $k)\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n }\n else\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n }\n $m += $l - 2;\n $b[count($b)] = $m;\n }\n elseif(($l > $j) && ($l < $k))\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - ($k - 1);\n $m += $l - 1;\n }\n elseif(($l > $k) && ($l < $j))\n {\n $m += (strlen($a) - 1) - $j;\n $m += (strlen($a) - 2) - $k;\n $m += $l - 1;\n }\n $b[count($b)] = $m;\n }\n }\n if(count($b) == 0)\n {\n print \"-1\";\n }\n else\n {\n print min($b);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "8acc88b6f26b5ac4d5f6a152392fb5be", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "34d608bf55093757708ce00690c7c27e", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "cbe0b02a7f378a20484f3c58cfb914b5", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if($a[$x] == $b[$f])\n {\n if($i == 0)\n {\n if($h < $g - ($x + 1))\n {\n $h = $g - ($x + 1);\n }\n $g = $x + 1;\n $i = 1;\n }\n else\n {\n if($h < $g - ($x + 1) - 1)\n {\n $h = $g - ($x + 1) - 1;\n }\n $g = $x + 1;\n }\n $e[count($e)] = $x + 1;\n $f--;\n if($f < 0)\n {\n break;\n }\n }\n}\nif($h < $g - 1)\n{\n $h = $g - 1;\n}\n$e = array_reverse($e);\nfor($x = 0; $x < strlen($b) - 1; $x++)\n{\n if(($e[$x + 1] > $c[$x + 1]) && ($h < $e[$x + 1] - $c[$x] - 1))\n {\n $h = $e[$x + 1] - $c[$x] - 1;\n }\n}\nprint $h;\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "9f1647ceff65db105b98d020a566ad84", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ($a - $e))\n {\n $d = $e - 1;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "binary search"], "code_uid": "001bd9ec2da85143b6af305906c978a4", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$n-$i+1) {\n break;\n }\n\n $mess+=2*($rem-1)-1;\n $rem=$rem-2;\n \n}\n\necho $mess;", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "7cef83ecb84d5d028c04ffdd824d9750", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n{\n $d = 0;\n for($x = 1; $x <= $b; $x++)\n {\n $d += ($a - 1);\n $a--;\n $d += ($a - 1);\n $a--;\n }\n printf(\"%.0f\", $d);\n}\nelse\n{\n $e = $b - $c;\n $f = $e % 2;\n $d = 0;\n for($x = 1; $x <= $c; $x++)\n {\n $d += ($a - 1);\n $a--;\n $d += ($a - 1);\n $a--;\n }\n if($f == 0)\n {\n printf(\"%.0f\", $d);\n }\n else\n {\n printf(\"%.0f\", $d);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "573e42cd1f641e94dca952798afab4c8", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n $f = $a - $b;\n $g = floor($f / 2);\n $h = ceil($f / 2);\n $i = $c[$g] + $c[$h];\n}\nprint $i;\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "35a2e8d611ce21b97ed875675b38f446", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n\t\t\treturn false;\n\t\t}\n\t\t$n = floor($n/7);\n\t}\n\treturn true;\n}\n\n$fp = fopen('php://stdin', 'r');\nlist($n, $m) = array_map('intval', explode(' ', fgets($fp)));\n$dn = max(1, ceil(log($n, 7)));\n$dm = max(1, ceil(log($m, 7)));\nif ($dn + $dm > 7) {\n\tdie('0');\n}\n\n$zeros = array_fill(0, 7, 0);\n\n$result = 0;\nfor($i = 0; $i < $n; ++$i) {\n\t$bits = $zeros;\n\tif (!set_bits($i, $dn, $bits)) {\n\t\tcontinue;\n\t}\n\tfor($j = 0; $j < $m; ++$j) {\n\t\t$bits2 = $bits;\n\t\tif (set_bits($j, $dm, $bits2)) {\n\t\t\t++$result;\n\t\t}\n\t\t//echo \"$i:$j \".implode(' ', $bits2).\"\\n\";\n\t}\n}\necho $result;", "lang_cluster": "PHP", "tags": ["brute force", "math", "combinatorics"], "code_uid": "89ad1dd534f178691adf2d64a9d473cf", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c673904fb24b016163e4cb40dbc07a14", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $e)\n {\n $f = $d - $e;\n if(($f == 200) && ($b[0] == 100))\n {\n $c = 1;\n }\n break;\n }\n}\nif($c == 1)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "0f67ea522361867429f4609f089b38fc", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "964dda987b94ed3e26b80614cc004b92", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $e)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a)\n {\n $h[$x] += 3;\n $i[$x] += $d;\n $j[$x] += $e;\n }\n if($g[$x] == $b)\n {\n $i[$x] += $e;\n $j[$x] += $d;\n }\n }\n}\nelseif($d == $e)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a)\n {\n $h[$x] += 1;\n $i[$x] += $d;\n $j[$x] += $e;\n }\n if($g[$x] == $b)\n {\n $h[$x] += 1;\n $i[$x] += $e;\n $j[$x] += $d;\n }\n }\n}\nelseif($d < $e)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a)\n {\n $i[$x] += $d;\n $j[$x] += $e;\n }\n if($g[$x] == $b)\n {\n $h[$x] += 3;\n $i[$x] += $e;\n $j[$x] += $d;\n }\n }\n}\nif($d2 > $e2)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a2)\n {\n $h[$x] += 3;\n $i[$x] += $d2;\n $j[$x] += $e2;\n }\n if($g[$x] == $b2)\n {\n $i[$x] += $e2;\n $j[$x] += $d2;\n }\n }\n}\nelseif($d2 == $e2)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a2)\n {\n $h[$x] += 1;\n $i[$x] += $d2;\n $j[$x] += $e2;\n }\n if($g[$x] == $b2)\n {\n $h[$x] += 1;\n $i[$x] += $e2;\n $j[$x] += $d2;\n }\n }\n}\nelseif($d2 < $e2)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a2)\n {\n $i[$x] += $d2;\n $j[$x] += $e2;\n }\n if($g[$x] == $b2)\n {\n $h[$x] += 3;\n $i[$x] += $e2;\n $j[$x] += $d2;\n }\n }\n}\nif($d3 > $e3)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a3)\n {\n $h[$x] += 3;\n $i[$x] += $d3;\n $j[$x] += $e3;\n }\n if($g[$x] == $b3)\n {\n $i[$x] += $e3;\n $j[$x] += $d3;\n }\n }\n}\nelseif($d3 == $e3)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a3)\n {\n $h[$x] += 1;\n $i[$x] += $d3;\n $j[$x] += $e3;\n }\n if($g[$x] == $b)\n {\n $h[$x] += 1;\n $i[$x] += $e3;\n $j[$x] += $d3;\n }\n }\n}\nelseif($d3 < $e3)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a3)\n {\n $i[$x] += $d3;\n $j[$x] += $e3;\n }\n if($g[$x] == $b3)\n {\n $h[$x] += 3;\n $i[$x] += $e3;\n $j[$x] += $d3;\n }\n }\n}\nif($d4 > $e4)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a4)\n {\n $h[$x] += 3;\n $i[$x] += $d4;\n $j[$x] += $e4;\n }\n if($g[$x] == $b4)\n {\n $i[$x] += $e4;\n $j[$x] += $d4;\n }\n }\n}\nelseif($d4 == $e4)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a4)\n {\n $h[$x] += 1;\n $i[$x] += $d4;\n $j[$x] += $e4;\n }\n if($g[$x] == $b4)\n {\n $h[$x] += 1;\n $i[$x] += $e4;\n $j[$x] += $d4;\n }\n }\n}\nelseif($d4 < $e4)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a4)\n {\n $i[$x] += $d4;\n $j[$x] += $e4;\n }\n if($g[$x] == $b4)\n {\n $h[$x] += 3;\n $i[$x] += $e4;\n $j[$x] += $d4;\n }\n }\n}\nif($d5 > $e5)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a5)\n {\n $h[$x] += 3;\n $i[$x] += $d5;\n $j[$x] += $e5;\n }\n if($g[$x] == $b5)\n {\n $i[$x] += $e5;\n $j[$x] += $d5;\n }\n }\n}\nelseif($d5 == $e5)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a5)\n {\n $h[$x] += 1;\n $i[$x] += $d5;\n $j[$x] += $e5;\n }\n if($g[$x] == $b5)\n {\n $h[$x] += 1;\n $i[$x] += $e5;\n $j[$x] += $d5;\n }\n }\n}\nelseif($d5 < $e5)\n{\n for($x = 0; $x < 4; $x++)\n {\n if($g[$x] == $a5)\n {\n $i[$x] += $d5;\n $j[$x] += $e5;\n }\n if($g[$x] == $b5)\n {\n $h[$x] += 3;\n $i[$x] += $e5;\n $j[$x] += $d5;\n }\n }\n}\nfor($x = 0; $x < 4; $x++)\n{\n if($g[$x] == \"BERLAND\")\n {\n break;\n }\n}\n$k = $h[$x] + 3;\n$l = $h;\nrsort($l);\nif($l[1] > $k)\n{\n print \"IMPOSSIBLE\";\n}\nelse\n{ \n $m = array();\n $n = array();\n $o = array();\n $h[$ber] += 3;\n for($w = 0; $w <= 50; $w++)\n {\n for($x = 0; $x < $w; $x++)\n {\n $g2 = $g;\n $h2 = $h;\n $i2 = $i;\n $j2 = $j;\n $i2[$ber] = $i[$ber] + $w;\n $i2[$reb] = $i[$reb] + $x;\n $j2[$ber] = $j[$ber] + $x;\n $j2[$reb] = $j[$reb] + $w;\n for($y = 0; $y < 4; $y++)\n {\n for($z = 0; $z < 4; $z++)\n {\n if(($i2[$y] > $i2[$z]) && ($y > $z))\n {\n $p = $g2[$y];\n $r = $g2[$z];\n array_splice($g2, $y, 1);\n array_splice($g2, $z, 1, array($p, $r));\n $p = $h2[$y];\n $r = $h2[$z];\n array_splice($h2, $y, 1);\n array_splice($h2, $z, 1, array($p, $r));\n $p = $i2[$y];\n $r = $i2[$z];\n array_splice($i2, $y, 1);\n array_splice($i2, $z, 1, array($p, $r));\n $p = $j2[$y];\n $r = $j2[$z];\n array_splice($j2, $y, 1);\n array_splice($j2, $z, 1, array($p, $r));\n }\n }\n }\n for($y = 0; $y < 4; $y++)\n {\n for($z = 0; $z < 4; $z++)\n {\n if((($i2[$y] - $j2[$y]) > ($i2[$z] - $j2[$z])) && ($y > $z))\n {\n $p = $g2[$y];\n $r = $g2[$z];\n array_splice($g2, $y, 1);\n array_splice($g2, $z, 1, array($p, $r));\n $p = $h2[$y];\n $r = $h2[$z];\n array_splice($h2, $y, 1);\n array_splice($h2, $z, 1, array($p, $r));\n $p = $i2[$y];\n $r = $i2[$z];\n array_splice($i2, $y, 1);\n array_splice($i2, $z, 1, array($p, $r));\n $p = $j2[$y];\n $r = $j2[$z];\n array_splice($j2, $y, 1);\n array_splice($j2, $z, 1, array($p, $r));\n }\n }\n }\n for($y = 0; $y < 4; $y++)\n {\n for($z = 0; $z < 4; $z++)\n {\n if(($h2[$y] > $h2[$z]) && ($y > $z))\n {\n $p = $g2[$y];\n $r = $g2[$z];\n array_splice($g2, $y, 1);\n array_splice($g2, $z, 1, array($p, $r));\n $p = $h2[$y];\n $r = $h2[$z];\n array_splice($h2, $y, 1);\n array_splice($h2, $z, 1, array($p, $r));\n $p = $i2[$y];\n $r = $i2[$z];\n array_splice($i2, $y, 1);\n array_splice($i2, $z, 1, array($p, $r));\n $p = $j2[$y];\n $r = $j2[$z];\n array_splice($j2, $y, 1);\n array_splice($j2, $z, 1, array($p, $r));\n }\n }\n }\n if(($g2[0] == \"BERLAND\") || ($g2[1] == \"BERLAND\"))\n {\n array_push($m, $w);\n array_push($n, $x);\n array_push($o, $w - $x);\n }\n }\n }\n $s = min($o);\n $t = array();\n $v = array();\n for($x = 0; $x < count($o); $x++)\n {\n if($o[$x] == $s)\n {\n $t[$x] = $n[$x];\n $v[$x] = 1;\n }\n }\n $u = min($t);\n for($x = 0; $x < count($o); $x++)\n {\n if(($n[$x] == $u) && ($v[$x] == TRUE))\n {\n break;\n }\n }\n print $m[$x] . \":\" . $n[$x];\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "faca4ff41695c7c9ea662cc92bbb3686", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($d2 <= 0))\n {\n $l = 1;\n break;\n }\n elseif($a2 <= 0)\n {\n break;\n }\n}\nif($l == 1)\n{\n print $k;\n}\nelse\n{\n $m = 1000000000;\n for($x = 0; $x <= 100; $x++)\n {\n for($y = 0; $y <= ($e - $c); $y++)\n {\n $a2 = $a;\n $b2 = $b + $x;\n $c2 = $c + $y;\n $d2 = $d;\n $n = 0;\n while(TRUE)\n {\n $a2 -= ($e - $c2);\n $d2 -= ($b2 - $f);\n if(($a2 > 0) && ($d2 <= 0))\n {\n $m = min($m, ($x * $h) + ($y * $i) + $n);\n break;\n }\n elseif($a2 <= 0)\n {\n $o = 1 - $a2;\n $a2 += ($e - $c2) + $o;\n $d2 += ($b2 - $f);\n $n += ($o * $g);\n }\n }\n }\n }\n print ($m + $k);\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "49d10488d5546f88b58fde3531822e15", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "dp", "implementation"], "code_uid": "b5e2ce4833b960f272b130fa9030a24c", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation", "number theory"], "code_uid": "2349ddee03f750dbccfff5fce9a2b6f8", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $f)\n{\n $g = array_slice($d, 0, $f);\n $h = array_slice($d, $f);\n $i = array_merge($b, $g);\n $h2 = array_unique($h);\n sort($h2);\n if((count($h2) == 1) && ($h2[0] == 0))\n {\n $j = $i;\n if(count($j) == 1)\n {\n print implode($j);\n }\n else\n {\n $k = count($j);\n for($x = 0; $x < $k; $x++)\n {\n if($j[$x] == 0)\n {\n unset($j[$x]);\n }\n else\n {\n break;\n }\n }\n print implode($j);\n }\n }\n else\n {\n array_push($i, \".\");\n $j = array_merge($i, $h);\n if($j[1] == \".\")\n {\n print implode($j);\n }\n else\n {\n $k = count($j);\n for($x = 0; $x < $k; $x++)\n {\n if($j[$x] == 0)\n {\n unset($j[$x]);\n }\n else\n {\n break;\n }\n }\n print implode($j);\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "strings", "implementation"], "code_uid": "7ee0e53f87ae63787a409c137a20a5dd", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0)\n{\n if(($c <= $a) && ($d <= $b))\n {\n $e++;\n }\n $c--;\n $d++;\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "417fb4abc3a6845fe98164d98a4fce93", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "48d5ea94607596f2e4a061bfadfd00fa", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val) {\n\tif (DEBUG) {\n\t\techo $prev + 1 . \"-\" . $key . \"\\n\";\n\t}\n\n\tif (is_null($prev) || $prev + 1 < $key) {\n\t\t$prev = $key;\n\t\t$answer += $key;\n\t\t$string .= chr($key + 96);\n\t\tif (strlen($string) === $k) {\n\t\t\t$bool = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (DEBUG) {\n\t\techo $string . PHP_EOL;\n\t}\n\n}\n\nif ($bool === false) {\n\techo \"-1\";\n} else {\n\tif (DEBUG) {\n\t\techo $string . PHP_EOL;\n\t}\n\n\techo $answer;\n}\n", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "98d3ab5b464e63179fa3f0330687a78d", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3ebd2552dac96ee5f466a265b9612a4f", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["two pointers", "implementation"], "code_uid": "06c061c75755b427a8b5d1129e6bf8b7", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1, 2 => 1, 3 => 0);\n$c = 0;\nfor($x = 1; $x <= $a; $x++)\n{\n $d = trim(fgets(STDIN));\n if($b[$d] == 1)\n {\n if($d == 1)\n {\n $b[1] = 1;\n if($b[2] == 0)\n {\n $b[2] = 1;\n }\n elseif($b[2] == 1)\n {\n $b[2] = 0;\n }\n if($b[3] == 0)\n {\n $b[3] = 1;\n }\n elseif($b[3] == 1)\n {\n $b[3] = 0;\n }\n }\n elseif($d == 2)\n {\n $b[2] = 1;\n if($b[1] == 0)\n {\n $b[1] = 1;\n }\n elseif($b[1] == 1)\n {\n $b[1] = 0;\n }\n if($b[3] == 0)\n {\n $b[3] = 1;\n }\n elseif($b[3] == 1)\n {\n $b[3] = 0;\n }\n }\n elseif($d == 3)\n {\n $b[3] = 1;\n if($b[1] == 0)\n {\n $b[1] = 1;\n }\n elseif($b[1] == 1)\n {\n $b[1] = 0;\n }\n if($b[2] == 0)\n {\n $b[2] = 1;\n }\n elseif($b[2] == 1)\n {\n $b[2] = 0;\n }\n }\n }\n else\n {\n $c = 1;\n break;\n }\n}\nif($c == 0)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e3d6cc547403464959f461d2ae6d8232", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 2) && ($j[0] >= $c) && ($j[count($j) - 1] <= $d))\n{\n print \"Correct\";\n}\nelse\n{\n print \"Incorrect\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c75ccca36ffc7d1cfd6ee2df61aac07e", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "edd842506e3fad641b3ef677646175bf", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "406178837c6d237aa7790497cd79aa31", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c) && ($d >= $b))\n {\n print \"Polycarp\";\n }\n elseif(($d > $c) && ($d < $b))\n {\n print \"Vasiliy\";\n }\n elseif(($d <= $c) && ($c >= $b))\n {\n print \"Polycarp\";\n }\n elseif(($d <= $c) && ($c < $b))\n {\n print \"Vasiliy\";\n }\n}\nelseif($b == 0)\n{\n if(($d > $c) && ($d >= $a))\n {\n print \"Polycarp\";\n }\n elseif(($d > $c) && ($d < $a))\n {\n print \"Vasiliy\";\n }\n elseif(($d <= $c) && ($c >= $a))\n {\n print \"Polycarp\";\n }\n elseif(($d <= $c) && ($c < $a))\n {\n print \"Vasiliy\";\n }\n}\nelseif($c == 0)\n{\n if(($a + $b) <= $d)\n {\n print \"Polycarp\";\n }\n else\n {\n print \"Vasiliy\";\n }\n}\nelseif($d == 0)\n{\n if(($a + $b) <= $c)\n {\n print \"Polycarp\";\n }\n else\n {\n print \"Vasiliy\";\n }\n}\nelseif(($a <= $c) && ($b <= $d))\n{\n print \"Polycarp\";\n}\nelseif(($a >= $c) && ($b >= $d))\n{\n print \"Vasiliy\";\n}\nelse\n{\n if(($d > $c) && ($d >= $a + $b))\n {\n print \"Polycarp\";\n }\n elseif(($d > $c) && ($d < $a + $b))\n {\n print \"Vasiliy\";\n }\n elseif(($d <= $c) && ($c >= $a + $b))\n {\n print \"Polycarp\";\n }\n elseif(($d <= $c) && ($c < $a + $b))\n {\n print \"Vasiliy\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "games"], "code_uid": "5d0208c9d22f6dab097eddc344839cee", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $i) {$res += (($r - ($r % 3)) / 3) + (($g - ($g % 3)) / 3) + (($b - ($b % 3)) / 3) - $i;}\n\t$max = ($max < $res) ? $res : $max;\n\t$res = $min;\n\t$r -= $i;\n\t$g -= $i;\n\t$b -= $i;\n}\n\necho $max;", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "e7e042c957a99e72ad238000f3f5960d", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n if($c > 0)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j + 2;\n }\n else\n {\n if($l == 0)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j + 1;\n $l = 1;\n }\n elseif($l == 1)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j;\n }\n }\n }\n else\n {\n if($c > 0)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j + 1;\n }\n else\n {\n if($k == 0)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j;\n $k = 1;\n $m = 1;\n }\n elseif($k == 1)\n {\n if($m == 0)\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j - 1;\n $m = 1;\n }\n else\n {\n $j = $h[count($h) - 1];\n $h[count($h)] = $j - 2;\n }\n }\n }\n }\n}\nprint array_sum($h);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "geometry"], "code_uid": "fdfda89c8f63957a386c0db8bcb527b9", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "geometry"], "code_uid": "33a8174b078ab4c05054299e632e281f", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n if($d >= 10)\n {\n $c--;\n $d -= 10;\n $e++;\n }\n else\n {\n break;\n }\n }\n else\n {\n break;\n }\n}\nif($c > 0)\n{\n $f = $c + $d;\n $g = floor($f / 11);\n $h = $e + $g;\n print $h;\n}\nelse\n{\n print $e;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "ad9731fd2d9c90f56255e23be327021b", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "9aae5b9112dd6258859f282f61763db3", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "greedy"], "code_uid": "5400e63e4c4735ab21e110b6142f6dac", "src_uid": "76659c0b7134416452585c391daadb16", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "6224024a589188fe1ff8e724756fc265", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0) {\n\t\tif ($d[$a] >= 0) {\n\t\t\tarray_push($b, $d[$a]);\n\t\t} else {\n\t\t\tarray_push($c, $d[$a]);\n\t\t}\n\t\t$a--;\n\t}\n\techo (array_sum($b) - array_sum($c));\n?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "cbf4b98bb98d3d8e23a50b4e268bf270", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "strings", "dp", "brute force"], "code_uid": "452b74aed16c8eb0c5d4542b43c437d6", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $val) {\n $cont = 1;\n $temp = $val;\n while ($temp != ($key + 1)) {\n ++$cont;\n if ($cont > 100) {\n exit('-1');\n }\n $temp = $arr[$temp - 1];\n }\n if ($cont % 2 == 0) {\n $cont /= 2;\n }\n $ans = $ans * $cont / gcd($ans, $cont);\n}\necho $ans;\n?>\n", "lang_cluster": "PHP", "tags": ["dfs and similar", "math"], "code_uid": "702905000bae263292d2789cbc93ff58", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $v) {\n if ($k != 0) {\n $i += 9 - $v;\n }\n }\n echo $i;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a4a2b64aab730db5f34fd1cde383f04e", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1);\nwhile(TRUE)\n{\n $a = intval($a);\n $a += 1;\n while(TRUE)\n {\n $a = strval($a);\n if($a[strlen($a) - 1] == 0)\n {\n $a = substr($a, 0, -1);\n }\n else\n {\n break;\n }\n }\n if($c[$a] == 1)\n {\n break;\n }\n else\n {\n $b++;\n $c[$a] = 1;\n }\n}\nprint $b;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "98c04859f627314744e650dcc2ddc941", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "9162c272c5395b8537e3f41e1a65d8c0", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $x = array_shift($cost);\n $B -= $x;\n if ($B >= 0) {\n $ans++;\n } else {\n break;\n }\n}\necho $ans;", "lang_cluster": "PHP", "tags": ["sortings", "dp", "greedy"], "code_uid": "3c2cf0947e1ea81c8f4428e8432ba530", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n {\n $j = 1;\n print $x;\n break;\n }\n }\n if($j == 0)\n {\n print count($h);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "dp", "greedy"], "code_uid": "5cc94880c4a1503adca9845e15c1bd7f", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 7))\n {\n $b = FALSE;\n }\n }\n else\n {\n $b = FALSE;\n }\n }\n else\n {\n $b = FALSE;\n }\n if($b == TRUE)\n {\n print \"byte\";\n }\n else\n {\n print \"short\";\n } \n}\nelseif((strlen($a) > 3) && (strlen($a) < 5))\n{\n print \"short\";\n}\nelseif(strlen($a) == 5)\n{\n $b = TRUE;\n if($a[0] > 3)\n {\n $b = FALSE;\n }\n else\n {\n if(($a[0] == 3) && ($a[1] <= 2))\n {\n if(($a[0] == 3) && ($a[1] == 2) && ($a[2] <= 7))\n {\n if(($a[0] == 3) && ($a[1] == 2) && ($a[2] == 7) && ($a[3] <= 6))\n {\n if(($a[0] == 3) && ($a[1] == 2) && ($a[2] == 7) && ($a[3] == 6) && ($a[4] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 3) && ($a[1] == 2) && ($a[2] == 7) && ($a[3] > 6))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 3) && ($a[1] == 2) && ($a[2] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 3) && ($a[1] > 2))\n {\n $b = FALSE;\n }\n }\n if($b == TRUE)\n {\n print \"short\";\n }\n else\n {\n print \"int\";\n } \n}\nelseif((strlen($a) > 5) && (strlen($a) < 10))\n{\n print \"int\";\n}\nelseif(strlen($a) == 10)\n{\n $b = TRUE;\n if($a[0] > 2)\n {\n $b = FALSE;\n }\n else\n {\n if(($a[0] == 2) && ($a[1] <= 1))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] <= 4))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] <= 7))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] <= 4))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] <= 8))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] <= 3))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] == 3) && ($a[7] <= 6))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] == 3) && ($a[7] == 6) && ($a[8] <= 4))\n {\n if(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] == 3) && ($a[7] == 6) && ($a[8] == 4) && ($a[9] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] == 3) && ($a[7] == 6) && ($a[8] > 4))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] == 3) && ($a[7] > 6))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] == 8) && ($a[6] > 3))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] == 4) && ($a[5] > 8))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] == 7) && ($a[4] > 4))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] == 4) && ($a[3] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] == 1) && ($a[2] > 4))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 2) && ($a[1] > 1))\n {\n $b = FALSE;\n }\n }\n if($b == TRUE)\n {\n print \"int\";\n }\n else\n {\n print \"long\";\n } \n}\nelseif((strlen($a) > 10) && (strlen($a) < 19))\n{\n print \"long\";\n}\nelseif(strlen($a) == 19)\n{\n $b = TRUE;\n if($a[0] <= 9)\n {\n if(($a[0] == 9) && ($a[1] <= 2))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] <= 2))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] <= 3))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] <= 3))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] <= 7))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] <= 2))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] <= 0))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] <= 3))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] <= 6))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] <= 8))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] <= 5))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] <= 4))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] <= 7))\n { \n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] <= 7))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] <= 5))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] == 5) && ($a[16] <= 8))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] == 5) && ($a[16] == 8) && ($a[17] <= 0))\n {\n if(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] == 5) && ($a[16] == 8) && ($a[17] == 0) && ($a[18] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] == 5) && ($a[16] == 8) && ($a[17] > 0))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] == 5) && ($a[16] > 8))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] == 7) && ($a[15] > 5))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] == 7) && ($a[14] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] == 4) && ($a[13] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] == 5) && ($a[12] > 4))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] == 8) && ($a[11] > 5))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] == 6) && ($a[10] > 8))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] == 3) && ($a[9] > 6))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] == 0) && ($a[8] > 3))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] == 2) && ($a[7] > 0))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] == 7) && ($a[6] > 2))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] == 3) && ($a[5] > 7))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] == 3) && ($a[4] > 3))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] == 2) && ($a[3] > 3))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] == 2) && ($a[2] > 2))\n {\n $b = FALSE;\n }\n }\n elseif(($a[0] == 9) && ($a[1] > 2))\n {\n $b = FALSE;\n }\n }\n else\n {\n $b = FALSE;\n }\n if($b == TRUE)\n {\n print \"long\";\n }\n else\n {\n print \"BigInteger\";\n } \n}\nelse\n{\n print \"BigInteger\";\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "f1ab16f43a31e4436fa9eb24484ad17b", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "d779b015fbbbd9a6a79667be601a631c", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 12) $n1 -= 12;\n $ans1 = $n1 * 30 + $n2 / 2; \n $ans2 = $n2 * 6;\n echo $ans1.\" \". $ans2;\n?>\n", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "f82cbe2ab744261a2a2a4ace13ba6245", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c) && ($x == $a))\n {\n $f = 1;\n break;\n }\n elseif($b > $c)\n {\n $c += $d[$e] - 1;\n $e++;\n }\n else\n {\n break;\n }\n}\nif($f == 1)\n{\n print \"-1\";\n}\nelse\n{\n print $e;\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "137feb020021cea7c8649a7d5720b790", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " insert($c[$x]);\n }\n else\n {\n while(TRUE)\n {\n $g = $d -> top();\n $b += $g;\n $d -> extract();\n $f++;\n $h[count($h)] = $g;\n if($b >= $c[$x])\n {\n $e .= $f . \" \";\n $b -= $c[$x];\n $d -> insert($c[$x]);\n for($y = 0; $y < count($h); $y++)\n {\n $d -> insert($h[$y]);\n $b -= $h[$y];\n }\n $f = 0;\n $h = array();\n break;\n }\n }\n }\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["sortings", "greedy"], "code_uid": "ad759dbff01fa19d90cdeb5dd7e369c8", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "3b5fcf8c6cd53c772a46c4eb897ad8f9", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0, "exec_outcome": "PASSED"}