{"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": " $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": "=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": " 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": "= 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": "", "lang_cluster": "PHP", "tags": ["brute force"], "code_uid": "35f95b8e0ec7f383232d170e93f038d4", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "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": "", "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": ["math", "games"], "code_uid": "39dca9d808feda56d10b7610de00c9ea", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "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\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": " 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": " $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": "", "lang_cluster": "PHP", "tags": ["brute force", "implementation"], "code_uid": "7b7e859014f6805ed4c96d7e364a60be", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.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": "", "lang_cluster": "PHP", "tags": ["math", "constructive algorithms"], "code_uid": "db67cf2a47fbbc671794cceeb6eef71c", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "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": "\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": "\n", "lang_cluster": "PHP", "tags": ["math", "number theory"], "code_uid": "cca36035ce50fa766ebe4c04d1eaa302", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.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": "$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": "", "lang_cluster": "PHP", "tags": ["implementation"], "code_uid": "d263269b2178732e0e96eb4e0a1d0fb1", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.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": ["brute force", "math", "binary search"], "code_uid": "d20b6f04cc7ccf844552fcd2a9d85dbc", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.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": "= 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": " $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": "74f36fdacb4faff7dd5a538bce798843", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "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": "= $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": "= 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": "_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": " 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"}