{"lang": "PHP", "source_code": "= 0) {\n $result++;\n }\n }\n}\necho $result;\n?>", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "253faac134fb53f380428bff1196315b", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "a73df1fa6c1941327cb58fe802a06347", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$participate&&$notebook>=$participate)\n\techo \"Yes\";\nelse\n\techo \"No\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "8e3d9e3f7775180c59ae9e2b6edd8868", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e27c63ee284cbf027f172171775353f5", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "f9d8a0e2d71d133aaf091c48ea10efa9", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings"], "code_uid": "8399dca56dca1773081490b9fce41fb0", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "797fae55411b5b6d93982ad729ed2c49", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "6ff815e9a92bfd6a80a98322fc987d23", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "74e43a99211c51834714ba1234024b9e", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $j--) {\n if ($arr[$j] === 0) {\n $arr[$j] = 9;\n $arr[$j - 1]--;\n }\n if ($arr[$j] === -1) {\n $arr[$j] = 9;\n $arr[$j - 1]--;\n }\n }\n if ($arr[0] === 0) {\n unset($arr[0]);\n }\n $max = max($max, $arrayMultiply($arr));\n}\n\necho $max;\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "08dbbebbf4c127ef2e25f11b33a68cfb", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n if(($a[$x] != 0) && ($a[$x] != 1))\n {\n $e = array_slice($a, 0, $x);\n $f = $a[$x] - 1;\n $e = array_merge($e, array($f));\n for($y = $x + 1; $y < count($a); $y++)\n {\n $e[count($e)] = 9;\n }\n $g = array_product($e);\n if($g > $d)\n {\n $d = $g;\n }\n $a = $a2;\n }\n}\nprint max($b, $c, $d);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "bb0c29f35b20a1a910fcbcfed29e4239", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $sV){\n if($sK != 0){\n $iCount += 9 - $sV;\n }\n }\n}\n\necho $iCount;\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5caa44f937392ab3d7b2fca2fa6c0091", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $limit)\n {\n {\n if ($grade[$c] > 0)\n {\n $result++;\n }\n }\n }\n}\nprint \"$result\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f52e7d8ec760774fc4be56ce4fee295d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 && (int) $result >= (int) $input['results'][$input['k'] - 1]) {\n $i++;\n } else {\n break;\n }\n }\n dataProvider::set($i);\n\n\n class dataProvider\n {\n public static function get()\n {\n $stdin = file_get_contents('php://stdin');\n $lines = explode(\"\\n\", $stdin, 2);\n $lines[0] = explode(' ', $lines[0], 2);\n $lines[1] = explode(' ', $lines[1]);\n return array(\n 'n' => intval($lines[0][0]),\n 'k' => intval($lines[0][1]),\n 'results' => $lines[1],\n );\n }\n\n public static function set($data)\n {\n file_put_contents('php://stdout', $data);\n }\n }\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "997856a6977b01e6f4d2ef0720d4ea7f", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n while ($k != $n)\n {\n if ($k > $n)\n $k -= $n;\n else\n $n -= $k;\n }\n \n if ($sem)\n {\n $sem = false;\n $k = $b;\n }\n else\n {\n $sem = true;\n $k = $a;\n } \n \n $n = $nn - $n; \n $nn = $n; \n if ($n <= 0)\n {\n switch ($sem)\n {\n case true:\n echo \"1\";\n break;\n case false:\n echo \"0\";\n break;\n }\n break;\n } \n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ab89fcff33b7365605ae1d82521a63b2", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b && $a > 0) {\n $a -= $b;\n }\n if($a === 0) {\n return $b;\n }\n }\n}\n\n$i = explode(' ',trim(fgets(STDIN)));\n$a = intval($i[0]);\n$b = intval($i[1]);\n$n = intval($i[2]);\n$cur = 1;\nwhile(1) {\n if( ($cur%2) !== 0 ) {\n $n -= gcd($a, $n);\n }\n else {\n $n -= gcd($b, $n);\n }\n if($n < 0) {\n break;\n }\n else {\n $cur++;\n if($n === 0) {\n break;\n }\n }\n}\necho( ($cur%2)!==0?'1':'0' );\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fe23c46d3e4600edcfe2dc37d3826f0d", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "366f8bd7a12c5be0a2873bfc873418dc", "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": "29e3d256769c869b07b268bcf07597d4", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$d){\n echo \"-1\";\n}else{\n $j = floor(($d-$s)/5) + ($n-1)*2;\n echo \"$j\";\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "e89acf3ceb1698f6b644df46758d1303", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $times){\n print \"-1\" ;\n \n}\nelse{\n print intval(($times - array_sum($t))/5);\n}\n\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "f48c3319b0f771563e55ba3880b3d31d", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "7cde592b1761c0ef24e12f717e0b4d2f", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fe6140955d526e902e433b7c8095ae6f", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $i, 'y' => $j); \n }\n }\n\n return false;\n}\n\n\n$matrix = array();\nfor ($i = 0; $i < 5; $i++) {\n $matrix[$i] = explode(' ', fgets(STDIN));\n}\n\n$point = findOne($matrix);\n\necho abs($point['x'] - 2) + abs($point['y'] - 2);\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b8de9e9bc67611c5cebe99d903343eea", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b1f08ea0a634418bf54c59b4ead74f31", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\n\t$star = 1 + 6 * ($A * $A - $A); \n\t\n\tprintf(\"%.0f\", $star);\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": ["combinatorics"], "code_uid": "b360e73fe00249b2be8fca0c796fe58f", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "86737ca234a0eef890e5110bc8835dd3", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "3d07a961e8e8a10d503f25af19308aa4", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "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\t$ans = 0;\n\t$d = 0;\n\tfor($x = 0; $x < strlen($a); $x++)\n\t{\n\t\t$e = $b[$a[$x]];\n\t\t$f = abs($e - $d);\n\t\t$g = 26 - $f;\n\t\t$ans += min($f, $g);\n\t\t$d = $e;\n\t}\n\tprint $ans;\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "a75f31e8af8922e8bd6e40b3871b03e6", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=1){\nforeach ($array as $key => $value) {\n if(key_exists($key+1,$array)){\n if($value == 'B' and $array[$key+1] == 'G'){\n $x=$array[$key];\n $array[$key]=$array[$key+1];\n $array[$key+1]=$x;\n }\n }\n}\n$a--;\n}\necho join('',$array);", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "d258dcae2ae205176744d137cbecc214", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " (strlen($word)/2))? strtoupper($word) : strtolower($word));", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "ab978433948cbe184c1af46bf495e772", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=preg_match_all('/[A-Z]/',$s,$o))\n print strtolower($s); else print strtoupper($s);\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "03313e834bb7580a476e16e87401d999", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2c0bfa716f40c798c4e660e1816606fd", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["constructive algorithms", "graphs"], "code_uid": "9300749b2da434e708e6dff48931b5bf", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "5cf245c10953c0f43cdc76a944b04a13", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 8) {\n fputs($stdout, \"draw\");\n return;\n }\n \n if($crosses > $nulls) {\n fputs($stdout, \"second\");\n } else {\n fputs($stdout, \"first\");\n }\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "7c0d2ca0cb4a5af1c2fe216699079f2e", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $k) || (($n == 1) && ($o == 1)) || (($k > $l) && ($o == 1)) || (($k == $l) && ($n == 1)) || ((($k - $l) > 1) && ($n == 1)) || (($k - $l) > 1))\n{\n $p = 1;\n}\nif($m == 0)\n{\n $r = 1;\n}\nif($k == $l)\n{\n $s = 1;\n}\nif($k > $l)\n{\n $t = 1;\n}\nif($p == 1)\n{\n print \"illegal\";\n}\nelseif($n == 1)\n{\n print \"the first player won\";\n}\nelseif($o == 1)\n{\n print \"the second player won\";\n}\nelseif($r == 1)\n{\n print \"draw\";\n}\nelseif($s == 1)\n{\n print \"first\";\n}\nelseif($t == 1)\n{\n print \"second\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "games"], "code_uid": "f547a80b7df05529a2ac3e4d0e96d72d", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.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": "700ac08787be8a354bab33e62401f6fe", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "343d5cc591dd70fa72476af7847ad6da", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 6) {\n \n echo \"YES\";\n \n $done = true;\n \n break;\n \n }\n \n $count = 1;\n \n }\n \n}\n\nif($done == false) {\n \n echo \"NO\";\n \n}\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "5f38ed703bc531492f145dbca3ce9eca", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 6) $b = 'YES';\n}\nprint($b);\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b57de4e18421b4f7472c86a427cf1de5", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9910adb6d495566b397ced0bae058989", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 100)\n\t{\n\t\t$s -= 100;\n\t\t$n++;\n\t}\n\telse if($s >= 20)\n\t{\n\t\t$s -= 20;\n\t\t$n++;\n\t}\n\telse if($s >= 10)\n\t{\n\t\t$s -= 10;\n\t\t$n++;\n\t}\n\telse if($s >= 5)\n\t{\n\t\t$s -= 5;\n\t\t$n++;\n\t}\n\telse if($s >= 1)\n\t{\n\t\t$s -= 1;\n\t\t$n++;\n\t}\n\telse\n\t{\n\t\techo $n;\n\t\tbreak;\n\t}\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "d1b367056b9f842ef9b4c3fa4a1d1733", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "solution($n);\n// End of interface\n\nclass MainClass {\n\t//996-A. Hit the Lottery\n\tpublic $problemLink = 'https://codeforces.com/problemset/problem/996/A';\n\tpublic $submissionLink = '';\n\n\tpublic function solution($n){\n\t\t$denominations = [1, 5, 10, 20, 100];\n\t\t$res = 0;\n\t\t$remainder = $n;\n\t\tforeach (array_reverse($denominations) as $value){\n\t\t\t$intQuotient = intval($remainder/$value);\n\t\t\t$currentReminder = $remainder % $value;\n\t\t\tif ($intQuotient > 0){\n\t\t\t\t$res = $res + $intQuotient;\n\t\t\t};\n\t\t\tif ($currentReminder >= 0){\n\t\t\t\t$remainder = $currentReminder;\n\t\t\t}\n\t\t}\n\t\treturn $res;\n\t}\n}\n", "lang_cluster": "PHP", "tags": ["greedy", "dp"], "code_uid": "31b754b4901c5ae59bb2a6eaf0370cca", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4219c8ab7599030b384cda082dda8fdd", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "149b8eda1c99a28d5ba562df51380c9e", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "9662f83ffa1c8cb4b304d53f25fbd60c", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "probabilities"], "code_uid": "abe92a0578f54865fca082eea00ffcb8", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $g)\n{\n print \"Second\";\n}\nelseif($f == $g)\n{\n print \"Friendship\";\n}\nelseif($f < $g)\n{\n print \"First\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "37234fc2cd9e0e5c9c52a00c74d7879a", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "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($s, $v1, $v2, $t1, $t2) = array_map('trim', readStringExplode($f, ' '));\n\t$answer1 = $t1 * 2 + $v1 * $s;\n\t$answer2 = $t2 * 2 + $v2 * $s;\n\tif ($answer1 < $answer2) {\n\t\techo 'First';\n\t} elseif ($answer1 > $answer2) {\n\t\techo 'Second';\n\t} else {\n\t\techo 'Friendship';\n\t}\n\n\t/* / end body */\n}\n\nif (!isset($is_test)) {\n\t$is_test = false;\n}\nif (empty($is_test)) {\n\tgetAnswer();\n}", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "aace53f67a5ef2c60f0e9bad73f13425", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "_fh = $fileHandler;}\n\tpublic function readString() {$d = trim(fgets($this->_fh));return $d;}\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\nclass Utils {\n\t/* Perform action N times. Can return values in array */\n\tstatic public function ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}\n\t/* Integral. Keys preserved. By reference. */\n\tstatic public function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}\n\t/* Difference. Keys preserved. By reference. */\n\tstatic public function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}\n\tstatic public function bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}\n}\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$s = $ir->readString();\n\n$t = [];\n$i = 0;\n$k = 1;\nwhile ($i<$n) {\n\t$t[] = $s[$i];\n\t$i+=$k;\n\t$k+=1;\n}\n\necho implode('', $t);\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "358a4154166266a413e99d54e7f9e8f3", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f62e0ae6c6935d1f6257b11030aea75d", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "120a59024a73363343f3f9675eff773f", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) && ($d > 0) && ($e > 0))\n{\n print \"BGR\";\n}\nelseif(($c > 1) && ($d == 1) && ($e == 0))\n{\n print \"GR\";\n}\nelseif(($c > 1) && ($d == 0) && ($e == 1))\n{\n print \"GR\";\n}\nelseif(($c == 0) && ($d > 1) && ($e == 1))\n{\n print \"BR\";\n}\nelseif(($c == 1) && ($d > 1) && ($e == 0))\n{\n print \"BR\";\n}\nelseif(($c == 0) && ($d == 1) && ($e > 1))\n{\n print \"BG\";\n}\nelseif(($c == 1) && ($d == 0) && ($e > 1))\n{\n print \"BG\";\n}\nelseif(($c > 1) && ($d > 1))\n{\n print \"BGR\";\n}\nelseif(($d > 1) && ($e > 1))\n{\n print \"BGR\";\n}\nelseif(($c > 1) && ($e > 1))\n{\n print \"BGR\";\n}\nelseif(($c > 0) && ($d == 0) && ($e == 0))\n{\n print \"B\";\n}\nelseif(($c == 0) && ($d > 0) && ($e == 0))\n{\n print \"G\";\n}\nelseif(($c == 0) && ($d == 0) && ($e > 0))\n{\n print \"R\";\n}\nelseif(($c > 0) && ($d > 0) && ($e == 0))\n{\n print \"R\";\n}\nelseif(($c > 0) && ($d == 0) && ($e > 0))\n{\n print \"G\";\n}\nelseif(($c == 0) && ($d > 0) && ($e > 0))\n{\n print \"B\";\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "dp", "constructive algorithms"], "code_uid": "2fc5d23af011053f2190a8a1ea8d7f92", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2))\n echo \"YES\".\"\\n\";\n else\n echo \"NO\".\"\\n\";\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "174f8c262df7f7130120d056785ddd7f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 2 ? 'YES' : 'NO';", "lang_cluster": "PHP", "tags": ["brute force", "math"], "code_uid": "d3ba3e9e79c10d3f078d0665b3f4506b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "169a1c7b9d303f2868c5eaca3b3dfeab", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "ce276c121725194b82c42f04ddba0256", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "27adf0cc93a6127b6b681d75cb311251", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "number theory"], "code_uid": "3c9d4c3ccaae8c780c0addbda84a0e2a", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b359373b87c4918eb54836a96d3c4ad7", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "35f95b8e0ec7f383232d170e93f038d4", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $half_multi_ride+$other_half_two)\n\t\t\t\t\t$multi_ride = $half_multi_ride+$other_half_two;\n\t\t\t\telse\n\t\t\t\t\t$multi_ride = $half_multi_ride+$other_half_one;\n\t\t\t}else{\n\t\t\t\t$multi_ride = ((int)($n/$m))*$b;\n\t\t\t}\n\t\t}else{\n\t\t\t$multi_ride = $b;\n\t\t}\n\t\tif($one_ride > $multi_ride)\n\t\t\treturn $multi_ride;\n\t\telse\n\t\t\treturn $one_ride;\n\t}\n\t\n\t$handle = fopen(\"php://stdin\", 'r');\n\t$readAll = stream_get_contents($handle);\n\t$contents = explode(' ', $readAll);\n\techo process($contents[0], $contents[1], $contents[2], $contents[3]);\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f1977150f99f64225f9fb0738acb147f", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "ca1225128577a47e08c67d4835080cd9", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "0fda6e35c4cc8f43d72373e460de7571", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "25", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "d293231fc1566257c150acbdd283d323", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "efe35abd92e41f4fa0ae26908fb9c8b9", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "6f480ba19427ed7434fc750fd720e0c0", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "9883a3a4f94f6591852255e4228fd91e", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "4746af893baabefb3c99470143aaf0a4", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.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\nfunction eratosphen($n) {\n $isPrime = array();\n for ($i = 0; $i < $n; $i++) {\n $isPrime[$i] = 1;\n }\n\n $isPrime[0] = 0;\n $isPrime[1] = 0;\n\n for ($i = 2; $i * $i < $n; $i++)\n if ($isPrime[$i])\n for ($j = $i * $i; $j < $n; $j += $i)\n $isPrime[$j] = 0;\n\n $simple = array();\n for ($i = 0; $i < $n; $i++) {\n if ($isPrime[$i] == 1) {\n $simple[] = $i;\n }\n }\n\n echo implode(', ', $simple);\n}\n\n$stdin = stdin();\n/****************************************************** Solving block *****************************************************/\n$n = g();\n\n$simple = array(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, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499);\n\nfunction del($num, $simple) {\n $cnt = 0;\n $find = false;\n\n foreach ($simple as $item) {\n if ($item > $num) {\n break;\n }\n\n while (true) {\n if ($num % $item == 0) {\n $num /= $item;\n $find = true;\n } else {\n break;\n }\n }\n\n if ($find) {\n $cnt++;\n $find = false;\n }\n }\n\n return $num == 1 && $cnt == 2;\n}\n\n$sum = 0;\nfor ($num = 0; $num <= $n; $num++) {\n if (del($num, $simple)) {\n $sum++;\n }\n}\n\necho $sum;\n?>", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "94cdc2ce46efc0d1c4406b3ebde38cd8", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "388b7ad5037606d25ae80ef17836afdd", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "faa334ded0a1fc7032a38bab11a3669f", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b &&\n (($a + $b) > $c) &&\n (($a + $c) > $b) &&\n (($c + $b) > $a)\n ) {\n $resultCount++;\n }\n }\n}\n\necho $resultCount;", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "9f0c1223e7ab4a78c358dec0c942a907", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "39dca9d808feda56d10b7610de00c9ea", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "games"], "code_uid": "6e3d997b05ea74ea6ebe34abb64de272", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n $mod32 /= 3;\n $result++;\n}\nwhile (($mod32 % 2) === 0) {\n $mod32 /= 2;\n $result++;\n}\n\necho $mod32 === 1 && $result > 0 ? $result : '-1';\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f77784a5a5aff5c6d19aed72134d41da", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "cd63ea8f0bf0a4088edf520cefb724f9", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $w) {\n break;\n }\n $last = $max;\n $i++; \n}\n$t1 = $w - $last;\n$t3 = floor($t1/pow(2,$i)); \necho( $result[$t3] );\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2ffccf5a111bda29425a1a1dd61eb691", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "def42ae06505bb8b29691701aa4b52f0", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value)\n {\n if (!empty($value))\n {\n $sum = array_sum($value);\n $max = max($value);\n $min = min($value);\n\n if ($sum <= $r && $sum >= $l && $x <= ($max - $min))\n {\n $count++;\n }\n }\n }\n}\n\necho $count;\n\n/**\n * Get all the sub arrays of a given array\n *\n * @param array $difficulties The given array\n *\n * @return array All the sub arrays\n */\nfunction subArrays($difficulties)\n{\n $len = count($difficulties);\n $list = array();\n\n for ($i = 1; $i < (1 << $len); $i++)\n {\n $subArray = array();\n\n for ($j = 0; $j < $len; $j++)\n {\n if ($i & (1 << $j))\n {\n $subArray[] = (int)$difficulties[$j];\n }\n }\n\n $list[] = $subArray;\n }\n\n return $list;\n}", "lang_cluster": "PHP", "tags": ["brute force", "bitmasks"], "code_uid": "c28cd8e6118122c35cdea488627aabae", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "53ffba4d83fc39d6c3d81aa319e9b59f", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " array(2 => 3, 3 => 4), 2 => array(1 => 3), 3 => array(1 => 4));\n $e = 0;\n for($x = 0; $x < $a - 1; $x++)\n {\n $e += $d[$b[$x]][$b[$x + 1]];\n }\n for($x = 0; $x < $a - 2; $x++)\n {\n if(($b[$x] == 3) && ($b[$x + 1] == 1) && ($b[$x + 2] == 2))\n {\n $e--;\n }\n }\n print \"Finite\\n\";\n print $e;\n}\nelse\n{\n print \"Infinite\";\n}\n?>", "lang_cluster": "PHP", "tags": ["geometry"], "code_uid": "23c674f675930842d221218ef3ebb968", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=1 && $len<=1000){\n\t$vowels = \"AOYEUIaoyeui\";\n\tif(preg_match('/[a-zA-Z]+/', $str)){\n\t\t$str = preg_replace('/[^AOYEUIaoyeui\\\\s]/', '.$0', $str);\n\t\t$str = preg_replace('/[AOYEUIaoyeui]/i', '', $str);\n\t\techo strtolower($str);\t\n\t}\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "4774577dd2206370b5a2dd408b746334", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "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$id = g();\n\n$word = \"[a-z0-9_]{1,16}\";\n$correct = preg_match(\"/^$word@(($word\\.)*$word)(\\/$word)?$/i\", $id, $matches);\n$correct = $correct && strlen($matches[1]) && strlen($matches[1]) < 33;\n\necho $correct ? 'YES' : 'NO';\n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "b12553e176ac07b34630ce1e2c8c45eb", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 16))\n {\n print \"NO\";\n }\n else\n {\n array_splice($b, 0, $c);\n if(count($b) == 0)\n {\n print \"NO\";\n }\n else\n {\n array_unshift($b, \" \");\n unset($b[0]);\n $g = array_search(\"/\", $b);\n if($g == 0) ////////// \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0441\u043b\u0435\u0448\u0430 //////////\n {\n if((count($b) < 1) && (count($b) > 32))\n {\n print \"NO\";\n }\n else\n {\n for($x = 1; $x <= count($b); $x++)\n {\n if($f2 == 0)\n {\n break;\n }\n else\n {\n $f2 = 0;\n for($y = 0; $y < count($e2); $y++)\n {\n if($b[$x] == $e2[$y])\n {\n $f2 = 1;\n break;\n }\n }\n }\n }\n if($f2 == 0)\n {\n print \"NO\";\n }\n else\n {\n if(($b[count($b)] == \".\") || ($b[1] == \".\"))\n {\n print \"NO\";\n }\n else\n {\n array_push($b, \".\");\n $j = 0;\n for($x = 1; $x <= count($b); $x++)\n {\n if(($b[$x] == \".\") && ($b[$x + 1] == \".\"))\n {\n $j = 1;\n }\n elseif($b[$x] == \".\")\n {\n $h = array_slice($b, 0, $x - 1);\n array_splice($b, 0, $x);\n $x = 0;\n array_unshift($b, \" \");\n unset($b[0]);\n if((count($h) < 1) && (count($h) > 16))\n {\n $j = 1;\n }\n }\n }\n if($j == 1)\n {\n print \"NO\";\n }\n else\n {\n print \"YES\";\n }\n }\n }\n }\n }\n else ////////// \u0435\u0441\u043b\u0438 \u0441\u043b\u0435\u0448 \u0435\u0441\u0442\u044c //////////\n {\n array_splice($b, $g - 1);\n array_unshift($b, \" \");\n unset($b[0]);\n if((count($b) < 1) && (count($b) > 32))\n {\n print \"NO\";\n }\n else\n {\n for($x = 1; $x <= count($b); $x++)\n {\n if($f2 == 0)\n {\n break;\n }\n else\n {\n $f2 = 0;\n for($y = 0; $y < count($e2); $y++)\n {\n if($b[$x] == $e2[$y])\n {\n $f2 = 1;\n break;\n }\n }\n }\n }\n if($f2 == 0)\n {\n print \"NO\";\n }\n else\n {\n if(($b[count($b)] == \".\") || ($b[1] == \".\"))\n {\n print \"NO\";\n }\n else\n {\n array_push($b, \".\");\n $j = 0;\n for($x = 1; $x <= count($b); $x++)\n {\n if(($b[$x] == \".\") && ($b[$x + 1] == \".\"))\n {\n $j = 1;\n }\n elseif($b[$x] == \".\")\n {\n $h = array_slice($b, 0, $x - 1);\n array_splice($b, 0, $x);\n $x = 0;\n array_unshift($b, \" \");\n unset($b[0]);\n if((count($h) < 1) && (count($h) > 16))\n {\n $j = 1;\n }\n }\n }\n if($j == 1)\n {\n print \"NO\";\n }\n else\n {\n $b = array_slice($b, 0, $g - 1);\n array_unshift($b, \" \");\n unset($b[0]);\n $m = array_search(\"/\", $k);\n $l = array_slice($k, $m);\n for($x = 0; $x < count($l); $x++)\n {\n if($f3 == 0)\n {\n break;\n }\n else\n {\n $f3 = 0;\n for($y = 0; $y < count($e); $y++)\n {\n if($l[$x] == $e[$y])\n {\n $f3 = 1;\n break;\n }\n }\n }\n }\n if(($f3 == 0) || (count($l) > 16) || (count($l) == 0))\n {\n print \"NO\";\n }\n else\n { \n print \"YES\";\n }\n }\n }\n }\n }\n }\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "20d02a63734c867b2292acc8f5bf501a", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $y--)\n {\n $h[$x][$i] = $g[$y][$x];\n $i++;\n }\n}\n$f[1] = $h;\n$j = array();\nfor($x = 0; $x < $a; $x++)\n{\n $i = 0;\n for($y = $a - 1; $y >= 0; $y--)\n {\n $j[$x][$i] = $h[$y][$x];\n $i++;\n }\n}\n$f[2] = $j;\n$k = array();\nfor($x = 0; $x < $a; $x++)\n{\n $i = 0;\n for($y = $a - 1; $y >= 0; $y--)\n {\n $k[$x][$i] = $j[$y][$x];\n $i++;\n }\n}\n$f[3] = $k;\n$o = array();\nfor($x = 0; $x < count($f); $x++)\n{\n $l = $f[$x];\n $m = array();\n $n = 0;\n for($y = $a - 1; $y >= 0; $y--)\n {\n $m[$n] = $l[$y];\n $n++;\n }\n $o[count($o)] = $m;\n $m = array();\n for($y = 0; $y < $a; $y++)\n {\n $n = $l[$y];\n $p = 0;\n for($z = $a - 1; $z >= 0; $z--)\n {\n $m[$y][$p] = $n[$y][$z];\n }\n }\n $o[count($o)] = $m;\n}\n$q = array_merge($f, $o);\n$r = 0;\nfor($x = 0; $x < count($q); $x++)\n{\n $s = $q[$x];\n if($b == $s)\n {\n $r = 1;\n break;\n }\n}\nif($r == 0)\n{\n print \"No\";\n}\nelse\n{\n print \"Yes\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "15be3a212c3b2f54eef87e6b52f43d7f", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "930b65ca875f01b6ab4fd3d4d8aef8e8", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $x--)\n{\n $d = $b[$x] - $b[$x - 1];\n $c[count($c)] = $d;\n}\n$e = array_unique($c);\nif(count($e) == 1)\n{\n print $b[$a - 1] + $d;\n}\nelse\n{\n print $b[$a - 1];\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "fdd2059254c8a281c95e80993bad2a6b", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "08b2283f2c1277937cb7672e1891033f", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n foreach ($arr as $key => &$value) {\n $number = $key + 1;\n $value -= $m;\n if ($value <= 0) unset($arr[$key]);\n }\n unset($value);\n}\n\necho \"$number\\n\";\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b9b89b2d0fd63e4724b18b3202bb94ba", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings"], "code_uid": "77caadc1354746736f59ecc72a61523b", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $bWeight){\n echo \"White\";\n}\nif($wWeight < $bWeight){\n echo \"Black\";\n}\nif($wWeight == $bWeight){\n echo \"Draw\";\n}\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "b6c5bf69d16e2793bd819a4694068a12", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 240) {\n \n echo 0;\n}\n\n$turbo=240 - $min;\n\nfor ($i=1; $i <= $prob; $i++) {\n \n $num += $i * 5;\n \n if ($i == $prob and $num < $turbo) {\n $final = $i;\n break;\n }elseif ($num == $turbo) {\n $final = $i;\n break;\n }elseif ($num > $turbo) {\n $final = $i - 1;\n break;\n }\n \n }\n\nif (!isset($final)) {\n echo 0;\n}else echo $final;\n\n\n\n\n\n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "6145e2959252aca050aafb6bfea3b051", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "153cb54bfae53f1508de92e89ac63ca6", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " array('q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'),\n 1 => array('a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';'),\n 2 => array('z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/'),\n);\n\nfunction generateMap($keyboard) {\n $arr = array();\n foreach ($keyboard as $k1 => $v1) {\n foreach ($v1 as $k2 => $v2) {\n if ($k2 != 0 && $k2 != 9) {\n $tmp = array('L' => $keyboard[$k1][$k2 - 1], 'R' => $keyboard[$k1][$k2 + 1]); \n } else if ($k2 == 0) {\n $tmp = array('R' => $keyboard[$k1][$k2 + 1]);\n } else if ($k2 == 9) {\n $tmp = array('L' => $keyboard[$k1][$k2 - 1]);\n }\n $arr[$v2] = $tmp;\n }\n }\n \n return $arr;\n}\n\n$arr = generateMap($keyboard);\nfscanf(STDIN, \"%s\", $d);\nfscanf(STDIN, \"%s\", $s);\n\n$c = ($d == 'R') ? 'L' : 'R';\n\nfor ($i = 0; $i < strlen($s); $i++) {\n echo $arr[$s[$i]][$c];\n}\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "18aebf8ea101da9fc2be0064f1d1db4a", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $v2) {\n \t\tif(strpos($v2, $input[$i])!==false){\n \t\t\t$input[$i]=$keyboard[$k2][strpos($v2, $input[$i])+$wo];\n \t\t}\n \t}\n }\n return $input;\n}\necho solve($d,$input);\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1fd682624d03cb1131cf7f41503bacd0", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "33dce29a111e52dba0b18ad9c93c8eb1", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $arr) {\n $mapArray[$arr] = $index;\n}\n\n$result = [];\nforeach ($array as $index => $arr) {\n if(isset($mapArray[$arr]) && $mapArray[$arr] != $index) continue;\n $result[] = $arr;\n}\n\necho count($result).\"\\n\";\necho implode(\" \", $result);\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "60e6dde34214320d127f2651950cd227", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "0f8b55482d7e767d38867c25954ffa40", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b37cc9c5dea2ad572c25ec6be5b02d1b", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print $e - ($f * $b);\n}\nelse\n{\n print $e;\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "184c2b49c00ffc362de3b7ea717b3ae4", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "dd495fba53f60d46492a8f981dd5f5ee", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $f)\n {\n if($c[$x] == $b)\n {\n $e++;\n $d = 0;\n $f = $b;\n }\n elseif($c[$x] < $b)\n {\n $e++;\n $d = $c[$x];\n }\n elseif($c[$x] > $b)\n {\n $f += $b;\n }\n }\n elseif(($d < $f) && ($d == $c[$x]))\n {\n $e++;\n }\n}\nprint $e;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5ccdba6498c4d135d71770d8ccf7289a", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n {\n if($e[$x] != 0)\n {\n array_splice($e, $x, 1);\n break;\n }\n }\n }\n }\n}\nif($h == 1)\n{\n print strlen($a) - 1;\n}\nelse\n{\n print $d;\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "2647145830dcc814b257636637e786a4", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "greedy"], "code_uid": "0e69acebb683bfba4f88aab41d4ff9d6", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1, \"tuesday\" => 2, \"wednesday\" => 3, \"thursday\" => 4, \"friday\" => 5, \"saturday\" => 6, \"sunday\" => 7);\n$d = $c[$a];\n$e = $c[$b];\nif($e >= $d)\n{\n $f = $e - $d;\n}\nelse\n{\n $f = 7 - $d + $e;\n}\nif(($f == 0) || ($f == 2) || ($f == 3))\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7f008dfb20fed6ad8237c6bd3d23ee32", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0, 'p' => 0, 's' => 0);\n foreach($n as $k => $v){\n $arr[$v[1]] += 1; \n }\n arsort($arr);\n if(reset($arr) == 1){\n echo 2;\n } else if (reset($arr) == 2) {\n foreach($n as $sk => $sv){\n if($sv[1] == array_keys($arr)[0]) {\n $a[] = $sv[0];\n }\n }\n if(abs($a[0] - $a[1]) <= 2) {\n echo 1;\n } else {\n echo 2;\n }\n } else if(reset($arr) == 3) {\n foreach($n as $sk => $sv){\n if($sv[1] == array_keys($arr)[0]) {\n $a[] = $sv[0];\n }\n }\n $b = array_count_values($a);\n arsort($b);\n if(max($a) - min($a) == 0) {\n echo 0;\n } else if (max($a) - min($a) == 2) {\n if(reset($b) < 2) {\n echo 0;\n }else{\n echo 1;\n }\n } else if (max($a) - min($a) > 2){\n $b = array_count_values($a);\n arsort($b);\n $d = array_keys($b);\n sort($d);\n $m1 = $d[0]+1;\n $m2 = $d[2]-1;\n $m3 = $d[1]+1;\n $m4 = $d[1]-1;\n if(reset($b) < 2) {\n if(in_array($m1, $d) || in_array($m2, $d) || in_array($m3, $d) || in_array($m4, $d) || ($m1 == $m4) || ($m3 == $m2)){\n echo 1;\n } else {\n echo 2;\n }\n } else {\n echo 1;\n }\n } else {\n echo 1;\n }\n }\n\n ?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "ea3620248e0b5e9c01d6ceb1c30ad09f", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 6)\n{\n print \"yes\";\n}\nelse\n{\n print \"no\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0e767f1dbbd9eb143a28ed2d1d19c60b", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 21) {\n echo 0;\n} else {\n $accessPoints = array(1 => 4,\n 2 => 4,\n 3 => 4,\n 4 => 4,\n 5 => 4,\n 6 => 4,\n 7 => 4,\n 8 => 4,\n 9 => 4,\n 10 => 15,\n 11 => 4\n );\n $key = $points - 10;\n echo $accessPoints[$key];\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "783406c0604e863a17e411bf2b014d4a", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0;$i--){\n for($j=$n-1;$j>=0;$j--){\n\t\tif ($cube[$i] > $cube[$j]){\n\t\t\t$sisa = $cube[$i] - $cube[$j];\n\t\t\t$cube[$j] += $sisa;\n\t\t\t$cube[$i] -= $sisa;\n\t\t}\n\t}\n}\nforeach($cube as $value){\n\techo $value . \" \";\n}\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "05a56e1ed6f0c29c25b20a94f7f2c259", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "7b7e859014f6805ed4c96d7e364a60be", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $g)\n {\n print \"1\";\n break;\n }\n elseif(($f == $g) && ($x == strlen($a) - 1))\n {\n print \"0\";\n break;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "7840cc6e82ef8e44adc39a1499649959", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $s)\n print \"NO\";\nelse\n print \"YES\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c9c518d9bbde2ec6d8198d1533c4802f", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "eb4b4b6b20d44897c32b65177678e18d", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "f51dd75652c5dada536476139538ef31", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $i--) { \n\t\t\t echo $array[$i];\n\t}\n?>", "lang_cluster": "PHP", "tags": ["math", "sortings", "greedy"], "code_uid": "7c72383d20034a583a8a12d0ced8f9fe", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c[$d])\n {\n array_push($b, $c[$d]);\n array_push($b, $b[$d]);\n unset($c[$d]);\n unset($b[$d]);\n $d++;\n if(count($c) == 0)\n {\n $e = 1;\n break;\n }\n }\n else\n {\n array_push($c, $b[$d]);\n array_push($c, $c[$d]);\n unset($b[$d]);\n unset($c[$d]);\n $d++;\n if(count($b) == 0)\n {\n $e = 2;\n break;\n }\n }\n}\nif($e == 0)\n{\n print \"-1\";\n}\nelseif($e == 1)\n{\n print $x . \" 1\";\n}\nelseif($e == 2)\n{\n print $x . \" 2\";\n}\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "brute force", "games"], "code_uid": "657b378dd6c33a4dc99bd8c57dea70ec", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "db67cf2a47fbbc671794cceeb6eef71c", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n\t\tforeach ($lucky as $l) {\n\t\t\tif ((int)$var % $l == 0) {\n\t\t\t\techo 'YES';\n\t\t\t\t$flag = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ($flag == false) echo 'NO';\n\t}\n\telse echo 'YES';", "lang_cluster": "PHP", "tags": ["brute force", "number theory"], "code_uid": "43c4f4381c21704fc7696a7e1da34b19", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$m){\n $d = (int)($dc/$m);\n $s += $d;\n $mod = $dc%$m;\n \n $dc =$d+$mod;\n \n }\n \n echo $s;\n}\n \n\n\n$nm = trim(fgets(STDIN));\n\n\n \nFinddays($nm);\n\n", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "bd432f93297e02b89ba65490ca42cbf0", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "fed1d847762005b4520169881ca13a0c", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $v) {\n if ($v == 0) {\n unset($a[$k]);\n }\n }\n funcMax($a, max($a), array());\n function funcMax($a, $max, $count) {\n $count[] = $max;\n foreach ($a AS $key => $val) {\n if ((int)$val == (int)$max) {\n unset($a[$key]);\n }\n }\n if ($a) { \n funcMax($a, max($a), $count);\n } else {\n echo count($count);\n }\n }\n \n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation"], "code_uid": "defd9487be09c302f1de081ae4b438cd", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " [\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n ],\n 'A' => [\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n ],\n 'B' => [\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n ]\n];\n\nforeach ($classA as $value) {\n ++$arrayCount['A'][$value];\n ++$arrayCount['ALL'][$value];\n}\nforeach ($classB as $value) {\n ++$arrayCount['B'][$value];\n ++$arrayCount['ALL'][$value];\n}\n\nforeach ($arrayCount['ALL'] as $value) {\n if ($value % 2 != 0)\n exit('-1');\n}\n\n$result = 0;\n$ok = 0;\n$swap = 0;\nwhile ($ok != 5) {\n $ok = 0;\n for ($i = 1; $i <= 5; ++$i) {\n if ($arrayCount['A'][$i] != $arrayCount['B'][$i]) {\n if ($arrayCount['A'][$i] > $arrayCount['B'][$i]) {\n --$arrayCount['A'][$i];\n ++$arrayCount['B'][$i];\n } else {\n ++$arrayCount['A'][$i];\n --$arrayCount['B'][$i];\n }\n $swap++;\n if ($swap % 2 == 0)\n $result++;\n }\n\n if ($arrayCount['A'][$i] == $arrayCount['B'][$i])\n $ok++;\n }\n}\n\necho $result;", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "722c52b0867e057a7354b70b93965782", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$ans1) ? \"YES\" : \"NO\" .\"\\n\";", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a746de81656c190b2e32e5744a4a1b14", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " substr_count($s, \"FS\") ? \"YES\" : \"NO\");\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "74f5d64e711c2e44a245f8456e6b3a6e", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "0a8a7d1c8d142f46440974fb330e2258", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\t$X = (int)$Scanner->Scan();\n\t$Y = (int)$Scanner->Scan();\n\t\n\t$temp = (string)(($N * ($Y / 100)));\n\t$temp = ceil($temp);\n\t$need = max($temp - $X, 0);\n\t\n\tprint($need);\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": ["math", "implementation"], "code_uid": "fa02af370c210e6fc73e90a671fae88f", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n\n\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "594ac48cbc5a953974a5ffeb0ecd9194", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n $c = $a;\n $a = $b;\n $b = $c;\n}\necho $a . \" \" . floor(($b - $a)/2);", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "7574e6cd7b31a5cb71d17fc3fd92beaa", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "#!/usr/bin/env php\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "7117d93cf2fd23f84085e36962815fb2", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $e[$h[$x]])\n {\n $g = $e[$h[$x]] * $f[$h[$x]];\n array_push($i, $g);\n }\n else\n {\n $g = $a * $f[$h[$x]];\n array_push($i, $g);\n break;\n }\n $a -= $e[$h[$x]];\n}\nprint array_sum($i);\n?>", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "c0a4e2f1845ae7bca68add2495c54a22", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $f[count($f) - 2])\n{\n print array_sum($f);\n}\nelse\n{\n $f = array_reverse($f);\n for($x = 1; $x < count($f); $x++)\n {\n $h = $f[$x] - $f[$x - 1];\n if($h > $d)\n {\n $f[$x] = $f[$x - 1] + $d;\n }\n else\n {\n break;\n }\n }\n print array_sum($f);\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "252e47cb78c854cfeacd17f3a7d8c172", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["bitmasks"], "code_uid": "0e7d782159d02f44d8e6ddd4374e648e", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n\t{\n\t\t$ans += $n & 1;\n\t\t$n /= 2;\n\t}\n\techo $ans;\n?>", "lang_cluster": "PHP", "tags": ["bitmasks"], "code_uid": "7b6d744eeea47c648dc15ff86e3957f5", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "036c333fe75377890f47a248ab1a816a", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "06ab5c96b355b7e8227dd8a68eae3624", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n break;\n }\n}\nif ($counter == 0) {\n if (strlen($str) % 2 == 1) {\n echo \"YES\";\n } else {\n\n echo \"NO\";\n }\n} else if ($counter == 1) {\n echo \"YES\";\n} else {\n echo \"NO\";\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "931706a36a31485901297526cdfc401c", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.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($first, $last) = array_map('trim', readStringExplode($f, ' '));\n\t$sec = readNum($f);\n\t$sec %= 4;\n\n\t$path = '^>v<';\n\t$cwPath = $path . $path . $path . $path;\n\t$cwwPath = strrev($path) . strrev($path) . strrev($path) . strrev($path);\n\t$firstPos = strpos($cwPath, $first);\n\t$endCwChar = $cwPath[$firstPos + $sec];\n\n\t$firstPos = strpos($cwwPath, $first);\n\t$endCcwChar = $cwwPath[$firstPos + $sec];\n\tif ($endCwChar == $endCcwChar) {\n\t\techo 'undefined';\n\t} elseif ($endCwChar == $last) {\n\t\techo 'cw';\n\t} elseif ($endCcwChar == $last) {\n\t\techo 'ccw';\n\t} else {\n\t\techo 'undefined';\n\t}\n\n\t/* / end body */\n}\n\nif (!isset($is_test)) {\n\t$is_test = false;\n}\nif (empty($is_test)) {\n\tgetAnswer();\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5a51aa6e9c2b8d89d8b782ef5a48284e", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n{\n if($a < $b)\n {\n $c = $b - $a;\n if($c == 1)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n elseif($a == $b)\n {\n print \"No\";\n }\n elseif($a > $b)\n {\n $a -= ($b - 1);\n $c = $a % 2;\n if($c == 0)\n {\n print \"Yes\";\n }\n else\n {\n print \"No\";\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e4e82c2bd508b46fb0dfb71821eb5c1a", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "b1248654b61019ee942735a41b06ad51", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "cca36035ce50fa766ebe4c04d1eaa302", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "cf382ced99feff9959a66ad59417635c", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.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$chars = array('A' => true, 'E' => true, 'I' => true, 'O' => true, 'U' => true, 'Y' => true);\n\n\t$str = strtoupper(readString($f));\n\t$len = strlen($str);\n\t$max = 1;\n\t$current = 1;\n\tfor ($i = 0; $i < $len; $i++) {\n\t\tif (!empty($chars[$str[$i]])) {\n\t\t\t$current = 1;\n\t\t\tcontinue;\n\t\t}\n\t\t$current++;\n\t\t$max = max($max, $current);\n\t}\n\techo $max;\n\t/* / end body */\n}\n\nif (empty($is_test))\n\tgetAnswer();", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "895990e52b308e84ad2bee528fcd9b30", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "1627da5d280c87196614221e080b35c0", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "de341babcd014427c8ec56d3b17bee85", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $childs )\n $min = $grownups;\n else\n $min = $grownups + abs( $grownups - $childs );\n\n $max = $grownups + ( $childs > 0 ? $childs - 1 : 0 );\n\n echo $min, ' ', $max;\n", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "6dd4df26724736387b9e266b08c075a9", "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;\n\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "4b145b6e9a72ee935d634d7ded966256", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n {\n if($c[$x] == 1)\n {\n break;\n }\n }\n $f = 0;\n if($x == $e)\n {\n $f = 1;\n }\n else\n {\n $d++;\n $e = $x;\n }\n }\n}\nif($f == 0)\n{\n print $d;\n}\nelse\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["dfs and similar", "greedy", "dp", "implementation"], "code_uid": "80b0149cfaa34eefd8ad9a3bba0c0266", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "ea97fe330796140756056324633026c1", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $p) {\n $p = $q;\n }\n}\nprint $p;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a3b7f716c42f7de1afdd3dc01b86aa4e", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $countMax) {\n $countMax = $resultArray[$array[$i]];\n }\n \n}\necho $countMax;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "e2b85297e0ae94dc498d97b5d06877e6", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "89193142d543b6f85b2a8ecddbbb228d", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $c[$x])\n {\n $f = $c[$x + 1] - $c[$x];\n if($d[$c[$x]] == 0)\n {\n $d[$c[$x]] = $f;\n }\n elseif($d[$c[$x]] != $f)\n {\n $e = 1;\n break;\n }\n }\n elseif($c[$x + 1] <= $c[$x])\n {\n $f = $a + $c[$x + 1] - $c[$x];\n if($d[$c[$x]] == 0)\n {\n $d[$c[$x]] = $f;\n }\n elseif($d[$c[$x]] != $f)\n {\n $e = 1;\n break;\n }\n }\n}\nif($e == 0)\n{\n $g = array_unique($d);\n sort($g);\n $h = array_slice($g, 1);\n sort($g);\n $i = range(1, $a);\n $j = array_diff($i, $g);\n sort($j);\n $k = 0;\n for($x = 1; $x <= $a; $x++)\n {\n if($d[$x] == 0)\n {\n $d[$x] = $j[$k];\n $k++;\n }\n }\n $l = array_unique($d);\n if(count($l) == count($d))\n {\n print implode(\" \", $d);\n }\n else\n {\n print \"-1\";\n }\n}\nelse\n{\n print \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2deee71a7b0f652967d4c1bbbae9044b", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $n)\n {\n return $s;\n }\n \n if($p - $k >= 1)\n {\n if($p - $k > 1)\n {\n $s .= '<< ';\n }\n \n for($i = ($p-$k); $i < $p; $i++)\n {\n $s .= $i . ' ';\n }\n }\n else if($p - $k < 1)\n {\n for($i = 1; $i < $p;$i++)\n {\n $s .= $i . ' ';\n }\n }\n \n $s .= '(' . $p . ') ';\n \n if($p + $k >= $n)\n {\n for($i = ($p+1); $i < $n+1; $i++)\n {\n $s .= $i . ' ';\n }\n }\n else if($p + $k < $n)\n {\n for($i = ($p+1); $i <= $p+$k; $i++)\n {\n $s .= $i . ' ';\n }\n $s .= ' >>';\n }\n \n return $s;\n}\n\n\necho pagination($n, $p, $k);", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "4966bfd71d9bedc24e1158c6b57c07ae", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "1) {\n\t$str .= '<< ';\n}\n\nfor($i = max($p-$k, 1); $i<=min($p+$k, $n); $i++){\n\t$str .= ($p==$i) ? \"($i) \" : \"$i \";\n}\n\nif($p+$k<$n) {\n\t$str .= '>>';\n}\n\nprint(trim($str));\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bbde303ea1aeef70a89836317c262947", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n if((($a - $b) == ($b - $c)) && (($b - $c) == ($c - $d)))\n {\n print $d - ($a - $b);\n }\n elseif((($c / $d) == $f) && (($b / $c) == $f) && (($a / $b) == $f))\n {\n $g = $d / $f;\n $h = floor($d / $f);\n if($g == $h)\n {\n print $g;\n }\n else\n {\n print \"42\";\n }\n }\n else\n {\n print \"42\";\n }\n}\nelse\n{\n if((($b - $a) == ($c - $b)) && (($c - $b) == ($d - $c)))\n {\n print $d + ($b - $a);\n }\n elseif((($b / $a) == $e) && (($c / $b) == $e) && (($d / $c) == $e))\n {\n $g = $e * $d;\n $h = floor($e * $d);\n if($g == $h)\n {\n print $g;\n }\n else\n {\n print \"42\";\n }\n }\n else\n {\n print \"42\";\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "1cce05ebd6f557b9f98fd43806769a90", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "8dc8353aebb7cdea12a5e3211511b3f6", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "054e61b3fcd8bf93b877eb0e7295bbdc", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$arr[$i+1])\n\t\t{\n\t\t\t$tmp=$arr[$i];\n\t\t\t$arr[$i]=$arr[$i+1];\n\t\t\t$arr[$i+1]=$tmp;\n\t\t}\n\t}\n}\n$res=0;\nwhile($i", "lang_cluster": "PHP", "tags": ["constructive algorithms", "games", "math", "greedy", "implementation"], "code_uid": "7070bf77687ec053b7eacbcf052092bd", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $middle) {\n $result = $m - 1;\n } else {\n $result = $m + 1;\n }\n}\nif ($result == 0) {\n $result = 1;\n}\necho $result;", "lang_cluster": "PHP", "tags": ["constructive algorithms", "games", "math", "greedy", "implementation"], "code_uid": "bf4aec2bba82c0c5bf029e20795c9d62", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$c[1]){if($c[0]>$c[2]){echo \"chest\";}}\nif($c[1]>$c[0]){if($c[1]>$c[2]){echo \"biceps\";}}\nif($c[2]>$c[0]){if($c[2]>$c[1]){echo \"back\";}}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "df9a5fba2e4edbb23e8ac39d8d95c2b4", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $mx){\n $cnt = 1;\n $mx = ord($t[$i]);\n continue;\n }\n if(ord($t[$i]) == $mx){\n $cnt ++;\n continue;\n }\n}\nfor($i = 0; $i < $cnt; ++$i){\n fwrite($stdout,chr($mx));\n}\nfclose($stdin);\nfclose($stdout);\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "a67edfb485a5494e8f80dcc5bf6cb29a", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=2)&&($curMaxLen\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "c7672808027bffb8aa2ba641883f013b", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "2843bfb90456976b85b5ed42fa95806a", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "5c6660f2089854ad9329f36f1b6f596d", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "sortings", "implementation"], "code_uid": "65e6f26404e2c5960787d4f3a9431972", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "914baee692f6327c3581b8ea6ebcf619", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms"], "code_uid": "4c9b4df0dcb41f55cd59a408594dabd4", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $x--)\n{\n for($y = 0; $y <= 9; $y++)\n {\n $c[$x] = $y;\n $d = array_sum($c);\n if($d == $b)\n {\n $i = 1;\n break;\n }\n }\n if($d == $b)\n {\n break;\n }\n}\n$e = implode($c);\n$f = array_fill(0, $a, 9);\n$j = 0;\nfor($x = count($f) - 1; $x >= 0; $x--)\n{\n for($y = 9; $y >= 0; $y--)\n {\n $f[$x] = $y;\n $g = array_sum($f);\n if($g == $b)\n {\n $j = 1;\n break;\n }\n }\n if($g == $b)\n {\n break;\n }\n}\nif(($i == 0) || ($j == 0))\n{\n print \"-1 -1\";\n}\nelse\n{\n $h = implode($f);\n print $e . \" \" . $h;\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp", "implementation"], "code_uid": "b9b5b62e1b35a95e037fe54ec1f23c5c", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d263269b2178732e0e96eb4e0a1d0fb1", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0) echo \"0 \".$t2.\" \".$t1.\" 0\";\nelse echo $t1.\" 0 0 \".$t2;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "3629973911ccc2bd68a0259625fe6a21", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$target)\n {\n\t$tmp=$start;\n\t$start=$target;\n\t$target=$tmp;\n}\n\n\n\n // $obstract=0;\n\n\t for ($i=$start-1;; $i+=$k)\n\t { \n\t \t //echo \"i=$i target=$target\\n\";\n\t\t if($i>$target-1)\n\t\t {\n\t\t \t echo \"NO\\n\";\n\t\t \t break;\n\t\t }\n\t\t \t if($i==$target-1)\n\t\t \t {\n\t\t \t \t echo \"YES\\n\";\n\t\t \t \t break;\n\t\t \t }\n\t\t \t \n\t\t \t if($str[$i]=='#')\n\t\t \t {\n\t\t \t \t echo \"NO\\n\";\n\t\t \t \t break;\n\t\t \t }\n\n\n\t }\n\t \n\t \t\n\n/*\nif($flag==1)\n\techo \"YES\\n\";\nelse\n\techo \"NO\\n\";\n*/", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "2d0d8d71d9861df434aa07ea0b43e248", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n if ($value == \"G\") {\n $g=$key;\n }\n if ($value == \"T\") {\n \n $tg=$key; \n }\n \n}\n\n\nwhile (TRUE) {\n$t= $g + $jump;\n$t1=$g - $jump;\n\n\nif ($tg < $g) {\nif ($str[$t1] == \"#\") {\n \n echo \"NO\";\n break;\n}elseif ($str[$t1] == \"T\") {\n \n echo \"YES\";\n break;\n}else $jump = $u + $jump;\n}\nif ($tg > $g) {\nif ($str[$t] == \"#\") {\n \n echo \"NO\";\n break;\n}elseif ($str[$t] == \"T\") {\n \n echo \"YES\";\n break;\n}else $jump = $u + $jump;\n\n\n\n } \n \n if ($jump > $len){\n \n echo \"NO\";\n break;\n \n}\n \n}\n\n \n\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "8fffa4b2f37f9d9f7434d0e100bbd1cb", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "871d0be48ea127dfd0995e6ec44839d7", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n{\n print $e - $b;\n}\nelse\n{\n print \"0\";\n}\n?>", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "9a03c57b97b830121d249c3a3436eec0", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $x[$i+1]) {\n $answer = max($answer, $x[$i] - $c - $x[$i+1]);\n }\n}\n\nprint $answer;\n\nfunction get_line() {\n return trim(fgets(STDIN));\n}\n", "lang_cluster": "PHP", "tags": ["brute force", "greedy", "implementation"], "code_uid": "cee848f4ca454d0d2dfb078e1902d6e8", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "#!/usr/bin/php -c -q\ntok = $tok;\n\t\t$this->token = strtok($str_line, $this->tok);\n\t}\n\t\n/* //unuseful firstversion\n\tpublic function nextToken() {\n\t\t\n\t\tif (Token::$first === true) {\n \t\t\tif ($this->$firstToken !== false) {\n\t\t\t\tToken::$first = false;\n\t\t\t\t//self::$first = false;\n\t\t\t\treturn $this->$firstToken;\n\t\t\t} else {\n\t\t\t\treturn -1;\n\t\t} else {\n\t\t\t$nextToken = strtok(\" \");\n\t\t\tif ($nextToken !== false) {\n\t\t\t\treturn $nextToken;\n\t\t\t} else {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n*/\n\tpublic function nextToken() {\n\t\t$thisToken = $this->token;\n\t\t//$this->token = strtok(\" \");\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}\n\n/* \nfunction getLines($str_lines) {\n\twhile (true) {\n\n\t\t$str_line = rtrim(fgets(STDIN, 10), \"\\n\");\n\t\n\t\t//null\ufffd\ufffd\ufffd\ufffd\ufffdstrlen($num) < 1\ufffdH \n \tif (!ctype_digit($str_line) || strlen($str_line) < 1) { \n \tbreak; \n \t}\n\n\t\t$str_lines[] = $str_line;\n\t}\n\treturn $str_lines;\n}\nfunction putLinesIn(&$str_lines) {\n\twhile (true) {\n\n\t\t$str_line = rtrim(fgets(STDIN, 10), \"\\n\");\n\t\n\t\t//null\ufffd\ufffd\ufffd\ufffd\ufffdstrlen($num) < 1\ufffdH \n \tif (!ctype_digit($str_line) || strlen($str_line) < 1) { \n \tbreak; \n \t}\n\n\t\t$str_lines[] = $str_line;\n\t}\n}\nfunction getStringArray($str_line, $str_arr) {\n\t$firstToken = strtok($str, \" \");\n\tif ($firstToken === false) return -1;\n\telse $fl_arr[] = $firstToken;\n\t\n\t$nextToken = strtok($str);\n\twhile ($nextToken !== false) {\n\t\t$fl_arr[] = $nextToken;\n\t\t$nextToken = strtok($str);\n\t}\n\treturn $str_arr;\n}\n*/\n\n/*string \ufffd\ufffd array \n//\ufffd\ufffd\ufffdK\ufffd\\\ufffd\ufffd\ufffd\ufffd\ufffdK\ufffdv preg_split\n//\ufffd\ufffd\ufffdK\ufffd\\\ufffd\ufffd\ufffd\ufffd\ufffds\ufffdv explode(), str_split()(more speedy but more simple) \n\n//1.example of explode() (best)\nfunction putStringsIn($str_line) {\n\tif ($str_line === null) $str_arr = null;\n\telseif (strpos($str_line, \" \") === false) $str_arr = $str_line;\n\telse $str_arr = explode(\" \", $str_line);\n\t\t\n\treturn $str_arr;\n}\n\n//2.example getting of arr from str, and using strtok (unuseful)\nfunction putStringsIn($str_line) {\n\t$str_arr = array();\n\t\n\t$firstToken = strtok($str_line, \" \");\n\tif ($firstToken !== false) {\n\t\t$str_arr[] = $firstToken;\n\t\t$nextToken = strtok($str_line);\n\t\twhile ($nextToken !== false) {\n\t\t\t$str_arr[] = $nextToken;\n\t\t\t$nextToken = strtok($str_line);\n\t\t}\n\t}\n}\n\n//3.example getting of float arr from str, and using strtok (unuseful)\nfunction getFloatArray($str_line, $fl_arr) {\n\t$firstToken = (float)strtok($str_line, \" \");\n\tif ($firstToken === false) return -1;\n\telse $fl_arr[] = $firstToken;\n\t\n\t$nextToken = (float)strtok($str_line);\n\twhile ($nextToken !== false) {\n\t\t$fl_arr[] = $nextToken;\n\t\t$nextToken = strtok($str_line);\n\t}\n\treturn $fl_arr;\n}\n\n//4.the same way, except using &$fl_arr (unuseful)\nfunction putFloatsIn($str_line, &$fl_arr) {\n\t$firstToken = (float)strtok($str_line, \" \");\n\tif ($firstToken === false || count($fl_arr) !== 0) return -1;\n\telse $fl_arr[] = $firstToken;\n\t\n\t$nextToken = (float)strtok($str_line);\n\twhile ($nextToken !== false) {\n\t\t$fl_arr[] = $nextToken;\n\t\t$nextToken = strtok($str_line);\n\t}\n}\n*/\n\n/*\nchange of data fomat of arrays\n\n//1.basic code\narray_map('strval', $arr), array_map('floatval', $arr)\n//2.unuseful firstversion\nfunction nextFloat($str) {\n\treturn (float)$str;\n}\n*/\n\n/*solve using foreach for reading input\nfunction solve(){\n\n\t$str_lines = array();\n\tputLinesIn($str_lines);\n\tforeach ($str_lines as $str_line) {\n\t\t$str_arr = array();\n\t\tputStringsIn($str_line, &$str_arr);\n\t\t//$fl_arr = array();\n\t\t//foreach ($str_arr as $str) {\n\t\t\t//$fl_arr[] = (float)$str;\n\t\t//}\n\t\t$fl_arr = array_map('floatval', $arr);\n\t\t\n\t\t$vp = $fl_arr[0];\n\t\t$vd = $fl_arr[1];\n\t\t$t = $fl_arr[2];\n\t\t$f = $fl_arr[3];\n\t\t$c = $fl_arr[4];\n\n\t\t$ttake = ($vp * $t) / ($vd - $vp);\n\t\t$dis = $vp * ($t + $ttake);\n\t\t$less = $c - $dis;\n\t\t$int_count = 0;\n\t\t$EPS = 1e-9;\n\n\t\twhile ($less > $EPS) {\n\t\t\t$int_count++;\n\t\t\t$t = $t + 2 * $ttake + $f;\n\t\t\t$ttake = ($vp * $t) / ($vd - $vp);\n\t\t\t$dis = $vp * ($t + $ttake);\n\t\t\t$less = $c - $dis;\n\t\t}\n\n\t\tprintf(%d,$int_count);\n\t}\n}\n*/\n//solve using strtok or class Toke for reading input\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$vp = $Token->nextFloat();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$vd = $Token->nextFloat();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$t = $Token->nextFloat();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$f = $Token->nextFloat();\n\t$Token = new Token(rtrim(fgets(STDIN), \"\\n\"), \" \");\n\t$c = $Token->nextFloat();\n\t\n/* another coding if possible\n\t1.for\n\tfor ($temp = $Token->nextFloat();;$temp = $Token->nextFloat();) {\n\t\tif ($temp === false) break;\n\t\t$vp = $temp;\n\t\t\ufffdE\n\t\t\ufffdE\n\t\t\ufffdE\n\t}\n\t\n\t2.while\n\t$temp = $Token->nextFloat();\n\twhile($temp !== false) {\n\t\t$vp = $temp;\n\t\t\ufffdE\n\t\t\ufffdE\n\t}\n*/\n\t$int_count = 0;\n\tif ($vd <= $vp) {\n\t\tprintf('%d', $int_count);\n\t\treturn;\n\t}\n\t\n\t$ttake = ($vp * $t) / ($vd - $vp);\n\t$dis = $vp * ($t + $ttake);\n\t$less = $c - $dis;\n\t$EPS = 1e-9;\n\twhile ($less > $EPS) {\n\t\t$int_count++;\n\t\t$t = $t + 2 * $ttake + $f;\n\t\t$ttake = ($vp * $t) / ($vd - $vp);\n\t\t$dis = $vp * ($t + $ttake);\n\t\t$less = $c - $dis;\n\t}\n\n\t//printf(%d, $int_count);\n\tprintf('%d', $int_count);\n}\n\nfunction run(){\n\tsolve();\n}\n\nob_end_clean();\nrun();\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "f4e95c8d133c7795a688ab5703db245a", "src_uid": "c9c03666278acec35f0e273691fe0fff", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "a = $a;\n\t\telse\n\t\t\t$this->a = array($a[2], $a[3], $a[0], $a[1]);\n\t}\n\tpublic static function create($a, $b, $c, $d) {\n\t\treturn new Segment(array($a, $b, $c, $d));\n\t}\n\t// public function __is_equal($other) {\n\t// \treturn $this->a == $other->a;\n\t// }\n\tpublic function __toString() {\n\t\treturn implode(', ', $this->a);\n\t} \n}\n\n$sa = array();\n$M = 10**9;\n$min_x = $M; $max_x = -$M;\n$min_y = $M; $max_y = -$M;\nfor ($i = 0; $i < 4; $i++) {\n\t$a = array_map(\"intval\", explode(' ', fgets(STDIN)));\n\t$min_x = min($min_x, min($a[0], $a[2]));\n\t$max_x = max($max_x, max($a[0], $a[2]));\n\t$min_y = min($min_y, min($a[1], $a[3]));\n\t$max_y = max($max_y, max($a[1], $a[3]));\n\t$sa[$i] = new Segment($a);\n}\n$sb = array(\n\tSegment::create($min_x, $min_y, $max_x, $min_y),\n\tSegment::create($min_x, $min_y, $min_x, $max_y),\n\tSegment::create($max_x, $max_y, $max_x, $min_y),\n\tSegment::create($max_x, $max_y, $min_x, $max_y)\n);\n// print(implode(' | ', $sa).\"\\n\");\n// print(implode(' | ', $sb).\"\\n\");\n$equal = (array_merge(array_diff($sa, $sb), array_diff($sb, $sa)) == array());\nprint($equal && $min_x != $max_x && $min_y != $max_y ? \"YES\\n\" : \"NO\\n\");\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "constructive algorithms", "math", "implementation", "geometry"], "code_uid": "a247497d731d347e44531a1efaf7a6d8", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0; $i--) {\n $tr += $t_i[$i];\n $cr = $n_i[$i] - $c * $tr;\n $r += max(0, $cr);\n $cr = 0; \n}\nif ($l > $r) print \"Limak\";\nif ($r > $l) print \"Radewoosh\";\nif ($l == $r) print \"Tie\";\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "7b80b9aaf55e4e4b7b83c703874c0d05", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $r)\n echo \"Limak\";\nelse if ($l < $r)\n echo \"Radewoosh\";\nelse\n echo \"Tie\";\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0d23e702b1cadc4d978368b9557c2684", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n\tif(floor($dist)%2 == 0){\n\t\t$output = 'black';\n\t}else{\n\t\t$output = 'white';\n\t}\n}else{\n\tif(floor($dist)%2 == 0){\n\t\t$output = 'white';\n\t}else{\n\t\t$output = 'black';\n\t}\n}\nfile_put_contents('php://stdout', $output);\n?>", "lang_cluster": "PHP", "tags": ["math", "geometry", "constructive algorithms", "implementation"], "code_uid": "5001664213575d99405ef49556224714", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f35faf9054d272404c35bd28d52490f4", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "414e0b6e1dd5991bdd2a15a1a04f322a", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$VPoints){\n echo \"Misha\";\n }else if($MPoints<$VPoints){\n echo \"Vasya\";\n }else if($MPoints ==$VPoints){\n echo \"Tie\";\n }\n}\n\n\nsolve($a,$b,$c,$d);\n\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "2184aa7457cbd474dfe7badb2545a2e0", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $number){\n\t\tif(!in_array($number, [1,4])){\n\t\t\treturn false;\n\t\t}\n\t\tif($number == 4){\n\t\t\tif($key == 0){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif($numbers[$key-1] == 1){\n\t\t\t\tcontinue;\n\t\t\t}elseif($numbers[$key-1] == 4){\n\t\t\t\tif($numbers[$key-2] == 1)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t}\n\treturn true;\n}\nif(magicNumber($input)){\n\techo \"YES\";\n}else{\n\techo \"NO\";\n}", "lang_cluster": "PHP", "tags": ["brute force", "greedy"], "code_uid": "f9a8ecf569f58b95a75c5c30c4200c4c", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $n1)\n{\n echo \"Second\\n\";\n}\nelse\n{\n echo \"First\\n\";\n}", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "2f5f6fd3de72a4fd1fafe24a51632aab", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n2) echo \"First\";\nelse echo \"Second\";\n?>", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "87fb4fda31cc69b2683cfb7c05e2a073", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a1b9d5c8d740cd29f538d1af29abfc07", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "sortings", "implementation"], "code_uid": "261b0af24fd3b48cc484975ae296c765", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 8)\n{\n $b = floor($a / 7) * 2;\n $c = $a - floor($a / 7) * 7;\n if($c == 0)\n {\n print $b . \" \" . $b;\n }\n elseif($c == 1)\n {\n print $b . \" \" . ($b + 1);\n }\n elseif($c <= 5)\n {\n print $b . \" \" . ($b + 2);\n }\n elseif($c == 6)\n {\n print ($b + 1) . \" \" . ($b + 2);\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "d3faa6d4269d77fdb0d74b4a3e97d58d", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "6b338c50c76084cb4beb2dca6f466136", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "binary search"], "code_uid": "d20b6f04cc7ccf844552fcd2a9d85dbc", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "Scan();\n\t$A2 = $Scanner->Scan();\n\t\n\t$A2_num = str_split($A2);\n\tkrsort($A2_num);\n\t$NewA2 = implode($A2_num);\n\t$NewA2 = (float)$NewA2;\n\t\n\t$ans = $A1 + $NewA2;\n\t\n\tprintf(\"%.0f\", $ans);\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": ["constructive algorithms"], "code_uid": "913d1a5d473df0b8957709d6d2379695", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "geometry", "brute force"], "code_uid": "67f9d9505c416ea907d6be606e48529e", "src_uid": "65f81f621c228c09915adcb05256c634", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=27){\n print $m;\n}\nelse print ($m % (1<<$n));\n \n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2e311e8e138631fe8c6c6ee6c491b0fe", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 3) {\n echo -1;\n die;\n}\n\n$numbers = array_map('intval', $numbers);\nsort($numbers);\n\n$numbers = array_values($numbers);\n\n$d = -1;\nswitch (count($numbers)) {\n case 1:\n $d = 0;\n break;\n case 2:\n $diff = $numbers[1] - $numbers[0];\n if ($diff % 2) {\n $d = $diff;\n } else {\n $d = $diff / 2;\n }\n break;\n case 3:\n if (($numbers[2] - $numbers[1]) !== ($numbers[1] - $numbers[0])) {\n $d = -1;\n } else {\n $d = $numbers[2] - $numbers[1];\n }\n break;\n}\n\nif ($d < -1) {\n $d = -1;\n}\n\necho $d;\n\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "96d0d14c83679f2beb27c2a1f16d454a", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "588fd36bb32bed342ad3d096eb66ae13", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 3) print 0; else print $n - $k + $n * 2;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "e778c78565fbbfddf87a5764e67f6bd9", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "2) $d1++;\n for($i=1;$i<$m1;$i++)\n $d1+=$month[$i];\n for($i=1900;$i<$y2;$i++)\n if($i%4==0 && $i%100!=0 || $i%400==0) $d2+=366;\n else $d2+=365;\n if($y2%4==0 && $y2%100!=0 || $y2%400==0)\n if($m2>2) $d2++;\n for($i=1;$i<$m2;$i++)\n $d2+=$month[$i];\n //echo $d1.\" \".$d2.\"\\n\";\n echo abs($d1-$d2);\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "5587577897917102d7cc255c4d668639", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp", "bitmasks"], "code_uid": "e85719233809bbf2f2152f611aa6c806", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy"], "code_uid": "7540b58f246ff475e2ba5a2bffcb4aaa", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "c69c9caaef94acdbb8f80a4c94da59fb", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=$nf){\n $nh = floor($f/$nf);\n $rf = $f%$nf;\n $h += $nh ;\n $f = $nh + $rf;\n}\necho $h;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f06fc2efa0b226abbe8fb2aad21ce948", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "d45952e13b202f213a34553023244376", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["dsu", "constructive algorithms", "implementation", "brute force"], "code_uid": "48f878f1ec20067bd791fca06a5ec73b", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "a884ae608cd0b53849cec6624c5189cf", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f4842e5cf667491cee0065fff1d1cf3d", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1) {\n try_digit($n % 10);\n $n = (int) $n / 10;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0488999cb1f9b2042fb6b2458e00171d", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0&&$gap%2==0) echo \"YES\\n\";\nelse echo \"NO\\n\";\n\n?>", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "9c9062a89cbc508e9d69bce6c4f79b06", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f4c77a057b95572e8fe20dae76d2db5d", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " abs($x1 - $x)) print abs($y1 - $y);\n else print abs($x1 - $x);\n?>\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c1d2f8de1df411c8ec7a6d207d407dc7", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b) {\n\t\t$s = $a - $b;\n\t\twhile ($a != $b) {\n\t\t\t$a--;\n\t\t\t$c++;\n\t\t\t$k = $k + $c;\n\t\t\tif ($a != $b) {\n\t\t\t\t$b++;\n\t\t\t\t$d++;\n\t\t\t\t$k = $k + $d;\n\t\t\t}\n\t\t}\n\t\techo $k;\n\t} else {\n\t\t$s = $b - $a;\n\t\twhile ($a != $b) {\n\t\t\t$a++;\n\t\t\t$c++;\n\t\t\t$k = $k + $c;\n\t\t\tif ($a != $b) {\n\t\t\t\t$b--;\n\t\t\t\t$d++;\n\t\t\t\t$k = $k + $d;\n\t\t\t}\n\t\t}\n\t\techo $k;\n\t}\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "5ac5ea8c5237708ac2fa2f3fc6074199", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5fc775aa3c2768e8d48329a236b6535b", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$item){\n if($key == count($way)-1){\n echo $item;\n break;\n }\n echo $item.' ';\n }\n return;\n }\n if($ch % 10 == 1){\n array_push($way, $ch);\n return back(substr($ch, 0, -1));\n }else if($ch % 2 == 0){\n array_push($way, $ch);\n return back($ch/2);\n }else{\n echo \"NO\";\n return;\n }\n}\nback($line1[1]);", "lang_cluster": "PHP", "tags": ["dfs and similar", "math", "brute force"], "code_uid": "06461e59bf18852b83cef6def5d27600", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "74f36fdacb4faff7dd5a538bce798843", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n if($world[$i-1][$j] == 'W'){\n $count++;\n $world[$i-1][$j] = '.';\n continue;\n }\n }\n if($i < $n-1){\n if($world[$i+1][$j] == 'W'){\n $count++;\n $world[$i+1][$j] = '.';\n continue;\n }\n }\n if($j > 0){\n if($world[$i][$j-1] == 'W'){\n $count++;\n $world[$i][$j-1] = '.';\n continue;\n }\n }\n if($j < $m-1){\n if($world[$i][$j+1] == 'W'){\n $count++;\n $world[$i][$j+1] = '.';\n continue;\n }\n }\n }\n }\n}\n\necho $count;", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "188f3f09fb220db160a4bf8c64185737", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " ($f + 1))\n {\n $b -= ($f + 1);\n }\n }\n }\n if($g != 0)\n {\n break;\n }\n}\nprint $g;\n?>", "lang_cluster": "PHP", "tags": ["constructive algorithms", "binary search", "implementation", "bitmasks"], "code_uid": "a992f19b64cf05661aa06bf33e630041", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $a)\n {\n break;\n }\n else\n {\n unset($d[$e]);\n }\n }\n $f = abs(array_sum($d));\n $g = max($g, $f);\n}\nprint $g;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "bd50d4f225b77fb1fb9e68d876157272", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "a68914ea721c5710accb2868293185e4", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "cedae8e0d3e3ecb654c6ddd783f63452", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "358b9808ff16481f36baec7e3c6f306e", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $r){\n printf(\"%.0f\" ,$r * 2 - 1);\n }\n else\n printf(\"%.0f\", ((floor(($n + 1) / 2)) - $r) * -2);\n \n ", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "4b568f22220a934abbc780cb0e59100b", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $part)\n{\n echo 2 * ($k-$part);\n}\n else {\n echo 2*($k-1)+1;\n}", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "b95d84771e123a9053e4c06f7ab5fbe1", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6ebfc230a883a04f4f89cd9049b67a37", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) {\n\t\tfor ($i = 2; $i < $n - $v + 1; $i++) {\n\t\t\t$res += $i;\n\t\t}\n\t}\n\techo ($res);\n\n\tfclose($in);\n\n##############################################################################\n\t#echo (number_format($res,0,null,'').\"\\n\");\n\t#$a = explode(\" \", trim(fgets($in)));\n?>", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "c13932f261ed3823aaeae3d8cc72056c", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "greedy", "dp"], "code_uid": "0ee1a4749297ecba91484069b2e3f7d4", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "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": "0cab9095377685c502d4f8ee90546dfd", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $num[2] || $num[1] + $num[2] > $num[3]) echo \"TRIANGLE\\n\";\nelse if($num[0] + $num[1] == $num[2] || $num[1] + $num[2] == $num[3]) echo \"SEGMENT\\n\";\nelse echo \"IMPOSSIBLE\\n\";\n?>\n", "lang_cluster": "PHP", "tags": ["brute force", "geometry"], "code_uid": "177fae691fdf43b439d0ea199e2148b2", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "6f40e25155c8542122dde2e21ba7befb", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "db46598a0c66b4faa63f12fceaaf9b52", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 25)\n{\n print $c - 25;\n}\nelse\n{\n print \"0\";\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "ac645bfa267c13b428331c0c30ff1170", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "2585e2dcdf8972d14ab19e05e10d2eec", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "implementation"], "code_uid": "cb5be1bd9a0b8d749169ac48b34736de", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $maxWait){\n\t\techo $maxWait;die;\n\t}else{\n\t\t$maxWait = $interestMin + 15;\n\t}\n}\necho $maxWait > 90 ? 90 : $maxWait;\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "22cfd57998aad98160850706f8fdabea", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["two pointers", "implementation"], "code_uid": "abdd227c8cbf3bc55e84fbd8078b0264", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0; $x--)\n{\n $a += $x;\n if($x == $d)\n {\n $a -= $c;\n if($a < 0)\n {\n $a = 0;\n }\n }\n elseif($x == $f)\n {\n $a -= $e;\n if($a < 0)\n {\n $a = 0;\n }\n }\n}\nprint $a;\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "3a6c114e3ed5e5ab19e47d76ec29b53c", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $max) {\n $max = $int;\n }\n}\n\n$count = $m;\n$maxCount = 0;\n\nwhile($count > 0 && $maxCount < $n)\n{\n $maxCount = 0;\n\n for($i = 0; $i < $n && $count > 0; $i++)\n {\n if($list[$i] < $max)\n {\n $list[$i]++;\n $count--;\n }\n else\n {\n $maxCount++;\n }\n }\n}\n\necho $max + ceil($count / $n), ' ', $max + $m;\n", "lang_cluster": "PHP", "tags": ["implementation", "binary search"], "code_uid": "9ab20536dd5218c18217ed8f953dbde6", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "68f6d97edae022b5189194e755f038b2", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0||($x-$t-1)%$s==0&&($x-$t-1)/$s>0) echo \"YES\\n\";\nelse echo \"NO\\n\";\n\n\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "e2cbe6afa7daf8fe265c3e552dbf5034", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $tempVars ++;\n if ($vars > 0) {\n $vars = $vars * $tempVars;\n } else {\n $vars = $tempVars;\n }\n $tempVars = 0;\n } else {\n \n }\n }\n \n}\nif ($vars == 0) {\n echo '1';\n} else {\n echo number_format($vars, 0, '', '');\n}\n\n?>", "lang_cluster": "PHP", "tags": ["combinatorics"], "code_uid": "f5b701e23a5e65d26b6edb9b5a1afbd6", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "83ba978eacb73f9335312e267a985c29", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0){\necho $initial;\n}else {\necho \"-1\";\n}\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0c52d6b0aa75ef404122cf3741975ec0", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $r ? $ans : $r);", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "56e9cf6db0a24033878d3da8a7ce2560", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "ee7d73632db1505e5bed7219160511a0", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "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->readInt();\n\n$k = intval(sqrt($n));\n\nif ($n==$k*$k) {\n\techo $k+$k;\n} else if ($n<=$k*($k+1)) {\n\techo $k+$k+1;\n} else {\n\techo $k+$k+2;\n}\n", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "binary search"], "code_uid": "3b8e1a4856647c91c9b626407c2931c6", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= array_sum($second)) {\n echo 'Yes';\n} else {\n echo 'No';\n}", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "7f6578a474d31b0740a2159010149ad4", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1) && ($g > 1) && ($i < 2))) || ((($m == 2) && (($e > 1) && ($i > 1) && ($g < 2))) || ((($m == 2) && (($g > 1) && ($i > 1) && ($e < 2))))))\n{\n $k += 1;\n}\nif((($a + $b + $c) == 4) || (($a == 0) || ($b == 0) || ($c == 0)))\n{\n $k -= 1;\n}\n$d = min($a, $b, $c);\n$e = $a - $d;\n$f = $b - $d;\n$g = $c - $d;\n$h = floor($e / 3);\n$i = floor($f / 3);\n$j = floor($g / 3);\n$l = $d + $h + $i + $j;\nif($k >= $l)\n{\n print $k;\n}\nelse\n{\n print $l;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "92d752f7c20e4329bae6639a3ad54134", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a001e45f83384ed2a4c45df9e20dad66", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "e74cd60ab8124973f5ffe5013644931f", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "5739547bd21544e1c2cbb0f2abe02a40", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ) {\n return array_shift($buffer);\n }\n $line = preg_replace('/[\\\\r\\\\n]+$/', '', getLine());\n $buffer = preg_split('/\\\\s+/', $line);\n return getNext();\n}\n\nfunction getLine() {\n global $input;\n return fgets($input, 4096);\n}\n\nfunction init() {\n global $input;\n $input = fopen(\"php://stdin\", \"r\");\n}\n\nfunction main() {\n\n $target = preg_split('/\\\\./', getNext());\n $self = getNext();\n\n $cand = preg_split('/\\\\./', $self);\n\n $ans = (ok(intval($cand[0]), intval($cand[1]), intval($cand[2]), $target) ||\n ok(intval($cand[0]), intval($cand[2]), intval($cand[1]), $target) ||\n ok(intval($cand[1]), intval($cand[0]), intval($cand[2]), $target) ||\n ok(intval($cand[1]), intval($cand[2]), intval($cand[0]), $target) ||\n ok(intval($cand[2]), intval($cand[0]), intval($cand[1]), $target) ||\n ok(intval($cand[2]), intval($cand[1]), intval($cand[0]), $target));\n\n print ($ans ? \"YES\" : \"NO\") . \"\\n\";\n\n}\n\nfunction validDate($dd, $mm, $yy) {\n $days = ($yy % 4 == 0 ? Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) : Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));\n if( $mm > 12 ) { return false; }\n $max = $days[$mm-1];\n return ($dd <= $max);\n}\n\nfunction ok($dd, $mm, $yy, $target) {\n if( !validDate($dd, $mm, $yy) ) { return false; }\n $me = $dd + $mm * 100 + ($yy + 18) * 10000;\n $you = $target[0] + $target[1] * 100 + $target[2] * 10000;\n return $me <= $you;\n}\n\nmain();\n\n?>\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d0e17bc5b18b1e19ca087e843eaaba79", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n{\n for($x = 1; $x <= $a; $x++)\n {\n $b -= $x;\n if($b < 0)\n {\n $b += $x;\n print $b;\n break;\n }\n elseif($b == 0)\n {\n print \"0\";\n break;\n }\n }\n}\nelse\n{\n $b = $b % $c;\n for($x = 1; $x <= $a; $x++)\n {\n $b -= $x;\n if($b < 0)\n {\n $b += $x;\n print $b;\n break;\n }\n elseif($b == 0)\n {\n print \"0\";\n break;\n }\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "a6acf5ab2ed0192044327ed0a7a12e02", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0){\n $dist -= 2*$r;\n $res++;\n}\n\necho $res.\"\\n\";", "lang_cluster": "PHP", "tags": ["math", "geometry"], "code_uid": "5b12b5de4a680c424630f72607e223b7", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "a82abaaeabd93626607adbc7054f4d37", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $value) {\n\t$b[$key] += 0;\n}\nsort($b);\n$count = 0;\nfor ($i=$n-1; $i >= 0; $i--) { \n\tif ($m <= $k) break;\n\tif ($k != 0) {\n\t\t$count++;\n\t\t$k += $b[$i] - 1;\n\t} else {\n\t\tbreak;\n\t}\n}\nif ($m > $k) $count = -1;\nfwrite($f_out, $count);\nfclose($f_out);", "lang_cluster": "PHP", "tags": ["sortings", "implementation", "greedy"], "code_uid": "c2580e5e5e67712afa92ece4e1cd1ca2", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "43b89bc567f425942a54bffe84e68d36", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$sum2)echo \">\";\nif($sum1<$sum2)echo \"<\";\nif($sum1==$sum2)echo \"=\"; \n\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "4cc8c26065cecf7f1860db3def0664a9", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "$n) ? -1 : $step;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "d0b1b9790a38f2b4ca4fc03ce5c472d9", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "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\n$count = 0;\nfor ($i = $array[0]; $i <= $array[1]; $i++) {\n $string = (string) $i;\n for ($j = 0; $j < strlen($string); $j++) {\n $count += $counts[$string[$j]];\n }\n}\n\necho $count;", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "5a92becee1fd551cb16114458876da84", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 1)\n {\n $e = ($c[$y - 1][$z] - 1) / 2;\n $c[$y - 1][$z] = 1;\n $c[$y][$z] += $e;\n $c[$y][$z + 1] += $e;\n }\n }\n }\n }\n}\n$f = 0;\nfor($x = 1; $x <= $a; $x++)\n{\n for($y = 1; $y <= $x; $y++)\n {\n if($c[$x][$y] >= 1)\n {\n $f++;\n }\n }\n}\nprint $f;\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "bede8cc25c1983c4aa08c9edf67912e9", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["greedy", "strings", "implementation"], "code_uid": "af2aca5d5cd6df2f7eb1604756672390", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "=0; $i--)\n {\n $flag = false;\n if($arr[$i]!='a')\n {\n for($j=$i-1; $j>=0; $j--)\n {\n $buffer = $arr[$j];\n ++$buffer;\n \n if( $arr[$i] == $buffer)\n {\n $flag = true;\n break;\n }\n }\n if(!$flag)\n {\n $ans = 'no';\n break;\n }\n }\n }\n \n echo ($ans == 'no') ? \"NO\\n\" : \"YES\\n\";\n?>\n", "lang_cluster": "PHP", "tags": ["greedy", "strings", "implementation"], "code_uid": "ba99753b82c6c82c2ec0f1966f7dfad1", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "c6bffdb80b8ef2bdb0ca4bb73769a183", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "63f2f44fa2421f278425b27adeb82203", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "ebc9cee882e03ae2dd6e3c4d18902dbd", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "combinatorics"], "code_uid": "ec3496dbd871d68278238b39547154e2", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "bb5ab4b5bc2ec76110c58f9582c1d03d", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $max){\n $max = $count;\n $max_sub = $tmp;\n }\n }\n}\necho $max_sub . PHP_EOL;\nexit;", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "dd8ce915bbe50839c0c0382d26ef6674", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $b)\n{\n $c = $a % $b;\n if($c == 0)\n {\n print $a + $b;\n }\n else\n {\n $d = $b - $c;\n print $a + $d;\n }\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "94242f9a6ddc8bc922d807736e830e3f", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "math", "binary search"], "code_uid": "62281df60edc52cb8c7e54895876db89", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "4e85c659d223bc402b694106704caf75", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $s - $t[$i] - $t[$j] - $t[$k])\n {\n $ans = $s - $t[$i] - $t[$j] - $t[$k];\n }\n }\n if($t[$i] == $t[$j] && $ans > $s - $t[$i] - $t[$j])\n {\n $ans = $s - $t[$i] - $t[$j];\n }\n }\n }\n print $ans;\n?>\n", "lang_cluster": "PHP", "tags": ["constructive algorithms", "implementation"], "code_uid": "cf997f34a2ccb9c2b81d214b0e6ee729", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= sizeof($input)){\n $ok = false;\n break;\n }else if(!isVowel($input[$i+1])){\n $ok = false;\n break;\n } \n } \n}\n\necho $ok ? 'YES' : 'NO';\n\nfunction isVowel($character){\n return $character == 'a' \n || $character == 'i' \n || $character == 'u' \n || $character == 'e' \n || $character == 'o';\n}\n?>", "lang_cluster": "PHP", "tags": ["strings", "implementation"], "code_uid": "ec24ef159d1eaf82333882f5c6b4023d", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 0)\n\t\techo $deposite;\n\telse\n\t\techo max($deposite, ceil($deposite / 10), ceil($deposite / 100) * 10 + $deposite % 10);", "lang_cluster": "PHP", "tags": ["implementation", "number theory"], "code_uid": "b6d9c1b86dc77824d63c9088ee66d60c", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1; $z--)\n {\n $g = $e[$y];\n for($z2 = 0; $z2 < $x - 1; $z2++)\n {\n if($g[$z2] == $z)\n {\n $g[$z2] = $x;\n }\n }\n $g = $z . $g;\n $f[count($f)] = $g;\n }\n }\n $e = $f;\n $f = array();\n}\n$h = 10000000000;\nfor($x = 0; $x < count($e); $x++)\n{\n $i = array();\n $j = $e[$x];\n for($y = 0; $y < $a; $y++)\n {\n $k = \"\";\n for($z = 0; $z < $b; $z++)\n {\n $l = $c[$y];\n $k .= $l[$j[$z] - 1];\n }\n $i[$y] = $k;\n }\n $m = max($i) - min($i);\n $h = min($h, $m);\n}\nprint $h;\n?>", "lang_cluster": "PHP", "tags": ["brute force", "implementation", "combinatorics"], "code_uid": "9d3853570c6acb3e10c50ee92ce54041", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0; $i--) {\n if ($map[$i][$j]=='B') {\n $bm = min($bm, 7-$i);\n break;\n }elseif ($map[$i][$j]=='W') {\n break;\n }\n }\n}\nif ($wm>$bm) {\n echo 'B';\n}else{\n echo 'A';\n}", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0acd09041ae5b9731722086e0df2faa8", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "dp"], "code_uid": "cbcf0c130cb9b2f5008bfdb20d2d7a29", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $distance\n && $numbers[1] - $numbers[2] >= $distance\n && $numbers[2] - $numbers[0] >= $distance) {\n echo 0;\n exit();\n}\n\n$left = min($numbers);\n$right = max($numbers);\nif ($right === $left) {\n $middle = $left;\n} else {\n\n $middle = false;\n\n foreach ($numbers as $number) {\n if ($number < $right && $number > $left) {\n $middle = $number;\n }\n }\n if ($middle === false) {\n $right_keys = array_keys($numbers, $right);\n if (count($right_keys) > 1) {\n $middle = $right;\n } else {\n $middle = $left;\n }\n }\n}\n\n\n\n$current_left_distance = $middle - $left;\n$current_right_distance = $right - $middle;\n\n\n$result = 0;\nif ($current_left_distance < $distance) {\n $result += $distance - $current_left_distance;\n}\nif ($current_right_distance < $distance) {\n $result += $distance - $current_right_distance;\n}\necho $result;\nexit;\n\n\n\n\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "af4cf01a58cd5adde76e24e9f49dcaa3", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math", "graphs", "shortest paths"], "code_uid": "bdb83e429e3ceeb5724eb75e1de29662", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "0 && $j==2){\n\t\t\t$bus[$i][$j] = \".\";\n\t\t}else if($n==0){\n\t\t\t$bus[$i][$j] = \"#\";\n\t\t}else{\n\t\t\t$bus[$i][$j] = \"O\";\n\t\t\t$n--;\n\t\t}\n\t}\n}\n\n//var_dump($bus);\necho \"+------------------------+\\n\";\necho \"|\";\nfor ($j=0; $j < 11; $j++) { \n\techo $bus[$j][0].\".\";\t\t\t\t\n}\necho \"|D|)\\n\";\n\necho \"|\";\nfor ($j=0; $j < 11; $j++) { \n\techo $bus[$j][1].\".\";\t\t\t\t\n}\necho \"|.|\\n\";\n\necho \"|\";\nfor ($j=0; $j < 11; $j++) { \n\techo $bus[$j][2].\".\";\t\t\t\t\n}\necho \"..|\\n\";\n\necho \"|\";\nfor ($j=0; $j < 11; $j++) { \n\techo $bus[$j][3].\".\";\t\t\t\t\n}\necho \"|.|)\\n\";\n\n\necho \"+------------------------+\\n\";\n\n", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "0d2028f55a14e016e68379a1ca5f081e", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.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\nclass Utils {\n\t/* Perform action N times. Can return values in array */\n\tstatic public function ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}\n\t/* Integral. Keys preserved. By reference. */\n\tstatic public function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}\n\t/* Difference. Keys preserved. By reference. */\n\tstatic public function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}\n\tstatic public function bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}\n}\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\nlist($n, $k) = $ir->readArrayOfInt(2);\n$xs = [];\nforeach(PrimeUtils::divisors($n) as $divisor=>$v) {\n\t$l = $divisor;\n\t$m = intval($n/$l);\n\t//echo \"$divisor, $l, $m, $k\\n\";\n\t\n\tif ($m<$k) {\n\t\t$xs[] = $k*$l + $m;\n\t}\n}\n\nif (empty($xs)) {\n\techo $n*$k+1;\n} else {\n\techo min($xs);\n}\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "f07eaf42a0b07b3e60473dbe37ea193a", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "1cff209b0732264c07f7d891465281ab", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "difficulty": 800.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " $d))\n {\n $c = 1;\n $b[$x] = $d;\n }\n elseif(($b[$x] != 9) && ($b[$x] < $d))\n {\n $c = 1;\n }\n elseif($b[$x] == 9)\n {\n $b[$x] = $d;\n }\n}\nprint implode(\"\", $b);\n?>", "lang_cluster": "PHP", "tags": ["greedy", "implementation"], "code_uid": "5776377559baed5f85de2684eba074c7", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " min($n, $m)){\n\techo 'Second', PHP_EOL;\n}else{\n\techo 'First', PHP_EOL;\n}", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms", "games"], "code_uid": "fb72f31379408d63ef893fc79ed30383", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= $b)\n {\n $f = 1;\n $h = array_slice($c, 0, $x);\n $i = array_slice($c, $x);\n break;\n }\n }\n if($f == 1)\n {\n $c = $h;\n $d[count($d)] = min($i);\n }\n if(count($c) > 0)\n {\n $r = 0;\n while(TRUE)\n {\n $j = array();\n for($x = 0; $x < count($c); $x++)\n {\n $k = pow($e, $x);\n $l = $c[$x] / $k;\n $j[$x] = $l;\n }\n asort($j);\n $m = array_keys($j);\n $n = floor($b / pow($e, $m[0]));\n $o = $n * $c[$m[0]];\n $r += $o;\n $b -= $n * pow($e, $m[0]);\n if($b <= 0)\n {\n $d[count($d)] = $r;\n break;\n }\n else\n {\n $d[count($d)] = $r + $c[$m[0]];\n $c = array_slice($c, 0, $m[0]);\n }\n }\n }\n $p = min($d);\n printf(\"%.0f\", $p);\n}\n?>", "lang_cluster": "PHP", "tags": ["greedy", "dp", "bitmasks"], "code_uid": "9ed88e4e076f76a668f3033d8f1e39af", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0) {\n $left -= (($kmin - 1) * $amin);\n\n if ($left > 0) {\n $r1 = min($left, $amin + $amax);\n } else {\n $r1 = 0;\n }\n} else {\n $r1 = 0;\n}\n\necho $r1;\n\n// max value\n\n$left = $n - ($kmin * $amin);\nif ($left > 0) {\n\n $r2 = $amin + min(floor($left / $kmax), $amax);\n} else {\n $r2 = floor($n / $kmin);\n}\n\necho ' ', $r2;", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "a59ca4a44feb245111f264d4ccd8ba7b", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0 ? $d_a : 0;\n$m_b = $d_b > 0 ? $d_b : 0;\n$m_c = $d_c > 0 ? $d_c : 0;\n$m = $m_a + $m_b + $m_c;\n\n//echo $m_a . \" \" . $m_b . \" \" . $m_c . \"\\n\";\n\n$e_a = -$d_a > 0 ? floor(-$d_a / 2) : 0;\n$e_b = -$d_b > 0 ? floor(-$d_b / 2) : 0;\n$e_c = -$d_c > 0 ? floor(-$d_c / 2) : 0;\n\n$e = $e_a + $e_b + $e_c;\n\n//echo $e_a . \" \" . $e_b . \" \" . $e_c . \"\\n\";\n\necho $e >= $m ? \"Yes\\n\" : \"No\\n\"\n\n?>", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "f03a8ff773719befcf58ec194dfd93de", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $c = $a % $x;\n array_push($m, $c);\n ($c >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $d = $a % $x;\n array_push($m, $d);\n ($d >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $e = $a % $x;\n array_push($m, $e);\n ($e >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $f = $a % $x;\n array_push($m, $f);\n ($f >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $g = $a % $x;\n array_push($m, $g);\n ($g >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $h = $a % $x;\n array_push($m, $h);;\n ($h >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $i = $a % $x;\n array_push($m, $i);\n ($i >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $j = $a % $x;\n array_push($m, $j);\n ($j >= 1) ? ($a = ($a - 1) / $x) : ($a = $a / $x);\n if($a >= $x)\n { \n $k = $a % $x;\n array_push($m, $k);\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n }\n else\n {\n array_push($m, floor($a));\n }\n $m2 = array_sum($m);\n }\n}\n$yy = 2;\nfor($y = 100; $y > 1; $y--)\n{\n if((($m2 % $y) == 0) && ((($a1 - $yy) % $y) == 0))\n {\n $m2 = $m2 / $y;\n $a1 = ($a1 - $yy) / $y;\n $yy = 0;\n }\n else\n {\n $xx++;\n }\n}\nif($xx == 100)\n{\n echo $m2, \"/\", $a1 - 2;\n}\nelse\n{\n echo $m2, \"/\", $a1;\n}\n?>", "lang_cluster": "PHP", "tags": ["math", "implementation"], "code_uid": "585cfd936216297b70850a6d50a5d420", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": " 0)\n {\n $c[count($c)] = $b[$x];\n }\n else\n {\n $d[count($d)] = $b[$x];\n }\n}\n$e = array_sum($c);\n$f = array_sum($d);\n$g = $e - $f;\nprint $g;\n?>", "lang_cluster": "PHP", "tags": ["greedy"], "code_uid": "b7382cfc52e2cfe6d2115df5f4645f4b", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.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]){ // \u548c\u4e5f\u8981\u662f\u7d20\u6570\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": "c9f45dd1ca09fb430173dfc206aaa5d8", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "", "lang_cluster": "PHP", "tags": ["number theory"], "code_uid": "a08b69f5a66056b8c258facb274038a7", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1000.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "\n", "lang_cluster": "PHP", "tags": ["math"], "code_uid": "55fbd53f4de84f55bf802195620a0fd6", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0, "exec_outcome": "PASSED"} {"lang": "PHP", "source_code": "13)\n\t\t\n\t\t\t$g1=abs($frst-26);\n\t\t\t//echo \"$g1\\n\";\n\t\t\n\t\telse\n\t\t\t$g1=$frst;\n\n\t\tif($secnd>15)\n\t\t\t$g2=abs($secnd-28);\n\t\telse\n\t\t\n\t\t\t$g2=abs($secnd-2);\n\t\t\t//echo \"$g2\\n\";\n\t\t\n\n\t\tif($thrd<6)\n\t\t\t$g3=abs($thrd+7);\n\t\telse\n\t\t\t$g3=abs(19-$thrd);\n\n\t\tif($frth>19)\n\t\t\t$g4=abs(32-$frth);\n\t\telse\n\t\t\t$g4=abs($frth-6);\n\t\t$count[$i]=$g1+$g2+$g3+$g4;\n \n\t\t\t\n\n\n\t\n\t\n}\n$min=$count[0];\nfor ($i=0; $i $y1)\n $ans1 = $y1;\n $n -= $ans1;\n $ans2 = $n - $x3;\n if($ans2 > $y2)\n $ans2 = $y2;\n $ans3 = $n - $ans2;\n echo $ans1;\n echo \" \";\n echo $ans2;\n echo \" \";\n echo $ans3;\n?>\n", "lang_cluster": "PHP", "tags": ["math", "greedy", "implementation"], "code_uid": "d261aa1ca690617bc910fd402cf98834", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0, "exec_outcome": "PASSED"}