{"lang": "JavaScript", "source_code": "n = input()\ntot = 0\nfor i in range(0,len(n)):\n if n[i] == \"4\" or n[i] == \"7\":\n tot +=1\nif tot in (4,7):\n print(\"YES\")\nelse:\n print('NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5ca080c5f9be2cfc73fba526d8235403", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let str = readline();\nlet strLength = str.length;\n\nstr = str.split('7');\nstr = str.join('');\nstr = str.split('4');\nstr = str.join('');\n\n\nif((strLength - str.length) % 2 === 0 && strLength !== str.length) {\n write('YES');\n} else {\n write('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "08decf2595f9d684226d840d67131231", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "no = readline();\nvar txt = no.replace(/[47]/,'');\nif(!(txt.length)\n write(\"YES\\n\");\nelse \n write(\"NO\\n\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "766dbc49c1451ce8d6119ae9a730efcf", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar set = new Set();\n\nfor (let i = 0 ; i < input.length ; i++) {\n set.add(input[i]);\n}\n\nvar siz = set.size;\n\nif (siz % 2 == 1) {\n print(\"IGNORE HIM!\");\n}\nelse {\n print(\"CHAT WITH HER!\");\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7b18bd0e0621b910347301c3e2db20db", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline();\nlet set = new Set();\n\nfor (let i = 0 ; i < input.length ; i++) {\n set.add(input[i]);\n}\n\nif (set.size() % 2 == 0) {\n print(\"IGNORE HIM!\");\n}\nelse {\n print(\"CHAT WITH HER!\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e289064da266f516153944420b38164d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let s = readline();\nlet map = new Map();\nlet count = 0;\ns.split(\" \").forEach( c => {\n if(!map.has(c)) count++;\n else map.set(c, true);\n});\nprint(count);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "122e9e09517d05d49c8cea6e29e3308e", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function(a){\n\t\tvar m=0; \n\t\tvar a1= a.split(\"\").sort();\n\t\tvar a2= new Array();\n\t\tfor(i=0;i {\n if(!obj.has(c)) count++;\n else obj.set(c, true);\n});\nprint(count);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8ad76c519f02c9d8222b80f175e23684", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var m = {}\nvar username = readline().split('').map(function(c){ m[c] = true; });\nprint((Object.keys(m).length % 2) == 0) ? 'CHAT WITH HER!' : 'IGNORE HIM!');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "17c764aa93bd36e64086509f2c9965b2", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nlet line = readline(),\n countOfSymbols = new Array(30), \n subtract = 95,\n countOfDifferentSym = 0;\n\ncountOfSymbols.fill(0);\n\nfor (let i = 0; i < line.length; i++) {\n countOfSymbols[line.charCodeAt(i) - subtract]++;\n}\n\nfor (let i = 0; i < 30; i++) {\n if (countOfSymbols[i] == 1) {\n countOfDifferentSym++;\n }\n}\n\nif ( (countOfDifferentSym % 2) == 0) {\n print(\"CHAT WITH HER!\");\n} else {\n print(\"IGNORE HIM!\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6702cb6bdd3ca8c17d32b35a6b6d7430", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let username = readline().split(\"\");\n\nlet se = new Set();\n\nfor (let i = 0; i < username.length; i++) {\n se.add(username[i]);\n}\n\nif (se.size % 2 === 0) {\n print(\"CHAT WITH HER!\");\n} else {\n print(\"IGNORE HIM!\")\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d08346b77fd1410784ca37f25a099150", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar set = new Set();\n\nfor (let i = 0 ; i < input.length ; i++) {\n set.add(input[i]);\n}\n\nif (set.size() % 2 == 0) {\n print(\"IGNORE HIM!\");\n}\nelse {\n print(\"CHAT WITH HER!\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ea368b014f268fe38193ce7811c343d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n=readline();\n let x=0;\n for(let i=1; i<=n; i++){\n x+=Math.pow(-1,i)*i;\n }\n print(x);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "79d9e1b5adc544bf78ef7264f848dbca", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var n = readline();\n if(n%2==0){\n n/2;\n }else{\n -(n/2);\n }\n print((n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0160220eaea70143b206cebe648e0c44", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var n = +readline();\n if(n%2==0){\n n/2;\n }else{\n -(n/2);\n }\n print((n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b977eb26fbeff40790777ffcd1879173", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = +readline();\n print((n % 2 === 0) ? n/2 : -1*(Math.floor(n)/2)));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d0bfbbc59ea7ab7380ee054d7b2c1e3f", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var n = +readline();\n print((n % 2 === 0) ? n/2 : -1*(Math.floor(n/2));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fc80ca53e60979bbad429bedce17e204", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var entrada = parseInt(readline());\n \n var resultado;\n if(entrada%2==0)\n resultado=entrada/2;\n }else\n {\n resultado=Math.floor(entrada/2)*-1 ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e47e52855c2ade390a78c4f8e596d4a7", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var entrada = readline();\n var resultado;\n \n if(entrada%2==0)\n resultado/2;\n }else if(entrada%2!=0)\n {resultado= Math.floor(resultado/2)*-1 ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4ca3a6e5b80a5f1f2396569872a8631e", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n n=readline();\n var x=0;\n for(let i=1; i<=n; i++){\n x+=Math.pow(-1,i)*i;\n }\n print(x);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0ff77428fd346ef0ac90233f3d59657b", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var entrada = readline();\n \n var resultado;\n if(entrada%2==0)\n resultado=entrada/2;\n }else\n {\n resultado=Math.floor(entrada/2)*-1 ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0f5d030bbcf501417e308f708c84bfcf", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var entrada = readline();\n var resultado=0;\n \n if(entrada%2==0)\n resultado/2;\n }else if(entrada%2!=0)\n {resultado= Math.floor(resultado/2)*-1 ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5ca72feb641a883f6f9858c11a6846eb", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n=readline();\n x=0;\n for(let i=1; i<=n; i++){\n x+=Math.pow(-1,i)*i;\n }\n print(x);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "060db3abf0705dad319c23489846e95d", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var entrada = parseInt(readline());\n \n var resultado;\n if(entrada%2==0)\n resultado=entrada/2;\n }else\n {\n resultado=(entrada/2)*-1 ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "eca205ac57881cf8ab7eec6773fe86d6", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = +readline();\n print((n % 2 === 0) ? n/2 : -(Math.floor(n/2));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b39ee299b78f8d8064b26643b443fc30", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var entrada = parseInt(readline());\n \n var resultado;\n if(entrada%2==0)\n resultado=entrada/2;\n }else\n {\n resultado=Math.floor(entrada/2)*(-1) ;\n }\n \n print(resultado);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ce0ff0ffc1da025095d1397cb8d18e11", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var entrada = readline();\n \n \n if(entrada%2==0)\n entrada/2;\n }else\n {Math.floor(entrada/2)*-1 ;\n }\n \n print(entrada);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "08f2641e6e654df4a09b8649b044e031", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var n = readline();\n if(n%2==0){\n n/2;\n }else{\n (n/2)*-1;\n }\n print((n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b241f12a2fa5946b40f0c96fc315b963", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nvar c=n/2;\n print((n % 2 === 0) ? c : -(Math.floor(c));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "636366346e2305042a0e823a4031d5f6", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar posicion = datos[1]-1;\nvar participantes = datos[0];\nvar notas = readline().split(\" \");\nvar cont= 0;\nfor (var i=0; i=notas[posicion] && notas[i]>0){\n cont++;\n }else{\n print(0);\n }\n }\n print (cont);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4d29bef944d1b8a06b05115c91badc23", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [count, k] = readline().split(' ');\nvar input = readline().split(' ');\n\nfunction counter(input, k) {\n var minScore = +input[k];\n var advance = 0;\n if (minScore === 0) return 0;\n for (var i = 0; i < input.length; i++) {\n if (+input[i] >= minScore) advance++;\n }\n return advance;\n}\nprint(counter(input, k));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4d99449f56a606b87a49501aa9277b7b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [t, l] = readline.split(\" \");\nl -= 1;\nvar arr = readline.split(\" \");\nif(arr[l]==0){\n while(arr[l]<=0) l-=1;\n}\nelse{\n while(arr[l]==arr[l+1]) l+=1;\n}\nprint(l+1); ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "060d8d222150c6b878214dbeb84b257a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar corte = datos[1];\nvar participantes = datos[0];\nvar notas = readline().split(\" \");\nvar cont= 0;\nfor (var i=0; icorte && notas[0]>0){\n cont++;\n }else{\n print(0);\n }\n }\n print (cont);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3e83f24a4489a555beb4e7d7cdddf05b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var countK = readline().split(' ');\nvar input = readline().split(' ');\n\nvar minScore = input[countK[1]];\nvar advance = 0;\nfor (let i = 0; i < input.length; i++) {\n if (parseInt(input[i]) >= parseInt(minScore)) advance++;\n}\nprint(advance);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "238074c6beaa4913e1f8da111a5d7ab4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var dataPeople = readline().split(\" \"),\n k = parseInt(dataPeople[1], 10), n = parseInt(dataPeople[0] 10);\n\nvar dataResult = readline().split(\" \");\nvar answer;\n\nanswer = k;\n\nfor(var i = k+1, flag = true; flag; i++) {\n if(dataPeople[k]!=dataPeople[i]) {\n flag = false;\n }\n else {\n answer++;\n }\n}\n\nwrite(answer);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "49a2ffb7d30dd966c44fb716acd2d9fd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar notas = readline().split(\" \");\nvar cont= 0;\nfor (var i=0; i=notas[posicion]) && notas[i]!=0){\n cont++;\n }else{\n print(0);\n }\n }\n print (cont);\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "29d76002a62d94995f653c1858019910", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar posicion = datos[1]-1;\nvar notas = readline().split(\" \");\nvar cont= 0;\nfor (var i=0; i=notas[posicion]) && notas[i]>0){\n cont++;\n }else{\n print(0);\n }\n }\n print (cont);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae5e12082311e9a613ccfae970c46265", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet n,k;\nrl.on('line', line => {\n [n, k] = line.split(' ');\n);\n}).on('close', () => {\n const stdin=input[1].split(' ');\n\n const scores=stdin.map((stdin)=>{\n return Number(stdin);\n });\n let count=0;\n const thK=Number(k);\n scores.forEach(elm=>{\n if(elm>0 && elm>=scores[thK-1]){\n count++;\n }\n });\n console.log(count);\n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5e7b03737c85fd0a6cf721bb936ae937", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\n\nfor(var i = 0; i < nPart; ++i){\n var p = +points[i];\n if(p > 0 && p >= points[kPart - 1]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fd4b672e16077fb6d723b5b1f07b11c9", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = readline().split(\" \");\nvar y = readline().split(\" \");\nvar cnt = x[0];\nvar lmt = x[1];\nvar t = 0;\nvar arr[];\nfor (var i = 0; i < cnt; i++) {\n arr[i] = readline();\n}\nvar pos = arr[lmt];\narr.forEach(function(d) {\n if ( d > pos )\n t++;\n});\nwrite(t);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "59b08e4c8f86e26e0b575ae9c494fbba", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "nk = readline();\n valNLk = nk.split(\" \");\n array = [];\n counter = 0;\n \n for (let i = 0; i < valNLk.length; i++) {\n value = valNLk[i];\n convertToNumber = parseInt(value);\n array.push(convertToNumber);\n }\n arr = [];\n if (array[0] >= array[1]) {\n secondLineInputs = readline();\n secondLineSplited = secondLineInputs.split(\" \");\n secondLineSplited.map(el => {\n arr.push(parseInt(el));\n })\n \n for (k = 0; k < array[1]; k++) {\n if (arr[k] == 0 && arr[k + 1] == 0) {\n break;\n }\n if (arr[k] >= arr[k + 1]) {\n counter++;\n }\n if(arr[k] == arr[array[1]]){\n counter++;\n }\n }\n print(counter);\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d18564cfd8cca5e3af9096395c53ee8c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var users = readline().split(' '),\n scores = readline().split(' '),\n\nvar result = scores.reduce(function (count, x) {\n +x >= +scores[+users[1] - 1] && count++;\n\n return count;\n}, 0);\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "64347b686e3f2982b8989d31df18f1be", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\n\nfor(var i = 0; i < nPart; ++i){\n var p = +points[i];\n if(p > 0 && p >= +points[+kPart]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "30bd6c11ca73651818ce67f277c51d55", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n\nconst arr = [];\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nrl.on('line', (input) => {\n \n arr.push(input)\n\n if(arr.length == 2) {\n compute(arr);\n }\n});\n\nfunction compute(arr) {\n\n\n var parsed = [];\n parsed.push(splitMNumber(arr[0]))\n parsed.push(splitMNumber(arr[1]))\n\n var limit = parsed[0][1]\n var last = -1;\n var sum = 0;\n\n for(let i=0;i 0 && (limit > 0 || current == last)) {\n sum++;\n }\n else {\n break;\n }\n limit--;\n last = current;\n }\n\n console.log(sum)\n\n\n}\n\nfunction splitMNumber(str) {\n return str.split(\" \");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "36c4d59d0b80a4b4b00c770dace9c1fd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\npoints.forEach(point => {\n var p = parseInt(point);\n if(p > 0 && p >= points[kPart]) ++res;\n});\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "441c26935f5eb627fefb93d47ffc3c73", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var nk = readline().split(' ');\nvar an = readline().split(' ');\nvar nextrnd = 0;\n\nvar n = nk[0];\nvar k = nk[1] - 1;\n\nif(an[k - 1] > 0)\n\tnextrnd = k - 1;\n\nif(an[k] > 0)\n{\n\tvar i = k;\n\tvar found = false;\n\twhile(i < n && !found)\n\t{\n\t\t// if(an[i] == an[k])\n\t\t{\n\t\t\tnextrnd++;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t\tfound = true;\n\t}\n}\n\nprint(nextrnd);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "249a53996b341b767ce2c2c29441f3b7", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n = readline();\nk = readline();\nstr = readline().split(' ').map(Number);\n\nvar res = 0;\n\nfor (let i = 0; i < n; i++) {\n\tif (str[i] > k) {\n\t\tres++;\n\t};\n};\n\nprint (res);\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a607953eb2c2331fd1026576775bdebb", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [count, k] = readline().split(' ');\nvar input = readline().split(' ');\n\nvar minScore = input[k];\nvar advance = 0;\nfor (let i = 0; i < input.length; i++) {\n if (+input[i] >= +minScore) advance++;\n}\nprint(advance);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "470e39e8e1f3d5975784796a9e886607", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var dataPeople = readline().split(\" \"),\n k = parseInt(dataPeople[1]), parseInt(n = dataPeople[0]);\n\nvar dataResult = readline().split(\" \");\nvar answer;\n\nanswer = k;\n\nfor(var i = k+1, flag = true; flag; i++) {\n if(dataPeople[k]!=dataPeople[i]) {\n flag = false;\n }\n else {\n answer++;\n }\n}\n\nwrite(answer);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ee9ad2a8f9986dd38ceb14c697d39cd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var users = readline().split(' '),\n scores = readline().split(' '),\n\nprint(scores.reduce(function (count, x) {\n +x >= +scores[+users[1] - 1] && count++;\n\n return count;\n}, 0));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bf3f120d7876ac5b19f4cb702d964845", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet stdinInput = '';\n\nprocess.stdin.on('data', input => {\n stdinInput += input;\n})\n\nprocess.stdin.on('end', () => {\n main(stdinInput);\n})\n\nmain(data) => {\n stdinInput = data.split('\\n');\n const contestant = data[0].split(' ');\n const score = data[1].split(' ');\n const kScore = +contestant[1];\n let count = 0;\n for (let i = 0; i < score.length; i += 1) {\n if (+score[i] < 1 || +score[i] < kScore) break;\n count += 1;\n }\n process.stdout.write(count + '');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5bcd8f696a495890bbe9952136ce95f9", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n = readline();\nk = readline();\nstr = readline().split(' ').map(Number);\n\nlet res = 0;\n\nfor (let i = 0; i < n; i++) {\n\tif (str[i] > k) {\n\t\tres++;\n\t};\n};\n\nprint (res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e293943a57503e209f4636880dd894d0", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nx=readline().split(\" \")\nn=readline().split(\" \")\nvar count = 0\nfor(i=0 , i <= (n.length -1) , i++)\n{ if(n[i] >= x[1])\n\t{count++}\n}\nprint(count)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0c5433c2e4c343bdd9c76c2e79251969", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar puntuaciones = readline().split(\" \");\nvar cont= 0;\nvar posicion = parseInt(datos[1]-1);\nfor (var i=0; i=requisito) && (punt>0)){\n cont++;\n }\n }\n print (cont);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bd74bb44947d3b42f2c3ba31e3d4436b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = parseInt(readline());\nvar y = parseInt(readline());\nvar arr[ ];\nfor (var i = 0; i < x; i++) {\n arr[i] = readline();\n}\nvar pos = arr[y], t = 0;\narr.forEach(function(x) {\n if ( x > pos )\n t++;\n});\nwrite(t);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dc79074681edb98bf061f94de646861a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\n\nfor(var i = 0; i < nPart; ++i){\n var p = +points[i];\n if(p > 0 && p >= points[kPart]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f0368f6a573ab7cb124ee69871634368", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [n, k] = readline().split(\" \").map(Number);\nvar score = readline().split(\" \").map(Number);\n\nvar res = k;\nif(score[k-1] === 0)\n print(0);\nelse{\n for(var i = k; i < n; i++){\n if(score[i] === score[k-1])\n k++;\n }\n print(k);\n} \n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d7a1765a448bafa982ac537e95db2a2c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\n\nfor(var i = 0; i < nPart; ++i){\n var p = parseInt(points[i]);\n if(p > 0 && p >= points[kPart]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae1a5dd9d35cdf629e20a983aa8beb22", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n n_k = readline(\"enter n and k\").split(\" \");\n let nk,\n val,\n counter = 0;\n for (let i = 0; i < n_k.length; i++) {\n n_k[i] = +n_k[i];\n nk = n_k;\n }\n secondLine = readline(\"Enter the n numbers of participats\").split(\" \");\n for (let j = 0; j < secondLine.length; j++) {\n secondLine[j] = +secondLine[j];\n val = secondLine;\n }\n kPlace = val[nk[1] - 1];\n for (let a = 0; a <= val.length - 1; a++) {\n if (val[a] == 0 && val[a + 1] == 0) {\n break;\n }\n \n if (val[a] >= kPlace) {\n counter++;\n }\n }\n\n print(counter);\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c53da1f8041414d223d51aaffb00e105", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar posicion = datos[1]-1;\nvar participantes = datos[0];\nvar notas = readline().split(\" \");\nvar cont= 0;\nfor (var i=0; i=notas[posicion]) && notas[i]>0){\n cont++;\n }else{\n print(0);\n }\n }\n print (cont);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d1e13b9ecc11a169e51affaac78c48d0", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = readline().split(\" \");\nvar scores = readline().split(\" \");\nvar cnt = x[0];\nvar mid = scores[x[1]-1];\nvar t = 0;\nvar arr[];\nfor (var i = 0; i < cnt; i++) {\n if(!scores[i])\n break;\n if(parseInt(scores[i]) >= parseInt(scores[lmt-1]))\n t++;\n else\n break;\n}\nwrite(t);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f423fc9e5c99eda7688523749d951064", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = readline().split(' ');\nvar playerScoreArray = readline().split(' ');\nvar ans = 0;\n\nfor(var i = 0; i < x[0]; i++){\n if(playerScoreArray[i] >= playerScoreArray[x[1]]){\n ans++;\n }\n print(playerScoreArray[i] + \" >= \" + playerScoreArray[x[1]] + \" = \" ans);\n}\n\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ee7889baf16d45eec9661d7a99f4b7da", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [nPart, kPart] = readline().split(' ');\nvar points = readline().split(' ');\nvar res = 0;\n\n\nfor(var i = 0; i < nPart; ++i){\n var p = Number(points[i]);\n if(p > 0 && p >= points[kPart]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7bb96bb416b129611139d37ab80b57ad", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [t, l] = readLine.split(\" \");\nl -= 1;\nvar arr = readLine.split(\" \");\nif(arr[l]==0){\n while(arr[l]<=0) l-=1;\n}\nelse{\n while(arr[l]==arr[l+1]) l+=1;\n}\nprint(l+1); ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7ae8986ccd93b4883aba053c46bfc06f", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line_one = readline().split(\" \");\n var line_two = readline().split(\" \");\n var n =parseInt(line_one[0]);\n var k = parseInt(line_one[1]);\n var count =0;\n\n for (var i=0;i=Number((line_two[k-1])) ){\n count++;\n\n }\n \n }\n print(count);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b8fe80a66ef1e5060799f981876a1b37", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nx=readline().split(\" \")\nn=readline().split(\" \")\nvar count \nfor(i=0 , i <= (n.length -1) , i++)\n{ if(n[i] >= x[1])\n\t{count++}\n}\nprint(count)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "077091f446bb96c5477b4dbefa486029", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let result = 0\nlet currentLimit = 0\nlet lastScore = 0\n\nvar [participatns, placeLimit] = readline().split(' ')\nvar scores = readline().split(' ')\n\nfor (var i = 0; i < participatns; i++) {\n// if first item zero or lower return 0\nif (scores[0] < 1) break;\n\nconst currentScore = scores[i]\n// filter participatns by min required value\n// stop loop when reached limit\nif (currentScore >= 1 && currentLimit <= placeLimit || lastScore === currentScore) {\n result++\n currentLimit++\n lastScore = currentScore\n} else {\n break;\n}\n}\n\nprint(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4b97044dd3e3ebdb908ae4f8a3004d05", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar corte = datos[1];\nvar participantes = datos[0];\nvar notas = readline().split(\" \");\nvar cont++;\nfor (var i=0; icorte){\n cont++;\n }\n print cont;\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f88daeacb81dfa9a778f5081acf800c5", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nx=readline().split(' ')\nn=readline().split(' ')\nvar count = 0\nfor(i=0 , i <= (n.length -1) , i++)\n{ if(int(n[i]) >= int(x[1]))\n\t{count++}\n}\nprint(count)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4f67955d54f4d8e922745976306fe129", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nx=readline().split(' ');\nn=readline().split(' ');\nvar count = 0;\nfor(i=0 , i <= (n.length -1) , i++)\n{ if(int(n[i]) >= int(x[1])\n\t{count++;}\n}\nprint(count)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "734693d79126099dd97e937aba51fc57", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var dataPeople = parseInt(readline().split(\" \")),\n k = dataPeople[1], n = dataPeople[0],10;\n\nvar dataResult = readline().split(\" \");\nvar answer;\n\nanswer = k;\n\nfor(var i = k+1, flag = true; flag; i++) {\n if(dataPeople[k]==dataPeople[i]) {\n answer++;\n }\n else {\n flag =false;\n }\n}\n\nwrite(answer);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "47b4cc744859846b2f9f8c9e8e67501e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [numberOfParticipants, qualPosition] = readline();\nvar results = readline();\nvar qualScore = results[qualPosition];\n\nvar qualifiers = results.filter(result => result >= qualScore);\n\nprint(qualifiers.length);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4c2957ce4a2140f052c62b11edddd7d4", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = readline().split(\" \");\nvar y = readline().split(\" \");\nvar arr[];\nfor (var i = 0; i < x; i++) {\n arr[i] = readline();\n}\nvar pos = arr[y], t = 0;\narr.forEach(function(x) {\n if ( x > pos )\n t++;\n});\nwrite(t);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "95a6ea4785224b50e3fcb72eb36e1331", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var result = 0\n var currentLimit = 0\n var lastScore = 0\n\n var [participatns, placeLimit] = readline().split(' ')\n var scores = readline().split(' ')\n\n for (var i = 0; i < participatns; i++) {\n // if first item zero or lower return 0\n if (scores[0] < 1) break;\n\n var currentScore = scores[i]\n // filter participatns by min required value\n // stop loop when reached limit\n if (currentScore >= 1 && currentLimit <= placeLimit || lastScore === currentScore) {\n result++\n currentLimit++\n lastScore = currentScore\n } else {\n break;\n }\n }\n\n print(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "916a046ed737b4e9dcd604809b5732b8", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "/*\n\"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score...\" \u2014 an excerpt from contest rules.\n\nA total of n participants took part in the contest (n\u2009\u2265\u2009k), and you already know their scores. Calculate how many participants will advance to the next round.\n\nInput\nThe first line of the input contains two integers n and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u200950) separated by a single space.\n\nThe second line contains n space-separated integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u2009100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i from 1 to n\u2009-\u20091 the following condition is fulfilled: ai\u2009\u2265\u2009ai\u2009+\u20091).\n\nOutput\nOutput the number of participants who advance to the next round.\n\nExamples\ninput\n8 5\n10 9 8 7 7 7 5 5\noutput\n6\ninput\n4 2\n0 0 0 0\noutput\n0\nNote\nIn the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.\n\nIn the second example nobody got a positive score.\n*/\n\nvar input = readline().split(\" \");\nvar input2 = readline().split(\" \");\nvar participantes = input[0];\nvar nota_corte = input[1];\nvar pasan;\n\nfor (var y = 0; y <= input2.length;y++){\n\tif(input2[y]>nota_corte){\n\t\tpasan++;\n\t}\n}*/\nprint(pasan);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "674a57fcda96c675a7c469873d12af3d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [t, l] = readLine.split(\" \");\nl -= 1;\narr = readLine.split(\" \");\nif(arr[l]==0){\n while(arr[l]<=0) l-=1;\n}\nelse{\n while(arr[l]==arr[l+1]) l+=1;\n}\nprint(l+1); ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "adb32746d6a7059a6886b6253b9b4394", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var datos = readline().split(\" \");\nvar corte = datos[1];\nvar participantes = datos[0];\nvar notas = readline().split(\" \");\nvar cont++;\nfor (var i=0; icorte){\n cont++;\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "32be6208c5a6a34cd3ce32eee5329d0c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var size = readline() - 0;\nvar line = readline();\nvar arr = ['Vaporeon', 'Jolteon', 'Flareon', 'Espeon', 'Umbreon', 'Leafeon', 'Glaceon' , 'Sylveon'];\n// var size = 7;\n// var line = 'j......';\nvar has_found = 0;\nfor(let i in arr){\n if(arr[i].search(RegExp(line,'i'))==0){\n print(arr[i])\n has_found = 1\n break;\n }\n}\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c29322036fe4d7679e749345b1c585bb", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arr=readline().split('+');\nvar i,j;\nfor(i=0;iarr[j+1])\n {\n var tmp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=tmp;\n }\n }\n}\n//arr.sort();\nvar ans_str=\"\";\nfor(i=0;i= 0; i--) {\n temp += params[i]\n }\n console.log(temp)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "10f445cff1a3185abaeb5ff392f68b53", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function get(str) {\n const array = str.split(\"+\").map(item => +item);\n const radix = [[],[],[],[]];\n\n for (let i = array.length - 1; i >= 0; i--) {\n radix[array[i] % 10].push(array[i]);\n }\n\n let ans = \"\";\n\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < radix[i].length; j++) {\n ans += radix[i][j] + \"+\"; \n }\n }\n\n return ans.slice(0, -1);\n}\n\nconst line = readline();\nprint(get(line));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9ecf15c258b1e9c0c9867445a487a8b0", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "(function () {\n print(readline().split('+').map(function(k){return parseInt(k);}).sort(function(d,c){return d-c;}).join('+'));}).call(this);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d025cc5ab6b6dc4070fc2b1898b54d74", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let array = readline().split('+').sort();\nlet result ='';\narray.forEach(function(symbol,index,array)\n {\n if (index !== array.length - 1)\n {\n result += symbol + '+';\n }\n else\n {\n result += symbol;\n }\n\n }\n);\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d328d5d4b943715706c24c3b14b57322", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const array = readline().split(\"+\").map(item => +item);\nconst radix = [[],[],[],[]];\n\nfor (let i = array.length - 1; i >= 0; i--) {\n radix[array[i] % 10].push(array[i]);\n}\n\nlet ans = \"\";\n\nfor (let i = 0; i < 4; i++) {\n for (let j = 0; j < radix[i].length; j++) {\n ans += radix[i][j] + \"+\"; \n }\n}\n\nprint(ans.slice(0, -1));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6a7bd94782020bd4da104ea61ce84072", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "x = readline();\nvar ps[];\nvar t = 0;\nfor (var i = 0; i < x.length; i++) {\n if(x[i] != '+')\n ps[t] = parseInt(x[i]), t++;\n}\nps.sort();\nfor (var i = 0; i < ps.length; i++) {\n write(ps[i] + '+');\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b9f8821cd81e3032293a606dcaa1e36f", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let cli = +readline() / 2;\ncli % 2 === 0 ? print('YES') : print('NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "22671ea623d1e783d9b6db9019eb7f17", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine(parseInt());\nif(w<2 && w%2===0) {\n console.log(\"YES\");\n} else {\n console.log(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cf8307a30dafac7b0e9a641796dd97da", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3bd22dd982849a662b232928345e9efd", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let pesos = new Array(100 + 1);\nlet peso = readline();\n\npeso = Number(peso);\n\npesos[0] = pesos[1] = pesos[2] = \"NO\"; \nfor(let i = 3; i < pesos.length; ++i)\n{\n\tpesos[i] = (i%2 === 0 ? \"YES\" : \"NO\");\n}\n\nprint(pesos[peso]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c36e30fe52529dadaa33bf401a94f89d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = parseInt(readline());\nif(w/2%2 === 1) {\n write(\"YES\")\n}else{\n write(\"NO\")\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "69be7c7ba4ec1077e38696b543af3e91", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = prompt('what is weight','');\nif(w>2)\n {\n w=w%2 ; \n if(w===0)\n {\n document.write('yes');\n }\n else\n {\n document.write('yes');\n }\n }\nelse\n {\n document.write('yes');\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "266039851caf5b702f57ea0c416901a4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function isDivisible(n) {\n return n % 2 === 0;\n}\n \nlet num = parseInt(readline());\n \nwhile(num) {\n print(isDivisible(num));\n\n num = parseInt(readline());\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f18a50888efc661d4e9b81bac4efb4e5", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x;\nx = prompt(\"\");\n\nif(Number(x) % 2 == 0){\n alert(\"YES\");\n}\nelse{\n alert(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a9296a1cdcb9bd0e72fe127e02170a53", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nlet number = parseInt(readline());\nif((number - 2) % 2 == 0 && number > 2){\n write('YES')\n} else {\n write('NO')\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "217086794b57aaa7e9ea72c1a23b6117", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let value = parseInt(readline())\nlet response = value % 2 == 0 ? \"YES\" : \"NO\"\nprint(response)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ea0334fb231f4f65e445dc433400b1e6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//------------------------//\n//template\n//------------------------//\nif(typeof _debug == \"undefined\"){\n\tvar _debug = false;\n}\nvar stdout = \"\";\nvar stdin = \"\";\n\nvar setstdin = function(str){\n\tstdin = str;\n}\n\n//for debug\nif(typeof readline != \"function\"){\n\t_debug = true;\n\tvar readline = function(){\n\t\tif(stdin){\n\t\t\tvar spl = stdin.split(\"\\n\");\n\t\t\tvar fl = spl[0];\n\t\t\tspl.shift();\n\t\t\tstdin = spl.join(\"\\n\");\n\n\t\t\treturn fl;\n\t\t}else{\n\t\t\tconsole.warn(\"stdin is empty\")\n\t\t}\n\t}\n\tvar write = function(x){\n\t\tstdout += x;\n\t}\n\tvar print = function(x){\n\t\tstdout += x + \"\\n\";\n\t}\n}\n\n\nfunction lines(n){\n l = [];\n a = true;\n for(;n--;){\n a = readline();\n l.push(a.split(\" \"));\n }\n return l;\n}\n\n//------------------------//\n//code\n//------------------------//\n(function(){\n\tlin = lines(1);\n\tlin = lin[0]|0;\n\n\twrite(lin & 3?:\"NO\":\"YES\");\n})();\n//------------------------//\n//code ends\n//------------------------//\n\nif(_debug){\n\tconsole.log(\"stdout:\\n\"+stdout)\n};\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "21ffdca6fd9e2f7990fcb7a32ce63b9a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "a=readline();\nprint(a%2==0&&a!=2?'YES':'NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8ce08a5fddf3dc48f071de386cff049a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = readline()\nif(a>2 && a%2 === 0) {\n console.log(\"YES\")\n} else {\n console.log(\"NO\")\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1b9119c15b6722a36fe1ef2b9fef8de8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\na=readline();\nif((a%2)==0){\n console.log(\"yes\")}\n else{ \n console.log(\"no\")}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "993c9a0aa02edb3830bd2cb99c57b535", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfunction(input){\n if((input % 2) == 0){\n print('YES');\n } else {\n print('NO');\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "04538e2b5d883c5191e15e8e2efbce84", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function(input) {\n\tif (input % 2 == 0) {\n\t\treturn true\n\t}\n\treturn false;\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae91eea9580c51caac4d6500ac2b3049", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let pesos = [];\nlet peso = readline();\n\npeso = Number(peso);\n\npesos[0] = pesos[1] = pesos[2] = \"NO\"; \nfor(let i = 3; i < 100 + 1; ++i)\n{\n\tpesos[i] = (i%2 === 0 ? \"YES\" : \"NO\");\n}\n\nprint(pesos[peso]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cb125015004222d1968b1f813bdade65", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = readLine();\nif (a % 2 === 0 && a !== 2){\n print(\"YES\");\n}else{\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1b6b2900702b4622ba0d663f2e646840", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = parseInt(s);\n\tif(n!=2&&n%2==0){\n\t\t//console.log(\"NO\");\n\t\t print(\"YES\");\n\t}\n\telse \n\t\t//console.logt(\"YES\");\n\t print(\"NO\");\n\t \n})();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dffbbc016493d8dbf84c26d4688b811e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const amount = parseInt(readline());\nconst secondPart = amount - 2;\n \nconst solve = () => {\n if(amount > 0 && amount % 2 === 0) {\n return {a:'YES'};\n }\n \n return {a:'NO'};\n}\n\nconst { a: answer } = solve();\n\nwriteln(answer)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fa69f3c0d04b1a3e399295062bccd7d7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nif ( line[0] > 3 && line !% 2 ) {\n print('YES') ;\n}\nelse {\n print ('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cbe39cba969ae97c9715d21c5a2a1c89", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let k = readLine()\nif(k === 2 || k % 2 !== 0){\n console.log('NO')\n}else{\n console.log('YES')\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c3c7ff5a45734df246c6e9b1292302ed", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let randomNum = readline();\nif (randomNum % 2 === 0)\n print('YES');\nelse\n print('NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "46f5ccacdfa12070c03c2c67745f70da", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var a = readline();\n for (let i = 0; i < a; i++) {\n if (a === 2) {\n print(\"NO\");\n } else if (a % 2 === 0) {\n print(\"YES\");\n } else {\n print(\"NO\");\n }\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "485818c05c0124617f25be6b859c4e1d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight=readline();\nif(weight==2||weight%2==1){\n print(\"NO\");\n}else if(weight%2==0){\n print(\"YES\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "08f199fc1051d02f982a437858c6224f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface({\n input: process.stdin[],\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', function(line){\n console.log(line);\n})", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "87748def313ad9c093be5d03280d7808", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//------------------------//\n//template\n//------------------------//\nif(typeof _debug == \"undefined\"){\n\tvar _debug = false;\n}\nvar stdout = \"\";\nvar stdin = \"\";\n\nvar setstdin = function(str){\n\tstdin = str;\n}\n\n//for debug\nif(typeof readline != \"function\"){\n\t_debug = true;\n\tvar readline = function(){\n\t\tif(stdin){\n\t\t\tvar spl = stdin.split(\"\\n\");\n\t\t\tvar fl = spl[0];\n\t\t\tspl.shift();\n\t\t\tstdin = spl.join(\"\\n\");\n\n\t\t\treturn fl;\n\t\t}else{\n\t\t\tconsole.warn(\"stdin is empty\")\n\t\t}\n\t}\n\tvar write = function(x){\n\t\tstdout += x;\n\t}\n\tvar print = function(x){\n\t\tstdout += x + \"\\n\";\n\t}\n}\n\n\nfunction lines(n){\n l = [];\n a = true;\n for(;n--;){\n a = readline();\n l.push(a.split(\" \"));\n }\n return l;\n}\n\n//------------------------//\n//code\n//------------------------//\n(function(){\n\tlin = lines(1);\n\tvar w = lin[0]|0;\n\n\tvar f = false;\n\tfor(var i = 0; i++ < w && !f;){\n\t\tif(!(w-i&1) && !(i&1))){\n\t\t\tf = true;\n\t\t}\n\t}\n\n\twrite(f?\"YES\":\"NO\");\n})();\n//------------------------//\n//code ends\n//------------------------//\n\nif(_debug){\n\tconsole.log(\"stdout:\\n\"+stdout)\n};\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "95cc5742b878f8a870faec7b89530fa7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a= readline();\nif(a%2===0) print(\"YES\") else print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "682c034a77e4b5a6284697f74cbdef35", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "/**********************************************************/\t\n/* CODIGO INICIAL A ANYADIR PARA USAR READLINE Y PRINT */\n/**********************************************************/\n\nconst print = console.log;\nconst readline = utf8readline;\nfunction utf8readline() {\n var r = '', b=new Buffer(10), bi=0, bl=0;\n b.fill(0);\n while (1) {\n var br = require('fs').readSync(0, b, bi, 1,null);\n if (!br) {\n readline.eof = true;\n r += b.toString('utf-8', 0, bi);\n return r;\n }\n var byte = b[bi];\n bi += br;\n \n if (bl) {\n bl--;\n if ((byte & 0xC0) !== 0x80) {\n console.error('readline: invalid utf-8 code point');\n }\n }\n else {\n if ((byte & 0xC0) == 0x80) {\n console.error('readline: invalid utf-8 code point');\n }\n if ((byte & 0xE0) == 0xC0) {\n bl = 1;\n }\n if ((byte & 0xF0) == 0xE0) {\n bl = 2;\n }\n if ((byte & 0xF8) == 0xF0) {\n bl = 3;\n }\n }\n\n var eoln = byte == 0x0A;\n if (eoln) {\n bl = 0;\n bi--;\n }\n\n if (!bl) {\n r += b.toString('utf-8', 0, bi);\n bi=0;\n }\n\n if (eoln || readline.eof) {\n return r;\n }\n }\n}\n\n\n/**********************************************************/\t\n/* FIN CODIGO INICIAL A ANYADIR PARA USAR READLINE Y PRINT */\n/**********************************************************/\n\n\n\n// AQUI EMPIEZA LA RESPUESTA DEL ALUMNO\n\nvar num = readline();\n\nif(num > 2 $$ num % 2 == 0) {\n print(\"YES\");\n} else {\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bf5936182029ab999eb7959f9de0149b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nif ( line[0] > 3 && line !% 2 ) {\n print('YES') ;\n}\nelse {\n print ('NO')\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b3db807bb9199b427541a1328e7a4cb2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ececb7a8493eb55ae10648c28bb2d2b8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine().parseInt();\n\nfunction watermelon(n) {\n if(n>2 && n%2===0) {\n console.log(\"YES\");\n } else {\n console.log(\"NO\");\n }\n}\nwatermelon(w);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6034c4a4fac2e51710e4b71bf392a116", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let value = readline()\nlet response = parseInt(value) % 2 == 0 ? \"YES\" : \"NO\"\nconsole.log(response)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7a26dabbd142d686fad9641371e52b16", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine().parseInt();\n\nfunction watermelon() {\n if(w>2 && w%2===0) {\n console.log(\"YES\");\n } else {\n console.log(\"NO\");\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f3d716c52a220f977c0d44c7b299a878", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline.(function water(x){\n \n if(x*2==0){\n return 'YES'\n } return 'NO'\n \n})", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9e9ed892fef6637224cd263ac5ef2731", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var w = readline();\n \n for (let i = 0; i < w; i++) {\n if (w == 2) {\n console.log(\"NO\");\n } else if (w % 2 === 0) {\n console.log(\"YES\");\n } else {\n console.log(\"NO\");\n }\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e152e33aa712526b2e1fc8f3a4711e91", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = () => `8`;\nconst print = (str) => console.log(str);\n\n(() => {\n 'use strict';\n\n const [w] = readline().split(\" \").map(x => parseInt(x));\n\n const ok = () => {\n print(\"YES\");\n };\n\n const fail = () => {\n print(\"NO\");\n };\n\n if (!(w >= 1 && w <= 100)) {\n return fail();\n }\n\n if (w % 2 === 0) {\n return ok();\n }\n\n fail();\n\n})();\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "07f33068f958ea39ea1e982adf88ba18", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = prompt('Enter a weight for the watermelon');\n\nif(input >= 1 || input <= 100 && (!isNaN(input) && input !== null)) {\n if((input%2===0) && ((input/2)%2===0))\n console.log('YES');\n else\n console.log('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "646319a4a5ee8eb39919793adce8a36a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// let x = readline()\n// .split(\" \")\n// .map(function (x) {\n// return parseInt(x);\n// });\n\nlet x = readline();\n\nif ((parseInt(x) / 2) % 2 == 0) {\n write(\"YES\");\n} else {\n write(\"NO\");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c1c9842b1be0a4a4e357972cbcd4afe7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function nextInt() {\n return parseInt(nextString());\n}\n\nfunction nextFloat() {\n return parseFloat(nextString());\n}\n\nlet input_stdin = \"\";\nlet input_cursor = 0;\n\nfunction nextString() {\n let next_string = \"\";\n clearWhitespaces();\n while (input_cursor < input_stdin.length && !isWhitespace(input_stdin[input_cursor])) {\n next_string += input_stdin[input_cursor];\n input_cursor += 1;\n }\n return next_string;\n}\n\nfunction nextChar() {\n clearWhitespaces();\n if (input_cursor < input_stdin.length) {\n return input_stdin[input_cursor++];\n } else {\n return '\\0';\n }\n}\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('ascii');\nprocess.stdin.on('data', function (data) { input_stdin += data; });\nprocess.stdin.on('end', function () { main(); });\n\nfunction isWhitespace(character) {\n return ' \\t\\n\\r\\v'.indexOf(character) > -1;\n}\n\nfunction clearWhitespaces() {\n while (input_cursor < input_stdin.length && isWhitespace(input_stdin[input_cursor])) {\n input_cursor += 1;\n } \n}\n\nfunction main() {\n let x = nextInt();\n if (x % 2 === 1 || x === 2)console.log(\"NO\"); else console.log(\"YES\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "26eff6f13dff887f50dbeb8f1095c4a6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nif (n % 2 == 0) {return \"YES\";} else {return \"NO\";}}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ce328d7a3e59b83980b8dc4c9a6eb2ae", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine();\n\nif(w%2 === 0) {\n print('YES');\n} else {\n print('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ff6e6129a9fa55020d7d0677fc47756d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = readLine();\nfunction task1(a){\n return (a%2)==0&&a!=2 ? \"YES\":\"NO\"\n}\nconspole.log(task1(a));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5fcb0b37ce66341caaf18c43becdb4f4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine().parseInt();\n\nfunction watermelon(n) {\n if(n>2 && n%2===0) {\n console.log(\"YES\");\n } else {\n console.log(\"NO\");\n }\n}\nprint(watermelon(w));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "42b06d84311fa99578f4511509143ace", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "57bfeb92d6f9ee55d976ecb6e48cb315", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nfunction main(x) {\n console.log(x % 2 == 0 && x > 3 ? 'YES' : 'NO');\n}\n\nconst a;\n\n// single line input\nreadline.on('line', line => {\n a = line;\n readline.close();\n});\n\n// multi line input\n// readline.on('line', line => {\n// console.log(line);\n// });\n\nmain(a);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "463a95b2ec90ad96ec7b9f61447a147a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a=readline();\nprint(a%2==0&&a>2?'YES':'NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6f9cd87576d530b9e7137d603ce3de6e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = 3;\nw%2 === 0 ? console.log(\"yes\") : console.log(\"no\")", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d82525451bb5397f85e39e1a10dded9d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight = readline();\nif (weight % 2 === 0 && weight > 2) {\n console.log(\"YES\");\n} else {\n console.log(\"NO\");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5e005fd315610aade04e6970f3a1cde7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = window.prompt('Enter a weight for the watermelon');\n\nif(input >= 1 || input <= 100 && (!isNaN(input) && input !== null)) {\n if((input%2===0) && ((input/2)%2===0))\n console.log('YES');\n else\n console.log('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6dee3296bde11ab839e509a9f7e7e569", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var stdin = process.openStdin();\n\nstdin.addListener(\"data\", function(d) {\n let weight = d.toString().trim()\n\n if (weight % 2 == 0 && weight > 2) {\n console.log(\"YES\");\n } else {\n console.log(\"NO\");\n }\n });\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7bf8b95968ba5eed208ffd56a54ca9ae", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let randomNum = +prompt('\u043e\u0442 1 \u0434\u043e 100','');\nif (randomNum % 2 === 0)\n console.log('YES');\nelse\n console.log('NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8364c2c5c17d73f7c7189b66721c9b36", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let num = Number.isInteger(w/2)\n\nif(num){\n return 'YES'\n}else{\n return 'NO'\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "22ab16018a0af3b20fdc7db551ded0ed", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline();\nw%2 === 0 ? print(\"yes\") : print(\"no\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5d10113c06f69e3a5463ada4f4972a1c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function isDivisible(n) {\n return n % 2 === 0;\n}\n\nfunction main() {\n let num;\n\n while(num = parseInt(readline()) {\n print(isDivisible(num));\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4a65a0ccc620c4767d5b1160e3b50b56", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let line = readline().split(' ');\nlet b = line[0] - 2;\nprint( (b > 0 && b % 2 === 0) ? 'YES' : 'NO' );", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f61b68d93364aa2ea9d056679e00598f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight=readline();\nif(weight==2){\n print(\"NO\");\n}else if(weight%2==0){\n pirnt(\"YES\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3f28792f576c9aebf1213d53722cebb9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f554f8ba1bfc230340d38ae04ec9a522", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine();\n\nfunction watermelon(w) {\n if(w>2 && w%2===0) {\n print(\"YES\");\n } else {\n print(\"NO\");\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "00b856667ff2d1d043d753f475eb2ccb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\nlet a = prompt(\"Please enter your number\");\nif ( a % 2 === 0 && a>2) {\n console.log(\"yes\");\n}\nelse{\n console.log(\"No\")\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5ee4c42adc2efd2ef9dece1fb3db075f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let randomNum = +prompt('\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u0441\u0441\u0443 \u0430\u0440\u0431\u0443\u0437\u0430 \u0432 \u043a\u0433 \u043e\u0442 1 \u0434\u043e 100 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e','');\nif (randomNum % 2 === 0)\n console.log('YES');\nelse\n console.log('NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "161655abb456c0d41422e1b59d6abe42", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main(){\n const w = readLine();\n if w%2===0{\n console.log(\"YES\");\n }\n else{\n console.log(\"NO\");\n }\n \n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "84eeb6cf3a8649a1eff35ba1e99d48e4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "'use strict';\n//const readline = () => `7`;\n\nconst [w] = readline().split(\" \").map(x => parseInt(x));\n\nconst ok = () => {\n console.log(\"YES\");\n};\n\nconst fail = () => {\n console.log(\"NO\");\n};\n\n(() => {\n\n if (!(w >= 1 && w <= 100)) {\n return fail();\n }\n\n if (w % 2 === 0) {\n return ok();\n }\n\n fail();\n\n})();\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c35074959dee69763e75711637cd6169", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const nmk = readline().split(\" \").map((x) => { return parseInt(x); });\n const N = nmk[0];\n const M = nmk[1];\n const K = nmk[2];\n const numbers = readline().split(\" \").map((x) => { return parseInt(x); });\n\n let cl = new Array(M);\n\n for (let i = 0; i < N; i++) {\n if (!(cl[numbers[i]])) {\n cl[numbers[i]] = [];\n }\n cl[numbers[i]].push(i + 1);\n }\n\n let res = new Array(K);\n let num = 0;\n for (let i = 1; i < M + 1; i++) {\n for (let j = 0; j < cl[i].length; j++) {\n if (!(res[num])) {\n res[num] = [];\n }\n res[num].push(cl[i][j]);\n num = (num + 1) % K;\n }\n }\n\n for (let i = 0; i < K; i++) {\n let resStr = res[i].length;\n for (let j = 0; j < res[i].length; j++) {\n resStr += ' ' + res[i][j];\n }\n print(resStr);\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "169c89a11e8244a9e758f40017a58f73", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "import java.*;\n\npublic static void main( String[] args){\n Scanner scan = new Scanner(System.in);\n String number = scan.next();\n if((number % 2) == 0){\n System.out.print('YES');\n } else {\n System.out.print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cfb73a55eba935bac01ab06347325cb2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var w = readline();\n\tif(w%2==0)\n\t{\n\t\tprint(\"YES\");\n\t}\n\t\telse \n\t\t{\n\t\t\tprint(\"NO\");\n\t\t}\n\t\telse if(w==2)\n\t\t{\n\t\t\tprint(\"NO\");\n\t\t}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "592887e4e66a9e23cf466e3dba58db57", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = prompt('what is weight','');\nif(w>2)\n {\n w=w%2 ; \n if(w===0)\n {\n console.log('yes');\n }\n else\n {\n console.log('no') ;\n }\n }\nelse\n {\n console.log('no');\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1771c32f96b50d86500905a54ccc1a9f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline();\n \nif ((w % 2 === 0) && (w != 2)) {\n print(\"YES\");\n} else {\n print(\"NO\");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c2af385329aa6706cc9bc5c6cd6bf5f7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const a = parseInt(readline());\nconst d = a % 2 === 0;\n\nlet r;\n\nd ? r = 'YES' : null;\n\nprint(r);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae49c93c18c7a1551bc162fb870ae4ff", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n//const lineReader = require('fs');\n//const scanner = lineReader.createReadStream('main.in');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nclass Pair {\n constructor(first, second){\n this.first = first;\n this.second = second;\n }\n}\n\nrl.on('line', (input) => {\n let x = input(input);\n if (x % 2 === 0 && x !== 2)console.log(\"YES\"); else console.log(\"NO\");\n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e582c0147524b4de7ec15405ea9b0591", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8058c10bac61d33832955cbabece0e47", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x = readline();\nif (!(x & 1) && x != 2)console.log(\"YES\"); else console.log(\"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "90e51ef8553be0189ec08015df470a8e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function task1(a){if((a/2)==0){return \"yes\"}else{ return \"no\"}};", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "02c99196db32d62500689ce17e5f3596", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let randomNum = +alert('\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u0441\u0441\u0443 \u0430\u0440\u0431\u0443\u0437\u0430 \u0432 \u043a\u0433 \u043e\u0442 1 \u0434\u043e 100 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e','');\nif (randomNum % 2 === 0)\n console.log('YES');\nelse\n console.log('NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "36db77e501d338d62e29bde2ca6c658a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\n\n\t\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f4cb6c9a2ac70364edfe8f166419c978", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3659785d6787757c0b3627828550f86d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "85e3c73ca26b8423e9a3b3f9a5d92f70", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function(input) {\n\tif (input % 2 == 0) {\n\t\tprint('YES');\n\t} else {\n\t\tprint('NO');\n\t}\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0b33651ef42ca943bf67b9414a73fc25", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = readLine();\nfunction task1(a){\n return ((a%2)==0&&a!=2) ? \"YES\":\"NO\"\n}\nconsole.log(task1(a));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3512add7986d62d412a0da3b8450611e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " int w = prompt(\"Please enter your number\");\n \n if(w%2==0&&w>2)\n \n {\n alert(\"yes\");\n }\n \n else\n \n {\n alert(\"NO\");\n }\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a45f0645f1142020ef522f4f184e4fa6", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding(\"ascii\");\n_input = \"\";\nprocess.stdin.on(\"data\", function (input) {\n _input += input;\n});\n\nprocess.stdin.on(\"end\", function () {\n processData(_input);\n});\n\nfunction processData(input) {\n const values = input.split('\\n')\n if (values && values.length > 0 && values[0]%2 === 0) {\n const temp = Math.floor(values[0]/2)\n if (temp%2 === 0) {\n console.log(\"YES\")\n\n } else {\n console.log(\"NO\")\n\n }\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1586cce7e5c9f0e3fb6a4ac0f1cd5a9e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a= readline();\nif(8%2===0) print(\"YES\") else print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0573d547a6e4d73ce613d354c6ef8d93", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nvar arr = \"\";\nprocess.stdin.on('data', function(chunk) {\n arr += chunk;\n});\nprocess.stdin.on('end', function() {\n arr = arr.split(\"\\n\");\n var n = parseInt(arr.shift()); // in order ot get no of test cases\n if(n%2===0 && n!==2)\n console.log('YES');\n else\n console.log('NO');\n }\n \n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b62dfc51b55705dff284df5c005ffdc9", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = readLine();\nfunction task1(a){\n return ((a%2)==0&&a!=2) ? \"YES\":\"NO\";\n}\nconsole.log(task1(a));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c68d08640e9edc041ced1cc7a864900a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let pesos = new Array(100 + 1);\nlet peso = Number(readline());\n\npesos[0] = pesos[1] = pesos[2] = \"NO\"; \nfor(let i = 3; i < pesos.length; ++i)\n{\n\tpesos[i] = (i%2 === 0 ? \"YES\" : \"NO\");\n}\n\nprint(pesos[peso]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c1d202b2a13810f15d17a685012e42f0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//const readline = () => `8`;\n//const print = (str) => console.log(str);\n\n(() => {\n 'use strict';\n\n const [w] = readline().split(\" \").map(x => parseInt(x));\n\n const ok = () => {\n print(\"YES\");\n };\n\n const fail = () => {\n print(\"NO\");\n };\n\n if (!(w >= 1 && w <= 100)) {\n return fail();\n }\n\n if (w % 2 === 0) {\n return ok();\n }\n\n fail();\n\n})();\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dfa876bacc2771044d19419561ea23de", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline()\nprint((w%2===0 && w>2)?\"YES\":\"NO\")", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ffbe74d74c6956629a6b78d555d31d91", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const nmk = readline().split(\" \").map((x) => { return parseInt(x); });\n const N = nmk[0];\n const M = nmk[1];\n const K = nmk[2];\n const numbers = readline().split(\" \").map((x) => { return parseInt(x); });\n\n let cl = [];\n\n // for (let i = 0; i < N; i++) {\n // if (!(cl[numbers[i]])) {\n // cl[numbers[i]] = [];\n // }\n // cl[numbers[i]].push(i + 1);\n // }\n //\n // let res = new Array(K);\n // let num = 0;\n // for (let i = 1; i < M + 1; i++) {\n // for (let j = 0; j < cl[i].length; j++) {\n // if (!(res[num])) {\n // res[num] = [];\n // }\n // res[num].push(cl[i][j]);\n // num = (num + 1) % K;\n // }\n // }\n //\n // for (let i = 0; i < K; i++) {\n // let resStr = res[i].length;\n // for (let j = 0; j < res[i].length; j++) {\n // resStr += ' ' + res[i][j];\n // }\n // print(resStr);\n // }\n print(1);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e28e0cd2f1be5eb830a21a4f5da09f69", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let readline = require('readline');\n\nlet rl = readline.createInterface({\n\tinput: process.stdin,\n\toutput: process.stdout\n});\n\nrl.question(\">>weight \", function(w) {\n\tif(w%2===0) {\n\t\tconsole.log(\"YES\");\n\t} else {\n\t\tconsole.log(\"NO\");\n\t}\n\trl.close();\n});\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "32cf8725488aa42220216a26390877fb", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight = readline();\nprint(weight && !(weight % 2) ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9c3c04e4d44c60f6a46db8dd12b5b784", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n=prompt(int(''))\nif(n%2==0 && n!=0):\nprint('Yes')\nelse:\nprint('No')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "683bcc444672ba3213757aa3ad84fde1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// let x = readline()\n// .split(\" \")\n// .map(function (x) {\n// return parseInt(x);\n// });\n\nlet x = readline();\n\nif ((parseInt(x) / 2) % 2 == 0) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "485fb1fe62eb8c418aefcb3148413a88", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "#!/usr/bin/js\nconst w = readline();\nconsole.log(w % 2 === 0 ? 'YES' : 'NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2391c5a588fede3b7cde9f2f97045919", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight = readline(), odd = [], even = [];\n\nfor(let i = 1; i < weight; i ++) {\n if(i % 2 == 0 && (weight - i) % 2 == 0) {\n odd.push([i, weight - i]);\n }\n}\n\nodd.length ? print('YES') : print('NO');\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1a68b317f209b995e45a6590e9567c8f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "#ifdef LocalHost\nfreopen(\"a.in\",\"r\",stdin);\nfreopen(\"a.out\",\"w\",stdout);\n#endif\n\nvar w = prompt('enter weight', 8);\n\nif(w % 2 == 0){\n alert(\"YES\")\n }\nelse\n {\n alert(\"NO\")\n }\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "48a9fa7a089e50682b25c245c7f776e3", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = function (w) {\n\tif (w === 1 || w ==== 0) {\n\t\treturn false;\n\t}\n\tif (w%2 === 0){\n\t\treturn true;\n\t}\n\tif (w%2 != 0){\n\t\treturn false;\n\t}\n}\n\ndelitarbuz(prompt());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0424435b84d58013821c2becc4d546e4", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nif ( line[0] > 3 && line[0] !% 2 ) {\n print('YES') ;\n}\nelse {\n print ('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d96f4c1e41e8a66e1ec0209e4c4a45ea", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight=readline();\nif(weight==2){\n print(\"NO\");\n}else if(weight%2==0){\n print(\"YES\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "202600259ff46d2c881aa7e5a2f1df31", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x;\nx = readline();\n\nif(Number(x) % 2 == 0){\n print(\"YES\");\n}\nelse{\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fc95543a6870680272cb22f161da600e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a= readline();\nif(a%2==0) print(\"YES\") else print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d6a8d3db2203c620a5c9dbff04925abe", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "var w = readline();\nif(w-2)%2 != 0) console.log(\"YES\")\nelse console.log(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "29fbe1f2f91ad793e404be2e67e046e0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let number = readline();\n\nprint(number % 2 ? 'YES' : 'NO' );", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f20d19d49fa09c263aee7db616524e08", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var w = readline()\nif (w % 2 === 0) {\n if(w === 2) {\n print(\"no\")\n \n}\nelse {\n print(\"yes\")\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "645d247bc968ca28eb5fc473f89758c2", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "210af4213281a0f16d673f549ae13095", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = readline();\nprint(a < 4 || a % 2 ? 'NO' : 'YES';", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9f768ba5af77f3f7f76e891d101d7c6b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nif ( line[0] > 3 && line !% 2 ) print('YES') \nelse print ('NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "13dc0e6394068e8d6050177a926b65ad", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function isDivisible(n) {\n return n % 2 === 0;\n}\n \nfunction main() {\n let num = parseInt(readline());\n\n while(num) {\n print(isDivisible(num));\n\n num = parseInt(readline());\n }\n}\n \nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a65cb33f85ab09261384a093543054f8", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const nmk = readline().split(\" \").map((x) => { return parseInt(x); });\n const N = nmk[0];\n const M = nmk[1];\n const K = nmk[2];\n const numbers = readline().split(\" \").map((x) => { return parseInt(x); });\n\n let cl = new Array(M);\n\n // for (let i = 0; i < N; i++) {\n // if (!(cl[numbers[i]])) {\n // cl[numbers[i]] = [];\n // }\n // cl[numbers[i]].push(i + 1);\n // }\n //\n // let res = new Array(K);\n // let num = 0;\n // for (let i = 1; i < M + 1; i++) {\n // for (let j = 0; j < cl[i].length; j++) {\n // if (!(res[num])) {\n // res[num] = [];\n // }\n // res[num].push(cl[i][j]);\n // num = (num + 1) % K;\n // }\n // }\n //\n // for (let i = 0; i < K; i++) {\n // let resStr = res[i].length;\n // for (let j = 0; j < res[i].length; j++) {\n // resStr += ' ' + res[i][j];\n // }\n // print(resStr);\n // }\n print(1);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8dd0cc8e12afdcf7d6d47f0f19a78936", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nprint n % 0 == 1 ? \"YES\" : \"NO\"", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "559f0ec1780560bad6bf045fa485fece", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline();\nlet s = w % 2;\n\nif (s === 0 && w !== 2) {\n print(\"YES\");\n} else {\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e148382594b5ba50233efd476acab7b1", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "Node.js", "source_code": "import prompt from \"prompt\";\n\nconst w = prompt();\nif (w <= 2 || w % 2 !== 0) {\n console.log(\"NO\", w);\n} else {\n console.log(\"YES\", w);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5ed9c0bd992815ee8a183e97bdcca37c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let number = readLine();\n\nprint(number % 2 ? 'YES' : 'NO' );", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "29545ea67b4a1da93a07b39df7d708da", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function watermilion(w) {\n for (let i = 0; i < w; i++) {\n if (w % 2 === 0) {\n console.log(\"YES\")\n } else {\n console.log(\"NO\")\n }\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "671d58f7cf0e074584cc5418999ab606", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x = readline()\n .split(\" \")\n .map(function (x) {\n return parseInt(x);\n });\n\nif ((x / 2) % 2 == 0) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bd0dd45a2d083d5b05543e4ab919d77f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline();\n\nif (w % 2 === 0 || w === 2) {\n print('YES');\n} else {\n print('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "56f2c0b3da230e972c12d5585840d41e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var w = readline();\n for (let i = 0; i < w; i++) {\n if (w == 2) {\n console.log(\"NO\")\n } else if (w % 2 === 0) {\n console.log(\"YES\")\n } else {\n console.log(\"NO\")\n }\n }\n}\nmain()", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cf662c94ad65611e2aab4620c2a73c8b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine();\n\nif (w%2 === 0){\n print(\"YES\");\n}\nelse print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a32c253938ae26d12728f7e9f7cf44de", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function watermelon(w) {\n let flag;\n if(w>2 && w%2===0) {\n flag = \"YES\";\n } else {flag = \"NO\"}\n return flag;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d90e6d09b6b5dc1f73e7b61d188cf593", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nlet b = line[0] - 2;\nprint( (b > 0 && b % 2 === 0) ? 'YES' : 'NO' );", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "edab51394d6fe5c7adb38584b49831e0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "'use strict';\n//const readline = () => `8`;\n//const print = (str) => console.log(str);\n\nconst [w] = readline().split(\" \").map(x => parseInt(x));\n\nconst ok = () => {\n print(\"YES\");\n};\n\nconst fail = () => {\n print(\"NO\");\n};\n\n(() => {\n\n if (!(w >= 1 && w <= 100)) {\n return fail();\n }\n\n if (w % 2 === 0) {\n return ok();\n }\n\n fail();\n\n})();\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "538b3d0e314f98c1a481c15e7091cf4e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function isDivisible(n) {\n return n % 2 === 0;\n}\n \nfunction main() {\n let num;\n \n while(num = parseInt(readline())) {\n print(isDivisible(num));\n }\n}\n \nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "05cb05a23b8da5de5a4a441912fc2a9b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let weight=readline();\nif(weight==2){\n console.log(\"NO\");\n}else if(weight%2==0){\n console.log(\"YES\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dd2e0961d9233f2fad2d60e485adceb7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine();\nif(w>2 && w%2===0) {\n print(\"YES\");\n} else {\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8aadecc423b6abe149ded096e9ff4667", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readLine());\n\tif(n!=2&&n%2==0){\n\t\t//console.log(\"NO\");\n\t\t print(\"YES\");\n\t}\n\telse \n\t\t//console.logt(\"YES\");\n\t print(\"NO\");\n\t \n})();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "961da2a5f782a9cbb26d0e3b23f47fb3", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ')[0];\nprint(input > 2 && !(input % 2) ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "78d99c8ebad9f557a12ffd6147cb4926", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require(\"readline\");\nconst { RSA_X931_PADDING } = require(\"constants\");\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\n\n rl.question(\"Watermelon Weight \", function(weight) {\n \n evenOdd(weight)\n \n rl.close();\n });\n\n\nfunction evenOdd(weight){\n if(weight%2==0){\n console.log('YES')\n\n }else{\n console.log('NO')\n }\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "78e577336deeb484beba178d38f68a6f", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let line = readline().split(' ');\nlet b = line[0] - 2;\nconsole.log((b > 0 && b % 2 === 0) ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9c9773fb4398661dc751a3d854cd2167", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readline();\n\nprint(w > 2 && w % 2 === 0 ? \"YES\" : \"NO\")", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d5246b3823c1f7ad33cd7ded61f26fb7", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let w = readLine();\n\nif(w%2 === 0) {\n console.log('YES');\n} else {\n console.log('NO');\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f969b47127396229fef444c67829772e", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\n\n\n

\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f6a11226a67d838f7f83615c875bae6a", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization(word) {\n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n return word.join(\" \")\n}\n var word = readline();\nprint(wordCapitalization(word))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a8631b525c44efc62628c321f943c556", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization(word) {\n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n console.log(word.join(\" \"));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "51358a2a813252bc0051195b2dc5a3db", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization(word) {\n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n let newWord = word.join(\" \")\n print(newWord);\n}\n\nwordCapitalization(readline())", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b0e2e5cdc93e0cef18a4cdd7ec1b69cf", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization() {\n let word = readline();\n \n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n print(word.join(\" \"));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "03711a291eda2a0e4050d80b36259c94", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization() {\n let word= readline();\n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n let newWord = word.join(\" \")\n print(newWord);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7742d0cacb0457627537a50a31a0627a", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization(word) {\n // console.log(word.split(\"\"));\n\n word = word.split(\" \");\n\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n return word.join(\" \");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6106db8c120110c86faaf26ce924e8fe", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wordCapitalization(word) {\n word = word.split(\" \");\n for (let i = 0; i < word.length; i++) {\n let wordArr = word[i].split(\"\");\n let toUppercaseLetter = wordArr[0].toUpperCase();\n wordArr[0] = toUppercaseLetter;\n word[i] = wordArr.join(\"\");\n }\n return word.join(\" \");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bdac52f2fc7773c12f6a41d1399e1cc9", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = readline();\nprint a[0].toUpperCase() + a.slice(1);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "81858b93c70ac8d05daa9e7cba3c3e3d", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const [a, b] = readline().split(' ').map(Number);\n`${Math.min(a, b)} ${parseInt(Math.abs(a-b)/2)}`;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "49821bccf0feb4e5516f699b5ceec69a", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [a, b] = readline().split(' ').map(Number);\nprint(Math.min(a, b) + ' ' + parseInt(Math.abs(a-b)/2));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bb608e8016ac2b8105236d21064f25e2", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let index = 0;\nlet arrData = [];\nprocess.stdin.on('data', function(data) {\n arrData.push(data.toString());\n if(++index == 2) {\n console.log(count(arrData[0], arrData[1]));\n process.exit();\n }\n});\n\nfunction count(daysCount, days) {\n let sToFArr = days.match( /SF/ig );\n let fToSArr = days.match( /FS/ig );\n let fToS = (fToSArr || []).length;\n let sToF = (sToFArr || []).length;\n return sToF > fToS ? 'YES' : 'NO';\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cc1ffaef5a5f5e523f367330aeb276c3", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline();\nfunction func(s,r){\n\tlet a = s.match(r);\n\treturn (a) ? a.length : 0;\n}\nvar s = readline();\nprint((func(s,/SF/g) > func(s,/FS/g)) ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ba85fa9edc18befb3813ecefa149005", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline();\nvar s = readline();\nfunction func(r){\n\tlet a = s.match(r);\n\treturn (a) ? a.length : 0;\n};\nprint((func(/SF/g) > func(/FS/g)) ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "387438848964133a72c2389bec4c014a", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "Node.js", "source_code": "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef DEBUG\n#include \"debug.hpp\"\n#endif // DEBUG\n\nusing namespace std;\ntypedef long long ll;\ntypedef pair pll;\ntypedef pair pii;\n#define KB(x) ((x)*1024ull)\n#define MB(x) ((x)*1024ull * 1024ull)\n#define all(x) begin(x), end(x)\n#define allr(x) rbegin(x), rend(x)\n#define till(x, n) begin(x), begin(x) + n\n#define tillr(x, n) rbegin(x), rbegin(x) + n\nstatic void boost();\ntemplate \nstatic bool innrange(T lo, T hi, T val) {\n return val >= lo && hi >= val;\n}\ntemplate \nstatic bool inrange(T lo, T hi, T val) {\n return val > lo && hi > val;\n}\nstatic constexpr auto N = KB(200ull);\nstatic constexpr auto N2 = KB(2ull);\nstatic constexpr auto MOD = 1000000007;\nstatic constexpr auto INF = numeric_limits::max();\nstatic constexpr auto INFl = numeric_limits::max();\nstatic constexpr double PId = 3.14159265358979323846;\nstatic constexpr float PIf = 3.14159265358979323846f;\n\nint main() {\n boost();\n#ifdef DEBUG\n DebugStart();\n#endif // DEBUG\n\n // --- PROGRAM ---\n int n, k;\n cin >> n >> k;\n map s;\n for (int i = 0; i < n; i++) {\n int a;\n cin >> a;\n s[a] = 1 + i;\n }\n\n if (s.size() < k)\n cout << \"NO\" << endl;\n else {\n cout << \"YES\" << endl;\n for (auto p : s) {\n cout << p.second << \" \";\n if (k-- <= 0) break;\n }\n cout << endl;\n }\n // --- END PROGRAM ---\n\n#ifdef DEBUG\n DebugEnd();\n#endif // DEBUG\n // xd\n return 0;\n}\n\nstatic void boost() {\n ios::sync_with_stdio(false);\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0fe573106a17ee73d58c9fff94788d0f", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n\nconst team = {};\n\nconst line = readline().split(' ');\nconst teamSize = line[1];\nconst guys = readline().split(' ');\n\nlet selected = 0;\n\nfor (let i = 0; i < guys.length; i++)\n{\n if(!team[guys[i]])\n {\n team[guys[i]] = i + 1;\n selected++;\n }\n}\n\nconsole.log(selected===teamSize);\nconsole.log(Object.keys(team).map(k => team[k]).join(' '));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e83749be4d2b397b5f870dde4481e45c", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.setEncoding('utf8');\n\nprocess.stdin.on('readable', () => {\n let input = process.stdin.read();\n input = input.trim();\n input = input.split('\\n');\n\n main(input);\n});\n\nfunction main(input) {\n let ratings = string.split('\\n')[0].split(' ');\n\n let ratings = Array.from(new Set(input[1].split(' ')));\n let final = [];\n\n if (input[0].split(' ')[1] != input[1]) return console.log('NO');\n\n ratings.forEach(rating => {\n final.push(input.slice(2).indexOf(rating) + 1);\n });\n\n console.log(`YES\\n${final.join(' ')}`);\n process.exit(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b5de0745597717d06f719403355ca0eb", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.setEncoding('utf8');\n\nprocess.stdin.on('readable', () => {\n let input = process.stdin.read();\n input = input.trim();\n input = input.split('\\n');\n\n main(input);\n});\n\nfunction main(input) {\n let ratings = string.split('\\n')[0].split(' ');\n\n let ratings = Array.from(new Set(input[1].split(' ')));\n let final = [];\n\n if (input[0].split(' ')[1] != ratings.length) return console.log('NO');\n\n ratings.forEach(rating => {\n final.push(input.slice(2).indexOf(rating) + 1);\n });\n\n console.log(`YES\\n${final.join(' ')}`);\n process.exit(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "54a4d0d7d1ec6c27e8f6d86a3c2673fe", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "{\n let stringInput = readline();\n const vowels = ['a', 'o', 'y', 'e', 'u', 'i'];\n stringInput = stringInput.toLowerCase();\n\n vowels.forEach(item => {\n while (stringInput.includes(item)) {\n stringInput = stringInput.replace(item, '');\n }\n })\n\n stringInput = stringInput.split('');\n\n for (let i = 0; i < stringInput.length; i++) {\n if (stringInput[i].charCodeAt(0) >= 97 && stringInput[i].charCodeAt(0) <= 122) {\n stringInput.splice(i, 0, '.');\n i++;\n }\n }\n\n stringInput = stringInput.toString();\n \n while (stringInput.includes(',')) {\n stringInput = stringInput.replace(',', '');\n }\n\n print(stringInput);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "431d4ee4d27e00b983e32c4ef4ca23bf", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "input = readline();\nans=''\nfor(let i of input){\n if('aeiou'.indexOf(i.toLowerCase()) ==-1){\n ans+='.'+i.toLowerCase();\n }\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "88553955a904d2657a84d1151f51f0fb", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = readline().toLowerCase().split(' ');\nvar b = '';\nvar dist = {\n \"A\":'',\"B\":'.b',\"C\":'.c',\"D\":'.d',\"E\":'',\"F\":'.f',\"G\":'.g',\"H\":'.h',\"I\":'',\"J\":'.j',\"K\":'.k',\"L\":'.l',\"M\":'.m',\"N\":'.n',\"O\":'',\"P\":'.p',\"Q\":'.q',\"R\":'.r',\"S\":'.s',\"T\":'.t',\"U\":'',\"V\":'.v',\"W\":'.w',\"X\":'.x',\"Y\":'',\"Z\":'.z',\n \"a\":'',\"b\":'.b',\"c\":'.c',\"d\":'.d',\"e\":'',\"f\":'.f',\"g\":'.g',\"h\":'.h',\"i\":'',\"j\":'.j',\"k\":'.k',\"l\":'.l',\"m\":'.m',\"n\":'.n',\"o\":'',\"p\":'.p',\"q\":'.q',\"r\":'.r',\"s\":'.s',\"t\":'.t',\"u\":'',\"v\":'.v',\"w\":'.w',\"x\":'.x',\"y\":'',\"z\":'.z'}\n\nfor (let i = 0; i < a.length; i++) {\n b=b+dist[a[i]]\n}\nprint(b)\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a9533bcc6a61d80d8de136e47cfb36f9", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "{\n let stringInput = prompt();\n const vowels = ['a', 'o', 'y', 'e', 'u', 'i'];\n stringInput = stringInput.toLowerCase();\n\n vowels.forEach(item => {\n while (stringInput.includes(item)) {\n stringInput = stringInput.replace(item, '');\n }\n })\n\n stringInput = stringInput.split('');\n\n for (let i = 0; i < stringInput.length; i++) {\n if (stringInput[i].charCodeAt(0) >= 97 && stringInput[i].charCodeAt(0) <= 122) {\n stringInput.splice(i, 0, '.');\n i++;\n }\n }\n\n stringInput = stringInput.toString();\n \n while (stringInput.includes(',')) {\n stringInput = stringInput.replace(',', '');\n }\n\n console.log(stringInput);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bcb0d5170a0de6e70b706a46e23bad33", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "n = readline();\nk = readline();\nstr = readline().split(' ').map(Number);\n\nvar res = 0;\n\nfor (let i = 0; i < n; i++) {\n\tif (str[i] > k) {\n\t\tres++;\n\t};\n};\n\nprint (res);\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "82502f01f03d395d2e4dc022e89ec1a9", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().toLowerCase().replace(/[aeiouy]/g,'');\nvar result = '';\n\nfor(i = 0 , i < input.length , i++)\n{result = result + \".\" + input[i]}\n\nprint(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae60817d4209cf8974f46960d430b1f1", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nfunction inArray(value, array = []) {\n return array.indexOf(value) > -1;\n}\n\nfunction stringTask(word) {\n return word\n .split('')\n .filter(letter => {\n letter = letter.toLowerCase();\n return !inArray(letter, ['a', 'e', 'i', 'o', 'u', 'y']);\n })\n .map(letter => {\n return (letter = '.' + letter.toLowerCase());\n })\n .join('');\n}\n\nvar input = readline()\n// var input = 'tour';\n// var input = 'Codeforces';\n// var input = 'aBAcAba';\n\nprint(stringTask(input))\n// console.log(stringTask(input));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "93eac19afe9dbc242286fba79c83a267", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "input = readline();\nans='';\nfor(let i of input){\n if('aeiou'.indexOf(i.toLowerCase()) ==-1){\n ans+='.'+i.toLowerCase();\n }\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "163665238ce7c55920a6e22d0aa03135", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().toLowerCase().replace(/[aeiouy]/g,'');\nvar result = '';\nvar i\n\nfor(i = 0 , i < input.length , i++)\n{result = result + \".\" + input[i]}\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8e1567128f9720778bac035c8cae3c89", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().toLowerCase().replace(/[aeiouy]/g,'');\nvar result = '';\nvar i;\n\nfor(i = 0 , i < input.length , i++)\n{result = result + '.' + input[i]}\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c5577fd8534704138cf8e9274e962164", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var x = readline();\nvar arr = ['A','a', 'O','o', 'Y','y', 'E','e', 'U','u', 'I','i' ];\nvar wrd[];\nfor( int i=0; i < x.length; ++i ){\n for( int j=0; j < arr.length; ++j )\n if(x[i] == arr[j])\n continue;\n wrd[i] = s[i];\n}\nwrd.forEach(function(x){\n write('.' + x);\n});\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7cca24283f983edb42c523270071eee3", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var word = readline();\n\nvar vowel = word.toUpperCase().split('');\nvar buffer = \"\";\nfor (let i = 0; i < vowel.length; i++) {\n if (vowel[i] === 'A' || vowel[i] === 'O' || vowel[i] === 'Y' || vowel[i] === 'E' || vowel[i] === 'U' || vowel[i] === 'I') {\n vowel\n } else {\n vowel[i] = \".\" + vowel[i];\n buffer += vowel[i]\n }\n}\nprint(buffer.toLowerCase())", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ac2515ded2ddfc141fdacbde1ce95d8d", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "str = readline().split('');\n\nvar arr = ['a', 'o', 'y', 'e', 'u', 'i'];\nvar newArr = [];\n\nfor (let i = 0; i < str.length; i++) {\n\tvar count = 0;\n\n\tfor (let j = 0; j < arr.length; j++) {\n\t\tif (str[i].toLowerCase() === arr[j]) {\n\t\t\tcount++;\n\t\t};\n\t};\n\n\tif (count === 0) {\n\t\tnewArr.push('.' + str[i]);\n\t};\n};\n\nprint (newArr.join('').toLowerCase());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8dbd156683a7b70f77043c5d1074c784", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().toLowerCase().replace(/[aeiouy]/g,'')\nvar result = ''\n\nfor(i = 0 , i < input.length , i++)\n\tresult = result + \".\" + input[i]\n\nprint(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b4084b08c469a4d2fffce48163ce1329", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "/**\n * @author Albert Hambardzumyan\n * @description String Task.\n * Reference: http://codeforces.com/problemset/problem/118/A\n * Tags: implementation, strings, 1100\n */\n(function () {\n const input = readline().toLowerCase()\n\n var result = ''\n var temp\n for (let i = 0; i < input.length; i++) {\n temp = input.charAt(i)\n if (!(temp === 'a' || temp === 'o' || temp === 'y' || temp === 'e' || temp === 'u' || temp === 'i'))\n result += '.' + temp\n }\n\n print(result)\n})()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "11f08ea6852daf6f071a6f98a37a6746", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "/**\n * @author Albert Hambardzumyan\n * @description String Task.\n * Reference: http://codeforces.com/problemset/problem/118/A\n * Tags: implementation, strings, 1100\n */\n(function () {\n const input = readline().toLowerCase()\n\n let result = ''\n let temp\n for (let i = 0; i < input.length; i++) {\n temp = input.charAt(i)\n if (!(temp === 'a' || temp === 'o' || temp === 'y' || temp === 'e' || temp === 'u' || temp === 'i'))\n result += '.' + temp\n }\n\n print(result)\n})()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "441e53ac19a34752c6f370eff8a3056b", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "input = readLine();\nans=''\nfor(let i of input){\n if('aeiou'.indexOf(i.toLowerCase()) ==-1){\n ans+='.'+i.toLowerCase();\n }\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dbf6f2d4080dda1cbb36406b32ff304d", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var let task =readline();\nlet arr = [];\nfor(var i =0; i (s.substring(1, s.length) == s.toUpperCase());\n\nconst isLowerCase = (s) => (s == s.toLowerCase());\n\nconst capitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length)));\n\nlet s = \"TEST\";\n\nif (unintentionallCaps(s)) {\n print(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toUpperCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1447b58399fbd5d493f26c0881552643", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var word = readline();\nif (word.toLowerCase() || word.slice(1).toUpperCase()) {\n\tprint(word[0].toUpperCase() + word.slice(1).toLowerCase(); \n} else print(word); ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bee58834033c9ddbd226d3a3976029d5", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline();\n if(input[0] != input[0].toUpperCase()) {\n print(input[0].toUpperCase() + input.substring(1).toLowerCase());\n } else {\n print(input);\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9670bcdb8be1c8087b92a73d4a85c73e", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function isLowerCase(symbol) {\n if (symbol === symbol.toLowerCase()) {\n return true;\n }\n}\n\nfunction isWrong(str) {\n if (str.length === 1) {\n return true;\n }\n for (var i = 1; i < str.length; i++) {\n if (isLowerCase(str[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction changeCase(str) {\n return str.split('').map(function (s) {\n return isLowerCase(s) ? s.toUpperCase() : s.toLowerCase();\n }).join('');\n}\n\nlet str = readline();\nif (isWrong(str)) {\n str = changeCase(str);\n}\nprint(str);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d496186c4e7302ea8fa6c6a626fa8777", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var txt = readline();\nvar k = txt.split('');\nvar a = k.sort();\nvar l;\nif(txt.length>1){\n \n if(a[0] >= \"A\" && a[a.length-1] <= \"Z\") {\n txt = txt.toLowerCase();\n}\nelse if(txt[0]>= \"a\" && a[a.length-2] <= \"Z\") {\n txt = txt.toLowerCase();\n l = txt[0].toUpperCase();\n txt = txt.replace(txt[0], l);\n }\n}\nelse {\n if((txt[0]>= \"a\" && a[0] <= \"Z\"){\n txt = txt.toLowerCase();\n }\n else\n txt = txt.toUpperCase();\n}\n\nprint(txt);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "624bf023e293c043370923b0336f3f26", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var txt = readline();\nvar k = txt.split('');\nvar a = k.sort();\nvar l;\nif(txt.length>1){\n \n if(a[0] >= \"A\" && a[a.length-1] <= \"Z\") {\n txt = txt.toLowerCase();\n}\nelse if(txt[0]>= \"a\" && a[a.length-2] <= \"Z\") {\n txt = txt.toLowerCase();\n l = txt[0].toUpperCase();\n txt = txt.replace(txt[0], l);\n }\n}\nelse {\n if((txt[0]>= \"a\" && a[a.length-2] <= \"Z\"){\n txt = txt.toLowerCase();\n }\n else\n txt = txt.toUpperCase();\n}\n\nprint(txt);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e0bc6c1b03ef179741695c9ca1da5952", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const unintentionallCaps = (s) => (s.substring(1, s.length) == s.toUpperCase());\n\nconst isLowerCase = (s) => (s == s.toLowerCase());\n\nconst capitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length)));\n\nlet s = readline();\n\nif (unintentionallCaps(s)) {\n console.log(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toUpperCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ac8fc27d3269d08939111b4d69acecfd", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = readline().toLowerCase().replace(n[0], function function(x){return x.toUpperCase();});\nprint(n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "83f21ba48b1b8ad038260110ea55dc8f", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var lee = readline();\n\nif (lee.slice(1) == lee.slice(1).toUpperCase() $$ lee[0] == lee[0].toLowerCase()) {\n\tprint(lee[0].toUpperCase() + lee.slice(1).toLowerCase()); \n} else if(lee == lee.toUpperCase()) {\n\tprint(lee.toLowerCase())\n} else {\n print(lee);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3e23ca8bde27bd375576f7c5a4edb7c0", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\tvar input = readline();\n\tif (input == input.toUpperCase()){print(input.toLowerCase()}\n\telse if (input.slice(1) == input.slice(1).toUpperCase()){\n\t\tprint( input[0].toUpperCase() + input.slice(1).toLowerCase() );}else{print(input);}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c908a933a5a87e071e2c93515e31e5e7", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const unintentionallCaps = (s) => (s.substring(1, s.length) == s.substring(1, s.length).toUpperCase());\n\nconst isLowerCase = (s) => (s == s.toLowerCase());\n\nconst capitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length).toLowerCase()));\n\nlet s = readline();\n\nif (unintentionallCaps(s)) {\n print(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toLowerCase());\n} else {\n print(s);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "677c4661df3a6c8bead2e55e96930204", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "unintentionallCaps = (s) => (s.substring(1, s.length) == s.toUpperCase());\n\nisLowerCase = (s) => (s == s.toLowerCase());\n\ncapitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length)));\n\nlet s = readline();\n\nif (unintentionallCaps(s)) {\n print(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toUpperCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "480a93adf588cefaadb688e01d0fe7d0", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const unintentionallCaps = (s) => (s.substring(1, s.length) == s.toUpperCase());\n\nconst isLowerCase = (s) => (s == s.toLowerCase());\n\nconst capitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length)));\n\nlet s = readline();\n\nif (unintentionallCaps(s)) {\n print(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toUpperCase());\n} else {\n print(s);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4d16841a92270ff4edc4e9ad9d495f33", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function typedWithCapsLockKeyAccidentallySwitchedOn(s) {\n\treturn \n\t || ;\n}\nfunction main() {\n\tvar textLine = readline();\t\t//.split(' ');\n\tif (textLine.match(/^[a-z].*/) && !textLine.match(/^[a-z].*[a-z]+.*/)) {\n\t\ttextLine = textLine.substring(0, 1).toUpperCase() + textLine.substring(1).toLowerCase();\n\t} else if (textLine.match(/^[A-Z].+/) && !textLine.match(/^[A-Z].*[a-z]+.*/)) {\n\t\ttextLine = textLine.toLowerCase();\n\t}\n\tprint(textLine);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "494c536a574a4576ab31bd497b022532", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = readline().toLowerCase().replace(n[0], function function(x){return x.toUpperCase();});\nvar p = n;\nprint(p);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "92ec9e437c1e98dad02d1a36ed53b5e7", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const unintentionallCaps = (s) => (s.substring(1, s.length) == s.toUpperCase());\n\nconst isLowerCase = (s) => (s == s.toLowerCase());\n\nconst capitalizeFirstLetter = (s) => (s[0].toUpperCase().concat(s.substring(1, s.length)));\n\nlet s = readline();\n\nif (unintentionallCaps(s)) {\n print(isLowerCase(s[0]) ? capitalizeFirstLetter(s) : s.toUpperCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "109c87af84c7747d230863c639976263", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var tmp = readline().split(' ').map(Number)\nvar jump = tmp[1]\nvar cells = readline().split(' ')\n\nlet start, end\nlet result = true\n\ncells.forEach((cell, i) => {\n if (cell === 'T' || cell === 'G') {\n if (!start) {\n start = i\n } else {\n end = i\n }\n }\n})\n\nif (end - start % jump !== 0) {\n result = false\n}\n\nfor (let i = start; i <= end; i += jump) {\n if (cells[i] === '#') result = false\n}\n\nprint(result ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d0f9214662e0cab767dfc6e21f1139e6", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const [inputSize, jump] = readline().split(' ').map(Number)\nlet cells = readline().split(' ')\n\nlet start, end\nlet resilt = true\n\ncells.forEach((cell, i) => {\n if (cell === 'T' || cell === 'G') {\n if (!start) {\n start = i\n } else {\n end = i\n }\n }\n})\n\nif (end - start % jump !== 0) {\n result = false\n}\n\nfor (let i = start; i <= end; i += jump) {\n if (cells[i] === '#') result = false\n}\n\nprint(result ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "48636e17c5bd855e5a0b90cebf65a6e8", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const [inputSize, jump] = readline().split(' ').map(Number)\nlet cells = readline().split(' ')\n\nlet start, end\nlet result = true\n\ncells.forEach((cell, i) => {\n if (cell === 'T' || cell === 'G') {\n if (!start) {\n start = i\n } else {\n end = i\n }\n }\n})\n\nif (end - start % jump !== 0) {\n result = false\n}\n\nfor (let i = start; i <= end; i += jump) {\n if (cells[i] === '#') result = false\n}\n\nprint(result ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6e7e3cffb9fe37b01a136dda4d0ff311", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const [inputSize, jump] = readline().split(' ').map(Number)\nlet cells = readline().split(' ')\n\nlet start, end\nlet resilt = true\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1ee1614c04ee46a2ae42e60467e8bde3", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var tmp = readline().split(' ').map(Number)\nvar jump = tmp[1]\nvar cells = readline().split(' ')\n\nvar start, end\nvar result = true\n\ncells.forEach(function (cell, i) {\n if (cell === 'T' || cell === 'G') {\n if (!start) {\n start = i\n } else {\n end = i\n }\n }\n})\n\nif ((end - start) % jump !== 0) {\n result = false\n}\n\nfor (let i = start; i <= end; i += jump) {\n if (cells[i] === '#') result = false\n}\n\nprint(result ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "99b2b751f78116fce4b68f31bfa9bffc", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var tmp = readline().split(' ').map(Number)\nvar jump = tmp[1]\nvar cells = readline().split(' ')\n\nvar start, end\nvar result = true\n\ncells.forEach(function (cell, i) {\n if (cell === 'T' || cell === 'G') {\n if (!start) {\n start = i\n } else {\n end = i\n }\n }\n})\n\nif (end - start % jump !== 0) {\n result = false\n}\n\nfor (let i = start; i <= end; i += jump) {\n if (cells[i] === '#') result = false\n}\n\nprint(result ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c0862449f4b0d0568474395f0e063736", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "{\nvar input1 = readline();\ninput1 = input1.split(' ');\nvar k = +input1[1];\nvar booleanStepsOfInsect = function(step, str)\n {\n if (str.indexOf('T') < str.indexOf('G'))\n {\n var currentPosition = str.indexOf('G');\n while ((currentPosition !== str.indexOf('T')) && (str.indexOf('T') < str.indexOf('G')))\n {\n if ((str[currentPosition - step] !== '#') && (currentPosition >= 0))\n {\n currentPosition -= step;\n }\n else return \"NO\";\n }\n if (currentPosition === str.indexOf('T')) return 'YES';\n else return 'NO';\n }\n else \n {\n {\n var currentPosition = str.indexOf('G');\n while ((currentPosition !== str.indexOf('T')) && (str.indexOf('T') > str.indexOf('G')))\n {\n if ((str[currentPosition + step] !== '#') && (currentPosition < str.length))\n {\n currentPosition += step;\n }\n else return \"NO\";\n }\n if (currentPosition === str.indexOf('T')) return 'YES';\n else return 'NO';\n }\n }\n }\nvar input2 = prompt('');\nprint(booleanStepsOfInsect(k, input2));\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ed7093f2ad86d15cc1845fffbd04d977", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a;\nvar u = 1;\na = readline();\nvar l = a.length;\nfor(var i = 0; i < l; ++i)\n{\n if(a[i] == a[i+1]){u++;}\n else {u = 1;}\n \n if(u == 7){print(\"YES\");goto exit_p;}\n}\nprint(\"NO\");\nexit_p:", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1fa2eb3ecf4ffc1f01c1712625f2c674", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var situation = parseInt(readline());\nvar dangerous = 1;\nfor(var i = 0; i < situation.length; i++) {\n if(parseInt(situation[i]) === parseInt(situation[i+1]) {\n \tdangerous++;\n } else {\n \tdangerous = 1;\n }\n \n if (dangerous === 7){\n \tprint(\"YES\");\n \tbreak;\n }\n}\n\nif(dangerous !== 7) {\n\tprint(\"NO\");\n} ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ef3955ca649f56bd3dabf2e7a93d0ee7", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var s = readline();\nvar x = s.replace('0000000', '').replace('1111111', '');\nprint s.length > x.length? 'YES': 'NO';", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aebd51bdb2ae5f0b93e58f690e8f60a7", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var a;\nvar u = 1;\na = readline();\nvar l = a.length;\nfor(var i = 0; i < l; ++i)\n{\n if(a[i] == a[i+1]){u++;}\n else {u = 1;}\n \n if(u == 7){print(\"YES\");goto exit;}\n}\nprint(\"NO\");\nexit:", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8db2fabe6abecbde8c5c7d997c0b86f3", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var string = readline();\n\nfor (var current = string[0], i = 1, sum = 1, answer; length = string.length; i < length; i++) {\n if(string[i] === current) {\n sum += 1;\n }\n else {\n current = string[i];\n\n if(answer >= 7) {\n answer = 1;\n }\n\n sum = 0;\n }\n}\n\n\nif(answer) {\n write(\"YES\");\n}\nelse {\n write(\"NO\");\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d7b61bf6615a2fde98fb37846a37433e", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main(){\n var teams = readline();\n\n if (teams.includes(\"0000000\")) {\n print(\"YES\")\n }\n else if ((teams.includes(\"111111\")) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6565fc6c3608e0d902739e54425b886b", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "/*\nPetya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If there are at least 7 players of some team standing one after another, then the situation is considered dangerous. For example, the situation 00100110111111101 is dangerous and 11110111011101 is not. You are given the current situation. Determine whether it is dangerous or not.\n\nInput\nThe first input line contains a non-empty string consisting of characters \"0\" and \"1\", which represents players. The length of the string does not exceed 100 characters. There's at least one player from each team present on the field.\n\nOutput\nPrint \"YES\" if the situation is dangerous. Otherwise, print \"NO\".\n*/\n\nvar input = readline();\n\nif (input.match(/1111111/) || input.match(/0000000/){\n\tprint(\"yes\");\n}else {print(\"no\");}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "38b3884b7e913ab60eaac52c6774c44e", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var str = readline();\n\nif(str.match(/(0{7})|(1{7})/)\n\tprint(\"YES\");\nelse\n\tprint(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "eccdae05cd8cd3768cedcf97b51efe18", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var s = readline();\nvar x = s.replace('0000000', '').replace('1111111', '')\nprint s.length > x.length? 'YES': 'NO';", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0ce5c89d111ce4a2232c92fe8a77d9a8", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var match = readline();\nvar count = 0;\n\nfor(var i = 0 ; i < match.length ; i++){\n if(match[i] == match[i+1]){\n count++;\n if count == 6{\n break;\n }\n }else{\n count=0;\n }\n}\n\nif(count == 6){\n print(\"YES\");\n}else{\n print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b8827bd0672c9d0c480d4be2c410b79f", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var [a,b] = readline().split(\" \").map(function(x) { return parseInt(x); });\nvar h = a;\nwhile (true){\n a /= b;\n h+=Math.floor(a);\n if (h < b) break;\n}\nprint (h);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ae59c665fadedcf2ed396d3feb799d0", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var l = readline().split (\" \");\n\nvar a = parseInt(l[0])\nvar b = parseInt(l[1])\n\n\nwhile (a)\n{\n a--;\n cnt++;\n ans++;\n if (cnt == b)\n {\n cnt = 0\n a++;\n }\n}\n\nprint ans", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4acfe238a8932fee4468ab355233a7c4", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var \n\tr = readline().split(' '),\n\ta = +r[0],\n\tb = +r[1],\n\tresult = a\n;\nwhen(a>1){\n a=a/b;\n sum= sum +a ;\n}\nprint(sum+1)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "88af02e488e202a4102e957e5ba7c57c", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict';\n\nString.prototype.toArray = function () {\n return String(this).split('');\n}\n\nString.prototype.getArray = function () {\n return String(this).split(' ');\n}\n\nString.prototype.getNumArray = function () {\n return String(this).split(' ').map(function (value) {\n return parseInt(value);\n });\n}\n\nlet [a, b] = readline().getNumArray(),\n year = 0;\n\nwhile(a <= b) {\n year++;\n a*=3;\n b*=2;\n}\n\nwrite(year);\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "145545c9d3694cf760364487fd9270a3", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const fn = (l, b, t = 0) => l > b ? print(t) : fn(l*3,b*2,t+1)\nfn(...readline().split(\" \"))\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "59fe40ed3412c08e3ff5126fec1907fb", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [a, b] = readline().split(\" \").map(Number);\nfor (var i=1; (a*=3)<=(b*=2); i++ ) {}\nprint (i);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "40d3a2c4947bcde1eb719b20e644e44a", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const fn = (l, b, t) => l > b ? print(t) : fn(l*3,b*2,t+1)\nconst [a,b] = readline.split(\" \")\nfn(parseInt(a),parseInt(b),0)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "80e190228fd40cb6fcfc4bb50e3f4a27", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var ar = readline().split(' ').map(x=>parseInt(x))\n\nvar r=0;\nwhile(ar[0]<=ar[1]) {\n ar = ar.map((a, i)=>{ \n return Math.floor(a*(1-i)*3/2) + Math.floor(a*i*2/3) })\n r++;\n })\n}\nprint(r)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "04be6602edb4bf56b7b8076102f080ae", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a , b ,years = 0;\n\na= readline();\nb= readline();\n\nwhile(a <= b ){\n \n a= a*3 ; b=b*2 ; \n years ++;\n\n}\nprint(years); \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "eb979febe7551bbb3e189a1303947aa9", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = write();\nlet numbers = getNumbers(input);\n\n\nmagic(numbers[0], numbers[1])\n\nfunction magic(a, b) {\n let counter = 1;\n while(true) {\n a = a * 3;\n b = b * 2;\n if(a > b) {\n return counter;\n }\n counter++\n }\n}\n\nfunction getNumbers(string) {\n let numbers = string.split(' ');\n numbers.map(n => Number(n));\n return numbers\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8a4fb9d83dfb4402a32fdce9bf3487c3", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function magic(a, b) {\n let counter = 1;\n while(true) {\n a = a * 3;\n b = b * 2;\n if(a > b) {\n return counter;\n }\n counter++\n }\n}\n\nfunction getNumbers(string) {\n let numbers = string.split(' ');\n numbers.map(n => Number(n));\n return numbers\n}\n\nlet numbers = getNumbers(readline());\n\nmaigc(numbers[0], numbers[1])", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "798d9275417e3b4a30b2403b306aa5c1", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(function(x) { return parseInt(x); });\nvar limak = input[0];\nvar bob = input[1];\n \nfunction bear (a,b){\n\tlet count = 0; \n\twhile ( a<= b) {\n\t\tcount ++ ;\n\t\ta = (a ==1)?3: a *3 ;\n\t\tb = (b ==1)?2: b*2;\n\t}\n \n\treturn count;\n}\n \nprint(bear(limak,bob));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "642c9774d32fedbd418ca3f6a4d3f41a", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x=readLine().split();\nlet n =x[0];\nn=parseInt(n);\nlet m = x[1];\nm=parseInt(m);\nlet a =x[2];\na=parseInt(a);\n\nprint Math.floor(n*m/a*a)*2;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3b4c66dcb42fcf81e58116eb8267e6b2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ').map((item)=>{ return (+item); });\n\nprint (input[0]);\n\n\n\nfunction main (input) {\n\tlet [m, n, a] = input;\n\n\tprint (Math.ceil(m/a) + Math.ceil(n/a));\n\treturn 0;\n}\n// main(input);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ff497723f95b7e2f62c68fe033ac4b87", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let x=readline().split(\" \");\nlet n =x[0].parseInt();\nlet m = x[1].parseInt();\nlet a =x[2].parseInt();\n\nprint Math.floor(n*m/a*a)*2;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "622df4b00bce6c6b04aadb6691e7f0df", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function solve(n, m, a){\n let long = n / a\n let larg = m / a\n return Math.ceil(long) * Math.ceil(larg)\n}\nconsole.log(solve(6,6,4))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2868bc4ef9b16c0345e5fee60b475542", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = input()\nlet b = input()\nlet c = input()\n\na = Math.ceil(a / c)\nb = Math.ceil(b / c)\n\nlet answer = a * b \nconsole.log(answer)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ba70aac207fe94c661f882619e14d13", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5c7cbc0448ea718df288a9f27f62b2cf", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let arr = readline().split(' ');\n\nfunction main(arr[0], arr[1], arr[2]) {\n print(Math.ceil(arr[0] / arr[2]) + Math.ceil(arr[1] / arr[2]));\n \n return 0;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9711f4eb456e2b2124c552abf20115ed", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nprint(parseInt(line[0]) + parseInt(line[1]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "40f40e0d1d678cb1eaadbd35c012372c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function lines(){\n l = [];\n a = true;\n while(a){\n a = readline();\n l.push(a.split(\" \"));\n }\n return l;\n}\nlin = lines();\nlin = lin[0].map(x => x|0);\n\nvar v = Math.ceil(lin[0] / lin[2]);\nvar h = Math.ceil(lin[1] / lin[2]);\n\nwrite(v*h)\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2c120afd869a08485cddbd405a54a55a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', function(line){\n main(line);\n})\n\nparseNMA(n, m, a){\n return ceil(n/a) + ceil(m/a);\n}\n\nfunction main(line){\n var nma = line.split(\" \");\n var n = parseInt(nma[0]);\n var m = parseInt(nma[1]);\n var a = parseInt(nma[2]);\n process.stdout.write(parseNMA(n, m, a));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae4300a8d19dda4846a69235cdd58598", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// input, split into array, and change it to Number (integer)\nconst [squareLength, squareWidth, flagstoneLength] = readline().split(' ').map(input => Number(input));\n\n// tes\n\nlet countFlagstoneWidth = Math.ceil(squareWidth / flagstoneLength);\nlet countFlagstoneLength = Math.ceil(squareLength / flagstoneLength);\n\nprint(countFlagstoneWidth * countFlagstoneLength);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "342ac59d6a8c6e66bebce94c8583ddc2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function solve(n, m, a){\n let long = n / a\n let larg = m / a\n return Math.ceil(long) * Math.ceil(larg)\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7707fd39e68d6fc9342a913bded6cb05", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n let long = n / a\n let larg = m / a\n console.log( Math.ceil(long) * Math.ceil(larg) )\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "264eaca86fe31d40905e9dff45eada17", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict';\nconst [n, m, a] = readline().split(' ').map(num => parseInt(num));\nwrite(Math.ceil(n/a)*Math.ceil(m/a));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "97884aa967a638bdfd3cac51e13fbb33", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "print 4;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "22a42c0136c11f065f63e99993e55f85", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const [n, m, a] = readline().split(' ')\n\nconst result = Math.ceil(n*m/a)\nprint(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "759c55fdf405a1b08de349a299d00594", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const [n, m, a] = readline().splite(' ')\n\nconst result = Math.ceil(n*m/a)\nprint(result)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d66c8385ad0eea8fffd2b27e2366b3f1", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "process.stdin.on('data',c=>{[n,m,a]=c.toString().split(' ')m=Math.ceil;console.log(m(n/a)*m(m/a))})", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fca1ee7f9be38870b02c5a9c5160e4b9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet output = Math.ceil(input.parseInt([0])/inputparseInt([2])) * Math.ceil(input.parseInt([1])/input.parseInt([2]));\nwrite(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d48edfe2ae60f8aa0cb071fb56652196", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar nums = readline().split(' ').map(function(each) {\n return Number(each);\n});\nvar n = nums[0];\nvar m = nums[1];\nvar a = nums[2];\n\n\n\tfor(let b = 1; ; b++) {\n\t\tif (b*a {\n let ay = 0;\n let ax = 0;\n\n while (a*ay < n) {\n ay++;\n }\n\n while (a*ax < m) {\n ax++;\n }\n\n return ax * ay;\n};\n\nprocess.stdin.on('data', function (data) {\n __input_stdin += data;\n});\n\nprocess.stdin.on('end', function () {\n __input_stdin_array = __input_stdin.split(\"\\n\");\n var res;\n var _line = __input_stdin_array[__input_currentline].trim();\n var line = _line.split(\" \");\n var _n = parseInt(line[0]);\n var _m = parseInt(line[1]);\n var _a = parseInt(line[2]);\n res = theatreSquare(_n, _m, _a);\n process.stdout.write(\"\"+res+\"\\n\");\n});\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6f5089241c0cc2ac0f8e60d69e115af6", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nprint(parseInt(line[0]) + parseInt(line[1])", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "46a8abed5fb0b730fca1d08b651a2298", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let x=readline().split(\" \");\nlet n =x[0];\nn=parseInt(n);\nlet m = x[1];\nm=parseInt(m);\nlet a =x[2];\na=parseInt(a);\n\nprint Math.floor((n*m)/(a*a))*2;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fd36d7605bb206fef2fbf3b93457c6c2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let arr = readline().split(' ');\n\nprint(Math.ceil(arr[0] / arr[2]) * Math.ceil(arr[1] / arr[2]));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "440f1054273616a193a855ecf1756602", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' ');\n\nfunction paveStones ( n, m, a ) {\n var xCount = 0;\n var yCount = 0;\n\twhile (n - a*xCount > 0){\n\txCount++;\n\t} \n\t\n\twhile (m - a*yCount > 0){\n\tyCount++;\n\t}\n\t\n \n \nreturn(xCount*yCount);\n}\n\nprint(paveStones a[0], a[1], a[2])", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5fc4d48101279ef657a639e66b86cb10", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet output = Math.ceil(input[0]/input[2]) * Math.ceil(input[1]/input[2]);\nwrite(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "065c4d76f795f1a01811a2b61d40e43a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var cad = readline();\nvar n = cad[0];\nvar m = cad[2];\nvar a = cad[4];\nif (a >= m){\n var a_anchos = 1;\n} else {\n if (m % a > 0){\n var a_anchos = parseInt(m/a) + 1;\n } else {\n var a_anchos = m/a;\n }\n}\nif (a >= n){\n var a_largos = 1;\n} else {\n if (n % a > 0){\n var a_largos = parseInt(n/a) + 1;\n } else {\n var a_largos = n/a;\n } \n}\nvar cantidad_necesaria = a_largos * a_anchos;\n\nif (cantidad_necesaria == Infinity){\n var largo = a_largos.toString();\n var ancho = a_anchos.toString();\n var total = \"\";\n for (let letra of largo){\n total += letra;\n }\n for (let subindice in ancho){\n if (subindice > 0){\n total += ancho[subindice];\n }\n }\n cantidad_necesaria = total;\n}\n\nprint (cantidad_necesaria);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0d3c4ed14f92aca16fd0a6a4fb624e6e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// const readline = () => {return '2 1 1'}\n// const print = (_result) => {console.log(_result)}\n\n\n\n\n// const [n, m, a] = readline().split(' ')\n// const result = Math.ceil(n*m/a)\n// print(result)\n\nconst x = readline().split(' ')\n\nconst [a2, b2, c2] = '1, 2, 3'.split(' ')\n\nprint(Math.ceil(x[0] / x[2]) * Math.ceil(x[1] / x[2]))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "959f2848eee22d3f1e500609e8beabd3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict';\n\nfunction NumberOfTiles(m,n,a) {\n\t\n\tfor(let b = 1; ; b++) {\n\t\tif (b*a Number(input));\n\n\nlet countFlagstoneWidth = Math.ceil(squareWidth / flagstoneLength);\nlet countFlagstoneLength = Math.ceil(squareLength / flagstoneLength);\n\nprint(countFlagstoneWidth * countFlagstoneLength);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bae771e1f560b09f008a9946c36a87f7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline();\ninput = input.split(' ');\noutput = Math.ceil(input[0]/input[2]) + Math.ceil(input[1]/input[2]);\nconsole.log(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "be5cf9bff5313b3d9f325acab700f59a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet output = Math.ceil(input[0]/input[2]) + Math.ceil(input[1]/input[2]);\nwrite(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d049b529d579a274fcc568c4eed64a4a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(' ')\nvar [n, m, a] = numbers\nvar [x, y] = [Math.ceil(n/a), Math.ceil(m/a)]\nprint(x * y)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "870f247713f7b6e16ea46269272b51b7", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "main(readline());\nparseNMA(n, m, a){\n return ceil(n/a) * ceil(m/a);\n}\n\nfunction main(line){\n var nma = line.split(\" \");\n var n = parseInt(nma[0]);\n var m = parseInt(nma[1]);\n var a = parseInt(nma[2]);\n write(parseNMA(n, m, a));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b889b81edfd0cbaf626869a41d8f082e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = readline();\nlet m = readline();\nlet n = readline();\nlet long = n / a;\nlet larg = m / a;\nwrite( Math.ceil(long) * Math.ceil(larg) );", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "18e56e8b2316db061961fcc91ad95ca5", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// input, split into array, and change it to Number (integer)\nconst inputs = readline().split(' ').map(input => Number(input));\n// const [squareLength, squareWidth, flagstoneLength] = readline().split(' ').map(input => Number(input));\nconst squareLength = inputs[0];\nconst squareWidth = inputs[1];\nconst flagstoneLength = inputs[2];\n\nlet countFlagstoneWidth = Math.ceil(squareWidth / flagstoneLength);\nlet countFlagstoneLength = Math.ceil(squareLength / flagstoneLength);\n\nprint(countFlagstoneWidth * countFlagstoneLength);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "17800002cc2f1747e455c64d95620208", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// input, split into array, and change it to Number (integer)\nconst inputs = readline().split(' ');\n// const [squareLength, squareWidth, flagstoneLength] = readline().split(' ').map(input => Number(input));\nconst squareLength = Number(inputs[0]);\nconst squareWidth = Number(inputs[1]);\nconst flagstoneLength = Number(inputs[2]);\n\nlet countFlagstoneWidth = Math.ceil(squareWidth / flagstoneLength);\nlet countFlagstoneLength = Math.ceil(squareLength / flagstoneLength);\n\nprint(countFlagstoneWidth * countFlagstoneLength);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f5c0d8709314dcef5a18e9a2b0f44976", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// const readline = () => {return '2 1 1'}\n// const print = (_result) => {console.log(_result)}\n\n\n\n\nconst [n, m, a] = readline().split(' ')\n\nconst result = Math.ceil(n*m/a)\nprint(result)\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d1d8813c81e6fad848e2dd5990d9d906", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let numbers = readline().split(' ').map(n => parseInt(n));\nlet [n, m, a] = numbers;\n\nlet an = Math.ceil(n / a);\nlet am = Math.ceil(m / a);\n\nprint(an * am);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "be1372a8e765bb3d51e4dec142a126a3", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let arr = readline().split(' ');\n\nprint(Math.ceil(arr[0] / arr[2]) * Math.ceil(arr[1] / arr[2]));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1e00178585e231e19693e47eb4d336b2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let numbers = readline().split(' ').map((n) => parseInt(n));\nlet [n, m, a] = numbers;\n\nlet an = Math.ceil(n / a);\nlet am = Math.ceil(m / a);\n\nprint(an * am);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "64978ce2a6207ccbc42b183dd1ae6d9a", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict'\nlet numbers = readline().split(\" \").map(function(x) { return parseInt(x); })\nconst [n, m, a] = numbers\nlet [x, y] = [parseInt(n / a), parseInt(m / a)]\n\nif (n % a) x++\nif (m % a) y++\nprint(x*y)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aaab688d14e2e6d1df1327ff4a157eb0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// input, split into array, and change it to Number (integer)\n// const inputs = readline().split(' ');\n// const [squareLength, squareWidth, flagstoneLength] = readline().split(' ').map(input => Number(input));\n// const squareLength = Number(inputs[0]);\n// const squareWidth = Number(inputs[1]);\n// const flagstoneLength = Number(inputs[2]);\n\n// let countFlagstoneWidth = Math.ceil(squareWidth / flagstoneLength);\n// let countFlagstoneLength = Math.ceil(squareLength / flagstoneLength);\n\n// print(countFlagstoneWidth * countFlagstoneLength);\n\nlet inputs = readline();\n\nprint(inputs);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c631abe35f6c28b06ced0560017d6bbc", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let x=readline().split();\nlet n =x[0];\nn=parseInt(n);\n\nprint n;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2c82a2c9a40349c50d81540188d81d85", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let numbers = readline().split(' ');\n\nfunction X(n) {\n let a = Math.ceil(n[0] / n[2])\n let b = Math.ceil(n[1] / n[2])\n \n return a * b\n}\nprint(X(numbers))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f302c88922708b81f027b8f3ca52303e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ');\nprint(Math.ceil(input[0]/input[2])*Math.ceil(input[1]/input[2]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "17bcff6574ec9b657e6782d911059864", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ').map(function(x) { return parseInt(x); });\nlet output = Math.ceil(input[0]/input[2]) * Math.ceil(input[1]/input[2]);\nwrite(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1c83de30d0744f380602d54ae00c47ab", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const numbers = readLine().split(\" \").map(x => parseInt(x));\n const [n, m, a] = numbers\n let [x, y] = [parseInt(n / a), parseInt(m / a)]\n if (n % a) x++\n if (m % a) y++\n console.log(x*y) ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0f10c88ef50268ad9a965f8a5385e1a9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input = \"\";\nprocess.stdin.on('data', function(chunk) {\n input += data;\n});\n\nprocess.stdin.on('end', function() {\n main(input.split(\"\\n\")[0]);\n});\n\nparseNMA(n, m, a){\n return ceil(n/a) + ceil(m/a);\n}\n\nfunction main(line){\n var nma = line.split(\" \");\n var n = parseInt(nma[0]);\n var m = parseInt(nma[1]);\n var a = parseInt(nma[2]);\n process.stdout.write(parseNMA(n, m, a));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aaec830f55ca42b7e2975c6badc6e307", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// const readline = () => {return '2 1 1'}\n// const print = (_result) => {console.log(_result)}\n\n\n\n\n// const [n, m, a] = readline().split(' ')\n// const result = Math.ceil(n*m/a)\n// print(result)\n\nconst x = readline().split(' ')\n\nconst [a2, b2, c2] = '1 2 3'.split(' ')\n\nprint(Math.ceil(x[0] / x[2]) * Math.ceil(x[1] / x[2]))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5dbfcea7a3cb755a22d3f8606e0c16a0", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ').map(function(x) { return parseInt(x); });;\nlet output = Math.ceil(input[0]/input[2]) * Math.ceil(input[1]/input[2]);\nwrite(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c8d5ebfb8d2ef08d16981ff3c3518b33", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet output = Math.ceil(input.parseInt([0])/inputparseInt([2])) * Math.ceil(input.parseInt([1])/input.parseInt([2]));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a70cce57f9bcaa9035920a3e332b739f", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function id (x,y) {\n\t(x - x % y) / y\n\nvar numbers = readline().split(\" \");\nvar n numbers = [0];\nvar m numbers = [1];\nvar a numbers = [2];\n\nvar resultat = 0;\n\nvar w = id(m, a);\nvar h = id(n, a);\n\nvar mr = (m % a);\n\nif (mr !==0)\n\tw = w + 1;\nif (nr !==0 )\n\th = h + 1;\nresult = w * h;\nprint(result)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d51389751a3d988c0008da4d7ce554ad", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n\t\n\tTest1\n\n\n\t\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4521adb0b105b5a5a6e3766287dbdee2", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const __rl__= require('readline').createInterface({ input: process.stdin, output: process.stdout });\n\nfunction solve(ax) {\n\twrite(Math.ceil(ax[0]/ax[2]) * Math.ceil(ax[1]/ax[2]));\n}\n\nfunction getInput(toProceed) {\n\tvar inputVar = [];\n\t// __rl__.on('line', function(line) {\n\t(while (true) { var line = readline();\n\t\tline.split(' ').filter(x => x.length > 0)\n\t\t\t.map(function(el) { inputVar.push(parseInt(el)); });\n\t\twhile (inputVar.length >= 3) toProceed(inputVar.splice(0, 3));\n\t});\n}\n\nfunction main() {\n\tgetInput(solve);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "98470f62655b37e143c83d03b49ab407", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function solve(n, m, a){\n let long = n / a\n let larg = m / a\n return Math.ceil(long) * Math.ceil(larg)\n}\nsolve(6,6,4)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4f0f9121427d563ad74c697f4d618493", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n// Read from Standard In\nvar data = readline().split(\" \");\n\n// Parse variables\nvar n = data[0];\nvar m = data[1];\nvar a = data[2];\n\n\nif( n === a){\n print(Math.round(m/a);\n} else if (m === a){\n print(Math.round(n/a);\n} else {\n print(Math.round(n/a) + Math.round(m/a));\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e4b5cd6d8af1a2b895eccbd9606b86ae", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const numbers = readLine().split(\" \").map(x => parseInt(x));\n const [n, m, a] = numbers\n let [x, y] = [parseInt(n / a), parseInt(m / a)]\n if (n % a) x++\n if (m % a) y++\n print(x*y)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8d58bcef173a06cef4bdcb9ca44b4f89", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = readline().split(' ')\na = a.map( x => +x );\nf = x => Math.ceil( x/a[2] )\nn = a[0]\nm = a[1]\nconsole.log( f(n)*f(m) )\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4d7e6afb58fd2506c55785043dc888e6", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "main(readline());\nparseNMA(n, m, a){\n return ceil(n/a) * ceil(m/a);\n}\n\nfunction main(line){\n var nma = line.split(\" \");\n var n = parseInt(nma[0]);\n var m = parseInt(nma[1]);\n var a = parseInt(nma[2]);\n process.stdout.write(parseNMA(n, m, a));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "25e682d2c1494ccdb025e194230bdc6e", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var x = readline().split(' ').map(x => parseInt(x));\n\nvar count=0;\nif(x[0]%x[2]>0)\n count+=x[0]/x[2]+1;\nelse\n count+=x[0]/x[2];\nif(x[1]%x[2]>0)\n count+=x[1]/x[2]+1;\nelse\n count+=x[1]/x[2];\nprint(count);\n\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "50973505aae9012fa0d616cf16276264", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let numbers = readline().split(' ').map(function(n) { return parseInt(n); });\nlet n = numbers[0];\nlet m = numbers[1];\nlet a = numbers[2];\n\nlet an = Math.ceil(n / a);\nlet am = Math.ceil(m / a);\n\nprint(an * am);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a97ae7416dc038a861c3bcc16291cb9c", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\n\n\nfunction main (input) {\n\tinput = input.map((item)=>{ return (+item); });\n\tlet [m, n, a] = input;\n\n\tprint (Math.ceil(m/a) + Math.ceil(n/a));\n\treturn 0;\n}\nmain(input);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4ca2f430ccb5e8e5e2803b6ba301ecbd", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let arr = readline().split(' ');\n\nprint(Math.ceil(arr[0] / arr[2]) + Math.ceil(arr[1] / arr[2]));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ff8eb1532c71d762b9b96718c22141c1", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let x=readline().split();\nlet n =x[0];\nn=parseInt(n);\nlet m = x[1];\nm=parseInt(m);\nlet a =x[2];\na=parseInt(a);\n\nprint a;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9e1c68e143a8a679bf79d324c2caa7e9", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const inp = readline();\nconst w = inp.split(\" \").map(v => Number(v));\nconst [n, m, a] = w;\nconst answer = coverCount(n, m, a);\n\nprint(answer);\n\nfunction coverCount(n, m, a) {\n return Math.ceil(n / a) * Math.ceil(m / a);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5815b964b1ee12667a8949b8878ef3f4", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let items;\nfor (let r = 0; r < 5; r++) {\n items = readline().split(' ');\n for (let c = 0; c < 5; c++) {\n if (items[c] == '1') { print(Math.abs(2 - c) + Math.abs(2 - r)); break; }\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e4a249b36330e719c2b80ecd536a2158", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var cont =0;\nvar posicion = 13;\n \nvar tablero[][];\n for(int i = 0 ; i < 5; i++){\n for(int x = 0; x < 5; x++){\n if(readline()==1){\n print (Math.abs(2-i)+Math.abs(2-x));\n }\n }\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f9e2909a409c61e676807851cb0d2dd7", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var cont =0;\nvar posicion = 13;\n \nvar tablero = [5][5];\n for(int i = 0 ; i < 5; i++){\n for(int x = 0; x < 5; x++){\n if(readline()==1){\n print (Math.abs(2-i)+Math.abs(2-x));\n }\n }\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e00d726a9edf43454f20055bcba2e00c", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = 5, b, c;\n\nfor (; a; a--) {\n c = readline();\n for (b = 10; b; b -= 2) {\n if (+c[b - 2]) {\n\t print(Math.abs(a - 3) + Math.abs((b / 2) - 3));\n\t break;\n }\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d2e441a637ec13bd738aa92c45a22112", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let row = 0;\nlet moves = 0;\n\nwhile(row < 5){\n const columns = prompt().split(' ');\n const col = columns.indexOf('1');\n if (col !== -1){\n moves = Math.abs(2 - row) + Math.abs(2 - column);\n }\n row++;\n}\n\nconsole.log(moves)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3092ebf4b9714e9d1e174acd6daad5d6", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = 5, b, c;\n\nfor (; a; a--) {\n c = readline();\n for (b = 9; b; b--) {\n if (+c[a - 1][b - 1]) {\n print((a - 3 < 0 ? 3 - a : a - 3) + (b - 7 < 0 ? 7 - b : b - 7));\n\t break;\n }\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ad5873651e8084edaecfb0df833cf04b", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = 5, b, c;\n\nfor (; a; a--) {\n c = readline();\n for (b = 10; b; b -= 2) {\n if (+c[b - 2]) {\n\t print((a - 3 < 0 ? 3 - a : a - 3) + ((b /= 2) - 3 < 0 ? 3 - b : b - 3));\n\t break;\n }\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0679ecf9bb004765987b4adb073565bf", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var cont =0;\nvar posicion = 13;\n \nvar tablero = new array();\n for(int i = 0 ; i < 5; i++){\n for(int x = 0; x < 5; x++){\n if(readline()==1){\n print (Math.abs(2-i)+Math.abs(2-x));\n }\n }\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ecf9b077b63c46d3930a81ece0c8a370", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "Node.js", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n\n \n vector d(3,0);\n vector x(3,0);\n vector arr(4,0);\n int i=0;\n cin >> arr[0] ;\n cin >> arr[1] ;\n cin >> arr[2] ;\n cin >> arr[3] ;\n \n //cout << i << endl;\n x[0]=arr[0];\n x[1]=arr[1];\n x[2]=arr[2];\n\n long long int dis=arr[3];\n sort(x.begin(), x.end()); \n \n\n d[0]=abs(x[0]-x[1]);\n d[1]=abs(x[0]-x[2]);\n d[2]=abs(x[1]-x[2]);\n\n long long int m = min(d[0],min(d[1],d[2]));\n //cout<< m<=dis){\n cout<< 0<= m) {\n var q = ~~(n / m);\n ans += q;\n n = q + n % m;\n }\n return ans;\n}.apply(null, readline().split(' ').map(Number)));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6e8ecfb6ed813fcb0729681c41f24337", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline().split(\" \");\nvar pairs_of_socks = +r[0];\nvar m-th_day = +r[1];\nvar\tresult = pairs_of_socks + ((pairs_of_socks-1)/(m-th_day-1));\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "304125fdd0b895fa14e97619ce2fbd1e", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var \n\tr = readline().split(\" \"),\n\tpairs_of_socks = +r[0],\n\tm-th_day = +r[1],\n\tresult = pairs_of_socks + (pairs_of_socks-1/m-th_day-1)\n;\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "36a712764507ecdd4a26083b45b74b02", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var \n\tr = readline().split(' '),\n\tpairs_of_socks = +r[0],\n\tm-th_day = +r[1]\n;\n\nif(pairs_of_socks === m-th_day){\n\tprint(pairs_of_socks + 1);\n}else{\n\tprint((pairs_of_socks + m-th_day) + 1);\n}\t", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "20ea6d8c86837fa8f3f37dfb77f3afbd", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var \n\tr = readline().split(' '),\n\tpairs_of_socks = +r[0],\n\tm-th_day = +r[1],\n\tresult = pairs_of_socks + (pairs_of_socks-1/m-th_day-1)\n;\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ee5595c99dd829f5a439dd050c0f3d2", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var \n\tr = readline().split(' '),\n\tpairs_of_socks = +r[0],\n\tm-th_day = +r[1],\n\tvar result = pairs_of_socks + (pairs_of_socks-1/m-th_day-1)\n;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ca22ff23988553a6af9ff6145b2dc2c1", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "const [sectionCountMax, nutCount, divisorCount, sectionCapacity] = readline().split(\" \").map(x => Number(x));\nconst divisorCountMax = sectionCountMax - 1;\nlet used = Math.floor(divisorCount / divisorCountMax);\nconst dividedCapacity = sectionCountMax * sectionCapacity;\nlet remaining = nutCount - used * dividedCapacity;\nif (remaining <= 0) print(Math.ceil(nutCount / dividedCapacity));\nelse {\n remaining -= (divisorCount - used++ * divisorCountMax + 1) * sectionCapacity;\n if (remaining > 0) used += Math.ceil(remaining / sectionCapacity);\n print(used);\n} \n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f4e52dda613aba3114b7f304c2c51b6f", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const fs = require(\"fs\");\n\nconst [sectionCountMax, nutCount, divisorCount, sectionCapacity] = fs.readFileSync(0).toString().trim().split(\" \").map(x => Number(x));\nconst divisorCountMax = sectionCountMax - 1;\nlet used = Math.floor(divisorCount / divisorCountMax);\nconst dividedCapacity = sectionCountMax * sectionCapacity;\nlet remaining = nutCount - used * dividedCapacity;\nif (remaining <= 0) process.stdout.write(Math.ceil(nutCount / dividedCapacity) + \"\\n\");\nelse {\n remaining -= (divisorCount - used++ * divisorCountMax + 1) * sectionCapacity;\n if (remaining > 0) used += Math.ceil(remaining / sectionCapacity);\n process.stdout.write(used + \"\\n\");\n} \nprocess.exit();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f2e8daa648822d2edd7de46633505693", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n int n = 1000;\n int m = 1000;\n int d = 1000000000;\n\n var sb = new StringBuilder();\n sb.AppendLine(n + \" \" + m + \" \" + d);\n\n for (int i = 1; i <= n; i++)\n sb.AppendLine(i + \" \" + i);\n for (int i = 1; i <= m; i++)\n sb.AppendLine(i + \" \" + i);\n var str = sb.ToString();\n\n Console.Write(str);\n\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4cb2d8791c34c74a3662ab830c7f7f05", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "JavaScript", "source_code": "2 2 2\n5 3\n6 3\n4 2\n8 1", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c1290536d8f668f8ba29a80e14a7275e", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "JavaScript", "source_code": "function f1(left, right, t) {\n if(left >= right) return left;\n let mid = right - (right - left) / 2;\n if(taskT[mid] < k) left = mid + 1;\n else right = mid - 1;\n f1(left, right, t);\n}\n\nfunction main() {\n let input = readline().split(' ');\n let [n, k] = input, T = 240, t = T - k, taskT = [0];\n for(let i = 1; i < 11; i++) taskT[i] = 5 * i + taskT[i - 1];\n print(f1(0, n, t));\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "512539f9a9d9d8b08edac18edb8b246a", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet n = input[0], k = input[1], T = 240, t = T - k, taskT = [0];\nfor(let i = 1; i < 11; i++) taskT[i] = 5 * i + taskT[i - 1];\nlet left = 0, right = n;\nwhile(left <= right) {\n let mid = parseInt(right - (right - left) / 2);\n if(taskT[mid] >= t) right = mid - 1;\n else left = mid + 1;\n}\nif(t === taskT[right + 1]) right ++;\nprint(Math.min(right,n));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c3e64a5bdec46ead241acc3038f61fa8", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ');\nvar [n, k] = input, T = 240, t = T - k, taskT = [0];\nfor(var i = 1; i < 11; i++) taskT[i] = 5 * i + taskT[i - 1];\nvar left = 0, right = n;\nwhile(left <= right) {\n var mid = parseInt(right - (right - left) / 2);\n if(taskT[mid] >= t) right = mid - 1;\n else left = mid + 1;\n}\nif(t === taskT[right + 1]) right ++;\nprint(Math.min(right,n));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "37fab8dc60d162d96f6301d0b642ea7e", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var t = readline();\nvar q = readline();\nvar str = readline();\nvar arr = str.split(\"\");\nvar check = false;\nfor (let i = 0; i < q; ++i) {\n arr.forEach((kid, index) => {\n if (check) {\n check = false;\n return;\n }\n if (kid === \"B\") {\n if (arr[index + 1] === \"G\") {\n var temp = arr[index];\n arr[index] = arr[index + 1];\n arr[index + 1] = temp;\n check = true;\n }\n }\n });\n}\nprint(arr.join(\"\"));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a2282d4f3f7c7269919cd4ce460b1d64", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "no = readline().split(\" \");\ntxt = readline();\nvar loop = parseInt(no[1]);\nvar cnt = parseInt(no[0]);\nfor (var k = 0; k < loop; k++) {\n for (var i = 0; i < cnt; i++) {\n if(txt[i] == 'B' && txt[i+1] == 'G'){\n txt[i+1] = [txt[i],txt[i] = txt[i+1]][0],++i;\n continue;\n }\n}\nwrite(txt);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fc57bae6013ecab9ca949a6770f713d7", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var t = readline();\nvar q = readline();\nvar str = readline();\nvar arr = str.split(\"\");\nvar check = false;\nfor (let i = 0; i < q; ++i) {\n arr.forEach((kid, index) => {\n if (check) {\n check = false;\n return;\n }\n if (kid === \"B\") {\n if (arr[index + 1] === \"G\") {\n [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];\n check = true;\n }\n }\n });\n}\nprint(arr.join(\"\"));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6bf62e001871df8b580eb5ed3e012c50", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var r = +readline().split(' ')[2];\nvar s = readline();\nwhiel(r--){\n s=s.replace(/BG/g, 'GB');\n}\nprint(s);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4e2d0de1b693ea2fb36db4990d42755c", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var num = readline()\nvar luckyNumbers = [4, 7, 44, 47, 77, 74, 444, 447, 474, 777, 774,]\nfor( var i = 0; i < luckyNumbers.length; i++){\n if(num % luckyNumbers[i] == 0){\n break\n print(\"YES\")\n }\n}else{\n print(\"NO\")\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e4dc546d7abbeb40ec4a65faff523879", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\na = readline();\nif (a % 4 === 0 || a % 7 === 0) {\n print('YES')\n}\nelse {\n \n if (a.includes('1') || a.includes('2') || a.includes('3') || a.includes('5') || a.includes('6') || a.includes('8') || a.includes('9') || a.includes('0')) {\n \n print('NO');\n}\nelse {\n print('YES');\n}\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "94e93605943b144f5fbdc3ea979a9b93", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var lucky = [4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777],\n\tn = parseInt(readline())\n\tresponse = 'NO'\n\nfor(var i = 0; i < 14, i++)\n\tif (0 == n % lucky[i]) {\n\t\tresponse = 'YES'\n\t\tbreak\n\t}\n\nprint(response)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "80cdc766c9cc17f296c37e5a1d407e55", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var lucky = [4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777],\n\tn = parseInt(readline()),\n\tresponse = 'NO'\n\nfor(var i = 0; i < 14, i++)\n\tif (0 == n % lucky[i]) {\n\t\tresponse = 'YES'\n\t\tbreak\n\t}\n\nprint(response)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "11b8ea6a9557c387aeaed45a4d831db4", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar n = parseInt(input);\nfunction isLucky(n){\n\twhile (n > 0) {\n\t\tunit = n % 10;\n\t\tn = n / 10;\n\t\tif (unit != 4 && unit != 7)\n\t\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction isAlmostLucky(n){\n\tif isLucky(n)\n\t\treturn 'YES';\n\tfor (i = 4; i < n; i++){\n\t\tif (isLucky(i)){\n\t\t\tif (n % i == 0) \n\t\t\t\treturn 'YES';\n\t\t}\n\t}\n\treturn 'NO';\n}\nprint(isAlmostLucky(n));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6848597475073bbf3e5b4c99818a8353", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "/**\n * Created by Det on 24.05.2015.\n */\n(function main() {\n var line = readline().split(' ');\n var k = line[0],\n n = line[1],\n w = line[2];\n var answer = parseInt(k * w * (1 + +w) / 2 - n);\n\n answer = answer ? answer :| 0;\n print(answer);\n})();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1544580dc3e35442d1efaab94504fa41", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = parseInt(readline().split(' '));\nvar k = input[0];//coste primera banana\nvar n = input[1];//dinero que tiene\nvar w = input[2];//numero bananas que quiere\nvar preciototal = 0;\nvar precioinferior=0;\nfor (var i=1; i<=w;i++){\n var preciototal += k*i;\n k++;\n}\nif(preciototal-n >=0){\n print (preciototal-n);\n}else{\n print(precioinferior);\n}\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aa071b2aab84df0ae64da5ce1873de56", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(\" \").map(x=>parseInt(x));\nvar [k,n,w] = input;\nvar total = 0;\nvar amount = k;\nfor(var i=0; i< w; i++){\n total += k;\n k*=2;\n}\nprint(total-n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a0f4a565dd46e4339d6dca7385a25639", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var l1 = readine();\nvar l2 = readine();\nfor(i in l1){\n if(l1[i].toLowerCase() < l2[i].toLowerCase()){\nwrite(-1);\n}if(l1[i].toLowerCase() < l2[i].toLowerCase()){write(1)}else{\nwrite(0)}\n}\n \n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6f82bfec318dcac5ddb2d9f4e8e892c0", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let inputString = readline()\n\ninputString = inputString.toLowerCase();\n\nlet strings = inputString.split(' ');\nlet firstStrCounter = 0,\n secondStrCounter = 0;\n\nfor (let i = 0; i < strings[0].length; i++) {\n if (strings[0].charCodeAt(i) > strings[1].charCodeAt(i)) {\n firstStrCounter++;\n } else if (strings[0].charCodeAt(i) < strings[1].charCodeAt(i)) {\n secondStrCounter++;\n }\n}\n\nprint(firstStrCounter - secondStrCounter)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "776a42460d04a5b1dd15adb123f86075", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let inputString = readline().toLowerCase();\nlet strings = inputString.split(' ');\n \nlet firstStrCounter = 0,\n secondStrCounter = 0;\n\nfor (let i = 0; i < strings[0].length; i++) {\n if (strings[0].charCodeAt(i) > strings[1].charCodeAt(i)) {\n firstStrCounter++;\n } else if (strings[0].charCodeAt(i) < strings[1].charCodeAt(i)) {\n secondStrCounter++;\n }\n}\n\nprint(firstStrCounter - secondStrCounter)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f4159450f1fb9c4e05d925e9ad76f643", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " str1 = readline().split();\n str2 = readline().split();\n let output = 0;\n for (i = 0; i < str1.length; i++) {\n char1 = str1[i].toLowerCase();\n char2 = str2[i].toLowerCase();\n \n if(char1 == char2){\n continue;\n } else if(char1 > char2){\n output++;\n break;\n } else {\n output--;\n break\n }\n }\n print(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b3e148ae4658f6a0820996bb67d8fd43", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let firstString = readline().toLowerCase();\nlet secondLine = readline().toLowerCase();\nprint(firstString < secondLine ? -1 : (firstString > secondLine ? 1 : 0));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "50d42aa3be055c3338542dfeefae72af", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var Fstring = readline().toLowerCase();\nvar Sstring = readline().toLowerCase();\nvar first = Fstring.charCodeAt(0) - \"a\".charCodeAt(0);\nvar second = Sstring.charCodeAt(0)- \"a\".charCodeAt(0);\nif(first == second) print(0);\nelseif(first < second) print(-1);\nelse print(1);\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9323fe618762e6ec0f93a0863c504e33", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var stringA = readline()\n var stringB = readline()\n\n var countA = 0\n var countB = 0\n\n for (let i = 0; i < stringA.length; i++) {\n countA += stringA.toLowerCase().charCodeAt(i)\n countB += stringB.toLowerCase().charCodeAt(i)\n }\n\n\n if (countA === countB) {\n print(0)\n } else if (countA < countB) {\n print(-1)\n } else {\n print(1)\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "742201716c659aaba59d4b14e3a9b394", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let inputString = readline().toLowerCase(),\n strings = inputString.split(' ');\n \nlet firstStrCounter = 0,\n secondStrCounter = 0;\n\nfor (let i = 0; i < strings[0].length; i++) {\n if (strings[0].charCodeAt(i) > strings[1].charCodeAt(i)) {\n firstStrCounter++;\n } else if (strings[0].charCodeAt(i) < strings[1].charCodeAt(i)) {\n secondStrCounter++;\n }\n}\n\nprint(firstStrCounter - secondStrCounter);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e4add8ff94d3e322df359ee688da40a4", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let string1 = readline()\nlet string2 = readline()\n// var string1 = \"aaaa\"\n// var string2 = \"aaaA\"\n\nif(string1.toLowerCase()string2.toLowerCase()){\n print(1)\n}\nelse{\n print(0)\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1023bb4299484efae7a10e52b708ffea", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//Petya and Strings\n\nvar cadena_uno=readline().toLowerCase();\t// guardamos la entrada de datos a min\u00fasculas.\nvar cadena_dos=readline().toLowerCase();\n\nvar abecedario=[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"];\n\n\nfunction posicionletra(letra){\n\tfor(x=0;xposicionletra(cadena_dos[i])){\n\t\tprint(1);\n\t}\n\telse{\t\n\t\tprint(-1);\n\t}\n\t\t\n}\n\t\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5ce30c8ea47f2eb5f3ab672dfac65a2c", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var str1 = readline().toLowerCase();\nvar str2 = readline().toLowerCase();\n\nvar firstStrCounter = 0,\n secondStrCounter = 0;\n\nfor (let i = 0; i < str1.length; i++) {\n if (str1.charCodeAt(i) > str2.charCodeAt(i)) {\n firstStrCounter++;\n } else if (str1.charCodeAt(i) < str2.charCodeAt(i)) {\n secondStrCounter++;\n }\n}\n\nprint(firstStrCounter - secondStrCounter)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f6b8eea6bf2745e85b7e66ffb6331cbf", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline()\nlet input = readline().split(\" \")\nlet found = false\nfor(let i in input)\n\tif(input[i] === \"1\"){\n\t\tfound = true\n\t\tprint(\"HARD\")\n\t}\n\nif(!found)\n\tprint(\"EASY\")\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1a7c743319cca9c907605c750e130a0d", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "493529b7da1e211c5a39de662ee27778", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline();\nvar a = readline();\nvar b = a.length;\nvar c = 'EASY';\n\nprint c;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1c4636c3022cc812d935a16d9c86d486", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\t\nvar n = readline().split(\" \");\nwhile(n[0]--)\n(n[1] == 1)? print(\"HARD\"): print(\"EASY\");\nbreak;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7832fd35d7f3af765785572d0dbfe00e", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline();\nvar a = readline();\nvar b = a.length;\nvar c = 'EASY';\nfor (; b; b--) {\n if (a[b - 1] == 1) {\n c = 'HARD';\n break;\n }\n}\nprint c;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "10ae3d2a1889e0123f415e7635fbbedd", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "'use strict'\nreadline();\nlet a = readline();\nlet b = a.length - 1;\nlet c = 'EASY';\nfor (; b; b--) {\n if (a[b] == 1) {\n c = 'HARD';\n break;\n }\n}\nwrite c;", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0ea1b595439cefd581544dd3b5ed8a26", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let\n n = Number (prompt ()),\n a = prompt ().split ('')\n\nfor (let i = 0; i <= n; i++) {\n if (Number (a[i]) == 0) {\n console.log (i)\n if (i == n - 1) {\n alert ('EASY')\n }\n }\n if (Number (a[i]) == 1) {\n alert ('HARD')\n break\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c1b1bf5f646ca52189fd55183ea25469", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "readline();\nvar data = readline().split(\" \").map( x=> parseInt(x));\nvar answer; \nfor(var i=0;i {\n\n let count = 0;\n for (let i = 1; i <= 9; i++) {\n let found = false;\n for (let j = 1; j <= 4; j++) {\n let apt = i.toString().repeat(j);\n count += apt.length;\n if (apt === appartment) {\n found = true;\n break;\n }\n }\n if (found) break;\n }\n\n return count;\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fd05d25fb54bd8b0e868ee557913b851", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numbersPressed = function(appartment) {\n\n let count = 0;\n for (let i = 1; i <= 9; i++) {\n let found = false;\n for (let j = 1; j <= 4; j++) {\n let apt = i.toString().repeat(j);\n count += apt.length;\n if (apt === appartment) {\n found = true;\n break;\n }\n }\n if (found) break;\n }\n\n return count;\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "68ead3496303ef6122cdc09b13418515", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let lines = +readline();\n\nlet mult = [1, 3, 6, 10];\n\nfor (let x = 0; x < lines; x++) {\n let f = readline[0];\n let res = (f - 1) * 10 + mult[readline.length - 1];\n print(res);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "40feea4abc56cf4c23f6cca6f5b036f5", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let lines = parseInt(readline());\n\nlet mult = [1, 3, 6, 10];\n\nfor (let x = 0; x < lines; x++) {\n let num = readline;\n let f = +num[0];\n let res = (f - 1) * 10 + mult[num.length - 1];\n print(res);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "371d870e64e66db712e4a3fe3aadf1d5", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let _inputLines;\nlet _lineNumber = 0;\nlet inputReader = _inputReader ();\n\nfunction _main() {\n\n\t_inputLines = _inputData.trim().split('\\n').map((string) => {\n\t\treturn string.trim();\n\t});;\n\tvar t = inputReader.readNumber();\n\tfunction print(x) { console.log(x); }\n\twhile (t--) {\n\t var n = inputReader.readNumber();\n\t var cnt = 0;\n\t var f = 0;\n\t for (var i = 1; i <= 9; ++i) {\n\t for (var j = i, time = 1; j < 10000+1; j = j * 10 + i, ++time) {\n\t cnt += time;\n\t if (j == n) {\n\t f = 1;\n\t break;\n\t }\n\t }\n\t if (f) break;\n\t }\n\t print(cnt);\n\t}\n\n}\n\nvar _inputData = '';\nfunction cacheInput(data) {\n\t_inputData += data;\n}\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf8');\nprocess.stdin.on('data', cacheInput).on('end', _main);\n\nfunction _inputReader () {\n\tfunction readNumber(){\n\t\treturn Number(_inputLines[_lineNumber++]);\n\t}\n\n\n\treturn {\n\t\treadNumber,\n\t}\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3ba206033184b77acb800af97f9e6c38", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const N = parseInt(readline());\nconst m = [0, 1, 3, 6, 10];\n\nfor (let i = 0; i < N; ++i) {\n const s = readline();\n const u = parseInt(s[0]);\n return (u - 1) * 10 + m[s.length];\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5c35a80678f3862f2ad41d3090cacb96", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const \u0432\u0432\u043e\u0434=readline().split(\" \").map(a=>+a.trim());let \u0441\u0447\u0435\u0442\u0447\u0438\u043a=0;for(let b,a=1;a<\u0432\u0432\u043e\u0434[1];a*=3){for(b=a;b<\u0432\u0432\u043e\u0434[0];)b*=2;for(let c=b;c<\u0432\u0432\u043e\u0434[1];c*=2)\u0441\u0447\u0435\u0442\u0447\u0438\u043a++}print(0|\u0441\u0447\u0435\u0442\u0447\u0438\u043a);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "92711d9176aa2bca6088b94ad7d1fb10", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function get(x)\n{\n var res = 0;\n for (var i = 1; i <= x; i *= 2)\n for (var j = 1; j * i <= x; j *= 3)\n res++;\n return res;\n}\n\nvar str = readline().split(' ');\nvar l = str[0], str[1];\n\nprint(get(r) - get(l - 1));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ed8e5b4d74c381c27a4da13a9d73677b", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var in = readline().split(\" \");\nvar l = parseInt(in[0]);\nvar r = parseInt(in[1]);\n\nvar ans = 0\n\nfor( i = 1; i <= r; i *= 2)\n for( j = 1; j * i <= r; j *= 3)\n if(i * j >= l){\n ans++\n }\n \nprint(ans)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1c3f9548e3b9ff4c57c1357982ae7fdd", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "const BBOD = readline().split(\" \").map(v => +v.trim());\n\nlet C4ET4uK = 0;\nfor (let TPOE4KA = 1; TPOE4KA < BBOD[1]; TPOE4KA *= 3) {\n\tlet DBA = TPOE4KA;\n\twhile (DBA < BBOD[0]) {\n\t\tDBA *= 2;\n\t}\n\n for (let TEKyLLIuu = DBA; TEKyLLIuu < BBOD[1]; TEKyLLIuu *= 2) {\n C4ET4uK++;\n }\n}\nprint(C4ET4uK|0);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7611b4965b14165f3202b4bbb4dc2f30", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var in = readline().split(' ')\nvar l = parseInt(in[0]);\nvar r = parseInt(in[1])\n\nvar ans = 0\n\nfor( i = 1; i <= r; i *= 2)\n for( j = 1; j * i <= r; j *= 3)\n if(i * j >= l){\n ans++\n }\n \nprint(ans)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d65a0982f84bb991921c7d3983109964", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "const BBOD = readline().split(\" \").map(v => +v.trim());\n\nlet C4ET4uK = 0;\nfor (let TPOE4KA = 1; TPOE4KA < BBOD[1]; TPOE4KA *= 3) {\n\tlet DBA = TPOE4KA;\n\twhile (DBA < BBOD[0]) {\n\t\tDBA *= 2;\n\t}\n\n for (let TEKyLLIuu = DBA; TEKyLLIuu < BBOD[1]; TEKyLLIuu *= 2) {\n C4ET4uK++;\n }\n}\nprint(C4ET4uK|0);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "356c489c25ee9e1fbdb266e3a4190b0f", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "const BBOD=readline().split(\" \").map(a=>+a.trim());let C4ET4uK=0;for(let b,a=1;a 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n }\n alert(n);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "db6696d16c9595c02362f4c445188238", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline();\nprint(input);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "47c86c65cada6adb4bd5180c1ded5cc0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function solve() {\n var input = readline().split(' ').map(Number),\n n = input[0],\n k = input[1];\n for (;k--;) {\n if (n % 10) {\n n--;\n } else {\n n /= 10;\n }\n }\n print(n);\n}\n\nif (typeof readline !== 'function') {\n let input = [],\n i = 0;\n function print() {\n console.log.apply(null, arguments);\n }\n function readline() {\n return input[i++];\n };\n\n const RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n });\n \n RL.on('line', (line) => {\n input.push(line);\n });\n \n RL.on('close', solve);\n} else {\n solve();\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "79e90e218d69cd7948dcc6691414d082", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\t\n\tvar a = readline().split(\"\");\n\twhile(a[1]--)\n\ta[0] = (a[0] % == 0 ) ? a[0] / 10 : a[0] --;\n\tprint (a);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "67374fe6be355458c9afdffbe61da996", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let arr=readline().split(\" \");\n\nfor (let i=0;i<+arr[1];i++)\nconsole.log(arr[1]);\nprint(+arr[0]);\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4354b3a146f29a456344294cffe8ca35", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nfor(let i=0; i < input[1]; i++){\n\tif(input[0] % 10 == 0) \n\t\tinput[0] /= 10\n\telse input[0] -= 1;\n}\n\nprint(input[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "979b151ae0c3bd5c77eb66fa47b499f0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const result = (n, k) => {\n for (let i = k; i >= 0; i--) {\n if (k % 10 === 0) k = k/10;\n else k--;\n }\n return k;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7ed14a9a31c266f85217e69ff34fe1d7", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var num = readline().split(\" \").map(x => parseInt(x));\nvar n,k;\nn=num[0],k=num[1];\n \nlet result = n;\nfor(let i=0; i 0) {\n if (x % 10 == 0) {\n x /= 10;\n } else {\n x--;\n }\n}\n\nconsole.log(x);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4c2c69c5e317092dab60ce0bc0614bb1", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet n = parseInt(input[0]), k = parseInt(input[1]);\nwhile (k > 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n}\nprint(n);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "50a4a2b8f9ce33a5ecfbc622fd2a97a1", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var x = readline().split(' ');\nvar n;\nfor (, x[1] > 0; x[1]--) {\n n = n % 10 ? x[0] - 1 : x[0] / 10;\n}\nprint(n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a51cfc0d2c1256d9a47b7fe24c65b30e", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const wrongSubstractions = (n, k) => {\n res = n;\n const getLastDigit = (d) => {\n last = d%10;\n return +last;\n };\n\n for (i = 0; i < k; i++){\n let lastDigit = getLastDigit(res);\n //if the last digit of the number is non-zero, she decreases the number by one;\n // the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).\n if (lastDigit !== 0) {\n res--;\n } else {\n res = res/10;\n }\n }\n return res;\n};", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c094513da59582dd63fe9a31268ddd12", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function solve() {\n let input = readline().split(' ').map(Number),\n n = input[0],\n k = input[1];\n for (;k--;) {\n if (n % 10) {\n n--;\n } else {\n n /= 10;\n }\n }\n print(n);\n}\n\nsolve();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8e8aa4cbdbc9a7d7434887cc47e22829", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function solve() {\n let input = readline().split(' ').map(Number),\n n = input[0],\n k = input[1];\n for (;k--;) {\n if (n % 10) {\n n--;\n } else {\n n /= 10;\n }\n }\n print(n);\n}\n\nif (typeof readline !== 'function') {\n let input = [],\n i = 0;\n function print() {\n console.log.apply(null, arguments);\n }\n function readline() {\n return input[i++];\n };\n\n const RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n });\n \n RL.on('line', (line) => {\n input.push(line);\n });\n \n RL.on('close', solve);\n} else {\n solve();\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5764c82deef9fd1df4bc7f18f7a6b4cc", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let data = readline().split(' ').map(x => parseInt(x, 10));\nfor (let i = data[1]; i > 0; i--) {\n if(data[0]%10 === 0) data[0] = data[0]/10;\n else data[0]--;\n}\nprint(data[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b8087b82981454e671245daf43eacd87", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "numbers = readLine().split(\"\").map((num) => parseInt(num))\n\nfor(let i = 0; i < num; i++) {\n if (numbers[0] % 10 === 0)\n numbers[0] /= 10;\n else \n numbers[0]--;\n}\nprint(numbers[0])", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c7b2911c9812766ce2955b1aff190d9b", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wrongSubstraction(input) {\n input = input.split(' ');\n let n = parseInt(input[0]), k = parseInt(input[1]);\n while (k > 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n }\n print(n);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "813d61b4c3a6c0678345b6e5ee72c1a8", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function calc(data) {\n const arr = data.split(\" \").map(x => parseInt(x, 10));\n for (let i = arr[1]; i >= 0; i--) {\n if (arr[0] % 10 === 0) arr[0] = arr[0]/10;\n else arr[0]--;\n }\n return arr[0];\n}\n\nvar s1 = readline();\n\nprint(calc(s1));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0c10242a9e96b70a62e25cf0a8bf536d", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const data = readline().split(' ').map(x => parseInt(x, 10));\nfor (let i = data[1]; i > 0; i--) {\n if(data[0]%10 === 0) {\n data[0] = data[0]/10;\n }\n else {\n data[0]--;\n }\n}\nprint(data[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "516b9e7c93bf31eec4dd6cb607336930", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let in = readline().split(' ');\nlet n = parseInt(in[0]), k = parseInt(in[1]);\nwhile (k > 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n}\nprint(n);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "78f898bee2827402b295510c58a41b48", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n = readline().split(\" \");\nwhile(n[1]--)\n (n[0]%10==0)?n[0]/=10:n[0]--;\nprint(n[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1005cc754fcaf48d9d2688e8eac93db9", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function wrongSubstraction(input) {\n input = input.split(' ');\n let n = parseInt(input[0]), k = parseInt(input[1]);\n while (k > 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n }\n console.log(n);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "911a617a7fb1ef43f26ae09d2b4562da", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let arr=readline().split(\" \");\n\nfor (let i=0;i<+arr[1];i++)\narr[0][arr[0].length-1]===0?String(+arr[0]/10):arr[0]=String(+arr[0]-1)\nprint(+arr[0]);\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8ba33a001fa7cb8d73007832f580b986", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n;\nlet k;\nk=readline();\n//print(k);\n//for(let i = 1;i <= k;i++)\n//if(n%10==0){\n// n=n/10\n//}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "218c8dcc024271bfd94777d26fde5ad0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let arr=readline().split(\" \");\n\nfor (let i=0;i+x;\nvar n = inputs[0];\nvar k = inputs[1];\n\n// let n = 1000000000, k = 9;\nfunction subtracte(n,k){\n\n\tfor(var i = 0; i < k; i++){\n\t\tvar last = n%10;\n\t\tif(last === 0){\n\t\t\tn /= 10;\n\t\t}else {\n\t\t\tn -= 1;\n\t\t}\n\t}\n\t// console.log(n);\n\tprint(n);\n}\nsubtracte(n, k);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9aaa57c03a9c1bf43170d58d96f19fd9", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(\" \")\nvar n = numbers[0]\nvar k = numbers[1]\n\nfor(var i=0; i 0)\n\t\t{\n\t\t\tn -= 1;\n\t\t}else{\n\t\t\tn /= 10;\n\t\t}\n\t}\n\treturn n;\n}\n\nrl.on('line', (line) => {\n\tnrs = line.split(' ');\n}).on('close', () => {\n\tconsole.log(wrongsubstraction(nrs[0],nrs[1]));\n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "af0af77be48d8da39fdfd84021d2a83f", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "x = readline().split(' ')\nfor (, x[1] > 0; x[1]--) {\n n = n % 10 ? x[0] - 1 : x[0] / 10\n}\nprint(n)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bf8bad5029c6844143866720ce3b79cb", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let arr=readline().split(\" \");\n\nfor (let i=0;i 0) {\n if ((n % 10) == 0) {\n n = n / 10;\n } else {\n n--;\n }\n k--\n}\noutput n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0f1762e0aee746fed8a15d1b000d36ac", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline().split(' ')[0];\nvar k = readline().split(' ')[1];\n\nfunction(a, b) {\n var result = a;\n for(var i = 0; i < b; i++) {\n if (!(a / 10).isInteger()) result = result / 10\n else result--\n }\n print(result);\n}(n,k);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bab105334f5c9e6c42afeaf9f40e2ce1", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n = readline().split(' ');\nk = n[0];\nx = n[1];\nfor (var i=0 ; i Number(x));\nlet i = data[1];\nfor (i; i > 0; i--) {\n if(data[0]%10 === 0) data[0] = data[0]/10;\n else data[0]--;\n}\nprint(data[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cbdb927b9debd6cf9bb67c6419bf0258", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(\" \").map(x => +x);\nfor(let i = 0; i < numbers[1]; i++)\n{\n if(numbers[0] % 10 !== 0)\n {\n numbers[0]--;\n }else{\n numbers[0] = numbers[0]/10\n } \n}\nprint(numbers[0])", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d6eab015803f31df950dc1eb32d4ea17", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n = 512\nk = 4\nwhile k > 0\n if (n % 10 == 0) {\n n = n / 10\n } else n--\n k--\noutput n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "383b04e8909d7519584e90e7b3d4c75d", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nfor(let i=0; i < input[1]; i++){\n\tif(input[0] % 10 == 0) \n\t\tinput[0] /= 10;\n\telse input[0] -= 1;\n}\n\nconsole.log(input[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ed8ee0ba24870ed4e9eff1189b2dccb0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const data = readline().split(' ').map((x) => (parseInt(x, 10)));\nfor (let i = data[1]; i > 0; i--) {\n if(data[0]%10 === 0) data[0] = data[0]/10;\n else data[0]--;\n}\nprint(data[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "77935593b2951728909624198ab65d32", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var toInt = x =>(parseInt(x));\nvar {a, b} = readline().split(' ').map(toInt);\nprint(a - b);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0492bfbb3f5b2c17cfbf2002f2a4a96d", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function subByOne(n,k){\n let result = n;\n for(let i=0; i parseInt(x));\nvar n,k;\nn=num[0],k=num[1];\nprint(subByOne(n,k));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c323e89a7838798771d8e71101e24ba8", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n;\nlet k=1;\n//k=readline();\nconsole.log(k);\n//for(let i = 1;i <= k;i++)\n//if(n%10==0){\n// n=n/10\n//}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d5344f14c33dda3a2c6b92e4f0ea1bff", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n;\nlet k=1;\n//k=readline();\nprint(k);\n//for(let i = 1;i <= k;i++)\n//if(n%10==0){\n// n=n/10\n//}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f0b5ced8d38636f0aa7975f675ec2ec0", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let arr=readline().split(\" \");\n\nfor (let i=0;i<+arr[1];i++)\narr[0][arr[0].length-1]===0?(+arr[0]/10).toString():(arr[0]=+arr[0]-1).toString()\nprint(+arr[0]);\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b5d50435c4aed994abc3daff7863fbba", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let n;\nlet k;\nlet input=readline().split(' ');\nn=parseInt(input[0]);\nk=parseInt(input[1]);\nconsole.log(k);\nfor(let i = 1;i <= k;i++){\n if(n%10==0){\n n=n/10;\n } \n if(n%10!=0){\n n=n-1;\n }\n}\nprint(n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fdeafbf655e3fa5ba5eee07bd539112a", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let input = readline().split(\" \");\nlet n = parseInt(input[0]);\nlet k = parseInt(input[1]);\nwhile (k > 0) {\n if (n.toString()[n.toString().length - 1] === '0') n = Math.floor(n / 10);\n else n--;\n k--;\n}\nprint(n);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f4289cb5797d1d3ac7e3387645ef48ce", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let input = 1000000000\nlet times = 9\nexport default function decrease(num, times) {\n let numStr = num.toString()\n for (let i=0; i {\n res = n;\n const getLastDigit = (d) => {\n last = d%10;\n return +last;\n };\n\n for (i = 0; i < k; i++){\n let lastDigit = getLastDigit(res);\n //if the last digit of the number is non-zero, she decreases the number by one;\n // the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).\n if (lastDigit !== 0) {\n res--;\n } else {\n res = res/10;\n }\n }\n return res;\n};", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4513c237851bc741bec2aa508d9cdbb8", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let [n, k] = readline().split(' ');\nfor (let i = 0; i < k; i++) {\n if (n % 10) {\n n--;\n }\n else {\n n /= 10;\n }\n}\nconsole.log(n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a30defd4271ac15fe102334dfd4f6b45", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let data = readline().split(' ').map(x => Number(x));\nfor (let i = data[1]; i > 0; i--) {\n if(data[0]%10 === 0) data[0] = data[0]/10;\n else data[0]--;\n}\nprint(data[0]);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6d97f72517309c7a6501c18cc6f5facc", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function subByOne(n,k){\n let result = n;\n for(let i=0; i i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n const k = lines[0];\n const arr = lines.slice(1.lines.length - 1);\n\n console.log(arr);\n\n \tfunction subseqs(arr, k) {\n\t const n = arr.length;\n\t const res = [];\n\t let j = 0;\n\n\t for (let mask = 0; mask < (1 << n); mask++) {\n\t let num = 0;\n\n\t for (let i = 0; i < n; i++) {\n\t if (mask & (1 << i)) {\n\t num++;\n\t }\n\t }\n\n\t if (num === k) {\n\t res[j] = [0, 0]\n\n\t for (let i = 0; i < n; i++) {\n\t if (mask & (1 << i)) {\n\t res[j][0] += arr[i]\n\t } else {\n\t res[j][1] += arr[i];\n\t }\n\t }\n\n\t j++;\n\t }\n\t }\n\n\t return res;\n\t}\n\n\tfor (let i = 1; i < arr.length; i++) {\n\t subseqs(arr, i).map(ss => console.log(ss[0] == ss[1] ? \"YES\" : \"NO\"));\n\t}\n});\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "16056e6690ef9fb356c9209d39f39305", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "let s = readLine().replace(/WUB/g, ' ').trim().replace(/[ ]+/, ' ');\nprint(s)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0c8ea935b594ff48d0047ad28255c2e3", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let s = readline().replace(/WUB/g, ' ').trim().replace(/[ ]+/, ' ');\nprint(s)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ad47c201ec082f6aaa6ee6b22983dc3d", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a95841789bb9ce8991bddd7dcbdcde5b", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "let str1=\"\",str2=\"\",i=0,res=\"\";\n\nstr1 = readline();\nstr2 = readline();\n\nstr1 = [...str1];\nstr2 = [...str2];\n\nstr1.forEach(el=>{\n res += el ^ str2[i];\n i++;\n})\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "35289d8dca3337dd00c8eeaa1fa35e41", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var r = readline();\nvar s = readline();\nvar sum = 0;\nvar result = \"\";\nfor(var i = 0 ;; i++){\n\tsum += i;\n\tif(sum >= s.length){\n\t\tbreak;\n\t}\n result + = s.charAt(sum);\n}\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0a7fef7eae4f0e9cda938a5fadc3df4c", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function enc() {\t\n\tvar a = readLine();\n\tvar r = readLine().split(\"\");\n\tvar x = \"\"\n\tvar n = 1;\n\tfor (var i = 0; n < parseInt(a); i++) {\n\t\tn += i;\n\t\tif (r[n-1] != undefined) {\n\t\t\tx += r[n-1];\n\t\t}\n\t}\n\tprint(x);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e19a0410c513759bce1ab525a0425ed2", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline());\nvar b = readline();\nvar array = [];\nvar count = 0;\nfunction main() {\n\n\tfor (let i = 0; i < b.length; i++) {\n\t\tif (b[i] == 'B') {\n\t\t\tcount++;\n\t\t}\n\t\tif (b[i] == 'W') {\n\t\t\tif (count != 0)\n\t\t\t\tarray.push(count);\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif (count != 0) {\n\t\tarray.push(count);\n\t}\n\tprint(array.length);\n\tif (array.length != 0)\n\t\tprint(array);\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cdc2db906aff0137135aee18a52acc1f", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline());\nvar b = readline();\n\tvar array = [];\n\tvar count = 0;\n\tfor(let i = 0; i < b.length; i++) {\n\t\tif(b[i] == 'B'){\n\t\t\tcount++;\n\t\t}\n\t\tif(b[i] == 'W'){\n\t\t\tif(count != 0)\n\t\t\tarray.push(count);\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif(count != 0) {\n\t\tarray.push(count);\n\t}\n\tprint(array.length);\n\tif(array.length != 0)\n\t\tprint(array);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "18dc21f41c23657b68f9cc10dda0e535", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline()),\nvar b = readline(),\nvar array = [],\nvar count = 0,\n\n\tfor (let i = 0; i < b.length; i++) {\n\t\tif (b[i] == 'B') {\n\t\t\tcount++\n\t\t}\n\t\tif (b[i] == 'W') {\n\t\t\tif (count != 0)\n\t\t\t\tarray.push(count)\n\t\t\tcount = 0\n\t\t}\n\t}\n\tif (count != 0) {\n\t\tarray.push(count)\n\t}\n\tprint(array.length)\n\tif (array.length != 0) {\n\t\tprint(array.join(' '))\n\t}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "911a4591f85cfd95ed7c15c01bb7f79d", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n\tvar a = parseInt(readline());\n\tvar b = readline();\n\tvar array = [];\n\tvar count = 0;\n\tfor (let i = 0; i < b.length; i++) {\n\t\tif (b[i] == 'B') {\n\t\t\tcount++;\n\t\t}\n\t\tif (b[i] == 'W') {\n\t\t\tif (count != 0)\n\t\t\t\tarray.push(count);\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif (count != 0) {\n\t\tarray.push(count);\n\t}\n\tprint(array.length);\n\tif (array.length != 0)\n\t\tprint(array);\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fc2e9dd0b3f7fe06303e77025596ad32", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline());\nvar b = readline();\nvar array = [];\nvar count = 0;\nfunction main() {\n\n\tfor (let i = 0; i < b.length; i++) {\n\t\tif (b[i] == 'B') {\n\t\t\tcount++;\n\t\t}\n\t\tif (b[i] == 'W') {\n\t\t\tif (count != 0)\n\t\t\t\tarray.push(count);\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif (count != 0) {\n\t\tarray.push(count);\n\t}\n\tprint(array.length);\n\tif (array.length != 0) {\n\t\tfor(i in array)\n\t\tprint(array[i]);\n\t}\n\n\n\treturn 0;\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1ed3518464e32a58257b2a902702d5a8", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline());\nvar b = readline();\nvar array = [];\nvar count = 0;\nfunction main() {\n\n\tfor (let i = 0; i < b.length; i++) {\n\t\tif (b[i] == 'B') {\n\t\t\tcount++;\n\t\t}\n\t\tif (b[i] == 'W') {\n\t\t\tif (count != 0)\n\t\t\t\tarray.push(count);\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tif (count != 0) {\n\t\tarray.push(count);\n\t}\n\tprint(array.length);\n\tif (array.length != 0)\n\t\tprint(array);\n\treturn 0;\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ebbfbd5f1895378f1046ac87aca67670", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar res=0;\n\nfor (var i=0; i readline().split(' ')\nconst readInts = () => read().map(parseInt)\n\nconst [x] = readInts()\n\nprint(Math.ceil(x / 5))\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a7d26b8cbdba8cf0e484c88d9962758c", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let a = Number(+readLine());\nif(a % 2 === 0){\n print((a / 2) ** 2);\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "358168edb107fb6a91e9f99e1575dea7", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = +readline();\nif(a % 2 === 0){\n print(Math.pow(a/2, 2));\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0edc01633e6d63c643fdc6cb41357015", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = Number(readLine());\nif(a % 2 === 0){\n print((a / 2) ** 2);\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6610ca8d557c772240ced5c19dc037d5", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = +readLine()\nif(a % 2 === 0){\n print(Math.pow(a/2, 2));\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9f264a186fd049ce46c2205f6d33abea", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = +readline()\nif(a % 2 === 0){\n print(Math.pow(a/2, 2));\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a6c1c84bd7ec798a7c2befc5926f1764", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = +readline()\nif(a % 2 === 0){\n print(Math.pow(a/2, 2));\n}\nelse{\n print(0 );\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "44f8db13ae364fb5066e0a01bc2ddf82", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = Number(readLine());\nif(a % 2 === 0){\n print((a / 2) ** 2);\n}\nelse{\n print(0);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "409789c946633b6a6aa00031d586c1b4", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let data = readline().split(\" \");\n \nlet a = parseInt(data[0]), b = parseInt(data[1]), c = parseInt(data[2]), d = parseInt(data[3]);\n \nfor(let i = 0; i < 2; ++ i) {\n for(let j = 0; j < 2; ++ j) {\n for(let e = 0; e < 2; ++ e) {\n for(let k = 0; k < 2; ++ k) {\n let A = i * a + j * b + e * c + k * d;\n let B = (i^1) * a + (j^1) * b + (e^1) * c + (k^1) * d;\n if(A == B) {\n print(\"YES\");\n }\n }\n }\n }\n}\nprint(\"NO\")", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2d4eeb2396f79327df7aa88c8f5dc704", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var n = parseInt(readline());\n var uno = n[0];\n var dos = n[1];\n var tres = n[2];\n var cuatro = n[3];\n var a=uno+dos;\n var b=tres+cuatro;\n var c=uno+tres;\n var d= dos+cuatro;\n var e=dos+tres+cuatro;\n var f=uno+tres+cuatro;\n var g=uno+dos+cuatro;\n var h=uno+dos+tres;\n print uno;\n print a;\n if (a == b){\n print (\"YES\");\n }\n else if(c==d ){\n print(\"YES\");\n }\n else if(uno==e){\n print(\"YES\");\n }\n else if(dos==f){\n print(\"YES\");\n }\n else if(tres==g){\n print(\"YES\");\n }\n else if(cuatro==h){\n print(\"YES\");\n }\n else{\n print(\"NO\");\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "03ab39f7614f5dd033eed5dcb61a20fd", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let data = readline().split(\" \");\n \nvar a = parseInt(data[0]), b = parseInt(data[1]), c = parseInt(data[2]), d = parseInt(data[3]);\n\nmain : for(let i = 0; i < 2; ++ i) {\n for(let j = 0; j < 2; ++ j) {\n for(let e = 0; e < 2; ++ e) {\n for(let k = 0; k < 2; ++ k) {\n let A = i * a + j * b + e * c + k * d;\n let B = (i^1) * a + (j^1) * b + (e^1) * c + (k^1) * d;\n if(A == B) {\n print(\"YES\");\n break main;\n }\n }\n }\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e760f18906872dbdda14cb2a081eeaf4", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(\" \");\nvar count = 0;\nfor(let i=1; i currentLength) {\n\t\tminLength = currentLength;\n\t}\n\n\tcurrentLength = 1;\n\tcurrentColor = data[i];\n}\n\nprint(minLength - 1);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "288a15ac3915c233cfb1bb984f267897", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "minLength = parseInt(readline());\ndata = readline().split('');\ncurrentLength = 1;\ncurrentColor = data.pop();\n\n\nfor (let i = data.length; i--;) {\n\tif (data[i] === currentColor) {\n\t\tcurrentLength++;\n\t\tcontinue;\n\t}\n\n\tif (minLength > currentLength) {\n\t\tminLength = currentLength;\n\t}\n\n\tcurrentLength = 1;\n\tcurrentColor = data[i];\n}\n\nprint(minLength - 1);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "20dac7a35b6fad395741f16c3c3ee9d1", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar stones = readline().split('');\nvar prev = stones[0];\nvar res = 0;\nfor(let i = 1; i < n; ++i){\n if(stones[i] === stones[i - 1]) ++res;\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a2d42575e8056d0775ea8dbc30ad3c17", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "input = readline().split(' ');\n\nminLength = parseInt(input[0]);\ndata = input[1].split('');\ncurrentLength = 1;\ncurrentColor = data.pop();\n\nprint(minLength + data);\n\nfor (let i = data.length; i--;) {\n\tif (data[i] === currentColor) {\n\t\tcurrentLength++;\n\t\tcontinue;\n\t}\n\n\tif (minLength > currentLength) {\n\t\tminLength = currentLength;\n\t}\n\n\tcurrentLength = 1;\n\tcurrentColor = data[i];\n}\n\nprint(minLength - 1);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a6262807b49e1762eb3fda626df13c33", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [n,m] = readLine().split(' ').map(a=>parseInt(a));\n var count = 0;\n var target = n+m;\n for(var i = 0;i<=n+m;i++){\n for(var j = 0;j<=n+m;j++){\n if(i^2+j == n && j^2+i == m){\n count++\n }\n }\n }\n print(count);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4b3c7bacac0c2809bd79210fd8c6a59a", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function processData(input) {\n //Enter your code here\n var [n,m] = input.split(' ').map(a=>parseInt(a))\n var count = 0\n var target = n+m\n for(var i = 0;i<=n+m;i++){\n for(var j = 0;j<=n+m;j++){\n if(i**2+j == n && j**2+i == m){\n count++\n }\n }\n }\n console.log(count)\n} \n \nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"ascii\");\n_input = \"\";\nprocess.stdin.on(\"data\", function (input) {\n _input += input;\n});\n \nprocess.stdin.on(\"end\", function () {\n processData(_input);\n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "198b4b16d86c576571dd1cd3e564b82d", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": " var [n,m] = readLine().split(' ').map(a=>parseInt(a))\n var count = 0\n var target = n+m\n for(var i = 0;i<=n+m;i++){\n for(var j = 0;j<=n+m;j++){\n if(i**2+j == n && j**2+i == m){\n count++\n }\n }\n }\n print(count)\n} ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "97ea5cc614b45091665bcf74cded99bd", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let print = require('lol-io').print;\nlet readline = require('lol-io').readline;\n\nfunction calc(input) {\n var o = 0, _ = 0;\n for (i = 0; i < input.length; i++) {\n if (input.charAt(i) === 'o')\n o++;\n else\n _++;\n }\n return (_ === 0) || (_ % o === 0 && o > 0);\n}\n\n\nwhile ((x = readline()) && x !== 'undefined')\n console.log(calc(x) ? 'YES' : 'NO');\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7c29d09dd054a704f1f8edb8b08f206a", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function calculateBillCount(n)\n{\n\tlet billCount = 0;\n\t\n\tbillCount += n \\ 100;\n\tn = n % 100;\n\t\n\tbillCount += n \\ 20;\n\tn = n % 20;\n\t\n\tbillCount += n \\ 10;\n\tn = n % 10;\n\t\n\tbillCount += n \\ 5;\n\tn = n % 5;\n\t\n\tbillCount += n \\ 1;\n\tn = n % 1;\n\t\n\treturn billCount;\n}\n\nconst numbers = readline().split(\" \")\nconst n = +numbers[0];\n\nprint(calculateBillCount(n))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5a18745e007dea0162cada97899c144e", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = readline();\nconst input = parseInt(readline);\nlet countingInput = 0;\nlet answer = 0;\nconst countAnswer = (input) => {\n countingInput = input;\n if (countingInput >= 100) {\n do {\n countingInput -= 100;\n answer += 1;\n } while (countingInput >= 100);\n }\n if (countingInput >= 20) {\n do {\n countingInput -= 20;\n answer += 1;\n } while (countingInput >= 20);\n }\n if (countingInput >= 10) {\n do {\n countingInput -= 10;\n answer += 1;\n } while (countingInput >= 10);\n }\n if (countingInput >= 5) {\n do {\n countingInput -= 5;\n answer += 1;\n } while (countingInput >= 5);\n }\n if (countingInput >= 1) {\n do {\n countingInput -= 1;\n answer += 1;\n } while (countingInput >= 1);\n }\n\n return answer;\n};\ncountAnswer(input);\n\nprint(answer);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b9dfbf7f3cc7bf6450a216f227c3547b", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let initialValue = 125;\nlet n100 = 0;\nlet n20 = 0;\nlet n10 = 0;\nlet n5 = 0;\nlet n1 = 0;\n\nif (initialValue >= 100) {\n n100 = initialValue / 100;\n initialValue = initialValue - Math.floor(n100) * 100;\n}\nif (initialValue >= 20) {\n n20 = initialValue / 20;\n initialValue = initialValue - Math.floor(n20) * 20;\n}\nif (initialValue >= 10) {\n n10 = initialValue / 10;\n initialValue = initialValue - Math.floor(n10) * 10;\n}\nif (initialValue >= 5) {\n n5 = initialValue / 5;\n initialValue = initialValue - Math.floor(n5) * 5;\n}\nif (initialValue >= 1) {\n n1 = initialValue / 1;\n initialValue = initialValue - Math.floor(n1) * 1;\n}\n\nconst result =\n Math.floor(n100) +\n Math.floor(n20) +\n Math.floor(n10) +\n Math.floor(n5) +\n Math.floor(n1);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "961ce5be48835824467c966e550bd706", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const num = readline().split(' ').map(n => parseInt(n));\nconst n = num[0];\n\nconst getBills = (bill, n) => (Math.floor(n / bill)) ? Math.floor(n / bill) : 0;\n\nconst bills = [100, 20, 10, 5, 1];\n\nlet result = 0;\nlet tempN = n;\n\nfor (let i = 0; i <5; i++) {\n const chlen = getBills(bills[i], tempN);\n result += chlen;\n if (chlen) {\n tempN -= bills[i] * chlen;\n }\n}\n\nconsole.log(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d786a9ea791b2653b8df381fe8b2ea42", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nprint( getSum(line[0]) );\nfunction getSum(number){\n let sum = 0;\n while (number >= 1) {\n number -= (num >= 100) ? 100 :\n (num >= 20) ? 20 :\n (num >= 10) ? 10 :\n (num >= 5) ? 5 :\n 1;\n sum++;\n }\n return sum;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7cdcb1905a45b96dc76d1cfa93b461dc", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const num = readline();\nconst n = parseInt(num);\n\nconst getBills = (bill, n) => (Math.floor(n / bill)) ? Math.floor(n / bill) : 0;\n\nconst bills = [100, 20, 10, 5, 1];\n\nlet result = 0;\nlet tempN = n;\n\nfor (let i = 0; i <5; i++) {\n const chlen = getBills(bills[i], tempN);\n result += chlen;\n if (chlen) {\n tempN -= bills[i] * chlen;\n }\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "85e21ed3a58e1e879bf3b4f85b2f8301", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let x = Number(readline());\nfunction getSum(number){\n if (number == 1) return 1;\n if (number >= 100) {\n return 1 + getSum(number - 100);\n } else if (number >= 20) {\n return 1 + getSum(number - 20);\n } else if (number >= 20) {\n return 1 + getSum(number - 20);\n } else if (number >= 20) {\n return 1 + getSum(number - 20);\n } else {\n return 1 + getSum(number - 1);\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8b1dd5f55091bb515cd8773988765ca1", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function calculateBillCount(n)\n{\n\tvar billCount = 0;\n\t\n\tbillCount += n \\ 100;\n\tn = n % 100;\n\t\n\tbillCount += n \\ 20;\n\tn = n % 20;\n\t\n\tbillCount += n \\ 10;\n\tn = n % 10;\n\t\n\tbillCount += n \\ 5;\n\tn = n % 5;\n\t\n\tbillCount += n \\ 1;\n\tn = n % 1;\n\t\n\treturn billCount;\n}\n\nvar numbers = readline().split(\" \")\nvar n = +numbers[0];\n\nprint(calculateBillCount(n))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "90546a3ab76aba28fe96373a96c946a5", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const num = readline();\nconst n = parseInt(num);\n\nconst getBills = (bill, n) => (Math.floor(n / bill)) ? Math.floor(n / bill) : 0;\n\nconst bills = [100, 20, 10, 5, 1];\n\nlet result = 0;\nlet tempN = n;\n\nfor (let i = 0; i <5; i++) {\n const chlen = getBills(bills[i], tempN);\n result += chlen;\n if (chlen) {\n tempN -= bills[i] * chlen;\n }\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "928c254714a71ffd2f7d754b0b3a237e", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = readline();\nconst input = parseInt(readline);\nlet countingInput = 0;\nlet answer = 0;\nconst countAnswer = (input) => {\n countingInput = input;\n if (countingInput >= 100) {\n do {\n countingInput -= 100;\n answer += 1;\n } while (countingInput >= 100);\n }\n if (countingInput >= 20) {\n do {\n countingInput -= 20;\n answer += 1;\n } while (countingInput >= 20);\n }\n if (countingInput >= 10) {\n do {\n countingInput -= 10;\n answer += 1;\n } while (countingInput >= 10);\n }\n if (countingInput >= 5) {\n do {\n countingInput -= 5;\n answer += 1;\n } while (countingInput >= 5);\n }\n if (countingInput >= 1) {\n do {\n countingInput -= 1;\n answer += 1;\n } while (countingInput >= 1);\n }\n\n return answer;\n};\ncountAnswer(input);\n\nprint(answer);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "99762ee0e3bb66ca7dbc2908e44f24f8", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nconst set = new Set(numbers);\n\nlet result = set.size();\n\nif (set.has(0)) {\n result -= 1;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1a5deb6595a638ddbcfbe9fe83481ab4", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var r = readline();\n//sorting the array in an ascending order\nvar puzzles_pieces = readline().split(\" \").sort(function(a, b){return a-b});\n//var modified = puzzles_pieces;\nvar modified = puzzles_pieces.filter(function(a,b){a==b return puzzles_pieces.remove(b)})\n// for(i = 0; i < puzzles_pieces; i++){\n// \tif(puzzles_pieces[i] === puzzles_pieces[i+1]){\n// \t\tmodified = puzzles_pieces.remove(puzzles_pieces[i])\n// \t}\n// }\nvar minDiff = modified[1] - modified[0];\nfor(i = 2; i < modified.length; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\tminDiff = Math.min(minDiff, modified[i]-modified[i-1]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0d9dbf8671b8f1e4b08245361f15a1a9", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline();\n\nvar puzzles_pieces = +readline();\n//sorting the array in an ascending order\nvar sorted = puzzles_pieces.sort(function(a,b){return a-b});\n\nvar new_sorted = sorted.map(function(a,b){a===b return sorted.remove(b)})\n\n\nvar minDiff = new_sorted[1] - new_sorted[0];\nfor(i = 2; i < sorted.length; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\tminDiff = Math.min(minDiff, a[i]-a[i-1]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c5b3ec15588bada4320de5112ec4f8f2", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline().split(\" \");\nvar students = +r[0] - 1;\nvar puzzles = +r[1];\n\n//sorting the array in an ascending order\nvar puzzles_pieces = readline().split(\" \").map(function(v){return+v;});\npuzzles_pieces.sort(function(a, b){return a-b;});\n// var removeItem = function(array){array.filter(function(array){for(i = 0; i < array.length; i++){\n// \tvar modified = Math.abs(array[i] - array[i+1]) > 0;\t\n// }return modified;})};\n// for(i = 0; i < puzzles_pieces.length; i++){\n// \tif(puzzles_pieces[i] == puzzles_pieces[i+1]){\n// \t\tpuzzles_pieces.remove(puzzles_pieces.puzzles_pieces[i]);\n// \t}\n// }\n\n// var modified = [];\n//var modified = puzzles_pieces;\n// var removeItem = function(array,value){ //my clear function\n// if(Array.isArray(array)){ //for multi remove\n// \t for(var i = 0; i < array.length; i++) {\n// \tif(array[i] === array[i+1]) {\n// \t\tarray.splice(i, 1);\n// }\t\n// }\n\n// for(i = 0; i < puzzles_pieces.length; i++){\n// \tif(puzzles_pieces[i] == puzzles_pieces[i+1]){\n\t\t\n// \t}\n// }\n\nvar minDiff = 3v8;\nfor(i = 0; i < puzzles - students; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\t\n\tminDiff = Math.min(minDiff, puzzles_pieces[i+students]-puzzles_pieces[i]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6c1e2ff64be98d5ce5fbe087d14e78c8", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline();\n//sorting the array in an ascending order\nvar puzzles_pieces = readline().split(\" \").sort(function(a, b){return a-b});\n// var modified = [];\n// puzzles_pieces = puzzles_pieces.filter(function(a,b){a==b return puzzles_pieces.remove(b)})\nvar removeItem = function(array,value){ //my clear function\n if(Array.isArray(array)){ //for multi remove\n for(var i = 0; i < array.length; i++) {\n for(var j = 0; j < array.length; j++) {\n if(array[i] === value[j]) {\n array.splice(i, 1);\n };\n }\n }\n\nfor(i = 0; i < puzzles_pieces; i++){\n\tif(puzzles_pieces[i] == puzzles_pieces[i+1]){\n\t\tremoveItem(puzzles_pieces, puzzles_pieces[i]);\n\t}\n}\n\nvar minDiff = puzzles_pieces[1] - puzzles_pieces[0];\nfor(i = 2; i < puzzles_pieces.length; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\tminDiff = Math.min(minDiff, puzzles_pieces[i]-puzzles_pieces[i-1]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "565c565cb7e401d890dcf0b450b60b39", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline();\n//sorting the array in an ascending order\nvar puzzles_pieces = readline().split(\" \").sort(function(a, b){return a-b});\nvar modified = [];\n// puzzles_pieces = puzzles_pieces.filter(function(a,b){a==b return puzzles_pieces.remove(b)})\nvar removeItem = function(array,value){ //my clear function\n if(Array.isArray(array)){ //for multi remove\n \t for(var i = 0; i < array.length; i++) {\n \tif(array[i] === array[i+1]) {\n \t\tarray.splice(i, 1);\n }\t\n }\n\nfor(i = 0; i < puzzles_pieces.length; i++){\n\tif(puzzles_pieces[i] == puzzles_pieces[i+1]){\n\t\tmodified.push(removeItem(puzzles_pieces, puzzles_pieces[i]));\n\t}\n}\n\nvar minDiff = modified[1] - modified[0];\nfor(i = 2; i < modified.length; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\tminDiff = Math.min(minDiff, modified[i]-modified[i-1]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bfb316f6cde25fa187aead504f40a00b", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main() {\n const n = Number(process.argv[2]);\n const m = Number(process.argv[3]);\n const array = [];\n for (let i = 4; i < process.argv.length; i++) {\n array.push(Number(process.argv[i]));\n }\n const sorted = mergesort(array);\n let minDistance = sorted[n-1] - sorted[0];\n let i = 1;\n while (n+i-1 < m) {\n if(sorted[n+i-1] - sorted[i] < minDistance) {\n minDistance = sorted[n+i-1] - sorted[i];\n }\n i++;\n }\n return minDistance;\n}\n\nfunction merge(left, right) {\n const result = [];\n let i = 0;\n let j = 0;\n while(i < left.length && j < right.length) {\n if (left[i] < right[j]) {\n result.push(left[i]);\n i++;\n } else {\n result.push(right[j]);\n j++;\n }\n }\n while(j < right.length) {\n result.push(right[j]);\n j++;\n }\n while(i < left.length) {\n result.push(left[i]);\n i++;\n }\n return result;\n}\n\nfunction mergesort(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n let a = arr.slice(0, arr.length/2);\n let b = arr.slice(arr.length/2, arr.length);\n const left = mergesort(a);\n const right = mergesort(b);\n const result = merge(left, right);\n return result;\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c06b305df5643478b91a6da50b54ea16", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var r = readline();\n//sorting the array in an ascending order\nvar puzzles_pieces = readline().split(\" \").sort(function(a, b){return a-b}).filter(function(a,b){Math.abs(a-b) == 0 return remove(a)});\n// var modified = [];\n//var modified = puzzles_pieces;\n// var removeItem = function(array,value){ //my clear function\n// if(Array.isArray(array)){ //for multi remove\n// \t for(var i = 0; i < array.length; i++) {\n// \tif(array[i] === array[i+1]) {\n// \t\tarray.splice(i, 1);\n// }\t\n// }\n\n// for(i = 0; i < puzzles_pieces.length; i++){\n// \tif(puzzles_pieces[i] == puzzles_pieces[i+1]){\n\t\t\n// \t}\n// }\n\nvar minDiff = puzzles_pieces[1] - puzzles_pieces[0];\nfor(i = 2; i < puzzles_pieces.length; i++){\n\t//using the comparsion Math.min() offers with fixed value \n\t//while iterating on the remaining portion of the array\n\t//to achieve the minimum difference needed.\n\tminDiff = Math.min(minDiff, puzzles_pieces[i]-puzzles_pieces[i-1]);\n}\nprint(minDiff);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5cfce59c3f56687076149055d05fec82", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function merge(left, right) {\n const result = [];\n let i = 0;\n let j = 0;\n while(i < left.length && j < right.length) {\n if (left[i] < right[j]) {\n result.push(left[i]);\n i++;\n } else {\n result.push(right[j]);\n j++;\n }\n }\n while(j < right.length) {\n result.push(right[j]);\n j++;\n }\n while(i < left.length) {\n result.push(left[i]);\n i++;\n }\n return result;\n}\n\nfunction mergesort(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n let a = arr.slice(0, arr.length/2);\n let b = arr.slice(arr.length/2, arr.length);\n const left = mergesort(a);\n const right = mergesort(b);\n const result = merge(left, right);\n return result;\n}\n\nfunction main() {\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n const n = Number(numbers[0]);\n const m = Number(numbers[1]);\n const sorted = mergesort(readline().split(\" \").map(function(x) { return parseInt(x); }));\n let minDistance = sorted[n-1] - sorted[0];\n let i = 1;\n while (n+i-1 < m) {\n if(sorted[n+i-1] - sorted[i] < minDistance) {\n minDistance = sorted[n+i-1] - sorted[i];\n }\n i++;\n }\n console.log(minDistance); \n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e701fe601bed708a0bd3468a52cd1c33", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function merge(left, right) {\n const result = [];\n let i = 0;\n let j = 0;\n while(i < left.length && j < right.length) {\n if (left[i] < right[j]) {\n result.push(left[i]);\n i++;\n } else {\n result.push(right[j]);\n j++;\n }\n }\n while(j < right.length) {\n result.push(right[j]);\n j++;\n }\n while(i < left.length) {\n result.push(left[i]);\n i++;\n }\n return result;\n}\n\nfunction mergesort(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n let a = arr.slice(0, arr.length/2);\n let b = arr.slice(arr.length/2, arr.length);\n const left = mergesort(a);\n const right = mergesort(b);\n const result = merge(left, right);\n return result;\n}\n\nfunction main() {\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n const n = Number(numbers[0]);\n const m = Number(numbers[1]);\n const sorted = mergesort(readline().split(\" \").map(function(x) { return parseInt(x); }));\n let minDistance = sorted[n-1] - sorted[0];\n let i = 1;\n while (n+i-1 < m) {\n if(sorted[n+i-1] - sorted[i] < minDistance) {\n minDistance = sorted[n+i-1] - sorted[i];\n }\n i++;\n }\n return minDistance;\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cc859a772b9ca0cb075b6f90e66de382", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var a = nextline();\nvar b = nextline();\nvar c = nextline();\nvar arr = new array [26];\nfor(var i=0;i<26;i++){\n arr[i]=0;\n}\nfor(var i = 0;i<26,i++){\n arr[c.charCodeAt(i)-'A'.charCodeAt(0)]++;\n}\nfor(var i = 0;i<26,i++){\n arr[b.charCodeAt(i)-'A'.charCodeAt(0)]--;\n}\nfor(var i = 0;i<26,i++){\n arr[a.charCodeAt(i)-'A'.charCodeAt(0)]--;\n}\nfor(var i = 0; i<26;i++){\n if(arr[i]!=0){\n print(\"NO\");\n return;\n }\n}\nprint (\"YES\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "604c3083794f5ef628440ef44f54380a", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+([][[]]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([![]]+[][[]])[+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+[+!+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(+(+!+[]+[+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+!+[]])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+!+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+[+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([![]]+[][[]])[+!+[]+[+[]]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+([![]]+[][[]])[+!+[]+[+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(+(+!+[]+[+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+!+[]])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(![]+[])[+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+!+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[!+[]+!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(![]+[])[+!+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[+!+[]]+[+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+[]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(![]+[])[!+[]+!+[]+!+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(![]+[])[+!+[]]+(+((+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[+[]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]])+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(![]+[+![]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]]+[+!+[]]+[+[]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]))()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(!![]+[])[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+[+!+[]]+[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+!+[]]]+(+((+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[+[]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]])+[])[!+[]+!+[]]+(+((+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[+[]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]])+[])[!+[]+!+[]]+(![]+[])[+[]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]))()\n[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]])+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "50e44c0841ccb746c619cd443cc96700", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "#include\ntypedef long long int ll;\nusing namespace std;\nint main()\n{\n ll i,j,k;\n string s;\n bool flag=true;\n\n cin>>s;\n for(i=0;i r.includes(i) ? r : [ ...r, i ], []).sort((a, b) => a - b);\nconst ribbon = (n, l) => {\n if (n === 0) return 0;\n if (n < 0) return false;\n for (let i = 0; i < l.length; i++) {\n const x = ribbon(n - l[i], l);\n if (typeof x === 'number') return 1 + x;\n }\n}\nprint(ribbon(n, l));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dbc39caecda36811673664c364a19d53", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "const [ n, a, b, c] = readline().split(' ').map(Number);\nconst l = [a, b, c].slice(1).reduce((r, i) => r.includes(i) ? r : [ ...r, i ], []).sort((a, b) => a - b);\n\nconst ribbon = (n, l) => {\n if (n === 0) return 0;\n if (n < 0) return false;\n for (let i = 0; i < l.length; i++) {\n const x = ribbon(n - l[i], l);\n if (typeof x === 'number') return 1 + x;\n }\n};\n\nprint(ribbon(n, l));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8bd976e8dd5a09101ca92c785a200a69", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "getInt = () => parseInt(readline());\ngetFlt = () => parseFloat(readline());\ngetArrInt = () => readline().split(' ').map(x => parseInt(x));\ngetArrFlt = () => readline().split(' ').map(x => parseFloat(x));\nInt = (x) => Math.floor(x);\n\nnums = getArrInt();\nn = nums[0], a = nums[1], b = nums[2], c = nums[3];\n\n\nmax = -1;\n\nfor(let i = 0; i <= 4000; i = i + 1){\n\tfor(let j = 0; j <= 4000; j++){\n\t\tlet tot = i * a + j * b;\n\t\tif(tot <= n){\n\t\t\tlet rem = n - tot;\n\t\t\tif(rem % c === 0){\n\t\t\t\tlet k = rem / c;\n\t\t\t\tmax = Math.max(max, i + j + k);\n\t\t\t}\n\t\t}\n\t}\n}\n\nprint(max)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e653e236846e955ef3abb7549034c800", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "nabc = readline().split(' ').map(Number);\nvar [ t, ...others ] = nabc;\nn = nabc[0];\nl = nabc.slice(1).reduce((r, i) => r.includes(i) ? r : [ ...r, i ], []).sort((a, b) => a - b);\nfunction ribbon(n, l) {\n if (n === 0) return 0;\n if (n < 0) return false;\n for (var i = 0; i < l.length; i++) {\n var x = ribbon(n - l[i], l);\n if (typeof x === 'number') return 1 + x;\n }\n}\nprint(ribbon(n, l));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5c899ee8f0c745d06b1b61c81620fd4b", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "let datos = readline().split(' ');\nconst tamano = Number(datos[0]);\nconst numero = Number(datos[1]);\nlet veces = 0;\nfor(let i=1; i<= tamano; i++){\n if((numero % i) === 0 && (numero / i) <= tamano ){\n veces++;\n }\n}\nprint(veces);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "21262be1ce484f9f1f7994d83ad45dca", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const datos = readline().split(' ');\nconst tamano = Number(datos[0]);\nconst numero = Number(datos[1]);\nlet veces = 0;\nfor(let i=1; i<= tamano; i++){\n if((numero % i) === 0 && (numero / i) <= tamano ){\n veces++;\n }\n}\nprint(veces);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "63974c9a202a0a1886d96366eb7c11df", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(\" \").map(function(x) {return parseInt(x); });\nconsole.log(numbers);\n\nvar n = numbers[0]\nvar x = numbers[1]\n\nvar count = 0;\nfor (i=0; i=x){\n count += 1;\n }\n}\nconsole.log(count);\n \n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "284c1093377acc8a9db4432b0c2173db", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\nvar numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\nlet N = numbers[0];\nlet M = numbers[1];\n\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n\n let value = node[0];\n let count = node[1];\n\n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f051f824287d2ea942818a12a610002c", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(() => {\n function FindC(N, M){\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n \n let value = node[0];\n let count = node[1];\n \n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n }\n \n \n \n let numbers = readline().split(\" \");\n print(FindC(parseInt(numbers[0]), parseInt(numbers[1])));\n})();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8198113a453aceb35b24113b52bfbe7c", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(() => {\n function FindC(N, M){\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n \n let value = node[0];\n let count = node[1];\n \n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n }\n \n \n \n let numbers = readline().split(\" \");\n print(FindC(parseInt(numbers[0]), parseInt(numbers[1])));\n}))();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ea875548e386311597a9942aaa46c52d", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "\nfunction FindC(N, M){\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n\n let value = node[0];\n let count = node[1];\n\n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n}\n\n\n\nlet numbers = readline().split(\" \");\nprint(FindC(parseInt(numbers[0]), parseInt(numbers[1])));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "48f26ebff5fa40207f83b714841de9dc", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "\nfunction FindC(N, M){\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n\n let value = node[0];\n let count = node[1];\n\n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n}\n\n\n\nvar numbers = readline().split(\" \");\nprint(FindC(parseInt(numbers[0]), parseInt(numbers[1])));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "15cbea99a12da26619432760a450a7d7", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "\nfunction FindC(N, M){\n if(N == M) return 0;\n let flags = [];\n let queue = [];\n let c = 0;\n let size = 0;\n queue[0] = [N, 1];\n flags[N] = true;\n while(queue.length > 0){\n let node = queue[c++];\n\n let value = node[0];\n let count = node[1];\n\n let le = value - 1;\n let ri = value * 2;\n if(le == M || ri == M){\n return count;\n }\n if(!flags[le] && le >= 1){\n queue[++size] = [le, count + 1];\n flags[le] = true;\n }\n if(!flags[ri] && ri < 2*M){\n queue[++size] = [ri, count + 1];\n flags[ri] = true;\n }\n }\n}\n\n\n\nvar numbers = readLine().split(\" \");\nprint(FindC(parseInt(numbers[0]), parseInt(numbers[1])));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "252b203c061f2f59e38bd4fff83597d9", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "\"use strict\";\r\nconst fs = require(\"fs\");\r\n/let filename = \"0.txt\";\r\nlet filename = 0;\r\nconst input = fs.readFileSync(filename, \"utf8\").trim().split(\"\\n\");\r\nlet line = 0;\r\nfunction readline() {\r\n return input[line++];\r\n}\r\nfunction iInpArr() {\r\n return readline()\r\n .trim()\r\n .split(\" \")\r\n .map((cur) => parseInt(cur));\r\n}\r\nfunction BInpArr() {\r\n return readline()\r\n .trim()\r\n .split(\" \")\r\n .map((cur) => BigInt(cur));\r\n}\r\nfunction string() {\r\n return readline().trim();\r\n}\r\nfunction stringArr() {\r\n return readline().trim().split(\"\");\r\n}\r\n\r\nfunction stringArr1() {\r\n return readline().trim().split(\" \");\r\n}\r\nfunction getValue() {\r\n return parseInt(readline());\r\n}\r\nfunction iInpArr1() {\r\n return readline()\r\n .trim()\r\n .split(\"\")\r\n .map((cur) => parseInt(cur));\r\n}\r\nlet mod = 1e9 + 7;\r\nmod = BigInt(mod);\r\nconst pow = (num, exp, mod) => {\r\n if (exp === BigInt(0)) return BigInt(1);\r\n let x = pow(num, exp / BigInt(2), mod);\r\n if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;\r\n else return (x * x) % mod;\r\n};\r\nconst inverse = (num, exp) => {\r\n return pow(BigInt(num), BigInt(exp), BigInt(mod));\r\n};\r\nconst sqrt = (n) => {\r\n let low = 1n,\r\n high = n,\r\n ans;\r\n while (low <= high) {\r\n let mid = (low + high) / 2n;\r\n if (mid * mid <= n) {\r\n ans = mid;\r\n low = mid + 1n;\r\n } else high = mid - 1n;\r\n }\r\n return ans;\r\n};\r\n\r\nconst solve = () => {\r\n let t = 1;\r\n while (t--) {\r\n let n = getValue();\r\n let ans = 6n,\r\n k = 4n;\r\n for (let i = 2; i <= n; i++) {\r\n ans = (ans * ((k * k) % mod)) % mod;\r\n k = (k * k) % mod;\r\n }\r\n console.log(ans + \"\");\r\n }\r\n};\r\nsolve();\r\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "94a5870e9719815e7fd39ecf7d24a5b7", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "let keyboardline = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\nlet direction = readline();\nlet modified = readline();\nlet original=\"\";\nif(direction ==\"R\"){\n for(var i = 0;i parseInt(x));\n console.log(getOutput(n, a, x, b, y));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c7d48297fde7b443df203ed8338c50c9", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res*=i;\n return res;\n}\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n let a = numbers[0], b = numbers[1]\n // print(a,b);\n let res;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "004fa9306358aff0c95105cafbbdd3b6", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res=res*i;\n return res;\n}\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n let a = numbers[0], b = numbers[1]\n // print(a,b);\n let res;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ed6d6cc871109bfa3d5f653985e9e1ca", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// function fat(n) {\n// let res = 1;\n// for(let i = 2; i <= n; i++) res=res*i;\n// return res;\n// }\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n let a = numbers[0], b = numbers[1]\n // print(a,b);\n let res;\n if(a <= b) res = 1;\n else res = 1;\n print(res);\n return res;\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ebdee123d2f9cc7c243c7941624d950d", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res=res*i;\n return res;\n}\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n let a = numbers[0], b = numbers[1]\n // print(a,b);\n let res;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n return res;\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "25b7f714954bdfab0975724e5f9cfd1b", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n var var = 1;\n for(let i = 2; i <= n; i++) res*=i;\n return res;\n}\n\nfunction main(){\n var numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n var a = numbers[0], b = numbers[1]\n // print(a,b);\n var res;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "905537b4cb3338b271278dafe09adba7", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res=res*i;\n return res;\n}\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n // let a = numbers[0], b = numbers[1]\n // // print(a,b);\n // let res;\n // if(a <= b) res = fat(a);\n // else res = fat(b);\n // print(res);\n // return res;\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "22cfcc1e0052d99d40d2244a1085249e", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res*=i;\n return res;\n}\n\nfunction main(){\n var numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n var a = numbers[0], b = numbers[1]\n // print(a,b);\n let res;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "85875d2a368d0719c26ad7cac5757ebe", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function fat(n) {\n let res = 1;\n for(let i = 2; i <= n; i++) res=res*i;\n return res;\n}\n\nfunction main(){\n let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n let a = numbers[0], b = numbers[1]\n // print(a,b);\n let res = 0;\n if(a <= b) res = fat(a);\n else res = fat(b);\n print(res);\n return res;\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6e7570312b47cb31d71dc05f7ddbe382", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n\n\n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "057d05f47e16df48a419e96955c5c51a", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var m={'h','e','l','l','o'};\nvar s={};\nvar r=readline().toLowerCase().split('').map(function(k){s[k]=true;});\nprint(((Object.keys(s)) == (Object.keys(m)))? 'YES': 'NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "98957b44e16b5574ec89ec74e5383c4a", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = readline();\nlet count_h = 0;\nlet count_e = 0;\nlet count_l = 0;\nlet count_o = 0;\nfor (let i = 0; i < a.length; i++) {\n if (a[i] == \"h\") count_h++;\n else if (a[i] == \"e\") count_e++;\n else if (a[i] == \"l\") count_l++;\n else if (a[i] == \"o\") count_o++;\n}\nif (\n count_h >= 1 &&\n count_e >= 1 &&\n count_l >= 2 &&\n count_o >= 1 &&\n a.length > 5\n)\n print(\"YES\");\nelse print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6da4ba408897814d996b7c3ab02b8068", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3f40d0c1a3dfa5ba8bb88b4188591350", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n\n\n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a53e1493a030f945b404acc6abb3ce77", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var string = readline();\n var greetings = [\"h\",\"e\",\"l\",\"l\",\"o\"];\n var i = 0;\n var result = string.split(\"\").filter((letter) => {\n if(letter === greetings[i]) {\n i++;\n return true;\n } \n return false;\n }).join(\"\") === \"hello\";\n if(result) print(\"YES\");\n else print(\"NO\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3d725ed43cf0d61aec01719476431aa6", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var s = readline();\n\nfunction shouldSayHello(s) {\n var word = 'hello';\n\n var prevIndex = 0;\n for (i = 0; i < word.length; i++) {\n let index = s.indexOf(word[i], prevIndex + 1);\n if (index === -1) {\n return 'NO';\n } else {\n prevIndex = index;\n }\n }\n return 'YES';\n}\n\nprint(shouldSayHello(s));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c78eae8c326cca4d21fccead4e0e59d6", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function shouldSayHello(s) {\n var word = 'hello';\n\n var prevIndex = 0;\n for (i = 0; i < word.length; i++) {\n let index = s.indexOf(word[i], prevIndex + 1);\n if (index === -1) {\n return 'NO';\n } else {\n prevIndex = index;\n }\n }\n return 'YES';\n}\n\nvar s = readline();\nprint(shouldSayHello(s));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "80baac0becb42a825a82777e1d7ea423", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var m={'h','e','l','l','o'};\nvar s={};\nvar x=m.map(function(w){m[w]=true;});\nvar r=readline().toLowerCase().split('').map(function(k){s[k]=true;});\nprint(((Object.keys(s)) == (Object.keys(m)))? 'YES': 'NO');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "61bf8d86175b719b0198bfe356e52fcd", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function shouldSayHello(s) {\n var word = 'hello';\n\n var prevIndex = 0;\n for (i = 0; i < word.length; i++) {\n let index = s.indexOf(word[i], prevIndex + 1);\n if (index === -1) {\n return 'NO';\n } else {\n prevIndex = index;\n }\n }\n return 'YES';\n}\n\n\n\nvar s = readline();\nprint(shouldSayHello(s));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "444376c3d2e564072cfc7d21ddd17ef6", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n\n\n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e703055fce3151cf0897d15f206541d2", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let a = readline();\nlet count_h = 0;\nlet count_e = 0;\nlet count_l = 0;\nlet count_o = 0;\nfor (let i = 0; i < a.length; i++) {\n if (a[i] === \"h\") count_h++;\n else if (a[i] ===\"e\") count_e++;\n else if (a[i] === \"l\") count_l++;\n else if (a[i] === \"o\") count_o++;\n}\nif (\n count_h >= 1 &&\n count_e >= 1 &&\n count_l >= 2 &&\n count_o >= 1 &&\n a.length > 5\n)\n print(\"YES\");\nelse print(\"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a9785a6bda8fb27d0387b0ee3858c195", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// function shouldSayHello(s) {\n// var word = 'hello';\n\n// var prevIndex = 0;\n// for (i = 0; i < word.length; i++) {\n// let index = s.indexOf(word[i], prevIndex + 1);\n// if (index === -1) {\n// return 'NO';\n// } else {\n// prevIndex = index;\n// }\n// }\n// return 'YES';\n// }\n\n\n\nvar s = readline();\n\nvar word = 'hello';\nvar res = 'YES';\n\nvar prevIndex = 0;\nfor (i = 0; i < word.length; i++) {\n let index = s.indexOf(word[i], prevIndex + 1);\n if (index === -1) {\n res = 'NO';\n break;\n } else {\n prevIndex = index;\n }\n}\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bb5eb2ec816fac849c679ada2d44f7e9", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2c503d193feb835bdfeb2e081f4d4767", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package quote collects pithy sayings.\npackage quote // import \"rsc.io/quote\"\n\nimport \"rsc.io/quote/v3\"\n\n// Hello returns a greeting.\nfunc Hello() string {\n\treturn quote.HelloV3()\n}\n\n// Glass returns a useful phrase for world travelers.\nfunc Glass() string {\n\t// See http://www.oocities.org/nodotus/hbglass.html.\n\treturn quote.GlassV3()\n}\n\n// Go returns a Go proverb.\nfunc Go() string {\n\treturn quote.GoV3()\n}\n\n// Opt returns an optimization truth.\nfunc Opt() string {\n\t// Wisdom from ken.\n\treturn quote.OptV3()\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b90c997d53dc9b5a176176d276b14ad1", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var len = +readline();\nvar originSet = readline().split(' ');\n\nvar countMap = {}\noriginSet.forEach((num) => {\n if (!countMap[num]) {\n countMap[num] = 0;\n }\n countMap[num]++;\n});\n\nvar niceGroupIndex = 0;\nvar niceDiff = 0;\n\nvar groupLabel = ['A', 'B'];\nvar label = groupLabel[0];\n\nvar result = [];\nvar isGood = {};\nvar goodCount = 0;\nvar labelForNum = {}\noriginSet.forEach((num, index) => {\n if (countMap[num] === 1) {\n result.push(label);\n // nice\n var group = niceGroupIndex % 2;\n niceDiff += group === 0 ? 1 : -1;\n\n niceGroupIndex++;\n\n group = niceGroupIndex % 2;\n label = groupLabel[group];\n } else {\n if (!labelForNum[num]) {\n labelForNum[num] = label;\n }\n result.push(labelForNum[num] ? labelForNum[num] : label);\n }\n if (countMap[num] > 2 && !isGood[num]) {\n isGood[num] = true;\n goodCount++;\n }\n});\n\nif (niceDiff === 0) {\n print('YES');\n print(result.join(''));\n} else {\n var rest = Math.abs(niceDiff)\n if (rest <= goodCount) {\n print('YES');\n var labelNeeded = niceDiff < 0 ? 'B' : 'A';\n for (var i = 0, len = originSet.length; i < len; i++) {\n var num = originSet[i];\n if (labelNeeded !== result[i]) {\n if (countMap[num] === 1 && rest >= 2) {\n result[i] = labelNeeded;\n rest -= 2;\n } else if (isGood[num]) {\n result[i] = labelNeeded;\n isGood[num] = false;\n rest--;\n }\n }\n if (rest === 0) {\n break;\n }\n }\n print(result.join(''));\n } else {\n print('NO');\n }\n}\n\nfunction check(result) {\n const groups = [[], []];\n result.forEach((label, index) => {\n if (label === 'A') {\n groups[0].push(originSet[index]);\n } else if (label === 'B') {\n groups[1].push(originSet[index]);\n }\n });\n\n const output = groups.map((group) => getNiceCount(group));\n function getNiceCount(group) {\n const map = {};\n group.forEach((num) => {\n if (!map[num]) {\n map[num] = 0;\n }\n map[num]++;\n });\n\n let sum = 0;\n Object.keys(map).forEach((num) => {\n if (map[num] === 1) {\n sum++;\n }\n });\n return sum;\n }\n console.log(output[0], output[1]);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1f9c0a1f229fea648a9125c72ce54d69", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var len = +readline();\nvar str = readline();\n\nvar i = 0;\nfor (; i < len - 1; i++) {\n var targetSum = 0;\n for (var j = 0; j <= i; j++) {\n targetSum += +str[j];\n }\n\n var k = i + 1;\n var sum = 0;\n while (k < len) {\n sum += +str[k];\n if (sum === targetSum) {\n sum = 0;\n } else if (sum > targetSum) {\n break;\n }\n k++;\n }\n\n if (k >= len && sum === 0) {\n break;\n }\n}\n\nvar res = i < len - 1 ? 'YES' : 'NO';\nprint(res);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c77ea48d932946775309e0d789d38c4c", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "// http://codeforces.com/contest/977/problem/B\n\nlet length = parseInt(readline(), 10);\nlet string = readline();\n\nfunction main(length, string) {\n let hash = {};\n\n for (let i = 0; i < length - 1; i++) {\n let substring = `${string[i]}${string[i + 1]}`;\n if (hash[substring]) {\n hash[substring] = hash[substring] + 1;\n } else {\n hash[substring] = 1;\n }\n }\n\n let twogrammaList = Object.keys(hash);\n let biggest = twogrammaList[0];\n\n for (let i = 1; i < twogrammaList.length; i++) {\n let tg = twogrammaList[i];\n\n if (hash[tg] > hash[biggest]) {\n biggest = twogrammaList[i];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0df5405aba6c3bbcd6ca002c9341d241", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let arg1 = readline().split(' ');\nlet arg2 = readline().split(' ');\n\nlet length = parseInt(arg1);\nlet string = arg2;\n\nfunction main(length, string) {\n let hash = {};\n\n for (let i = 0; i < length - 1; i++) {\n let substring = `${string[i]}${string[i + 1]}`;\n if (hash[substring]) {\n hash[substring] = hash[substring] + 1;\n } else {\n hash[substring] = 1;\n }\n }\n\n let twogrammaList = Object.keys(hash);\n let biggest = twogrammaList[0];\n\n for (let i = 1; i < twogrammaList.length; i++) {\n let tg = twogrammaList[i];\n\n if (hash[tg] > hash[biggest]) {\n biggest = twogrammaList[i];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2ebd05b35ae52acba1ef0fd7c3c8cdfc", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "// http://codeforces.com/contest/977/problem/B\n\nvar args = readline().split(' ');\n\nvar length = parseInt(args[0], 10);\nvar string = args[1];\n\nfunction main(length, string) {\n var hash = {};\n\n for (var i = 0; i < length; i++) {\n if (!string[i + 1]) {\n break;\n }\n\n var tg = `${string[i]}${string[i + 1]}`;\n if (hash[tg]) {\n hash[tg] = hash[tg] + 1;\n } else {\n hash[tg] = 1;\n }\n }\n\n var twogrammaList = Object.keys(hash);\n var biggest = twogrammaList[0];\n\n for (var j = 1; j < twogrammaList.length; j++) {\n let twogramma = twogrammaList[j];\n\n if (twogrammaList[twogramma] > twogrammaList[biggest]) {\n biggest = twogrammaList[j];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "63ea1e71c4aa7fa62b46a7d03634d8be", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var length = parseInt(readline());\nvar string = readline();\n\nfunction main(length, string) {\n var hash = {};\n\n for (var i = 0; i < length; i++) {\n if (!string[i + 1]) {\n break;\n }\n\n var tg = `${string[i]}${string[i + 1]}`;\n if (hash[tg]) {\n hash[tg] = hash[tg] + 1;\n } else {\n hash[tg] = 1;\n }\n }\n\n var twogrammaList = Object.keys(hash);\n var biggest = twogrammaList[0];\n\n for (var j = 1; j < twogrammaList.length; j++) {\n let twogramma = twogrammaList[j];\n\n if (twogrammaList[twogramma] > twogrammaList[biggest]) {\n biggest = twogrammaList[j];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4bb44b618615cd767795d821816dbdc4", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "// http://codeforces.com/contest/977/problem/B\n\nlet arg1 = readline();\nlet arg2 = readline();\n\nprint(arg1);\nprint(arg2);\n\n\n//let length = parseInt(arg1);\n//let string = arg2;\n\n//function main(length, string) {\n //let hash = {};\n\n //for (let i = 0; i < length - 1; i++) {\n //let substring = `${string[i]}${string[i + 1]}`;\n //if (hash[substring]) {\n //hash[substring] = hash[substring] + 1;\n //} else {\n //hash[substring] = 1;\n //}\n //}\n\n //let twogrammaList = Object.keys(hash);\n //let biggest = twogrammaList[0];\n\n //for (let i = 1; i < twogrammaList.length; i++) {\n //let tg = twogrammaList[i];\n\n //if (hash[tg] > hash[biggest]) {\n //biggest = twogrammaList[i];\n //}\n //}\n\n //return biggest;\n//}\n\n//print(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "39a8c61c6cc78913c49ae33b3095ad54", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "// http://codeforces.com/contest/977/problem/B\n\nlet args = readline().split(' ');\n\nlet length = parseInt(args[0], 10);\nlet string = args[1];\n\nfunction main(length, string) {\n let hash = {};\n\n for (let i = 0; i < length; i++) {\n if (!string[i + 1]) {\n break;\n }\n\n let twogramma = `${string[i]}${string[i + 1]}`;\n if (hash[twogramma]) {\n hash[twogramma] = hash[twogramma] + 1;\n } else {\n hash[twogramma] = 1;\n }\n }\n\n let twogrammaList = Object.keys(hash);\n let biggest = twogrammaList[0];\n\n for (let i = 1; i < twogrammaList.length; i++) {\n let twogramma = twogrammaList[i];\n\n if (twogrammaList[twogramma] > twogrammaList[biggest]) {\n biggest = twogrammaList[i];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fedc643a8b17507a06dd932aca66a8ea", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let arg1 = readline();\nlet arg2 = readline();\n\nlet length = parseInt(arg1);\nlet string = arg2;\n\nfunction main(length, string) {\n let hash = {};\n\n for (let i = 0; i < length - 1; i++) {\n let substring = `${string[i]}${string[i + 1]}`;\n if (hash[substring]) {\n hash[substring] = hash[substring] + 1;\n } else {\n hash[substring] = 1;\n }\n }\n\n let twogrammaList = Object.keys(hash);\n let biggest = twogrammaList[0];\n\n for (let i = 1; i < twogrammaList.length; i++) {\n let tg = twogrammaList[i];\n\n if (hash[tg] > hash[biggest]) {\n biggest = twogrammaList[i];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aac4ea371f5be7cacb565737f7f04349", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "// http://codeforces.com/contest/977/problem/B\n\nlet arg1 = read();\nlet arg2 = read();\n\nlet length = parseInt(arg1, 10);\nlet string = arg2;\n\nfunction main(length, string) {\n let hash = {};\n\n for (let i = 0; i < length - 1; i++) {\n let substring = `${string[i]}${string[i + 1]}`;\n if (hash[substring]) {\n hash[substring] = hash[substring] + 1;\n } else {\n hash[substring] = 1;\n }\n }\n\n let twogrammaList = Object.keys(hash);\n let biggest = twogrammaList[0];\n\n for (let i = 1; i < twogrammaList.length; i++) {\n let tg = twogrammaList[i];\n\n if (hash[tg] > hash[biggest]) {\n biggest = twogrammaList[i];\n }\n }\n\n return biggest;\n}\n\nprint(main(length, string));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "09409054e72fa94d24746a343614e447", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function foo(m, s) {\n if (m*9 < s || s === 0) {\n return { min: '-1', max: '-1' }\n }\n\n var maxArr = [];\n\n var i=0;\n while (i != m) {\n if (s/9 >= 1) {\n maxArr[i] = 9;\n s -= 9;\n } else {\n maxArr[i] = s;\n s -= s;\n }\n\n i++;\n }\n\n var max = '';\n for (var j=0; j {\n if (S === 0) return M === 1 ? '0 0' : '-1 -1'\n if (S > 9 * M) return '-1 -1'\n const s = (S - 1) % 9 + 1;\n let r = Array((S - s) / 9 + 1).join('9');\n if (M - 1 === r.length) return `${s}${r} ${r}${s}`;\n const zzz = Array(M - 1 - r.length).join('0');\n return `1${zzz}${s-1}${r} ${r}${s}${zzz}0`;\n}\nconst x = readline().split(' ');\nprint(fn(parseInt(x[0]), parseInt(x[1])));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cf5378a39756cc4711e3428e8fce53f5", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "const q = [];\nconst r = [];\nconst input = readline().split(' ').map(Number);\nlet x = { m: input[0], s: input[1], h: '' };\nfor(let i = 1; i < Math.min(10, x.s + 1); i++) q.push({ m: x.m - 1, s: x.s - i, h: `${i}` });\nwhile(q.length) {\n x = q.pop();\n if (x.m === 0) {\n if (x.s === 0) r.push(x.h);\n } else {\n for(let i = 0; i < Math.min(10, x.s + 1); i++)\n q.push({ m: x.m - 1, s: x.s - i, h: `${x.h}${i}` });\n }\n}\nif (!r.length) print('-1 -1');\nelse print(Math.min(...r) + ' ' + Math.max(...r))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "98ed84b49087780e8bc93507894b7366", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "'use strict'\n \nconst [m, S] = readline().split(' ').map(Number);\n \nif (m === 1 && S === 0) print('0 0');\nelse {\n if (S === 0 || S > 9 * m) {\n print('-1 -1');\n } else {\n const s = (S - 1) % 9 + 1;\n let r = Array((S - s) / 9 + 1).join('9');\n if (r.length === m - 1) print(`${s}${r} ${r}${s}`);\n else {\n const zzz = Array(m - r.length - 1).join('0');\n print(`1${zzz}${s-1}${r} ${r}${s}${zzz}0`);\n }\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1f2db67e2470eefbbe237ba927934750", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function foo(m, s) {\n if (m*9 < s || s === 0) {\n return { min: '-1', max: '-1' }\n }\n\n const maxArr = [];\n\n let i=0;\n while (i != m) {\n if (s/9 >= 1) {\n maxArr[i] = 9;\n s -= 9;\n } else {\n maxArr[i] = s;\n s -= s;\n }\n\n i++;\n }\n\n let max = '';\n for (let j=0; j= 1) {\n maxArr[i] = 9;\n s -= 9;\n } else {\n maxArr[i] = s;\n s -= s;\n }\n\n i++;\n }\n\n var max = '';\n for (var j=0; j\n var n = prompt();\n var s = prompt();\n var str = new Set();\n for (var i = 0;i!=s.length;i++)\n str.add(s[i]);\n if (str.size >= 26)\n document.write(\"YES\");\n else \n document.write(\"NO\");\n \n \n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c71a942071674d5ad629de053e6da483", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n = Number(readline());\ns = readline().toLowerCase();\nstr = \"\"\nfor (var i = 0; i < n; i++) {\n if (str.indexOf(s.charAt(i)) == -1) {\n str += s[i]\n }\n}\nprint(str.length >= 26 ? \"YES\" : \"NO\")n = Number(readline());\ns = readline().toLowerCase();\nstr = \"\"\nfor (var i = 0; i < n; i++) {\n if (str.indexOf(s.charAt(i)) == -1) {\n str += s[i]\n }\n}\nprint(str.length >= 26 ? \"YES\" : \"NO\")", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2b402473f56051d0b11e5102d37ab56d", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main\n{ \n var n;\n n = parseInt(readline());\n\n var a=[];\n a = parseInt(readline().split(' '));\n\n var x1 = 0, x2 = n, ed=0;\n\n var i;\n\n for(i=0; i \n\nfor (i=0;i {\n f(x,y-1)\n f(x+1,y)\n}\n\nprint(T)\n// f(0, A.length-1)\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2b95c7d6f6187716ecc0ef0c62b6ac70", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "body input{border:1px solid transparent;display:block;margin:5px}body .logo-wrapper{display:inline-block;width:0;height:48px;background-color:black;border-radius:0 0 15px 0;overflow:hidden}body .logo{font-family:sans-serif;font-weight:bold;background:-webkit-linear-gradient(#000 35%, blue 42%, #fff 46%, #000 55%, #9922D2 65%, #fff 80%);-webkit-background-clip:text;-webkit-text-fill-color:transparent;-webkit-text-stroke:0.5px white;text-shadow:5px 5px 40px #0000FF;display:none;margin-left:10px}body .button{color:white}\n/*# sourceMappingURL=style.css.map */\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "95029dede0df07d6a1bad4f058e23f5d", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// Getting Problem Data from Codeforces.\nlet inputString = readline();\n// Setting up and populating HashMap.\nlet nineteenHashMap = {'n':0,'i':0,'e':0,'t':0};\nfor (let index = 0;index=3 && m['i']>=1 && m['e']>=3 && m['t']>=1){\n //Increasing count and removing from HashMap.\n m['n']-=2;m['i']-=1;m['e']-=3;m['t']-=1;\n nineteenCount+=1\n}\nprint(nineteenCount);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2de9fbc903c80f8a7d00fe51de916bfc", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "JavaScript", "source_code": "\n\n\n\nfunction getCm(text) {\n\tconst target = \"nineteen\".split(\"\");\n\tconst map = {};\n for(var i = 0; i < text.length; i++)\n\t\tmap[text[i]] = (map[text[i]]||0)+1;\n\t\n\tlet c = 0;\n\t_break:\n\twhile(1) {\n\t\tfor(let i = 0; i < target.length; i++) {\n\t\t\tif ( !map[target[i]]-- ) {\n\t\t\t\tbreak _break;\n\t\t\t}\n\t\t}\n\t\tc++;\n\t}\n\treturn c;\n\t\n\treturn Math.min(map[\"n\"]/2|0, map[\"e\"]/3|0, map[\"t\"], map[\"i\"]);\n\t\n\t//const arr = target.map(c => map[c]);\n\t//return Math.min.apply(null, arr);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7af108c455f2e0b033c48bff82543168", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "JavaScript", "source_code": "var letters = readline().split(\"\");\n var n = 3;\n var i = 1;\n var e = 3;\n var t = 1;\n var countedN = 0;\n var countedI = 0;\n var countedE = 0;\n var countedT = 0;\n\n for (var j = 0; j < letters.length; j++) {\n switch(letters[j]) {\n case 'n':\n countedN++;\n break;\n case 'i':\n countedI++;\n break;\n case 'e':\n countedE++;\n break;\n case 't':\n countedT++;\n break;\n default:\n break;\n }\n }\n if (countedN >= n) {\n countedN++;\n }\n // console.log(countedN);\n // console.log(countedI);\n // console.log(countedE);\n // console.log(countedT);\n let num = (Math.min(Math.floor(countedN / n), Math.floor(countedI / i), Math.floor(countedE / e), Math.floor(countedT / t)));\n num = (Math.min(Math.floor((countedN + num) / n), Math.floor(countedI / i), Math.floor(countedE / e), Math.floor(countedT / t)));\n print(num);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4439652e9fdf9e1ea71e0f73529e5804", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "JavaScript", "source_code": "let t = +readline();\r\nfor(let i=0;i0){\r\n sum=sum-x;\r\n ans=x+ans;\r\n x=x-1;\r\n }\r\n ans=sum+ans;\r\n print(ans);\r\n }\r\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "172cdbc98a8d49b57d39ef60887531cb", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(\" \");\nvar min = Math.min(...line);\nvar max = Math.max(...line);\n\nvar ret = 0;\n\n// if (min >= 2 || max >= 2) {\n // ret = (min - min % 2) * max / 2 + Math.floor((min % 2) * max / 2);\n// }\nret = Math.floor(min * max / 2);\n\nprint(ret);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0d918d4539648239c8a99dbc5382e5b3", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let lines = readline().split(\" \"); \nlet output = Math.floor(lines[0] / 2) * Math.floor(lines[1] / 2) * 2;\noutput += (lines[0] % 2 == 1) ? (lines[1] % 2 == 1) ? 2 : 1 : 0;\nprint(output);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c8aa7f4e1202e9ef4ae39e19dd062b24", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var [m, n] = readline().split(' ')\n\nprint(parseInt(m * n / 2))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d1bc817c6a22eb5b3de8e6e84158c3c8", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var args = readline().split(\" \");\nprint(((args[0] * args[1]) - (args[0] * args[1] mod 2))/2);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "285e5f86083bd28ea8e77cfbe61f4b86", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline()split(' ');\nvar height = input[0];\nvar width = input[1];\nvar result = 0;\n\nwhile(height>1){\n result+= width;\n height-=2;\n}\n\nif(height === 1){\n result+= width/2;\n}\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "18637f414f27f316e13ae1a82118a53d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "# A. \u0423\u043a\u043b\u0430\u0434\u043a\u0430 \u0434\u043e\u043c\u0438\u043d\u043e\u0448\u043a\u0430\u043c\u0438\n###### [\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0443](https://codeforces.com/problemset/problem/50/A)\n\n### \u041a\u043e\u043d\u0446\u0435\u043f\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:\n\n### \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:\n```\n'use strict';\nconst inputData = readline().split(' ');\nvar width = parseInt(inputData[0]);\nvar height = parseInt(inputData[1]);\n\n\nwrite(Math.floor(width*height/2));\n\n```\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "78bd50e33ee177be27fd67aebc7bf723", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var inputs = readline().split(\" \");\n \nprint(Math.floor(inputs[0] * inputs[1]) / 2))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "69f8f5fbe7c7b27d638324049b8a2406", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var needToBuy = 4\u00b7\nvar horsesShoeOwned = {}\n\n var horsesShoe = readline().split(' ').map(Number)\n\n for (var i = 0; i < horsesShoe.length; i++) {\n if (!horsesShoeOwned.hasOwnProperty(horsesShoe[i])) {\n horsesShoeOwned[horsesShoe[i]] = 0\n needToBuy -= 1\n }\n }\n\n print(needToBuy)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6c22f625448fd57dc25168b5718a3e72", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nvar m = parseInt(readline());\nvar arr = [];\nfor(let i = 0; i0) {\n mink += 1;\n}\nprint(`${mink} ${maxk}`);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1befb29762eda435184f1b87992f2806", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nvar m = parseInt(readline());\nvar arr = [];\nfor(let i = 0; i0) {\n mink += 1;\n}\nprint(mink+\" \"+maxk);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b9e766f816e1111e6b02b2b8c8d60e86", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var par = readline().split(\" \").map( (x) => parseInt(x));\nvar n = parseInt(readline());\nvar m = parseInt(readline());\nvar arr = [];\nfor(var i = 0; i0) {\n mink += 1;\n}\nprint(mink+\" \"+maxk);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "737b48435b5830f53651a6cb194976c7", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "//Input\n// k - Precio por pala\n// r - demonimaci\u00f3n de la moneda que Polycarp tiene en su bolsillo\n// var firstLine = \"117 3\"; // 9\n// var firstLine = \"237 7\"; // 1\n// var firstLine = \"15 2\"; // 2\n\nlet firstLine = readline();\n\nretorno = eval(firstLine);\n\n//Solution\nfunction eval(firstLine){\n let tmp = firstLine.split(\" \").map(function(x) { return parseInt(x); });\n let k = tmp[0];\n let r = tmp[1];\n\n write(minimumNumberOfShovels(k, r));\n // console.log(minimumNumberOfShovels(k, r));\n // return \"Hola;\"\n};\n\nfunction minimumNumberOfShovels(k, r){\n let m1 = 0;\n for(var n = 1 ; n < 1000 ; n++){\n //console.log(\"n*10/k: \" + Math.floor(n*10/k));\n if( (n*10/k) == Math.floor(n*10/k) ){\n m1 = n*10/k;\n break;\n };\n };\n\n let m2 = 0;\n for(var n = 1 ; n < 1000 ; n++){\n if( ((n*10+r)/k) == Math.floor((n*10+r)/k) ){\n m2 = (n*10+r)/k;\n break;\n }\n };\n //console.log(\"m1: \" + m1 + \" m2: \" + m2);\n\n var m = ( (m2 != 0 ) ? Math.min(m1, m2) : m1 );\n //console.log(\"m: \" + m);\n\n return m;\n};\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3cb78649c14907f7198158138247e3a6", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//Input\n// k - Precio por pala\n// r - demonimaci\u00f3n de la moneda que Polycarp tiene en su bolsillo\n// var firstLine = \"117 3\"; // 9\n// var firstLine = \"237 7\"; // 1\n// var firstLine = \"15 2\"; // 2\n\nlet firstLine = readLine();\n\nretorno = eval(firstLine);\n\n//Solution\nfunction eval(firstLine){\n let tmp = firstLine.split(\" \").map(function(x) { return parseInt(x); });\n let k = tmp[0];\n let r = tmp[1];\n\n write(minimumNumberOfShovels(k, r));\n // console.log(minimumNumberOfShovels(k, r));\n // return \"Hola;\"\n};\n\nfunction minimumNumberOfShovels(k, r){\n let m1 = 0;\n for(var n = 1 ; n < 1000 ; n++){\n //console.log(\"n*10/k: \" + Math.floor(n*10/k));\n if( (n*10/k) == Math.floor(n*10/k) ){\n m1 = n*10/k;\n break;\n };\n };\n\n let m2 = 0;\n for(var n = 1 ; n < 1000 ; n++){\n if( ((n*10+r)/k) == Math.floor((n*10+r)/k) ){\n m2 = (n*10+r)/k;\n break;\n }\n };\n //console.log(\"m1: \" + m1 + \" m2: \" + m2);\n\n var m = ( (m2 != 0 ) ? Math.min(m1, m2) : m1 );\n //console.log(\"m: \" + m);\n\n return m;\n};\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4ca6bfe8e070eba056a7b954fe51cbda", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar ptoalla = valores[0];\nvar centimos = valores[1];\nvar ptotal=ptoalla;\nvar contador=1;\n\nwhile ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){\n\tcontador++;\n\tptotal=contador*ptoalla;\n}\nprint(parseInt(contador));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ae2bb063f9e17be3ac841274ebe04af3", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar ptoalla = valores[0];\nvar centimos = valores[1];\nvar ptotal=ptoalla;\nvar contador=1;\n\nwhile ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){\n\tcontador++;\n\tptotal=contador*ptoalla;\n}\nprint(contador);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4a93baaf6ec5311771675c2cf9f09402", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar ptoalla = valores[0];\nvar centimos = valores[1];\nvar ptotal=ptoalla;\nvar contador=1;\n\nwhile ((ptotal%10!=0)||((ptotal-centimos)%10!=0){\n\tcontador++;\n\tptotal=contador*ptoalla;\n}\nprint(contador);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2c2f2b0d01d003f70fe514503126d1fa", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar ptoalla = parseInt(valores[0]);\nvar centimos = parseInt(valores[1]);\nvar ptotal=ptoalla;\nvar contador=1;\n\nwhile ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){\n\tcontador++;\n\tptotal=contador*ptoalla;\n}\nprint(contador);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aa6f8437e733848c50a08b97872a277f", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar ptoalla = valores[0];\nvar centimos = valores[1];\nvar ptotal=ptoalla;\nvar contador=1;\n\nwhile (!(ptotal%10==0)||!((ptotal-centimos)%10==0){\n\tcontador++;\n\tptotal=contador*ptoalla;\n}\nprint(contador);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cf86db937b8399013e0b7d203b7686b5", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var arr = readline().split(\" \");\nvar n = +arr[0];\nvar k = +arr[1];\n\nvar arr = readline().split(\" \").map(function(v) {return +v;});\narr.sort(function(a,b) {return a-b;});\n\nvar res = [];\nfor(var i = 0; i < n; i++) {\n k-=arr[i];\n if(k>=0)\n res.push(arr[i]);\n else\n break;\n}\n\nprint(i);\nprint(res.join(\" \");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "11de6d21d9d4aef0d81af03c2205edd2", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var str[11];\nvar line = readline().split(' ');\nvar F = parseInt(line[0]), I = parseInt(line[1]), T = parseInt(line[2]);\nfor (var i = 0; i < F; i++) str[i] = readline();\nvar ans = 0;\n\tfor (var j = 0; j < I; j++){\n\t\tvar cnt = 0;\n\t\tfor (var i = 0; i < F; i++) if (str[i][j] == 'Y') cnt++;\n\t\tif (cnt >= T) ans++;\n\t}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "41b467b4f641a0a1c4018b50617c85d7", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var kitten,j,p,i,n,m,t,k=0,q=readline().split(' '),a=[];\nn=q[0];\nm=q[1];\nt=q[2];\nfor(i=0;i= T) ans++;\n\t}\nprint(ans)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d554394d963e46ee35919c0618f087cc", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var f,I,ans,t;\n var m=[];\n for (var i=0;i<100;i++) m.push(0);\n var s;\n var s1 = readLine();\n s1 = s1.split(' ');\n f = s1[0];\n I=s1[1];\n t=s1[2];\n for (var i=0;i=t) ans++;\n print(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "27f53ea4e67ad0224547349875bb74c1", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var inp = readline().split(' ').map(x => parseInt(x));\nvar S = [];\nfor(var i = 0; i < inp[0]; ++i){\n S.push(readline());\n}\n\nvar cnt = 0;\n\nfor(var i = 0; i < inp[1]; ++i){\n var l = 0;\n for(var j = 0; j < inp[0]; ++j){\n if (S[j][i] == 'Y')\n l++;\n }\n if (l >= inp[2])\n cnt++;\n \n}\n\nprint(cnt);\nprint(\ud83d\udc08);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7f8ce206dee81365eedadd73da1270e0", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "\n'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.replace(/\\s*$/, '')\n .split('\\n')\n .map(str => str.replace(/\\s*$/, ''));\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\n// Complete the coins function below.\nfunction coins(n) {\nvar pri=[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];\nvar ans=[];\nvar pridiv=[];\nvar div =[];\nvar g=0;\nvar t=1;\nfor(var i=0;i<=pri.length;i++){\n if(n%pri[i]==0) pridiv.push(pri[i]);\n}\nfor(var k=0;k lowerCase){\n print(word.toUpperCase());\n}\nelse{\n print(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f8b9635e88ac3cb10deab1aa8ef99c00", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "input = readline();\nlet upperCase =0 , lowerCase =0;\nfor (const ch of word){\n if (ch == ch.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n print(word.toUpperCase());\n}\nelse{\n print(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f396570eeae1382278d6b79be9b8bf50", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var word = readline();\nlet upperCase =0 , lowerCase =0;\nfor (let i=0;i lowerCase){\n print(word.toUpperCase());\n}\nelse{\n print(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "91b5ed52f163e1872572abad23e0fbef", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let word = \"HOUse\";\nlet upperCase =0 , lowerCase =0;\nfor (const ch of word){\n if (ch == ch.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n console.log(word.toUpperCase());\n}\nelse{\n console.log(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "93fa6efb2ab80794657859e792287d7b", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const transform = (text) => {\n \n let lowerCount = 0, upperCount =0;\n for(let i =0; i <= text.length; ++i){\n\n if(\"A\".charCodeAt(0) <= text.charCodeAt(i) && \"Z\".charCodeAt(0) >= text.charCodeAt(i) ){\n ++upperCount;\n } else {\n ++lowerCount;\n }\n }\n return (lowerCount < upperCount) ? text.toUpperCase() : text.toLowerCase();\n}\n\ntransform(readline())", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "49155778204a994ab4b693b71332821d", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let word = prompt();\nlet upperCase =0 , lowerCase =0;\nfor (const ch of word){\n if (ch == ch.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n console.log(word.toUpperCase());\n}\nelse{\n console.log(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ac9ef8db8e6fea98bd8591b8b3a970e7", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main{\n var n = readline();\n var u = 0;\n var l = 0;\n for (var j = 0; j < n.length; j++) {\n if isStringUpperCase(n[j]){\n u++;\n else:\n l++;\n }\n if(u > l) {\n print(toUpperCase(n));\n }\n else {\n print(toLowerCase(n))\n }\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0683314f940589cee3294e376e13cd07", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function transform (text) {\n \n let lowerCount = 0, upperCount =0;\n for(let i =0; i <= text.length; ++i){\n\n if(\"A\".charCodeAt(0) <= text.charCodeAt(i) && \"Z\".charCodeAt(0) >= text.charCodeAt(i) ){\n ++upperCount;\n } else {\n ++lowerCount;\n }\n }\n return (lowerCount < upperCount) ? text.toUpperCase() : text.toLowerCase();\n}\n\ntransform(readline())", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "742e1d51636c0455d06ecd8a0c12cc6f", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let word = readline();\nlet upperCase =0 , lowerCase =0;\nfor (const ch of word){\n if (ch == ch.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n print(word.toUpperCase());\n}\nelse{\n print(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dfda9e0220f684e19cd8e6f26b15158e", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let word = prompt(\"Enter a word\");\nlet upperCase =0 , lowerCase =0;\nfor (const char of word){\n if (char == char.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n alert(word.toUpperCase());\n}\nelse{\n alert(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "056b6c18aa57d9a3feaf8e4b71a85404", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let word = readLine();\nlet upperCase =0 , lowerCase =0;\nfor (const ch of word){\n if (ch == ch.toUpperCase()){\n upperCase ++;\n }\n else{\n lowerCase ++;\n }\n}\nif (upperCase > lowerCase){\n print(word.toUpperCase());\n}\nelse{\n print(word.toLowerCase());\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f5688e182119a9e2ba06b7772fecc5e1", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet colored = {C:true, M:true, Y: true};\nlet isColored = false;\nlet count = 0;\nlet n;\n\nrl.on('line', (input) => {\n //console.log(`Received: ${input}`);\n\n let arr = input.split(' ');\n if (!count) {\n n = +arr[0];\n }\n\n if (colored[arr[0]] || colored[arr[1]]) {\n isColored = true;\n done();\n rl.close();\n }\n\n //console.log(count, n);\n if (count === n) {\n done();\n rl.close();\n }\n count++;\n});\n\nfunction done() {\n let output = isColored? '#Color':'#Black&White';\n rl.write(output);\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bbaaee974d46e386baf78e0b5d76d8d7", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var dimentions = readline().split(' ').map(Number)\nvar rows = dimentions[0]\nvar columns = dimentions[1]\n\nvar ans = '#Black&White'\nfor (var i = 0; i < rows; i++) {\n var row = readline().split(' ')\u00b7\n for (var j = 0; j < columns; j++) {\n if (row[j] === 'C' || row[j] === 'M' || row[j] === 'Y') {\n ans = '#Color'\n break;\n }\n }\n if (ans === '#Color') {\n break;\n }\n}\n\nprint(ans)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f4ddf4250e0a45d320fab0f698bf71a3", "src_uid": "19c311c02380f9a73cd477e4fde27454", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const { readlink } = require(\"fs\");\n\nvar x = readline();\nvar n = 0;\n\nx.split('');\n\nfor (e of x) {\n n += Number(e);\n}\n\nprint(n);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "026ae0c85133b288afcc2fc025016b51", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var n,m,x;\nvar cnt[1024][5];\n\nvar line = readline().split('');\nn=line[0];\nm=line[1];\n \nfor(var i=0;i 0){\n\t\tn_mod = n % 10;\n\n\t\tif(n_mod > 1){\n\t\t\tbinary_number = (1 << binary_digit_count+1) - 1;\n\t\t} else if(n_mod == 1){\n\t\t\tbinary_number |= 1 << binary_digit_count;\n\t\t}\n\n\t\tbinary_digit_count++\n\n\t\tn = (n - n_mod) / 10;\n\t}\n\n\tprint binary_number;\n})(+readline());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "20750dc029e878f3814da71ab2af3b74", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nconst rem = (s, m) => {\n const n = s.length;\n if (n <= 10) return parseInt(s) % m;\n\n const first = s.slice(0, n-10);\n const second = s.slice(-10);\n return (rem(first, m) * ((10**10) % m) + parseInt(second) % m) % m;\n}\nconst div = (s, m) => {\n const n = s.length;\n if (n <= 10) return parseInt(parseInt(s) / m);\n\n const rem = parseInt(s.slice(0, 10)) % m\n const head = (parseInt(s.slice(0, 10)) - rem) / m;\n return `${head}${div(`${rem}${s.slice(10)}`, m)}`;\n}\n\nconst sub = (a, b) => {\n const subact = (A, B) => {\n const lA = A.length, lB = B.length;\n if (lA <= 9 && lB <= 9) return [ { value: parseInt(A) - parseInt(B), size: lA } ];\n if (lA < lB) return [ { value: -parseInt(B.slice(0, -lA)), size: lB - lA }, ...subact(B.slice(-lA), A) ];\n if (lA > lB) return [ { value: parseInt(A.slice(0, -lB)), size: lA - lB }, ...subact(A.slice(-lB), B) ];\n\n return [ { value: parseInt(A.slice(0, 9)) - parseInt(B.slice(0, 9)), size: 9 }, ...subact(A.slice(9), B.slice(9)) ]\n }\n\n let x = subact(a, b);\n x = x.slice(x.findIndex(i => i.value));\n if (!x.length) return '0';\n\n let t = '';\n if (x[0] < 0) { t = '-'; x = x.map(i => -i); }\n\n for (let i = 1; i < x.length; i++) {\n if (x[i].value < 0) { x[i-1].value -= 1; x[i].value = 10**10 + x[i].value; }\n }\n return t + x.map(i => `${'0'.repeat(i.size)}${i.value}`.slice(-i.size)).join('').replace(/^0+/, '') || '0';\n}\n\n\nconst problem = (n, p, w, d) => {\n let Y = -1;\n const W = parseInt(w);\n while (++Y < W && rem(p, w)) p = sub(p, d);\n console.log(n, '[', p, w, div(p, w), ']', Y );\n const z = sub(sub(n, div(p, w)), `${Y}`);\n if (Y === W) return -1; // || (p|z) < 0\n console.log(Y, p, z);\n return `${div(p, w)} ${Y} ${z}`;\n}\n\nconst npwd = readline().split(' ');\nwrite(problem(npwd[0], npwd[1], npwd[2], npwd[3]));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1b8550b3ea58c4a0ba2b0d89eb3fd37f", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.0} {"lang": "JavaScript", "source_code": "\n\nvar firstLine = readline();\nprint('\\n');\n\nvar args = firstLine.split(' ');\n\nlet count = 0;\nlet numRez = firstLine.split(' ')[0];\nlet res = [];\n\nprint(getRezult(numRez));\n\nfunction getRezult (num) {\n var input = `${num}`;\n var parse = [];\n var sum = 0;\n parse.push(+input);\n debugger;\n for (var i =0; i < input.length; i++) {\n parse.push(+input[i]);\n }\n\n for (var j =0; j < parse.length; j++) {\n sum += parse[j];\n }\n\n if(sum == numRez) {\n res.push(input);\n } else {\n count++;\n }\n\n if (count == numRez) {\n return 0;\n }\n getRezult(--input);\n\n return res;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8db9c58f7b855231557425555cb7158a", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "/*var inputVedraDlinna = prompt(\"Enter dlinna koli4estvo veder i dlinna sada \").split(' ');\nvar koli4estvoVeder = inputVedraDlinna[0];\nvar dlinnaSada = inputVedraDlinna[1];\n\nvar otrezkiZemli = prompt(\"Otrzli zemli\").split(' ');\n\nvar r = Math.max()\nconsole.log(koli4estvoVeder, dlinnaSada);\nalert(otrezkiZemli);\n*/\n/*var n = prompt(\"dannue\")\n\n\nfunction getNumbersSum(num){\n return num.toString().split('').reduce(function(a, b) {\n return +a + +b;\n \n })\n\n }\n \ngetNumbersSum(n);\n*/\n/*var n = prompt(\"ented digit\");\n\nfor (i = 1 ; i < n; i++){\nvar res = n/2 + i;\n\nconsole.log(res);\n}\n\n/*function getSumNumber(num) {\n var sum = 0, tmp;\n\n while (num) {\n tmp = num % 10;\nnum = (num - tmp) / 10;\nsum += tmp;\n }\n return sum;\n }\nalert(n + getSumNumber(n));\n */\n\n var n = readline(); //+prompt(\"dsfs\");\n var resultArr = [];\n \n for (let i = Math.floor(n / 2); i < n; i++) {\n const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);\n const resultSum = i + sumOfDigits;\n //console.log(resultSum);\n if (resultSum === n) {\n resultArr.push(i);\n }\n }\n print(resultArr.length);\n print(resultArr.toString().replace(',', ' '));\n //console.log(resultArr.length);\n //console.log(resultArr.toString().replace(',', ' '));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "791ac8147dc743e48e73da431cf7d486", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "/*var n = prompt(\"enter digit\");\n\nfor (i = n/2 ; i < n; i++){\n function getSumNumber(i) {\n var sum = 0, tmp;\n while (i) {\n tmp = i % 10;\ni = (i - tmp) / 10;\nsum += tmp;\n }\n return Math.trunc(sum);\n \n }\n \nalert(getSumNumber(i));\n}\n /*var n = prompt(\"ented digit\");\n\nfor (i = 1 ; i < n; i++){\nvar res = n/2 + i;.\n\nconsole.log(res);\n\n}\n*/\nconst n = readline(); //prompt(\"olo\");\nconst resultArr = [];\n\nfor (let i = Math.floor(n / 2); i < n; i++) {\n const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);\n const resultSum = i + sumOfDigits;\n if (resultSum === n) {\n resultArr.push(i);\n }\n}\nprint(resultArr.length);\npreint(resultArr.toString().replece(',', ' '));\n//console.log(resultArr.length);\n//console.log(resultArr.toString().replace(',', ' '));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "729b19c943d64a2b581991a22fb1064b", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "\n\nvar firstLine = readline();\n\nvar args = firstLine.split(' ');\n\nvar count = 0;\nvar numRez = firstLine.split(' ')[0];\nvar res = [];\nlet rezult = getRezult(numRez)\n\nprint(rezult.length);\nprint(rezult);\n\nfunction getRezult (num) {\n var input = `${num}`;\n var parse = [];\n var sum = 0;\n parse.push(+input);\n debugger;\n for (var i =0; i < input.length; i++) {\n parse.push(+input[i]);\n }\n\n for (var j =0; j < parse.length; j++) {\n sum += parse[j];\n }\n\n if(sum == numRez) {\n res.push(input);\n } else {\n count++;\n }\n\n if (count == numRez) {\n return 0;\n }\n getRezult(--input);\n\n return res;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b27c4418d9557978ee82b9b0f672eb53", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "'use strict';\nvar num = parseInt(readline()), \nvar res = new Array;\nfor (var i = num - 9*num.toString().length; i = 1) {\nfor (var i = num - 9*numLength; i a + b, 0);\n var resultSum = i + sumOfDigits;\n //console.log(resultSum);\n if (resultSum === n) {\n resultArr.push(i);\n }\n }\n print(resultArr.length);\n print(resultArr.toString().replace(',', ' '));\n //console.log(resultArr.length);\n //console.log(resultArr.toString().replace(',', ' '));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "ceb6b4ef2e9956585be92b339614a9ea", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n\n\n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "819196d2afb86c805fafef7fcb709993", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": " var n = readline(); //+prompt(\"dsfs\");\n var resultArr = [];\n \n for (let i = Math.floor(n / 2); i < n; i++) {\n var sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);\n var resultSum = i + sumOfDigits;\n //console.log(resultSum);\n if (resultSum === n) {\n resultArr.push(i);\n }\n }\n print(resultArr.length);\n print(resultArr.toString().replace(',', ' '));\n //console.log(resultArr.length);\n //console.log(resultArr.toString().replace(',', ' '));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "891f449e50204f33e7cc323e3c72b3f3", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function(n){\n var i;\n var k = 0;\n var s = [];\n var m = [];\n s = n.toString().split('');\n n < 18 ? i = n : i = 9 * s.length;\n var p;\n while(i >= 0){ \n var p = n - i;\n var t = p;\n while(p){\n t += (p % 10);\n p = Math.floor(p / 10);\n }\n if(t === n){\n m.push(n - i);\n k++;\n }\n i--;\n }\n print(k);\n for(var e of m)\n print(e);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "eef84cd150f4c67d5a26ebfa379f292a", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "/*var n = prompt(\"enter digit\");\n\nfor (i = n/2 ; i < n; i++){\n function getSumNumber(i) {\n var sum = 0, tmp;\n while (i) {\n tmp = i % 10;\ni = (i - tmp) / 10;\nsum += tmp;\n }\n return Math.trunc(sum);\n \n }\n \nalert(getSumNumber(i));\n}\n /*var n = prompt(\"ented digit\");\n\nfor (i = 1 ; i < n; i++){\nvar res = n/2 + i;.\n\nconsole.log(res);\n\n}\n*/\nconst n = readline(); //prompt(\"olo\");\nconst resultArr = [];\n\nfor (let i = Math.floor(n / 2); i < n; i++) {\n const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);\n const resultSum = i + sumOfDigits;\n if (resultSum === n) {\n resultArr.push(i);\n }\n}\nprint(resultArr.length);\nprint(resultArr.toString().replece(',', ' '));\n//console.log(resultArr.length);\n//console.log(resultArr.toString().replace(',', ' '));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "68acc6c7502531e21b8d6d5dac4c2eee", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var x = parseInt(readline()),\n y = parseInt(readline()),\n z = parseInt(readline());\n print(Math.max( x*y*z , (x+y)*z , x*(y+z) , x+y+z)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3c96301da8fdbb6fb2761b58c881795e", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = readline();\nvar b = readline();\nvar c = readline();\nvar max = 0;\nvar abc = [a,b,c];\nfor (i in abc){\nabc[i]=parseInt(abc[i]);\nabc.sort(mySort);\nif (abc[2]!==1){\nif(abc[1]+abc[0]>=abc[1]*abc[0]){\n\tmax = abc[2]*(abc[1]+abc[0]);}\nelse max = abc[2]*(abc[1]*abc[0]);\n}\nelse max = abc[0]+abc[1]+abc[2];\nprint(max);\nfunction mySort(a, b){return a-b;}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "9a289775937d30edc02b4b7a31bf431a", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var res =0; \nfor (var i=0; i<3; i++){\n\tvar n = readline();\n if (res==0);\n\tres+=Number(n);\n\telse if (res==1)\n\t\tres+=Number(n);\n\telse if res*=Number(n);\n}\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3fb1848cf91fac1d3f740137b2b888aa", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = parseInt(readline());\nvar b = parseInt(readline());\nvar c = parseInt(readline());\n\nprint(Math.max(a + b + c, (a + b) * c, a * (b + c), a * b * c);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "626763da023380cf68ef697b07cecc34", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = readline();\nvar b = readline();\nvar c = readline();\nvar max = 0;\nvar abc = [a,b,c];\nfor (i in abc){\nabc[i]=parseInt(abc[i]);\n}\nabc.sort(mySort);\nif (abc[2]!==1){\nif(abc[1]+abc[0]>=abc[1]*abc[0]){\n\tmax = abc[2]*(abc[1]+abc[0]);}\nelse max = abc[2]*(abc[1]*abc[0]);\n}\nelse max = abc[0]+abc[1]+abc[2];\nprint(max);\nfunction mySort(a, b){return a-b;}\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7028e419ae292f5abae9a715cdf0704d", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n\n \n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "612aa0f7d61cd8fc4a5cb8ea0f7f5df4", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "\nfunction findDelayCount(delay,alarmTime){\n let hour = Number(alarmTime.split(' ')[0]),\n min = Number(alarmTime.split(' ')[1]),\n delayCounter = 0; \n\n for(let i = 0; true; i++){\n let time = hour.toString() + ':' + min.toString();\n if(time.search('7') > 0){\n delayCounter = i;\n break;\n }\n else{\n if(min>=delay){\n min -= delay;\n }\n else{\n min += 60 - delay;\n if(hour==0){\n hour = 23;\n }else{\n hour--;\n }\n }\n }\n }\n console.log(delayCounter);\n return delayCounter;\n}\n\nfindDelayCount(\"3\", \"15 23\");\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5d249dbe615e22a831aadbb3d90f4c88", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let minuteInterval = readline();\nlet entereTime = readline().split(' ').map(minuteInterval function(+minuteInterval));\nlet stopActionCount = 0;\nlet n = entereTime[0]*60+entereTime[1]\nlet res = function () {\n while (7) {\n if (`${Math.round(n/60)}${n%60}`.indexOf('7')>=0)\n return stopActionCount;\n else\n n = n >= minuteInterval ? n - minuteInterval : n - minuteInterval + 24*60;\n y++;\n }\n}\nprint(res());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "af2554d5cc1b42201f14b87d5eac622e", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "/* eslint-disable */\nrequire('dotenv').config();\n\nrequire('babel-polyfill');\nconst babel = require('babel-loader');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst webpack = require('webpack');\nconst path = require('path');\nconst WebpackNotifierPlugin = require('webpack-notifier');\nconst CleanWebpackPlugin = require('clean-webpack-plugin');\nconst UglifyJSPlugin = require('uglifyjs-webpack-plugin');\n\nconst port = process.env.PORT || 5001;\nconst proxyUrl = process.env.PROXY_URL || 'http://localhost:5000';\n\nconst DEBUG = process.env.NODE_ENV !== 'production';\n\nlet config = {\n distPath : path.join(__dirname, 'public'),\n srcPath : path.join(__dirname, 'front/src/app')\n};\n\nlet appEntries = [\n 'babel-polyfill',\n `${config.srcPath}/index.tsx`\n];\n\nif(process.env.NODE_ENV !== 'production') {\n [].unshift.apply(appEntries, [\n 'webpack-dev-server/client?http://localhost:' + port,\n 'webpack/hot/only-dev-server'\n ])\n} else {\n console.log(process.env.NODE_ENV)\n}\n\n/*{\n test: /\\.tsx?$/,\n enforce: 'pre',\n loader: 'tslint-loader'\n},*/\n\nlet moduleRules = [\n {\n use : DEBUG ? ['react-hot-loader/webpack', 'babel-loader', 'ts-loader'] : [ 'babel-loader', 'ts-loader' ],\n test : /\\.tsx?$/,\n exclude: /(node_modules)/\n },\n {\n loader: 'html-loader',\n test : /\\.html?$/\n },\n {\n test: /\\.scss$/,\n use: [\"style-loader\", \"css-loader\", \"sass-loader\"]\n },\n {\n test: /\\.css$/,\n loader: \"style-loader!css-loader\"\n },\n {\n test: /\\.(woff|woff2)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n loader: 'url-loader?limit=10000&mimetype=application/font-woff'\n },\n {\n test: /\\.ttf(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n loader: 'url-loader?limit=10000&mimetype=application/octet-stream'\n },\n {\n test: /\\.eot(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n loader: 'file-loader'\n },\n {\n test: /\\.(jpe?g|png|gif|svg|ico)$/i,\n use: [\n 'file-loader?name=[hash].[ext]'\n ]\n }\n];\n\nconst plugins = [\n new CleanWebpackPlugin([config.distPath], {verbose:true}),\n new webpack.DefinePlugin({\n 'process.env': {\n 'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),\n 'STRIPE_KEY': JSON.stringify(process.env.STRIPE_PUBLISH_KEY || 'pk_test_GrMRPRZI9vLTKBFG5NybQx6Z'),\n 'WIDGET_URL': JSON.stringify(process.env.WIDGET_URL || 'https://brands-widget.klickly.com')\n }\n }),\n new webpack.HotModuleReplacementPlugin(),\n new webpack.LoaderOptionsPlugin({\n debug: true\n }),\n new HtmlWebpackPlugin({\n //favicon: 'front/app/favicon.ico',\n template: path.join(config.srcPath, 'index.html')\n }),\n new WebpackNotifierPlugin({alwaysNotify: true})\n];\n\nif (!DEBUG) {\n plugins.push(\n new UglifyJSPlugin({\n uglifyOptions: {\n compress: true,\n warnings: false,\n comments: false,\n }\n })\n )\n}\n\nmodule.exports = {\n resolve: {\n extensions: ['.ts', '.tsx', '.js', '.jsx', 'scss']\n },\n entry : {\n app: appEntries\n },\n output : {\n filename : '[name].bundle-[hash:4].js',\n sourceMapFilename: '[name].bundle-[hash:4].map',\n path : config.distPath,\n publicPath : '/'\n },\n\n devServer: {\n port: port,\n proxy: [{\n context: ['/api/**'],\n changeOrigin: true,\n target: proxyUrl,\n secure: false\n }]\n },\n\n devtool: 'source-map',\n\n module: {\n rules: moduleRules\n },\n\n plugins: plugins\n};\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a2e082f05518b33e4d373c8800583e8b", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let minuteInterval = readline();//prompt(\"enter minute interval\");\nlet entereTime = readline().split(' ').map(minuteInterval => +minuteInterval);//prompt(\"enter HH, MM\").split(' ').map(minuteInterval => +minuteInterval);\nlet stopActionCount = 0;\nlet time = entereTime[0]*60+entereTime[1];\n\nlet res = function () {\n while (true) {\n if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){\n return stopActionCount;\n }\n else {\n time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;\n stopActionCount++;\n}\n }\n}\nprint(res());//alert(res());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e2f9b2d6dcd7305c29644b83c1959d76", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let minuteInterval = readline();//prompt(\"enter minute interval\");\nlet entereTime = readline().split(' ').map(minuteInterval => +minuteInterval);//prompt(\"enter HH, MM\").split(' ').map(minuteInterval => +minuteInterval);\nlet stopActionCount = 0;\nlet time = entereTime[0]*60+entereTime[1];\n\nlet res = function () {\n while (true) {\n if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){\n return stopActionCount;\n }\n else {\n time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;\n stopActionCount++;\n}\n }\n}\npprint(res());//alert(res());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "009e4610a07b85c91f580bfa5bfc5882", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "getAlarmCount = (delay, hours, minutes) => {\n let counter = 0;\n while (!this.isHappy(hours, minutes)) {\n counter++;\n minutes -= delay;\n if (minutes < 0) {\n minutes += 60;\n hours--;\n if (hours < 0) hours = 23;\n }\n }\n return counter;\n};\n\nisHappy = (h, m) => h.toString().includes(\"7\") || m.toString().includes(\"7\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e16e318fbdfa24d92ff5688f07c1ebe4", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let x = +readline(), y = 0, [h, m] = readline().split(' ').map(s => +s);\nfor (; !`${h}${m}`.match(/7/); y++, m -= x)\n if (m < 0) m += 60, h = h ? h - 1 : 24;\nprint(y);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fe355e2af37eccc35c760d13680c263b", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "'use strict';\n\nconst hh = +prompt('Hours');\nconst yy = +prompt('Minuts');\nconst x = +prompt('Interval');;\n\nconst rezult = getRezult(hh, yy, x);\nalert(rezult);\n\nfunction getRezult (hh, yy, x) {\n const maxTime = 60 * 24 / x;\n let count = 0;\n let hours = hh;\n let min = yy;\n\n for (let i = 0; i < maxTime; i++) {\n const newTime = changeTime(hours, min, x);\n if (getHappyTime(hours, min)) {\n return count;\n } else {\n ++count;\n }\n hours = newTime.hh;\n min = newTime.yy ;\n }\n \n return \"more than 1 day\";\n}\n\nfunction getHappyTime (hh, yy) {\n const time = `${hh}:${yy}`;\n return time.includes('7');\n}\n\nfunction changeTime (hh, yy, x) {\n if ( yy - x < 0) {\n hh = getChangedH(hh);\n }\n yy = yy >= x ? yy - x : 60 + yy - x;\n\n return {hh, yy};\n}\n\n function getChangedH (hh,) {\n return hh - 1 < 0 ? 23 : --hh;\n }", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e00884fb7e14c85c35021f25f65f4d41", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "let minuteInterval = prompt(\"enter minute interval\");\nlet entereTime = prompt(\"enter HH, MM\").split(' ').map(minuteInterval => +minuteInterval);\nlet stopActionCount = 0;\nlet time = entereTime[0]*60+entereTime[1];\n\nlet res = function () {\n while (true) {\n if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){\n return stopActionCount;\n }\n else {\n time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;\n ++stopActionCount;\n}\n }\n}\nalert(res());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "56d6da730547b2fae083d28680086ae0", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "const input = require('fs').readFileSync('/dev/stdin', 'utf8');\nconst table = input.split('\\n').filter((e) => e.length > 0).map((row) => row.split(''));\n\nconst score = [\n [3, 3, 0, 4, 4, 0, 3, 3],\n [3, 3, 0, 4, 4, 0, 3, 3],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [1, 1, 0, 2, 2, 0, 1, 1],\n [1, 1, 0, 2, 2, 0, 1, 1]\n];\n\nlet maxi = -1, maxj = -1, max = 0;\nfor(let i = 0; i < 6; i++) {\n for(let j = 0; j < 8; j++) {\n if(table[i][j] == '.') {\n if(max < score[i][j]) {\n max = score[i][j];\n maxi = i;\n maxj = j;\n }\n }\n }\n}\n\ntable[maxi][maxj] = 'P';\nconsole.log(table.map((row) => row.join('')).join('\\n'));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c339b4b91372e9c664f4ae6db7ef587d", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "const C = [\n [3, 3, 0, 4, 4, 0, 3, 3],\n [3, 3, 0, 4, 4, 0, 3, 3],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [1, 1, 0, 2, 2, 0, 1, 1],\n [1, 1, 0, 2, 2, 0, 1, 1]\n]\nconst n = 6\nconst m = 8\nlet a = []\nfor (let i = 0; i < n; i++) {\n a.push(readline().split(''))\n}\n\nlet x = -1, y = -1, mx = -1\n\nfor (let i = 0; i < n; i++) {\n for (let j = 0; j < m; j++) {\n if (a[i][j] != '.') continue\n let c = C[i][j]\n if (c > mx) {\n mx = c\n x = i\n y = j\n }\n }\n}\n\na[x][y] = 'P'\nfor (let i = 0; i < n; i++) {\n print(a[i].join(''))\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2260522bbaef97a41148d056a3d9f7b3", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "let table = [];\nfor(let i = 0; i < 6; i++) {\n table[i] = readline().split('')\n}\n\nconst score = [\n [3, 3, 0, 4, 4, 0, 3, 3],\n [3, 3, 0, 4, 4, 0, 3, 3],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [2, 2, 0, 3, 3, 0, 2, 2],\n [1, 1, 0, 2, 2, 0, 1, 1],\n [1, 1, 0, 2, 2, 0, 1, 1]\n];\n\nlet maxi = -1, maxj = -1, max = 0;\nfor(let i = 0; i < 6; i++) {\n for(let j = 0; j < 8; j++) {\n if(table[i][j] == '.') {\n if(max < score[i][j]) {\n max = score[i][j];\n maxi = i;\n maxj = j;\n }\n }\n }\n}\n\ntable[maxi][maxj] = 'P';\nconsole.log(table.map((row) => row.join('')).join('\\n'));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c04db04599f5abbd475fbf22c7c87677", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": " class Program\n {\n static void Main(string[] args)\n {\n string str = System.Console.ReadLine().ToString();\n int n = Convert.ToInt32(str[0]);\n int k = Convert.ToInt32(str[1]);\n k = k * 2 - 1;\n System.Console.Write(k <= n ? k : k - n + (n % 2==0 ? 0 : 1));\n }\n }\n ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "81a885567762adeb91d901efa34ea08c", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var str = readline().split(\" \");\nvar n = +str[0]; var k = +str[1]; \nvar res = 0;\nif (n/2>k){\n\tfor (var i=1; i<+n; i++){\t\n\t\t\tif(i%2!=0)\n\t\t\t\tres++;\n\t\t\n\t\tif (res==k){\n\t\t\t\tprint(i);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t}\n}\nelse (n/2 {\n var currentNumber = 1;\n var someArray = [];\n if (lastNumber % 2 === 0) {\n lastNumber += 1;\n }\n for(let i = 1; i <= needNumber; i++) {\n someArray.push(currentNumber);\n currentNumber += 2;\n if (currentNumber === lastNumber) {\n someArray.push(currentNumber);\n currentNumber = 2;\n }\n if (someArray.length === needNumber) {\n break;\n }\n }\n return currentNumber;\n};\nevenAndOdd();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a53c7aa7ddbb127c9f44bfabd680d60a", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "const evenAndOdd = (lastNumber, needNumber) => {\n var currentNumber = 1;\n var someArray = [];\n if (lastNumber % 2 === 0) {\n lastNumber += 1;\n }\n for(let i = 1; i <= needNumber; i++) {\n someArray.push(currentNumber);\n currentNumber += 2;\n if (currentNumber === lastNumber) {\n someArray.push(currentNumber);\n currentNumber = 2;\n }\n if (someArray.length === needNumber) {\n break;\n }\n }\n return currentNumber;\n};", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "25410a582ffb7ff012c6044ae7b5c491", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "\n\n \n \n \n\n \n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6c684fd87e7d5ef059aaa9e46f3116ca", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let n = Number(readline());\nlet p = readline().split(' ').map(Number);\n\n// let n = 6;\n// let p = [1, 2, 6];\n\n// let n = 10;\n// let p = [1, 2, 3, 4, 5];\n\nlet b = 0,\n\tw = 0;\n\np.map((p, j) => {\n\tb += Math.abs(p - ((j + 1)*2 - 1));\t\n\tw += Math.abs(p - (j + 1)*2);\n})\n\n// console.log(b, w);\n\n// console.log(b > w ? w : b);\n\nprint(b > w ? w : b);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b9a8029e968b347616c617180e269900", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = readline().split(\" \").map(function(v) {return +v;});\n\nvar a = arr[0];\nvar b = arr[2];\nvar c = arr[1];\nvar d = arr[3];\n\nfunction score(a,b) {\n return Math.max(3*a/10, a-a*b/250);\n}\n\nif(score(a,b)>score(c,d))\n print(\"Misha\");\nelse if(score(a,b)===score(c,d));\n print(\"Tie\");\nelse\n print(\"Vasya\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e81b91e5f3bb6ddc3c2e6938eae65938", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "const n = +readline();\n\nfunction solve(n) {\n if (n % 2 === 0) {\n return n / 2;\n }\n \n const square = Math.sqrt(n);\n let d = 3;\n let smallestDivisor = n;\n while (d < square) {\n if (n % d === 0) {\n smallestDivisor = d;\n break;\n }\n d += 2;\n }\n\n return n / smallestDivisor;\n}\n\nwrite(solve(n));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "33bb1b5c568e23b14cf30ff5d9e8ee01", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function firstPrimeDivisorExcept2(x) {\n for (let i = 3; i <= Math.sqrt(x); i+=2) {\n if (x % i === 0) return i;\n }\n}\n\nfunction run(input) {\n if (input % 2 === 0) return print(input / 2);\n const prime = firstPrimeDivisorExcept2(input);\n return (input - prime) / 2;\n}\n\nprint(run(parseInt(readline())));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bfd43f5e52e074a103f230b485fc0cf8", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "const n = +readLine();\n\nfunction solve(n) {\n if (n % 2 === 0) {\n return n / 2;\n }\n \n const square = Math.sqrt(n);\n let d = 3;\n let smallestDivisor = n;\n while (d < square) {\n if (n % d === 0) {\n smallestDivisor = d;\n break;\n }\n d += 2;\n }\n\n return n / smallestDivisor;\n}\n\nsolve(n);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "49905d76274074f1552565ed76e820e4", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function main(n,m) {\n\n var ans = 2**n;\n // if(n > 1){\n // for(var i = 0 ; i < n ; i++)ans *= 2;\n // }\n ans = m%ans;\n print(ans);\n}\n\n//\nvar n = parseInt(readline());\nvar m = parseInt(readline());\n\nmain(n,m);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5560d100d92c8a60778de09fa2255ccb", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main(n,m) {\n\n print(m%(2**n));\n}\n\nvar n = parseInt(readline());\nvar m = parseInt(readline());\n\nmain(n,m);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5357529613ce91081c902307d27d359e", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main(n,m) {\n\n var ans = 2 ** n;\n ans = m%ans;\n print(ans);\n}\n\n\nvar n = parseInt(readline());\nvar m = parseInt(readline());\n\nmain(n,m);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f2680bfee36e70bf41afb34acc67930c", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n\n// Basic JavaScript BN library - subset useful for RSA encryption.\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = (canary & 0xffffff) == 0xefcafe;\n\n// (public) Constructor\nfunction BigInteger(a, b, c) {\n if (a != null)\n if ('number' == typeof a) this.fromNumber(a, b, c);\n else if (b == null && 'string' != typeof a) this.fromString(a, 256);\n else this.fromString(a, b);\n}\n\n// return new, unset BigInteger\nfunction nbi() {\n return new BigInteger(null);\n}\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff,\n xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff,\n xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n}\nif (j_lm && navigator.appName == 'Microsoft Internet Explorer') {\n BigInteger.prototype.am = am2;\n dbits = 30;\n} else if (j_lm && navigator.appName != 'Netscape') {\n BigInteger.prototype.am = am1;\n dbits = 26;\n} else {\n // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\n\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\n// Digit conversions\nvar BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';\nvar BI_RC = new Array();\nvar rr, vv;\nrr = '0'.charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;\nrr = 'a'.charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\nrr = 'A'.charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;\n\nfunction int2char(n) {\n return BI_RM.charAt(n);\n}\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return c == null ? -1 : c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];\n r.t = this.t;\n r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = x < 0 ? -1 : 0;\n if (x > 0) this[0] = x;\n else if (x < -1) this[0] = x + this.DV;\n else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 256) k = 8;\n else if (b == 2)\n // byte array\n k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length,\n mi = false,\n sh = 0;\n while (--i >= 0) {\n var x = k == 8 ? s[i] & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == '-') mi = true;\n continue;\n }\n mi = false;\n if (sh == 0) this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = x >> (this.DB - sh);\n } else this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c) --this.t;\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n if (this.s < 0) return '-' + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = '',\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : '0';\n}\n\n// (public) -this\nfunction bnNegate() {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n}\n\n// (public) |this|\nfunction bnAbs() {\n return this.s < 0 ? this.negate() : this;\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n var r = this.s - a.s;\n if (r != 0) return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0) return this.s < 0 ? -r : r;\n while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r;\n return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1,\n t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n if (this.t <= 0) return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];\n for (i = n - 1; i >= 0; --i) r[i] = 0;\n r.t = this.t + n;\n r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) r[i - n] = this[i];\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB),\n c = (this.s << bs) & this.DM,\n i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (i = ds - 1; i >= 0; --i) r[i] = 0;\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n var i = 0,\n c = 0,\n m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n } else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = c < 0 ? -1 : 0;\n if (c < -1) r[i++] = this.DV + c;\n else if (c > 0) r[i++] = c;\n r.t = i;\n r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0) r[i] = 0;\n for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n r.s = 0;\n r.clamp();\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = (r.t = 2 * x.t);\n while (--i >= 0) r[i] = 0;\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if (\n (r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >=\n x.DV\n ) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) return;\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0);\n if (r != null) this.copyTo(r);\n return;\n }\n if (r == null) r = nbi();\n var y = nbi(),\n ts = this.s,\n ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n } else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0) return;\n var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt,\n d2 = (1 << this.F1) / yt,\n e = 1 << this.F2;\n var i = r.t,\n j = i - ys,\n t = q == null ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys) y[y.t++] = 0;\n while (--j >= 0) {\n // Estimate quotient digit\n var qd =\n r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n // Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd) r.subTo(t, r);\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) BigInteger.ZERO.subTo(q, q);\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n if (ts < 0) BigInteger.ZERO.subTo(r, r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n return r;\n}\n\n// Modular reduction using \"classic\" algorithm\nfunction Classic(m) {\n this.m = m;\n}\nfunction cConvert(x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);\n else return x;\n}\nfunction cRevert(x) {\n return x;\n}\nfunction cReduce(x) {\n x.divRemTo(this.m, null, x);\n}\nfunction cMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\nfunction cSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n}\n\nClassic.prototype.convert = cConvert;\nClassic.prototype.revert = cRevert;\nClassic.prototype.reduce = cReduce;\nClassic.prototype.mulTo = cMulTo;\nClassic.prototype.sqrTo = cSqrTo;\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n if (this.t < 1) return 0;\n var x = this[0];\n if ((x & 1) == 0) return 0;\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - (x * y) % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return y > 0 ? this.DV - y : -y;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n while (\n x.t <= this.mt2 // pad x so am has enough room later\n )\n x[x.t++] = 0;\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 =\n (j * this.mpl +\n (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) &\n x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (protected) true iff this is even\nfunction bnpIsEven() {\n return (this.t > 0 ? this[0] & 1 : this.s) == 0;\n}\n\n// (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\nfunction bnpExp(e, z) {\n if (e > 0xffffffff || e < 1) return BigInteger.ONE;\n var r = nbi(),\n r2 = nbi(),\n g = z.convert(this),\n i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0) z.mulTo(r2, g, r);\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n}\n\n// (public) this^e % m, 0 <= e < 2^32\nfunction bnModPowInt(e, m) {\n var z;\n if (e < 256 || m.isEven()) z = new Classic(m);\n else z = new Montgomery(m);\n return this.exp(e, z);\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.isEven = bnpIsEven;\nBigInteger.prototype.exp = bnpExp;\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.modPowInt = bnModPowInt;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\nfunction main() {\n var nums = readline().split(' ');\n var decimal = `${String(\n new BigInteger(Number(nums[0])).divide(new BigInteger(Number(nums[1]))),\n ).slice(2)}0`;\n var c = nums[2];\n\n // console.log('decimal', decimal);\n // console.log(decimal.indexOf(c));\n\n print(decimal.indexOf(c) + 1);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f9ad5d55bdf64f2309e914d0598f05de", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function main() {\n var nums = readline().split(' ');\n var decimal = `${String(\n parseFloat(Number(nums[0])).toPrecision(12) /\n parseFloat(Number(nums[1])).toPrecision(12),\n ).slice(2)}0`;\n var c = nums[2];\n\n // console.log('decimal', decimal);\n // console.log(decimal.indexOf(c));\n\n print(decimal.indexOf(c) + 1);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "576b68782dc7da54ed53ce726340af2a", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var a = readline().split(\" \").map(function(firstLine) { return parseInt(firstLine); });\n\n\nfunction calc (a, b) {\n\tvar res = 0;\n \n\tfor(var i=a; i\n\n \n \n \n Document\n \n \n \n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4a9fb93661033397348b7f3012602154", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main(){\n var n = readline();\n var s = readline();\n var ot = \"YES\"\n if n.length == s.length{\n for (var j = 0; j < n.length; j++){\n if(s[i] != n[n.length - i-1])ot = \"NO\";\n }\n }\n else print(\"NO\");\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6192654159b580259cd4f6d7ca00b00d", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var s1=readline();\nvar s2=readline();\nvar k=true;\n s2.reverse();\n for(var i=0;i R){print(\"NO\");\n if(R == r && parseInt(nRr[0]) <= 1){print(\"YES\"); return;}\n else if (R == r && parseInt(nRr[0]) > 1){print(\"NO\"); return;}\n var max = (2*Math.PI) / Math.acos((-2*Math.pow(r, 2) + Math.pow((R-r), 2)) / Math.pow((R-r), 2));\n if(parseInt(nRr[0]) <= Math.floor(max)){print(\"YES\");}\n else {print(\"NO\");}\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "568017a9a18fc99d926cdd74cc186a0a", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "function main()\n{\n var nRr = readline();\n nRr = nRr.split(\" \");\n var R = parseInt(nRr[1]);\n var r = parseInt(nRr[2]);\n if(r > R){print9\"NO\");\n if(R == r && parseInt(nRr[0]) <= 1){print(\"YES\"); return;}\n else if (R == r && parseInt(nRr[0]) > 1){print(\"NO\"); return;}\n var max = (2*Math.PI) / Math.acos((-2*Math.pow(r, 2) + Math.pow((R-r), 2)) / Math.pow((R-r), 2));\n if(parseInt(nRr[0]) <= Math.floor(max)){print(\"YES\");}\n else {print(\"NO\");}\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b2123aa4f4cbc06895a47314184067fe", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "str = readline();\nprint(str);\nlet q = 0;\nlet qa = 0;\nlet qaq = 0;\nfor (let i=0; i < str.length; i++) {\n\tif (str[i] === 'Q') {\n\t\tq++;\n\t}\n\tif (q > 0 && str[i] == 'A') {\n\t\tqa+= q;\n\t}\n\tif (qa > 0 && str[i] === 'Q') {\n\t\tqaq+= qa;\n\t}\n}\nprint(qaq);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c3cd275c70e97a5e247cc3130da6b3b1", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "str = readline();\nlet q = 0;\nlet qa = 0;\nlet qaq = 0;\nfor (let i=0; i < str.length; i++) {\n\tif (str[i] === 'Q') {\n\t\tq++;\n\t}\n\tif (q > 0 && str[i] == 'A') {\n\t\tqa+= q;\n\t}\n\tif (qa > 0 && str[i] === 'Q') {\n\t\tqaq+= qa;\n\t}\n}\nprint(qaq);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e164293178a28623417fbca7119a12aa", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main(){\n\nvar line = readline().split('').map(Number);\nvar n = line[0];\n\nvar cancount = 1;\nvar person = 0;\nvar round = 1;\nvar roundcans = 0;\nvar ppround = 5;\n\nwhile(cancount<=n){\n if(cancount === n){\n\tprintf('Sheldon');\n\treturn;\n }\n cancount+=ppround;\n round+=1;\n ppround *=2;\n}\n\nppround /=2;\ncancount-=ppround;\nround-=1;\ncancount-=1;\nint cpr = 1;\n\nfor(i=1;icpr){\n\tperson+=1;\n\troundcans=1;\n }\n}\n\nif(person===0){\n print('Sheldon');\n return;\n}\n\nif(person === 1){\n print('Leonard');\n return;\n}\n\nif(person === 2){\n print('Penny');\n return;\n}\n\nif(person === 3){\n print('Rajesh');\n return;\n}\n\nif(person === 4){\n print('Howard');\n return;\n}\n\n\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cb5a89de3709179217cc7618eb5df540", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function (){\n const z = readline().split().map(String);\n const x = readline().split().map(String);\n let y = 0;\n for (let i=0; i <= x.length - 1; i++){\n if(x[i][0] == n[0] || x[i][1] == n[1]){\n y = y + 1;\n }\n }\n if(y===0){\n print('NO');\n }else{\n print('Yes');\n }\n }\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a22143d56fcec4e6068f534bbc67ac40", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let stdin = process.stdin;\nstdin.setEncoding('utf8');\nstdin.on('data', function (data) {\n let input = data.split('\\n');\n console.log(solution(input[0]; input[1]));\n});\n\nconst solution = (cardOnTable, cardsInHand) => {\n if (cardsInHand.indexOf(cardOnTable[0]) >= 0 || cardsInHand.indexOf(cardOnTable[1]) >= 0){\n\treturn \"YES\";\n } else {\n\treturn \"NO\";\n }\n};", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a18135eed38d4f9d7300a337ca9de620", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var t = readline().split(\" \");\nvar n = Number(t[0]);\nvar y = Number(t[1]);\nif(n == y){\n print(n)''\n}\nelse{\n print(\"1\");\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "11c5fcfb683c19895615bb843edb2e98", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var p = function(a,b){\n\tfor(i=0;i targetNo){\n return false;\n }\n if(startingNo === targetNo){\n return true;\n }\n return solutionFirst(2*startingNo, targetNo) || solutionFirst(10*startingNo + 1, targetNo)\n }\n\n function lastDigitOne(someNo){\n let lastDigit = +someNo.toString().split('').pop();\n return lastDigit === 1;\n }\n\n\n let path = [];\n function solution(a, b){\n let c = b;\n while(c > a){\n if(c % 2 === 0) {\n path.push(c);\n c = c/2;\n } else if (lastDigitOne(c)){\n path.push(c);\n c = (c - 1)/10\n }\n else {\n return false;\n }\n }\n if(c === a){\n path.push(a);\n return true;\n } else {\n path = [];\n return false;\n }\n }\n\n\n const line1 = readline().split(\" \");\n const a = parseInt(line1[0]);\n const b = parseInt(line1[1]);\n\n let s = solution(a, b);\n\n if(!s){\n print(\"NO\");\n }\n else {\n print(\"YES\");\n print(path.length);\n let someString = \"\";\n for(let i = 0; i < path.length; i++){\n someString += path[path.length - 1 - i];\n if(i < path.length - 1){\n someString += \" \";\n }\n\n }\n print(someString);\n }\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2d5a0488bf382788c1d8491859b5d056", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function main(){\n\n /* Couldn't figure out how to get path for this brute forces recursion solution, ask Tigran */\n function solutionFirst(a, b){\n let startingNo = a;\n let targetNo = b;\n\n if(startingNo > targetNo){\n return false;\n }\n if(startingNo === targetNo){\n return true;\n }\n return solutionFirst(2*startingNo, targetNo) || solutionFirst(10*startingNo + 1, targetNo)\n }\n\n function lastDigitOne(someNo){\n let lastDigit = +someNo.toString().split('').pop();\n return lastDigit === 1;\n }\n\n\n let path = [];\n function solution(a, b){\n let c = b;\n while(c > a){\n if(c % 2 === 0) {\n path.push(c);\n c = c/2;\n } else if (lastDigitOne(c)){\n path.push(c);\n c = (c - 1)/10\n }\n else {\n return false;\n }\n }\n if(c === a){\n path.push(a);\n return true;\n } else {\n path = [];\n return false;\n }\n }\n\n\n const line1 = readline().split(\" \");\n const a = parseInt(line1[0]);\n const b = parseInt(line1[1]);\n\n let s = solution(a, b);\n\n if(!s){\n print(\"NO\");\n }\n else {\n print(\"YES\");\n print(path.length);\n let someString = \"\";\n for(let i = 0; i < path.length; i++){\n someString += path[path.length - 1 - i];\n if(i < path.length - 1){\n someString += \" \";\n }\n\n }\n print(someString);\n }\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e75a2d20c893a80e48a680ed5f862157", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var values = readline().split(' ').map(Number);\n \nvar n = values[0];\nvar m = values[1];\n \nvar sum = 0;\n \nfor (let i = 1; i <= n; i++) {\n for (let j = 0; j <= 5; j++) {\n if ((i % 5) + j === 5) {\n sum += Math.floor((m - j) / 5) + 1;\n }\n }\n}\n \nprint(sum);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b19a80bf78fa5c9431a3f886241e5393", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var values = readline().split(' ').map(Number);\n\nvar n = values[0];\nvar m = values[1];\n\nvar first = Math.min(n, 4);\nvar fval;\n\nvar sum = 0;\n\nfor (let i = 1; i <= n; i++) {\n for (let j = 1; j <= first; j++) {\n if (i + j === 5) {\n fval = j;\n sum += Math.floor((m - fval) / 5) + 1;\n }\n }\n}\n\nprint(sum);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aaef8fe53e692cb23911f5e825ed08e5", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var values = readline().split(' ').map(Number);\n\nvar n = values[0];\nvar m = values[1];\n\nvar first = n >= 4? 4: n; // pick upto max of 4\nvar fval;\n\nvar sum = 0;\n\nfor (let i = 1; i < n; i++) {\n for (let j = 1; j < first; j++) {\n if (i + j === 5) {\n fval = j;\n sum += Math.floor((m - fval) / 5) + 1;\n break;\n }\n }\n}\n\nprint(sum);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f0863cfc4c1683666f6dc60fb165baac", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var x = readline().trim(), y = readline();\nfor (let i = 0; i < x.length; i++) {\n if (x[i] < y[i]) {\n y = '-1';\n break\n }\n}\nprint(y);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "91a590960b7c3238c5965b251265291f", "src_uid": "ce0cb995e18501f73e34c76713aec182", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var t = readline().split(' ')\nvar y = t[0]\nvar b = t[1]\nvar r = t[2]\nvar res = r;\n\nif b < (r-1) then res = b + 1;\nres = res + b;\n\nif y < (b-1) then res = y+1 + y+2;\nres = res + y;\n\nprint(res);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "58af8c0ad41a8358096dd4c459ee19e8", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var y, b, r;\n\ny = readline();\nb = readline();\nr = readline();\n\nvar res;\n\nres=r;\n\nif b < (r-1) then res = b + 1;\nres = res + b;\n\nif y < (b-1) then res = y+1 + y+2;\nres = res + y;\n\nwrite(res);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "495739ebc73a3403e7f4c06c6fe8173e", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let jt = Number(readline()) % 4;\nif(jt === 0){\n write(\"1 A\");\n}\nelse if(jt == 1){\n write(\"0 A\");\n}\nelse if(jt == 2){\n write(\"1 B\");\n}\nelse\n write(\"2 A\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "942cf9f0e88086ab1f0b80200eb43c56", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function div64(strn) {\n if (strn.length < 7)\n return 'no'\n // 1000000 === 64\n var zeros = 0\n for (let i = strn.length - 1; i >= 0; i--)\n if (strn[i] === '1' && zeros >= 6)\n return 'yes'\n else if (strn[i] === '0')\n zeros++\n return 'no'\n}\n\nfunction main() {\n var line = readline().split(' ')[0]\n print(div64(line))\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "dadd5e1f90b0d54dc77e7739d65adf18", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function div64(strn) {\n if (strn.length < 7)\n return 'no'\n // 1000000 === 64\n var zeros = 0\n for (let i = strn.length - 1; i >= 0; i--)\n if (strn[i] === '1' && zeros >= 6)\n return 'yes'\n else if (strn[i] === '0')\n zeros++\n return 'no'\n}\n\nfunction main() {\n var line = readline().split(' ')[0]\n print(div64(line))\n}\n\nmain()", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5889ba8bafb0841be4f12281390f071f", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function binStr(bs) {\n if (bs.length < 7) return \"no\";\n let tot = 0;\n for (let i = bs.length-1, j = 0; i >= 0; i--, j++) {\n tot += bs[i] * Math.pow(2, j);\n }\n if (tot <= 64) return \"no\";\n return \"yes\";\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a9d801cb5e901b36bf0b0358325a4ae9", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "let input = readline().split(' ');\nlet name = input[0];\nlet surname = input[1];\n\nlet i = 1;\nfor (; i < name.length && name.charCodeAt(i) < surname.charCodeAt(0); i++) {}\nwrite(name.substr(0, i) + surname.charAt(0));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2f5ad617b3ec6cdb5221083c4a3595cc", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nfunction main(){\n var line = readline().split(\" \");\n var firstName = line[0];\n var lastName = line[1];\n\n var min_sub = firstName.concat(lastName);\n for(let i = 1; i < firstName.length + 1; i++) {\n for(let j = 1; j < lastName.length + 1; j++) {\n var str = firstName.substr(0,i).concat(lastName.substring(0,j));\n // print(str);\n if (str < min_sub) min_sub = str;\n }\n }\n\n print(min_sub);\n return 0\n}\n\nmain()\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fb04b8e1038d9cc43588c75880977895", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function getAns(k,l,m,n,d){\n var dead = new Array(d+2);\n for (let i=1;i<=d;i++)\n dead[i]=false;\n var ans=0;\n for (let i=1;i<=d;i++){\n if (i%k===0||i%l===0||i%m===0||i%n===0){\n if (dead[i]===false){\n ans++;\n dead[i]=true;\n }\n }\n }\n return ans;\n}\n\nvar r=readline;\nvar k=+r(),l=+r(),m=+r(),n=+r(),d=+r();\nprint(getAns(k,l,m,n,d));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "104bf2495ab074e90b68c98ad8921033", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function getAns(k,l,m,n,d){\n var dead = new Array(d+2);\n for (let i=1;i<=d;i++)\n dead[i]=false;\n var ans=0;\n for (let i=1;i<=d;i++){\n if (i%k===0||i%l===0||i%m===0||i%n===0){\n if (dead[i]===false){\n ans++;\n dead[i]=true;\n }\n }\n }\n return ans;\n}\n\n\nvar input=+readline().split(' ');\nvar k=input[0],l=input[1],m=input[2],n=input[3],d=input[4];\nprint(getAns(k,l,m,n,d));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "02aa1247a2eb9cb77ea96a47a5b55715", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function getAns(k,l,m,n,d){\n var dead = new Array(d+2);\n for (let i=1;i<=d;i++)\n dead[i]=false;\n var ans=0;\n for (let i=1;i<=d;i++){\n if (i%k===0||i%l===0||i%m===0||i%n===0){\n if (dead[i]===false){\n ans++;\n dead[i]=true;\n }\n }\n }\n return ans;\n}\n\n\nvar r=readline;\nvar k=+r(),l=+r(),m=+r(),n=+r(),d=+r();\nprint(getAns(k,l,m,n,d));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aec3facb1fb19bf750fb9c64fc314658", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var k = parseInt(readline());\nvar l= parseInt(readline());\nvar m= parseInt(readline());\nvar n= parseInt(readline());\nvar d= parseInt(readline());\nvar arr= [k,l,m,d];\nvar output = [];\narr.forEach(e=>{\n Array.from({length:d}, (_,i)=>i+1).forEach(x=>{\n if(x%e === 0){\n output.push(x)\n }\n })\n \n})\n \nprint((...output.filter((v,i,a)=>a.indexOf(v)===i)).reduce((a,b)=>a+b,0));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7a4e066c257ef2863a2b51f42a206229", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar group_a = readline().split(' ');\nvar group_b = readline().split(' ');\n\n\nfuntion solve(a, b) {\n var rlt = {};\n\n a.forEach(str => {rlt[str] ++;})\n b.forEach(str => {rlt[str] --;})\n \n var r = 0;\n for (var key in rlt) {\n if (rlt[key]%2)\n return -1\n r += Math.abs(rlt[key])/2\n }\n return r\n}\n\nprint(solve(group_a, group_b))", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d7c4a3d4c6bb0157abd9a28ccc9b7e15", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const line = readline().split(' ').map(_ => Number(_));\nconst log = () => {};\n\n// const line = '6 10 2 4'.split(' ').map(_ => Number(_));\n// const print = console.log;\n// const log = console.log;\n\nconst [a, b, f, k] = line;\n\nlet count = k;\nlet position = 1;\nlet amount = b;\nlet refill = 0;\n\nif (amount < f || amount < a - f) {\n // log(\"can't make it\", { amount, f, a });\n print(-1);\n} else {\n while (count > 0) {\n const needToTurnBack = count > 1;\n if (position === 1) {\n log('pos A:', { amount, count });\n position = 2;\n count--;\n if (needToTurnBack) {\n if (amount < 2 * a - f) {\n log('refill');\n refill += 1;\n amount = b - (a - f);\n } else {\n log('skip');\n amount -= a;\n }\n } else {\n if (amount < a) {\n log('last refill');\n refill += 1;\n amount = b - (a - f);\n } else {\n log('last skip');\n }\n }\n log('pos B:', { amount, count });\n continue;\n }\n if (position === 2) {\n log('pos B:', { amount, count });\n position = 1;\n count--;\n if (needToTurnBack) {\n if (amount < a + f) {\n log('refill');\n refill += 1;\n amount = b - f;\n } else {\n log('skip');\n amount -= a;\n }\n } else {\n if (amount < a) {\n log('last refill');\n refill += 1;\n amount = b - f;\n } else {\n log('last skip');\n }\n }\n log('pos A:', { amount, count });\n }\n }\n print(refill);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b5d7073e9dfe3f2e83c55e7ad72feb7e", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "\nvar input=readline();\n\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\nreturn\n}\nvar count= 0;\nvar divided =n/m\nreqursion(divided)\n\n\n\nfunction reqursion(divided) {\nif(divided===1) {print(count) return}\nif(divided%3===0) {\ncount++;\nreqursion(divided/3)\nreturn\n}\nif(divided%2===0) {\ncount++;\nreqursion(divided/2)\nreturn\n}\nprint(-1)\nreturn\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8efb5a5b0e4f316634f80a4d8c42d6c1", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input=readline();\n\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\n\n}\n let count= 0;\nlet divided =n/m\nprint(7)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a5feceea341f24d8580be6b554a9dbae", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\nfunction main(){\n var line = readline().split(' ');\n var a = line[0];\n var b = line[1];\n\n var one = parseInt(a);\n var two = parseInt(b);\n if(two > one){\n var [one,two] = [two,one];\n }\n if(one%two != 0 ){\n console.log(-1);\n }\n else{\n chuone(one/two,0);\n }\n}\n\nfunction chuone(a,sum){\n if(a == 1){\n //console.log(0);\n print(0);\n return;\n }\n if((a/2 == 1 && a%2 == 0) || (a/3 == 1 && a%3 == 0)){\n sum++;\n print(sum);\n //console.log(sum);\n return;\n }\n if(a%2 != 0 && a%3 != 0){\n print(-1);\n //console.log(-1);\n }\n else if(a%2 == 0){\n a = a/2;\n sum++;\n chuone(a,sum);\n }\n else if(a%3 == 0){\n a = a/3;\n sum++;\n chuone(a,sum);\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8448c18a5842e06f930172e708c9bcf3", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input=readline();\n\nfunction reqursion(divided) {\nif(divided===1) {return}\nif(divided%3===0) {\ncount++;\nreqursion(divided/3)\nreturn\n}\nif(divided%2===0) {\ncount++;\nreqursion(divided/2)\nreturn\n}\nprint(-1)\nreturn\n}\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\nreturn\n}\n let count= 0;\nlet divided =n/m\nreqursion(divided)\nprint(count)\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b50d216e9f3b55975950d7daad81a62c", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar input=readline();\n\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\nreturn\n}\n let count= 0;\nlet divided =n/m\nreqursion(divided)\nprint(count)\n\n\nfunction reqursion(divided) {\nif(divided===1) {return}\nif(divided%3===0) {\ncount++;\nreqursion(divided/3)\nreturn\n}\nif(divided%2===0) {\ncount++;\nreqursion(divided/2)\nreturn\n}\nprint(-1)\nreturn\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d33d31be13915fe58fa0da8d8947f7ca", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar input=readline();\nfunction reqursion(divided) {\nif(divided===1) {print(count)}\nif(divided%3===0) {\ncount++;\nreqursion(divided/3)\n\n}\nif(divided%2===0) {\ncount++;\nreqursion(divided/2)\n\n}\nprint(-1)\n\n}\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\n\n}\n let count= 0;\nlet divided =n/m\nreqursion(divided)\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "fdd03056e8fd32a5044ee1ac69d66a0c", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nvar a = line[0];\nvar b = line[1];\n\n// print(parseInt(a)+parseInt(b);\n\nvar one = parseInt(a);\nvar two = parseInt(b);\nif(two > one){\n var [one,two] = [two,one];\n}\nif(one%two != 0 ){\n console.log(-1);\n}\nelse{\n chuone(one/two,0);\n}\nfunction chuone(a,sum){\n if(a == 1){\n //console.log(0);\n print(0);\n return;\n }\n if((a/2 == 1 && a%2 == 0) || (a/3 == 1 && a%3 == 0)){\n sum++;\n print(sum);\n //console.log(sum);\n return;\n }\n if(a%2 != 0 && a%3 != 0){\n print(-1);\n //console.log(-1);\n }\n else if(a%2 == 0){\n a = a/2;\n sum++;\n chuone(a,sum);\n }\n else if(a%3 == 0){\n a = a/3;\n sum++;\n chuone(a,sum);\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "13f8d266fc461209250bd0e0b7a418e4", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar input=readline();\n\nvar m= input.split(' ')[0]\nvar n= input.split(' ')[1]\n\nif(n%m!==0) {\nprint(-1)\n\n}\n let count= 0;\nlet divided =n/m\nreqursion(divided)\n\n\n\nfunction reqursion(divided) {\nif(divided===1) {print(count)}\nif(divided%3===0) {\ncount++;\nreqursion(divided/3)\n\n}\nif(divided%2===0) {\ncount++;\nreqursion(divided/2)\n\n}\nprint(-1)\n\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c70e7bfe40c1f9400176606058dd1b7a", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "declare const process: any;\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet input: string = '';\nprocess.stdin.on('data', (line) => {\n input += line;\n});\n\nprocess.stdin.on('end', () => {\n const lines: string[] = input.split('\\n');\n\n const k = parseInt(lines.shift(), 10);\n\n const occur: number[] = Array(10).fill(1);\n let count: number = 1;\n let index: number = 0;\n\n while (count < k) {\n occur[index]++;\n count = occur.reduce((acc, value) => acc * value, 1);\n index++;\n if (index === 10) {\n index = 0;\n }\n }\n\n const word: string = \"codeforces\";\n const ans: string = occur\n .map((value, index) => word[index].repeat(value))\n .join('');\n\n console.log(ans);\n});\n\n// input helper\n\nfunction lineToNumArray(line: string): number[] {\n return line.split(' ').map(element => parseInt(element, 10));\n}\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3b244dc4091d874c3bfd83017eac935f", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var num = readline().split(\" \").map(x => parseInt(x)); // num will be an array [1,2,3]\nvar a = num[0];\nvar b = num[1];\nvar c = num[2];\nvar result = [];\nvar count = 0;\n\nfor (var i = 1; i < 81; i++) {\n if (i == ((b*i**a))+c) {\n result.push(i);\n count++;\n }\n}\n\nprint(count);\nresult.forEach(element => print(count));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "6b9073b7c633228bf58060280a6b93b2", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var num = readline().split(\" \").map(x => parseInt(x)); // num will be an array [1,2,3]\nvar a = num[0];\nvar b = num[1];\nvar c = num[2];\nvar result = [];\nvar count = 0;\n\nfor (var i = 1; i < 81; i++) {\n var buf = (b * i ** a) + c;\n var sumBufNumbers = buf.toString().split('').reduce(function(a,b){\n return +a + +b;\n });\n if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {\n result.push(buf);\n count++;\n }\n}\n\nprint(count);\nresult.forEach(element => print(element));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "854d5ac384d072e941b2ddd36fe33bfa", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var num = readline().split(\" \").map(x => parseInt(x)); // num will be an array [1,2,3]\nvar a = num[0];\nvar b = num[1];\nvar c = num[2];\nvar result = [];\nvar count = 0;\n\nfor (var i = 1; i < 81; i++) {\n var buf = (b * i ** a) + c;\n var sumBufNumbers = buf.toString().split('').reduce(function(a,b){\n return +a + +b;\n });\n if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {\n result.push(buf);\n count++;\n }\n}\n//\nprint(count);\nresult.forEach(element => print(element));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7e9c32e34f25124a251c0e25bbb17a99", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var num = readline().split(\" \").map(x => parseInt(x)); // num will be an array [1,2,3]\nvar a = num[0];\nvar b = num[1];\nvar c = num[2];\nvar result = [];\nvar count = 0;\n\nfor (let i = 1; i < 81; i++) {\n var buf = (b * i ** a) + c;\n var sumBufNumbers = buf.toString().split('').reduce(function(a,b){\n return +a + +b;\n });\n if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {\n result.push(buf);\n count++;\n }\n}\n//\nprint(count);\nresult.forEach(element => print(element));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "640fe5e19a8ae7e40d923843e18b6ff8", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const len = parseInt(readline());\nconst numbers = readline().split(\" \").map( x => parseInt(x));\n\nlet dict = {};\n\nnumbers.forEach((x, i) => {\n dict[i] = x;\n});\n\nprint(dict);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "69b4f25192dab230c6ad481749338061", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "ar count, i, j, k, l, m, n, o, p, palindrome, pp, q, ref, ref1, ref2, ref3, ref4;\n\nreadline(s);\n\nn = s.length;\n\npp = [];\n\ncount = [];\n\nfor (l = j = 1, ref = n; 1 <= ref ? j <= ref : j >= ref; l = 1 <= ref ? ++j : --j) {\n count[l] = 0;\n for (i = m = 0, ref1 = n - l; 0 <= ref1 ? m <= ref1 : m >= ref1; i = 0 <= ref1 ? ++m : --m) {\n pp[l * n + i] = (l === 1 ? 1 : 0);\n }\n}\n\ncount[1] += n;\n\npalindrome = function(i, l) {\n return pp[l * n + i];\n};\n\nfor (l = o = 2, ref2 = n; 2 <= ref2 ? o <= ref2 : o >= ref2; l = 2 <= ref2 ? ++o : --o) {\n for (i = p = 0, ref3 = n - l; 0 <= ref3 ? p <= ref3 : p >= ref3; i = 0 <= ref3 ? ++p : --p) {\n if (s[i] === s[i + l - 1] && (l === 2 || palindrome(i + 1, l - 2))) {\n k = 1 + palindrome(i, Math.floor(l / 2));\n pp[l * n + i] = k;\n count[k] += 1;\n }\n }\n}\n\nfor (i = q = ref4 = n - 2; q >= 0; i = q += -1) {\n count[i] += count[i + 1];\n}\n\nprint(count.slice(1).join(' '));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "5c433fb5c2230f953949511e00e7a615", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var tiles = readline().split(\" \");\n\n\nif (isKoutsu(tiles) || isShuntsu(tiles))\n print(\"0\")\nelse {\n var koutsuRepairCount = correctForKoutsu(tiles);\n var shuntsuRepairCount = correctForShuntsu(tiles);\n\n print(Math.min(koutsuRepairCount, shuntsuRepairCount));\n}\n\n\n/***************************************************************************/\n/***************************************************************************/\n/***************************************************************************/\nfunction isKoutsu(tiles) {\n return (tiles[0] === tiles[1] && tiles[1] === tiles[2]);\n}\n\n\nfunction isShuntsu(tiles) {\n tiles.sort();\n return isSameSuit(tiles[0], tiles[1], tiles[2]) && isSequential(tiles[0], tiles[1], tiles[2]);\n}\n\n\nfunction isSameSuit(tile1, tile2, tile3) {\n return (tile1.charAt(1) == tile2.charAt(1) && tile2.charAt(1) == tile3.charAt(1));\n}\n\nfunction isSequential(tile1, tile2, tile3) {\n var diff1 = Math.abs(parseInt(tile1.charAt(0)) - parseInt(tile2.charAt(0))) == 1;\n var diff2 = Math.abs(parseInt(tile2.charAt(0)) - parseInt(tile3.charAt(0))) == 1;\n\n return diff1 && diff2;\n\n}\n\n\nfunction correctForShuntsu(tiles) {\n\n var groups = {};\n\n tiles.forEach(function (tile) {\n var suit = tile.charAt(1);\n var digit = parseInt(tile.charAt(0));\n\n if (!groups.hasOwnProperty(suit)) {\n groups[suit] = [];\n }\n groups[suit].push(digit);\n groups[suit].sort();\n });\n\n var consecutive = false;\n\n for (var [suit, digits] of Object.entries(groups)) {\n if (digits.length == 2) {\n consecutive = (Math.abs(digits[0] - digits[1]) == 1) || (Math.abs(digits[0] - digits[1]) == 2);\n }\n }\n\n return consecutive ? 1 : 2;\n}\n\n\n\nfunction correctForKoutsu(tiles) {\n\n var set = new Set(tiles);\n var len = set.size;\n\n return (len == tiles.length) ? 2 : (tiles.length - len);\n\n} ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "99b855089606723cd7d5a4cb8362adf4", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var tiles = readline().split(\" \");\n\n\nif (isKoutsu(tiles) || isShuntsu(tiles))\n print(\"0\")\nelse {\n var koutsuRepairCount = correctForKoutsu(tiles);\n var shuntsuRepairCount = correctForShuntsu(tiles);\n\n print(Math.min(koutsuRepairCount, shuntsuRepairCount));\n}\n\n\n/***************************************************************************/\n/***************************************************************************/\n/***************************************************************************/\nfunction isKoutsu(tiles) {\n return (tiles[0] === tiles[1] && tiles[1] === tiles[2]);\n}\n\n\nfunction isShuntsu(tiles) {\n tiles.sort();\n return isSameSuit(tiles[0], tiles[1], tiles[2]) && isSequential(tiles[0], tiles[1], tiles[2]);\n}\n\n\nfunction isSameSuit(tile1, tile2, tile3) {\n return (tile1.charAt(1) == tile2.charAt(1) && tile2.charAt(1) == tile3.charAt(1));\n}\n\nfunction isSequential(tile1, tile2, tile3) {\n var diff1 = Math.abs(parseInt(tile1.charAt(0)) - parseInt(tile2.charAt(0))) == 1;\n var diff2 = Math.abs(parseInt(tile2.charAt(0)) - parseInt(tile3.charAt(0))) == 1;\n\n return diff1 && diff2;\n\n}\n\n\nfunction correctForShuntsu(tiles) {\n\n var groups = {};\n\n tiles.forEach(function (tile) {\n var suit = tile.charAt(1);\n var digit = parseInt(tile.charAt(0));\n\n if (!groups.hasOwnProperty(suit)) {\n groups[suit] = [];\n }\n groups[suit].push(digit);\n groups[suit].sort();\n });\n\n var consecutive = false;\n\n for (const [suit, digits] of Object.entries(groups)) {\n if (digits.length == 2) {\n consecutive = (Math.abs(digits[0] - digits[1]) == 1) || (Math.abs(digits[0] - digits[1]) == 2);\n }\n }\n\n return consecutive ? 1 : 2;\n}\n\n\n\nfunction correctForKoutsu(tiles) {\n\n var set = new Set(tiles);\n var len = set.size;\n\n return (len == tiles.length) ? 2 : (tiles.length - len);\n\n} ", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "889ae6272c647b0303c10095f94a617a", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "import java.util.*;\npublic Class A {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int[] arr = new int[n];\n for(int i=0; i {\n let x = Math.max.apply(null, years.map(function(el) {\n return Math.min.apply(null, years.map(function(year) {\n let delta = Math.abs(parseInt(year) - parseInt(el));\n return delta > 0 ? delta : Infinity;\n }));\n }));\n console.log(years.filter(function(el) {\n let year = years.reduce(function(prev, cur) {\n if (Math.abs(el - parseInt(cur)) <= x) {\n return prev && true;\n } else {\n return prev && false;\n }\n }, true);\n if (year) return el;\n })[0]);\n process.exit();\n};\n\nrl.on('line', function(input) {\n if (line === 0) {\n count = input;\n line++;\n } else {\n years = input.split(' ');\n calc();\n }\n});", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "036e919998ce9d076dfc2bb19dcb5e5d", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "/**\n * Created by lukask on 9/24/17.\n */\nvar readLine = require('readline');\n\nvar rl = readLine.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nfunction isPalindrome(number) {\n let i = 0;\n for (i = 0; i < number.length / 2; i++) {\n // console.log(number[i] + ' === ' + number[number.length - i - 1]);\n if (number[i] !== number[number.length - i - 1]) {\n return false;\n }\n }\n return true;\n}\n\nfunction isQuasiPalindrome(number) {\n if (isPalindrome(number)) {\n return 'YES';\n }\n let zeroesInFront = 0;\n let zeroesInBack = 0;\n let i = 0;\n while (number[i] === '0') {\n i++;\n }\n zeroesInFront = i;\n i = number.length - 1;\n while (number[i] === '0') {\n i--;\n }\n zeroesInBack = number.length - i - 1;\n if (zeroesInFront > zeroesInBack) {\n // console.log(zeroesInFront + ' ' + zeroesInBack);\n return 'NO';\n }\n number = number.substring(0, number.length - (zeroesInBack - zeroesInFront));\n // console.log(number);\n if (isPalindrome(number)) {\n return 'YES'\n }\n // console.log(zeroesInBack);\n return 'NO';\n}\n\nrl.on('line', function(line){\n console.log(isQuasiPalindrome(line));\n})\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b47ac306198325076e55a5f048f831b9", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var s=String(readline());\nvar num=[];\nvar res=[];\nfor(let i=0;i 0){\n num[i]-=1;\n tmps+=\"1\";\n }else{\n tmps+=\"0\";\n\t}\n }\n res.push(parseInt(tmps));\n if(num.every(function(elem){return elem==0;})){\n break;\n }\n} \nprint (res.length);\nprint (res.join(\" \"));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "695003f915232a24a186e726efe7185a", "src_uid": "033068c5e16d25f09039e29c88474275", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "// const io = require('../lol-io.js');\n// const readline = io.readline;\n// const print = io.print;\n\nfunction f(x) {\n x++;\n while (x % 10 === 0) {\n x /= 10;\n }\n\n return x;\n}\n\nlet x = Number(readline());\nconst used = {};\nlet count = 0;\n\nwhile (!used[x]) {\n used[x] = true;\n ++count;\n\n x = f(x);\n};\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "de0d624b6ff851f5c4ccab179166e0fb", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "// const io = require('../lol-io.js');\n// const readline = io.readline;\n// const print = io.print;\n\nfunction f(x) {\n x++;\n while (x % 10 === 0) {\n x /= 10;\n }\n\n return x;\n}\n\nlet x = Number(readline());\nconst used = {};\nlet count = 0;\n\nwhile (!used[x]) {\n used[x] = true;\n ++count;\n\n x = f(x);\n};\n\nprint(count);\n// const print = console.log;\n// const readline = require('readline').createInterface({\n// input: process.stdin,\n// output: process.stdout\n// });\n\n// readline.on('line', (input) => {\n// print(input);\n// });\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3564feb34b04bb6f4c41bf877a66241f", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const io = require('../lol-io.js');\nconst readline = io.readline;\nconst print = io.print;\n\nfunction f(x) {\n x++;\n while (x % 10 === 0) {\n x /= 10;\n }\n\n return x;\n}\n\nlet x = Number(readline());\nconst used = {};\nlet count = 0;\n\nwhile (!used[x]) {\n used[x] = true;\n ++count;\n\n x = f(x);\n};\n\nprint(count);\n// const print = console.log;\n// const readline = require('readline').createInterface({\n// input: process.stdin,\n// output: process.stdout\n// });\n\n// readline.on('line', (input) => {\n// print(input);\n// });\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "adcf8823d46bb9661a4c68137aeed592", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print('white\\n0 1' if int(input()) % 2 == 0 else 'black')\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "c3fc1e3e62188c9d960533b24466ebb8", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "\nvar input = parseint(readline());\nvar str = \"\":\nfor(int i=1; i<= input; ++i){\n s = s.concat(i);\n}\nprint(s.charAt(n-1));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "77173c7cdcfad2cf844c18f67068f5c6", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\nvar input = parseInt(readline());\nvar str = \"\":\nfor(int i=1; i<= input; ++i){\n s = s.concat(i);\n}\nprint(s.charAt(n-1));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "166f3149cbc0900fd4736b37618611e5", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "#!/usr/bin/node\n// Problem http://codeforces.com/contest/476/problem/B#_=_\n\n\"use strict\";\nconst readline = require('readline');\n\nfunction calculateProb(s1, s2) {\n var possibilties = [];\n calculatePossibilities(s2, 0, [], possibilties);\n\n var d = destinationNum(s1);\n var successCount = 0;\n for(var i = 0; i {\n rl.on(\"line\", (s2)=> { \n rl.write(calculateProb(s1, s2)+ \"\");\n rl.close();\n })\n})", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1cdeb327603b338ca156edb4223289fc", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "#!/usr/bin/node\n// Problem http://codeforces.com/contest/476/problem/B#_=_\n\n\"use strict\";\n\nfunction calculateProb(s1, s2) {\n var possibilties = [];\n calculatePossibilities(s2, 0, [], possibilties);\n\n var d = destinationNum(s1);\n var successCount = 0;\n for(var i = 0; i +a + +b);\n return sum%4;\n}\n\nwhile (check(digits)) {\n let nun = parseInt(digits.join(\"\"));\n nun++;\n digits = String(nun).split(\"\");\n}\n\nlet result = digits.join(\"\");\n\n// console.log(result);\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "7c58ddb5d09d99c4901eb3e1afa4c6f7", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nlet digits = String(numbers[0]).split(\"\");\n\nfunction check(digits) {\n let sum = digits.reduce((a, b) => +a + +b);\n return sum%4;\n}\n\nwhile (check(digits)) {\n let nun = parseInt(digits.join(\"\"));\n nun++;\n digits = String(nun).split(\"\");\n}\n\nlet result = parseInt(digits.join(\"\"));\n\nwrite(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "23e31349070021d2328d7e8020d57473", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// var numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nvar numbers = [99];\n\nlet digits = String(numbers[0]).split(\"\");\n\nfunction check(digits) {\n let sum = digits.reduce((a, b) => {return (+a) + (+b)});\n return sum%4;\n}\n\nwhile (check(digits)) {\n var nun = parseInt(digits.join(\"\"));\n nun++;\n digits = String(nun).split(\"\");\n}\n\nvar result = digits.join(\"\");\n\nconsole.log(result);\n\n// print(result);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b9a731debf35b4c2b8ca48093962fe8f", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numberStr = readline().split(\" \")[0];\n\nfunction check(numberStr) {\n let digits = numberStr.split(\"\");\n let sum = digits.reduce((a, b) => {return (+a) + (+b)}, 0);\n return sum%4;\n}\n\nwhile (check(numberStr)) {\n var nun = +numberStr;\n nun++;\n numberStr = String(nun);\n}\n\nprint(numberStr);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "884010b0a87b2e7abf7c0f0ad6e3f422", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar s = readline().split(' ');\n\n\tprint( Math.min(+s[0] - s[1], +s[2] + 1);\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "8690a4f3ec8cf8e45810509d6da46044", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var valores = readline().split(\" \");\nvar gente = valores[0];\nvar delante = valores[1];\nvar detras = valores[2];\n\nprint(Math.min((gente-delante),(detras+1));", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3f14929c5c906a41c2d2176ec7235513", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var s = readline().trim(), cnt = 2;\nfor (let i = 0, j = s.length - 1; i < j; i++, j--) {\n if (s[i] != s[j]) {\n cnt -= 1;\n if (!cnt) {\n break\n }\n }\n}\nprint((cnt) ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "d42d7fad1f2e414c11c38e339c79c0b3", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "ar r = readline().split(' ').map(Number);\nvar r1 = r[0];\nvar r2 = r[1];\nvar c = readline().split(' ').map(Number);\nvar c1 = c[0];\nvar c2 = c[1];\nvar d = readline().split(' ').map(Number);\nvar d1 = d[0];\nvar d2 = d[1];\n\nvar list = {};\nfor (var i = 1; i <= 9; i++) {\n for (var j = 1; j <= 9; j++) {\n if (i === j) continue;\n var index = i + j;\n if (list.hasOwnProperty(index)) {\n list[index].push([i, j]);\n } else {\n list[index] = [[i, j]];\n }\n }\n}\n\nvar line1;\nvar line2;\nvar find = false;\nvar length1 = (list[r1] || []).length\nvar length2 = (list[r2] || []).length\n\nfor (var i = 0; i < length1; i++) {\n line1 = list[r1][i]\n for (var j = 0; j < length2; j++) {\n line2 = list[r2][j]\n\n if (\n c1 === line1[0] + line2[0] &&\n c2 === line1[1] + line2[1] &&\n d1 === line1[0] + line2[1] &&\n d2 === line1[1] + line2[0] &&\n line1[0] !== line2[0] &&\n line1[0] !== line2[1] &&\n line1[1] !== line2[0] &&\n line1[1] !== line2[1]\n ) {\n find = true;\n break;\n }\n }\n\n if (find) {\n break;\n }\n}\nif (find) {\n print(line1.join(' '));\n print(line2.join(' '));\n} else {\n print(-1);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1acea9a71b19cfa19d9847dcf930741b", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const w = readline()\nconst ww = [[0, 0]]\nconst s = new Set(['-1:0', '1:0', '0:1', '0:-1'])\nconst p = [0, 0]\nfor (let i = 0; i < w.length; i++) {\n switch (w[i]) {\n case 'L': {\n p[0] -= 1\n break;\n }\n case 'R': {\n p[0] += 1\n break;\n }\n case 'U': {\n p[1] += 1\n break;\n }\n case 'D': {\n p[1] -= 1\n break;\n }\n }\n ww.push([p[0], p[1]])\n s.add([p[0] - 1, p[1]].join(':'))\n s.add([p[0], p[1] - 1].join(':'))\n s.add([p[0], p[1] + 1].join(':'))\n s.add([p[0] + 1, p[1]].join(':'))\n}\n\nprint(ww.length * 3 + 2 == s.size)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "60a45552e7448e70987f0fa10b3fda5b", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "const w = readline()\nconst ww = [[0, 0]]\nconst s = new Set([-1:0', '1:0', '0:1', '0:-1'])\nconst p = [0, 0]\nfor (let i = 0; i < w.length; i++) {\n switch (w[i]) {\n case 'L': {\n p[0] -= 1\n break;\n }\n case 'R': {\n p[0] += 1\n break;\n }\n case 'U': {\n p[1] += 1\n break;\n }\n case 'D': {\n p[1] -= 1\n break;\n }\n }\n ww.push([p[0], p[1]])\n s.add([p[0] - 1, p[1]].join(':'))\n s.add([p[0], p[1] - 1].join(':'))\n s.add([p[0], p[1] + 1].join(':'))\n s.add([p[0] + 1, p[1]].join(':'))\n}\n\nprint(ww.length * 3 + 2 == s.size)", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a471bda27c5eea29ca0d8ac8c2eb6df5", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "const w = readline()\nconst ww = [[0, 0]]\nconst s = {'-1:0': true, '1:0': true, '0:1': true, '0:-1': true}\nconst p = [0, 0]\nfor (let i = 0; i < w.length; i++) {\n switch (w[i]) {\n case 'L': {\n p[0] -= 1\n break;\n }\n case 'R': {\n p[0] += 1\n break;\n }\n case 'U': {\n p[1] += 1\n break;\n }\n case 'D': {\n p[1] -= 1\n break;\n }\n }\n ww.push([p[0], p[1]])\n s[[p[0] - 1, p[1]].join(':')] = true\n s[[p[0], p[1] - 1].join(':')] = true\n s[[p[0], p[1] + 1].join(':')] = true\n s[[p[0] + 1, p[1]].join(':')] = true\n}\n\nprint(ww.length * 3 == Object.keys(s).length ? 'OK' : 'BUG')", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4e35f822043e6c903a94161f34c9760a", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var num = readline().split('');\nvar l = parseInt\ufffd\ufffdnum[0]\ufffd\ufffd;\nvar r = parseInt\ufffd\ufffdnum[1]\ufffd\ufffd;;\nif(r - l >= 1){\n\tprint(2);\n}else{\n\tprint(1);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "82ad71bb77cb689ebcb580103c3f9327", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var num = readline().split('');\nvar l = num[0];\nvar r = num[1];\nif(r - l >= 1){\n\tdocument.write(2);\n}else{\n\tdocument.write(\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u06a1\ufffd);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1a8bccce4e5aa88db46a2dd01f46db40", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var num = readline().split('');\nvar l = num[0];\nvar r = num[1];\nif(r - l >= 1){\n\tprint(2);\n}else{\n\tprint(\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u06a1\ufffd);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "f961c8ccf39ed703dbebfcdeb94626bb", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function () {\n var n = parseInt(readline()),\n array = readline().split(\" \"),\n i = 0,\n sum = 0;\n for (; i < n; i++) {\n sum += parseInt(array[i]);\n }\n\n function check100 (ln) {\n var i = ln;\n for (; i < n; i++) {\n if (parseInt(array[i]) === 100) {\n print(\"YES\");\n return;\n }\n }\n print(\"NO\");\n }\n\n sum /= 2;\n i = 0;\n while (sum >= 0) {\n sum -= array[i];\n i++;\n if (sum === 0) {\n print(\"YES\");\n return\n }\n if (sum === 100) {\n check100(i);\n return\n }\n if\n print(\"NO\");\n }\n})();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b54ead1bc19b990e7ca848a9c4af7dee", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function f(x)\n{\n\treturn (x*(x+1))/2;\n}\n\nvar input = readline().split().map(Number);\nvar n = input[0];\nvar ans - f(n);\n\nfor(var x = n - 2; x >= 1; x--)\n{\n\tans += f(x);\n}\n\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "aeb72d1802a32ac8cc4034fecade95e6", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n \n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "848c016aa453c7c6bc20302933e50168", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "By tea, contest: Educational Codeforces Round 36 (Rated for Div. 2), problem: (A) Garden, Accepted, #\n T=readline().split(' ').map(Number)\nA=readline().split(' ').map(Number)\nA.sort((l,r)=>r-l)\n\nvar a;\nfor (var i=0;i y ? x : y);\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4d81a67b02e1bb6bcd5c1a8e8a77ca09", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "\n\n\n \n \n \n Document\n\n\n \n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "de2e47463aa0cf7bcf31dc2a5442fac9", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "\nvar firstLine = readline();\nprint('\\n');\n\nprint(tort(+firstLine.split(' ')[0], +firstLine.split(' ')[1], +firstLine.split(' ')[2]))\n\n\nfunction tort(k, x, y) {\n let maxMin = 0;\n \n for (let i = 1; i < k; i++) {\n const curr = Math.min(Math.floor(x / i), Math.floor(y / (k - i)));\n if (curr > maxMin) {\n maxMin = curr;\n }\n }\n \n return maxMin;\n}\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "254433fb45fc311f3d681b873fa879ab", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "// @flow\n\n\n const n = readline()\n const r = readline()\n\n let x = 0\n let y = 0\n let max = 0;\n\n for (var i = 0; i < r.length; i++) {\n switch(r[i]){\n case 'U': y++; break;\n case 'D': y--; break;\n case 'L': x--; break;\n case 'R': x++; break;\n }\n\n if (x === 0 && y === 0) max = i + 1\n }\n\n print(max)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "264503ae4d84c5eda5a3b1496dc80402", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "// @flow\n\n const n = parseInt(readline(), 10)\n const r = readline()\n\n let x = 0\n let y = 0\n let max = 0;\n\n for (var i = 0; i < r.length; i++) {\n switch(r[i]){\n case 'U': y++; break;\n case 'D': y--; break;\n case 'L': x--; break;\n case 'R': x++; break;\n }\n\n if (x === 0 && y === 0) max = i + 1\n }\n\n print(max)\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1ae5cf4335f8501091dc27d028a01876", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var inp = readline().split(\" \").map(function(x){return parseInt(x);});\ninp = inp.sort(function(a,b){return a > b;})\nvar toAdd = 0;\nvar res = inp[0];\nif (inp[1] - inp[0] != 0){\n\tinp[1] -= inp[0];\n\tinp[2] -= inp[0];\n\n\twhile (inp[1] != 0 && inp[2] != 0 && inp[1]+inp[2]>2 ){\n\t\tvar mini = Math.min(inp[1],inp[2]);\n\t\tvar temp = Math.min(Math.min(inp[1],inp[2]), )\n\t\t\n\t\tif (inp[2]>inp[1]){\n\t\t\t\t\tvar temp = Math.min(inp[1], Math.floor((inp[2]-inp[1])/2));\n\t\t\t\t\t inp[2]-=2 * temp;\n\t\t\t\t\t inp[1]-= temp;\n\t\t\t\t\t toAdd+=temp;\n\t\t} else{\n\t\tvar temp = Math.min(inp[2], Math.floor((inp[1]-inp[2])/2));\n\t\t\t inp[1]-=2 * temp;\n\t\t\t inp[2]-= temp;\n\t\t\t toAdd+=temp;\n\t\t}\n\t}\n}\n\nprint(res + toAdd);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "1d3999220fc65348558573a3dcc8aa53", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "let i = readline().split(' ').map(x => parseInt(x)),\n o = (i[0] == 2) ? 28 : ([4, 6, 9, 11].indexOf(i[0]) < 0 ? 31 : 30);\no += i[1] - 1;\nprint(Math.ceil(o / 7) + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "19b7f026b47e35b5bb63a89e5c5763de", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "let i = readline().split(' ').map(x => parseInt(x)),\n o = (i[0] == 2) ? 28 : ([4, 6, 9, 11].indexOf(i[0]) < 0 ? 31 : 30);\no += i[1] - 1;\nwrite(Math.ceil(o / 7));\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "a202419ff9910bf9dd542a0a48d7b7e4", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet n, k;\n\nconst remove = (string, index) => {\n return string.split('').filter((el, i) => i != index).join('');\n}\n\nvar get = (n, k) => {\n n += '';\n let div = Math.pow(10, k);\n\n let counter = 0;\n\n if(n % div === 0)\n return counter;\n\n for(let i = n.length - 1; i >= 0; i--) {\n if(n % div === 0)\n return counter;\n\n if(n[i] != 0) {\n n = remove(n, i);\n counter++;\n }\n }\n\n return counter;\n}\n\nrl.on('line', (input) => {\n const arr = input.split(' ');\n\n n = arr[0];\n k = arr[1];\n\n console.log(get(n, k));\n});\n\n//nu i govno\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "acd83b7fd554c6c3ccb906bee4b46363", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+\n(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]\n+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]\n+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])\n[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])\n[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])\n[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])\n[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])\n[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])\n[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])\n[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])\n[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]\n((+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])\n[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+\n(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])\n[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+\n(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])\n[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+\n(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])\n[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+\n(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])\n[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])\n[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])\n[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])\n[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+\n(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])\n[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+\n([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+\n(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])\n[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+\n(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+\n(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+\n(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])\n[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])\n[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])\n[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+\n)[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[\n ])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+\n (!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]\n ]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+\n []+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[+!+[]]+([![]]+[][\n []])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+\n (![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[!+[]+!+[]+!+[]+!+[]]+(+(+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+[]]))+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "95c07dd9d2acbb5f8c47bfa5b222d9c0", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "\n\nfunction solveSplitsProblem(n) {\n let result = Math.floor((n/2 + 1));\n print(result);\n}\n\nlet n = readline();\nsolveSplitsProblem(n);\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "626034bc0e1603ae7f95e495d9bd72f9", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\nfunction solveSplitsProblem(n) {\n let result = Math.floor((n/2 + 1));\n console.log(result);\n}\n\nsolveSplitsProblem(9);\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "0071dc0f96ffd930f0aa91ef6b91ce44", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\nfunction solveSplitsProblem(n) {\n let result = Math.floor((n/2 + 1));\n console.log(result);\n}\n\nsolveSplitsProblem(7);\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "bbdf52781c7a165c158fd2f7bf9d8845", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var inp = readline()\n\nlet count4 = inp.match(/4/g);\nlet count7 = inp.match(/7/g);\n\nif (count4) {\n if (count7) {\n if (count4.length >= count7.length) {\n print(4);\n } else {\n print(7);\n }\n }\n} else if(count7) {\n print(7);\n} else {\n print(-1);\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b787fa46dabb6f392c156269b99a100b", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const SPLIT_BY_SPACE = function(line) {\n return line.split(' ');\n};\nconst STRING_LINE = function(line) {\n return line;\n}\nfunction getInput(...parseLineFunc) {\n let line = readline();\n let iFunc = 0;\n let data = [];\n parseLineFunc = parseLineFunc || [];\n\n do{\n let func = parseLineFunc[iFunc] || SPLIT_BY_SPACE;\n data[iFunc] = func(line);\n line = readline();\n iFunc++;\n }\n while(line);\n return data;\n\n};\n\nfunction solution() {\n let data = getInput(SPLIT_BY_SPACE, STRING_LINE);\n let N = parseInt(data[0]);\n let S = data[1];\n let maps = {};\n for (let s of S) {\n if (maps[s]) {\n console.log('Yes');\n return;\n }\n maps[s] = true;\n }\n console.log('No');\n return;\n} \n\nsolution();", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "debe98cdaaf790bff03c4dd1367f801e", "src_uid": "6b22e93f7e429693dcfe3c099346dcda", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false,\n});\n\nlet n;\n\nconst numCapitals = word => {\n let total = 0;\n for (let i = 0; i < word.length; i++) {\n if (/[A-Z]/.test(word[i])) {\n total++;\n }\n }\n return total;\n};\n\nrl.on('line', line => {\n if (!n) {\n n = line;\n } else {\n const words = line.split(' ');\n const max = words.reduce((max, curr) => {\n const count = numCapitals(curr);\n if (count > max) {\n return count;\n }\n return max;\n }, -1);\n rl.write(max);\n process.exit();\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "cc9d914b61c021a3de0faf2b776340f1", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function numCapitals(word) {\n let total = 0;\n for (let i = 0; i < word.length; i++) {\n if (/[A-Z]/.test(word[i])) {\n total++;\n }\n }\n return total;\n}\n\nfunction main() {\n const n = readline();\n const words = readline().split(' ');\n\n const max = words.reduce((max, curr) => {\n const count = numCapitals(curr);\n if (count > max) {\n return count;\n }\n return max;\n }, -1);\n\n print(max);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "066d18ecaea27fd55e5c738b10604efa", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "2438ede8d6108243c1e84b1581ba22fd", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var t = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n \nvar inp = readline().split(' ');\nvar n = inp[0];\nvar type = inp[2];\n\nif (type == \"week\") {\n var current = 5;\n var a = 0;\n for (var i = 0; i < 366; ++i) {\n if(current == n)\n ++a;\n ++current;\n if(current > 7)\n current = 1;\n }\n print(a);\n} else {\n var a = 0;\n for (var i = 0; i < 12; ++i) {\n a += n <= t[i];\n \n }\n print(a);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "01c987c94da11b9a4f3f18b7ea3a0e86", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var s = readline().split(' ');\nvar p =function () {var t= parseInt(s[0]); if (s[2]=='month') {if (t<=29) { return 12;} else if (t==30) {return 11;} else return 7;} else if (t<=4 || t==7) {return 52;} else return 53; };\nprint (p());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e2f52f1fe8793cc55d76ddb2b362e47", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "\nvar week = function (n) {\n var baseweek = 52;\n if (n==5 || n==6){\n baseweek++;\n }\n return baseweek;\n}\nvar month = function (n) {\n var res = 0;\n if (n<=29){\n res = 12;\n }else if (n==30){\n res = 11;\n }else{\n res = 7;\n }\n return res;\n}\nvar inp = readline();\n\nif (inp.includes(\"month\")){\n write(month(inp.split(\" \")[0]));\n}else{\n write(week(inp.split(\" \")[0]));\n\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0b742331c8451d3cee57b05aeccef34e", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var cwDirections = ['^', '>', 'v', '<'];\n\nfunction main() {\n var dirs = readline().split(' ');\n var start = dirs[0];\n var end = dirs[1];\n var n = Number(readline());\n\n if (n % 2 === 0) {\n return print('undefined');\n }\n\n var startIndex = cwDirections.indexOf(start); // ^ = 0\n var endIndex = cwDirections.indexOf(end); // > = 1\n\n if ((startIndex + n) % 4 === endIndex) {\n return 'cw';\n } else {\n return 'ccw';\n }\n\n print();\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "40612d7c49174fba79b65ae78bd1f843", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var cwDirections = ['^', '>', 'v', '<'];\n\nfunction main() {\n var dirs = readline().split(' ');\n var start = dirs[0];\n var end = dirs[1];\n var n = Number(readLine());\n\n if (n % 2 === 0) {\n return print('undefined');\n }\n\n var startIndex = cwDirections.indexOf(start); // ^ = 0\n var endIndex = cwDirections.indexOf(end); // > = 1\n\n if ((startIndex + n) % 4 === endIndex) {\n return 'cw';\n } else {\n return 'ccw';\n }\n\n print();\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3b569bfea555fd83a7481a06e31a08b1", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var cwDirections = ['^', '>', 'v', '<'];\n\nfunction main() {\n var dirs = readline().split(' ');\n var start = dirs[0];\n var end = dirs[1];\n var n = Number(readline());\n\n if (n % 2 === 0) {\n return print('undefined');\n }\n\n var startIndex = cwDirections.indexOf(start); // ^ = 0\n var endIndex = cwDirections.indexOf(end); // > = 1\n\n if ((startIndex + n) % 4 === endIndex) {\n print('cw');\n } else {\n print('ccw');\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8bfc68ac909739278c1076f720b94226", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var a = [];\n\tfor(var i = 1; i <= 3; i++)\n\t{\n\t\ta[i] = parseInt(readline());\n\t}\n\twhile(a[1]*4 > a[3])\n\t{\n\t\ta[1] --;\n\t}\n\twhile(a[1]*2 > a[2])\n\t{\n\t\ta[1] --;\n\t}\n\tvar ans = a[1]+a[1]*2+a[1]*4;\n\tprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dfbb997764e492c14a828e1d7f75d73b", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet count = 0;\nlet a, b, c;\n\nconst solve = () => {\n let ans = 0;\n let hasFruits = true;\n\n while (hasFruits) {\n a -= 1;\n b -= 2;\n c -= 4;\n\n if (a > -1 && b > -1 & c > -1) {\n ans += 7;\n }\n else {\n hasFruits = false;\n }\n }\n\n console.log(ans);\n};\n\nrl.on('line', (d) => {\n if (count === 0) {\n a = +d;\n }\n else if (count === 1) {\n b = +d;\n }\n else {\n c = +d;\n\n solve();\n }\n\n count++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a918f7beab32420e65f034eb02fae00b", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var a = readline();\nvar b = readline();\nvar c = readline();\nvar res = 0;\nwhile(a*2>b || a*4>c){\na--;\n}\nres = a+a*2+a*4;\nprint(res);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4cf59467efa359680f58895eaad7f561", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar sides = [];\n\n\tfor (var i = 0; i < 4; i += 1) {\n\t\tvar integers = tokenizeIntegers(readline());\n\t\tsides.push( { x0: integers[0], y0: integers[1],\n\t\t\t\t\t x1: integers[2], y1: integers[3] } );\n\t}\n\n\tvar used = new Array(4);\n\n\tvar found = false;\n\n\tfunction go(attempt) {\n\t\tif (attempt.length == 4) {\n\t\t\tvar a = attempt[0], b = attempt[1], c = attempt[2], d = attempt[3];\n\t\t\tif (a.x0 == a.x1 && b.y0 == b.y1 && c.x0 == c.x1 && d.y0 == d.y1 &&\n\t\t\t\t\tMath.max(a.y0, a.y1) == b.y0 &&\n\t\t\t\t\tMath.max(b.x0, b.x1) == c.x0 &&\n\t\t\t\t\tMath.min(c.y0, c.y1) == d.y0 &&\n\t\t\t\t\tMath.min(d.x0, d.x1) == a.x0) {\n\t\t\t\tfound = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor (var i = 0; i < 4; i += 1) {\n\t\t\t\tif (used[i] === undefined) {\n\t\t\t\t\t\tused[i] = true;\n\t\t\t\t\t\tattempt.push(sides[i]);\n\t\t\t\t\t\tgo(attempt);\n\t\t\t\t\t\tattempt.pop();\n\t\t\t\t\t\tused[i] = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgo([]);\n\n\tprint(found ? \"YES\" : \"NO\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "42ef1a3323e2c2e4124eb58354026182", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar sides = [];\n\n\tfor (var i = 0; i < 4; i += 1) {\n\t\tvar integers = tokenizeIntegers(readline());\n\t\tsides.push([ { x: integers[0], y: integers[1] },\n\t\t\t\t\t { x: integers[2], y: integers[3] } ]);\n\t}\n\n\tfunction makeCorner(a, b) {\n\t\tfor (var i = 0; i < 2; i += 1) {\n\t\t\tvar p = a[i], q = a[(i+1)%2];\n\t\t\tfor (var j = 0; j < 2; j += 1) {\n\t\t\t\tvar r = b[j], s = b[(j+1)%2];\n\t\t\t\tif (p.y == q.y && p.x != q.x &&\n\t\t\t\t\t\tq.x == r.x && q.y == r.y &&\n\t\t\t\t\t\tr.x == s.x && r.y != s.y) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (p.x == q.x && p.y != q.y &&\n\t\t\t\t\t\tq.x == r.x && q.y == r.y &&\n\t\t\t\t\t\tr.y == s.y && r.x != s.x) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//write(\"(\"+a[0].x+\", \"+a[0].y+\") (\"+a[1].x+\", \"+a[1].y+\")\");\n\t\t//print(\" -> (\"+b[0].x+\", \"+b[0].y+\") (\"+b[1].x+\", \"+b[1].y+\")\");\n\t\treturn false;\n\t}\n\n\tvar used = new Array(4);\n\tvar okay = false;\n\n\tfunction go(attempt) {\n\t\t//print(attempt.length);\n\t\tif (attempt.length == 4) {\n\t\t\tif (makeCorner(attempt[3], attempt[0])) {\n\t\t\t\tokay = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor (var i = 0; i < 4; i += 1) {\n\t\t\t\tif (used[i] === undefined) {\n\t\t\t\t\tif (attempt.length == 0 ||\n\t\t\t\t\t\t\tmakeCorner(attempt[attempt.length-1], sides[i])) {\n\t\t\t\t\t\tused[i] = true;\n\t\t\t\t\t\tattempt.push(sides[i]);\n\t\t\t\t\t\tgo(attempt);\n\t\t\t\t\t\tattempt.pop();\n\t\t\t\t\t\tused[i] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgo([]);\n\tprint(okay ? \"YES\" : \"NO\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1a1898d2625788e4474151aba56b1eb4", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar sides = [];\n\n\tfor (var i = 0; i < 4; i += 1) {\n\t\tvar integers = tokenizeIntegers(readline());\n\t\tsides.push( { x0: integers[0], y0: integers[1],\n\t\t\t\t\t x1: integers[2], y1: integers[3] } );\n\t}\n\n\tvar used = new Array(4);\n\n\tvar found = false;\n\n\tfunction go(attempt) {\n\t\tif (attempt.length == 4) {\n\t\t\tvar a = attempt[0], b = attempt[1], c = attempt[2], d = attempt[3];\n\t\t\tif (a.x0 == a.x1 && b.y0 == b.y1 && c.x0 == c.x1 && d.y0 == d.y1 &&\n\t\t\t\t\ta.y0 != a.y1 && b.x0 != b.x1 &&\n\t\t\t\t\tMath.max(a.y0, a.y1) == b.y0 &&\n\t\t\t\t\tMath.max(b.x0, b.x1) == c.x0 &&\n\t\t\t\t\tMath.min(c.y0, c.y1) == d.y0 &&\n\t\t\t\t\tMath.min(d.x0, d.x1) == a.x0) {\n\t\t\t\tfound = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor (var i = 0; i < 4; i += 1) {\n\t\t\t\tif (used[i] === undefined) {\n\t\t\t\t\t\tused[i] = true;\n\t\t\t\t\t\tattempt.push(sides[i]);\n\t\t\t\t\t\tgo(attempt);\n\t\t\t\t\t\tattempt.pop();\n\t\t\t\t\t\tused[i] = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgo([]);\n\n\tprint(found ? \"YES\" : \"NO\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c9f0e0ca65bf02d6ccb192a0bab49b2f", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\n\nvar IsPrime = function (num) {\n if (num == 2)\n return true;\n if (num < 2 || num % 2 == 0)\n return false;\n var limit = parseInt(Math.sqrt(num));\n for (i = 3; i <= limit; i += 2) {\n if (num % i == 0)\n return false;\n }\n return true;\n}\n\nvar prev = 2,\n n, k, counter = 0,\n helper;\n\nrl.on('line', (input) => {\n var temp = input.split(' ').map(item => parseInt(item));\n n = temp[0];\n k = temp[1];\n\n for (let i = 3; i <= n; i++) {\n if (IsPrime(i)) {\n helper = prev + i + 1;\n if (IsPrime(helper) && helper <= n)\n counter++;\n prev = i;\n }\n }\n console.log((counter >= k) ? \"YES\" : \"NO\");\n rl.close();\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ec89678ff4e4f1a2d6611fd492518bc3", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\n\nconst N = lll[0]\nconst K = lll[1]\n\nconst simples = getSimpleToN(N)\n\nlet sc = 0\n\nsimples.forEach((s, i, a) => {\n for (let j = 1; j < i; j++) {\n let ps = a[j] + a[j - 1] + 1\n if (s == a[j] + a[j - 1] + 1) sc++\n if (s <= ps) break\n }\n})\n\n\nprint(sc >= K ? 'YES' : 'NO')\n\nfunction getSimpleToN (N) {\n const ss = [2]\n next: for (let i = 3; i <= N; i++) {\n for (let j = 0; j < ss.length; j++) {\n if (!(i % ss[j])) continue next\n }\n ss.push(i)\n }\n return ss\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3d1165edcb8311bca8cc9e2cdb06f7ec", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar IsPrime = function (Num) {\n if (Num == 2)\n return true;\n if (Num < 2 || Num % 2 == 0)\n return false;\n let limit = parseInt(Math.sqrt(Num));\n for (let i = 3; i <= limit; i+=2){\n if (!(Num % i))\n return false;\n }\n return true;\n}\n\nrl.on('line', (input) => {\n let temp = input.split(' ').map(item => parseInt(item));\n let n = temp[0];\n let k = temp[1];\n let prev = 2, counter = 0;\n\n for (let i = 3; i < n; i++){\n if (IsPrime(i)){\n let helper = prev + i + 1;\n counter += (IsPrime(helper) && helper <= n);\n prev = i;\n }\n }\n console.log(counter >= k?\"YES\":\"NO\");\n rl.close();\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "49a0db71424efb7105e9fb1d67752ba6", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var nk = readline().split(' ').map(Number);\nvar n = nk[0];\nvar k = nk[1];\n\nvar pros = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31];\nfor (var i=12; i<=n; i++){\n\tif (i%2 != 0 && i%3 != 0 && i%5 != 0 && i%7 != 0 && i%11 != 0 && i%13 != 0 && i%17 != 0 && i%19 != 0 && i%23 != 0 && i%29 != 0 && i%31 != 0) pros.push(i);\n}\n\nvar prossum = [];\nfor (var i=0; i<(pros.length-1); i++){\n\tvar sum = pros[i] + pros[i+1] + 1;\n\tif (sum%2 != 0 && sum%3 != 0 && sum%5 != 0 && sum%7 != 0 && sum%11 != 0 && sum%13 != 0 && sum%17 != 0 && sum%19 != 0 && sum%23 != 0 && sum%29 != 0 && sum%31 != 0 && sum<=n) prossum.push(sum);\n}\n\nif (prossum.length >= k) print ('YES');\nelse print ('NO');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ae91d35feddb301608af6d2bf89b17da", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var nk = readline().split(' ').map(Number);\nvar n = nk[0];\nvar k = nk[1];\n\nvar pros = [2, 3, 5, 7, 11];\nfor (var i=12; i<=n; i++){\n\tif (i%2 != 0 && i%3 != 0 && i%5 != 0 && i%7 != 0 && i%11 != 0) pros.push(i);\n}\n\nvar prossum = [];\nfor (var i=0; i<(pros.length-1); i++){\n\tvar sum = pros[i] + pros[i+1] + 1;\n\tif (sum%2 != 0 && sum%3 != 0 && sum%5 != 0 && sum%7 != 0 && sum%11 != 0 && sum<=n) prossum.push(sum);\n}\n\nif (prossum.length >= k) print ('YES');\nelse print ('NO');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7648b3b15b9fd4dfe8c1f3dc70ba471d", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\n\nconst N = lll[0]\nconst K = lll[1]\n\nconst simples = getSimpleToN(N)\n\nlet sc = 0\n\nsimples.forEach((s, i, a) => {\n for (let j = 0; j < i; j++) {\n if (s == a[j] + a[j] + 1) sc++\n }\n})\n\n\nprint(sc >= K ? 'YES' : 'NO')\n\nfunction getSimpleToN (N) {\n const ss = [2]\n next: for (let i = 3; i < N; i++) {\n for (let j = 0; j < ss.length; j++) {\n if (!(i % ss[j])) continue next\n }\n ss.push(i)\n }\n return ss\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "322f956fe272815cf9213306a0c2377a", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' ');\n\nvar count = Number(a[0]);\nvar place = Number(a[1]);\nvar diff = place > count / 2 ? count - place : place - 1;\n\nprint(count*2 + 1 + count - 1 + diff)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f1005a388944318d173e02342a760cd2", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const input = readline().split(\" \").map(e => parseInt(e));\nconst n = input[0];\nconst k = input[1];\n\nconst moving = n - 1 + Math.min(n - k, k - 1);\nconst stones = n + 1;\n\nprint(moving + stones + n);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bc1ce923e4a5709358a347e6520ff040", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arry=readline().split(' ');\nvar manhole = arry[0], position = arry[1], steps=manhole*3;\n\nif (position != 1 && position != manhole) {\n steps += Math.min(position - 1, manhole - position);\n}\n \nprint(steps) \n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b2de391d9666c06a41ffc42607c0c4a2", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var inp = readline().split(' ').map(x => parseInt(x));\nvar n = inp[0], k = inp[1];\n\nvar mn = Math.min(n - k, k - 1);\nvar mx = Math.max(n - k, k - 1);\nvar ans = 3 + 4 * mn + 3 * mx;\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "48959167174509d3bd40a49c411ceb27", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var nk = readline().split(' ').map(v=>(parseInt(v)))\nvar n = nk[0]\nvar k = nk[1]\n\nprint(3*n + Math.min( k>0 ? k-1:n-k, n-k) )\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ec795cad83e1d7485e149cbf2eb179e0", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var stats = readline().split(' ').map(function (num) {\n return parseInt(num);\n });\n\n// var stats = [4, 2];\n\nfunction min(a, b) {\n return (a < b) ? a : b;\n}\n\nvar distance = min(stats[0] - stats[1], stats[1] - 1);\n\nwrite(distance + (3 * stats[0]));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9a7f3eb73d96722b027041162014600d", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arry=readline().split(' ');\n\nvar manhole = arry[0], position = arry[1], steps=0;\n\nif (position == manhole || position == 1) {\n steps = 3 + (manhole - 1)*3;\n}\nelse if (1 < position && position < manhole) {\n steps = 4 + (manhole - 1)*3;\n}\n \nprint(steps) ", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0f587e47f801a7e8477586fdd5504b98", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arry=readline().split(' ');\n\nvar manhole = arry[0], position = arry[1], steps=0;\n\nif (position == manhole || position == 1) {\n steps = manhole*3;\n}\nelse if (1 < position && position < manhole) {\n steps = Math.min(position - 1, manhole - position) + manhole*3;\n}\n \nprint(steps) ", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8b5d8cd1be1145eeb9a188ded88c1f12", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number), n = input[0], a = input[1], b = input[2], k = input[3];\nvar MOD = 1000000007;\nvar res = [];\na--;\nb--;\n\nfor (var j = 0; j < 2; j++) {\n res[j] = [];\n for (var i = 0; i < n + 1; i++) res[j][i] = 0;\n}\n\nres[0][a] = 1;\n\nfor (var j = 0; j < k; j++) {\n var current = j & 1;\n var next = current ^ 1;\n \n for (var i = 0; i < n; i++) res[next][i] = 0;\n\n for (var i = 0; i < n; i++) {\n var currentValue = res[current][i];\n var diff = Math.abs(i - b);\n var bottomBorder = Math.max(i - diff + 1, 0); // inclusively\n var topBorder = Math.min(i + diff, n); // exclusively\n res[next][bottomBorder] = (res[next][bottomBorder] + currentValue) % MOD;\n res[next][topBorder] = (res[next][topBorder] - currentValue);\n if (res[next][topBorder] < 0) res[next][topBorder] += MOD;\n }\n\n \n for (var i = 1; i < n; i++)\n res[next][i] = (res[next][i] + res[next][i-1]) % MOD;\n\n\n for (var i = 0; i < n; i++) {\n res[next][i] = res[next][i] - res[current][i];\n if (res[next][i] < 0) res[next][i] += MOD;\n }\n}\n\nvar sum = 0;\nfor (var i = 0; i < n; i++) {\n sum = (sum + res[k & 1][i]) % MOD;\n}\n\nwrite(sum);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7e53336be5add5ec4fee8220e29dc70c", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "function allEqual(arr) {\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] != arr[i - 1]) {\n return false;\n }\n }\n\n return true;\n}\n\nvar n = parseInt(readline(), 10);\nvar seq = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nseq.sort(function(a, b) { return a - b; });\nwhile (!allEqual(seq)) {\n seq[n - 1] = seq[n - 1] - seq[n - 2];\n seq.sort(function(a, b) { return a - b; });\n}\n\nvar result = 0;\nfor (var i = 0; i < n; i++) {\n result += seq[i];\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0e255916872be90ce834f2701575c6e0", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function allEqual(arr) {\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] != arr[i - 1]) {\n return false;\n }\n }\n\n return true;\n}\n\nvar n = parseInt(readline(), 10);\nvar seq = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nseq.sort(function(a, b) { return a - b; });\nwhile (!allEqual(seq)) {\n for (var k = n - 2; k >= 0; k++) {\n if (seq[n - 1] > seq[k]) {\n seq[n - 1] = seq[n - 1] - seq[k];\n break;\n }\n }\n \n seq.sort(function(a, b) { return a - b; });\n}\n\nvar result = 0;\nfor (var i = 0; i < n; i++) {\n result += seq[i];\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "176ae5b7ebffc00ed80777ab1cdc49e5", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function allEqual(arr) {\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] != arr[i - 1]) {\n return false;\n }\n }\n \n return true;\n}\n \nvar n = parseInt(readline(), 10);\nvar seq = readline().split(\" \").map(function(x) { return parseInt(x); });\n \nseq.sort(function(a, b) { return a - b; });\nwhile (!allEqual(seq)) {\n for (var k = n - 2; k >= 0; k--) {\n if (seq[n - 1] > seq[k]) {\n seq[n - 1] = seq[n - 1] - seq[k];\n break;\n }\n }\n \n seq.sort(function(a, b) { return a - b; });\n}\n \nvar result = 0;\nfor (var i = 0; i < n; i++) {\n result += seq[i];\n}\n \nprint(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ae72d18522de6f923d53b256f68481e3", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function allEqual(arr) {\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] != arr[i - 1]) {\n return false;\n }\n }\n\n return true;\n}\n\nvar n = parseInt(readline(), 10);\nvar seq = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nseq.sort(function(a, b) { return a - b; });\nwhile (!allEqual(seq)) {\n for (var k = n - 2; k >= 0; k--) {\n if (seq[n - 1] > seq[k]) {\n seq[n - 1] = seq[n - 1] - seq[k];\n break;\n }\n }\n\n seq.sort(function(a, b) { return a - b; });\n}\n\nvar result = 0;\nfor (var i = 0; i < n; i++) {\n result += seq[i];\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6c5cf2c99fa3f03a5d0ac01aa63cc932", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function gcd(a,b){\n //print(\"a=\"+a+\" b=\"+b+\"\\n\");\n return a%b==0 ? b : gcd(b,a%b);\n}\n\n\n\n\n\n\nvar num = parseInt(readline());\nvar arr = readline().split(\" \").map(function(x) { return parseInt(x); });\n\n//for(var i in arr) arr[i] = parseInt(arr[i]);\n\n var ans=arr[0];\n\n //print(\"arr[1]=\"+arr[1]+\"\\n\")\n var i;\n for(i=1;i<=num-1;i++)\n {\n ans=gcd(ans,arr[i]);\n }\n //print(ans);\n //print(num);\n print(ans*num);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b2d78053fce9e5c6c1defdf8753bfa8d", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function (){\n var i, n = parseInt(readline());\n var a = readline().split(' ');\n function gcd(a,b){\n if ( a % b == 0 ){\n return b;\n }else{\n return gcd(b,a%b);\n }\n }\n var g = parseInt(a[0]);\n for ( i = 1 ; i < n ; ++i){\n g = gcd(g,parseInt(a[i]));\n }\n print(g*n);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "75f71aaab523d7f20e69aa55b49b9c2c", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar n=+readline();\nvar x=readline().split(' ').map(function(v){return+v;});\n\nvar sum=1e20;\nwhile(true){\n\tx.sort(function(a,b){return a-b});\n\tfor(var i=1;ix[i-1]){\n\t\t\tx[i]=x[i]-x[i-1];\n\t\t}\n\t}\n\tvar s=x.reduce(function(a,b){return a+b}, 0);\n\t\tif(sx!==\"\"),\n cnt=dvsr(n);\n //console.log(cnt,arr)\n cnt.forEach((d)=>{\n let temp=\"\";\n while(d>0){\n temp+=arr.shift();\n d--\n }\n //console.log(arr,temp)\n temp=[...temp].reverse();\n arr=[...temp,...arr];\n \n })\n console.log(arr.reverse().join(\"\"))\n} \n\nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"ascii\");\n_input = \"\";\nprocess.stdin.on(\"data\", function (input) {\n _input += input;\n});\n\nprocess.stdin.on(\"end\", function () {\n processData(_input);\n});\nfunction dvsr(n){\n let v=Math.sqrt(n),cnt=[]\nfor(let i=2;i<=v;i++){\n if(n%i===0){\n cnt.push(i);\n cnt.push(n/i)\n }\n // cnt.push(i)\n}\nreturn cnt.sort((a,b)=>a-b)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4c737c8ac257d82cb004c7a86c1b9e8f", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "Node.js", "source_code": "\nfunction processData(input) {\n //Enter your code here\n let res=input.split(\"\\n\"), n=+(res[0]),\n arr=res[1].split(\"\").filter((x)=>x!==\"\"),\n cnt=dvsr(n);\n //console.log(cnt,arr)\n cnt.forEach((d)=>{\n ////console.log(arr,d)\n let temp=\"\";\n while(d>0){\n temp+=arr.shift();\n d--\n }\n //console.log(arr,temp)\n temp=[...temp].reverse();\n arr=[...temp,...arr];\n \n })\n console.log(arr.reverse().join(\"\"))\n} \n\nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"ascii\");\n_input = \"\";\nprocess.stdin.on(\"data\", function (input) {\n _input += input;\n});\n\nprocess.stdin.on(\"end\", function () {\n processData(_input);\n});\nfunction dvsr(n){\n let v=Math.sqrt(n),set=new Set()\nfor(let i=2;i<=v;i++){\n if(n%i===0){\n set.add(i);\n set.add(n/i)\n }\n // cnt.push(i)\n}\n let cnt=[...set]\nreturn cnt.sort((a,b)=>a-b)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5ce695abab4db7231e763b9247737963", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "Node.js", "source_code": "'use strict';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString='';\nlet currentLine=0;\nprocess.stdin.on('data',inputStdin=>{\n inputString+=inputStdin;\n});\nprocess.stdin.on('end',_=>{\n inputString=inputString.trim().split(\"\\n\").map(string=>{\n return string.trim();\n });\n main();\n});\nfunction readLine()\n{\n return inputString[currentLine++]; \n}\n\nfunction main()\n{\n const n=+(readLine());\n let enc=readLine().trim();\n let ans=enc;\n for(let i=2;i<=n;++i)\n {\n if(n%i==0)\n {\n ans=ans.substr(0,i).split(\"\").reverse().join(\"\")+ans.substr(i);\n }\n }\n console.log(ans);\n \n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "956a3db52c647f8e43179d370475ab04", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var inputs = readline();\nvar initlengths = parseInt(inputs);\n\nfunction reverse_partial(string, start, end){\n var newString = \"\";\n var appendString = string.substring(end, string.length);\n for (var i = end - 1; i >= start; i--) {\n newString += string[i];\n }\n return newString+appendString;\n}\n\nfunction decrypt(strings, lengths){\n if(lengths == initlengths){\n return reverse_partial(strings, 0, initlengths);\n }\n divisor = lengths+1;\n while(initlengths%divisor != 0){\n divisor++;\n }\n reversed = reverse_partial(strings,0,lengths);\n return decrypt(reversed, divisor);\n}\n\nwhile(inputs = readline()){\n print(decrypt(inputs, 0)); \n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "af8103ceefff1e53c12a4649726c6f66", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nvar s = readline();\nvar arr = [];\nvar result = \"\";\n\nfor(var i = 0; i < n; i++)\n{\n arr.push(s[i]);\n}\n\nfor(var i = 0; i < n + 1; i++)\n{\n if(n % i == 0)\n {\n subArr = arr.slice(0, i);\n subArr.reverse();\n\n for(var j = 0; j < i; j++)\n {\n arr[j] = subArr[j];\n }\n }\n}\n\nfor(var i = 0; i < n; i++)\n{\n result += arr[i];\n}\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "41257e305a95118c4afbb8f531773cab", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var n, t;\nn = readline ();\nn = n.trim ();\nt = readline ();\nt = t.trim ();\nvar i, a = [ ];\nfor ( i = 0; i < t.length; i ++ ) { a [ i ] = t [ i ]; }\nvar j, temp;\nfor ( i = 1; i < t.length; i ++ ) {\n if ( a.length % (i + 1) == 0 ) { \n for ( j = 0; j <= Math.floor ( i / 2 ); j ++ ) {\n temp = a [ j ];\n a [ j ] = a [ i - j ];\n a [ i - j ] = temp;\n }\n }\n}\nprint ( a.join ( '' ) );\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a44924c3df20ab663d743cd6a0c9b272", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nvar s = readline();\nvar arr = [];\nvar result = \"\";\nvar subArr;\n\nfor(var i = 0; i < n; i++)\n{\n arr.push(s[i]);\n}\n\nfor(var i = 1; i < n + 1; i++)\n{\n if(n % i == 0)\n {\n subArr = arr.slice(0, i);\n subArr.reverse();\n\n for(var j = 0; j < i; j++)\n {\n arr[j] = subArr[j];\n }\n }\n}\n\nfor(var i = 0; i < n; i++)\n{\n result += arr[i];\n}\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8260f029939f89fe580c771c585b650d", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (str) => {\n if (c === 0) {\n c++;\n return;\n }\n\n let arr = [...str];\n const len = arr.length;\n for (let i = 2; i <= len; i++) {\n if (len % i === 0) {\n const firstPart = arr.slice(0, i);\n const secondPart = arr.slice(i);\n\n firstPart.reverse();\n\n arr = [...firstPart, ...secondPart];\n }\n }\n\n console.log(arr.join(''));\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a97fe264f32c0fb2c5f918fc9f323913", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nvar t = readline();\nvar del = [];\nfor (var i=1; i<=n; i++){\n\tif (n%i == 0) del.push(i);\n}\nfor (var i=0; i {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n \nfunction readline() {\n return inputString[currentLine++];\n}\n// Make a Snippet for the code above this and then write your logic in main();\n \n \nfunction main() {\n const x = readline();\n var line2 = readline(); \n \n \n // console log function here\n console.log(removeAdjacent(x, line2));\n}\n \n// function here\n\nfunction removeAdjacent(l, s) {\n\n\tlet sArr = Array.from(s);\n\n\t// create a dictionary where every letter in associated the its positions in the string, \n\t// and a linkde list where every element has a reference in the dictionary near the position here stored\n\n\tlet sll = {value:s[0], prev: null, next: null};\n\tlet lettersDict = {[s[0]]: [{position: 0, elem: sll}]};\n\tlet start = sll;\n\tlet currElemLinkedList = sll;\n\n\tfor (let i = 1; i < l; i++) {\n\t\tlet curr = s[i];\n\n\t\tcurrElemLinkedList.next = {value:curr, prev: currElemLinkedList, next: null};\n\t\tif (curr in lettersDict) {\n\t\t\tlettersDict[curr].push({position: i, elem: currElemLinkedList.next});\n\t\t}\n\t\telse {\n\t\t\tlettersDict[curr] = [{position: i, elem: currElemLinkedList.next}];\n\t\t}\n\n\t\tcurrElemLinkedList = currElemLinkedList.next;\n\t}\n\n\tlet end = currElemLinkedList;\n\n\t// order the keys of the dictionary by ascii value\n\tconst keys = Object.keys(lettersDict);\n\tkeys.sort((a, b) => {\n\t\treturn b.charCodeAt(0) - a.charCodeAt(0)\n\t});\n\n\t// for every entry in keys check the string for adjacents\n\treturn keys.reduce((acc, curr) => {\n\t\tlet nEliminated = 0;\n\n\n\t\tfor (let i = 0; i < lettersDict[curr].length; i++) {\n\t\t\tlet elem = lettersDict[curr][i].elem;\n\t\t\tif (elem) {\n\t\t\t\tlet position = lettersDict[curr][i].position;\n\n\t\t\t\tlet leftComparable = elem.prev && elem.prev.value;\n\t\t\t\tlet rightComparable = elem.next && elem.next.value;\n\n\t\t\t\tif ((leftComparable && (leftComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1)) ||\n\t\t\t\t\t(rightComparable && (rightComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1))) {\n\t\t\t\t\tnEliminated++;\n\n\t\t\t\t\tlettersDict[curr][i].elem = null;\n\t\t\t\t\tif (leftComparable === elem.value) {\n\t\t\t\t\t\ti -= 2\n\t\t\t\t\t}\n\t\t\t\t\tlet prev = elem.prev;\n\t\t\t\t\tlet next = elem.next;\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tprev.next = next;\n\t\t\t\t\t}\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\tnext.prev = prev;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn acc + nEliminated;\n\t}, 0)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8cf5ea97fe4afa006c9457352abcb334", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\nprocess.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nlet input = ''\nlet ptr = 0\nprocess.stdin.on('data', (i) => {\n input += i\n})\n\n\nprocess.stdin.on('end', () => {\n input = input.split('\\n').map(a => a.replace(/(\\r\\n|\\n|\\r)/gm, ''))\n main()\n})\n\nfunction wr(...x) {\n console.log(...x)\n}\n\nfunction sort(a, inc = true) {\n if(inc) a.sort((a, b) => a - b)\n else a.sort((a, b) => b - a)\n}\n\nfunction readInt() {\n return parseInt(input[ptr++])\n}\n\nfunction readString() {\n return input[ptr++]\n}\n\nfunction readStrings() {\n return input[ptr++].split(' ')\n}\n\nfunction readInts() {\n return input[ptr++].split(' ').map(a => parseInt(a))\n}\n\nfunction main() {\n const l = readInt()\n let s = readString()\n let max = 0\n let count = 0\n let len = l\n for(let c = 1; c < l; c++) { // l -1 times\n let f = false\n for(let i = 1; i < len; i++) {\n if(s[i] > s[max]) max = i\n }\n // console.log(s, max, s[max], count)\n if(max !== 0 && s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n s = cut(max)\n len--\n count++\n f = true\n }\n else {\n for(let x = max; x < len - 1; x++) {\n if(s[x] === s[max] && s.charCodeAt(x) - 1 === s.charCodeAt(x + 1)) {\n // console.log('x', x, s[x])\n s = cut(x)\n len--\n count++\n f = true\n break\n }\n }\n }\n if(!f) s = put(max)\n max = 0\n }\n\n wr(count)\n\n function cut(i) {\n i++\n return s.substring(0, i - 1) + s.substring(i)\n }\n function put(i) {\n i++\n return s.substring(0, i - 1) + 'A' + s.substring(i)\n\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aa09744d1c1d7d0a98a04b84be2bcee8", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "function generateAlphabets() {\n var alphabets = [];\n var start = 'a'.charCodeAt(0);\n var last = 'z'.charCodeAt(0);\n for (var i = start; i <= last; ++i) {\n alphabets.push(String.fromCharCode(i));\n }\n\n return alphabets;\n}\n\nconst seq = generateAlphabets();\n\n\n\n\nconst processData = (lines) => {\n const s = lines[1].split('').map(x => x.charCodeAt(0))\n let sum = 0\n const set = Array.from(new Set(s)).sort((a, b) => a - b).reverse()\n for (const l of set) {\n const target = l - 1;\n for (let j =0; j i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n processData(lines)\n})\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "97b265e18efe8ea7f73d68bdf067a3b0", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "'use strict';\n \nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n \nlet inputString = '';\nlet currentLine = 0;\n \nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n \nfunction readline() {\n return inputString[currentLine++];\n}\n// Make a Snippet for the code above this and then write your logic in main();\n \n \nfunction main() {\n const x = readline();\n var line2 = readline(); \n \n console.log(removeAdjacent(x, line2));\n}\n \nfunction findComparable(direction /* -1 left, 1 right*/, from, sArr) {\n\treturn from+(direction*(sArr.findIndex((_, index) => sArr[from+(direction*(index+1))]!='#')+1));\n}\n \nfunction removeAdjacent(l, s) {\n \n\tlet sArr = Array.from(s);\n \n\t// create a dictionary where every letter in associated the its positions in the string\n\tconst lettersDict = sArr.reduce((acc, curr, i) => {\n\t\tif (curr in acc) {\n\t\t\tacc[curr].push(i);\n\t\t}\n\t\telse {\n\t\t\tacc[curr] = [i];\n\t\t}\n\t\treturn acc;\n\t}, {});\n \n\t// order the keys of the dictionary by ascii value\n\tconst keys = Object.keys(lettersDict);\n\tkeys.sort((a, b) => {\n\t\treturn b.charCodeAt(0) - a.charCodeAt(0)\n\t});\n \n\t// for every entry in keys check the string for adjacents\n\treturn keys.reduce((acc, curr) => {\n\t\tlet nEliminated = 0;\n\n\t\tfor (let i = 0; i < lettersDict[curr].length; i++) {\n\t\t\tlet position = lettersDict[curr][i];\n\t\t\tlet leftComparable = findComparable(-1, position, sArr);\n\t\t\tlet rightComparable = findComparable(1, position, sArr);\n\t\t\tif ((sArr[leftComparable] && (sArr[leftComparable].charCodeAt(0) - sArr[position].charCodeAt(0) == -1)) ||\n\t\t\t\t(sArr[rightComparable] && (sArr[rightComparable].charCodeAt(0) - sArr[position].charCodeAt(0) == -1))) {\n\t\t\t\tnEliminated++;\n\t\t\t\tif (sArr[position-1] === sArr[position]) {\n\t\t\t\t\ti -= 2;\n\t\t\t\t}\n\t\t\t\tsArr[position] = '#';\n\t\t\t}\n\t\t}\n\n\t\treturn acc + nEliminated;\n\t}, 0);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3a8bad76291340887b853a8b69e524cf", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\nprocess.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nlet input = ''\nlet ptr = 0\nprocess.stdin.on('data', (i) => {\n input += i\n})\n\n\nprocess.stdin.on('end', () => {\n input = input.split('\\n').map(a => a.replace(/(\\r\\n|\\n|\\r)/gm, ''))\n main()\n})\n\nfunction wr(...x) {\n console.log(...x)\n}\n\nfunction sort(a, inc = true) {\n if(inc) a.sort((a, b) => a - b)\n else a.sort((a, b) => b - a)\n}\n\nfunction readInt() {\n return parseInt(input[ptr++])\n}\n\nfunction readString() {\n return input[ptr++]\n}\n\nfunction readStrings() {\n return input[ptr++].split(' ')\n}\n\nfunction readInts() {\n return input[ptr++].split(' ').map(a => parseInt(a))\n}\n\nfunction main() {\n const l = readInt()\n let s = readString()\n let max = 0\n let count = 0\n let len = l\n for(let c = 1; c < l; c++) { // l -1 times\n for(let i = 1; i < len; i++) {\n if(s[i] > s[max]) max = i\n }\n // console.log(s, max, count)\n if(max === len - 1) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n count++\n }\n }\n else if(max !== 0) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1) || s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n count++\n }\n }\n else {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1)) {\n count++\n }\n }\n s = cut(max)\n len--\n max = 0\n }\n\n wr(count)\n\n function cut(i) {\n i++\n return s.substring(0, i - 1) + s.substring(i)\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1b9d1c40243d65969d668073e24fc60b", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\nprocess.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nlet input = ''\nlet ptr = 0\nprocess.stdin.on('data', (i) => {\n input += i\n})\n\n\nprocess.stdin.on('end', () => {\n input = input.split('\\n').map(a => a.replace(/(\\r\\n|\\n|\\r)/gm, ''))\n main()\n})\n\nfunction wr(...x) {\n console.log(...x)\n}\n\nfunction sort(a, inc = true) {\n if(inc) a.sort((a, b) => a - b)\n else a.sort((a, b) => b - a)\n}\n\nfunction readInt() {\n return parseInt(input[ptr++])\n}\n\nfunction readString() {\n return input[ptr++]\n}\n\nfunction readStrings() {\n return input[ptr++].split(' ')\n}\n\nfunction readInts() {\n return input[ptr++].split(' ').map(a => parseInt(a))\n}\n\nfunction main() {\n const l = readInt()\n let s = readString()\n let max = 0\n let count = 0\n let len = l\n for(let c = 1; c < l; c++) { // l -1 times\n for(let i = 1; i < len; i++) {\n if(s[i] > s[max]) max = i\n }\n // console.log(s, max, count)\n if(max === len - 1) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n s = cut(max)\n len--\n count++\n }\n else {\n s = put(max)\n }\n }\n else if(max !== 0) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1) || s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n s = cut(max)\n len--\n count++\n }\n else {\n s = put(max)\n }\n }\n else {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1)) {\n s = cut(max)\n len--\n count++\n }\n else {\n s = put(max)\n }\n }\n max = 0\n }\n\n wr(count)\n\n function cut(i) {\n i++\n return s.substring(0, i - 1) + s.substring(i)\n }\n function put(i) {\n i++\n return s.substring(0, i - 1) + 'A' + s.substring(i)\n\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e6dca04d009b224cc666725e0e96f69b", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\nprocess.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nlet input = ''\nlet ptr = 0\nprocess.stdin.on('data', (i) => {\n input += i\n})\n\n\nprocess.stdin.on('end', () => {\n input = input.split('\\n').map(a => a.replace(/(\\r\\n|\\n|\\r)/gm, ''))\n main()\n})\n\nfunction wr(...x) {\n console.log(...x)\n}\n\nfunction sort(a, inc = true) {\n if(inc) a.sort((a, b) => a - b)\n else a.sort((a, b) => b - a)\n}\n\nfunction readInt() {\n return parseInt(input[ptr++])\n}\n\nfunction readString() {\n return input[ptr++]\n}\n\nfunction readStrings() {\n return input[ptr++].split(' ')\n}\n\nfunction readInts() {\n return input[ptr++].split(' ').map(a => parseInt(a))\n}\n\nfunction main() {\n const l = readInt()\n let s = readString()\n let max = 0\n let count = 0\n let len = l\n for(let c = 1; c < l; c++) { // l -1 times\n for(let i = 1; i < len; i++) {\n if(s[i] > s[max]) max = i\n }\n // console.log(s, max, count)\n if(max === len - 1) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n s = cut(max)\n len--\n count++\n }\n }\n else if(max !== 0) {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1) || s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {\n s = cut(max)\n len--\n count++\n }\n else {\n s = put(max)\n }\n }\n else {\n if(s.charCodeAt(max) - 1 === s.charCodeAt(max + 1)) {\n s = cut(max)\n len--\n count++\n }\n else {\n s = put(max)\n }\n }\n max = 0\n }\n\n wr(count)\n\n function cut(i) {\n i++\n return s.substring(0, i - 1) + s.substring(i)\n }\n function put(i) {\n i++\n return s.substring(0, i - 1) + 'A' + s.substring(i)\n\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "11d93ba685f4d613eec6b6b5bc656075", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "function generateAlphabets() {\n var alphabets = [];\n var start = 'a'.charCodeAt(0);\n var last = 'z'.charCodeAt(0);\n for (var i = start; i <= last; ++i) {\n alphabets.push(String.fromCharCode(i));\n }\n\n return alphabets;\n}\n\nconst seq = generateAlphabets();\n\n\n\n\nconst processData = (lines) => {\n const s = lines[1].split('').map(x => x.charCodeAt(0))\n let sum = 0\n const set = Array.from(new Set(s)).sort((a, b) => a - b).reverse()\n for (const l of set) {\n const target = l - 1;\n for (let j =0; j i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n processData(lines)\n})\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e698206c718fa301661dd44929708641", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n\nfunction readline() {\n return inputString[currentLine++];\n}\n// Make a Snippet for the code above this and then write your logic in main();\n\n\nfunction main() {\n const x = readline();\n var line2 = readline(); \n \n console.log(removeAdjacent(x, line2));\n}\n\nfunction findComparable(direction /* -1 left, 1 right*/, from, sArr) {\n\treturn from+(direction*(sArr.findIndex((_, index) => sArr[from+(direction*(index+1))]!='#')+1));\n}\n\nfunction removeAdjacent(l, s) {\n\n\tlet sArr = Array.from(s);\n\n\t// create a dictionary where every letter in associated the its positions in the string\n\tconst lettersDict = sArr.reduce((acc, curr, i) => {\n\t\tif (curr in acc) {\n\t\t\tacc[curr].push(i);\n\t\t}\n\t\telse {\n\t\t\tacc[curr] = [i];\n\t\t}\n\t\treturn acc;\n\t}, {});\n\n\t// order the keys of the dictionary by ascii value\n\tconst keys = Object.keys(lettersDict);\n\tkeys.sort((a, b) => {\n\t\treturn b.charCodeAt(0) - a.charCodeAt(0)\n\t});\n\n\t// for every entry in keys check the string for adjacents\n\treturn keys.reduce((acc, curr) => {\n\t\tlet nEliminated = 0;\n\t\tlettersDict[curr].forEach((position) => {\n\t\t\tlet leftComparable = findComparable(-1, position, sArr);\n\t\t\tlet rightComparable = findComparable(1, position, sArr);\n\t\t\tif ((sArr[leftComparable] && (sArr[leftComparable].charCodeAt(0) - sArr[position].charCodeAt(0) == -1)) ||\n\t\t\t\t(sArr[rightComparable] && (sArr[rightComparable].charCodeAt(0) - sArr[position].charCodeAt(0) == -1))) {\n\t\t\t\tnEliminated++;\n\t\t\t\tsArr[position] = '#';\n\t\t\t}\n\t\t});\n\t\treturn acc + nEliminated;\n\t}, 0)\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c7148bf11950098c5bd5a4c45d6abf4a", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\n\nvar n = input[0];\nvar a = input[1];\nvar b = input[2];\nvar c = input[3];\nvar d = input[4];\n\nvar TR = 1;\n\nvar TL = 0;\nvar BL = 0;\nvar BR = 0;\n\nvar count = 0;\n\nwhile (TR <= n) {\n\tTL = c - b + TR;\n\tBL = a + c - b - d + TR;\n\tBR = a - d + TR;\n\tif ((TL > 0 && TL <= n) && (BL > 0 && BL <= n) && (BR > 0 && BR <= n)) {\n\t\tcount += 1;\n\t}\n\tTR ++;\n}\n\nvar answer = n * count;\n\nprint(answer);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "016d3de535736d3fa78b882118812849", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(n => parseInt(n))\nvar n = input[0];\nvar a = input[1];\nvar b = input[2];\nvar c = input[3];\nvar d = input[4];\n\nvar x1 = 0;\nvar x2 = x1 + b - c;\n// x3 can be any number with [1, n] range.\nvar x4 = x1 + a - d;\nvar x5 = x1 + a + b - c - d;\n// Imagine x1, x2, x4, x5 on a line.\nvar points = [x1, x2, x4, x5];\nvar validRangeLength = Math.max(...points) - Math.min(...points);\nvar totalCombinations = 0;\nif (validRangeLength <= n) {\n totalCombinations = (n - validRangeLength)*n;\n}\nprint(totalCombinations);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fc66c9b574d3387bea7d1300c514e36a", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(function () {\n\tvar line = readline().split(' ');\n\tvar n = parseInt(line[0]),\n\ta = parseInt(line[1]);\n\tb = parseInt(line[2]),\n\tc = parseInt(line[3]),\n\td = parseInt(line[4]);\n\tfunction check(v) {\n\t\treturn (v<=n&&v>0);\n\t}\n\tvar sum0 = a+b,\n\tsum1 = a+c,\n\tsum2 = b+d,\n\tsum3 = d+c;\n\tvar ans = 0;\n\tfor(var i=1;i<=n;++i) {\n\t\tif(check(sum0-sum1+i)&&check(sum0-sum2+i)&&check(sum0-sum3+i)) {\n\t\t\tans+=n;\n\t\t}\n\t}\n\tprint(ans);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8c0c816766d37023beebb98590ac8774", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var s = readline();\nvar arr = s.split(' ');\nvar n = parseInt(arr[0]);\nvar a = parseInt(arr[1]);\nvar b = parseInt(arr[2]);\nvar c = parseInt(arr[3]);\nvar d = parseInt(arr[4]);\n\nvar count = 0;\n\n\n var i = 1;\n var k = a + b + i;\n for (var j = 1; j <= n; j++) {\n var p = k + j;\n var ac = p - a - c - i;\n var cd = p - c - d - i;\n var bd = p - b - d - i;\n if (ac > 0 && ac <=n && cd > 0 && cd <= n && bd > 0 && bd <= n) count++;\n }\n\n\nprint(count * n);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "660e4feea726d0bd5e7c5ea53cad5378", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\n\nvar n = input[0];\nvar a = input[1];\nvar b = input[2];\nvar c = input[3];\nvar d = input[4];\n\nvar TR = 1;\n\nvar TL = 0;\nvar BL = 0;\nvar BR = 0;\n\nvar count = 0;\n\nwhile (TR <= n) {\n\tTL = c - b + TR;\n\tBL = a + c - b - d + TR;\n\tBR = a - d + TR;\n\tif ((TL > 0 && TL <= n) && (BL > 0 && BL <= n) && (BR > 0 && BR <= n)) {\n\t\tcount += 1;\n\t}\n\tTR ++;\n}\n\nTR = 1;\nprint(TL);\nprint(BL);\nprint(BR);\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ec15e866fbfdbbe41455678d51680c6e", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var s = readline();\nvar arr = s.split(' ');\nvar n = parseInt(arr[0]);\nvar a = parseInt(arr[1]);\nvar b = parseInt(arr[2]);\nvar c = parseInt(arr[3]);\nvar d = parseInt(arr[4]);\n\nvar count = 0;\n\n\nfor (var i = 1; i <= n; i++) {\n var k = a + b + i;\n for (var j = 1; j <= n; j++) {\n var p = k + j;\n var ac = p - a - c - i;\n var ad = p - a - d - i;\n var cd = p - c - d - i;\n var bd = p - b - d - i;\n if (ac > 0 && ac <=n && ad > 0 && ad <=n && cd > 0 && cd <= n && bd > 0 && bd <= n) count++;\n }\n}\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "66254e0ac28872072b01df6a98b5f8db", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var s = readline();\nvar arr = s.split(' ');\nvar n = parseInt(arr[0]);\nvar a = parseInt(arr[1]);\nvar b = parseInt(arr[2]);\nvar c = parseInt(arr[3]);\nvar d = parseInt(arr[4]);\n\nvar count = 0;\n\n\nfor (var i = 1; i <= n; i++) {\n var k = a + b + i;\n for (var j = 1; j <= n; j++) {\n var p = k + j;\n var ac = p - a - c - i;\n var cd = p - c - d - i;\n var bd = p - b - d - i;\n if (ac > 0 && ac <=n && cd > 0 && cd <= n && bd > 0 && bd <= n) count++;\n }\n}\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "82297e9befe549f81ff75c4dea6bf6c7", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function checkPairs (pairs) {\n pairs = pairs.split(\" \").join(\"\");\n pairs = pairs.replace(/0+$/g, \"\"); // strip trailing zeros\n pairs = pairs.replace(/^0+/g, \"\"); // strip first zeros\n pairs = pairs.replace(/0{2,}/g, \"\"); //strip 00\n\n return pairs.length;\n}\n\nvar smth = readline(),\n input = readline();\n\nvar output = checkPairs.call(null, input);\n\nwrite(output);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dd8a99563313bd2d94f26f6925a09f2b", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "n = +readline();\na = readline().split(\" \").map(Number);\n\nanswer = 0;\nlast_i = -100;\nfor (var i = 0; i < n; i++) {\n\tif (a[i] == 1) {\n\t\tif (last_i >=0 && last_i+2 == i) {\n\t\t\t// a[i-1] == 0\n\t\t\tanswer += 1;\n\t\t}\n\t\tanswer += 1;\n\t\tlast_i = i;\n\t}\n}\nwrite(answer);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aac79041477b8c7d5432273fc348a785", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function checkPairs (pairs) {\n pairs = pairs.split(\" \").join(\"\");\n pairs = pairs.replace(/0+$/g, \"\"); // strip trailing zeros\n pairs = pairs.replace(/^0+/g, \"\"); // strip first zeros\n pairs = pairs.replace(/00/g, \"\"); //strip 00\n\n return pairs.length;\n}\n\nvar input = readline();\n\nvar output = checkPairs.call(null, input);\n\nwrite(output);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4c4fe5c55a3f227cfbf2ff4c6cb08459", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "Node.js", "source_code": "'use strict'; /*jslint node:true, browser:true, es6:true*/\nconst rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })\nconst print = console.log\nconst lines = []\nrl.on('line', line => {\n lines.push(line);\n});\nrl.on('close', main)\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n\nfunction query(arr){\n let set = new Set(arr);\n if (set.size==1)\n return print('NO');\n print('YES');\n let left = [], last;\n for (let i=1; i+a);\n query(arr);\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c56a3db9396d322e27b8c9ddaef0913a", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\n\nvar fact = 1;\nfor (var i = 1; i < n / 2; ++i) {\n\tfact *= i;\n}\n\nvar val1 = 1;\nfor (var i = n / 2 + 1; i < n; ++i) {\n\tval1 *= i;\n}\n\nvar ans = fact * val1;\n\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "09a88313c25d49bf1e4fb00ce2f21760", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "const solve = (n) => {\n let res = 1;\n for (let i = 1; i <= n; i++) {\n res *= i;\n }\n res /= n;\n res /= (n >> 1);\n return res;\n};\n\nconst main = () => {\n const readline = require('readline');\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n rl.on('line', (line) => {\n console.log(solve(Number(line)));\n });\n};\n\nmain()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "43034018e3ba4765b22ecec1f63aad1b", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "let inputString = \"\";\nlet currentLine = 0;\nprocess.stdin.on(\"data\", (data) => {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\n\n// utils\nconst MOD = 1e9 + 7;\nconst mod = (n) => ((n % MOD) + MOD) % MOD;\nconst add = (a, b) => mod(mod(a) + mod(b));\nconst sub = (a, b) => mod(mod(a) - mod(b));\nfunction mul() {\n for (var a = arguments, r = a[0], i = a.length; --i; )\n r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;\n return r;\n}\nfunction inv(b) {\n for (var a = MOD, u = 0, v = 1, t; b; v = t)\n (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);\n u %= MOD;\n return u < 0 ? u + MOD : u;\n}\nfunction pow(base, n) {\n if (n === 0) return 1;\n let p = pow(base, Math.floor(n / 2));\n let res = mul(mod(p), mod(p));\n if (n % 2 === 1) res = mul(mod(res), base);\n return res;\n}\nfunction highestOneBit(i) {\n i |= i >> 1;\n i |= i >> 2;\n i |= i >> 4;\n i |= i >> 8;\n i |= i >> 16;\n return i - (i >>> 1);\n}\nfunction permutation(arr, len, store = \"\", permutations = []) {\n if (store.length === len) {\n permutations.push(store);\n return;\n }\n for (let i = 0; i < arr.length; i++) {\n const newArr = [...arr];\n const newChar = newArr.splice(i, 1);\n permutation(newArr, len, store.concat(newChar), permutations);\n }\n return permutations;\n}\n\nfunction main() {\n const n = +readLine();\n let result = \"\";\n let fact = 1n;\n for (let i = 2; i <= n - 1; i++) {\n fact *= BigInt(i);\n }\n const ans = fact / BigInt(Math.floor(n / 2));\n result += ans;\n console.log(result);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7543c874c4af3f071347704447bc5758", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "(()=>{\"use strict\";var t={675:(t,e)=>{Object.defineProperty(e,\"__esModule\",{value:!0}),Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){return Math.max(...this)},Array.prototype.min=function(){return Math.min(...this)},Array.prototype.sum=function(){let t=0;for(let e=0;e{if(l)return s=o.default.readFileSync(\"input.txt\").toString().trim().split(\"\\n\").map((t=>t.trim())),t(),o.default.writeFileSync(\"output.txt\",a),console.log(a),void(o.default.readFileSync(\"expected.txt\").toString().trim()==a.trim()&&console.log(\"\u2705 AC!\"));process.stdin.resume(),process.stdin.setEncoding(\"utf-8\"),process.stdin.on(\"data\",(t=>{u+=t})),process.stdin.on(\"end\",(e=>{s=u.trim().split(\"\\n\").map((t=>t.trim())),t(),console.log(a)}))};function f(){return s[i++]}function p(){return f().split(\" \").map((t=>parseFloat(t)))}function d(){return f().split(\"\")}e.default={runMain:c,runEachTest:t=>{c((()=>{let[e]=p();for(;e>0;)t(),e--}))},readline:f,nextNumbers:p,nextNumbersMatrix:function(t){let e=[];for(let r=0;r{t.exports=require(\"fs\")}},e={};!function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(965)})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "57cf4de8b41fde682ccaf23bf39b6e42", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = Number(readline());\nvar c = [2,3,5,7,11,13,17,19,23,29,31];\nfor(var i=0;i<10;i++){\n if(n%c[i]==0) break;\n}\nprint(\"\"+c[i]+(n/c[i]));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "14381f611c771b006a7bbbd921d33e49", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "JavaScript", "source_code": "var input = readline().split(\" \"), t = +input[0], s = +input[1], q = +input[2];\n\nfor(i = 1; ; i++){\n\ts += Math.round(s * (q - 1));\n\tif(t <= s){\n\t\tbreak;\n\t}\n}\nwrite(i);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ccbb11cbaa1fd6be6c856c1fb1008036", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var data = readline().split(' ');\nvar T = parseInt(data[0]);//\u0434\u043b\u0438\u043d\u0430 \u043f\u0435\u0441\u043d\u0438\nvar S = parseInt(data[1]);//\u043f\u0440\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u043e \u043f\u0435\u0441\u043d\u0438 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u0435\u0441\u043d\u0438)\nvar q = parseInt(data[2]);//\u0441\u0435\u043a\u0443\u043d\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438\nvar result=0;\n\nwhile ( S < T) {\nS = S + S*(q-1);\n result++;\n}\n\nwrite(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "839ac6176816f745925a41a875d15cf5", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var data = readline().split(' ');\nvar T = parseInt(data[0]);//\u0434\u043b\u0438\u043d\u0430 \u043f\u0435\u0441\u043d\u0438\nvar S = parseInt(data[1]);//\u043f\u0440\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u043e \u043f\u0435\u0441\u043d\u0438 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u0435\u0441\u043d\u0438)\nvar q = parseInt(data[2]);//\u0441\u0435\u043a\u0443\u043d\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438\nvar result=0;\nvar dL = 0;\nvar dS = 0;\n\n//\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f q-1\n//var eleps = T - S;\n S = S + S*(q-1);//\u043f\u0440\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0445 \u0441\u0435\u043a\u0443\u043d\u0434\nwhile ( dL < T) {\n dL = dL + S;\n result++;\n S = S + (q-1);\n}\n\nwrite(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7d4dd6676ff104e97942f9d303c49f42", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var arr = readline().split(' ');\nvar len = Number(arr[0]);\narr = readline().split(' ');\n\nvar str = arr[0];\nvar num_in_p = 0;\nvar max_len = 0;\nvar tmp_len = 0;\nvar p_flag = false;\nvar s_flag = false;\n\nfor (var i = 0;i < str.length;i ++) {\n\tif (!s_flag && !p_flag && helper(str[i]) == -1) {\n\t\ttmp_len ++;\n\t\ts_flag = true;\n\t} else if (s_flag && !p_flag && helper(str[i]) == -1) {\n\t\ttmp_len ++;\n\t} else if (helper(str[i]) != -1 && !p_flag) {\n\t\ts_flag = false;\n\t\tmax_len < tmp_len && max_len = tmp_len;\n\t\ttmp_len = 0;\n\t} \n\tif (!p_flag && helper(str[i]) == 1) {\n\t\tp_flag = true;\n\t} else if (p_flag && helper(str[i]) == 2) {\n\t\tp_flag = false;\n\t}\n\n\tif (p_flag && helper(str[i]) == -1 && !s_flag) {\n\t\ts_flag = true;\n\t} else if (p_flag && s_flag && helper(str[i]) != -1) {\n\t\tnum_in_p ++;\n\t} \n}\nmax_len < tmp_len && max_len = tmp_len;\n\nprint(max_len);\nprint(num_in_p);\n\nfunction helper(_c) {\n\tif (_c == '_') {\n\t\treturn 0;\n\t} else if (_c == '(') {\n\t\treturn 1;\n\t} else if (_c == ')') {\n\t\treturn 2;\n\t} else {\n\t\treturn -1;\n\t}\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bb97a553c396b9d086791f3d86331650", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "readline()\nvar str = readline()\nvar inside = ''\n\n!(str.match(/\\([^)]*\\)/g) || []).forEach(x => {\n\tinside += x.replace(/\\(|\\)/g, '_')\n\tstr = str.replace(x, '_')\n})\n\nvar lengths = str.split(/\\_+/).map(w => w.length)\nvar words = inside.split(/\\_+/).filter(x => x)\nprint(Math.max.apply(null, lengths) + ' ' + words.length)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "73c47bff2b1b632b918598c515f03e3c", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "readline();\nvar input = readline() + '(_)_';\nprint([\n Math.max(...input.replace(/[(][a-z_]*[)]/gi, '_').split('_').map(el => el.length)),\n input.match(/[(][a-z_]*[)]/gi).map(el => el.split(/[()_]/gi).filter(el => el)).reduce((a, b) => a + b.length, 0)\n].join(' '));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5e6ec3c597eb8838f763241a66df72be", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const n = Number(readline());\nconst a = readline().split(\" \").slice(0, n).map(x => Number(x));\nprint(2 + (a[2] ^ Math.min(...a)));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ac76b57f6ef9050fade04baa71d6bd7c", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "difficulty": null} {"lang": "Node.js", "source_code": "// problem name: Routine Problem\n// problem link: https://codeforces.com/problemset/problem/337/B\n// contest link: https://codeforces.com/contest/337\n// author: reyad\n// time: (?)\n\n'use strict';\n\nfunction gcd(a, b) {\n\twhile(b != 0) {\n\t\tlet t = b;\n\t\tb = a % b;\n\t\ta = t;\n\t}\n\treturn a;\n}\n\nfunction main() {\n\tlet a = nextInt();\n\tlet b = nextInt();\n\tlet c = nextInt();\n\tlet d = nextInt();\n\n\tif(c * b > a * d) {\n\t\tlet x = b * c - d * a;\n\t\tlet y = b * c;\n\t\tlet g = gcd(x, y);\n\t\tconsole.log((x / g) + '/' + (y / g));\n\t}\n\telse {\n\t\tlet x = d * a - b * c;\n\t\tlet y = d * a;\n\t\tlet g = gcd(x, y);\n\t\tconsole.log((x / g) + '/' + (y / g));\n\t}\n}\n\n\n\n// reader and main caller\n\nlet readline = require('readline');\n\nlet rl = readline.createInterface({\n\tinput: process.stdin,\n\toutput: process.stdout,\n\tterminal: false\n});\n\nlet inputBuf = [];\nlet inputBufCnt = 0;\nlet tk = []\nlet tkCnt = 0;\n\nfunction nextLine() {\n\treturn inputBuf[inputBufCnt++];\n}\nfunction next() {\n\tif(tkCnt == tk.length) {\n\t\ttk = inputBuf[inputBufCnt++].split(' ');\n\t\ttkCnt = 0;\n\t}\n\treturn tk[tkCnt++];\n}\nfunction nextInt() {\n\treturn parseInt(next());\n}\nfunction nextDouble() {\n\treturn parseFloat(next());\n}\n\nrl.on('line', (line) => {\n\tinputBuf.push(line);\n}).on('close', () => {\n\tmain();\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "208b27328b1d8b4ab56b43995fe695ed", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(function main() {\n var s = readline();\n var re = /^(http|ftp)(.+)ru(.*)$/;\n var res = re.exec(s);\n var rs = res[1] + '://' + res[2] + '.ru';\n if (res[3]) \n rs += '/' + res[3];\n print(rs)\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b483a2b285bac7da3f3cae745bdeaed0", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var input = readline().replace(/(http|ftp)/, '$1://');\nvar tmp = input.replace(/(\\w+)(ru)$/, '$1.$2');\nwrite((tmp == input) ? input.replace(/(\\w+)(ru)/, '$1.$2/') : tmp);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3b6538e738ec6b45255c056866942aa6", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var input = readline().replace(/(http|ftp)/, '$1://');\nvar tmp = input.replace(/(ru)$/, '.$1');\nwrite((tmp == input) ? input.replace(/(ru)/, '.$1/') : tmp);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f1a41faa373d0c880af4d3e257b603ef", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(n, k, l, c, d, p, nl, np){\n\tvar a = ~~( k*l/nl );\n\tvar b = c*d;\n\tvar e = ~~( p/np );\n\treturn ~~( Math.min(a,b,e)/n );\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0159ebb55558e71493c6404a15c071ee", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (data) => {\n let [n, k, l, c, d, p, nl, np] = data.split(' ').map(Number);\n\n let x = Math.floor(k * l / nl);\n let y = c * d;\n let z = Math.floor(p / np);\n let ans = Math.floor(Math.min(x, y, z) / n);\n\n console.log(ans);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8e8a13bec3b898ecd793caabfeccd396", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(\" \"), n = +input[0], k = +input[1], l = +input[2], c = +input[3],\nd = +input[4], p = +input[5], nl = +input[6], np = +input[7];\n\nwrite(Math.floor(Math.min( (Math.floor(k * l / nl)), (Math.floor(c * d)), (Math.floor(p / np)) ) / n));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a0be80d06205514034cca7cc33f3fbe5", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', data => {\n\tinputString += data;\n});\nprocess.stdin.on('end', function () {\n\tinputString = inputString\n\t\t.trim()\n\t\t.split('\\n')\n\t\t.map(str => str.trim());\n\tmain();\n});\n\nfunction readLine() {\n\treturn inputString[currentLine++];\n}\n\nfunction isPrime(x) {\n\tlet s = Math.sqrt(x);\n\tlet i = 2;\n\twhile (i <= s) {\n\t\tif (x % i === 0) {\n\t\t\treturn false;\n\t\t}\n\t\ti++;\n\t}\n\treturn true;\n}\n\nfunction main() {\n\tlet [n, k, l, c, d, p, nl, np] = readLine()\n\t\t.split(' ')\n\t\t.map(x => x >> 0);\n\n\tlet bottle = Math.floor((k * l) / nl);\n\tlet limes = c * d;\n\tlet salt = Math.floor(p / np);\n\n\tlet res = Math.floor(Math.min(bottle, limes, salt) / n);\n\tconsole.log(res);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f5189c9ae4847bceaf0507313e799cff", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\n// 151A \u0413\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u043e\u043f\u0438\u0442\u0438\u0435 \n\n// var n = parseInt(readline());\n\nvar input_line = readline().split(' ').map(Number);\n\nvar n = input_line[0];\nvar k = input_line[1];\nvar l = input_line[2];\nvar c = input_line[3];\nvar d = input_line[4];\nvar p = input_line[5];\nvar nl = input_line[6];\nvar np = input_line[7];\n\nvar gaz = k * l / nl / n;\nvar lame =c * d / n;\nvar sol = p / np / n;\n\nvar count = Math.floor(Math.min(gaz, lame, sol));\n\nprint(count);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eb6cea92a27fb1862793db5ced6ed2e4", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": ";(function () {\n\t\n\tvar d = readline().split(' ').map(Number);\n\n\tprint( Math.floor( Math.min( Math.floor(d[1] * d[2] / d[6]), d[3] * d[4], Math.floor(d[5] / d[7]) ) / d[0] ) );\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ed6aa74e8db919c32eff9cbb1c292b3f", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Soft Drinking\n\nconst {EOL} = require('os');\n\nlet inp = '';\n\nprocess.stdin.on('data', c => inp += c);\n\nprocess.stdin.on('end', () => {\n let lines = inp.split(EOL)[0].split(' ');\n \n let n = +lines[0];\n let k = +lines[1];\n let l = +lines[2];\n let c = +lines[3];\n let d = +lines[4];\n let p = +lines[5];\n let nl = +lines[6];\n let np = +lines[7];\n\n process.stdout.write(Math.min(~~((k * l) / (n * nl)), ~~((c * d) / n), ~~(p / (n * np))) + '');\n\n return;\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "08f3114a77c0c1e961fc1d61992e7e63", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const input = [];\n\nconst RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n});\n \nRL.on('line', line => input.push(line));\n\nRL.on('close', () => {\n const [n, k, l, c, d, p, nl, np] = input[0].split(' ').map(x => parseInt(x));\n let botl = parseInt((k * l) / nl);\n let lim = c*d; let s = parseInt(p / np);\n\n console.log( parseInt(Math.min(botl, lim, s) / n) );\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "12601dfa848410e55c2cddb68d4166e1", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var str = readline().split(\" \");\n // n,k,l,c, d, p,nl,np\nn = +str[0], k = +str[1], l = +str[2], c = +str[3],\nd = +str[4], p = +str[5], nl = +str[6], np = +str[7];\n\nprint(Math.floor(Math.min(k*l/nl, c*d, p/np)/n));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "80399355ab86fb98467f35f92c843a2c", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var numbers = readline().split(\" \").map(function(x) { return parseInt(x); });\n\nvar allMl = (numbers[1]*numbers[2]) / numbers[6]; // l * k / nl\nvar allSclice = numbers[3]*numbers[4]; // c * d \nvar pgram = numbers[5]/ numbers[7] ; // p / np\n\nvar min = function (x,y,z) {\n if (x <= y){\n if(x<= z){\n return x;\n }else {\n return z;\n }\n }else {\n if(y<=z){\n return y;\n }else{\n return z;\n }\n } \n};\n\nwrite(parseInt(min(allMl,allSclice,pgram)/numbers[0]));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "712af88f579ad9385ee2e4be3502d147", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let inputString = \"\";\nlet currentLine = 0;\nprocess.stdin.on(\"data\", (data) => {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n const [n, k, l, c, d, p, nl, np] = readLine()\n .split(\" \")\n .map((n) => parseInt(n));\n\n console.log(Math.floor(Math.min((k * l) / nl, c * d, p / np) / n));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1c7f7b47ff9dead0e3102d725e527fb0", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n input: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n obj = init(inLine);\n console.error('\\n');\n var start = Date.now();\n Main();\n var end = Date.now() - start;\n myerr('time : ' + end + 'ms');\n myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n return {\n list : input, index : 0, max : input.length,\n hasNext : function(){return (this.index < this.max);},\n next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n };\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n var one = nextIntArray();\n var n = one[0];\n var k = one[1];\n var l = one[2];\n var c = one[3];\n var d = one[4];\n var p = one[5];\n var nl = one[6];\n var np = one[7];\n var allB = k * l;\n var allS = c * d;\n myout(Math.min.apply(null, [Math.floor(allB / nl / n), Math.floor(p / np / n), Math.floor(allS / n)]));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cd1aee76d9102188509fec0753953d37", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let data = '';\nprocess.stdin.on('data', c => data += c);\n\nconst solution = () => {\n\tlet line = data.split('\\n');\n\tlet n = parseInt(line[0],10);\n\tlet a = line[1].split(' ').map(v => parseInt(v,10));\n\tlet c = 0;\n\twhile(a.length > 0){\n\t\tc++;\n\t\tlet t = [];\n\t\tlet min = Math.min(...a);\n\t\tfor(let i of a){\n\t\t\tif (i%min !== 0){\n\t\t\t\tt.push(i);\n\t\t\t}\n\t\t}\n\t\ta = t;\n\t\t\n\t}\n\tconsole.log(c);\n};\n\nprocess.stdin.on('end',solution);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "76f3202948d7355453f23d9ffec60cbf", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let i = '';\nprocess.stdin.on('data', (c) => {\n i += c;\n});\nprocess.stdin.on('end', () => {\n const { EOL } = require('os');\n const lines = i.split(EOL);\n let nums = lines[1].split(' ');\n nums = nums.map(num => parseInt(num, 10));\n console.log(getMinNums(nums));\n});\n\n\nfunction getMinNums(nums) {\n nums = nums.sort((a, b) => a - b);\n let count = 0;\n for (let i = 0; i < nums.length; i++) {\n if (nums[i] > 0) {\n count++;\n for (let j = i + 1; j < nums.length; j++) {\n if (nums[j] % nums[i] === 0) {\n nums[j] = 'a';\n }\n }\n }\n }\n return count;\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "42f9bbcd07224b513e3ff4b05baf311b", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\"use strict\";\n\nString.prototype.getNumArray = function () {\n return String(this).split(' ').map(function (value) {\n return parseInt(value);\n });\n};\n\nfunction bubbleSort(list) {\n var swapped;\n var n = list.length - 1;\n\n do {\n swapped = false;\n\n for (var i = 0; i < n; i++) {\n if (list[i] > list[i + 1]) {\n var temp = list[i];\n list[i] = list[i + 1];\n list[i + 1] = temp;\n swapped = true;\n }\n }\n } while (swapped);\n\n return list;\n}\n\nvar n = readline();\nvar array = bubbleSort(readline().getNumArray());\n\n(function () {\n if (array[0] === 1) {\n write(1);\n return;\n }\n\n var primeNumbersCount = 0;\n\n for (var i = 0; i < array.length; i++) {\n if (array[i] === -1) {\n continue;\n }\n\n var primeNumber = array[i];\n primeNumbersCount++;\n\n for (var j = i + 1; j < array.length; j++) {\n if (array[j] !== -1 && array[j] % primeNumber === 0) {\n array[j] = -1;\n }\n }\n }\n\n write(primeNumbersCount);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6413de564e4934e3859fda0b1df057f9", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n const arr = d.split(' ').map(Number);\n arr.sort((a, b) => a - b);\n let ans = 0;\n\n for (let i = 0; i < arr.length; i++) {\n let curr = arr[i];\n if (curr !== 0) {\n arr[i] = 0;\n ans++;\n\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] % curr === 0) {\n arr[j] = 0;\n }\n }\n }\n }\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d048f2d84db9c7b60cc4c5b7b62d3f63", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n input: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n obj = init(inLine);\n console.error('\\n');\n var start = Date.now();\n Main();\n var end = Date.now() - start;\n myerr('time : ' + end + 'ms');\n myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n return {\n list : input, index : 0, max : input.length,\n hasNext : function(){return (this.index < this.max);},\n next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n };\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n var N = nextInt();\n var list = nextIntArray();\n list.sort(function(a,b){\n \treturn a - b;\n });\n var map = {};\n for(var i = 0; i < N; i++){\n if(list[i] != -1){\n var div = list[i];\n map[list[i]] = [];\n for(var j = i; j < N; j++){\n if(list[j] % div == 0){\n list[j] = -1;\n }\n }\n }\n }\n myout(Object.keys(map).length);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "40412699bea87db4e4793a49ef21841a", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar a = readline().split(\" \").map(x=> parseInt(x));\na.sort((x,y) => x-y);\n\nvar c = 0;\nfor(var i=0;i {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n\nfunction readline() {\n return inputString[currentLine++];\n}\n\n\nfunction main(){\n\n var n = readline();\n var a = readline().split(\" \").map(x=> parseInt(x));\n a.sort((x,y) => x-y);\n \n let c = 0;\n for(let i=0;i list[i+1])\n {\n const temp = list[i]\n list[i] = list[i+1]\n list[i+1] = temp\n swapped = true\n }\n }\n } while (swapped) \n\n return list;\n}\n\n\nconst n = readline();\nconst array = bubbleSort(readline().getNumArray());\n\nif (array[0] === 1) {\n write(1);\n return;\n}\n\nlet primeNumbersCount = 0;\n\nfor(let i = 0; i < array.length; i++) {\n if (array[i] === -1) {\n continue;\n }\n\n let primeNumber = array[i];\n primeNumbersCount++;\n\n for(let j = i + 1; j < array.length; j++) {\n if (array[j] !== -1 && array[j] % primeNumber === 0) {\n array[j] = -1;\n }\n }\n}\n\nwrite(primeNumbersCount);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "12baa2ac2e8083208ee4d5dc8a8bbf80", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar a = readline().split(\" \").map(x=> parseInt(x));\na.sort((x,y) => x-y);\n\nlet c = 0;\nfor(let i=0;i parseInt(x));\na.sort((x,y) => x-y);\n\nvar c = 0;\nfor(var i=0;i parseInt(x));\n a.sort((x,y) => x-y);\n \n let c = 0;\n for(let i=0;i data += c);\n\nconst solution = () => {\n\tlet line = data.split(/\\n/g);\n\tlet n = parseInt(line[0],10);\n\tlet a = line[1].split(/\\s/g).map(v => parseInt(v,10));\n\tlet c = 0;\n\twhile(a.length > 0){\n\t\tc++;\n\t\tlet t = [];\n\t\tlet min = Math.min(...a);\n\t\tfor(let i of a){\n\t\t\tif (i%min !== 0){\n\t\t\t\tt.push(i);\n\t\t\t}\n\t\t}\n\t\ta = t;\n\t\t\n\t}\n\tconsole.log(c);\n};\n\nprocess.stdin.on('end',solution);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4be3422125bedaa3dbb3337cf9590f91", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": ";(function () {\n\t\n\tvar s = readline().split(' ').map(Number);\n\n\tprint( 4 * ( Math.pow(s[0]*s[1] / s[2] , 0.5) + Math.pow(s[0]*s[2] / s[1] , 0.5) + Math.pow(s[1] * s[2] / s[0] , 0.5) ) );\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "91885f8ff1e3607378d9abb063dc81b0", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', (inputStd) => {\n inputString += inputStd;\n});\nprocess.stdin.on('end', function () {\n inputString = inputString\n .trim()\n .split('\\n')\n .map((str) => {\n return str.trim();\n });\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n let [area1, area2, area3] = readLine().split(' ').map(Number);\n let a = Math.round(Math.sqrt((area1 * area3) / area2));\n let b = Math.round(Math.sqrt((area1 * area2) / area3));\n let c = Math.round(Math.sqrt((area2 * area3) / area1));\n console.log(4 * (a + b + c));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "62b4754d581e70fb9b29818ff921db77", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "let inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', data => {\n\tinputString += data;\n});\nprocess.stdin.on('end', function () {\n\tinputString = inputString\n\t\t.trim()\n\t\t.split('\\n')\n\t\t.map(str => str.trim());\n\tmain();\n});\n\nfunction readLine() {\n\treturn inputString[currentLine++];\n}\n\nfunction multiply(a, b) {\n\ta = a.toString(10).split('').reverse();\n\tb = b.toString(10).split('').reverse();\n\n\tif (a.length < b.length) {\n\t\t[a, b] = [b, a];\n\t}\n\n\tlet res = Array(a.length + b.length).fill(0);\n\tfor (let i = 0, lb = b.length; i < lb; ++i) {\n\t\tlet carry = 0;\n\t\tlet scarry = 0;\n\t\tfor (let j = 0, la = a.length; j < la; ++j) {\n\t\t\tlet m = b[i] * a[j];\n\t\t\tm += carry;\n\n\t\t\tif (m > 9) {\n\t\t\t\tlet [c, d] = m.toString(10).split('');\n\t\t\t\tres[i + j] += (scarry >> 0) + (d >> 0);\n\t\t\t\tcarry = c >> 0;\n\t\t\t} else {\n\t\t\t\tres[i + j] += (scarry >> 0) + m;\n\t\t\t\tcarry = 0;\n\t\t\t}\n\n\t\t\tif (res[i + j] > 9) {\n\t\t\t\tlet [c, d] = res[i + j].toString(10).split('');\n\t\t\t\tres[i + j] = d >> 0;\n\t\t\t\tscarry = c;\n\t\t\t} else {\n\t\t\t\tscarry = 0;\n\t\t\t}\n\t\t}\n\t\tif (carry > 0) res[a.length + i] = carry;\n\t\tif (scarry > 0) res[a.length + i] = scarry;\n\t}\n\n\tres.reverse();\n\tlet mulVal = '';\n\tlet flag = false;\n\tres.forEach(d => {\n\t\tif (!flag && d !== 0) flag = true;\n\t\tif (flag) mulVal += d;\n\t});\n\treturn mulVal;\n}\n\nfunction main() {\n\tlet [s1, s2, s3] = readLine()\n\t\t.split(' ')\n\t\t.map(x => x >> 0);\n\tlet res =\n\t\t4 *\n\t\t(Math.sqrt((s1 * s3) / s2) +\n\t\t\tMath.sqrt((s1 * s2) / s3) +\n\t\t\tMath.sqrt((s2 * s3) / s1));\n\tconsole.log(Math.floor(res));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b9d7838a6fdbccb3d85357d0904bddec", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(a, b, c){\n\tfor(var x=1; x<=a; x++)\n\t\tif(a%x===0 && c%(a/x)===0)\n\t\t\treturn 4*(x+a/x+c/(a/x));\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b5f67891592d771cbd39c4656a7fb6bf", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\tnumSongs = data[0], totalTime = data[1],\n\t\tsongs = tokenizeIntegers(readline());\n\tvar time = songs[0], jokes = 0;\n\tfor (var i = 1; i < numSongs; ++i) {\n\t\ttime += 10 + songs[i];\n\t\tjokes += 2;\n\t}\n\tif (time > totalTime) {\n\t\tprint(-1);\n\t} else {\n\t\tjokes += Math.floor((totalTime - time) / 5);\n\t\tprint(jokes);\n\t}\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a2d280ea3fba4b90532500345806eedc", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "if (!this.readline) print = console.log, readline = require('./readline');\n\nfunction readNums() {\n\treturn readline().split(' ').map(Number);\n}\n\nprint(function(n, d) {\n\n\tvar rest = d - readNums().reduce(function(a, b) {\n\t\treturn a + b;\n\t});\n\tif (rest < 10 * (n - 1))\n\t\treturn -1;\n\n\treturn Math.floor(rest / 5);\n\n}.apply(0, readNums()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a179eec07889e52a176be8066957bcdd", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nlet secondLine = false;\n\n\n// Create readline Interface\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet inputs = [];\n\n\n\nrl.on('line', lineInput => {\n inputs.push(lineInput);\n})\n\n// Read Inputs\nrl.on('close', () => {\n const line1 = inputs[0].split(' ');\n const songs = inputs[1].split(' ');\n const D = parseInt(line1[1].split(' ')[0]);\n let spareTime = 0;\n let neededDurationForSongs = 0;\n for (let i = 0; i < songs.length; i++) {\n neededDurationForSongs += parseInt(songs[i]);\n }\n\n spareTime = (songs.length - 1) * 10;\n\n if (neededDurationForSongs + spareTime > D)\n return console.log(-1)\n\n let durationsForJokes = D - neededDurationForSongs;\n\n return console.log(Math.floor(durationsForJokes / 5))\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e1c7f77a07131f1fead9ce8be2a7b01f", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require(\"readline\");\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false,\n});\n\nlet c = 0;\nlet n, d;\n\nrl.on(\"line\", (data) => {\n if (c === 0) {\n [n, d] = data.split(\" \").map(Number);\n c++;\n return;\n }\n\n const arr = data.split(\" \").map(Number);\n const waitTime = (arr.length - 1) * 10;\n const sum = arr.reduce((a, b) => a + b, 0);\n const remmainMinutes = d - sum;\n\n if (sum + waitTime > d) {\n console.log(-1);\n } else {\n console.log(Math.floor(remmainMinutes / 5));\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "31a59a242caa49add0a0679c30dc38af", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var P=readline().split(' ').map(Number)\nvar T=readline().split(' ').map(Number)\n\nfunction an() {\n var jokes=0;\n for (var i=T.length-1; i>=0; --i) {\n P[1] -= T[i]+(i===0 ? 0 : 10)\n jokes += i===0?0:2;\n if (P[1]<0) return -1;\n }\n jokes += Math.trunc(P[1]/5)\n return jokes;\n}\n\nprint(an())\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8dc3a0968337079c98ad2bf084520679", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar d = readline().split(' ');\n\tvar n = +d[0];\n\td = +d[1];\n\n\tvar k = 0;\n\tvar c = 0;\n\tvar t = readline().split(' ').map(function (e, i , a) {\n\t\te = +e;\n\t\tk += e;\n\t\tif (i != (a.length - 1)) {\n\t\t\tk += 10;\n\t\t\tc += 2;\n\t\t}\n\t});\n\n\tif (k > d) {\n\t\tprint(-1);\n\t\treturn;\n\t}\n\n\twhile ( (k+5) <= d ) {\n\t\tk += 5;\n\t\tc++;\n\t}\n\n\tprint(c);\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ff932b632c78463b6119591f74ea4951", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nlet secondLine = false;\n\n\n// Create readline Interface\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet inputs = [];\n\n\n\nrl.on('line', lineInput => {\n inputs.push(lineInput);\n})\n\n\n// Read Inputs\nrl.on('close', () => {\n const line1 = inputs[0].split(' ');\n const songs = inputs[1].split(' ');\n const D = parseInt(line1[1].split(' ')[0]);\n let spareTime = 0;\n let neededDurationForSongs = 0;\n for (let i = 0; i < songs.length; i++) {\n neededDurationForSongs += parseInt(songs[i]);\n }\n\n spareTime = (songs.length - 1) * 10;\n\n if (neededDurationForSongs + spareTime > D)\n return console.log(-1)\n\n let durationsForJokes = D - neededDurationForSongs;\n\n return console.log(Math.floor(durationsForJokes / 5))\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3fa7e8313ae429aadfd37c509226fe95", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var info = readline().split(' ').map(Number);\nvar Arr = readline().split(' ').map(Number);\nvar result = (info[0]-1)*2;\nvar summ = 0;\nvar br = info[0]-1;\nfor (var i=0; iinfo[1]) {\n print(-1);\n}\nelse {\nresult += Math.round((info[1]-time)/5);\nprint(result);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c90801b0fa7f14d0085fccf405a4ed3e", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nlet secondLine = false;\n\n\n// Create readline Interface\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet inputs = [];\n\n\n\nrl.on('line', lineInput => {\n inputs.push(lineInput);\n})\n\n// Read Inputs\nrl.on('close', () => {\n const line1 = inputs[0].split(' ');\n const songs = inputs[1].split(' ');\n const D = parseInt(line1[1].split(' ')[0]);\n let spareTime = 0;\n let neededDurationForSongs = 0;\n for (let i = 0; i < songs.length; i++) {\n neededDurationForSongs += parseInt(songs[i]);\n }\n\n spareTime = (songs.length - 1) * 10;\n\n if (neededDurationForSongs + spareTime > D)\n return console.log(-1)\n\n let durationsForJokes = D - neededDurationForSongs;\n\n return console.log(durationsForJokes / 5)\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c189666335fd318cb40d2de878fdead8", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar d = readline().split(' ');\n\tvar n = +d[0];\n\td = +d[1];\n\n\tvar k = 0;\n\tvar c = 0;\n\tvar t = readline().split(' ').map(function (e, i , a) {\n\t\te = +e;\n\t\tif (i != (a.length - 1)) {\n\t\t\tk += e + 10;\n\t\t\tc += 2;\n\t\t}\n\t});\n\n\tif (k > d) {\n\t\tprint(-1);\n\t\treturn;\n\t}\n\n\twhile ( (k+5) < d ) {\n\t\tk += 5;\n\t\tc++;\n\t}\n\n\tprint(c);\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "15846c83f2bd33968a067b00f0693326", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var P=readline().split(' ').map(Number)\nvar T=readline().split(' ').map(Number)\n\nfunction an() {\n var jokes=0;\n for (var i=T.length-1; i>=0; --i) {\n P[1] -= T[i]+(i===0 ? 0 : 10)\n jokes += 2;\n if (P[1]<0) return -1;\n }\n jokes += Math.trunc(P[1]/5)\n return jokes;\n}\n\nprint(an())\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e3a4c8f9a9b356b6ba9af52d7f548955", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "Node.js", "source_code": "/* eslint-disable no-param-reassign */\nconst readline = require('readline').createInterface({\n input: process.stdin,\n});\n\nconst getNumber = (k) => {\n let str = '';\n let i = 1;\n\n while (str.length < k) {\n str += i;\n i += 1;\n }\n\n return str[k - 1];\n};\n\nconst handleI = (i, k) => {\n if (i === 1) {\n return String(k);\n }\n\n // \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u0440\u0435\u0437\u043a\u0435. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0432 \u043e\u0442 \u0440\u0435\u0437\u043a\u0435 [100, 199] - 300 \u0446\u0438\u0444\u0440.\n const rangeCount = i * (10 ** (i - 1));\n // \u0427\u0438\u0441\u043b\u043e 522 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 [200, 299]\n const rangeIdx = Math.ceil((k + 1) / rangeCount);\n // \u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.\n const rangeNum = (10 ** (i - 1)) * rangeIdx;\n const num = rangeNum + Math.floor(((k % rangeCount) - 1) / i);\n return String(num)[(k - 1) % i];\n};\n\nconst optimalWayGetNumber = (k) => {\n // \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e 711\n let i = 1;\n while (k > 0) {\n k -= 9 * i * (10 ** (i - 1));\n i += 1;\n }\n\n i -= 1;\n // \u041f\u043e\u0441\u043b\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u0446\u0438\u0444\u0440\u044b \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u0440\u0435\u0437\u043a\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430.\n // \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 - \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e 522.\n k += 9 * i * (10 ** (i - 1));\n return handleI(i, k);\n};\n\nreadline.on('line', (line) => {\n const k = Number(line);\n\n console.log(optimalWayGetNumber(k));\n});\n\nmodule.exports = {\n getNumber,\n optimalWayGetNumber,\n};\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5bbed7ab04b0082f96725c8deef8c319", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var pos = +readline();\nvar str = '';\n\nfor (var i=0; i<100000; i++) str += i;\nwrite(str[pos]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9273f442ba0739b74ef23a700326eebc", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var row = readline().split(\" \").map(function(x) { return parseInt(x); });\nvar n = row[0];\n\nvar index = 0;\nvar number = 0;\nvar res = \"\";\nvar a = \"\";\n\nwhile(true) {\n number++;\n index += number.toString().length;\n a += number.toString();\n if(index >= n) {\n res = number.toString()[number.toString().length - 1 - (index - n)];\n break;\n }\n}\n\nwrite(res);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5f62ee9adac72b8a011093b41deb9ddc", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var g = Number(readline());\n\nvar str = \"\";\nfor(i=1;i<=g;i++){\n str += String(i);\n}\n\nprint(str[g-1]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0a6720c182f7f60f8c0f8d3d2cd3df43", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', function(line){\n let r = `0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999`.charAt(+line);\n console.log(r);\n process.exit(0);\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dca5dc3cf3517287cbfa4e332cb07140", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "const lines = [];\nconst rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });\nrl.on('line', line => lines.push(line));\nrl.on('close', main);\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n\nconst ra = ()=>readline().split(' ').map(a=>+a);\n\n/*---------------------------------------------------*/\n\nfunction div(val, by){\n return (val - val % by) / by;\n}\n\nconst getDigits = (x) => {\n let digits = new Array(10).fill(false);\n while (x) {\n digits[x % 10n] = true;\n x /= 10n;\n }\n return digits;\n}\n\nconst getLen = (x) => {\n let str = x.toString(10);\n return str.length;\n}\n\nconst calc = (t)=>{\n /* read */\n let [n, x] = readline().split(' ');\n n = +n;\n x = BigInt(x);\n\n let arr = new Array(10).fill(x);\n\n let q = [BigInt(x)];\n\n for (let steps = 1; steps <= 1000000; steps++) {\n let newq = [];\n for (const num of q) {\n if (getLen(num) === n) return steps - 1;\n let digits = getDigits(num);\n for (let i = 2; i < 10; i++) {\n if (!digits[i]) continue;\n newq.push(num * BigInt(i));\n }\n }\n\n if (newq.length === 0) return -1;\n // if (q.length === 1 && newq.length === 1 && q[0] === newq[0]) return -1;\n q = newq;\n\n // let newarr = new Array(10).fill(0);\n // for (let i = 1; i < 10; i++) {\n // let digits = getDigits(arr[i]);\n // for (let j = 1; j < 10; j++) {\n // if (!digits[j]) continue;\n // for\n // }\n // }\n }\n \n\n return -1;\n};\n\nfunction main() {\n // let T = +readline();\n let out = [];\n // for (let t = 1; t <= T; t++){\n out.push(calc());\n // process.stdout.write(`${calc(n, a)}\\n`);\n // }\n // process.stdout.write(`${calc()}\\n`);\n process.stdout.write(out.join('\\n')+'\\n');\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a43a95d324ef636518bfe7fc6c51e73b", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const lines = [];\nconst rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });\nrl.on('line', line => lines.push(line));\nrl.on('close', main);\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n\nconst ra = ()=>readline().split(' ').map(a=>+a);\n\n/*---------------------------------------------------*/\n\nfunction div(val, by){\n return (val - val % by) / by;\n}\n\nconst getDigits = (x) => {\n let digits = new Array(10).fill(false);\n let len = 0;\n while (x) {\n len++;\n digits[x % 10n] = true;\n x /= 10n;\n }\n return [digits, len];\n}\n\nconst getLen = (x) => {\n let str = x.toString(10);\n return str.length;\n}\n\nconst calc = (t)=>{\n /* read */\n let [n, x] = readline().split(' ');\n n = +n;\n x = BigInt(x);\n\n let arr = new Array(10).fill(x);\n\n let q = [BigInt(x)];\n\n for (let steps = 1; steps <= 1000000; steps++) {\n let maxlen = 0;\n let newq = [];\n for (const num of q) {\n let [digits, len] = getDigits(num);\n if (len === n) return steps - 1;\n if (len > maxlen) maxlen = len;\n if (len < maxlen - 1) continue;\n for (let i = 9; i > 1; i--) {\n if (!digits[i]) continue;\n newq.push(num * BigInt(i));\n }\n }\n\n if (newq.length === 0) return -1;\n // if (q.length === 1 && newq.length === 1 && q[0] === newq[0]) return -1;\n newq.sort((x, y) => {\n if (y > x) return 1;\n if (x > y) return -1;\n return 0;\n });\n q = newq;\n\n // let newarr = new Array(10).fill(0);\n // for (let i = 1; i < 10; i++) {\n // let digits = getDigits(arr[i]);\n // for (let j = 1; j < 10; j++) {\n // if (!digits[j]) continue;\n // for\n // }\n // }\n }\n \n\n return -1;\n};\n\nfunction main() {\n // let T = +readline();\n let out = [];\n // for (let t = 1; t <= T; t++){\n out.push(calc());\n // process.stdout.write(`${calc(n, a)}\\n`);\n // }\n // process.stdout.write(`${calc()}\\n`);\n process.stdout.write(out.join('\\n')+'\\n');\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a7fc8d3f1be1d1528493c2d9a592d5c2", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const lines = [];\nconst rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });\nrl.on('line', line => lines.push(line));\nrl.on('close', main);\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n\nconst ra = ()=>readline().split(' ').map(a=>+a);\n\n/*---------------------------------------------------*/\n\nfunction div(val, by){\n return (val - val % by) / by;\n}\n\nconst getDigits = (x) => {\n let digits = new Array(10).fill(false);\n let len = 0;\n while (x) {\n len++;\n digits[x % 10n] = true;\n x /= 10n;\n }\n return [digits, len];\n}\n\nconst getLen = (x) => {\n let str = x.toString(10);\n return str.length;\n}\n\nconst calc = (t)=>{\n /* read */\n let [n, x] = readline().split(' ');\n n = +n;\n x = BigInt(x);\n\n let arr = new Array(10).fill(x);\n\n let q = [BigInt(x)];\n\n for (let steps = 1; steps <= 1000000; steps++) {\n let maxlen = 0;\n let newq = [];\n for (const num of q) {\n let [digits, len] = getDigits(num);\n if (len === n) return steps - 1;\n if (len > maxlen) maxlen = len;\n if (len < maxlen - 1) continue;\n for (let i = 9; i > 1; i--) {\n if (!digits[i]) continue;\n newq.push(num * BigInt(i));\n }\n }\n\n if (newq.length === 0) return -1;\n // if (q.length === 1 && newq.length === 1 && q[0] === newq[0]) return -1;\n // newq.sort((x, y) => y - x);\n q = newq;\n\n // let newarr = new Array(10).fill(0);\n // for (let i = 1; i < 10; i++) {\n // let digits = getDigits(arr[i]);\n // for (let j = 1; j < 10; j++) {\n // if (!digits[j]) continue;\n // for\n // }\n // }\n }\n \n\n return -1;\n};\n\nfunction main() {\n // let T = +readline();\n let out = [];\n // for (let t = 1; t <= T; t++){\n out.push(calc());\n // process.stdout.write(`${calc(n, a)}\\n`);\n // }\n // process.stdout.write(`${calc()}\\n`);\n process.stdout.write(out.join('\\n')+'\\n');\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "03013e73c33cf20480f7da8ea7c7aaaa", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const lines = [];\nconst rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });\nrl.on('line', line => lines.push(line));\nrl.on('close', main);\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n\nconst ra = ()=>readline().split(' ').map(a=>+a);\n\n/*---------------------------------------------------*/\n\nfunction div(val, by){\n return (val - val % by) / by;\n}\n\nconst getDigits = (x) => {\n let digits = new Array(10).fill(false);\n let len = 0;\n while (x) {\n len++;\n digits[x % 10n] = true;\n x /= 10n;\n }\n return [digits, len];\n}\n\nconst getLen = (x) => {\n let str = x.toString(10);\n return str.length;\n}\n\nconst calc = (t)=>{\n /* read */\n let [n, x] = readline().split(' ');\n n = +n;\n x = BigInt(x);\n\n let arr = new Array(10).fill(x);\n\n let result = -1;\n\n\n const dfs = (num, depth = 0) => {\n if (result > -1) return;\n if (depth > 25) return;\n let next = [];\n let [digits, len] = getDigits(num);\n if (len === n) {\n result = depth;\n return;\n }\n for (let i = 9; i > 1; i--) {\n if (!digits[i]) continue;\n let newNum = num * BigInt(i);\n next.push(newNum);\n }\n next.sort((x, y) => {\n if (y > x) return 1;\n if (x > y) return -1;\n return 0;\n });\n // console.log('DEBUG next', next);\n for (let nx of next) {\n dfs(nx, depth + 1);\n }\n }\n\n dfs(x);\n\n // let q = [BigInt(x)];\n\n // for (let steps = 1; steps <= 1000000; steps++) {\n // let maxlen = 0;\n // let newq = [];\n // for (const num of q) {\n // let [digits, len] = getDigits(num);\n // if (len === n) return steps - 1;\n // if (len > maxlen) maxlen = len;\n // if (len < maxlen - 1) continue;\n // for (let i = 9; i > 1; i--) {\n // if (!digits[i]) continue;\n // let newNum = num * BigInt(i);\n // if (getLen(newNum) < maxlen) continue;\n // newq.push(newNum);\n // }\n // }\n\n // if (newq.length === 0) return -1;\n // // if (q.length === 1 && newq.length === 1 && q[0] === newq[0]) return -1;\n // newq.sort((x, y) => {\n // if (y > x) return 1;\n // if (x > y) return -1;\n // return 0;\n // });\n // q = newq;\n\n // // let newarr = new Array(10).fill(0);\n // // for (let i = 1; i < 10; i++) {\n // // let digits = getDigits(arr[i]);\n // // for (let j = 1; j < 10; j++) {\n // // if (!digits[j]) continue;\n // // for\n // // }\n // // }\n // }\n \n\n return result;\n};\n\nfunction main() {\n // let T = +readline();\n let out = [];\n // for (let t = 1; t <= T; t++){\n out.push(calc());\n // process.stdout.write(`${calc(n, a)}\\n`);\n // }\n // process.stdout.write(`${calc()}\\n`);\n process.stdout.write(out.join('\\n')+'\\n');\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "274f748b2787c1c8f64e6c273bbc2839", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const rl = require(\"readline\").createInterface({\r\n input: process.stdin,\r\n output: process.stdout,\r\n});\r\n\r\nlet input = [];\r\nrl.on(\"line\", function (line) {\r\n input.push(line);\r\n}).on(\"close\", function () {\r\n solution(input);\r\n process.exit();\r\n});\r\n\r\nfunction solution(input) {\r\n const [N, X] = input[0].split(\" \").map(Number);\r\n const dist = new Map();\r\n dist.set(X, 0);\r\n queue = [X];\r\n while (queue.length > 0) {\r\n const val = queue.shift();\r\n const str = String(val);\r\n let splited = new Set(str.split(\"\"));\r\n\r\n if (str.length === N) {\r\n console.log(dist.get(val));\r\n return;\r\n }\r\n\r\n splited.delete(\"0\");\r\n if (splited.has(1) && splited.size === 1) {\r\n break;\r\n }\r\n splited.delete(\"1\");\r\n\r\n for (s of splited) {\r\n const nextVal = val * Number(s);\r\n if (!dist.has(nextVal)) {\r\n dist.set(nextVal, dist.get(val) + 1);\r\n queue.push(nextVal);\r\n }\r\n }\r\n }\r\n console.log(-1);\r\n}\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "41882fb28a16e41fb628952e45969045", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nfunction solve(n, m) {\r\n const target = 10 ** (n - 1);\r\n const queue = [[m, 0]],\r\n cache = new Set();\r\n for (let [num, step] of queue) {\r\n const st = [];\r\n let tmp = num;\r\n while (num) {\r\n let cur = num % 10;\r\n num = Math.floor(num / 10);\r\n if (cur < 2 || st[cur]) continue;\r\n st[cur] = 1;\r\n let next = tmp * cur;\r\n if (cache.has(next)) continue;\r\n if (next >= target) {\r\n return step + 1;\r\n }\r\n cache.add(next);\r\n queue.push([next, step + 1]);\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nasync function main(read) {\r\n try {\r\n let res = [];\r\n const [n, m] = (await read()).split(' ').map(Number);\r\n res.push(solve(n, m));\r\n console.log(res.join('\\n'));\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', () => {\r\n inputs = str.split('\\n').values();\r\n main(read);\r\n});\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7924eeb3353f143fb46c36e534777472", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nfunction solve(n, m) {\r\n const target = 10n ** (n - 1n);\r\n const queue = [[BigInt(m), 0]],\r\n cache = new Set();\r\n for (let [num, step] of queue) {\r\n const st = [];\r\n let tmp = num;\r\n while (num) {\r\n let cur = num % 10n;\r\n num = num / 10n;\r\n if (cur < 2n || st[cur]) continue;\r\n st[cur] = 1;\r\n let next = tmp * cur;\r\n if (cache.has(next)) continue;\r\n if (next >= target) {\r\n console.log(queue.length)\r\n return step + 1;\r\n }\r\n cache.add(next);\r\n queue.push([next, step + 1]);\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nasync function main(read) {\r\n try {\r\n let res = [];\r\n const [n, m] = (await read()).split(' ').map(BigInt);\r\n res.push(solve(n, m));\r\n console.log(res.join('\\n'));\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', () => {\r\n inputs = str.split('\\n').values();\r\n main(read);\r\n});\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9fa68c33d0c29d71da7c1bd757f935a0", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict';\n// HEADER:\nconst print = function(arg){\n let str = arg;\n if (arguments.length>1)\n str = Array.prototype.slice.call(arguments).join(' ');\n process.stdout.write(str+'\\n');\n};\nlet IS_MULTITEST, testN, tests;\nconst pcalc = (testN, toPrint)=>{\n let res = calc(testN);\n if (Array.isArray(res)){\n toPrint.push(res.join(' '));\n } else if (Number.isFinite(res) || typeof res=='string'){\n toPrint.push(res+'');\n }\n if (process.env.DEBUG && toPrint.length){\n let ans = toPrint.pop();\n print(ans);\n let expected = tests[testN-1];\n if (expected){\n if (expected==ans)\n console.log('\\x1b[32m%s\\x1b[0m', 'correct'); \n else {\n console.log('\\x1b[31m%s\\x1b[0m', 'wrong, expected:', expected); \n }\n }\n }\n};\n\nconst main = ()=>{\n let toPrint = [];\n L('\\nSolving:');\n if (IS_MULTITEST){\n let T = +readline()\n for (testN=1; testN<=T; testN++)\n pcalc(testN, toPrint);\n } else {\n pcalc(1, toPrint);\n }\n if (toPrint.length){\n print(toPrint.join('\\n'));\n }\n};\n\nconst lines = [];\nconst rl = require('readline').createInterface({\n input: process.stdin, output: process.stdout});\nrl.on('line', line=>{\n lines.push(line);\n});\nrl.on('close', main);\nlet rli = 0;\nconst readline = ()=>lines[rli++];\nconst L = process.env.DEBUG ? console.log : ()=>{};\nconst LT = obj=>L(`\\nTest #${testN}`, obj);\n\nconst ra = ()=>readline().split(' ').map(a=>+a)\nconst pa = arr=>print(arr.join(' '));\n\ntests = [\n``, // Test #1\n``, // Test #2\n``, // Test #3\n``, // Test #4\n``, // Test #5\n];\n\n// SOLUTION:\nIS_MULTITEST = false;\n \nconst calc = (testN)=>{\n // READING:\n let [n, x] = readline().split(' '); // 10x18\n n = +n;\n LT({n, x});\n // PROCESSING:\n if (n==x.length)\n return 0;\n let queue = [], qi = 0;\n queue.push([x, 0]);\n let visited = new Set([x]);\n while (qin || visited.has(next))\n continue;\n visited.add(next);\n queue.push([next, path+1])\n }\n }\n return -1;\n};\n ", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f7ad4e0b3e4a8f56e4d67ec095fad665", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const rl = require(\"readline\").createInterface({\r\n input: process.stdin,\r\n output: process.stdout,\r\n});\r\n\r\nlet input = [];\r\nrl.on(\"line\", function (line) {\r\n input.push(line);\r\n}).on(\"close\", function () {\r\n solution(input);\r\n process.exit();\r\n});\r\n\r\nfunction solution(input) {\r\n let [N, X] = input[0].split(\" \");\r\n N = Number(N);\r\n X = BigInt(X);\r\n const dist = new Map();\r\n dist.set(X, 0);\r\n queue = [X];\r\n while (queue.length > 0) {\r\n const val = queue.shift();\r\n const str = String(val);\r\n let splited = new Set(str.split(\"\"));\r\n\r\n if (str.length === N) {\r\n console.log(dist.get(val));\r\n return;\r\n }\r\n\r\n splited.delete(\"0\");\r\n if (splited.has(1) && splited.size === 1) {\r\n break;\r\n }\r\n splited.delete(\"1\");\r\n\r\n for (const s of splited) {\r\n const nextVal = val * BigInt(s);\r\n if (!dist.has(nextVal)) {\r\n dist.set(nextVal, dist.get(val) + 1);\r\n queue.push(nextVal);\r\n }\r\n }\r\n }\r\n console.log(-1);\r\n}\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3b722d5db86d575c5767cc8eaa26fbe7", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nfunction solve(n, m) {\r\n const target = 10n ** (n - 1n);\r\n const queue = [[BigInt(m), 0]],\r\n cache = new Set();\r\n for (let [num, step] of queue) {\r\n const st = [];\r\n let tmp = num;\r\n while (num) {\r\n let cur = num % 10n;\r\n num = num / 10n;\r\n if (cur < 2n || st[cur]) continue;\r\n st[cur] = 1;\r\n let next = tmp * cur;\r\n if (cache.has(next)) continue;\r\n if (next >= target) {\r\n return step + 1;\r\n }\r\n cache.add(next);\r\n queue.push([next, step + 1]);\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nasync function main(read) {\r\n try {\r\n let res = [];\r\n const [n, m] = (await read()).split(' ').map(BigInt);\r\n res.push(solve(n, m));\r\n console.log(res.join('\\n'));\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', () => {\r\n inputs = str.split('\\n').values();\r\n main(read);\r\n});\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "48404f633c0db06e9fe544a0d606efb5", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n let [n, k] = lines[l++].trim().split(' ')\n n = +n\n output[i] = solve(n, k)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n, k) {\n if (k.length >= n) return 0\n let has = 0\n for (let i = 0; i < k.length; i++) {\n if (+k[i] > 1) {\n has = 1\n break\n }\n }\n if (!has) return -1\n\n let q = {}\n q[k] = 1\n has = 1\n let count = 1\n const visited = {}\n while (has) {\n const nq = {}\n has = 0\n for (let s in q) {\n const bs = BigInt(s)\n for (let i = 0; i < s.length; i++) {\n const x = BigInt(s[i])\n const nx = bs * x\n if (visited[nx]) continue\n visited[nx] = 1\n // console.log(count, nx)\n if (String(nx).length >= n) return count\n nq[nx] = 1\n has = 1\n }\n }\n q = nq\n count++\n }\n return count\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "85988b9705246fba6381a2f780489322", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var InputReader = (function () {\n function InputReader() {\n this.index = 0;\n this.tokenizer = [];\n }\n InputReader.prototype.next = function () {\n while (this.tokenizer == null || this.index == this.tokenizer.length) {\n this.tokenizer = readline().split(\" \");\n this.index = 0;\n }\n var res = this.tokenizer[this.index++];\n return res;\n };\n InputReader.prototype.nextInt = function () {\n return parseInt(this.next());\n };\n InputReader.prototype.nextFloat = function () {\n return parseFloat(this.next());\n };\n return InputReader;\n})();\nfunction main() {\n var input = new InputReader();\n var a = input.nextInt();\n var b = input.nextInt();\n var res = 0;\n var h = Math.min(a, b);\n var w = Math.max(a, b);\n while (h != 0) {\n res += Math.floor(w / h);\n var t = w;\n w = h;\n h = t % h;\n }\n print(res);\n}\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7cd90e1349bfb44b4e873ce0b3b79e09", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var tok = null;\nvar index = 0;\nfunction next() {\n while (tok == null || index == tok.length) {\n tok = readline().split(' ');\n index = 0;\n }\n var res = tok[index++];\n return res;\n}\n\nfunction nextInt() {\n return parseInt(next());\n}\n\nfunction main() {\n var a = nextInt();\n var b = nextInt();\n var result = 0;\n while (a * b > 0) {\n if (b > a) {\n var t = a;\n a = b;\n b = t;\n }\n result += Math.floor(a / b);\n a = a % b;\n }\n print(result);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c8d2b986530a431df1b81cf26cda7309", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "(function () {\n\t'use strict';\n\n\tvar str = readline().split(' ').map(Number),\n\t\ta = str[0], b = str[1], result = 0;\n\n\twhile (true) {\n\t\tif (a === b) {\n\t\t\tresult++;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (a * b === 0) break;\n\n\t\tvar max = Math.max(a, b),\n\t\t\tmin = Math.min(a, b),\n\t\t\titter = parseInt(max / min);\n\n\t\tresult += itter;\n\t\ta = min;\n\t\tb = max - min * itter;\n\t}\n\n\tprint(result);\n\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fabe72ad371208dacbe89b18bb298cc3", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\nvar a = parseInt(line[0]);\nvar b = parseInt(line[1]);\n\nvar total = 0;\nvar newSquares = 0;\nvar tempA = 0;\n\nwhile (b > 0) {\n newSquares = Math.floor(a/b);\n tempA = a - b*newSquares;\n a = b;\n b = tempA;\n total += newSquares;\n}\n\nwrite(total);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2c769c319f48599c2c8d2a78a385fce7", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' '),\n n = a[0], m = a[1], count = 0, x, y;\n\n while(n > 0 && m > 0){\n count = count + parseInt(n / m);\n x = n % m;\n y = m;\n if(x < y){\n \tm = x;\n \tn = y;\n }\n else{\n \tn = x;\n \tm = y;\n }\n }\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ce29c3b27aaa678f488dd59c7cae6d37", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' ');\nvar ans = 0;\nwhile(a[1] > 0) {\n ans += parseInt(a[0]/a[1]);\n var t = a[0] % a[1];\n a[0] = a[1];\n a[1] = t;\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "829a50b6345d5cccecece0c3aa15e394", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' '),\n n = a[0], m = a[1], count = 0, x, y;\n\n while(n > 0 && m > 0){\n count = count + (n / m);\n x = n % m;\n y = m;\n if(x < y){\n \tm = x;\n \tn = y;\n }\n else{\n \tn = x;\n \tm = y;\n }\n }\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7acc3a422e6a6b790b1290d0e5118c98", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\nvar a = parseInt(line[0]);\nvar b = parseInt(line[1]);\n\nvar total = 0;\nvar newSquares = 0;\nvar tempA = 0;\n\nwhile (b > 0) {\n tempA = a;\n newSquares = Math.floor(a/b);\n a -= b*newSquares;\n b = tempA;\n total += newSquares;\n}\n\nwrite(total);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ba89223db193d1e6b21c719d3222727a", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var a = readline().split(' '),\n n = a[0], m = a[1], count = 0, x, y;\n\n while(n > 0 && m > 0){\n count = count + (n / m);\n x = n % m;\n y = m;\n n = max(x, y);\n m = min(x, y);\n }\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "05832497f569c48d1177dcd21b6f2568", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function main() {\n readLine();\n var sum = readLine().split(' ').map(Number)\n .reduce((acc, d) => acc + (d < 0 ? -d : d), 0);\n print(sum);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "85b87cd37789de4e038d7dfe88c53e5b", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n=readline()\nres=0\na=readline().split(' ')\nfor (i=0;i acc + (d < 0 ? -d : d), 0);\n console.log(sum);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b09d2d7cd9c1003bc2212de002eac4c1", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline()\nvar k = readline()\n\nvar n = readline().split(' ')\n\nvar s = 0\nfor(var i=0; i +x);\n \n print(solution(elem));\n})();\n\nfunction solution(elem) {\n var B = elem.filter(x => x > 0).reduce((s, v) => s + v, 0);\n var C = elem.filter(x => x < 0).reduce((s, v) => s + v, 0);\n \n return B - C;\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "50d133e4b2af96fc60f61789c1b50a0e", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "x=readline();\n y=(readline()).split(' '); \nsum=0;\nfor(i=0;i acc + (d < 0 ? -d : d), 0);\nprint(sum);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1833302fe94a09f3727680071ccb4739", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var tok = null;\nvar index = 0;\nfunction next() {\n while (tok == null || index == tok.length) {\n tok = readline().split(' ');\n index = 0;\n }\n var res = tok[index++];\n return res;\n}\n\nfunction nextInt() {\n return parseInt(next());\n}\n\nfunction sortNumber(a, b) {\n return a - b;\n}\n\nfunction sortSegment(a, l, r) {\n var n = a.length;\n var b = [];\n var m = r - l + 1;\n for (var i = 0; i < m; i++) {\n b[i] = a[l + i];\n }\n b.sort(sortNumber);\n for (var i = 0; i < m; i++) {\n a[l + i] = b[i];\n }\n return a;\n}\n\nfunction nextPermutation(a) {\n var n = a.length;\n for (var i = n - 1; i >= 0; i--) {\n if (i == 0) {\n return \"null\";\n }\n if (a[i] > a[i - 1]) {\n for (var j = i; j < n; j++) {\n if (j == n - 1) {\n var t = a[j];\n a[j] = a[i - 1];\n a[i - 1] = t;\n a = sortSegment(a, i, n - 1);\n return a;\n }\n if (a[j + 1] < a[i - 1]) {\n var t = a[j];\n a[j] = a[i - 1];\n a[i - 1] = t;\n a = sortSegment(a, i, n - 1);\n return a;\n }\n }\n }\n }\n return a;\n}\n\nfunction main() {\n var p = [0, 1, 2, 3, 4];\n var a = [[], [], [], [], []];\n for (var i = 0; i < 5; i++) {\n for (var j = 0; j < 5; j++) {\n a[i][j] = nextInt();\n }\n }\n var p12 = a[p[0]][p[1]] + a[p[1]][p[0]];\n var p23 = a[p[2]][p[1]] + a[p[1]][p[2]];\n var p34 = a[p[2]][p[3]] + a[p[3]][p[2]];\n var p45 = a[p[4]][p[3]] + a[p[3]][p[4]];\n var max = p12 + p23 + 2 * (p34 + p45);\n while (nextPermutation(p) != 'null') {\n p12 = a[p[0]][p[1]] + a[p[1]][p[0]];\n p23 = a[p[2]][p[1]] + a[p[1]][p[2]];\n p34 = a[p[2]][p[3]] + a[p[3]][p[2]];\n p45 = a[p[4]][p[3]] + a[p[3]][p[4]];\n var sum = p12 + p23 + 2 * (p34 + p45);\n if (sum > max) {\n max = sum;\n }\n }\n print(max);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e386c4c140d69b50f51ec2d7b9f9e334", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar m = [];\n\tfor (var i = 0; i < 5; i++) m.push(readline().split(' ').map(Number));\n\n\tvar t = 0, k = [];\n\tfor (var a = 0; a < 5; a++)\n\t\tfor (var b = 0; b < 5; b++)\n\t\t\tfor (var c = 0; c < 5; c++)\n\t\t\t\tfor (var d = 0; d < 5; d++)\n\t\t\t\t\tfor (var e = 0; e < 5; e++)\n\t\t\t\t\t\tif (dif(a, b, c, d, e))\n\t\t\t\t\t\t\tt = Math.max(t, sum(a, b, c, d, e));\n\n\tprint(t);\n\n\tfunction sum (a, b, c, d, e) {\n\t\treturn 0\n\t\t\t+ m[a][b]\u2009+\u2009m[b][a]\u2009+\u2009m[c][d]\n\t\t\t+\u2009m[d][c] +\u2009m[c][b]\u2009+\u2009m[b][c]\n\t\t\t+\u2009m[d][e]\u2009+\u2009m[e][d] +\u2009m[c][d]\n\t\t\t+\u2009m[d][c] +\u2009m[d][e]\u2009+\u2009m[e][d];\n\t}\n\n\tfunction dif (a, b, c, d, e) {\n\t\tvar m = {}; m[a] = true; m[b] = true;\n\t\tm[c] = true; m[d] = true; m[e] = true;\n\t\treturn Object.keys(m).length === 5;\n\t}\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "68d3e759fbeac54e6b74098be5c5c28e", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var infoLine = [0, 0, 0, 0, 0];\nvar honor = 0;\nvar limitHonor = 0;\nfor (var s = 0; s<5; s++) {\n infoLine[s] = readline().split(' ').map(Number);\n}\nvar permArr = [],\nusedChars = [];\n\nfunction permute(input) {\n var k, ch;\n for (k = 0; k < input.length; k++) {\n ch = input.splice(k, 1)[0];\n usedChars.push(ch);\n if (input.length == 0) {\n permArr.push(usedChars.slice());\n }\n permute(input);\n input.splice(k, 0, ch);\n usedChars.pop();\n }\n return permArr\n};\npermute([0,1,2,3,4]);\n\nfor (var i=0; i < permArr.length; i++) {\n limitHonor = (infoLine[permArr[i][0]][permArr[i][1]] + infoLine[permArr[i][1]][permArr[i][0]] + infoLine[permArr[i][2]][permArr[i][3]] + infoLine[permArr[i][3]][permArr[i][2]]) + (infoLine[permArr[i][1]][permArr[i][2]] + infoLine[permArr[i][2]][permArr[i][1]] + infoLine[permArr[i][3]][permArr[i][4]] + infoLine[permArr[i][4]][permArr[i][3]]) + (infoLine[permArr[i][2]][permArr[i][3]] + infoLine[permArr[i][3]][permArr[i][2]]) + (infoLine[permArr[i][3]][permArr[i][4]] + infoLine[permArr[i][4]][permArr[i][3]]);\n if (limitHonor > honor) {\n honor = limitHonor; \n }\n}\n\nprint(honor);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a33f743b5ac9afd3bb04a808019dc0c6", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": " var next_permutation = function( d ) {\n var i = d.length - 1;\n while ( i > 0 ) {\n var k = i;\n i--;\n if ( d[i] < d[k] ) {\n var j = d.length-1;\n while ( d[i] >= d[j] ) {\n j--;\n }\n d[i] = d.splice( j, 1, d[i] )[0]; // d[i]\u3068d[j]\u3092\u5165\u308c\u66ff\u3048\u308b\n np_reverse( d, k, d.length-1 );\n return true;\n }\n }\n return false;\n }\n\n var np_reverse = function( d, a, b ) {\n var sub = d.slice( a, b+1 ).reverse();\n for ( var i = a; i <= b; i++ ) {\n d[i] = sub[i-a];\n }\n }\n function main(){\n var m = [], i,j;\n for( i = 0 ; i < 5 ; ++i){\n m[i] = readline().split(' ');\n for ( j = 0 ; j < 5 ; ++j){\n m[i][j] = parseInt(m[i][j]);\n }\n }\n var answer = 0;\n var p = [0,1,2,3,4];\n do{\n var sum = 2 * (m[p[3]][p[4]]+m[p[4]][p[3]] + m[p[2]][p[3]] + m[p[3]][p[2]]) + m[p[0]][p[1]] + m[p[1]][p[0]] + m[p[1]][p[2]] + m[p[2]][p[1]];\n answer = Math.max(answer,sum);\n }while(next_permutation(p));\n print(answer);\n }\n main();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6c522a29fc5c0c64a98ce58d8ce3b8d4", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar h = [];\n\tfor (var r = 0; r < 5; ++r) {\n\t\th.push(tokenizeIntegers(readline()));\n\t}\n\n\tvar best = 0,\n\t\tp = [0, 1, 2, 3, 4];\n\n\tfunction permute(i) {\n\t\tif (i == 5) {\n\t\t\tvar a = p[0], b = p[1], c = p[2], d = p[3], e = p[4];\n\t\t\tbest = Math.max(best, h[a][b] + h[b][c] + 2*h[c][d] + 2*h[d][e] +\n\t\t\t\t\t\t\t\t h[b][a] + h[c][b] + 2*h[d][c] + 2*h[e][d]);\n\t\t\treturn;\n\t\t}\n\t\tpermute(i+1);\n\t\tvar t = p[i];\n\t\tfor (var j = i+1; j < 5; j += 1) {\n\t\t\tp[i] = p[j];\n\t\t\tp[j] = t;\n\t\t\tpermute(i+1);\n\t\t\tp[j] = p[i];\n\t\t}\n\t\tp[i] = t;\n\t}\n\n\tpermute(0);\n\tprint(best);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "84e519bcb649a9e9ba7dcb5466e2cb9b", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var tok = null;\nvar index = 0;\nfunction next() {\n while (tok == null || index == tok.length) {\n tok = readline().split(' ');\n index = 0;\n }\n var res = tok[index++];\n return res;\n}\n\nfunction nextInt() {\n return parseInt(next());\n}\n\nfunction sortNumber(a, b) {\n return a - b;\n}\n\nfunction sortSegment(a, l, r) {\n var n = a.length;\n var b = [];\n var m = r - l + 1;\n for (var i = 0; i < m; i++) {\n b[i] = a[l + i];\n }\n b.sort(sortNumber);\n for (var i = 0; i < m; i++) {\n a[l + i] = b[i];\n }\n return a;\n}\n\nfunction nextPermutation(a) {\n var n = a.length;\n for (var i = n - 1; i >= 0; i--) {\n if (i == 0) {\n return \"null\";\n }\n if (a[i] > a[i - 1]) {\n for (var j = i; j < n; j++) {\n if (j == n - 1) {\n var t = a[j];\n a[j] = a[i - 1];\n a[i - 1] = t;\n a = sortSegment(a, i, n - 1);\n return a;\n }\n if (a[j + 1] < a[i - 1]) {\n var t = a[j];\n a[j] = a[i - 1];\n a[i - 1] = t;\n a = sortSegment(a, i, n - 1);\n return a;\n }\n }\n }\n }\n return a;\n}\n\nfunction main() {\n var p = [0, 1, 2, 3, 4];\n var max = 0;\n var a = [[], [], [], [], []];\n for (var i = 0; i < 5; i++) {\n for (var j = 0; j < 5; j++) {\n a[i][j] = nextInt();\n }\n }\n while (nextPermutation(p) != 'null') {\n var p12 = a[p[0]][p[1]] + a[p[1]][p[0]];\n var p23 = a[p[2]][p[1]] + a[p[1]][p[2]];\n var p34 = a[p[2]][p[3]] + a[p[3]][p[2]];\n var p45 = a[p[4]][p[3]] + a[p[3]][p[4]];\n var sum = p12 + p23 + 2 * (p34 + p45);\n\n if (sum > max) {\n max = sum;\n }\n }\n print(max);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "59559d20126ac9043a3dcea296f513fe", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\n\nvar result = 0 ;\n\n\nfor(var i = 1 ; i <= n; i ++){\n for(var j = 1 ; j <= n; j ++){\n var k = j ^ i;\n if( k<(i+j) && j<(i+k) && i<(j+k)){\n result ++;\n }\n\n }\n}\n\n\nprint(result/n);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a3047ea5f20c704b973d153144340dca", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\n\nvar result = 0 ;\n\n\nfor(var i = 1 ; i <= n; i ++){\n for(var j = 1 ; j <= n; j ++){\n var k = j ^ i;\n if((i-j) parseInt(i, 10));\n let allItems = {}, sum = 0;\n\n for (let i = 0; i < items.length; ++i) {\n if (!(items[i] in allItems)) allItems[items[i]] = 0;\n ++allItems[items[i]];\n }\n\n for (let p in allItems) {\n sum += allItems[p];\n }\n\n const uniqCount = Object.keys(allItems).length;\n const countForOneMeal = uniqCount * k;\n\n const d1 = countForOneMeal - sum;\n\n return countForOneMeal * d1 - items.length;\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32f110c2804f5e6c57155f76419c72cd", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "Node.js", "source_code": "function main() {\n let line = stdin[0].split(' ');\n let k = parseInt(line[1], 10);\n let items = stdin[1].split(' ').map(i => parseInt(i, 10));\n let allItems = {}, sum = 0;\n\n for (let i = 0; i < items.length; ++i) {\n if (!(items[i] in allItems)) allItems[items[i]] = 0;\n ++allItems[items[i]];\n }\n\n for (let p in allItems) {\n sum += allItems[p];\n }\n\n const uniqCount = Object.keys(allItems).length;\n const countForOneMeal = uniqCount * k;\n\n const d1 = countForOneMeal - sum;\n\n console.log(countForOneMeal * d1 - items.length)\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cf595d40b55ac54f0ad71792cac7b782", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "Node.js", "source_code": "function main() {\n let line = stdin[0].split(' ');\n let k = parseInt(line[1], 10);\n let items = stdin[1].split(' ').map(i => parseInt(i, 10));\n let allItems = {}, sum = 0, overhead = 0;\n\n for (let i = 0; i < items.length; ++i) {\n if (!(items[i] in allItems)) allItems[items[i]] = 0;\n ++allItems[items[i]];\n }\n \n for (let p in allItems) {\n sum += Math.min(allItems[p], k);\n overhead += Math.max(allItems[p] - k, 0)\n }\n \n \n const uniqCount = Object.keys(allItems).length;\n const countForOneMeal = uniqCount * k;\n \n \n const o1 = overhead / countForOneMeal;\n\n console.log(countForOneMeal - countForOneMeal * o1 + countForOneMeal - sum);\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "509fe414fde19d9fb7285c2d849d693e", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var guests = +readline().split(' ')[1];\nvar map = {};\nvar max = 0;\nvar leftovers = +readline().split(' ').map(v => {\n map[v] = (map[v] || 0) + 1;\n max = Math.max(max, map[v]);\n});\n\nmax = Math.ceil(max / guests) * guests;\n\nvar k;\nvar res = 0;\nfor(var k in map) {\n res+= max - map[k];\n}\n\nprint(res);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d841f8be7e60fead841311965c8a05f7", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "Node.js", "source_code": "function main() {\n let line = stdin[0].split(' ');\n let k = parseInt(line[1], 10);\n let items = stdin[1].split(' ').map(i => parseInt(i, 10));\n let allItems = {}, sum = 0, overhead = 0;\n\n for (let i = 0; i < items.length; ++i) {\n if (!(items[i] in allItems)) allItems[items[i]] = 0;\n ++allItems[items[i]];\n }\n \n for (let p in allItems) {\n max = Math.max(allItems[p], max);\n }\n \n const uniqCount = Object.keys(allItems).length;\n \n while (max % k != 0) { max++; }\n \n console.log(uniqCount * max - items.length);\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7373ae1f53b52412c9e1b3f0af7d0959", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var s = readline().split(' ').map(Number).sort((a,b)=>a-b);\nvar m = (x,y)=>{var fun =(a)=>{var r=2*Math.floor(a/3); if (a%3==2){r++;} return r}; if (x= 2 * i)\n ans = Math.max(ans, i + Math.min(Math.floor((n - i) / 2), m - 2 * i));\n\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4ce63aa43d34429777c0ef58760c9e81", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "\n// 519C A \u0438 B \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0430\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \n\n//var n = parseInt(readline());\n\n// var input_line = readline().split(' ').map(Number);\nvar arr = readline().split(' ').map(Number);\nvar n = arr[0];\nvar m = arr[1];\n\nvar count = 0;\n\nwhile ((n > 0) && (m > 0)) {\n if (n > m) {\n n -= 2;\n m -= 1;\n count ++;\n } else {\n if (m >= 2) {\n n -= 1;\n m -= 2;\n count ++;\n } else {\n break;\n };\n };\n}\n\n\nprint(count);\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "103d08acc01efdf073018e487d7db010", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = readline();\n \nvar ans = 0;\n \nfor(var i=2; i{\"use strict\";var t={675:(t,e)=>{Object.defineProperty(e,\"__esModule\",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let i=0;it-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e{if(p){if(s=i.default.readFileSync(\"input.txt\").toString().trim().split(\"\\n\").map((t=>t.trim())),t(),i.default.writeFileSync(\"output.txt\",l),console.log(l),i.default.readFileSync(\"expected.txt\").toString().trim()==l.trim()){const{exec:t}=r(129);t(\"osascript -e 'display notification \\\"\u2705 AC!!\\\"'\")}}else process.stdin.resume(),process.stdin.setEncoding(\"utf-8\"),process.stdin.on(\"data\",(t=>{o+=t})),process.stdin.on(\"end\",(e=>{s=o.trim().split(\"\\n\").map((t=>t.trim())),t(),console.log(l)}))};function h(){return s[u++]}function f(){return h().split(\" \").map((t=>parseFloat(t)))}function c(){return h().split(\"\")}e.default={runMain:a,runEachTest:t=>{a((()=>{let[e]=f();for(;e>0;)t(),e--}))},readline:h,nextNumbers:f,nextBigNumbers:function(){return h().split(\" \").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r{t.exports=require(\"child_process\")},747:t=>{t.exports=require(\"fs\")}},e={};!function r(n){if(e[n])return e[n].exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(965)})();\n\n// Solution written in typescript and compiled via webpack. Original source code below\n// Happy Hacking \ud83d\ude1c\n\n\n// import './array'\n// \n// import io from './io'\n// \n// function main() {\n// let [n] = io.nextNumbers()\n// \n// let res = 0\n// \n// for (let i = 2; i < n; ++i) {\n// res += i * (i + 1)\n// }\n// \n// io.puts(res)\n// }\n// \n// // io.runEachTest(main)\n// io.runMain(main)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "99b70296f7fa79b3eef2f836a0e0d40a", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar w=0;\nfor(var i=2; i result) {\n result = x;\n }\n }\n print(result);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c23c4f94374f99460e53a496473fe998", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var k = parseInt( readline() ),\n\ts = readline(),\n\tans = [],\n\tused = {};\n\t\nfor (var i = 0; i < s.length && ans.length < k; i++) {\n\tif (!used[s.charAt( i )]) {\n\t\tans.push( i );\n\t\tused[s.charAt( i )] = true;\n\t}\n}\n\nif (k === ans.length) {\n\tprint( 'YES' );\n\tans.push( s.length );\n\tans.forEach( function(p, i) {\n\t\tif (i > 0) {\n\t\t\tprint( s.substring( ans[i-1], i ) );\n\t\t}\t\n\t} );\n} else {\n\tprint( 'NO' );\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1953ec3ae85e6f4ba422d83d36ebdf8f", "src_uid": "c1b071f09ef375f19031ce99d10e90ab", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function toi(x){return parseInt(x);}\nn=toi(readline());\nvar s=readline();\nvar res=\"\";\nvar dic={};\nvar num=0;\nfor(var i=0;i 0) {\n\t\t\tprint( s.substring( ans[i-1], p ) );\n\t\t}\t\n\t} );\n} else {\n\tprint( 'NO' );\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b31c72e9bde5e15d3a55bf4fcdbebaa4", "src_uid": "c1b071f09ef375f19031ce99d10e90ab", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n let f = [];\n let c = (i, j, z) => {\n let x = ((f[i] || [])[j] || [])[z]\n return x === undefined ? -1e5 : x;\n }\n let f0 = Arr(0, n, (i, p) => i ? p + (s[i - 1] == t[0]) : 0);\n if (t[0] == t[1]) {\n let m = Math.min(f0[n] + k, n);\n console.log(m * (m - 1) / 2)\n return;\n }\n for (let i = 2; i <= n; i++) {\n f[i] = Array(n + 1);\n for (let j = 0; j <= k; j++) {\n f[i][j] = Array(n + 1);\n for (let z = 1; z <= i; z++) {\n if (i == 2) {\n if (z == 1) {\n let dif = (s[0] != t[0]) + (s[1] != t[1]);\n if (j >= dif) f[i][j][z] = 1;\n else {\n let same = (s[0] == t[0]) + (s[1] == t[0]);\n if (same == 1 || j > 0) f[i][j][z] = 0;\n }\n } else {\n let same = (s[0] == t[0]) + (s[1] == t[0]);\n if (j >= 2 - same) f[i][j][z] = 0;\n }\n // console.log(i, j, z, c(i, j, z));\n continue;\n }\n // if (j == 0) {\n // if (s[i - 1] == t[1]) {\n // if (z == f0[i]) f[i][j][z] = 1;\n // } else {\n // f[i][j][z] = c(i - 1, j, z - (s[i - 1] == t[0]));\n // }\n // console.log(i, j, z, c(i, j, z));\n // continue;\n // }\n if (s[i - 1] == t[1]) {\n f[i][j][z] = Math.max(c(i, j - 1, z), c(i - 1, j, z) + z);\n } else if (s[i - 1] != t[0]) {\n f[i][j][z] = Math.max(c(i - 1, j, z), c(i, j - 1, z), c(i - 1, j - 1, z) + z, c(i - 1, j - 1, z - 1))\n } else {\n f[i][j][z] = Math.max(c(i - 1, j, z - 1), c(i, j - 1, z), c(i - 1, j - 1, z) + z)\n }\n // console.log(i, j, z, f[i][j][z]);\n }\n }\n }\n console.log(Math.max(...f[n][k].filter(v => v)));\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9c51462ae12eb8cd3be4de511049ecaf", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n if (t[0] == t[1]) {\n let x = Math.min([...s].filter(c => c == t[0]).length + k, n);\n console.log(x * (x - 1) / 2);\n return;\n }\n let t0 = Arr(0, n - 1, (i, p) => p + (s[i] == t[0]));\n let t1 = Arr(0, n - 1, (i, p) => p + (s[n - 1 - i] == t[1])).reverse();\n let max = Arr(0, n - 2, i => s[i] == t[0] ? t1[i + 1] : 0).sum();\n\n For(0, Math.min(k, n - t0[n - 1] - t1[0]), i => {\n let ss = [...s];\n let remain = i;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (ss[i] != t[0] && ss[i] != t[1]) { ss[i] = t[0]; remain-- }\n })\n For(0, Math.min(k - i, t1[0]), j => {\n let s0 = [...ss];\n let remain = j;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (s0[i] == t[1]) { s0[i] = t[0]; remain-- }\n })\n // console.log(i, j, s0.join(''));\n remain = k - i - j;\n let t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n let j1 = n - 1;\n let j2 = n - 1;\n let sum2 = 0;\n while (remain > 0 && (j1 >= 0 || j2 >= 0)) {\n while (j1 >= 0 && (s0[j1] == t[0] || s0[j1] == t[1])) j1--;\n while (j2 >= 0 && s0[j2] != t[0]) {\n if (s0[j2] == t[1]) sum2++;\n j2--;\n }\n if ((t00[j1 - 1] || 0) > (t00[j2 - 1] || 0) - sum2) {\n s0[j1--] = t[1];\n remain--;\n } else if ((t00[j2 - 1] || 0) - sum2 >= 0) {\n s0[j2--] = t[1];\n sum2++;\n remain--;\n } else break;\n }\n t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n // console.log(i, j, k - i - j, s0.join(''), Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum());\n max = Math.max(max, Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum())\n })\n })\n console.log(max);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "73afe7a739b271cf55764715fcef0b85", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n let count = s => Arr(0, n - 2, i => Arr(i + 1, n - 1, j => s[i] == t[0] && s[j] == t[1]).sum()).sum();\n let max = count(s);\n For(0, k, i => {\n let s0 = [...s];\n let remain = i;\n For(0, n - 1, j => {\n if (remain <= 0) return 1;\n if (s0[j] != t[0]) {\n s0[j] = t[0];\n remain--;\n }\n });\n remain = k - i;\n For(n -1, 0, j => {\n if (remain <= 0) return 1;\n if (s0[j] != t[1]) {\n s0[j] = t[1];\n remain--;\n }\n })\n max = Math.max(max, count(s0));\n });\n console.log(max);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32205dde2b1120b609e9c9410bd98f71", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n if (t[0] == t[1]) {\n let x = Math.min([...s].filter(c => c == t[0]).length + k, n);\n console.log(x * (x - 1) / 2);\n return;\n }\n let t0 = Arr(0, n - 1, (i, p) => p + (s[i] == t[0]));\n let t1 = Arr(0, n - 1, (i, p) => p + (s[n - 1 - i] == t[1])).reverse();\n let max = Arr(0, n - 2, i => s[i] == t[0] ? t1[i + 1] : 0).sum();\n\n For(0, Math.min(k, n - t0[n - 1] - t1[0]), i => {\n let ss = [...s];\n let remain = i;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (ss[i] != t[0] && ss[i] != t[1]) { ss[i] = t[0]; remain-- }\n })\n For(0, Math.min(k - i, t1[0]), j => {\n let s0 = [...ss];\n let remain = j;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (s0[i] == t[1]) { s0[i] = t[0]; remain-- }\n })\n\n if (k < 50) {\n For(0, Math.min(k - i - j, n - t0[n - 1] - t1[0]), z => {\n let s1 = [...s0];\n let remain = z;\n For(n - 1, 0, i => {\n if (remain <= 0) return 0;\n if (s1[i] != t[1] && s1[i] != t[0]) { s1[i] = t[1]; remain-- }\n });\n remain = k - i - j - z;\n For(n - 1, 0, i => {\n if (remain <= 0) return 0;\n if (s1[i] == t[0]) { s1[i] = t[1]; remain-- }\n });\n let tt = Arr(0, n - 1, (i, p) => p + (s1[i] == t[0]));\n max = Math.max(max, Arr(1, n - 1, i => s1[i] == t[1] ? tt[i - 1] : 0).sum())\n });\n return 0;\n }\n\n // console.log(i, j, s0.join(''));\n remain = k - i - j;\n let t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n let j1 = n - 1;\n let j2 = n - 1;\n let sum2 = 0;\n while (remain > 0 && (j1 >= 0 || j2 >= 0)) {\n while (j1 >= 0 && (s0[j1] == t[0] || s0[j1] == t[1])) j1--;\n while (j2 >= 0 && s0[j2] != t[0]) {\n if (s0[j2] == t[1]) sum2++;\n j2--;\n }\n if ((t00[j1 - 1] || 0) > (t00[j2 - 1] || 0) - sum2) {\n s0[j1--] = t[1];\n remain--;\n } else if ((t00[j2 - 1] || 0) - sum2 >= 0) {\n s0[j2--] = t[1];\n sum2++;\n remain--;\n } else break;\n }\n t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n // console.log(i, j, k - i - j, s0.join(''), Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum());\n max = Math.max(max, Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum())\n })\n })\n console.log(max);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d090cd9e88f2f91818620ec293a89e6a", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n let f = [];\n let c = (i, j, z) => {\n let x = ((f[i] || [])[j] || [])[z]\n return x === undefined ? -1e5 : x;\n }\n let f0 = Arr(0, n, (i, p) => i ? p + (s[i - 1] == t[0]) : 0);\n if (t[0] == t[1]) {\n let m = Math.min(f0[n] + k, n);\n console.log(m * (m - 1) / 2)\n return;\n }\n if (k == 0) {\n let res = 0;\n for (let i = 0; i < n - 1; i++) {\n for (let j = i + 1; j < n; j++) {\n if (s[i] == t[0] && s[j] == t[1]) res++;\n }\n }\n console.log(res);\n return;\n }\n for (let i = 2; i <= n; i++) {\n f[i] = Array(n + 1);\n for (let j = 0; j <= k; j++) {\n f[i][j] = Array(n + 1);\n for (let z = 1; z <= i; z++) {\n if (i == 2) {\n if (z == 1) {\n let dif = (s[0] != t[0]) + (s[1] != t[1]);\n if (j >= dif) f[i][j][z] = 1;\n else {\n let same = (s[0] == t[0]) + (s[1] == t[0]);\n if (same == 1 || j > 0) f[i][j][z] = 0;\n }\n } else {\n let same = (s[0] == t[0]) + (s[1] == t[0]);\n if (j >= 2 - same) f[i][j][z] = 0;\n }\n // console.log(i, j, z, c(i, j, z));\n continue;\n }\n // if (j == 0) {\n // if (s[i - 1] == t[1]) {\n // if (z == f0[i]) f[i][j][z] = 1;\n // } else {\n // f[i][j][z] = c(i - 1, j, z - (s[i - 1] == t[0]));\n // }\n // console.log(i, j, z, c(i, j, z));\n // continue;\n // }\n if (s[i - 1] == t[1]) {\n f[i][j][z] = Math.max(c(i, j - 1, z), c(i - 1, j, z) + z);\n } else if (s[i - 1] != t[0]) {\n f[i][j][z] = Math.max(c(i - 1, j, z), c(i, j - 1, z), c(i - 1, j - 1, z) + z, c(i - 1, j - 1, z - 1))\n } else {\n f[i][j][z] = Math.max(c(i - 1, j, z - 1), c(i, j - 1, z), c(i - 1, j - 1, z) + z)\n }\n // console.log(i, j, z, f[i][j][z]);\n }\n }\n }\n console.log(Math.max(...f[n][k].filter(v => v)));\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aa71aa7ebfdba9e0c14bb9d39ad09d30", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n if (t[0] == t[1]) {\n let x = Math.min([...s].filter(c => c == t[0]).length + k, n);\n console.log(x * (x - 1) / 2);\n return;\n }\n let t0 = Arr(0, n - 1, (i, p) => p + (s[i] == t[0]));\n let t1 = Arr(0, n - 1, (i, p) => p + (s[n - 1 - i] == t[1])).reverse();\n let max = Arr(0, n - 2, i => s[i] == t[0] ? t1[i + 1] : 0).sum();\n\n For(0, Math.min(k, n - t0[n - 1] - t1[0]), i => {\n let ss = [...s];\n let remain = i;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (ss[i] != t[0] && ss[i] != t[1]) { ss[i] = t[0]; remain-- }\n })\n For(0, Math.min(k - i, t1[0]), j => {\n let s0 = [...ss];\n let remain = j;\n For(0, n - 1, i => {\n if (remain <= 0) return 0;\n if (s0[i] == t[1]) { s0[i] = t[0]; remain-- }\n })\n\n For(0, Math.min(k - i - j, n - t0[n - 1] - t1[0]), z => {\n let s1 = [...s0];\n let remain = z;\n For(n - 1, 0, i => {\n if (remain <= 0) return 0;\n if (s1[i] != t[1] && s1[i] != t[0]) { s1[i] = t[1]; remain-- }\n });\n remain = k - i - j - z;\n For(n - 1, 0, i => {\n if (remain <= 0) return 0;\n if (s1[i] == t[0]) { s1[i] = t[1]; remain-- }\n });\n let tt = Arr(0, n - 1, (i, p) => p + (s1[i] == t[0]));\n max = Math.max(max, Arr(1, n - 1, i => s1[i] == t[1] ? tt[i - 1] : 0).sum())\n })\n\n // console.log(i, j, s0.join(''));\n // remain = k - i - j;\n // let t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n // let j1 = n - 1;\n // let j2 = n - 1;\n // let sum2 = 0;\n // while (remain > 0 && (j1 >= 0 || j2 >= 0)) {\n // while (j1 >= 0 && (s0[j1] == t[0] || s0[j1] == t[1])) j1--;\n // while (j2 >= 0 && s0[j2] != t[0]) {\n // if (s0[j2] == t[1]) sum2++;\n // j2--;\n // }\n // if ((t00[j1 - 1] || 0) > (t00[j2 - 1] || 0) - sum2) {\n // s0[j1--] = t[1];\n // remain--;\n // } else if ((t00[j2 - 1] || 0) - sum2 >= 0) {\n // s0[j2--] = t[1];\n // sum2++;\n // remain--;\n // } else break;\n // }\n // t00 = Arr(0, n - 1, (i, p) => p + (s0[i] == t[0]));\n // // console.log(i, j, k - i - j, s0.join(''), Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum());\n // max = Math.max(max, Arr(1, n - 1, i => s0[i] == t[1] ? t00[i - 1] : 0).sum())\n })\n })\n console.log(max);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3ac6e6037e10c83da95b97b4284695ee", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let input = '';\nlet inputResolve;\nlet inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => inputResolve());\n\nfunction For(a, b, fn) {\n let res;\n if (a < b) {\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) !== undefined) return res;\n }\n } else {\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) !== undefined) return res;\n }\n }\n}\n\nfunction Arr(a, b, fn, prev) {\n let p = prev || 0;\n if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);\n return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn(v)).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);\n return [this[i], i, min];\n}\nArray.prototype.max = function (fn) {\n let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));\n let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);\n return [this[i], i, max];\n}\n\nfunction gcd(a, b) {\n if (!b) return a;\n return gcd(b, a % b);\n}\nfunction mod(a, n, m) {\n if (n == 0n) return 1n;\n if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);\n return a * mod(a, n - 1n, m) % m;\n}\nfunction extendedEuclid(a, b) {\n if (!b) return [1, 0];\n else {\n let [x, y] = extendedEuclid(b, a % b);\n return [y, x - (a / b | 0) * y];\n }\n}\n// [m] = extendedEuclid(a, 998244353);\n\n(async () => {\n await inputPromise;\n let inp = input.split(/\\s+/); r = 0;\n let [n, k, s, t] = inp;\n n = +n;\n k = +k;\n if (t[0] == t[1]) {\n let x = Math.min([...s].filter(c => c == t[0]).length + k, n);\n console.log(x * (x - 1) / 2);\n return;\n }\n let f = Arr(0, n + 1, i => Arr(0, n + 1, i => Arr(0, n + 1, i => -1e5)));\n f[0][0][0] = 0;\n For(0, n, i => {\n For(0, k, j => {\n For(0, i, cnt0 => {\n if (f[i][j][cnt0] < 0) return;\n let e0 = s[i] == t[0];\n let e1 = s[i] == t[1];\n f[i + 1][j][cnt0 + e0] = Math.max(f[i + 1][j][cnt0 + e0], f[i][j][cnt0] + e1 * cnt0);\n f[i + 1][j + 1][cnt0 + 1] = Math.max(f[i + 1][j + 1][cnt0 + 1], f[i][j][cnt0]);\n f[i + 1][j + 1][cnt0] = Math.max(f[i + 1][j][cnt0], f[i][j][cnt0] + cnt0);\n })\n })\n })\n // console.log(f);\n console.log(Arr(0, k, i => Arr(0, n, j => f[n][i][j]).max()[0]).max()[0]);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3a9ffe3b0f996629bc9ad9f8c40b07b3", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n operate(lines); \n});\n\n\nfunction operate(lines){\n line1=lines[0].split(' ');\n //console.log(line1[0]);\n console.log(line1[1]);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5c114efd397ed89a830ac964c030b1cc", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n operate(lines); \n});\n\n\nfunction operate(lines){\n line1=lines[0].split(' ');\n n=line1[0];\n k=line1[1];\n x=0;\n i=0;\n s=1;\n while(s>0){\n i++;\n x+=i;\n m=x-k;\n s=n-m-i;\n }\n console.log(m);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cda2e6cab55f0b7ca79365872c3da0ff", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var line = readline();\nvar n = line.split(' ')[0];\nvar k = line.split(' ')[1];\nvar sum = 0;\n\nif(n == 1 && k ==1){\n print(0);\n}\n\nfor(var i =1; i <= n-1; i++){\n if(gaussSum(i) - (n-i) == k){\n print(n-i);\n break;\n }\n}\n\nfunction gaussSum(n){\n return (n * (n+1))/2;\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1af719c4e79a4c7f5dd9737bbceabd5d", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arr = readline().split(' ').map(item => +item);\nvar n = arr[0]; k = arr[1];\nvar i = 0;\nvar sum = 0;\n\nwhile(n > 0) {\n i++;\n n--;\n sum += i;\n if(sum >= k && n === sum - k) {\n break;\n }\n}\n\nprint(n);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "facde31ce3dc952c35cfbd192a7fa901", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "function main() {\n // write code here:\n const nk = stdin[0].split(' ').map(Number);\n var i = 0,\n sum = 0;\n while (nk[0] > 0) {\n nk[0]--;\n i++;\n sum += i;\n if (sum >= nk[1] && nk[0] === sum - nk[1]) {\n break;\n }\n }\n console.log(nk[0]);\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {\n stdin.push(line);\n});\nrl.on('close', main);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "33d7feabf811a0692584de5d74b8913c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "let i = '';\nprocess.stdin.on('data', (c) => {\n i += c;\n});\nprocess.stdin.on('end', () => {\n const { EOL } = require('os');\n const lines = i.split(EOL);\n const [n, k] = lines[0].split(' ');\n console.log(getCandiesEaten(parseInt(n, 10), parseInt(k, 10)));\n});\n\nfunction getCandiesEaten(n, k) {\n if (n === 1) return 0;\n n--;\n let candies = 1;\n let sum = 2;\n let consumed = 0;\n while (n > 0) {\n while (candies <= k) {\n candies += sum;\n sum++;\n n--;\n }\n // Reduce candies to less than k\n const candiesToSubtract = candies - k;\n n -= candiesToSubtract;\n consumed += candiesToSubtract;\n candies -= candiesToSubtract;\n }\n return consumed;\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2b6ee29552b1f83b89b5e7a67fbe540f", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n =readline()\nvar root=Math.sqrt(n)\n\nvar nbr=4,curNbr=2,k=1,res=1,ok=false\n\nwhile(nbr-10; i--) {\n if(n%i===0) {\n two=(i).toString(2);\n if(two.length%2===1){\n c=true;\n for(j=0;j0; i--) {\n if(n%i===0) {\n two=(i).toString(2);\n if(two.length%2===1){\n c=true;\n for(j=0;j0; i--) {\n if(n%i===0) {\n two=(i).toString(2);\n if(two%2===1){\n c=true;\n for(j=0;j0; i--) {\n if(n%i===0) {\n two=(i).toString(2);\n if(two.length%2===1){\n c=true;\n for(j=0;j +v);\nvar s = 0;\nwhile(a.length) {\n var l = a.length,\n m = Infinity,\n mi = 1;\n for(var i = 1; i < l; i++) {\n var lm = Math.abs(a[0] - a[i]);\n if(lm < m) {\n m = lm;\n mi = i;\n }\n }\n s += m;\n a.splice(mi, 1);\n a.splice(0, 1);\n}\nwrite(s);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "990ef2104856f5b631740aec3ba54c5e", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n\n const input = lines[1];\n const vector = input.split(' ').map(\n n => parseInt(n)\n );\n\n const insertionSort = (vector) => {\n let res = 0;\n\n for (let i = 0; i < vector.length; i++) {\n let minIndex = i;\n\n for (let j = i + 1; j < vector.length; j++) {\n if (vector[j] < vector[minIndex]) {\n minIndex = j;\n }\n }\n\n let temp = vector[i];\n vector[i] = vector[minIndex];\n vector[minIndex] = temp;\n\n if (i !== 0 && i % 2 === 1) {\n res += vector[i] - vector[i -1]\n }\n }\n\n console.log(res);\n };\n});\n\n//////\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ab6211cbab7e7e94fddda206ff66483f", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n\n const input = lines[1];\n const vector = input.split(' ').map(\n n => parseInt(n)\n );\n\n const insertionSort = (vector) => {\n let res = 0;\n\n for (let i = 0; i < vector.length; i++) {\n let minIndex = i;\n\n for (let j = i + 1; j < vector.length; j++) {\n if (vector[j] < vector[minIndex]) {\n minIndex = j;\n }\n }\n\n let temp = vector[i];\n vector[i] = vector[minIndex];\n vector[minIndex] = temp;\n\n if (i !== 0 && i % 2 === 1) {\n res += vector[i] - vector[i -1]\n }\n }\n\n console.log(res);\n };\n});\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aed35ed6459494a3a22ce419f3860ce7", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "readline();\nconst input = readline();\nconst vector = input.split(' ').map(\n n => parseInt(n)\n);\n\nconst insertionSort = (vector) => {\n let res = 0;\n\n for (let i = 0; i < vector.length; i++) {\n let minIndex = i;\n\n for (let j = i + 1; j < vector.length; j++) {\n if (vector[j] < vector[minIndex]) {\n minIndex = j;\n }\n }\n\n let temp = vector[i];\n vector[i] = vector[minIndex];\n vector[minIndex] = temp;\n\n if (i !== 0 && i % 2 === 1) {\n res += vector[i] - vector[i -1]\n }\n }\n\n write(res);\n};\n\ninsertionSort(vector);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c8c64f66703510b0cbd7065740a994ec", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let size = parseInt(prompt('input elements count'));\nlet vector = [];\n\nfor (let i = 0; i < size; i++) {\n\tlet element = prompt('enter element');\n\tvector.push(element);\n}\n\nlet shiftSize = parseInt(prompt('enter shift size'));\n\nfor (let i = 0; i < shiftSize; i++) {\n\tvector.push(vector[0]);\n\tvector.shift();\n}\n\nalert(vector.join(' '));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4a698afa55f54d834e38a2b9a5dfd9a2", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//var input = readline()\nvar k = readline()\n\nvar n = readline().split(' ')\nn.sort((a,b) => { return a - b })\n//print(n)\n//print(n[0]+' '+n[1])\nvar a = 0, b = 0\nfor(var i=0; i {\n if (c === 0) {\n c++;\n return;\n }\n\n const arr = d.split(' ').map(Number).sort((a, b) => a - b);\n let ans = 0;\n\n for (let i = 0; i < arr.length; i++) {\n if (i % 2) {\n ans += arr[i];\n }\n else {\n ans -= arr[i];\n }\n }\n\n console.log(Math.abs(ans));\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d4bf42c1e7473594b2f43b0d43a6ff3f", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline(),\n a = readline().split(' ').map(v => +v);\na.sort((a,b) => a - b);\nvar s = 0;\nwhile(n) {\n var m = 100,\n mi = 1;\n for(var i = 1; i < n; i++) {\n var lm = Math.abs(a[0] - a[i]);\n if(lm < m) {\n m = lm;\n mi = i;\n }\n }\n s += m;\n a.splice(mi, 1);\n a.splice(0, 1);\n n -= 2;\n}\nwrite(s);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "415dc0f3302c5b16e9608562543877ab", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let input = [];\n \nconst RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n});\n\nRL.on('line', (line) => {\n input.push(line);\n});\n\nRL.on('close', () => {\n let n = parseInt(input[0]);\n let num = []; input[1].split(' ').forEach(i => num.push(parseInt(i)));\n num.sort((a, b) => a-b);\n let answer = 0;\n for(let i = 1; i < n; i+=2){\n answer += num[i]-num[i-1];\n }\n console.log(answer);\n});\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cb9b8b0323e8532f87e8c099e1ee0503", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding(\"utf-8\");\n\nlet inputString = \"\";\nlet currentLine = 0;\n\nprocess.stdin.on(\"data\", (inputStdin) => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on(\"end\", (_) => {\n inputString = inputString\n .replace(/\\s*$/, \"\")\n .split(\"\\n\")\n .map((str) => str.replace(/\\s*$/, \"\"));\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n const nd = readLine().split(\" \");\n const length = parseInt(nd[0], 10);\n const array = readLine()\n .split(\" \")\n .map((aTemp) => parseInt(aTemp, 10));\n\n let count = 0;\n for (let i = 0; i < length - 1; i++) {\n for (let j = 1; j < length; j++) {\n if (array[j - 1] > array[j]) {\n [array[j - 1], array[j]] = [array[j], array[j - 1]];\n }\n }\n }\n for (let g = 0; g < array.length; g += 2) {\n if (array[g + 1] > array[g]) {\n count += array[g + 1] - array[g];\n }\n }\n console.log(count);\n}\n\n// sortTeams(length, students);\n\n// const input = prompt(\"Friends\");\n\n// const meetFriends = () => {\n// let friends = input.split(\" \");\n// let distance = 0;\n\n// for (let i = 1; i < friends.length; i++) {\n// let current = friends[i];\n\n// let index = i;\n\n// while (index >= 0 && current < friends[index - 1]) {\n// friends[index] = friends[index - 1];\n// index--;\n// }\n// friends[index] = current;\n// }\n// distance = friends[2] - friends[0];\n// console.log(distance);\n// };\n\n// meetFriends(input);\n\n// const input1 = parseInt(prompt(\"First length\"))\n// const input2 = prompt(\"First text\")\n// const input3 = parseInt(prompt(\"Second length\"))\n// const input4 = prompt(\"Second text\")\n\n// const chooseTwoNumbers = () => {\n// let first = input2.split(\" \");\n// let second = input4.split(\" \");\n\n// for (let i = 1; i < input1; i++) {\n// let current = first[i];\n\n// let index = i;\n\n// while (index >= 0 && current < first[index - 1]) {\n// first[index] = first[index - 1];\n// index--;\n// }\n// first[index] = current;\n// }\n// for (let i = 1; i < input3; i++) {\n// let current = second[i];\n\n// let index = i;\n\n// while (index >= 0 && current < second[index - 1]) {\n// second[index] = second[index - 1];\n// index--;\n// }\n// second[index] = current;\n// }\n\n// if (\n// first[input1 - 1] >= second[input3 - 1] &&\n// first[0] >= second[input3 - 1]\n// ) {\n// console.log(\"YES\");\n// } else if (first[input1 - 1] <= second[0] && first[0] <= second[0]) {\n// console.log(\"YES\");\n// } else {\n// console.log(\"NO\");\n// }\n// };\n\n// chooseTwoNumbers();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8c081eb08abc51e047c3f2395d95e2ec", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n\n const input = lines[1];\n const vector = input.split(' ').map(\n n => parseInt(n)\n );\n\n const insertionSort = (vector) => {\n let res = 0;\n\n for (let i = 0; i < vector.length; i++) {\n let minIndex = i;\n\n for (let j = i + 1; j < vector.length; j++) {\n if (vector[j] < vector[minIndex]) {\n minIndex = j;\n }\n }\n\n let temp = vector[i];\n vector[i] = vector[minIndex];\n vector[minIndex] = temp;\n\n if (i !== 0 && i % 2 === 1) {\n res += vector[i] - vector[i -1]\n }\n }\n\n console.log(res);\n };\n\n insertionSort(vector);\n});\n\n//////\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d9434119753fb03b18e82e672fc4ca90", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "//var input = readline()\nvar k = readline()\n\nvar n = readline().split(' ')\nn.sort((a, b) => (a - b))\n\nvar a = 0, b = 0\nfor(var i=0; i {\n if (l == 0) { l++ }\n else {\n rl.close();\n let strArray = input.split(\" \")\n let s = strArray.map(function (item) {\n return parseInt(item, 10);\n });\n s = s.sort(function sortNumber(a, b) {\n return a - b;\n })\n let res = 0;\n for (let i = 0; i < input.length; i += 2) {\n let d = s[i + 1] - s[i]\n if (d > 0) {\n res += d\n }\n }\n console.log(res)\n return 0;\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6615ee3524be722e628db651a1f8a688", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar ni = readline().split(' ');\nvar output = 0;\n\nfor(var i=0; i b) return 1;\n if (a < b) return -1;\n}\n\nfor(var i=0; iinput+=data)\nprocess.stdin.on('end',()=>{\n let count = 0;\n let tmp = input.split('\\n');\n let arr = tmp[1].split(' ').map((val)=>+val).sort((a,b)=>a-b);\n \n for(let i = 0; i < arr.length; i+=2){\n count+=Math.abs(arr[i]-arr[i+1])\n }\n console.log(count)\n})\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aad2d5e617dbd853b355ad8c3a863cbc", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n input: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n obj = init(inLine);\n console.error('\\n');\n var start = Date.now();\n Main();\n var end = Date.now() - start;\n myerr('time : ' + end + 'ms');\n myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n return {\n list : input, index : 0, max : input.length,\n hasNext : function(){return (this.index < this.max);},\n next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n };\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n var N = nextInt();\n var list = nextIntArray();\n list.sort(function(a,b){\n \treturn a - b;\n });\n var output = 0;\n for(var i = 0; i < N; i += 2){\n output += list[i + 1] - list[i];\n }\n myout(output);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1b8dcbfc6be5af7e054ff67ca215827e", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n\n let l=0;\n rl.on('line', (input) => {\n if (l==0) {l++}\n else {\n rl.close(); \n let strArray = input.split(\" \")\n let s = strArray.map(function(item) {\n return parseInt(item, 10);\n });\n s = s.sort(function sortNumber(a,b) {\n return a - b;\n })\n let res=0;\n for(let i=0;i0) {\n res+=d\n }\n }\n console.log(res)\n return 0;\n}\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c739721a329b4810980cbfca7fc23e13", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let stdin = process.stdin;\nstdin.setEncoding('utf8');\nstdin.on('data', function (data) {\n let input = data.split('\\n');\n let n = input[0].split(' ').map(function (a) { return parseInt(a); });\n let k = input[1].split(' ').map(function (a) { return parseInt(a); });\n let result = solution(n, k);\n console.log(result);\n});\n\n// End of interface\n\nconst solution = (n, studentsArray) => {\n\tlet res = 0;\n\tstudentsArray.sort(function(a, b){return a-b});\n\tfor (let i = 0; i 0)\n return this.substring(0, index) + string + this.substring(index, this.length);\n else\n return string + this;\n};\nString.prototype.reverse= function(){\n return this.split('').reverse().join('');\n}\n\n\nfunction solve(){\n var s = readline();\n var alphabet = \"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n for(var i = 0; i <= s.length; ++i){\n for(var j = 0; j < alphabet.length; ++j){\n var s1 = s.insert(i,alphabet[j]);\n var s2 = s1.reverse();\n if(s1 == s2){\n print(s1);\n return;\n }\n }\n }\n print(\"NA\");\n}\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d063991d18a14bfea0bd471bf49b98e4", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "(function() {\n\nvar alpha = \"abcdefghijklmnopqrstuvwxyz\";\nvar str = readline();\n\nfor(var i = 0; i <= str.length; i++) {\n for(var j = 0; j < alpha.length; j++) {\n var res = str.substr(0,i)+alpha[j]+str.substr(i);\n if(isPalin(res))\n return print(res);\n }\n}\n\nprint(\"NA\");\n\nfunction isPalin(s) {\n for(var i = 0; i < s.length/2; i++) {\n if(s[i] !== s[s.length-1-i])\n return false;\n }\n return true;\n}\n\n})();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0bdc05c9508075ab475442962d921cfc", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "const readline = require(\"readline\");\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nrl.question(\"\", function {\n let ans = word.split('')\n let j = ans.length - 1;\n let ans2 = ans.join('');\n let found = false\n for(let i = 0; !found && i < ans.length; i++){\n for(let j = 0; j < ans.length; j++){\n let ans1 = ans2.slice(0, i) + ans[j] + ans2.slice(i, ans.length )\n if(checkPolindrom(ans1)){\n found = true;\n console.log(ans1);\n break;\n }\n }\n }\n\n for(let i = 0; !found && i < ans.length; i++){\n if(ans[i] !== ans[j]){\n let ans1 = ans2 + ans[j];\n if(checkPolindrom(ans1)){\n found = true\n console.log(ans1)\n break;\n }\n ans1 = ans[j] + ans2;\n if(checkPolindrom(ans1)){\n found = true\n console.log(ans1)\n break;\n }\n ans1 = ans[i] + ans2;\n if(checkPolindrom(ans1)){\n found = true\n console.log(ans1)\n break;\n }\n ans1 = ans2 + ans[i];\n if(checkPolindrom(ans1)){\n found = true\n console.log(ans1)\n break;\n }\n }\n }\n if(!found)\n console.log('NA')\n process.exit(0)\n})\n\nrl.on(\"close\", function() {\n console.log(\"\\nBYE BYE !!!\");\n process.exit(0);\n});\n\n\nfunction checkPolindrom(ans1){\n var splitString = ans1.split(\"\");\n var reverseArray = splitString.reverse();\n let check = reverseArray.join(\"\");\n return check === ans1;\n}", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "3ac709bf2eec889fd0dcfc9ac7c65d12", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "(function() {\n\nvar alpha = \"abcdefghijklmnopqrstuvwxyz\";\nvar str = readline();\n\nfor(var i = 0; i <= str.length; i++) {\n for(var j = 0; j < alpha.length; j++) {\n var res = s.substr(0,i)+alpha[j]+s.substr(i);\n if(isPalin(res))\n return print(res);\n }\n}\n\nprint(\"NA\");\n\nfunction isPalin(s) {\n for(var i = 0; i < s.length/2; i++) {\n if(s[i] !== s[s.length-1-i])\n return false;\n }\n return true;\n}\n\n})();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8745ba44f585098bbf95b1492a382340", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar N = nextInt();\n\tvar list = nextCharArray();\n\tvar output = \"\";\n\tvar isOne = false;\n\tfor(var i = 0; i < N; i++){\n\t\tif(list[i] == \"0\"){\n\t\t\toutput += \"0\";\n\t\t}else{\n\t\t\tisOne = true;\n\t\t}\n\t}\n\tif(isOne){\n\t\tmyout(\"1\" + output);\n\t}else{\n\t\tmyout(\"0\");\n\t}\n\t\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e36dbed1485537a20cd3b6c329e9e921", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "m=Number(readline()) ;\narr=readline() ;\nans=\"1\"\nfor(j=0;j1)\n print(ans);\nelse\n print(arr)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1839fbbeb0d9529a21e3332ab65096dc", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar g = readline().split(\"\");\n\nvar zeros = 0;\nvar ones = 0;\nfor(i=0;i {\n if (c === 0) {\n c++;\n return;\n }\n\n let ones = 0;\n let zeros = 0;\n\n for (let i = 0; i < str.length; i++) {\n if (str[i] === '1') {\n ones++;\n }\n else {\n zeros++;\n }\n }\n\n if (ones === 0) {\n console.log(0);\n }\n else {\n console.log(`1${'0'.repeat(zeros)}`);\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "051d45639e9ca2569365117e637261ec", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var N = readline().split(\"\");\nvar S = readline().split(\"\");\n\nvar cnt = 0;\n\nS.forEach((item) => {\n if (item === '0') {\n cnt++;\n }\n});\n\nvar ans = \"\";\nans += S[0];\n\nif (S[0] === '0') {\n cnt--;\n}\n\nfor (var i = 0; i < cnt; i++) {\n ans += '0';\n}\n\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ce93def42e719d6e9c8c6e7c30635845", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "m=Number(readline()) ;\narr=readline() ;\nans=\"1\"\nfor(j=0;j1)\n print(ans);\nelse\n print(arr)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3cae67bb24315799648b832b253d4080", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = readline(), str = readline().split(''), cnt = [0, 0], ans = '';\nfor(var i = 0; i < n; i++) str[i] === '0'? cnt[0]++ : cnt[1]++;\nif(cnt[1] !== 0) ans += 1;\nfor(var i = 0; i < cnt[0]; i++) ans += '0';\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "912c56c89e4e371ca436ce7b67266807", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var N = readline().split(\"\");\nvar S = readline().split(\"\");\n\nvar cnt = 0;\n\nS.forEach((item) => {\n if (item === '0') {\n cnt++;\n }\n});\n\nprint(S[0]);\nif (S[0] === '0') {\n cnt--;\n}\n\nfor (var i = 0; i < cnt; i++) {\n print('0');\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "48b809bfe127c98346cc58d7b7f9e2c4", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "/*a=readline().split(\" \").map(Number) ;\nn=a[0];\nm=a[1];\n*/\n\nm=Number(readline()) ;\n arr=readline() ;\n ans=\"1\"\n for(j=0;j2)\n print(ans);\nelse\n print(\"0\")", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32c843f69451a7298c811a3bfe2f6e56", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction parse(number, inputBase) {\n\tvar power = 1, total = 0;\n\twhile (number != 0) {\n\t\tvar digit = number%10;\n\t\ttotal += digit*power;\n\t\tnumber = (number-digit)/10;\n\t\tpower *= inputBase;\n\t}\n\treturn total;\n}\n\nfunction generate(number, base) {\n\tvar digits = [];\n\twhile (true) {\n\t\tdigits.push(number%base);\n\t\tnumber = Math.floor(number/base);\n\t\tif (number == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tdigits.reverse();\n\treturn digits.join(\"\");\n}\n\nfunction findLargestDigit(number) {\n\tvar best = 0;\n\twhile (number != 0) {\n\t\tbest = Math.max(best, number%10);\n\t\tnumber = Math.floor(number/10);\n\t}\n\treturn best;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline());\n\tvar base = Math.max(findLargestDigit(data[0]),\n\t\t\tfindLargestDigit(data[1])) + 1;\n\tvar sum = parse(data[0], base) + parse(data[1], base);\n\tprint(generate(sum, base).length);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "438aa9079d0ef4727561b56da0ba0c31", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\nmin++\n\nlet max = 0\nfor (let i = min; i < 14; i++) {\n let da = parseInt(a, i)\n let db = parseInt(b, i)\n let ds = da + db\n let bs = from10(ds, i)\n max = Math.max(max, String(bs).length)\n}\n\nprint(max)\n\nfunction from10 (x, b) {\n let res = ''\n let n = 0\n while (Math.pow(b, ++n) <= x) {}\n while (n--) {\n let a = x / Math.pow(b, n) | 0\n if (b > 9) {\n res += 'a'\n } else {\n res += a\n }\n x -= a * Math.pow(b, n)\n }\n return res\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5f949a76eb591dfe47f5288324bf5f69", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\nmin++\n\nlet max = 0\nfor (let i = min; i < 14; i++) {\n let da = to10(a, i)\n let db = to10(b, i)\n let ds = da + db\n let bs = from10(ds, i)\n max = Math.max(max, String(bs).length)\n}\n\nprint(max)\n\nfunction to10 (x, b) {\n return String(x).split('').reduce((r, v, i) => r + v * Math.pow(b, i), 0)\n}\n\nfunction from10 (x, b) {\n let res = ''\n let n = 0\n while (Math.pow(b, ++n) <= x) {}\n while (n--) {\n let a = x / Math.pow(b, n) | 0\n if (b > 9) {\n res += 'a'\n } else {\n res += a\n }\n x -= a * Math.pow(b, n)\n }\n return res\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4dd642a0612a06daf83c9c5a119d757d", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\nmin++\n\nlet max = 0\nfor (let i = min; i < 14; i++) {\n let ba = from10(a, i)\n let bb = from10(b, i)\n let da = to10(ba, i)\n let db = to10(bb, i)\n let ds = da + db\n let bs = from10(ds, i)\n max = Math.max(max, String(bs).length)\n}\n\nprint(max)\n\nfunction to10 (x, b) {\n return String(x).split('').reduce((r, v, i) => r + v * Math.pow(b, i), 0)\n}\n\nfunction from10 (x, b) {\n let res = ''\n let n = 0\n while (Math.pow(b, ++n) <= x) {}\n while (n--) {\n let a = x / Math.pow(b, n) | 0\n res += a\n x -= a * Math.pow(b, n)\n }\n return res\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "875c22a3914d18d31e26ff07c53bf746", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\n\nlet max = 0\nif (min == 1) {\n max = a + b\n} else {\n for (let i = min; i < 14; i++) {\n let ba = parseInt(a, i)\n let bb = parseInt(b, i)\n let da = to10(ba, i)\n let db = to10(bb, i)\n let ds = da + db\n let bs = parseInt(ds, i)\n max = Math.max(max, String(bs).length)\n }\n}\n\n\nprint(max)\n\nfunction to10 (x, b) {\n return String(x).split('').reduce((r, v, i) => r + v * Math.pow(b, i), 0)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "620b3648bac824d869360b2b9c72e048", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\nmin++\n\nlet max = 0\nfor (let i = min; i < 14; i++) {\n let da = to10(a, i)\n let db = to10(b, i)\n let ds = da + db\n let bs = from10(ds, i)\n max = Math.max(max, String(bs).length)\n}\n\nprint(max)\n\nfunction to10 (x, b) {\n return String(x).split('').reduce((r, v, i) => r + v * Math.pow(b, i), 0)\n}\n\nfunction from10 (x, b) {\n let res = ''\n let n = 0\n if (b > 9) return parseInt(x, b)\n while (Math.pow(b, ++n) <= x) {}\n while (n--) {\n let a = x / Math.pow(b, n) | 0\n res += a\n x -= a * Math.pow(b, n)\n }\n return res\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "034ee6d9b34466de827021a2a290e513", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction parse(number, inputBase) {\n\tvar power = 1, total = 0;\n\twhile (number != 0) {\n\t\tvar digit = number%10;\n\t\ttotal += digit*power;\n\t\tnumber = (number-digit)/10;\n\t\tpower += inputBase;\n\t}\n\treturn total;\n}\n\nfunction generate(number, base) {\n\tvar digits = [];\n\twhile (true) {\n\t\tdigits.push(number%base);\n\t\tnumber = Math.floor(number/base);\n\t\tif (number == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tdigits.reverse();\n\treturn digits.join(\"\");\n}\n\nfunction findLargestDigit(number) {\n\tvar best = 0;\n\twhile (number != 0) {\n\t\tbest = Math.max(best, number%10);\n\t\tnumber = Math.floor(number/10);\n\t}\n\treturn best;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline());\n\tvar base = Math.max(findLargestDigit(data[0]),\n\t\t\tfindLargestDigit(data[1])) + 1;\n\tvar sum = parse(data[0], base) + parse(data[1], base);\n\tprint(generate(sum, base).length);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c36d854a701bcec4a3aac90a07f10965", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ')\nvar a = line[0].split(\"\")\nvar k = parseInt(line[1])\n\nfor (var i = 0; i + 1 < a.length; i++) {\n\tvar p = i\n\tfor (var j = 1; j <= k && i + j < a.length; j++) {\n\t\tvar q = i + j\n\t\tif (a[q] > a[p]) p = q\n\t}\n\n\tfor (var j = p - 1; j >= i; j--) {\n\t\tvar t = a[j]\n\t\ta[j] = a[j + 1]\n\t\ta[j + 1] = t\n\t}\n\n\tk -= p - i\n}\n\nprint(a.join(\"\"))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "43e17898aa8abdbf4b74bc04154f07ee", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenize(readline()),\n\t\tdigits = data[0].split(''), n = digits.length,\n\t\tswapNum = parseInt(data[1]);\n\tfor (var i = 0; i < digits.length; ++i) {\n\t\tdigits[i] = parseInt(digits[i]);\n\t}\n\tfor (var pos = 0; swapNum > 0 && pos < n; ++pos) {\n\t\tvar max = digits[pos], best = pos,\n\t\t\tlimit = Math.min(pos+swapNum, n-1);\n\t\tfor (var seek = pos+1; seek <= limit; ++seek) {\n\t\t\tif (digits[seek] > max) {\n\t\t\t\tbest = seek;\n\t\t\t\tmax = digits[seek];\n\t\t\t}\n\t\t}\n\t\tif (best != pos) {\n\t\t\tfor (var i = best; i > pos; --i) {\n\t\t\t\tdigits[i] = digits[i-1];\n\t\t\t}\n\t\t\tdigits[pos] = max;\n\t\t\tswapNum -= (best-pos);\n\t\t}\n\t}\n\tprint(digits.join(''));\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "95c812fe41c3248fe4b684424dfd0c43", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var nm = readline().trim().split(' ');\nvar a=nm[0],k=parseInt(nm[1]);\n\nvar cursor = 0;\nvar iMaxi = 0;\n\nwhile(k>0 && cursor a[p]) p = q\n\t}\n\n\tvar t = a[i]\n\ta[i] = a[p]\n\ta[p] = t\n\n\tk -= p - i\n}\n\nprint(a.join(\"\"))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "86f4f17b1f4dc137d0b70f1745b92053", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var nm = readline().trim().split(' ').map((x)=>parseInt(x));\nvar a=nm[0]+\"\",k=nm[1];\n\nvar cursor = 0;\nvar iMaxi = 0;\n\nwhile(k>0 && cursor= this.lines.length\r\n }\r\n readLine() {\r\n const n = this.lines[this.lineIndex]\r\n return (this.lineIndex += 1), n\r\n }\r\n readIntegersOfLine() {\r\n const n = this.readLine().match(integerRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n readNumsOfLine() {\r\n const n = this.readLine().match(decimalRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n print(n) {\r\n stdout.write(n)\r\n }\r\n async init() {\r\n const n = await this.readLines()\r\n this.lines = n\r\n }\r\n readLines() {\r\n const n = []\r\n return new Promise(e => {\r\n stdin.on('data', e => n.push(e)),\r\n stdin.on('end', function () {\r\n const t = n.join('').split(os.EOL)\r\n e(t)\r\n })\r\n })\r\n }\r\n}\r\nasync function __main__(n) {\r\n const e = new InputAndOutput()\r\n await e.init(), n(e)\r\n}\r\nconst MOD = BigInt(1000000007),\r\n MAX_N = 200010,\r\n f = new Array(MAX_N)\r\nfunction solve(n, e) {\r\n if (0 === e) return 1n\r\n return (\r\n (((fastPower(2n, BigInt(n) * BigInt(e), MOD) -\r\n fastPower(f[n], BigInt(e), MOD)) %\r\n MOD) +\r\n MOD) %\r\n MOD\r\n )\r\n}\r\nfunction fastPower(n, e, t) {\r\n let i = 1n\r\n for (let s = e, r = n; s > 0; s /= 2n, r = (r * r) % t)\r\n s % 2n === 1n && (i = (i * r) % t)\r\n return i\r\n}\r\n__main__(function (n) {\r\n ;(f[0] = 0n), (f[1] = 1n), (f[2] = 2n)\r\n for (let n = 3; n < MAX_N; ++n) f[n] = (f[n - 1] + f[n - 2]) % MOD\r\n const e = Number(n.readLine())\r\n for (let t = 1; t <= e; ++t) {\r\n const [e, t] = n.readIntegersOfLine(),\r\n i = solve(e, t)\r\n n.print(i + '\\n')\r\n }\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b50b504f5eaeac39a1a0b81158796175", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict'\r\nObject.defineProperty(exports, '__esModule', { value: !0 })\r\nvar os = require('os')\r\nconst stdin = process.stdin,\r\n stdout = process.stdout,\r\n integerRegex = /-?\\d+/g,\r\n decimalRegex = /-?\\d+(?:\\.\\d+)?/g\r\nclass InputAndOutput {\r\n lineIndex = 0\r\n lines = []\r\n dried() {\r\n return this.lineIndex >= this.lines.length\r\n }\r\n readLine() {\r\n const n = this.lines[this.lineIndex]\r\n return (this.lineIndex += 1), n\r\n }\r\n readIntegersOfLine() {\r\n const n = this.readLine().match(integerRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n readNumsOfLine() {\r\n const n = this.readLine().match(decimalRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n print(n) {\r\n stdout.write(n)\r\n }\r\n async init() {\r\n const n = await this.readLines()\r\n this.lines = n\r\n }\r\n readLines() {\r\n const n = []\r\n return new Promise(e => {\r\n stdin.on('data', e => n.push(e)),\r\n stdin.on('end', function () {\r\n const t = n.join('').split(os.EOL)\r\n e(t)\r\n })\r\n })\r\n }\r\n}\r\nasync function __main__(n) {\r\n const e = new InputAndOutput()\r\n await e.init(), n(e)\r\n}\r\nconst MOD = BigInt(1000000007)\r\nfunction solve(n, e) {\r\n if (0 === e) return 1n\r\n const t =\r\n 1 & n\r\n ? fastPower(2n, BigInt(n - 1), MOD) + 1n\r\n : fastPower(2n, BigInt(n - 1), MOD)\r\n return fastPower((t + MOD) % MOD, BigInt(e), MOD)\r\n}\r\nfunction fastPower(n, e, t) {\r\n let s = 1n\r\n for (let i = e, r = n; i > 0; i /= 2n, r = (r * r) % t)\r\n i % 2n === 1n && (s = (s * r) % t)\r\n return s\r\n}\r\n__main__(function (n) {\r\n const e = Number(n.readLine())\r\n for (let t = 1; t <= e; ++t) {\r\n const [e, t] = n.readIntegersOfLine(),\r\n s = ((solve(e, t) % MOD) + MOD) % MOD\r\n n.print(s + '\\n')\r\n }\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b6c0a8cb0031eefdc27783cebc62d761", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict'\r\nObject.defineProperty(exports, '__esModule', { value: !0 })\r\nvar os = require('os')\r\nconst stdin = process.stdin,\r\n stdout = process.stdout,\r\n integerRegex = /-?\\d+/g,\r\n decimalRegex = /-?\\d+(?:\\.\\d+)?/g\r\nclass InputAndOutput {\r\n lineIndex = 0\r\n lines = []\r\n dried() {\r\n return this.lineIndex >= this.lines.length\r\n }\r\n readLine() {\r\n const n = this.lines[this.lineIndex]\r\n return (this.lineIndex += 1), n\r\n }\r\n readIntegersOfLine() {\r\n const n = this.readLine().match(integerRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n readNumsOfLine() {\r\n const n = this.readLine().match(decimalRegex)\r\n return null == n ? [] : n.map(n => Number(n))\r\n }\r\n print(n) {\r\n stdout.write(n)\r\n }\r\n async init() {\r\n const n = await this.readLines()\r\n this.lines = n\r\n }\r\n readLines() {\r\n const n = []\r\n return new Promise(e => {\r\n stdin.on('data', e => n.push(e)),\r\n stdin.on('end', function () {\r\n const t = n.join('').split(os.EOL)\r\n e(t)\r\n })\r\n })\r\n }\r\n}\r\nasync function __main__(n) {\r\n const e = new InputAndOutput()\r\n await e.init(), n(e)\r\n}\r\nconst MOD = BigInt(1000000007),\r\n MAX_N = 200010,\r\n f = new Array(MAX_N)\r\nfunction solve(n, e) {\r\n if (0 === e) return 1n\r\n const t = f[n - 1]\r\n if (1 & n) return fastPower(t + 1n, BigInt(e), MOD)\r\n let s = fastPower(t - 1n, BigInt(e), MOD),\r\n i = 1n\r\n for (let n = 1; n <= e; ++n) (s += i * f[e - n]), (i = (i * t) % MOD)\r\n return s\r\n}\r\nfunction fastPower(n, e, t) {\r\n let s = 1n\r\n for (let i = e, r = n; i > 0; i /= 2n, r = (r * r) % t)\r\n i % 2n === 1n && (s = (s * r) % t)\r\n return s\r\n}\r\n__main__(function (n) {\r\n f[0] = 1n\r\n for (let n = 1; n < MAX_N; ++n) f[n] = (2n * f[n - 1]) % MOD\r\n const e = Number(n.readLine())\r\n for (let t = 1; t <= e; ++t) {\r\n const [e, t] = n.readIntegersOfLine(),\r\n s = ((solve(e, t) % MOD) + MOD) % MOD\r\n n.print(s + '\\n')\r\n }\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d8d15b6972cb6fddb030bb8af747a856", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict'\r\nObject.defineProperty(exports, '__esModule', { value: !0 })\r\nvar os = require('os')\r\nconst stdin = process.stdin,\r\n stdout = process.stdout,\r\n integerRegex = /-?\\d+/g,\r\n decimalRegex = /-?\\d+(?:\\.\\d+)?/g\r\nclass InputAndOutput {\r\n lineIndex = 0\r\n lines = []\r\n dried() {\r\n return this.lineIndex >= this.lines.length\r\n }\r\n readLine() {\r\n const e = this.lines[this.lineIndex]\r\n return (this.lineIndex += 1), e\r\n }\r\n readIntegersOfLine() {\r\n const e = this.readLine().match(integerRegex)\r\n return null == e ? [] : e.map(e => Number(e))\r\n }\r\n readNumsOfLine() {\r\n const e = this.readLine().match(decimalRegex)\r\n return null == e ? [] : e.map(e => Number(e))\r\n }\r\n print(e) {\r\n stdout.write(e)\r\n }\r\n async init() {\r\n const e = await this.readLines()\r\n this.lines = e\r\n }\r\n readLines() {\r\n const e = []\r\n return new Promise(n => {\r\n stdin.on('data', n => e.push(n)),\r\n stdin.on('end', function () {\r\n const t = e.join('').split(os.EOL)\r\n n(t)\r\n })\r\n })\r\n }\r\n}\r\nasync function __main__(e) {\r\n const n = new InputAndOutput()\r\n await n.init(), e(n)\r\n}\r\nconst MOD = BigInt(1000000007)\r\nfunction solve(e, n) {\r\n if (0 === n) return 1n\r\n const t = fastPower(2n, BigInt(e - 1), MOD)\r\n let s = fastPower((t + MOD) % MOD, BigInt(n), MOD)\r\n if (0 == (1 & e)) return s\r\n for (let e = 1; e <= n; ++e)\r\n s += fastPower(t, BigInt(e - 1), MOD) * fastPower(2n, BigInt(n - e), MOD)\r\n return s\r\n}\r\nfunction fastPower(e, n, t) {\r\n let s = 1n\r\n for (let i = n, r = e; i > 0; i /= 2n, r = (r * r) % t)\r\n i % 2n === 1n && (s = (s * r) % t)\r\n return s\r\n}\r\n__main__(function (e) {\r\n const n = Number(e.readLine())\r\n for (let t = 1; t <= n; ++t) {\r\n const [n, t] = e.readIntegersOfLine(),\r\n s = ((solve(n, t) % MOD) + MOD) % MOD\r\n e.print(s + '\\n')\r\n }\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8c1dae6e15eb41bfe26f610656fe9c41", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict'\r\nObject.defineProperty(exports, '__esModule', { value: !0 })\r\nvar os = require('os')\r\nfunction fastModuloPower(e, n, t) {\r\n let r = 1n\r\n for (let s = n, i = e; s > 0; s >>= 1, i = (i * i) % t)\r\n 1 & s && (r = (r * i) % t)\r\n return r\r\n}\r\nconst stdin = process.stdin,\r\n stdout = process.stdout,\r\n integerRegex = /-?\\d+/g,\r\n decimalRegex = /-?\\d+(?:\\.\\d+)?/g\r\nclass InputAndOutput {\r\n lineIndex = 0\r\n lines = []\r\n dried() {\r\n return this.lineIndex >= this.lines.length\r\n }\r\n readLine() {\r\n const e = this.lines[this.lineIndex]\r\n return (this.lineIndex += 1), e\r\n }\r\n readIntegersOfLine() {\r\n const e = this.readLine().match(integerRegex)\r\n return null == e ? [] : e.map(e => Number(e))\r\n }\r\n readNumsOfLine() {\r\n const e = this.readLine().match(decimalRegex)\r\n return null == e ? [] : e.map(e => Number(e))\r\n }\r\n print(e) {\r\n stdout.write(e)\r\n }\r\n async init() {\r\n const e = await this.readLines()\r\n this.lines = e\r\n }\r\n readLines() {\r\n const e = []\r\n return new Promise(n => {\r\n stdin.on('data', n => e.push(n)),\r\n stdin.on('end', function () {\r\n const t = e.join('').split(os.EOL)\r\n n(t)\r\n })\r\n })\r\n }\r\n}\r\nasync function __main__(e) {\r\n const n = new InputAndOutput()\r\n await n.init(), e(n)\r\n}\r\nconst MOD = BigInt(1000000007),\r\n MAX_N = 200010,\r\n f = new Array(MAX_N),\r\n h = new Array(MAX_N)\r\nfunction solve(e, n) {\r\n if (0 === n) return 1n\r\n const t = 1 & e ? f[e - 1] + 1n : f[e - 1] - 1n,\r\n r = fastModuloPower(t, n, MOD)\r\n if (1 & e) return r\r\n for (let t = 0, r = 1n; t <= n; ++t, r = (r * f[e]) % MOD) h[t] = r\r\n let s = 0n\r\n for (let e = 1, r = 1n; e <= n; ++e)\r\n (s += (r * h[n - e]) % MOD), (r = (r * t) % MOD)\r\n return (((fastModuloPower(f[e], n, MOD) - s * f[e - 1]) % MOD) + MOD) % MOD\r\n}\r\n__main__(function (e) {\r\n f[0] = 1n\r\n for (let e = 1; e < MAX_N; ++e) f[e] = (2n * f[e - 1]) % MOD\r\n const n = Number(e.readLine())\r\n for (let t = 1; t <= n; ++t) {\r\n const [n, t] = e.readIntegersOfLine(),\r\n r = solve(n, t)\r\n e.print(r + '\\n')\r\n }\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "62eca8d8fa631906c4b98e836e2e3ca5", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "print(function(s) {\n\n\tvar x = {};\n\tfor (var i = 0; i <= 9; i++)\n\t\tx[readline()] = i;\n\n\treturn s.replace(/[01]{10}/g, function(v) {\n\t\treturn x[v];\n\t});\n\n}(readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1719a075e96dbf13c41dc036481c9272", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function () {\n\t\tvar s = readline().split(''), l = [];\n\t\tfor (var i = 0; i < 8; i++) {\n\t\t\tl.push(s.splice(0, 10).join(''));\n\t\t}\n\n\t\tvar n = [], s = 10;\n\t\twhile (s--) {\n\t\t\tn.push(readline());\n\t\t}\n\n\t\tl.forEach(function (e, i) {\n\t\t\tl[i] = n.indexOf(e);\n\t\t});\n\n\t\treturn l.join('');\n\t}());\n}.call(this));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "af4a575ee1b02c4c4f5676fbecade5f9", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function cmp(a,b)\n{\n return a-b;\n}\n\nvar s = readline();\nvar res=10\nfor (var i=0;i<=999999;i++)\n{\n var z=i+''\n while(z.length<6)\n {\n z='0'+z\n }\n var a=+z[0]\n var b=+z[1]\n var c=+z[2]\n var d=+z[3]\n var e=+z[4]\n var f=+z[5]\n if (a+b+c==d+e+f)\n {\n var kol=6;\n for (var j=0;j<6;j++)\n {\n if (s[j]==z[j]){kol--;}\n }\n if (res>kol){res=kol;}\n }\n}\nprint(res)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a7a9a6adc5f2988f148245eee47e1282", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var xParams = readline().split(' '),\n xRepresentation = readline();\n yParams = readline().split(' '),\n yRepresentation = readline();\n \n// var xParams = \"7 16\".split(' '),\n// xRepresentation = \"15 15 4 0 0 7 10\";\n// yParams = \"7 9\".split(' '),\n// yRepresentation = \"4 8 0 3 1 5 0\";\n \nvar n = Number(xParams[0]),\n xNumSys = Number(xParams[1]),\n m = Number(yParams[0]),\n yNumSys = Number(yParams[1]);\n\n \nfunction solver() {\n var x = transformBaseRepToDecimal(xRepresentation.split(' ').map(function (item) {\n return Number(item);\n }), xNumSys);\n var y = transformBaseRepToDecimal(yRepresentation.split(' ').map(function (item) {\n return Number(item);\n }), yNumSys);\n \n var res = '=';\n if (x < y) {\n return '<';\n } else if (x > y) {\n return '>';\n }\n \n return res;\n}\n\nfunction transformBaseRepToDecimal(arr, base) {\n var decimalValue = 0;\n \n for (var i = arr.length - 1, val = 1; i >= 0; i--) {\n decimalValue += ((val * arr[i]));\n val *= base;\n }\n \n return decimalValue;\n}\n\nprint(solver());\n// console.log(solver());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "757dfd0f00088ebc0e4b538b6adbe62b", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var x = readline().split(' ');\nvar n = parseInt(x[0]);\nvar bx = parseInt(x[1]);\nx = readline().split(' ');\nvar a = []\nfor(var i = 0; i < n; i++) {\n a[i] = parseInt(x[i]);\n}\nx = readline().split(' ');\nvar m = parseInt(x[0]);\nvar by = parseInt(x[1]);\nx = readline().split(' ');\nvar b = []\nfor(var i = 0; i\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cb965197397e58c31f4978e68bd40e60", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var x ;\n var Arr , c ,v0 ,v1 ,a ,l ,sum , count ;\n\nnextLine();\nfunction nextLine(){\nvar x = readline()\nif(x){\nArr = x.split(\" \").map(function(x) { return parseInt(x); })\nc= Arr[0]\nv0 = Arr[1]\nv1 = Arr[2]\na =Arr[3]\nl = Arr[4]\nsum = 0 ;\ncount=0 ; \nsum = 0 ;\ncount = 0;\n\nsummer();\n}\n}\n\n\nfunction summer (){\nsum += (v0+count*a arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar _readline$split$map = readline().split(' ').map(function (val) {\n return parseInt(val);\n}),\n _readline$split$map2 = _slicedToArray(_readline$split$map, 5),\n c = _readline$split$map2[0],\n v0 = _readline$split$map2[1],\n v1 = _readline$split$map2[2],\n a = _readline$split$map2[3],\n l = _readline$split$map2[4];\n\nvar cur = 0;\nvar speed = v0;\nvar day = 0;\n\nwhile (true) {\n day++;\n cur += speed;\n if (cur >= c) break;\n cur -= l;\n speed = Math.min(v1, speed + a);\n}\n\nprint(day);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7d892ab8eda1e8c1ad40d867141bc0bb", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main()\n{\n var line = readline();\n var arr = line.split(' ');\n\n //print(arr);\n\n var c = parseInt(arr[0]),\n v0 = parseInt(arr[1]),\n v1 = parseInt(arr[2]),\n a = parseInt(arr[3]),\n l = parseInt(arr[4]);\n\n var read = v0,\n days = 1;\n\n if (c === 0) {\n print(0);\n return 0;\n }\n while (read < c) {\n read += Math.min((v0 - l) + days * a, v1);\n days++;\n }\n\n print(days);\n return 0;\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "becd2fe1ba823c096dc4f367ada1c1b8", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function main()\n{\n var line = readline();\n var arr = line.split(' ');\n\n //print(arr);\n\n var c = parseInt(arr[0]),\n v0 = parseInt(arr[1]),\n v1 = parseInt(arr[2]),\n a = parseInt(arr[3]),\n l = parseInt(arr[4]);\n\n var read = v0,\n days = 1;\n\n while (read < c) {\n read += Math.min((v0 - l) + days * a, v1);\n days++;\n }\n\n print(days);\n return 0;\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "17264c168caff5b3a4f54ce55117ba4a", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "\nvar x ;\nvar Arr , c ,v0 ,v1 ,a ,l ,sum , count ;\nnextLine();\nfunction nextLine(){\n // var x = readLine()\n if(x.split(\" \").length>3){\n Arr = readLine().split(\" \").map(function(x) { return parseInt(x); })\n c= Arr[0]\n v0 = Arr[1]\n v1 = Arr[2]\n a =Arr[3]\n l = Arr[4]\n sum = 0 ;\n count=0 ; \n sum = 0 ;\n count = 0;\n summer();\n }\n}\n\n\nfunction summer (){\n sum += (v0+count*a3){\nArr = x.split(\" \").map(function(x) { return parseInt(x); })\nc= Arr[0]\nv0 = Arr[1]\nv1 = Arr[2]\na =Arr[3]\nl = Arr[4]\nsum = 0 ;\ncount=0 ; \nsum = 0 ;\ncount = 0;\n\nsummer();\n}\n}\n\n\nfunction summer (){\nsum += (v0+count*a3){\nArr = x.split(\" \").map(function(x) { return parseInt(x); })\nc= Arr[0]\nv0 = Arr[1]\nv1 = Arr[2]\na =Arr[3]\nl = Arr[4]\nsum = 0 ;\ncount=0 ; \nsum = 0 ;\ncount = 0;\n\nsummer();\n}\n}\n\n\nfunction summer (){\nsum += (v0+count*a3){\n Arr = readLine().split(\" \").map(function(x) { return parseInt(x); })\n c= Arr[0]\n v0 = Arr[1]\n v1 = Arr[2]\n a =Arr[3]\n l = Arr[4]\n sum = 0 ;\n count=0 ; \n sum = 0 ;\n count = 0;\n summer();\n }\n}\n\n\nfunction summer (){\n sum += (v0+count*a {\n let [n, k] = d.split(' ').map(Number);\n\n let mid = Math.ceil(n / 2);\n let x = mid % (k + 1);\n let a = (mid - x) / (k + 1);\n let b = a * k;\n let c = n - a - b;\n\n console.log(`${a} ${b} ${c}`);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "665a990a062d5d1f09e96488528a2050", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var numbers = readline().split(\" \").map(Number);\n\n var students = numbers[0];\n var ratio = numbers[1];\n var notWinners = '0 0 ' + students;\n\n if (ratio * 2 > students)\n return notWinners;\n\n for (var i = parseInt((students + 1) / 2); i >= 0; i--) {\n var ratio2 = ratio + 1;\n if (i % ratio2 == 0) {\n var numDiplomas = i / ratio2;\n return numDiplomas + \" \" + numDiplomas * ratio + \" \" + (students - (numDiplomas * ratio2));\n }\n }\n\n return notWinners;\n}\n\nprint(main());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d4833e97545da6ae77ab49922cbe6bd0", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n const numbers = readline().split(\" \").map(Number);\n\n const students = numbers[0];\n const ratio = numbers[1];\n const notWinners = '0 0 ' + students;\n\n if (ratio * 2 > students)\n return notWinners;\n\n for (let i = parseInt((students + 1) / 2); i >= 0; i--) {\n let ratio2 = ratio + 1;\n if (i % ratio2 == 0) {\n let numDiplomas = i / ratio2;\n return numDiplomas + \" \" + numDiplomas * ratio + \" \" + (students - (numDiplomas * ratio2));\n }\n }\n\n return notWinners;\n}\n\nprint(main());", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "255a8fc0799aede70bd6d9cd527ae359", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var numbers = readline().split(\" \").map(Number);\n\n var students = numbers[0];\n var ratio = numbers[1];\n var notWinners = '0 0 ' + students;\n\n if (ratio * 2 >= students)\n return notWinners;\n\n var max = parseInt(students / 2);\n var ratio2 = ratio + 1;\n max -= max % ratio2;\n var ndiplomas = max / ratio2;\n if(ndiplomas === 0)\n return notWinners;\n var ncert = ndiplomas * ratio;\n var nnotwinners = students - ncert - ndiplomas;\n\n return ndiplomas + ' ' + ncert + ' ' + nnotwinners;\n}\n\nprint(main());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "499382cf151dfc0912a151666d9fae2a", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var data = readline().split(\" \");\nvar cnt = parseInt(data[0]);\nvar mod = parseInt(data[1]);\n\nvar d = 0;\nvar g = 0;\nvar l = 0;\nvar p = parseInt(cnt/2); //9\n\nd = parseInt(p / (mod + 1));\ng = parseInt(d * mod);\nl = parseInt(cnt - d - g);\n\nif (mod > cnt) {\n d = 0;\n g = 0;\n l = cnt;\n}\n\nprint(d + ' ' + g + ' ' + l)\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7b8a813ef22cb9dd5802d82e1b7c8ba8", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n let [n, k] = d.split(' ').map(Number);\n\n let mid = Math.floor(n / 2);\n let x = mid % (k + 1);\n let a = (mid - x) / (k + 1);\n let b = a * k;\n let c = n - a - b;\n\n console.log(`${a} ${b} ${c}`);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "83bcf8b77428bdc1811bb3072cdb1de7", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var numbers = readline().split(\" \").map(Number);\n\n var students = numbers[0];\n var ratio = numbers[1];\n var notWinners = '0 0 ' + students;\n\n if (ratio * 2 > students)\n return notWinners;\n\n for (var i = parseInt(students / 2); i >= 0; i--) {\n var ratio2 = ratio + 1;\n if (i % ratio2 == 0) {\n var numDiplomas = i / ratio2;\n return numDiplomas + \" \" + numDiplomas * ratio + \" \" + (students - (numDiplomas * ratio2));\n }\n }\n\n return notWinners;\n}\n\nprint(main());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "925a91328311f9c516534b5abbb52769", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "s=readline().split(' ')\nn=+s[0]\nm=+s[1]\nif (n 0; rep++) {\n var low = 0, high = 1000, cnt = 0;\n while(low <= high) {\n var mid = (low + high) >> 1;\n if(nC2(mid) <= k) {\n cnt = mid;\n low = mid + 1;\n }else {\n high = mid - 1;\n }\n }\n k -= nC2(cnt);\n ans += String.fromCharCode(97 + rep).repeat(cnt);\n }\n print(ans);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "886b0173e20d2dc40896425fc90ba12d", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var triangles=[0]\nwhile(triangles[triangles.length-1]<=100000)\n{\n triangles.push(triangles[triangles.length-1]+triangles.length);\n}\n\nvar n=+readline()\nvar nows='qwertyuiopasdfghjklzxcvbnm'\nvar now=0\nres=''\nif (0==n)\n{\n print(\"skorobogatova\")\n}\nelse if (0==n)\n{\n print(\"danil\")\n}\nelse\n{\n var i=triangles.length-1;\n while(n)\n {\n while(triangles[i]>n){i--;}\n n-=triangles[i]\n for (var j=0;j<=i;j++)\n {\n res+=nows[now];\n }\n now++;\n }\n}\nprint(res)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dff8bfaa5e34b8db0bde8d432b7e7403", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map((x) => Number(x));\n\n// var input = \"5 2 1 4 5\".split(' ').map((x) => Number(x));\n\nvar d = input[0], k = input[1], a = input[2], b = input[3], t = input[4];\n\nvar cnt = Math.floor(d / k), o = d - cnt * k;\n\n\nvar a1 = (t / k + a);\n\nvar ans;\n\nif (k >= d) {\n print(a * d);\n}\n\nif (a1 >= b) {\n ans = k * a + (d - k) * b;\n}\nelse {\n var t1 = (cnt * k + o) * a + t * cnt, t2 = cnt * k * a + b * o + t * (cnt - 1);\n ans = Math.min(t1, t2);\n}\n\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e176e8643e3675fe206e75dc67777cf6", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map((x) => Number(x));\n\n// var input = \"5 2 1 4 5\".split(' ').map((x) => Number(x));\n\nvar d = input[0], k = input[1], a = input[2], b = input[3], t = input[4];\n\nvar cnt = Math.floor(d / k), o = d - cnt * k;\n\n\nvar a1 = (t / k + a);\n\nvar ans;\n\nif (a1 >= b) {\n ans = k * a + (d - k) * b;\n}\nelse {\n var t1 = (cnt * k + o) * a + t * cnt, t2 = cnt * k * a + b * o + t * (cnt - 1);\n ans = Math.min(t1, t2);\n}\n print(Math.min(t1, t2));\n\n//console.log(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8dd9fc7922991a76cf1ac44ea99aabbd", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map((x) => Number(x));\n\n// var input = \"5 2 1 4 5\".split(' ').map((x) => Number(x));\n\nvar d = input[0], k = input[1], a = input[2], b = input[3], t = input[4];\n\nvar cnt = Math.floor(d / k), o = d - cnt * k;\n\n\nvar a1 = (t / k + a);\n\nvar ans;\n\nif (a1 >= b) {\n ans = k * a + (d - k) * b;\n}\nelse {\n var t1 = (cnt * k + o) * a + t * cnt, t2 = cnt * k * a + b * o + t * (cnt - 1);\n ans = Math.min(t1, t2);\n}\n\nprint(ans);\n\n//console.log(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "949c8ec2558192ed0e315aaf1afbe2f6", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map((x) => Number(x));\n\n// var input = \"5 2 1 4 5\".split(' ').map((x) => Number(x));\n\nvar d = input[0], k = input[1], a = input[2], b = input[3], t = input[4];\n\nvar cnt = Math.floor(d / k), o = d - cnt * k;\n\n\nvar a1 = (t / k + a);\n\nvar ans;\n\nif (a1 >= b) {\n ans = k * a + (d - k) * b;\n}\nelse {\n var t1 = (cnt * k + o) * a + t * cnt, t2 = cnt * k * a + b * o + t * (cnt - 1);\n ans = Math.min(t1, t2);\n}\n\nif (k >= d) {\n ans = d * a;\n}\n\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f08e54e78d2ab4de7c284e836d3e90db", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var time = readline();\ntime = time.split(\":\");\ntime[0] = parseInt(time[0]);\ntime[1] = parseInt(time[1]);\nif(time[0] > 12){time[0] -= 12;}\nprint((time[0]*30+time[1]*0.5).toFixed(9) + \" \" + (time[1]*6).tofixed(9));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d9de7d418253da2b92ec44630901a7f7", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n let [h, m] = ipt.split(EOL).slice(0, -1)[0].split(':').map(v => parseInt(v))\n if (h >= 12) h -= 12\n\n let y = m * 6\n let x = h * 30 + y / 12\n\n console.log(x, y)\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cd70cd83a4c2dffe469b2cd7a0e0158d", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var time = readline();\ntime = time.split(\":\");\ntime[0] = parseInt(time[0]);\ntime[1] = parseInt(time[1]);\nif(time[0] > 12){time[0] -= 12;}\nprint((time[0]*30+time[1]*0.5).toFixed(9) + \" \" + (time[1]*6).toFixed(9));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "822ed50d03d721d6a4d5dd91af8fe501", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var params = readline().split(/[.e]/);\nvar a = params[0]; var d = params[1]; var b = parseInt(params[2]);\nprint(params);\n\nif(a === \"0\" || b === 0) {\n print(a + \".\" + d);\n} else {\n \n var num = a + d;\n if(b < d.length) {\n var tmp = num.split('');\n tmp.splice(a.length + b, 0, '.');\n num = tmp.join('');\n } else if(b > d.length) {\n var zeros = b - d.length;\n for(var i = 0; i < zeros; i++)\n num += \"0\";\n }\n \n print(num);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4572a32f133743783d5b2a188a8f0363", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar match = input.match(/(\\d*)\\.(\\d*)e(\\d*)/);\n\nvar a = match[1];\nvar d = match[2];\nvar b = match[3];\n\nfor (var i = d.length; i < +b; ++i) {\n d += '0';\n}\n\nmatch = d.match(new RegExp('(.{' + b + '})(.*)'));\n\na = +(a + match[1]);\nd = +match[2];\n\nwrite(d === 0 ? a : a + '.' + d)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d1f0d2f2efeb65eb548b59da84e8c6f4", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var params = readline().split(/[.e]/);\nvar a = params[0]; var d = params[1]; var b = parseInt(params[2]);\n\nif(a === \"0\") {\n print(a + \".\" + d);\n} else {\n \n var num = a + d;\n if(b < d.length) {\n var tmp = num.split('');\n tmp.splice(a.length + d.length - 1, 0, '.');\n num = tmp.join('');\n } else if(b > d.length) {\n var zeros = b - d.length;\n for(var i = 0; i < zeros; i++)\n num += \"0\";\n }\n \n print(num);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ee6b53dd4ab2f264ae46459aeacada23", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var params = readline().split(/[.e]/);\nvar a = params[0]; var d = params[1]; var b = parseInt(params[2]);\n\nif(a === \"0\" && d === \"0\" && b === 0) {\n print(\"0\"); \n} else if(a === \"0\" || b === 0) {\n print(a + \".\" + d);\n} else {\n \n var num = a + d;\n if(b < d.length) {\n var tmp = num.split('');\n tmp.splice(a.length + b, 0, '.');\n num = tmp.join('');\n } else if(b > d.length) {\n var zeros = b - d.length;\n for(var i = 0; i < zeros; i++)\n num += \"0\";\n }\n \n print(num);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "97e17988009ea9118809312d022a614e", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "write(parseFloat(readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "27dfa1cd3e02d282a4b12634e823633c", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var params = readline().split(/[.e]/);\nvar a = params[0]; var d = params[1]; var b = params[2];\n\nif(a === 0) {\n print(a + \".\" + d);\n} else {\n \n var num = a + d;\n if(b < d.length) {\n num = num.split('').splice(a.length + d.length, 0, '.').join('');\n } else if(b > d.length) {\n var zeros = b - d.length;\n for(var i = 0; i < zeros; i++)\n num += \"0\";\n }\n \n print(num);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b58c973ab2eda8e5b64608eb0f3f33d5", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar match = input.match(/(\\d*)\\.(\\d*)e(\\d*)/);\n\nvar a = match[1];\nvar d = match[2];\nvar b = match[3];\n\nfor (var i = d.length; i < +b; ++i) {\n d += '0';\n}\n\nmatch = d.match(new RegExp('(.{' + b + '})(.*)'));\n\na += match[1];\nd = +match[2];\n\nwrite(d === 0 ? a : a + '.' + d)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8fdc4c3ca282d92dc70d70d3ffa963c5", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar match = input.match(/(\\d*)\\.(\\d*)e(\\d*)/);\n\nvar a = match[1];\nvar d = match[2];\nvar b = match[3];\n\nfor (var i = d.length; i < +b; ++i) {\n d += '0';\n}\n\nmatch = d.match(new RegExp('(.{' + b + '})(.*)'));\n\na += match[1];\nd = match[2];\n\nwrite(+d === 0 ? a : a + '.' + d)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "faec2889f9259b65faac5b7237238ebb", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var s = readline();\n s = s.split('e');\n var nm = s[0].split('.');\n var a = nm[0];\n var b = nm[1];\n var c = parseInt(s[1]);\n var res = a;\n if(c >= b.length) {\n res += b;\n while(c > b.length) {\n c -= 1;\n res += '0';\n }\n } else {\n res += b.substr(0, c) + '.' + b.substr(c);\n }\n\n while(res[0] === '0') {\n res = res.substr(1);\n }\n if(res[0] === '.') {\n res = '0' + res;\n }\n if(res.indexOf('.') !== -1) {\n while(res[res.length - 1] === '0') {\n res = res.substr(0, res.length - 1);\n }\n }\n while(res[res.length - 1] === '.') {\n res = res.substr(0, res.length - 1);\n }\n print(res);\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a39d7561509c93347c96b2868a2cf89a", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "print(readline().match(/C{1,5}|P{1,5}/g).length);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2f841faf24f23dcc0375b9c7eef3f4c2", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "(function() {\n var count, lastItem, res, str;\n str = readline();\n lastItem = str[0];\n count = 0;\n res = [];\n str.split(\"\").forEach(function(type) {\n if (type === lastItem) {\n return count++;\n } else {\n res.push(count);\n lastItem = type;\n return count = 1;\n }\n });\n res.push(count);\n count = 0;\n res.forEach(function(num) {\n return count += Math.ceil(num / 5);\n });\n write(count);\n}).call(this);\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c545c8caa7fca65202ceb8254bd79124", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tprint((function () {\n\t\tfor (var i = 1, str = readline(), l = str.length, ret = 0, p = 0; i < l; i++) {\n\t\t\tif (str[i] === str[i - 1]) {\n\t\t\t\tp++;\n\t\t\t} else {\n\t\t\t\tp = 0;\n\t\t\t\tret++;\n\t\t\t}\n\n\t\t\tif (p >= 5) {\n\t\t\t\tret++;\n\t\t\t\tp = 0;\n\t\t\t}\n\t\t}\n\n\t\treturn ret + 1;\n\t}).apply(0));\n\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a2711c8f19fee4f7473998b213ff58cc", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "//137A\n//Local attempts - 4\nlet arr = readline().split('');\nlet res = 0;\nwhile(arr.length) {\n let curr = arr.shift();\n for(let i = 0; i < 4; i++) {\n if (arr[0] === curr) {\n arr.shift();\n } else {\n break;\n }\n }\n res++;\n}\nprint(res);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "e1c9db04d43ab8b2723860005ca3f6e2", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] > 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\t\n\tr = colors[0];\n\tg = colors[1];\n\tb = colors[2];\n\n\tif (r + g + b == 9){\n\t\tcount += 3\n\t}\n\telse if (r + g + b >= 6){\n\t\tcount += 2;\n\t}\n\telse{\n\t\twhile (r >= 1 && g >= 1 && b >= 1){\n\t\t\tr -= 1;\n\t\t\tg -= 1;\n\t\t\tb -= 1;\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "969eb7974dbe3d5d01850ab5ffb45bf0", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\treturn Math.floor((r + g + b) / 3);\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5961ae44431c28cb9903161ccf28b8fe", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] > 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\t\n\tr = colors[0];\n\tg = colors[1];\n\tb = colors[2];\n\tif (r + g + b >= 6){\n\n\t\tcount += 2;\n\t}\n\telse{\n\t\twhile (r >= 1 && g >= 1 && b >= 1){\n\t\t\tr -= 1;\n\t\t\tg -= 1;\n\t\t\tb -= 1;\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count;\n};\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f67786ea942dc0bd10bd4b30937a4b78", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] >= 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\t\n\tr = colors[0];\n\tg = colors[1];\n\tb = colors[2];\n\twhile (r >= 1 && g >= 1 && b >= 1){\n\t\tr -= 1;\n\t\tg -= 1;\n\t\tb -= 1;\n\t\tcount++;\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "634af1abdaddddc525ffe40662d3d95e", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] > 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\t\n\tr = colors[0];\n\tg = colors[1];\n\tb = colors[2];\n\twhile (r >= 1 && g >= 1 && b >= 1){\n\t\tr -= 1;\n\t\tg -= 1;\n\t\tb -= 1;\n\t\tcount++;\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f87e503a48dca5ab360120c4209ad563", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] > 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\n\tif ( colors.filter(function(index) {\n\t\treturn index == 2\n\t}).length < 2) {\n\t\tfor (var i in colors){\n\t\t\twhile (colors[i] >= 3){\n\t\t\t\tcolors[i] -= 3;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\n\twhile (colors.filter(function(index) {\n\t\treturn index >= 1;\n\t}).length >= 3) {\n\t\tfor (var i in colors) {\n\t\t\tcolors[i] -= 1;\n\t\t}\n\t\tcount++;\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7ba749092c62a6ab13f34c014614eed7", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\twhile (colors[i] > 3){\n\t\t\tcolors[i] -= 3;\n\t\t\tcount++;\n\t\t}\n\t}\n\n\tif ( colors.filter(function(index) {\n\t\treturn index == 2\n\t}).length < 2) {\n\t\tfor (var i in colors){\n\t\t\tif (colors[i] == 3){\n\t\t\t\tcolors[i] -= 3;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\n\twhile (colors.filter(function(index) {\n\t\treturn index >= 1;\n\t}).length >= 3) {\n\t\tfor (var i in colors) {\n\t\t\tcolors[i] -= 1;\n\t\t}\n\t\tcount++;\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "82cfef7e21f35f5287ac8229680c0670", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var flowers = function(r, g, b){\n\tvar count = 0;\n\tvar colors = [r, g, b];\n\tfor (var i in colors) {\n\t\tif (colors[i] > 3){\n\t\t\tif (colors[i] % 3 == 0){\n\t\t\t\tcount += colors[i] / 3 - 1;\n\t\t\t\tcolors[i] = 3;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcount += Math.floor(colors[i] / 3);\n\t\t\t\tcolors[i] = colors[i] % 3;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( colors.filter(function(index) {\n\t\treturn index == 2\n\t}).length < 2) {\n\t\tfor (var i in colors){\n\t\t\tif (colors[i] == 3){\n\t\t\t\tcolors[i] -= 3;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\n\twhile (colors.filter(function(index) {\n\t\treturn index >= 1;\n\t}).length >= 3) {\n\t\tfor (var i in colors) {\n\t\t\tcolors[i] -= 1;\n\t\t}\n\t\tcount++;\n\t}\n\n\treturn count;\n};\n\nvar line = readline().split(' ');\nvar r = parseInt(line[0]);\nvar g = parseInt(line[1]);\nvar b = parseInt(line[2]);\n\nprint (flowers(r, g, b));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ebd038c3d06aaec4c5e181806637e18b", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n let [p1, p2, p3, p4, a, b] = ipt.split(EOL)[0].split(' ').map(v => parseInt(v))\n let c = 0\n for (let i = a; i <= b; i++) {\n i % p4 % p3 % p2 % p1 == i && c++\n }\n\n console.log(c)\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5b9655bd476465d0b5dd09d01bf3531a", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n let [p1, p2, p3, p4, a, b] = ipt.split(EOL)[0].split(' ').map(v => parseInt(v))\n let c = 0\n for (let i = a; i <= b; i++) {\n [\n i % p4 % p3 % p2 % p1 == i,\n i % p3 % p4 % p2 % p1 == i,\n i % p3 % p2 % p4 % p1 == i,\n i % p3 % p2 % p1 % p4 == i,\n i % p4 % p2 % p3 % p1 == i,\n i % p2 % p4 % p3 % p1 == i,\n i % p2 % p3 % p4 % p1 == i,\n i % p2 % p3 % p1 % p4 == i,\n i % p4 % p2 % p1 % p3 == i,\n i % p2 % p4 % p1 % p3 == i,\n i % p2 % p1 % p4 % p3 == i,\n i % p2 % p1 % p3 % p4 == i,\n i % p4 % p3 % p1 % p2 == i,\n i % p3 % p4 % p1 % p2 == i,\n i % p3 % p1 % p4 % p2 == i,\n i % p3 % p1 % p2 % p4 == i,\n i % p4 % p1 % p3 % p2 == i,\n i % p1 % p4 % p3 % p2 == i,\n i % p1 % p3 % p4 % p2 == i,\n i % p1 % p3 % p2 % p4 == i,\n i % p4 % p1 % p2 % p3 == i,\n i % p1 % p4 % p2 % p3 == i,\n i % p1 % p2 % p4 % p3 == i,\n i % p1 % p2 % p3 % p4 == i,\n ].filter(Boolean).length >= 7 && c++\n }\n\n console.log(c)\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f522f917a1cd2a875cc76fd07a1b5a52", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(Math.ceil((-1 + Math.sqrt(1 + 8*+readline()))/2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "896b07157c5f3dd7fd023e9c253a4b1f", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "print(Math.floor(Math.log2(+readline())+1));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3eed9913ed13772e9c1718a1f60caa59", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "const https = require('https');\n\n// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n // Print user input in console.\n console.log('User Input Data : ' + data);\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "daff50a3ea5fb30899e740f7a7de18af", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "Main();\nfunction myout(t){print(t);}//standard output\nfunction next(){return readline();}\nfunction nextInt(){return myconv(next(),1);}\nfunction nextStrArray(){return myconv(next(),2);}//\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u5206\u5272\nfunction nextIntArray(){return myconv(next(),4);}//\u534a\u89d2\u30b9\u30da\u30fc\u30b9 + \u6570\u5024\u5316\nfunction nextCharArray(){return myconv(next(),6);}//1\u6587\u5b57\u5206\u5272\n//[no]\u8981\u7d20\u306e\u6271\u3044\u3002\u6570\u5024\u578b\n//\u4e0d\u660e\u5024\u3001\u7570\u5e38\u6642:\u5f15\u6570\u305d\u306e\u307e\u307e\u8fd4\u3059\n//6:1\u6587\u5b57\u306b\u5206\u5272 7:1\u6587\u5b57\u306b\u5206\u5272\u3057\u3001\u6570\u5024\u914d\u5217\u3078\n//8:\u534a\u89d2SP\u3067\u7d50\u5408\u30009:\u6539\u884c\u3067\u7d50\u5408\u30000:\u6587\u5b57\u306a\u3057\u3067\u7d50\u5408\n//atcoder\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u6700\u5f8c\u306b\u6539\u884c\u5165\u308c\u308b\u3053\u3068\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(\" \");case 4:return i.split(\" \").map((a)=>Number(a));case 6:return i.split(\"\");case 7:return i.split(\"\").map((a)=>Number(a));case 8:return i.join(\" \");case 9:return i.join(\"\\n\");case 0:return i.join(\"\");default:return i;}}catch(e){return i;}}\nfunction Main() {\n myout(\"1\");\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c3fb0d658ce7076b5810f1582e197223", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=id:\" + data;\n\t\tconsole.log(url);\n\t\t }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3080f608b9d7d323cf8a3ea3e50777e4", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "Main();\nfunction myout(t){print(t);}//standard output\nfunction next(){return readline();}\nfunction nextInt(){return myconv(next(),1);}\nfunction nextStrArray(){return myconv(next(),2);}//\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u5206\u5272\nfunction nextIntArray(){return myconv(next(),4);}//\u534a\u89d2\u30b9\u30da\u30fc\u30b9 + \u6570\u5024\u5316\nfunction nextCharArray(){return myconv(next(),6);}//1\u6587\u5b57\u5206\u5272\n//[no]\u8981\u7d20\u306e\u6271\u3044\u3002\u6570\u5024\u578b\n//\u4e0d\u660e\u5024\u3001\u7570\u5e38\u6642:\u5f15\u6570\u305d\u306e\u307e\u307e\u8fd4\u3059\n//6:1\u6587\u5b57\u306b\u5206\u5272 7:1\u6587\u5b57\u306b\u5206\u5272\u3057\u3001\u6570\u5024\u914d\u5217\u3078\n//8:\u534a\u89d2SP\u3067\u7d50\u5408\u30009:\u6539\u884c\u3067\u7d50\u5408\u30000:\u6587\u5b57\u306a\u3057\u3067\u7d50\u5408\n//atcoder\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u6700\u5f8c\u306b\u6539\u884c\u5165\u308c\u308b\u3053\u3068\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(\" \");case 4:return i.split(\" \").map((a)=>Number(a));case 6:return i.split(\"\");case 7:return i.split(\"\").map((a)=>Number(a));case 8:return i.join(\" \");case 9:return i.join(\"\\n\");case 0:return i.join(\"\");default:return i;}}catch(e){return i;}}\nfunction Main() {\n myout(\"0\");\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5cd98924a1b110ef93c81a27d13f275b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const https = require('https');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "99ae608d6c4abde81dfd336196473c9b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const https = require('https');\n\n// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=1:\" + data;\n\t\tconsole.log(url)\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ce55247d804486a47ff58f120c738b7b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const request = require(\"request\");\n// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=id:\" + data;\n\t\thttps.get(url, (resp) => {\n\t\t\tconsole.log(resp);\n\t\t});\n\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b123054a81814d93b5863fe35c2ae853", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const request = require(\"request\");\n// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=id:\" + data;\n\t\trequest.get(url, (error, response, body) => {\n\t\t\tlet json = JSON.parse(body);\n\t \t\tconsole.log(json);\n\t\t});\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4a6950e7888fd82017b6dc15129545e0", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "var input = readline();\n\nvar s = readline();\nvar k = s.slice(s.length - 1);\nprint(k % 2 == 0 ? 0 : 1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fbfe2b8c0e0a969789eaf7953b47cbb2", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const https = require('https');\n\nhttps.get('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY', (resp) => {\n let data = '';\n\n // A chunk of data has been recieved.\n resp.on('data', (chunk) => {\n data += chunk;\n });\n\n // The whole response has been received. Print out the result.\n resp.on('end', () => {\n console.log(JSON.parse(data).explanation);\n });\n\n}).on(\"error\", (err) => {\n console.log(\"Error: \" + err.message);\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "da518e31321abf4d31068bcf5af70f14", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "// Get process.stdin as the standard input object.\nconst https = require(\"https\");\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=id:\" + data;\n\t\tconsole.log(url);\n\t\thttps.get(url, res => {\n res.setEncoding(\"utf8\");\n let body = \"\";\n res.on(\"data\", data => {\n body += data;\n });\n res.on(\"end\", () => {\n body = JSON.parse(body);\n console.log(body);\n });\n});\n\t}\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fc5047852ae5a5ffca211b37beff8e7a", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "const https = require('https');\n\n// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else\n {\n\t\t//variable: data\n\t\tvar url = \"https://oeis.org/search?fmt=json&q=id:\" + data;\n\t\thttps.get(url, (resp) => {\n\t\t\tconsole.log(resp);\n\t\t});\n\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d78d3517435b69cf757d1e789c08eb4b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "// Get process.stdin as the standard input object.\nconst https = require(\"https\");\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else{\n\t\tvar r = int(data[6])\n\t\tconsole.log(r % 2);\n\t}\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c740263f3aedde74faa6d3eb902ae418", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readline() {\n return inputString[currentLine++];\n}\n// Make a Snippet for the code above this and then write your logic in main();\n\n\nfunction main() {\n const x = readline();\n let z = parseInt(x, 16) % 2;\n process.stdout.write(z.toString()); // without auto '\\n' (newline)\n\n // console.log(z); // with auto '\\n' (newline)\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "36439fbfe5f4375c8a33a50442d50e7b", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "var input = readline();\n\nvar numbers = parseInt(input.split(\"A\").join(\"\"));\nprint(numbers % 2 === 0 ? 0: 1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d462110e182c6786157e08abbf0cb4e3", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "Node.js", "source_code": "// Get process.stdin as the standard input object.\nvar standard_input = process.stdin;\n\n// Set input character encoding.\nstandard_input.setEncoding('utf-8');\n\n// Prompt user to input data in console.\n\n// When user input data and click enter key.\nstandard_input.on('data', function (data) {\n\n // User input exit.\n if(data === 'exit\\n'){\n // Program exit.\n console.log(\"User input complete, program exit.\");\n process.exit();\n }else{\n\t\tvar r = data[6] - '0'\n\t\tconsole.log(r % 2);\n\t}\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4277b2097c9308603565d5991825d015", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "//var input = readline();\nvar s = readline();\nvar k = s.slice(s.length - 1);\nprint(k % 2 == 0 ? 0 : 1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0cf2710992f1288f9052dd9e9a64ca39", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "JavaScript", "source_code": "function ansa(h,m){\n\n var t = 0;\n while(true){\n if(((h % 10) === (m / 10)) && ((h / 10) === (m % 10))){\n print(t);\n return;\n }\n m++;\n if(m === 60){\n h++;\n m = 0;\n if(h === 24) h = 0;\n }\n t++;\n }\n}\n\n\n//ansa(6,[1,1,1,1,1,1],[5,5,5,5,5,5])\n\n\nvar line = readline();\n\nvar h = parseInt(line[0] + line[1]);\nvar m = parseInt(line[3] + line[4]);\n// var a = readline().split(\" \");\n// for(var i = 0 ; i < a.length ; i++) a[i] = parseInt(a[i]);\n// var b = readline().split(' ');\n// for(var i = 0 ; i < b.length ; i++) b[i] = parseInt(b[i]);\n\nansa(h,m);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b43f8494dc1da75e84e06221d35f6a89", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function ansa(h,m){\n\n var t = 0;\n while(true){\n if((h % 10 === m / 10) && (a / 10 === b % 10)){\n print(t);\n return;\n }\n m++;\n if(b === 60){\n h++;\n if(h === 24) h = 0;\n }\n t++;\n }\n}\n\n\n//ansa(6,[1,1,1,1,1,1],[5,5,5,5,5,5])\n\n\nvar line = readline();\n\nvar h = parseInt(parseInt(line[0]) + \"\" + parseInt(line[1]));\nvar m = parseInt(parseInt(line[3]) + \"\" + parseInt(line[4]));\n// var a = readline().split(\" \");\n// for(var i = 0 ; i < a.length ; i++) a[i] = parseInt(a[i]);\n// var b = readline().split(' ');\n// for(var i = 0 ; i < b.length ; i++) b[i] = parseInt(b[i]);\n\nansa(h,m);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "34b36065eb873a5ecea132e656ffd4ad", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function ansa(h,m){\n\n var t = 0;\n while(true){\n if(((h % 10) === (m / 10)) && ((h / 10) === (m % 10))){\n print(t);\n return;\n }\n m++;\n if(m === 60){\n h++;\n if(h === 24) h = 0;\n }\n t++;\n }\n}\n\n\n//ansa(6,[1,1,1,1,1,1],[5,5,5,5,5,5])\n\n\nvar line = readline();\n\nvar h = parseInt(parseInt(line[0]) + \"\" + parseInt(line[1]));\nvar m = parseInt(parseInt(line[3]) + \"\" + parseInt(line[4]));\n// var a = readline().split(\" \");\n// for(var i = 0 ; i < a.length ; i++) a[i] = parseInt(a[i]);\n// var b = readline().split(' ');\n// for(var i = 0 ; i < b.length ; i++) b[i] = parseInt(b[i]);\n\nansa(h,m);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "519bd8bd0a3674b46050fc6561dd5b02", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function ansa(h,m){\n\n var t = 0;\n while(true){\n if((h % 10 === m / 10) && (h / 10 === m % 10)){\n print(t);\n return;\n }\n m++;\n if(m === 60){\n h++;\n if(h === 24) h = 0;\n }\n t++;\n }\n}\n\n\n//ansa(6,[1,1,1,1,1,1],[5,5,5,5,5,5])\n\n\nvar line = readline();\n\nvar h = parseInt(parseInt(line[0]) + \"\" + parseInt(line[1]));\nvar m = parseInt(parseInt(line[3]) + \"\" + parseInt(line[4]));\n// var a = readline().split(\" \");\n// for(var i = 0 ; i < a.length ; i++) a[i] = parseInt(a[i]);\n// var b = readline().split(' ');\n// for(var i = 0 ; i < b.length ; i++) b[i] = parseInt(b[i]);\n\nansa(h,m);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0d43d66cf72dd73f3a7a95829ee3b12b", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var arr = readline().split(':');\nvar h = parseInt(arr[0]);\nvar m = parseInt(arr[1]);\n\nvar isP = function (s)\n{\n for (var i = 0; i < s.length / 2; i ++)\n {\n if (s.charAt(i) != s.charAt(s.length - i - 1))\n {\n return false;\n }\n }\n return true;\n}\nvar zeroPad = function (num, places)\n{\n var zero = places - num.toString().length + 1;\n return Array(+(zero > 0 && zero)).join(\"0\") + num;\n}\n\nvar i = 0;\nwhile(true)\n{\n var str = zeroPad(h, 2)+zeroPad(m, 2);\n // print(str);\n if (isP(str))\n {\n break;\n }\n m ++;\n if (m >= 60)\n {\n m %= 60;\n h ++;\n h %= 24;\n }\n i ++;\n}\nprint(i);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "561912fea2ba2236bfaec4a1e0c73eed", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function ansa(h,m){\n\n var t = 0;\n while(true){\n if(((Math.floor(h % 10)) === (Math.floor(m / 10))) && (Math.floor((h / 10)) === (Math.floor(m % 10)))){\n print(t);\n return;\n }\n m++;\n if(m === 60){\n h++;\n m = 0;\n if(h === 24) h = 0;\n }\n t++;\n }\n}\n\n\n//ansa(6,[1,1,1,1,1,1],[5,5,5,5,5,5])\n\n\nvar line = readline();\n\nvar h = parseInt(line[0] + line[1]);\nvar m = parseInt(line[3] + line[4]);\n// var a = readline().split(\" \");\n// for(var i = 0 ; i < a.length ; i++) a[i] = parseInt(a[i]);\n// var b = readline().split(' ');\n// for(var i = 0 ; i < b.length ; i++) b[i] = parseInt(b[i]);\n\nansa(h,m);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c5efcebb0cc3f28481b5f83c911de543", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const rd = readline;\nconst wr = write;\nconst pr = print;\n\nvar parties = 0;\nvar pi = [];\nparties = +rd();\npi = rd().split(' ').map(v => +v);\nvar cannot = true;\nvar curr = pi[0];\nvar i = 1;\nvar k = 1, ki = [1];\nvar total = pi.reduce((sum, curr) => {return sum + curr;}, 0);\nwhile(cannot && i < pi.length) {\n\tif ((pi[0] >> 1) >= pi[i]) {\n ki.push(i + 1);\n k++;\n\t\tcurr+= pi[i];\n\t}\n\ti++;\n\tif ((curr << 1) > total) {\n\t cannot = false;\n\t}\n}\nif (cannot) {\n\twr('0');\n} else {\n pr(k);\n\twr(ki.join(' '));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8b6ea95316c683e91ed7d9f0d3f74bb6", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\"use strict\";\n \nvar main = function() {\n var n = +rd();\n var A = rdAr().map((v, i) => [v, i+1]);\n var B = [A[0]].concat(A.slice(1).sort((a, b) => a[0] - b[0]));\n var S = A.reduce((a, v) => v[0] + a, 0);\n //pr(S);\n var pA = A[0][0];\n var H = S/2.0;\n var s = 0;\n var res = [];\n for (var i = 0; i < B.length; ++i) {\n if (s> 0 && pA < 2*B[i][0]) {\n break;\n }\n s += B[i][0];\n res.push(B[i][1]);\n if (s > H) {\n pr(res.length);\n prAr(res);\n return;\n }\n }\n wr(0);\n};\n \nconst rd = readline;\nconst wr = write;\nconst pr = print;\nconst rdAr = () => rd().split(' ').map(v => +v);\nconst prAr = (a) => pr(a.join(' '));\nconst cmpLt = (a, b) => a - b;\nconst cmpGt = (a, b) => b - a;\nArray.prototype.sortLt = function() { return this.sort(cmpLt); };\nArray.prototype.sortGt = function() { return this.sort(cmpGt); };\nconst crAr = function(length, ...fillArgs) { return new Array(length).fill(...fillArgs); };\n \nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "93340ce07e3fb67a2a05acd697904341", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n const arr = d.split(' ').map(Number);\n let a = arr[0];\n let b = 0;\n let mid = Math.floor(a / 2);\n const ans = [1];\n\n for (let i = 1; i < arr.length; i++) {\n if (arr[i] > mid) {\n b += arr[i];\n }\n else {\n a += arr[i];\n ans.push(i + 1);\n }\n }\n\n if (a <= b) {\n console.log(0);\n }\n else {\n console.log(ans.length);\n console.log(ans.join(' '));\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "757e32f3765a2d7c3bb28945812d9dab", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n const arr = d.split(' ').map(Number);\n let a = arr[0];\n let b = 0;\n let mid = Math.floor(a / 2);\n const ans = [1];\n\n for (let i = 1; i < arr.length; i++) {\n if (arr[i] > mid) {\n b += arr[i];\n }\n else {\n a += arr[i];\n ans.push(i + 1);\n }\n }\n\n if (a <= b) {\n console.log(0);\n }\n else {\n console.log(ans.join(' '));\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1652f0f4f8aec05bd0b9ef24a8d2190a", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function readArr()\n{\n return readline().split(' ').map(function(x){return +x;})\n}\n\nfunction readArr1()\n{\n return readline().split(' ')\n}\n\nn=+readline()\nc=new Array(n)\nfor (i=0;i1)\n for (j=0;j2)\n for (k=0;k1)\n {\n ans=res[i]\n break\n }\n}\nprint(ans)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4973a9492c2347c03f9b9b39f7b18809", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function readArr()\n{\n return readline().split(' ').map(function(x){return +x;})\n}\n\nfunction readArr1()\n{\n return readline().split(' ')\n}\n\nn=+readline()\nc=new Array(n)\nfor (i=0;i1)\n for (j=0;j2)\n for (k=0;k1)\n {\n ans=res[i]\n break\n }\n}\nprint(ans)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d8b72cc094f52553145a5b23826bb68a", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function readArr()\n{\n return readline().split(' ').map(function(x){return +x;})\n}\n\nfunction readArr1()\n{\n return readline().split(' ')\n}\n\nn=+readline()\nc=new Array(n)\nfor (i=0;i1)\n for (j=0;j2)\n for (k=0;k1)\n {\n ans=res[i]\n break\n }\n if (!i)\n {\n if (res[i]>1)\n {\n ans=0\n break\n }\n }\n}\nprint(ans)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "033dcaf7d8d844485a8c507d0f08e41f", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var triangles = readline().split(' '),\n a = parseInt(triangles[0]),\n b = parseInt(triangles[1]),\n curr = [a, a, b],\n step = 1,\n i = 0,\n j = 0;\n\nwhile (curr[0] !== b && curr[1] !== b) {\n i = Math.abs(1 - i);\n j = Math.abs(1 - i);\n curr[i] = Math.abs(curr[j] - b) + 1;\n while (curr[0] + curr[1] <= b || Math.abs(curr[0] - curr[1]) >= b) {\n curr[i]++;\n }\n step++;\n}\n\nprint(step);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b94612126fee55b6d257d5be684219cf", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var triangles = readline().split(' '),\n\ta = parseInt(triangles[0]),\n\tb = parseInt(triangles[1]),\n\tbottomUp = [b, b, b],\n\tstep = 0,\n\ti = 0,\n\tj = 0,\n\tk = 0;\n\t\nwhile(bottomUp[0] < a || bottomUp[1] < a || bottomUp[2] < a) {\n\tfor (i = 0; i < 3; i++) {\n\t\tj = (i + 1) % 3;\n\t\tk = (i + 2) % 3;\n\t\tbottomUp[i] = Math.min(a, bottomUp[j] + bottomUp[k] - 1);\n\t\tstep++;\n\t\tif (Math.abs(a - bottomUp[j]) < bottomUp[k] && bottomUp[k] < a + bottomUp[j]) {\n\t\t\tbottomUp[i] = a;\n\t\t\tif (bottomUp[j] < a) {\n\t\t\t\tbottomUp[j] = a;\n\t\t\t\tstep++;\n\t\t\t}\n\t\t\tif (bottomUp[k] < a) {\n\t\t\t\tbottomUp[k] = a;\n\t\t\t\tstep++;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\nprint(step);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "007b859714458d62ad1858a742864b01", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "let i = ''\n\nprocess.stdin.on('data',c => {\n i += c\n})\n\nprocess.stdin.on('end', () => {\n const { EOL } = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n\n let a = parseInt(lines[0].split(\" \")[0])\n let ta = parseInt(lines[0].split(\" \")[1])\n \n let b = parseInt(lines[1].split(\" \")[0])\n let tb = parseInt(lines[1].split(\" \")[1])\n\n let startingHour = parseInt(lines[2].split(\":\")[0])\n let startingMinute = parseInt(lines[2].split(\":\")[1])\n let startingTime = (startingHour * 60) + startingMinute\n\n let startOfShift = 5 * 60\n let endOfShift = 23 * 60 + 59\n\n let count = 0\n\n for (i = startOfShift; i <= endOfShift; i = i+b) {\n if ( i < startingTime + ta && i + tb > startingTime ) {\n count ++\n }\n }\n\n console.log(count)\n })", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9327606a7d8f4c834538698edd59209f", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "function getInput() {\n var line = readline();\n var lines = [line];\n while (line = readline()) {\n lines.push(line);\n }\n return lines;\n}\n\nfunction main() {\n var lines = getInput().map(item => item.split(' '));\n var durationA = Number(lines[0][1]);\n var durationB = Number(lines[1][1]);\n var repeatB = Number(lines[1][0]);\n\n // first bus run at 5:00.\n var firstBusTime = 5 * 60;\n // start time in minutes.\n var startTime = lines[2][0].split(':').map(Number);\n // after 00\n if (startTime[0] < 5) {\n startTime[0] *= 24;\n }\n startTime = startTime[0] * 60 + startTime[1];\n\n var count = 0;\n var firstBBusTime = firstBusTime;\n while((firstBBusTime + durationB) <= startTime) {\n firstBBusTime += repeatB;\n }\n\n while(firstBBusTime < (startTime + durationA)) {\n firstBBusTime += repeatB;\n count++;\n }\n\n print(count);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aee64d2bbfab98f5b077848ca0ae7667", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "function getInput() {\n var line = readline();\n var lines = [line];\n while (line = readline()) {\n lines.push(line);\n }\n return lines;\n}\n\nfunction main() {\n var lines = getInput().map(item => item.split(' '));\n var durationA = Number(lines[0][1]);\n var durationB = Number(lines[1][1]);\n var repeatB = Number(lines[1][0]);\n\n // first bus run at 5:00.\n var firstBusTime = 5 * 60;\n // start time in minutes.\n var startTime = lines[2][0].split(':').map(Number);\n startTime = startTime[0] * 60 + startTime[1];\n\n var count = 0;\n var firstBBusTime = firstBusTime;\n while((firstBBusTime + durationB) < startTime) {\n firstBBusTime += repeatB;\n }\n\n while(firstBBusTime < (startTime + durationA)) {\n firstBBusTime += repeatB;\n count++;\n }\n\n print(count);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9fc5224577e7448c7b5424adb230ce09", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "str = readline().split(' ').map(Number);\n\nvar n = str[0], a = str[1], b = str[2], i = 0, j = 0, arr = [], count = 1, x = false;\n\nwhile (i !== n) {\n\ti++;\n\tarr.push(i);\n};\n\nwhile (x !== true) {\n\tif ((arr[j] == a && arr[j + 1] == b) || (arr[j] == b && arr[j + 1] == a)) {\n\t\tif (arr.length == 2) {\n\t\t\tprint('Final!');\n\t\t} else {\n\t\t\tprint(count);\n\t\t};\n\n\t\tx = true;\n\t\tbreak;\t\n\t} else if ((arr[j] == a && arr[j + 1] !== b) || (arr[j] == b && arr[j + 1] !== a)) {\n\t\tarr.splice(j + 1, 1);\n\t} else if ((arr[j + 1] == a && arr[j] !== b) || (arr[j + 1] == b && arr[j] !== a)) {\n\t\tarr.splice(j, 1);\n\t} else {\n\t\tarr.splice(j + 1, 1);\n\t};\n\n\tif (j == arr.length - 1) {\n\t\tj = 0;\n\t\tcount++;\n\t} else {\n\t\tj++;\n\t};\n};\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "31261283ab779ce413f33810fd71888d", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "a b 3 4\n\n1 a 3 4 5 b 7 8\na 3 b 7\na b\n\n1 2 3 4 b 6 a 8\n1 3 b a\n\n\n\nstr = readline().split(' ').map(Number);\n\nvar n = str[0], a = str[1], b = str[2], i = 0, j = 0, arr = [], count = 1, x = false;\n\nwhile (i !== n) {\n\ti++;\n\tarr.push(i);\n};\n\nwhile (x !== true) {\n\tif ((arr[j] == a && arr[j + 1] == b) || (arr[j] == b && arr[j + 1] == a)) {\n\t\tif (arr.length == 2) {\n\t\t\tprint('Final!');\n\t\t} else {\n\t\t\tprint(count);\n\t\t};\n\n\t\tx = true;\n\t\tbreak;\t\n\t} else if ((arr[j] == a && arr[j + 1] !== b) || (arr[j] == b && arr[j + 1] !== a)) {\n\t\tarr.splice(j + 1, 1);\n\t} else if ((arr[j + 1] == a && arr[j] !== b) || (arr[j + 1] == b && arr[j] !== a)) {\n\t\tarr.splice(j, 1);\n\t} else {\n\t\tarr.splice(j + 1, 1);\n\t};\n\n\tif (j == arr.length - 1) {\n\t\tj = 0;\n\t\tcount++;\n\t} else {\n\t\tj++;\n\t};\n};\n\n", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "885b75e47342b10e9bbed61efb21d84d", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function gcd(a, b) {\n return b == 0 ? a : gcd(b, a % b);\n}\nvar inp = readline().split(' ').map(Number);\nvar x = inp[0], y = inp[1], a = inp[2], b = inp[3];\nvar i = 1, g = gcd(Math.max(x, y), Math.min(x, y)), lcm = (x / g) * y;\nprint(Math.floor(b / lcm) - Math.floor((a - 1) / lcm));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9fe75430f0145d2aa066eba296f5b099", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function gcd(a, b){\n\treturn b===0 ? a : gcd(b, a%b);\n}\nprint(function(x, y, a, b){\n\tvar ans = x*y/gcd(x, y);\n\treturn Math.floor(b/ans)-Math.floor((a-1)/ans);\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d02f2e623fc5dbb8bc2a733193e4eb26", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\nvar x = input[0], y = input[1], a = input[2], b = input[3];\nvar i = 1, lcm = 0;\nwhile (true) {\n if (x * i % y == 0) {\n lcm = x * i;\n break;\n }\n i++;\n}\nvar cm = 0;\nfor (var i = a; i <= b; i++) {\n if (i % lcm === 0) {\n cm = i;\n break;\n }\n}\nprint(cm == 0 ? 0 : Math.floor((b - Math.max(cm, a)) / lcm + 1));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a38f2ba1f1836b88dc9c3fc301355676", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function gcd (a, b) { return a ? gcd(b%a, a) : b; }\nfunction lcm (a, b) { return a * b / gcd(a, b); }\n\n;(function () {\n\t\n\tvar x = readline().split(' ');\n\tvar y = +x[1];\n\tvar a = +x[2];\n\tvar b = +x[3];\n\tx = +x[0];\n\n\tvar l = lcm(x, y);\n\n\tprint( Math.floor( b / l) - Math.floor( (a - 1) / l) );\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "826c4c7ad48eda8b33c74f7ed434a7e2", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "function gcd(a, b){\n\treturn a%b===0 ? b : gcd(b, a%b);\n}\nprint(function(x, y, a, b){\n\tvar ans = x*y/gcd(x, y);\n\treturn Math.floor(b/ans)-Math.floor((a-1)/ans);\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3c3ef82bb46d858c864aea1bea9b84d1", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\nvar x = input[0], y = input[1], a = input[2], b = input[3];\nvar i = 1, lcm = 0;\nwhile (true) {\n if (x * i % y == 0) {\n lcm = x * i;\n break;\n }\n i++;\n}\nvar cm = lcm;\nfor (var i = a; i < b; i++) {\n if (i % lcm == 0) {\n cm = i;\n break;\n }\n}\nprint(Math.floor((b - Math.max(cm, a)) / lcm + 1));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "476b3cdd7deb1c3ed9a0e4fc9c1dcf59", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\nvar x = input[0], y = input[1], a = input[2], b = input[3];\nvar i = 1, lcm = 0;\nwhile (true) {\n if (x * i % y == 0) {\n lcm = x * i;\n break;\n }\n i++;\n}\nvar cm = 0;\nfor (var i = a; i < b; i++) {\n if (i % lcm == 0) {\n cm = i;\n break;\n }\n}\nprint(cm == 0 || (b - cm) / lcm + 1);\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f9576e7d7764dccbe22b115cb2031e9e", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\nvar x = input[0], y = input[1], a = input[2], b = input[3];\nvar i = 1, lcm = 0;\nwhile (true) {\n if (x * i % y == 0) {\n lcm = x * i;\n break;\n }\n i++;\n}\nvar cm = 0;\nfor (var i = a; i < b; i++) {\n if (i % lcm == 0) {\n cm = i;\n break;\n }\n}\nprint(cm == 0 || Math.floor((b - cm) / lcm + 1));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d01d0892b6160fa97850dc12510b2fa0", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ').map(Number);\nvar x = input[0], y = input[1], a = input[2], b = input[3];\nvar i = 1, lcm = 0;\nwhile (true) {\n if (x * i % y == 0) {\n lcm = x * i;\n break;\n }\n i++;\n}\nvar cm = 0;\nfor (var i = a; i < b; i++) {\n if (i % lcm == 0) {\n cm = i;\n break;\n }\n}\nprint(cm == 0 ? 0 : Math.floor((b - cm) / lcm + 1));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "46e2d2850f56c879124feb26cf6d7da8", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": ";(function () {\n\t\n\tvar x = readline().split(' ');\n\tvar y = +x[1];\n\tvar a = +x[2];\n\tvar b = +x[3];\n\tx = +x[0];\n\n\tvar t = 0;\n\tfor (var i = a; i <= b; i++) {\n\t\tif (i % x == 0 && i % y == 0) t++;\n\t}\n\n\tprint(t);\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c46b84938711b60920d06f611a9709a0", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var s=readline().split(' ')\nn=+s[0]\nk=+s[1]\n\nfunction phi(n)\n{\n var res=1;\n for (var i=2; i*i<=n; i++)\n {\n if (n%i==0)\n {\n var z1=1;\n while(n%i==0)\n {\n z1*=i;\n n/=i;\n }\n res*=(z1-z1/i);\n }\n }\n if (n>1)\n {\n res*=(n-1);\n }\n return res;\n}\n\nfunction f(n,k)\n{\n if (k==0){return n;}\n if (n==1){return 1;}\n if (k%2==0){return f (n,k-1);}\n return f(phi(n),k-1);\n}\n\n\nprint(f(n,k)%1000000007)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c8c0ff6c94f6cfd6cd176b52f3bf1612", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "JavaScript", "source_code": "var s=readline().split(' ')\nn=+s[0]\nk=+s[1]\n\nfunction phi(n)\n{\n var res=1;\n for (var i=2; i*i<=n; i++)\n {\n if (n%i==0)\n {\n var z1=1;\n while(n%i==0)\n {\n z1*=i;\n n/=i;\n }\n res*=(z1-z1/i);\n }\n }\n if (n>1)\n {\n res*=(n-1);\n }\n return res;\n}\n\nfunction f(n,k)\n{\n if (k==0){return n;}\n if (n==1){return 1;}\n if (k%2==0){return f (n,k-1);}\n return f(phi(n),k-1);\n}\n\n\nprint(f(n,k))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0b00af21e0f3cc057d0d0ce9ea7bc984", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "const fs = require(\"fs\");\n\nconst input = fs.readFileSync(0, \"utf8\").trim().split(\"\\n\");\n\nconst testCases = [];\n\nfunction parseInput() {\n // T = parseInt(input[0]);\n // let index = 0;\n\n // for (let i = 0; i < T; i++) {\n // index++;\n const [n, m] = input[index].split(\" \").map((item) => BigInt(item));\n const testCase = {\n n,\n m,\n };\n testCases.push(testCase);\n // }\n}\n\nfunction solution(testCase) {\n const { n, m } = testCase;\n\n const modulo = 998244353n;\n\n let result = 0n;\n let toRemove = m;\n const primes = [];\n let primeProd = 1n;\n\n result = ((m ** (n + 1n) - 1n) / (m - 1n) - m - 1n) % modulo;\n\n for (let l = 2n; l <= n; l++) {\n if (!primes.find((p) => l % p == 0)) {\n primes.push(l);\n primeProd *= l;\n }\n if (toRemove) {\n toRemove *= m / primeProd;\n }\n if (toRemove == 0) break;\n result = (result - toRemove) % modulo;\n }\n\n console.log(((result + modulo) % modulo).toString());\n}\n\nparseInput();\n\ntestCases.forEach(solution);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0e1ae387f857b648f364461263091143", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "const fs = require(\"fs\");\n\nconst input = fs.readFileSync(0, \"utf8\").trim().split(\"\\n\");\n\nconst testCases = [];\n\nfunction parseInput() {\n let index = 0;\n\n // T = parseInt(input[0]);\n\n // for (let i = 0; i < T; i++) {\n // index++;\n const [n, m] = input[index].split(\" \").map((item) => BigInt(item));\n const testCase = {\n n,\n m,\n };\n testCases.push(testCase);\n // }\n}\n\nfunction solution(testCase) {\n const { n, m } = testCase;\n\n const modulo = 998244353n;\n\n let result = 0n;\n let toRemove = m;\n const primes = [];\n let primeProd = 1n;\n\n let exp = m;\n for (let l = 2n; l <= n; l++) {\n exp = (exp * m) % modulo;\n result = (result + exp) % modulo;\n }\n\n for (let l = 2n; l <= n; l++) {\n if (!primes.find((p) => l % p == 0)) {\n primes.push(l);\n primeProd *= l;\n }\n if (toRemove) {\n toRemove *= m / primeProd;\n }\n if (toRemove == 0) break;\n result = (result - toRemove) % modulo;\n }\n\n console.log(((result + modulo) % modulo).toString());\n}\n\nparseInput();\n\ntestCases.forEach(solution);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a0f5005cba0cac4eab4bcf50ba599520", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nvar fs = require('fs');\r\n\r\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\r\n\r\nvar fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);\r\n\r\nfunction solve(read) {\r\n const [rn, rb, rns, re, rbs] = convertInput(read);\r\n const [n, m] = rns();\r\n let pre = 1,\r\n M = mod(m),\r\n res = 0,\r\n ans = M,\r\n ans1 = M;\r\n const p = getPrimes(n + 10);\r\n for (let i = 2; i <= n; i++) {\r\n if (pre <= m && p[i]) pre = pre * i;\r\n if (pre > m) {\r\n ans = 0;\r\n } else {\r\n ans = mul(ans, Math.floor(m / pre));\r\n }\r\n ans1 = mul(ans1, M);\r\n res = mod(res + ans1 - ans);\r\n }\r\n return res;\r\n}\r\nfunction getPrimes(n) {\r\n const nums = new Array(n + 1).fill(1);\r\n nums[0] = nums[1] = 0;\r\n const primes = [];\r\n for (let i = 2; i <= n; i++) {\r\n if (nums[i]) primes.push(i);\r\n for (let j = 0; primes[j] <= n / i; j++) {\r\n nums[primes[j] * i] = 0;\r\n if (i % primes[j] === 0) break;\r\n }\r\n }\r\n return nums;\r\n}\r\nconst MOD = 998244353;\r\nfunction mod(num) {\r\n if (num >= MOD) return num % MOD;else if (num < 0) return (num % MOD + MOD) % MOD;\r\n return num;\r\n}\r\nfunction mul(...args) {\r\n if (args.length === 0) throw new Error('\u53c2\u6570\u4e0d\u80fd\u4e3a\u7a7a');\r\n if (args.length === 1) return args[0];\r\n const [a, b] = args;\r\n if (args.length > 2) return mul(mul(a, b), ...args.slice(2));\r\n return (Math.floor(a / 65536) * b % MOD * 65536 + (a & 65535) * b) % MOD;\r\n}\r\nfunction convertInput(read) {\r\n const rn = () => Number(read());\r\n const rb = () => BigInt(read());\r\n const rns = () => read().split(/\\s+/).map(Number);\r\n const re = () => read().split(/\\s+/).map(s => Number(s) - 1);\r\n const rbs = () => read().split(/\\s+/).map(BigInt);\r\n return [rn, rb, rns, re, rbs];\r\n}\r\nfunction main(r) {\r\n try {\r\n let t = 1;\r\n let res = new Array(t);\r\n let limit = 0;\r\n for (let i = 0; i < t; i++) {\r\n var _solve;\r\n const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';\r\n if (t < limit) ; else {\r\n res[i] = s;\r\n }\r\n }\r\n if (t >= limit) {\r\n return res.join('\\n');\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nconst inputs = fs__default[\"default\"].readFileSync(0, 'utf-8').split(/\\r?\\n/);\r\nvoid function () {\r\n const read = ((i = 0) => () => inputs[i++])();\r\n const output = main(read);\r\n process.stdout.write(output);\r\n}();\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a7a0a6604ff8a20ba397632d11e13845", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "const fs = require(\"fs\");\n\nconst input = fs.readFileSync(0, \"utf8\").trim().split(\"\\n\");\n\nconst testCases = [];\n\nfunction parseInput() {\n let index = 0;\n\n const [n, m] = input[index].split(\" \").map((item) => BigInt(item));\n const testCase = {\n n,\n m,\n };\n\n testCases.push(testCase);\n}\n\nfunction solution(testCase) {\n const { n, m } = testCase;\n\n const modulo = 998244353n;\n\n let result = 0n;\n let toRemove = m;\n const primes = [];\n let primeProd = 1n;\n let exp = m;\n\n for (let l = 2n; l <= n; l++) {\n if (!primes.find((p) => l % p == 0)) {\n primes.push(l);\n primeProd *= l;\n }\n if (toRemove) {\n toRemove *= m / primeProd;\n }\n exp = exp * m;\n result = (result + exp - toRemove + modulo) % modulo;\n }\n\n console.log((result % modulo).toString());\n}\n\nparseInput();\n\ntestCases.forEach(solution);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b198c7dfd4e394423a5b6ff601bf3fbf", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "const fs = require(\"fs\");\n\nconst input = fs.readFileSync(0, \"utf8\").trim().split(\"\\n\");\n\nconst testCases = [];\n\nfunction parseInput() {\n // T = parseInt(input[0]);\n let index = 0;\n\n // for (let i = 0; i < T; i++) {\n // index++;\n const [n, m] = input[index].split(\" \").map((item) => BigInt(item));\n const testCase = {\n n,\n m,\n };\n testCases.push(testCase);\n // }\n}\n\nfunction solution(testCase) {\n const { n, m } = testCase;\n\n const modulo = 998244353n;\n\n let result = 0n;\n let toRemove = m;\n const primes = [];\n let primeProd = 1n;\n\n result = ((m ** (n + 1n) - 1n) / (m - 1n) - m - 1n) % modulo;\n\n for (let l = 2n; l <= n; l++) {\n if (!primes.find((p) => l % p == 0)) {\n primes.push(l);\n primeProd *= l;\n }\n if (toRemove) {\n toRemove *= m / primeProd;\n }\n if (toRemove == 0) break;\n result = (result - toRemove) % modulo;\n }\n\n console.log(((result + modulo) % modulo).toString());\n}\n\nparseInput();\n\ntestCases.forEach(solution);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "544889ab5fbd7e5f9d4f4434226e5fef", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "function cmp(a,b)\n{\n return a-b;\n}\n\nvar s=readline().split(' ')\nvar n=+s[0]\nvar k=+s[1]\nvar m=+s[2]\nvar t=readline().split(' ').map(function(v){return +v;})\nt.sort(cmp)\nvar sum=0;\nfor (var i=0;im){break;}\n for (var j=0;jres){res=kol;}\n}\nprint(res)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "663a1ade65b4dfe26f935e3aae7b3c70", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "const golorp = readline().match(/^\\?\\((.+)\\):-(.+)\\.$/);\nconst expression = golorp[1];\nconst conditions = golorp[2].split(\",\").map(condition => {\n const match = condition.match(/[<>]/);\n const index = match.index;\n const left = condition.substring(0, index);\n const right = condition.substring(index + 1);\n return match[0] === \">\" ? [right, left] : [left, right];\n});\nconst sequence = expression.match(/_+/g);\nconst variables = Array.from(new Set(sequence));\nconst nodes = new Map;\nconst values = new Map;\nfor (var variable of variables) {\n nodes.set(variable, [variable, new Set, new Set]);\n values.set(variable, -1);\n}\nfor (var condition of conditions) {\n var less = condition[0];\n var greater = condition[1];\n nodes.get(less)[1].add(greater);\n nodes.get(greater)[2].add(less);\n}\nconst seen = new Set;\nfor (var i = 10; i; i--)\n for (var from of variables) {\n if (seen.has(from)) continue;\n var fromNode = nodes.get(from);\n if (!fromNode[2].size) {\n seen.add(from);\n var newValue = values.get(from) + 1;\n values.set(from, newValue);\n for (var to of fromNode[1]) {\n if (newValue > values.get(to)) values.set(to, newValue);\n nodes.get(to)[2].delete(from);\n }\n }\n }\nvar found = true;\nfor (var variable of variables)\n if (!seen.has(variable) || values.get(variable) >= 10) {\n found = false;\n break;\n }\nprint(found ? sequence.map(variable => values.get(variable)).join(\"\") : \"false\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7cecf1ddd91611effbd1a63e0c10ad7f", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "JavaScript", "source_code": "var text = readline().split(':-'), i;\nvar left = text[0].split(/[^_]/).filter(function(x){return x.length != 0;});\nvar right = text[1].split(/[^_<>]/).filter(function(x){return x.length != 0;});\nvar top = 0, nxt = new Array(), to = new Array(), head = new Array(), dgree = new Array(), as = new Array();\nfor(i = 0; i < 1024; ++i) nxt[i] = to[i] = head[i] = dgree[i] = as[i] = 0;\nfunction addedge(te, sym)\n{\n\tvar val = te.split(sym);\n\tif(sym === '>') val = [val[1].length, val[0].length];\n\telse val = [val[0].length, val[1].length];\n\ttop++;\n\tnxt[top] = head[val[0]];\n\tto[top] = val[1];\n\thead[val[0]] = top;\n\t++dgree[val[1]];\n}\nfunction solve(okback, nsback)\n{\n\tvar que = new Array(), lead = 1, tail = 0, now;\n\tfor(i = 1; i < 1024; ++i) if(!dgree[i]) que[++tail] = i;\n\tfor(; lead <= tail; ++lead)\n\t{\n\t\tnow = que[lead];\n\t\tfor(i = head[now]; i; i = nxt[i])\n\t\t{\n\t\t\tas[to[i]] = Math.max(as[to[i]], as[now] + 1);\n\t\t\tif(!--dgree[to[i]]) que[++tail] = to[i];\n\t\t}\n\t}\n\tif(dgree.reduce(function(l, r){return l || (r != 0);}) || as.reduce(function(l, r){return l || (r > 9);}))\tnsback();\n\telse okback();\n}\nfor(i = 0; i < right.length; ++i)\n\tif(right[i].indexOf('>') != -1) addedge(right[i], '>');\n\telse addedge(right[i], '<');\nvar ans = \"\";\nsolve(function(){for(i = 0; i < left.length; ++i) ans = ans + as[left[i].length];},function(){ans = 'false'});\nwrite(ans, '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d7920d4ade64ee11b0ddb727a8070a07", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "JavaScript", "source_code": "const golorp = readline().match(/^\\?\\((.+)\\):-(.+)\\.$/);\nconst expression = golorp[1];\nconst conditions = golorp[2].split(\",\");\nconst sequence = expression.match(/_+/g);\nconst variables = Array.from(new Set(sequence));\nconst variableCount = variables.length;\nconst values = new Map;\nconst expressionFunction = new Function(...variables, `return ${expression};`);\nconst conditionToString = condition => \" && \" + condition[2];\nconst conditionsFunctions = variables.reduceRight((previous, current, index) => {\n previous[index] = previous[index + 1].filter(condition => condition[0] != current && condition[1] != current);\n return previous;\n}, (() => {\n const result = new Array(variableCount + 1);\n result[variableCount] = conditions.map(condition => {\n const index = condition.match(/[<>]/).index;\n return [condition.substring(0, index), condition.substring(index + 1), condition];\n });\n return result;\n})()).map(conditions => new Function(...variables, `return true${conditions.map(conditionToString).join(\"\")};`));\n\nfunction toValues(variables) {\n return variables.map(variable => values.get(variable));\n}\n\n(() => {\n try {\n (function search(depth) {\n const args = toValues(variables);\n if (!conditionsFunctions[depth](...args)) return;\n if (depth == variableCount) {\n if (Number.isFinite(expressionFunction(...args))) throw undefined;\n return;\n }\n const variable = variables[depth++];\n for (var i = 0; i <= 9; i++) {\n values.set(variable, i);\n search(depth);\n }\n })(0);\n } catch (e) {\n print(toValues(sequence).join(\"\"));\n return;\n }\n print(\"false\");\n})();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f0f9ce7e4fa6da1773f68e2e2e8f5a43", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "JavaScript", "source_code": "function main() {\n\n var nm = readline().split(' ').map(Number);\n var n = nm[0];\n var m = nm[1];\n var horizontal = readline();\n var vertical = readline();\n\n if (horizontal[0] === \"<\" && horizontal[n - 1] === \">\" && vertical[0] === \"v\" && vertical[m - 1] === \"^\") {\n print(\"YES\");\n } else if (horizontal[0] === \">\" && horizontal[n - 1] === \"<\" && vertical[m - 1] === \"v\" && vertical[0] === \"^\") {\n print(\"YES\");\n } else {\n print(\"NO\");\n }\n\n\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ed810805a8506ad7041bc63b653632b6", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n\n this.dfs = function( x , y ) {\n var nx , ny , i , j;\n this.vis[ x ][ y ] = 1;\n i = this.arr[ x ];\n j = this.brr[ y ];\n nx = x + this.dx[ i ];\n ny = y + this.dy[ i ];\n if( nx >= 0 && nx < this.n && ny >= 0 && ny < this.m ) {\n if( this.vis[ nx ][ ny ] == 0 ) {\n this.dfs( nx , ny );\n }\n }\n nx = x + this.dx[ j ];\n ny = y + this.dy[ j ];\n if( nx >= 0 && nx < this.n && ny >= 0 && ny < this.m ) {\n if( this.vis[ nx ][ ny ] == 0 ) {\n this.dfs( nx , ny );\n }\n }\n };\n\n this.solveCase = function() {\n var res , i , j , k , l;\n res = \"YES\";\n for( i = 0 ; i < this.n ; i++ ) {\n if( this.s.charAt( i ) == '<' ) {\n this.arr[ i ] = 1;\n }\n else {\n this.arr[ i ] = 0;\n }\n }\n for( i = 0 ; i < this.m ; i++ ) {\n if( this.t.charAt( i ) == '^' ) {\n this.brr[ i ] = 3;\n }\n else {\n this.brr[ i ] = 2;\n }\n }\n for( i = 0 ; i < this.n ; i++ ) {\n for( j = 0 ; j < this.m ; j++ ) {\n this.vis = new Array();\n for( k = 0 ; k < this.n ; k++ ) {\n this.vis.push( new Array() );\n for( l = 0 ; l < this.m ; l++ ) {\n this.vis[ k ].push( 0 );\n }\n }\n this.dfs( i , j );\n for( k = 0 ; k < this.n ; k++ ) {\n for( l = 0 ; l < this.m ; l++ ) {\n if( this.vis[ k ][ l ] == 0 ) {\n res = \"NO\";\n }\n }\n }\n }\n }\n print( res );\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.n = irObj.nextInt();\n this.m = irObj.nextInt();\n this.s = irObj.nextString();\n this.t = irObj.nextString();\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.brr = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adj_list.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n //this.clearArraysPerCase() ;\n };\n\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adj_list = new Array();\n this.dx = new Array( 0 , 0 , +1 , -1 );\n this.dy = new Array( +1 , -1 , 0 , 0 );\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adj_list.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 );\n this.done[ i ].push( 0 );\n }\n }\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.memsetArray1D = function( arrParam , val ) {\n var i;\n if( arrParam == null ) {\n throw new Error( \"No array supplied in the parameter!\" );\n }\n if( val == null ) {\n throw new Error( \"No value for memset has been supplied in the parameter!\" );\n }\n arrParam = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n arrParam.push( val );\n }\n return arrParam;\n };\n\n this.getStringLength = function( stringData ) {\n var len , lengthType;\n len = stringData.length;\n lengthType = typeof len;\n if( lengthType == \"function\" ) {\n len = stringData.length();\n }\n else {\n len = stringData.length;\n }\n return len;\n };\n\n this.init();\n}\n\nfunction InputReader() {\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n\n this.readAllLinesFromRhinoStdin = function() {\n importPackage( java.io );\n importPackage( java.lang );\n var singleLine , reader;\n reader = new BufferedReader( new InputStreamReader( System[ \"in\" ] ) );\n this.allLines = [];\n while( true ) {\n singleLine = reader.readLine();\n if( singleLine != null ) {\n this.allLines.push( singleLine );\n }\n else {\n break;\n }\n }\n };\n\n this.readAllLinesFromNodeStdin = function() {\n var fsObj , size , rawData;\n process.stdin.setEncoding( 'ascii' );\n fsObj = require( 'fs' );\n size = fsObj.fstatSync( process.stdin.fd ).size;\n rawData = fsObj.readSync( process.stdin.fd , size )[ 0 ];\n this.parseRawData( rawData );\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx , lengthType;\n len = this.allLines[ this.currrentLineNumber ].length;\n lengthType = typeof len;\n if( lengthType == \"function\" ) {\n len = this.allLines[ this.currrentLineNumber ].length();\n }\n if( flag == 0 ) {\n res = \"\";\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != '\\t'.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = -1;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) || this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == '\\t'.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );\n }\n if( endIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n else {\n this.currrentCharacterIndex = endIdx;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n if( currentDirectory.charAt( 1 ) != \":\" ) {\n //not local machine/windows\n outputFilePath = outputFileName;\n }\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCode = function() {\n var testCases , i , hasMoreTestCases , isLocalMachine , localContext;\n isLocalMachine = false;\n try {\n if( __dirname != null && __dirname.charAt( 1 ) == ':' ) {\n //only on windows\n isLocalMachine = true;\n }\n }\n catch( ex ) {\n isLocalMachine = false;\n }\n if( isLocalMachine == true ) {\n //local machine runs on node and relies on file i/o\n print = console.log;\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n }\n else {\n //server machine\n try {\n var rlObj = readline;\n //server runs on javasctipt v8 distribution and has readline method on global context\n this.irObj.readAllLines();\n }\n catch( ex ) {\n try {\n var pObj = process;\n //server runs on node\n print = console.log;\n this.irObj.readAllLinesFromNodeStdin();\n }\n catch( ex ) {\n try {\n var ipObj = importPackage;\n //server runs on rhino\n this.irObj.readAllLinesFromRhinoStdin();\n }\n catch( ex ) {\n throw new Error( \"Unknown javasctipt distribution!\" );\n }\n }\n }\n }\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n //only works for local machine(tested)\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.runCode();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cd8cf2b1adc1f5e07f3ed0761fa71e86", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar current = a;\n\nwhile(!dat[current] && current<=m)\n{\n dat[current] = true;\n current = current + a%m;\n}\n\nprint((dat[0] || dat[m]) ? \"Yes\" : \"No\");", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c3ee875eefd64d02f8a3d9209a349e5a", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\n//var line = \"3 6\".split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar current = a;\nvar firstIt = true;\n\nwhile(!dat[current] && (current<=m || firstIt))\n{\n dat[current] = true;\n current = current + current%m;\n firstIt = false;\n}\n\nprint((dat[0] || dat[m]) ? \"Yes\" : \"No\");\n//console.log((dat[0] || dat[m]) ? \"Yes\" : \"No\");", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "645cd94efb138475a9c400381210b1aa", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\n//var line = \"3 6\".split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar current = a;\n\nwhile(!dat[current] && current<=m*3)\n{\n dat[current] = true;\n current = current + current%m;\n}\n\nprint((dat[0] || dat[m] || a%m == 0) ? \"Yes\" : \"No\");\n//console.log((dat[0] || dat[m]) ? \"Yes\" : \"No\");", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8d7ec911310603fd3a0c8d6c768ab11a", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar result = \"No\";\n\na = a%m;\n\nwhile(!dat[a])\n{\n if (a)\n { \n a = a * 2;\n a = a % m;\n dat[a] = true;\n }\n else\n {\n result = \"Yes\";\n }\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9cf854c59b9be636e744eeb637009b1c", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\n//var line = \"3 6\".split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar current = a;\n\nwhile(!dat[current] && current<=m)\n{\n dat[current] = true;\n current = current + current%m;\n}\n\nprint((dat[0] || dat[m] || a%m == 0) ? \"Yes\" : \"No\");\n//console.log((dat[0] || dat[m]) ? \"Yes\" : \"No\");", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "13294d1182a03bf2796effb5f2f64ada", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\nvar a = parseInt(line[0]);\nvar m = parseInt(line[1]);\nvar dat = {};\n\nvar result = \"No\";\n\na = a%m;\n\nwhile(!dat[a])\n{\n if (a)\n {\n dat[a] = true;\n a = a * 2;\n a = a % m;\n }\n else\n {\n result = \"Yes\";\n }\n}\n\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "10f17b1f6c6e5d3e2e30a12e38171af7", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var line = readline();\nvar rb = 0, rs = 0, rc = 0;\nvar i;\nfor (i = 0; i < line.length; i++) {\n switch (line[i]) {\n case 'B': rb++; break;\n case 'S': rs++; break;\n case 'C': rc++; break;\n }\n}\n\nline = readline().split(' ');\nvar nb = +line[0];\nvar ns = +line[1];\nvar nc = +line[2];\n\nline = readline().split(' ');\nvar pb = +line[0];\nvar ps = +line[1];\nvar pc = +line[2];\n\nvar pr = pb*rb + ps*rs + pc*rc;\n\nline = readline();\nvar r = +line;\n\nvar rMakingN = function (n) {\n if (n < 1) {\n return 0;\n }\n \n var costb = (n*rb-nb)*pb;\n if (costb < 0) {\n costb = 0;\n }\n var costs = (n*rs-ns)*ps;\n if (costs < 0) {\n costs = 0;\n }\n var costc = (n*rc-nc)*pc;\n if (costc < 0) {\n costc = 0;\n }\n \n return costb + costs + costc;\n};\n\nvar min = 0;\nvar max = 2e12;\nvar mid = 0;\nvar cost = 0;\n\nwhile (min < max) {\n mid = Math.ceil((min+max)/2);\n cost = rMakingN(mid);\n if (cost > r) {\n if (max === mid) mid--;\n max = mid;\n } else if (cost < r) {\n min = mid;\n } else {\n break;\n }\n}\n\nwrite(mid);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1ee477a1ad9f87b9cac5d4b3b8169492", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var line = readline();\nvar rb = 0, rs = 0, rc = 0;\nvar i;\nfor (i = 0; i < line.length; i++) {\n switch (line[i]) {\n case 'B': rb++; break;\n case 'S': rs++; break;\n case 'C': rc++; break;\n }\n}\n\nline = readline().split(' ');\nvar nb = +line[0];\nvar ns = +line[1];\nvar nc = +line[2];\n\nline = readline().split(' ');\nvar pb = +line[0];\nvar ps = +line[1];\nvar pc = +line[2];\n\nvar pr = pb*rb + ps*rs + pc*rc;\n\nline = readline();\nvar r = +line;\n\nvar total = 0;\nvar subtotal = 0;\n\nvar maxb = 0;\nvar maxs = 0;\nvar maxc = 0;\nvar max = 0;\n\nvar rMakingN = function (n) {\n if (n < 1) {\n return 0;\n }\n \n var costb = (n*rb-nb)*pb;\n if (costb < 0) {\n costb = 0;\n }\n var costs = (n*rs-ns)*ps;\n if (costs < 0) {\n costs = 0;\n }\n var costc = (n*rc-nc)*pc;\n if (costc < 0) {\n costc = 0;\n }\n \n return costb + costs + costc;\n}\n\nmaxb = Math.floor(nb/rb);\nmaxs = Math.floor(ns/rs);\nmaxc = Math.floor(nc/rc);\n\nmax = Math.min(maxb, maxs, maxc);\n\ntotal += max;\nnb -= rb * max;\nns -= rs * max;\nnc -= rc * max;\n\nwhile (true) {\n if (nb === 0 && ns === 0 && nc === 0) {\n total += Math.floor(r/pr);\n r %= pr;\n break;\n }\n \n if (nb < rb) {\n r -= pb*(rb-nb);\n nb = rb;\n }\n if (ns < rs) {\n r -= ps*(rs-ns);\n ns = rs;\n }\n if (nc < rc) {\n r -= pc*(rc-nc);\n nc = rc;\n }\n if (r < 0) {\n break;\n }\n total++;\n nb -= rb;\n ns -= rs;\n nc -= rc;\n \n maxb = Math.floor(nb/rb);\n maxs = Math.floor(ns/rs);\n maxc = Math.floor(nc/rc);\n \n max = 0;\n if (maxb > 0) {\n max = maxb;\n }\n if (maxs > 0 && maxs < max) {\n max = maxs;\n }\n if (maxc > 0 && maxc < max) {\n max = maxc;\n }\n \n var rCostMax = rMakingN(max);\n if (rCostMax <= r) {\n total += max;\n nb -= rb * max;\n ns -= rs * max;\n nc -= rc * max;\n }\n}\n\nwrite(total);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8dedcdbc572cbbd8f381c49d603b4cd2", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var line = readline();\nvar rb = 0, rs = 0, rc = 0;\nvar i;\nfor (i = 0; i < line.length; i++) {\n switch (line[i]) {\n case 'B': rb++; break;\n case 'S': rs++; break;\n case 'C': rc++; break;\n }\n}\n\nline = readline().split(' ');\nvar nb = +line[0];\nvar ns = +line[1];\nvar nc = +line[2];\n\nline = readline().split(' ');\nvar pb = +line[0];\nvar ps = +line[1];\nvar pc = +line[2];\n\nvar pr = pb*rb + ps*rs + pc*rc;\n\nline = readline();\nvar r = +line;\n\nvar total = 0;\nvar subtotal = 0;\n\nvar maxb = 0;\nvar maxs = 0;\nvar maxc = 0;\nvar max = 0;\n\nvar rMakingN = function (n) {\n if (n < 1) {\n return 0;\n }\n \n var costb = (n*rb-nb)*pb;\n if (costb < 0) {\n costb = 0;\n }\n var costs = (n*rs-ns)*ps;\n if (costs < 0) {\n costs = 0;\n }\n var costc = (n*rc-nc)*pc;\n if (costc < 0) {\n costc = 0;\n }\n \n return costb + costs + costc;\n}\n\nmaxb = Math.floor(nb/rb);\nmaxs = Math.floor(ns/rs);\nmaxc = Math.floor(nc/rc);\n\nmax = Math.min(maxb, maxs, maxc);\n\ntotal += max;\nnb -= rb * max;\nns -= rs * max;\nnc -= rc * max;\n\nwhile (true) {\n if (nb === 0 && ns === 0 && nc === 0) {\n total += Math.floor(r/pr);\n r %= pr;\n break;\n }\n \n if (nb < rb) {\n r -= pb*(rb-nb);\n nb = rb;\n }\n if (ns < rs) {\n r -= ps*(rs-ns);\n ns = rs;\n }\n if (nc < rc) {\n r -= pc*(rc-nc);\n nc = rc;\n }\n if (r < 0) {\n break;\n }\n total++;\n nb -= rb;\n ns -= rs;\n nc -= rc;\n \n maxb = nb/rb | 0;\n maxs = ns/rs | 0;\n maxc = nc/rc | 0;\n \n max = 0;\n if (maxb > 0) {\n max = maxb;\n }\n if (maxs > 0 && maxs < max) {\n max = maxs;\n }\n if (maxc > 0 && maxc < max) {\n max = maxc;\n }\n \n if (max === 0) {\n total += Math.floor(r/pr);\n r %= pr;\n }\n \n var rCostMax = rMakingN(max);\n if (rCostMax <= r) {\n total += max;\n nb -= rb * max;\n ns -= rs * max;\n nc -= rc * max;\n } else {\n \n }\n}\n\nwrite(total);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b94e548fd8eca6bcc2b780df7c2cdc12", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "let table = [0];\nlet j = \"\";\nfor(let i=0;i<55;i++)\n{\n j+= \"1\"\n table[i+1] = BigInt(j);\n} \n\nlet dp = {};\n\n\nlet i = ''\nprocess.stdin.on('data', c => i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL)\n console.log(calc(BigInt(lines[0])));\n});\n\nfunction abs(x)\n{\n return (x>=0)?x:0n-x;\n}\n\nfunction max(v1,v2)\n{\n return (v1>v2)?v1:v2;\n}\n\nfunction min(v1,v2)\n{\n return (v1>v2)?v2:v1;\n}\n\n\nfunction calc(x)\n{\n if (x==0) return 0;\n \n let str = x.toString();\n if (dp[str]) return dp[str]; \n let n = str.length;\n \n let v1 = abs(table[n+1]-x);\n let v2 = abs(table[n]-x);\n \n let ret;\n \n let diff = abs(v1-v2);\n let mx = max(v1,v2);\n let ratio = Number(diff * 100n / mx) / 100;\n if (ratio<=0.1)\n {\n ret = min(n+1+calc(v1),n+calc(v2));\n }\n else\n {\n if (v1 i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n run(BigInt(lines[0]),lines[0].length); \n});\n\nfunction abs(x)\n{\n return (x>=0)?x:0n-x;\n}\n\nfunction run(x,n)\n{\n let table = [0];\n let j = \"\";\n for(let i=0;i0)\n {\n n = x.toString().length;\n let s = -1n;\n let c = 0;\n for(let i=1;i<=n+1;i++)\n {\n let v = abs(table[i]-x);\n if ((s==-1n) || (v i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n run(parseInt(lines[0]),lines[0].length); \n});\n\nfunction run(x,n)\n{\n let table = [0];\n let j = \"\";\n for(let i=0;i0)\n {\n n = x.toString().length;\n let v1 = Math.abs(table[n+1]-x);\n let v2 = Math.abs(table[n]-x);\n if (v1 {\n let r = 1;\n for (let i=0; i {\n let r = 1;\n for (let i=0; i {\n let r = 1;\n for (let i=0; i b === 0 ? 1 : b === 1 ? a : (Math.pow(pow(a, b / 2 | 0), 2) % 1000000007) * (Math.pow(a, b % 2) % 1000000007);\n\nconst nm = readline().split(' ').map(Number);\n\nwrite(pow((pow(2, nm[1]) - 1), nm[0]));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32caf9c93a08b2c5489fca7f3b410e4c", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nconst rem = (s, m) => {\n const n = s.length;\n if (n <= 15) return `${+s % m}`;\n return `${(+rem(s.slice(0, n-15), m) * (1000000000000000 % m) + +s.slice(-15) % m) % m}`;\n}\n\nconst MOD = 1000000007;\n\nconst mult = (a, b) => {\n const la = a.length;\n const lb = b.length;\n if (la < 6 && lb < 6) return +a * +b;\n return +rem(`${mult(a.slice(0, -5), b.slice(0, -5))}0000000000`, MOD)\n + +rem(`${mult(a.slice(0, -5), b.slice(-5))}00000`, MOD)\n + +rem(`${mult(a.slice(-5), b.slice(0, -5))}00000`, MOD)\n +a.slice(-5) * +b.slice(-5);\n}\n\n\nconst pow = (a, b) => {\n if (b === 0) return 1;\n if (b === 1) return a;\n let r = `${pow(a, b >> 1)}`;\n r = mult(r, r);\n if (b % 2) r = mult(`${r}`, `${a}`);\n return +r % MOD;\n}\n\nconst nm = readline().split(' ').map(Number);\n\nwrite(pow(pow(2, nm[1]) - 1, nm[0]));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f90542fce48b9ce9f143b59cbb5fd00d", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n \nconst pow = (a, b) => {\n let r = 1;\n for (let i=0; ig)\n{\n var t =r;\n\tr = g;\n\tg = t;\n}\nvar x = r+g;\nvar n;\nvar MOD = 1000000007;\n\nfor(var i=1;i<10000;i++)\n{\n if(i*(i+1)/2>x)\n\t{\n\t n = i-1;\n\t break;\n\t}\n}\n\nvar dp = new Array();\nfor(var i=0;i<=n;i++)\n{\n dp[i] = new Array();\n}\ndp[0][0] = 1;\nfor(var i=1;i<=r;i++)\n{\n dp[0][i]=0;\n}\nvar y =0;\nvar k2 =0;\nvar k1 =1;\nfor(var i=1;i<=n;i++)\n{\n t = k2;\n\tk2 = k1;\n\tk1 = t;\n for(var j=0;j<=r;j++)\n\t{\n\t dp[k2][j] = 0;\n\t\tif(y-j>=0&&y-j<=g)\n\t\t{\n\t dp[k2][j] = dp[k1][j];\n\t }\n if(j>=i)\n\t\t{\n\t\t dp[k2][j] = (dp[k2][j] + dp[k1][j-i])%MOD;\n\t\t}\n//\t\tprint(\"dp[\"+i+\"][\"+j+\"]: \"+dp[i][j]);\n\t}\n\ty+=i;\n}\nvar ans =0;\nx = (n+1)*n/2;\nfor(var i=0;i<=r;i++)\n{\n if((x-i)<=g)\n\t{\n ans = (ans+dp[k2][i])%MOD;\n\t}\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "86fbca1e6e50865ad1aa303d1c0d36e4", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(' ');\nvar r = parseInt(nums[0]);\nvar g = parseInt(nums[1]);\nif(r>g)\n{\n var t =r;\n\tr = g;\n\tg = t;\n}\nvar x = r+g;\nvar n;\nvar MOD = 1000000007;\n\nfor(var i=1;i<10000;i++)\n{\n if(i*(i+1)/2>x)\n\t{\n\t n = i-1;\n\t break;\n\t}\n}\n\nvar dp = new Array();\n\ndp[0] = 1;\nfor(var i=1;i<=r;i++)\n{\n dp[i]=0;\n}\nvar y =0;\nvar k2 =0;\nvar k1 =1;\nfor(var i=1;i<=n;i++)\n{\n// t = k2;\n//\tk2 = k1;\n//\tk1 = t;\n\ty+=i;\n\n for(var j=r;j>=i;j--)\n\t{\n\t\tif(y-j>g)\n\t\t{\n//\t\t dp[k2][j] = dp[k1][j-i];\n dp[j] = dp[j-i];\n\t\t}\n\t\telse\n\t\t{\n//\t\t dp[k2][j] = (dp[k1][j-i]+dp[k1][j])%MOD;\n dp[j] = (dp[j]+dp[j-i])%MOD;\n\t }\n\t}\n\tfor(var j=i-1;j>=0;j--)\n\t{\n\t if(y-j>g)\n\t\t{\n//\t\t dp[k2][j] = 0;\n dp[j]=0;\n\t\t}\n//\t\telse\n//\t\t{\n//\t\t dp[k2][j] = dp[k1][j];\n//\t\t}\n\t}\n}\nvar ans =0;\nx = (n+1)*n/2;\nfor(var i=0;i<=r;i++)\n{\n if((x-i)<=g)\n\t{\n ans = (ans+dp[i])%MOD;\n\t}\n}\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d4cbefd154b46798fd2d4f59f1bddec1", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(\" \").map(function(x) { return parseInt(x); });\nvar n = nums[0], m = nums[1];\nvar s = readline().split(\" \").map(function(x) { return parseInt(x); });\n\n//var sum = 0;\n//for (var i=0; idown) {\n//write(\" down = \", down, \"\\n\");\n//write(\" up = \", up, \"\\n\\n\");\n\tvar mid = Math.floor((up+down)/2);\n\t//var res = sum;\n\tvar dvv = Math.floor(n/mid);\n\tvar rem = n % mid;\n\n\tvar res = 0;\n\tvar fr = 0;\n\tif (rem > 0) {\n\t\tfor (var i=0; i 0)\n\t//\tres -= rem * dvv;\n\t\n\tif (res >= m) up = mid;\n\telse down = mid + 1;\n}\nif (down > Math.min(n,m)) write(\"-1\");\nelse write(down);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aa26725e125881a4ef83b399feb749f6", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var str1 =readline().split(\" \");\nvar answer = [0,0,0];\nvar x;\nvar y;\nvar z;\nx = Math.abs(str1[0]-str1[2]);\ny = Math.abs(str1[1]-str1[3]);\nif (x==0&&y==0) answer[0]=0; \n\telse if (x==0||y==0) answer[0]=1;\n\t\t\telse answer[0]=2;\nif (x==0&&y==0) answer[1]=0;\n\telse{ z = Math.abs(x-y);\n\t\tif (z==1||z==3||z==5||z==7) answer[1]=0;\n\t\t\telse if (x==y) answer[1]=1;\n\t\t\t\t\telse answer[1]=2;}\nif (x==0&&y==0) answer[2]=0; \nelse if (x==0||y==0) {z = Math.abs(x-y);answer[2]=z;}\n\t\telse {z = Math.max(x,y); answer[2]=z;}\nprint(answer);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d35a0fb50884d0d6e90ec8a9ceff271c", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var str1 =readline().split(\" \");\nvar answer = [0,0,0];\nvar x;\nvar y;\nvar z;\nvar answer1 = \"\";\nx = Math.abs(str1[0]-str1[2]);\ny = Math.abs(str1[1]-str1[3]);\nif (x==0&&y==0) answer[0]=0; \n\telse if (x==0||y==0) answer[0]=1;\n\t\t\telse answer[0]=2;\nif (x==0&&y==0) answer[1]=0;\n\telse{ z = Math.abs(x-y);\n\t\tif (z==1||z==3||z==5||z==7) answer[1]=0;\n\t\t\telse if (x==y) answer[1]=1;\n\t\t\t\t\telse answer[1]=2;}\nif (x==0&&y==0) answer[2]=0; \nelse if (x==0||y==0) {z = Math.abs(x-y);answer[2]=z;}\n\t\telse {z = Math.max(x,y); answer[2]=z;}\nfor (i=0;i<3;i++)\n\tanswer1 = answer1 +\" \" + answer[i];\nprint(answer1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7c75b79e26e0a7fba88511b38b9e915c", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar integers = tokenizeIntegers(readline());\n\tvar fromR = integers[0], fromC = integers[1];\n\tvar toR = integers[2], toC = integers[3];\n\t\n\tvar rook = (fromR == toR || fromC == toC ? 1 : 2);\n\n\tif ((fromR+fromC)%2 != (toR+toC)%2) {\n\t\tvar bishop = 0;\n\t}\n\telse {\n\t\tvar bishop = (Math.abs(fromR - toR) == Math.abs(fromC - toC) ? 1 : 2);\n\t}\n\n\tvar dr = Math.abs(fromR - toR), dc = Math.abs(fromC - toC);\n\tvar king = dr + dc - Math.min(dr, dc);\n\n\tprint(rook, bishop, king);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a48b50e855b6a3b9a57a76d86bc3f505", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "(function() {\n 'use strict';\n let n = readline().split(' ').map(Number);\n let x = readline().split(' ').map(Number);\n let y = 0;\n let i = 0;\n while(x[i] <= n[1]) {\n y++;\n i++;\n }\n let m = x.length - 1;\n while(x[m] <= n[1]) {\n y++;\n m--;\n }\n print(y);\n}());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0b5f98482b3c33397055b4fe3c93f051", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var s1=readline().split(\" \");\nvar s2=readline().split(\" \");\nvar n=s1[0],k=s1[1],t=0;\nfor(var i=0;i=0;y--){\n\t\t\tif(s2[i]<=k){t++;}\n\t\t\telse{break;}\n\t\t}\n\t}\n}print(t);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "90c52f815daf7389428fb0a92593598e", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nlet n, k;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n [n, k] = d.split(' ').map(Number);\n return;\n }\n\n const arr = d.split(' ').map(Number);\n let ans = 0;\n let stopIndex = 0;\n\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] <= k) {\n ans++;\n }\n else {\n stopIndex = i;\n break;\n }\n }\n\n if (stopIndex !== 0) {\n for (let j = arr.length - 1; j > stopIndex; j--) {\n if (arr[j] <= k) {\n ans++;\n }\n else {\n break;\n }\n }\n }\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3bde047a3b61c09a7895f22154a24447", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Node.js", "source_code": "'use strict';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString='';\nlet currentLine=0;\nprocess.stdin.on('data',inputStdin=>{\n inputString+=inputStdin;\n});\nprocess.stdin.on('end',_=>{\n inputString=inputString.trim().split(\"\\n\").map(string=>{\n return string.trim();\n });\n main();\n});\nfunction readLine()\n{\n return inputString[currentLine++]; \n}\n\nfunction main()\n{\n const [n,k]=readLine().trim().split(' ').map(a=>{return +(a.trim());});\n let arr=readLine().trim().split(' ').map(a=>{return +(a.trim());});\n let ans=0;\n for(let i=0;ik)\n {\n break;\n }\n ans++;\n if(i==n-1)\n {\n console.log(ans);\n return;\n }\n }\n for(let i=n-1;i>=0;--i)\n {\n if(arr[i]>k)\n {\n break;\n }\n ans++;\n }\n console.log(ans);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6ab33148003187e58f7be99dcd851eb4", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n, k, aa = [ ];\nvar line = readline ();\nvar one = line.trim ().split ( ' ' ); // method chaining\nn = (+ one [ 0 ]); // convert words to numbers\nk = (+ one [ 1 ]); // \nline = readline ();\naa = line.trim ().split ( ' ' );\nvar cnt = 0;\nla: while ( aa.length > 0 && aa [ 0 ] <= k && ++ cnt ) { aa.shift (); }\nlb: while ( aa.length > 0 && aa [ aa.length - 1 ] <= k && ++ cnt ) { aa.pop (); }\nprint ( cnt );\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7177b2a5472f0d887e8a8952671287bc", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar one = nextIntArray();\n\tvar N = one[0];\n\tvar K = one[1];\n\tvar list = nextIntArray();\n\tvar count = 0;\n\twhile(list.length > 0){\n\t\tvar L = list[0];\n\t\tif(L <= K){\n\t\t\tcount++;\n\t\t\tlist.shift();\n\t\t\tcontinue;\n\t\t}\n\t\tvar R = list[list.length - 1];\n\t\tif(R <= K){\n\t\t\tcount++;\n\t\t\tlist.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\t\n\tmyout(count);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8b72ccc829c98a356a61709bc8125bc4", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Node.js", "source_code": "function processData(input) {\n //Enter your code here\n let res=input.split(\"\\n\"), [n,k]=res[0].split(\" \").map(Number),\n arr=res[1].split(\" \").filter((x)=>x!==\"\").map(Number);\n while(arr.length>0){\n if(arr[0]<=k){\n arr.shift()\n }else if(arr[arr.length-1]<=k){\n arr.pop()\n }else{\n break;\n }\n }\n console.log(n-arr.length)\n} \n\nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"ascii\");\n_input = \"\";\nprocess.stdin.on(\"data\", function (input) {\n _input += input;\n});\n\nprocess.stdin.on(\"end\", function () {\n processData(_input);\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "01f526c4fe4adea5e39e54dbab32f39b", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var nk = readline().split(' ').map(Number);\nvar n = nk[0];\nvar k = nk[1];\nvar test = readline().split(' ').map(Number);\nvar count = 0;\nfor (var i=0; i=0; i--){\n\tif (test[i] <= k) count++;\n\telse break;\n}\n}\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "77e9e7b1f0cf941f179abf5c4f653372", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var inputs = readline();\nvar count = inputs.split(' ')[0];\nvar skill = inputs.split(' ')[1];\n\nfunction main(isDone, solved, problems){\n //print(skill, '|',problems, '|', solved, '|',isDone);\n if(count == 0)\n return 0;\n\n while( problems.length > 0 && !isDone){\n if(parseInt(problems[0]) <= skill){\n //print('deleted', problems[0])\n problems.splice(0, 1);\n solved++;\n } else if(parseInt(problems[problems.length-1]) <= skill){\n //print('deleted', problems[problems.length-1])\n problems.splice(problems.length-1, 1)\n solved++;\n } else if(parseInt(problems[problems.length-1]) > skill && parseInt(problems[0]) > skill){\n isDone = true;\n }\n //print(problems,isDone, problems[problems.length-1], problems[0])\n }\n return solved; \n}\nwhile(inputs = readline()){\n var problems = inputs.split(' ');\n var isDone = false;\n var solved = 0;\n \n print(main(isDone, solved, problems)); \n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4d704430de5221c3b4f4e38ea7ed5af3", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "(function() {\n 'use strict';\n let n = readline().split(' ').map(Number);\n let x = readline().split(' ').map(Number);\n let y = 0;\n let i = 0;\n while(x[i] <= n[1]) {\n y++;\n i++;\n }\n x.splice(0, y);\n let m = x.length - 1;\n while(x[m] <= n[1]) {\n y++;\n m--;\n }\n print(y);\n}());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d76ffe945ae807994fe20894d5ad2a16", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var s1=readline().split(\" \");\nvar s2=readline().split(\" \");\nvar n=parseInt(s1[0]),k=parseInt(s1[1]),t=0;\nvar f=0;\nfor(var i=0;i=0;y--){\n\t\t\tif(parseInt(s2[y])<=k){t++;}\n\t\t\telse{break;}\n\t\t}\n\t\n}\n\nprint(t);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "36a8c0be84f6db71fc0f5b28b7cd76a4", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nlet n, k;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n [n, k] = d.split(' ').map(Number);\n return;\n }\n\n const arr = d.split(' ').map(Number);\n let ans = 0;\n let L = 0;\n let R = arr.length - 1;\n\n while (L <= R) {\n if (arr[L] <= k) {\n ans++;\n L++;\n }\n else if (arr[R] <= k) {\n ans++;\n R--;\n }\n else {\n break;\n }\n }\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0320890de9b5d01d714a1c9689df6b9a", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "print(function(a, b) {\n\tvar ans = 0;\n\tfor (var i = 0; i < a.length; i += 2) {\n\t\tif (a[i] === b[i]) continue;\n\t\tif (a[i] === '8') {\n\t\t\tif (b[i] === '[') ans++;\n\t\t\telse ans--;\n\t\t}\n\t\tif (a[i] === '[') {\n\t\t\tif (b[i] === '(') ans++;\n\t\t\telse ans--;\n\t\t}\n\t\tif (a[i] === '(') {\n\t\t\tif (b[i] === '8') ans++;\n\t\t\telse ans--;\n\t\t}\n\t}\n\tif (ans === 0) return 'TIE';\n\treturn 'TEAM ' + (ans > 0 ? 1 : 2) + ' WINS';\n}(readline(), readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3bf23af4c6efbc76d1e5c06c85f68272", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction printResult(x) {\n process.stdout.write(x);\n}\n\nfunction main() {\n const arrPoints = new Array(8);\n for (let i = 0; i < 8; i++) {\n let rl = readLine().split(' ').map(Number);\n arrPoints[i] = new Point(rl[0], rl[1]);\n }\n\n eightPointSet(arrPoints);\n}\n\nfunction Point(x, y)\n{\n this.x = x;\n this.y = y;\n}\n\nconst comparePoints = (a, b) => {\n if (a.x < b.x || (a.x === b.x && a.y < b.y)) {\n return -1;\n }\n if (a.x > b.x || (a.x === b.x && a.y > b.y)) {\n return 1;\n }\n return 0;\n}\n\n/**\n * eightPointSet\n *\n * 2 4 7\n * 1 6\n * 0 3 5\n *\n * => Equal\n * x0 = x0 = x2\n * x3 = x4\n * x5 = x6 = x7\n * y0 = y3 = y5\n * y1 = y6\n * y2 = y4 = y7\n *\n * => Not equal\n * x0 != x3\n * x3 != x5\n * y0 != y1\n * y1 != y2\n */\nconst eightPointSet = (a) => {\n a.sort(comparePoints);\n if (a[0].x === a[1].x && a[1].x === a[2].x\n && a[3].x === a[4].x\n && a[5].x === a[6].x && a[6].x === a[7].x\n && a[0].y === a[3].y && a[3].y === a[5].y\n && a[1].y === a[6].y\n && a[2].y === a[4].y && a[4].y === a[7].y\n\n && a[0].y === a[3].y\n && a[3].y === a[5].y\n && a[0].y === a[1].y\n && a[1].y === a[2].y) {\n printResult('respectable');\n } else {\n printResult('ugly');\n }\n};", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e4ff3071e90a4a16f281e6705a19ae4", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction printResult(x) {\n process.stdout.write(x);\n}\n\nfunction main() {\n const arrPoints = new Array(8);\n for (let i = 0; i < 8; i++) {\n let rl = readLine().split(' ').map(Number);\n arrPoints[i] = new Point(rl[0], rl[1]);\n }\n\n eightPointSet(arrPoints);\n}\n\nfunction Point(x, y)\n{\n this.x = x;\n this.y = y;\n}\n\nconst comparePoints = (a, b) => {\n if (a.x < b.x || (a.x === b.x && a.y < b.y)) {\n return -1;\n }\n if (a.x > b.x || (a.x === b.x && a.y > b.y)) {\n return 1;\n }\n return 0;\n}\n\n/**\n * eightPointSet\n *\n * 2 4 7\n * 1 6\n * 0 3 5\n *\n * => Equal\n * x0 = x0 = x2\n * x3 = x4\n * x5 = x6 = x7\n * y0 = y3 = y5\n * y1 = y6\n * y2 = y4 = y7\n *\n * => Not equal\n * x0 != x3\n * x3 != x5\n * y0 != y1\n * y1 != y2\n */\nconst eightPointSet = (a) => {\n a.sort(comparePoints);\n if (a[0].x === a[1].x && a[1].x === a[2].x\n && a[3].x === a[4].x\n && a[5].x === a[6].x && a[6].x === a[7].x\n && a[0].y === a[3].y && a[3].y === a[5].y\n && a[1].y === a[6].y\n && a[2].y === a[4].y && a[4].y === a[7].y\n\n && a[0].x === a[3].x\n && a[3].x === a[5].x\n && a[0].y === a[1].y\n && a[1].y === a[2].y) {\n printResult('respectable');\n } else {\n printResult('ugly');\n }\n};", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5af3f505f4f9cd95971832d532e55b25", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction printResult(x) {\n process.stdout.write(x);\n}\n\nfunction main() {\n const arrPoints = new Array(8);\n for (let i = 0; i < 8; i++) {\n let rl = readLine().split(' ').map(Number);\n arrPoints[i] = new Point(rl[0], rl[1]);\n }\n\n eightPointSet(arrPoints);\n}\n\nfunction Point(x, y)\n{\n this.x = x;\n this.y = y;\n}\n\nconst comparePoints = (a, b) => {\n if (a.x < b.x || (a.x === b.x && a.y < b.y)) {\n return -1;\n }\n if (a.x > b.x || (a.x === b.x && a.y > b.y)) {\n return 1;\n }\n return 0;\n}\n\n/**\n * eightPointSet\n *\n * 2 4 7\n * 1 6\n * 0 3 5\n *\n * => Equal\n * x0 = x0 = x2\n * x3 = x4\n * x5 = x6 = x7\n * y0 = y3 = y5\n * y1 = y6\n * y2 = y4 = y7\n *\n * => Not equal\n * x0 != x3\n * x3 != x5\n * y0 != y1\n * y1 != y2\n */\nconst eightPointSet = (a) => {\n a.sort(comparePoints);\n if (a[0].x === a[1].x && a[1].x === a[2].x\n && a[3].x === a[4].x\n && a[5].x === a[6].x && a[6].x === a[7].x\n && a[0].y === a[3].y && a[3].y === a[5].y\n && a[1].y === a[6].y\n && a[2].y === a[4].y && a[4].y === a[7].y\n\n && a[0].x !== a[3].x\n && a[3].x !== a[5].x\n && a[0].y !== a[1].y\n && a[1].y !== a[2].y) {\n printResult('respectable');\n } else {\n printResult('ugly');\n }\n};", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0a5694fbffbb5514e52d1130621fb565", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction printResult(x) {\n process.stdout.write(x);\n}\n\nfunction main() {\n const arrPoints = new Array(8);\n for (let i = 0; i < 8; i++) {\n let rl = readLine().split(' ').map(Number);\n arrPoints[i] = new Point(rl[0], rl[1]);\n }\n\n // console.log('eee',arrPoints[0].x);\n // const result = eightPointSet(arrPoints);\n eightPointSet(arrPoints);\n // printResult(result.toString());\n}\n\nfunction Point(x, y)\n{\n this.x = x;\n this.y = y;\n}\n\nconst comparePoints = (a, b) => {\n if (a.x < b.x || (a.x === b.x && a.y < b.y)) {\n return -1;\n }\n if (a.x > b.x || (a.x === b.x && a.y > b.y)) {\n return 1;\n }\n return 0;\n}\n\nconst eightPointSet = (a) => {\n a.sort(comparePoints);\n if (a[0].x === a[1].x && a[1].x === a[2].x\n && a[2].x !== a[3].x\n && a[3].x === a[4].x\n && a[4].x !== a[5].x\n && a[5].x === a[6].x && a[6].x === a[7].x\n && a[0].y === a[3].y && a[3].y === a[5].y\n && a[5].y !== a[1].y\n && a[1].y === a[6].y\n && a[6].y !== a[2].y\n && a[2].y === a[4].y && a[4].y === a[7].y) {\n printResult('respectable');\n } else {\n printResult('ugly');\n }\n};\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "de8186edd03e1ebd4606bc8b1f3c8936", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function n (f) { return f == Math.floor(f); }\n\n;(function () {\n\t\n\tvar k = +readline();\n\tvar l = +readline();\n\n\tvar t = k;\n\tvar i = 1;\n\twhile (t < l) {\n\t\tt *= k;\n\t\ti++;\n\t}\n\n\tif ( t == l) {\n\t\tprint('YES');\n\t\tprint(i - 1);\n\t\treturn;\n\t}\n\n\tprint('NO');\n\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2bef724432e2cea4e3cdde7538a62127", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var k = +readline(), l = +readline();\nvar x = k;\nfor( var i=0; x base) {\n\n rest /= base;\n ++importance;\n }\n if ( rest === base ) {\n return importance;\n }\n};\n\nvar k = parseInt( readline(), 10 );\nvar l = parseInt( readline(), 10 );\nvar importance = importanceInPetriciumusCifera( k, l );\nif ( typeof importance !== \"undefined\" ) {\n print( \"YES\" );\n print( importance );\n} else {\n print( \"NO\" );\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ffc3d308f9af3a3c624ebd4a5b6dedc6", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var i = 0;\nvar s = parseInt(readline());\nvar e = parseInt(readline());\nvar curr = s;\n\n(function res() {\n\twhile (curr <= e) {\n\t\tif (curr == e) {\n\t\t\tprint('YES');\n\t\t\tprint(i);\n\t\t\treturn;\n\t\t} else {\n\t\t\tcurr *= s;\n\t\t\ti++;\n\t\t}\n\t}\n\tprint('NO');\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "851e776ef67a396db3540c6dfce667ea", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var isInPetriciumusCifera = function ( base, number ) {\n var rest = number;\n while ( rest % base === 0) {\n rest /= base;\n }\n return rest === 1;\n};\n\nvar k = parseInt( readline(), 10 );\nvar l = parseInt( readline(), 10 );\nif ( isInPetriciumusCifera( k, l ) ) {\n print( \"YES\" );\n} else {\n print( \"NO\" );\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cc4d9c6c26592c632b324046e97d0898", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var c = {};\n\nfunction T(i, n) {\n if (i > n / 2) i = n - i;\n if (i === 0) return 1;\n if (c[i + '+' + n]) return c[i + '+' + n];\n if (i == 1) {\n return n;\n }\n var ans = 0;\n for (var j = 1; j < n; j++) {\n ans += T(i - 1, j);\n }\n return c[i + '+' + n] = ans;\n}\n\n\nprint(function(n, m, t) {\n var a = [];\n for (var i = 1; i <= m; i++) {\n\n var j = t - i;\n\n if (j <= n && j >= 4) {\n a.push([T(i, m), T(j, n)]);\n }\n }\n\n var b = [];\n var x = 0;\n a.forEach(function(v){\n \tif(v[0]*v[1]>1e15){\n \t\tvar xx=v[1].toString();\n \t\tvar j=xx.length-1;\n \t\t// print(v)\n \t\tfor(var i=1; i=0||j>=0){\n \t\tvar k= +(a[i]||0) + +(b[j]||0) + c;\n \t\tc=~~(k/10);\n \t\tsum.push(k%10);\n \t\ti--;\n \t\tj--;\n \t}\n \tif(c>0){\n\t \tsum.push(c)\t\n \t}\n \treturn sum.reverse().join('');\n });\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f25b5e3fb71593fe94678b4977cad890", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "\nvar c = {};\nfunction T(i, n) {\n if (i > n / 2) i = n - i;\n if (i === 0) return 1;\n if (c[i + '+' + n]) return c[i + '+' + n];\n if (i == 1) {\n return n;\n }\n var ans = 0;\n for (var j = 1; j < n; j++) {\n ans += T(i - 1, j);\n }\n return c[i + '+' + n] = ans;\n}\n\nconst MAX = Math.pow(2,53)-5;\nprint(function(n, m, t) {\n\n var a = [];\n\n for (var i = 1; i <= m; i++) {\n var j = t - i;\n if (j <= n && j >= 4) {\n var x = T(i, m);\n var y = T(j, n);\n if(x*y>MAX){\n x.toString().split('').map(Number).reverse().forEach(function(v, i){\n a.push(x*v*Math.pow(10, i));\n });\n }else{\n a.push(x*y);\n }\n }\n }\n\n return a.map(function(v){\n return v.toString().split('').map(Number);\n }).reduce(function(a,b){\n var sum=[];\n var c=0;\n for(i=a.length-1, j=b.length-1; i>=0||j>=0; i--,j--){\n var v = (a[i]||0) + (b[j]||0) + c;\n c=Math.floor(v/10);\n sum.push(v%10);\n }\n if(c>0){\n sum.push(c);\n }\n return sum.reverse();\n }).join('');\n\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c25bea01efe7ad0db8d0fbff98bb1677", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var c={};\nfunction T(i, n){\n if(i>n/2) i=n-i;\n if(c[i+'+'+n]) return c[i+'+'+n];\n if(i==1){\n return n;\n }\n var ans=0;\n for(var j=1; j=4){\n ans+=T(i, m)*T(j, n);\n }\n }\n return ans;\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "689014984f7243acf7da493d2d118bb9", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var c = {};\n\nfunction T(i, n) {\n if (i > n / 2) i = n - i;\n if (i === 0) return 1;\n if (c[i + '+' + n]) return c[i + '+' + n];\n if (i == 1) {\n return n;\n }\n var ans = 0;\n for (var j = 1; j < n; j++) {\n ans += T(i - 1, j);\n }\n return c[i + '+' + n] = ans;\n}\n\n\nprint(function(n, m, t) {\n var ans = 0;\n for (var i = 1; i <= m; i++) {\n\n var j = t - i;\n\n if (j <= n && j >= 4) {\n ans += T(i, m) * T(j, n);\n }\n }\n return ans;\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fb52329aa9f786e1e3cc2385dfffd960", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var c = {};\n\nfunction T(i, n) {\n if (i > n / 2) i = n - i;\n if (i === 0) return 1;\n if (c[i + '+' + n]) return c[i + '+' + n];\n if (i == 1) {\n return n;\n }\n var ans = 0;\n for (var j = 1; j < n; j++) {\n ans += T(i - 1, j);\n }\n return c[i + '+' + n] = ans;\n}\n\n\nprint(function(n, m, t) {\n var a = [];\n for (var i = 1; i <= m; i++) {\n\n var j = t - i;\n\n if (j <= n && j >= 4) {\n a.push(T(i, m));\n }\n }\n\n var b = [];\n var x = 0;\n a.forEach(function(v){\n \tif(v>1e8){\n \t\tvar xx=v.toString();\n \t\tvar j=xx.length-1;\n \t\tfor(var i=1; i=0||j>=0){\n \t\tvar k= +(a[i]||0) + +(b[j]||0) + c;\n \t\tc=~~(k/10);\n \t\tsum.push(k%10);\n \t\ti--;\n \t\tj--;\n \t}\n \tif(c>0){\n\t \tsum.push(c)\t\n \t}\n \treturn sum.reverse().join('');\n });\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "31a13d9a31f20b2c8e7abc6664fd1a04", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "print(function(n, m, t) {\n var a = [];\n for (var i = 1; i <= m; i++) {\n\n var j = t - i;\n\n if (j <= n && j >= 4) {\n a.push([T(i, m), T(j, n)]);\n }\n }\n\n var b = [];\n var x = 0;\n a.forEach(function(v){\n \tif(v[0]>1e8||v[1]>1e8){\n \t\tvar xx=v[1].toString();\n \t\tvar j=xx.length-1;\n \t\tfor(var i=1; i=0||j>=0){\n \t\tvar k= +(a[i]||0) + +(b[j]||0) + c;\n \t\tc=~~(k/10);\n \t\tsum.push(k%10);\n \t\ti--;\n \t\tj--;\n \t}\n \tif(c>0){\n\t \tsum.push(c)\t\n \t}\n \treturn sum.reverse().join('');\n });\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eabdb7ef39fe50bfe49e4a1f261d3c2f", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "n = readline();\n\nvar player1 = 1, player2 = 2, watcher = 3, res = 'YES';\n\nfor (var i = 0; i < n; i++) {\n\twinner = readline();\n\n\tif (watcher == winner) {\n\t\tres = 'NO';\n\t\tbreak;\n\t} else if (player1 == winner) {\n\t\tvar temp = watcher;\n\t\twatcher = player2;\n\t\tplayer2 = temp;\n\t} else if (player2 == winner) {\n\t\tvar temp = watcher;\n\t\twatcher = player1;\n\t\tplayer1 = temp;\n\t};\n};\n\nprint(res);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5d066b8517f10e2854fe09c23fd9dd26", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "n=readline();\na=1;\nb=2;\nc=3;\nr='YES';\nfor(i=0; i {\n return Math.sqrt(Math.abs(x1 - x2)**2 + Math.abs(y1 - y2)**2);\n}\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n m = +d;\n return;\n }\n\n const [x, y] = d.split(' ').map(Number);\n const white = distance(1, x, 1, y);\n const black = distance(m, x, m, y);\n\n if (black < white) {\n console.log('Black');\n }\n else {\n console.log('White');\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f566e97d20dcd603805d304129e6fc84", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let data = '';\nprocess.stdin.on('data', c => data += c);\n\nfunction* nextLine() {\n\tlet lines = data.trim().split(/\\n/g);\n\tfor(let l of lines){\n\t\tyield l.trim();\n\t}\n}\n\nlet nl = nextLine();\n\nnl.num = function() {\n\t\treturn Number(this.next().value);\n\t};\nnl.nums = function() {\n\t\treturn this.next().value.split(/\\s/g).map(Number);\n\t};\nnl.line = function() {\n\t\treturn this.next().value;\n\t}\n\t\nconst sol = () => {\n\tlet n = nl.num();\n\tlet [x, y] = nl.nums();\n\t\n\tlet w = Math.max(x-1,y-1);\n\tlet b = Math.max(n-x,n-y);\n\tconsole.log(w<=b?'White':'Black');\n\n};\n\nprocess.stdin.on('end', sol);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "885c152697507a120cf119f08cc95649", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nvar s = readline().split(' ').map(v=>+v);\n\nvar w = Math.max(s[0] - 1, s[1] - 1);\nvar b = Math.max(n - s[0], n - s[1]);\n\nprint(b < w ? 'Black' : 'White');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "487e9101319b68d754986a6c991b06c8", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar convertToInt = function(str){\n let n = str.length;\n let ans = 0;\n for(let i = 0; i < n;i++){\n ans = ans * 10 + (str[i] - '0');\n \n }\n return ans;\n}\nvar counter = 0, N;\n\nrl.on('line', (input) => {\n if (counter == 0) {\n N = BigInt(input);\n counter++;\n }\n else {\n //let cont = input.split(' ').map(item => parseInt(item));\n //let x = cont[0], y = cont[1];\n let cont = input.split(' ');\n //x=parseInt(cont[0]), y = parseInt(cont[1]);\n //x=Number(cont[0]), y=Number(cont[1]);\n //x = convertToInt(cont[0]), y = convertToInt(cont[1]);\n x = BigInt(cont[0]), y = BigInt(cont[1]);\n \n let whiteMoves = 0n, blackMoves = 0n, minDiff=0n, maxDiff=0n;\n console.log(\"N = %d x = %d y = %d cont[0] = %s cont[1] = %s\", N, x, y, cont[0], cont[1]);\n //calculate white moves\n /* minDiff = Math.min(x - 1n, y - 1n);\n maxDiff = Math.max(x - 1n, y - 1n);\n whiteMoves=minDiff+(maxDiff-minDiff);\n minDiff = Math.min(N - x, N - y);\n maxDiff = Math.max(N - x, N - y);\n blackMoves=minDiff+(maxDiff-minDiff);*/\n let help1 = x - 1n, help2 = y - 1n;\n minDiff = (help1 > help2) ? help2 : help1;\n maxDiff = (help1 < help2) ? help2 : help1;\n whiteMoves=minDiff+(maxDiff-minDiff);\n \n help1 = N - x, help2 = N - y;\n minDiff = (help1 > help2) ? help2 : help1;\n maxDiff = (help1 < help2) ? help2 : help1;\n blackMoves=minDiff+(maxDiff-minDiff);\n\n console.log(whiteMoves<=blackMoves?\"White\":\"Black\");\n rl.close();\n }\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a722ec12e27c3123fbe3cfddf35e6dc1", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Node.js", "source_code": "/*\n * big.js v5.2.2\n * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.\n * Copyright (c) 2018 Michael Mclaughlin \n * https://github.com/MikeMcl/big.js/LICENCE\n */\n\n 'use strict';\n var Big,\n\n\n/************************************** EDITABLE DEFAULTS *****************************************/\n\n\n // The default values below must be integers within the stated ranges.\n\n /*\n * The maximum number of decimal places (DP) of the results of operations involving division:\n * div and sqrt, and pow with negative exponents.\n */\n DP = 20, // 0 to MAX_DP\n\n /*\n * The rounding mode (RM) used when rounding to the above decimal places.\n *\n * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)\n * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)\n * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)\n * 3 Away from zero. (ROUND_UP)\n */\n RM = 1, // 0, 1, 2 or 3\n\n // The maximum value of DP and Big.DP.\n MAX_DP = 1E6, // 0 to 1000000\n\n // The maximum magnitude of the exponent argument to the pow method.\n MAX_POWER = 1E6, // 1 to 1000000\n\n /*\n * The negative exponent (NE) at and beneath which toString returns exponential notation.\n * (JavaScript numbers: -7)\n * -1000000 is the minimum recommended exponent value of a Big.\n */\n NE = -7, // 0 to -1000000\n\n /*\n * The positive exponent (PE) at and above which toString returns exponential notation.\n * (JavaScript numbers: 21)\n * 1000000 is the maximum recommended exponent value of a Big.\n * (This limit is not enforced or checked.)\n */\n PE = 21, // 0 to 1000000\n\n\n/**************************************************************************************************/\n\n\n // Error messages.\n NAME = '[big.js] ',\n INVALID = NAME + 'Invalid ',\n INVALID_DP = INVALID + 'decimal places',\n INVALID_RM = INVALID + 'rounding mode',\n DIV_BY_ZERO = NAME + 'Division by zero',\n\n // The shared prototype object.\n P = {},\n UNDEFINED = void 0,\n NUMERIC = /^-?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i;\n\n\n /*\n * Create and return a Big constructor.\n *\n */\n function _Big_() {\n\n /*\n * The Big constructor and exported function.\n * Create and return a new instance of a Big number object.\n *\n * n {number|string|Big} A numeric value.\n */\n function Big(n) {\n var x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\n\n // Duplicate.\n if (n instanceof Big) {\n x.s = n.s;\n x.e = n.e;\n x.c = n.c.slice();\n } else {\n parse(x, n);\n }\n\n /*\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\n * points to Object.\n */\n x.constructor = Big;\n }\n\n Big.prototype = P;\n Big.DP = DP;\n Big.RM = RM;\n Big.NE = NE;\n Big.PE = PE;\n Big.version = '5.2.2';\n\n return Big;\n }\n\n\n /*\n * Parse the number or string value passed to a Big constructor.\n *\n * x {Big} A Big number instance.\n * n {number|string} A numeric value.\n */\n function parse(x, n) {\n var e, i, nl;\n\n // Minus zero?\n if (n === 0 && 1 / n < 0) n = '-0';\n else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');\n\n // Determine sign.\n x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;\n\n // Decimal point?\n if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');\n\n // Exponential form?\n if ((i = n.search(/e/i)) > 0) {\n\n // Determine exponent.\n if (e < 0) e = i;\n e += +n.slice(i + 1);\n n = n.substring(0, i);\n } else if (e < 0) {\n\n // Integer.\n e = n.length;\n }\n\n nl = n.length;\n\n // Determine leading zeros.\n for (i = 0; i < nl && n.charAt(i) == '0';) ++i;\n\n if (i == nl) {\n\n // Zero.\n x.c = [x.e = 0];\n } else {\n\n // Determine trailing zeros.\n for (; nl > 0 && n.charAt(--nl) == '0';);\n x.e = e - i - 1;\n x.c = [];\n\n // Convert string to array of digits without leading/trailing zeros.\n for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);\n }\n\n return x;\n }\n\n\n /*\n * Round Big x to a maximum of dp decimal places using rounding mode rm.\n * Called by stringify, P.div, P.round and P.sqrt.\n *\n * x {Big} The Big to round.\n * dp {number} Integer, 0 to MAX_DP inclusive.\n * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)\n * [more] {boolean} Whether the result of division was truncated.\n */\n function round(x, dp, rm, more) {\n var xc = x.c,\n i = x.e + dp + 1;\n\n if (i < xc.length) {\n if (rm === 1) {\n\n // xc[i] is the digit after the digit that may be rounded up.\n more = xc[i] >= 5;\n } else if (rm === 2) {\n more = xc[i] > 5 || xc[i] == 5 &&\n (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);\n } else if (rm === 3) {\n more = more || !!xc[0];\n } else {\n more = false;\n if (rm !== 0) throw Error(INVALID_RM);\n }\n\n if (i < 1) {\n xc.length = 1;\n\n if (more) {\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n x.e = -dp;\n xc[0] = 1;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n } else {\n\n // Remove any digits after the required decimal places.\n xc.length = i--;\n\n // Round up?\n if (more) {\n\n // Rounding up may mean the previous digit has to be rounded up.\n for (; ++xc[i] > 9;) {\n xc[i] = 0;\n if (!i--) {\n ++x.e;\n xc.unshift(1);\n }\n }\n }\n\n // Remove trailing zeros.\n for (i = xc.length; !xc[--i];) xc.pop();\n }\n } else if (rm < 0 || rm > 3 || rm !== ~~rm) {\n throw Error(INVALID_RM);\n }\n\n return x;\n }\n\n\n /*\n * Return a string representing the value of Big x in normal or exponential notation.\n * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.\n *\n * x {Big}\n * id? {number} Caller id.\n * 1 toExponential\n * 2 toFixed\n * 3 toPrecision\n * 4 valueOf\n * n? {number|undefined} Caller's argument.\n * k? {number|undefined}\n */\n function stringify(x, id, n, k) {\n var e, s,\n Big = x.constructor,\n z = !x.c[0];\n\n if (n !== UNDEFINED) {\n if (n !== ~~n || n < (id == 3) || n > MAX_DP) {\n throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);\n }\n\n x = new Big(x);\n\n // The index of the digit that may be rounded up.\n n = k - x.e;\n\n // Round?\n if (x.c.length > ++k) round(x, n, Big.RM);\n\n // toFixed: recalculate k as x.e may have changed if value rounded up.\n if (id == 2) k = x.e + n + 1;\n\n // Append zeros?\n for (; x.c.length < k;) x.c.push(0);\n }\n\n e = x.e;\n s = x.c.join('');\n n = s.length;\n\n // Exponential notation?\n if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {\n s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;\n\n // Normal notation.\n } else if (e < 0) {\n for (; ++e;) s = '0' + s;\n s = '0.' + s;\n } else if (e > 0) {\n if (++e > n) for (e -= n; e--;) s += '0';\n else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);\n } else if (n > 1) {\n s = s.charAt(0) + '.' + s.slice(1);\n }\n\n return x.s < 0 && (!z || id == 4) ? '-' + s : s;\n }\n\n\n // Prototype/instance methods\n\n\n /*\n * Return a new Big whose value is the absolute value of this Big.\n */\n P.abs = function () {\n var x = new this.constructor(this);\n x.s = 1;\n return x;\n };\n\n\n /*\n * Return 1 if the value of this Big is greater than the value of Big y,\n * -1 if the value of this Big is less than the value of Big y, or\n * 0 if they have the same value.\n */\n P.cmp = function (y) {\n var isneg,\n x = this,\n xc = x.c,\n yc = (y = new x.constructor(y)).c,\n i = x.s,\n j = y.s,\n k = x.e,\n l = y.e;\n\n // Either zero?\n if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;\n\n // Signs differ?\n if (i != j) return i;\n\n isneg = i < 0;\n\n // Compare exponents.\n if (k != l) return k > l ^ isneg ? 1 : -1;\n\n j = (k = xc.length) < (l = yc.length) ? k : l;\n\n // Compare digit by digit.\n for (i = -1; ++i < j;) {\n if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;\n }\n\n // Compare lengths.\n return k == l ? 0 : k > l ^ isneg ? 1 : -1;\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,\n * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.\n */\n P.div = function (y) {\n var x = this,\n Big = x.constructor,\n a = x.c, // dividend\n b = (y = new Big(y)).c, // divisor\n k = x.s == y.s ? 1 : -1,\n dp = Big.DP;\n\n if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);\n\n // Divisor is zero?\n if (!b[0]) throw Error(DIV_BY_ZERO);\n\n // Dividend is 0? Return +-0.\n if (!a[0]) return new Big(k * 0);\n\n var bl, bt, n, cmp, ri,\n bz = b.slice(),\n ai = bl = b.length,\n al = a.length,\n r = a.slice(0, bl), // remainder\n rl = r.length,\n q = y, // quotient\n qc = q.c = [],\n qi = 0,\n d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result\n\n q.s = k;\n k = d < 0 ? 0 : d;\n\n // Create version of divisor with leading zero.\n bz.unshift(0);\n\n // Add zeros to make remainder as long as divisor.\n for (; rl++ < bl;) r.push(0);\n\n do {\n\n // n is how many times the divisor goes into current remainder.\n for (n = 0; n < 10; n++) {\n\n // Compare divisor and remainder.\n if (bl != (rl = r.length)) {\n cmp = bl > rl ? 1 : -1;\n } else {\n for (ri = -1, cmp = 0; ++ri < bl;) {\n if (b[ri] != r[ri]) {\n cmp = b[ri] > r[ri] ? 1 : -1;\n break;\n }\n }\n }\n\n // If divisor < remainder, subtract divisor from remainder.\n if (cmp < 0) {\n\n // Remainder can't be more than 1 digit longer than divisor.\n // Equalise lengths using divisor with extra leading zero?\n for (bt = rl == bl ? b : bz; rl;) {\n if (r[--rl] < bt[rl]) {\n ri = rl;\n for (; ri && !r[--ri];) r[ri] = 9;\n --r[ri];\n r[rl] += 10;\n }\n r[rl] -= bt[rl];\n }\n\n for (; !r[0];) r.shift();\n } else {\n break;\n }\n }\n\n // Add the digit n to the result array.\n qc[qi++] = cmp ? n : ++n;\n\n // Update the remainder.\n if (r[0] && cmp) r[rl] = a[ai] || 0;\n else r = [a[ai]];\n\n } while ((ai++ < al || r[0] !== UNDEFINED) && k--);\n\n // Leading zero? Do not remove if result is simply zero (qi == 1).\n if (!qc[0] && qi != 1) {\n\n // There can't be more than one zero.\n qc.shift();\n q.e--;\n }\n\n // Round?\n if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);\n\n return q;\n };\n\n\n /*\n * Return true if the value of this Big is equal to the value of Big y, otherwise return false.\n */\n P.eq = function (y) {\n return !this.cmp(y);\n };\n\n\n /*\n * Return true if the value of this Big is greater than the value of Big y, otherwise return\n * false.\n */\n P.gt = function (y) {\n return this.cmp(y) > 0;\n };\n\n\n /*\n * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise\n * return false.\n */\n P.gte = function (y) {\n return this.cmp(y) > -1;\n };\n\n\n /*\n * Return true if the value of this Big is less than the value of Big y, otherwise return false.\n */\n P.lt = function (y) {\n return this.cmp(y) < 0;\n };\n\n\n /*\n * Return true if the value of this Big is less than or equal to the value of Big y, otherwise\n * return false.\n */\n P.lte = function (y) {\n return this.cmp(y) < 1;\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big minus the value of Big y.\n */\n P.minus = P.sub = function (y) {\n var i, j, t, xlty,\n x = this,\n Big = x.constructor,\n a = x.s,\n b = (y = new Big(y)).s;\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xc = x.c.slice(),\n xe = x.e,\n yc = y.c,\n ye = y.e;\n\n // Either zero?\n if (!xc[0] || !yc[0]) {\n\n // y is non-zero? x is non-zero? Or both are zero.\n return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);\n }\n\n // Determine which is the bigger number. Prepend zeros to equalise exponents.\n if (a = xe - ye) {\n\n if (xlty = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n for (b = a; b--;) t.push(0);\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ((xlty = xc.length < yc.length) ? xc : yc).length;\n\n for (a = b = 0; b < j; b++) {\n if (xc[b] != yc[b]) {\n xlty = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xlty) {\n t = xc;\n xc = yc;\n yc = t;\n y.s = -y.s;\n }\n\n /*\n * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only\n * needs to start at yc.length.\n */\n if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;\n\n // Subtract yc from xc.\n for (b = i; j > a;) {\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i];) xc[i] = 9;\n --xc[i];\n xc[j] += 10;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove trailing zeros.\n for (; xc[--b] === 0;) xc.pop();\n\n // Remove leading zeros and adjust exponent accordingly.\n for (; xc[0] === 0;) {\n xc.shift();\n --ye;\n }\n\n if (!xc[0]) {\n\n // n - n = +0\n y.s = 1;\n\n // Result must be zero.\n xc = [ye = 0];\n }\n\n y.c = xc;\n y.e = ye;\n\n return y;\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big modulo the value of Big y.\n */\n P.mod = function (y) {\n var ygtx,\n x = this,\n Big = x.constructor,\n a = x.s,\n b = (y = new Big(y)).s;\n\n if (!y.c[0]) throw Error(DIV_BY_ZERO);\n\n x.s = y.s = 1;\n ygtx = y.cmp(x) == 1;\n x.s = a;\n y.s = b;\n\n if (ygtx) return new Big(x);\n\n a = Big.DP;\n b = Big.RM;\n Big.DP = Big.RM = 0;\n x = x.div(y);\n Big.DP = a;\n Big.RM = b;\n\n return this.minus(x.times(y));\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big plus the value of Big y.\n */\n P.plus = P.add = function (y) {\n var t,\n x = this,\n Big = x.constructor,\n a = x.s,\n b = (y = new Big(y)).s;\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e,\n xc = x.c,\n ye = y.e,\n yc = y.c;\n\n // Either zero? y is non-zero? x is non-zero? Or both are zero.\n if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);\n\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents.\n // Note: reverse faster than unshifts.\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for (; a--;) t.push(0);\n t.reverse();\n }\n\n // Point xc to the longer array.\n if (xc.length - yc.length < 0) {\n t = yc;\n yc = xc;\n xc = t;\n }\n\n a = yc.length;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.\n for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\n if (b) {\n xc.unshift(b);\n ++ye;\n }\n\n // Remove trailing zeros.\n for (a = xc.length; xc[--a] === 0;) xc.pop();\n\n y.c = xc;\n y.e = ye;\n\n return y;\n };\n\n\n /*\n * Return a Big whose value is the value of this Big raised to the power n.\n * If n is negative, round to a maximum of Big.DP decimal places using rounding\n * mode Big.RM.\n *\n * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.\n */\n P.pow = function (n) {\n var x = this,\n one = new x.constructor(1),\n y = one,\n isneg = n < 0;\n\n if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');\n if (isneg) n = -n;\n\n for (;;) {\n if (n & 1) y = y.times(x);\n n >>= 1;\n if (!n) break;\n x = x.times(x);\n }\n\n return isneg ? one.div(y) : y;\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big rounded using rounding mode rm\n * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a\n * multiple of 10**-dp.\n * If dp is not specified, round to 0 decimal places.\n * If rm is not specified, use Big.RM.\n *\n * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.\n * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)\n */\n P.round = function (dp, rm) {\n var Big = this.constructor;\n if (dp === UNDEFINED) dp = 0;\n else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);\n return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);\n };\n\n\n /*\n * Return a new Big whose value is the square root of the value of this Big, rounded, if\n * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.\n */\n P.sqrt = function () {\n var r, c, t,\n x = this,\n Big = x.constructor,\n s = x.s,\n e = x.e,\n half = new Big(0.5);\n\n // Zero?\n if (!x.c[0]) return new Big(x);\n\n // Negative?\n if (s < 0) throw Error(NAME + 'No square root');\n\n // Estimate.\n s = Math.sqrt(x + '');\n\n // Math.sqrt underflow/overflow?\n // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.\n if (s === 0 || s === 1 / 0) {\n c = x.c.join('');\n if (!(c.length + e & 1)) c += '0';\n s = Math.sqrt(c);\n e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);\n r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);\n } else {\n r = new Big(s);\n }\n\n e = r.e + (Big.DP += 4);\n\n // Newton-Raphson iteration.\n do {\n t = r;\n r = half.times(t.plus(x.div(t)));\n } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));\n\n return round(r, Big.DP -= 4, Big.RM);\n };\n\n\n /*\n * Return a new Big whose value is the value of this Big times the value of Big y.\n */\n P.times = P.mul = function (y) {\n var c,\n x = this,\n Big = x.constructor,\n xc = x.c,\n yc = (y = new Big(y)).c,\n a = xc.length,\n b = yc.length,\n i = x.e,\n j = y.e;\n\n // Determine sign of result.\n y.s = x.s == y.s ? 1 : -1;\n\n // Return signed 0 if either 0.\n if (!xc[0] || !yc[0]) return new Big(y.s * 0);\n\n // Initialise exponent of result as x.e + y.e.\n y.e = i + j;\n\n // If array xc has fewer digits than yc, swap xc and yc, and lengths.\n if (a < b) {\n c = xc;\n xc = yc;\n yc = c;\n j = a;\n a = b;\n b = j;\n }\n\n // Initialise coefficient array of result with zeros.\n for (c = new Array(j = a + b); j--;) c[j] = 0;\n\n // Multiply.\n\n // i is initially xc.length.\n for (i = b; i--;) {\n b = 0;\n\n // a is yc.length.\n for (j = a + i; j > i;) {\n\n // Current sum of products at this digit position, plus carry.\n b = c[j] + yc[i] * xc[j - i - 1] + b;\n c[j--] = b % 10;\n\n // carry\n b = b / 10 | 0;\n }\n\n c[j] = b;\n }\n\n // Increment result exponent if there is a final carry, otherwise remove leading zero.\n if (b) ++y.e;\n else c.shift();\n\n // Remove trailing zeros.\n for (i = c.length; !c[--i];) c.pop();\n y.c = c;\n\n return y;\n };\n\n\n /*\n * Return a string representing the value of this Big in exponential notation to dp fixed decimal\n * places and rounded using Big.RM.\n *\n * dp? {number} Integer, 0 to MAX_DP inclusive.\n */\n P.toExponential = function (dp) {\n return stringify(this, 1, dp, dp);\n };\n\n\n /*\n * Return a string representing the value of this Big in normal notation to dp fixed decimal\n * places and rounded using Big.RM.\n *\n * dp? {number} Integer, 0 to MAX_DP inclusive.\n *\n * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.\n * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.\n */\n P.toFixed = function (dp) {\n return stringify(this, 2, dp, this.e + dp);\n };\n\n\n /*\n * Return a string representing the value of this Big rounded to sd significant digits using\n * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent\n * the integer part of the value in normal notation.\n *\n * sd {number} Integer, 1 to MAX_DP inclusive.\n */\n P.toPrecision = function (sd) {\n return stringify(this, 3, sd, sd - 1);\n };\n\n\n /*\n * Return a string representing the value of this Big.\n * Return exponential notation if this Big has a positive exponent equal to or greater than\n * Big.PE, or a negative exponent equal to or less than Big.NE.\n * Omit the sign for negative zero.\n */\n P.toString = function () {\n return stringify(this);\n };\n\n\n /*\n * Return a string representing the value of this Big.\n * Return exponential notation if this Big has a positive exponent equal to or greater than\n * Big.PE, or a negative exponent equal to or less than Big.NE.\n * Include the sign for negative zero.\n */\n P.valueOf = P.toJSON = function () {\n return stringify(this, 4);\n };\n\n\n // Export\n\n\n Big = _Big_();\n\n Big['default'] = Big.Big = Big;\n\n //AMD.\n if (typeof define === 'function' && define.amd) {\n define(function () { return Big; });\n\n // Node and other CommonJS-like environments that support module.exports.\n } else if (typeof module !== 'undefined' && module.exports) {\n module.exports = Big;\n\n //Browser.\n } else {\n GLOBAL.Big = Big;\n }\nlet data = '';\nprocess.stdin.on('data', c => data += c);\n\nfunction* nextLine() {\n\tlet lines = data.trim().split(/\\n/g);\n\tfor(let l of lines){\n\t\tyield l.trim();\n\t}\n}\n\nlet nl = nextLine();\n\nnl.elem = function(funParse) {\n\treturn funParse(this.next().value);\t\n};\nnl.array = function(funParse) {\n\t\treturn this.next().value.split(/\\s/g).map(funParse||(x => x));\n\t};\nnl.line = function() {\n\t\treturn this.next().value;\n\t}\n\t\nconst sol = () => {\n\tlet n = nl.elem(Big);\n\tlet [x, y] = nl.array(Big);\n\tlet wx = x.minus(Big(1));\n\tlet wy = y.minus(Big(1));\n\tlet bx = n.minus(x);\n\tlet by = n.minus(y);\n\t\n\tlet w = wx.lte(wy)?wx:wy;\n\tlet b = bx.lte(by)?bx:by;\n\tconsole.log(w.lte(b)?'White':'Black');\n\n};\n\nprocess.stdin.on('end', sol);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c53aa6738d8dc1b22f1db83477a8fbee", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar convertToInt = function(str){\n let n = str.length;\n let ans = 0;\n for(let i = 0; i < n;i++){\n ans = ans * 10 + (str[i] - '0');\n \n }\n return ans;\n}\nvar counter = 0, N;\n\nrl.on('line', (input) => {\n if (counter == 0) {\n N = BigInt(input);\n counter++;\n }\n else {\n //let cont = input.split(' ').map(item => parseInt(item));\n //let x = cont[0], y = cont[1];\n let cont = input.split(' ');\n //x=parseInt(cont[0]), y = parseInt(cont[1]);\n //x=Number(cont[0]), y=Number(cont[1]);\n //x = convertToInt(cont[0]), y = convertToInt(cont[1]);\n x = BigInt(cont[0]), y = BigInt(cont[1]);\n \n let whiteMoves = 0n, blackMoves = 0n, minDiff=0n, maxDiff=0n;\n //console.log(\"N = %d x = %d y = %d cont[0] = %s cont[1] = %s\", N, x, y, cont[0], cont[1]);\n //calculate white moves\n /* minDiff = Math.min(x - 1n, y - 1n);\n maxDiff = Math.max(x - 1n, y - 1n);\n whiteMoves=minDiff+(maxDiff-minDiff);\n minDiff = Math.min(N - x, N - y);\n maxDiff = Math.max(N - x, N - y);\n blackMoves=minDiff+(maxDiff-minDiff);*/\n let help1 = x - 1n, help2 = y - 1n;\n minDiff = (help1 > help2) ? help2 : help1;\n maxDiff = (help1 < help2) ? help2 : help1;\n whiteMoves=minDiff+(maxDiff-minDiff);\n\n help1 = N - x, help2 = N - y;\n minDiff = (help1 > help2) ? help2 : help1;\n maxDiff = (help1 < help2) ? help2 : help1;\n blackMoves=minDiff+(maxDiff-minDiff);\n\n console.log(whiteMoves<=blackMoves?\"White\":\"Black\");\n rl.close();\n }\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d032ab2982c10d73d9ab834562429537", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let data = '';\nprocess.stdin.on('data', c => data += c);\n\nfunction* nextLine() {\n\tlet lines = data.trim().split(/\\n/g);\n\tfor(let l of lines){\n\t\tyield l.trim();\n\t}\n}\n\nlet nl = nextLine();\n\nnl.num = function() {\n\t\treturn Number(this.next().value);\n\t};\nnl.array = function(parse) {\n\t\treturn this.next().value.split(/\\s/g).map(parse);\n\t};\n\nnl.line = function() {\n\t\treturn this.next().value;\n\t}\n\t\nconst sol = () => {\n\tlet n = nl.num();\n\tlet [x, y] = nl.array(BigNum);\n\t\n\tlet w = Math.max(x-1,y-1);\n\tlet b = Math.max(n-x,n-y);\n\tconsole.log(w<=b?'White':'Black');\n\n};\n\nprocess.stdin.on('end', sol);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0b14165b480227912cfb0c394561333f", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "\"use strict\";\n\nfunction main()\n{\n var line = readline().split(\" \");\n \n var size = parseInt(line[0], 10);\n var words = parseInt(line[1], 10);\n \n var transforms = new Array(6);\n for (var i=0 ; i<6 ; i++)\n {\n transforms[i] = new Array(6);\n transforms[i].fill(0);\n }\n \n for (var i=0 ; i 1; i++) {\n var op = string.slice(0, 2)\n if (!ops[op]) { return false }\n string = ops[op] + string.slice(2)\n }\n return string === 'a'\n })\n .length\n)\n\n\nfunction generateStrings (NN) {\n\n var strings = []\n\n var K = NN - 1, k = 0,\n N = alphabet.length, n = 0,\n out = [],\n stack = []\n\n function next(){\n while (true) {\n while (n < alphabet.length) {\n out[k] = alphabet[n++];\n if (k == K) return out.slice(0);\n else {\n if (n < alphabet.length) {\n stack.push(k);\n stack.push(n);\n }\n k++;\n n = 0;\n }\n }\n if (stack.length == 0) break;\n\n n = stack.pop();\n k = stack.pop();\n }\n return false;\n }\n\n var str\n\n while (str = next()) {\n strings.push(str.join(''))\n }\n\n return strings\n\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "45aef97a523d06db15307c9dfef95567", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var num = readline();\n\n// var num = '2901'\n\n\nfunction allNines(num) {\n var arr=[]\n for (var i = 0; i < num.length-1; i++) {\n arr.push(9);\n }\n\n return parseInt(arr.join(''))\n}\n\nfunction main(num) {\n //add less than 2 case\n if (num.length === 1) {\n return parseInt(num);\n } else if (num[0] === '1') {\n return main(num.split('').slice(1))\n } else {\n return Math.max(parseInt(num[0])*main(num.split('').slice(1).join('')), (parseInt(num[0]) - 1)*allNines(num));\n }\n}\n\nwrite(main(num))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c7397a8289e46b8b92853f8354bc5b21", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nfunction readLines(number, cb) {\n const lines = [];\n rl.on('line', function(line) {\n lines.push(line);\n if (lines.length === number) {\n rl.close();\n cb(lines);\n }\n });\n};\n\n\nfunction doIt(lines) {\n const n = parseInt(lines[0]);\n if (n === 0)\n console.log(n)\n else\n console.log(calc(n, 1));\n}\n\nfunction calc(next, acc) {\n if (next === 0)\n return acc;\n let unit1 = next%10;\n let rest1 = Math.floor(next/10);\n let ret1 = calc(rest1, unit1*acc);\n let ret2 = 0;\n if (unit1 < 9 && rest1>0) {\n let unit2 = 9;\n let rest2 = Math.floor(next/10) -1;\n\n ret2 = calc(rest2, unit2*acc);\n }\n return Math.max(ret1, ret2);\n}\n\nreadLines(1, doIt);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2641e4893c9eb3e1748e4e0c71397445", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\n\nrl.question('', ans => {\n rl.close()\n\n let n = Number(ans)\n\n function nirvana(num) {\n const str = String(num)\n \n function mult(str) {\n return Number(str) === 0 ? 1 : str.split('').map(x => Number(x)).reduce((i, acc = 1) => i * acc)\n }\n \n let l = mult(str)\n for (let i = str.length - 1; i > 0; i--) {\n \t\tnines = str.length -1 - i + 1\n \t\tlet tMult = mult(String(Number(str.substr(0, i)) - 1))\n \t\ttMult = tMult * (9 ** nines)\n \t\t\n \t\tif (tMult > l) l = tMult\n }\n \t\n \treturn l\n }\n\n console.log(nirvana(n))\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b2d249324f27fbd766b9b6344acf71d0", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var num = readline();\n\n// var num = '1000000000'\n\n\nfunction multiplyNines(num) {\n var hi = 1;\n for (var i = 0; i < num.length-1; i++) {\n hi *= 9;\n }\n\n return hi + ''\n}\n\nfunction allNines(num) {\n var arr=[]\n for (var i = 0; i < num.length-1; i++) {\n arr.push(9);\n }\n\n return parseInt(arr.join(''))\n}\n\nfunction main(num) {\n //add less than 2 case\n if (num.length === 1) {\n return parseInt(num);\n } else if (num[0] === '1') {\n return multiplyNines(num)\n } else {\n return Math.max(parseInt(num[0])*main(num.split('').slice(1).join('')), (parseInt(num[0]) - 1)*parseInt(multiplyNines(num)));\n }\n}\n\nwrite(main(num))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "731046f2b1b533beb768d3907479b075", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\n\nrl.question('', ans => {\n rl.close()\n\n let n = Number(ans)\n\n function closest (n) {\n let closest = ''\n while (true) { \n if (n <= 9) {\n\t\t\tclosest = n + closest\n\t\t\tbreak\n }\n \n\t\tclosest = 9 + closest\n n = ~~((n - 9) / 10)\n }\n \n return Number(closest)\n }\n\n function nirvana (n) {\n const c = closest(n)\n const sC = String(c).split('')\n let grtst = Number(sC.reduce((i, acc = 1) => Number(i) * acc))\n\n for (let i = c + 1; i <= n; i++) {\n const sI = String(i).split('')\n let dMult = Number(sI.reduce((i, acc = 1) => i * acc))\n grtst = dMult > grtst ? dMult : grtst\n }\n \n return grtst\n }\n\n console.log(nirvana(n))\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4bbcbee38c4e919629acaaa2bc7302a7", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var num = readline();\n\n// var num = '7'\n\n\nfunction multiplyNines(num) {\n var hi = 1;\n for (var i = 0; i < num.length-1; i++) {\n hi *= 9;\n }\n\n return hi + ''\n}\n\nfunction allNines(num) {\n var arr=[]\n for (var i = 0; i < num.length-1; i++) {\n arr.push(9);\n }\n\n return parseInt(arr.join(''))\n}\n\nfunction main(num) {\n //add less than 2 case\n if (num.length === 1) {\n return parseInt(num);\n } else if (num[0] === '1') {\n return multiplyNines(num)\n } else {\n return Math.max(parseInt(num[0])*main(num.split('').slice(1).join('')), (parseInt(num[0]) - 1)*allNines(num));\n }\n}\n\nwrite(main(num))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "20c7d586bcf6f44ea4c1dbd88f023fc5", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "n=+readline()\na=readline().split(' ').map(function(x){return +x;})\nvar d=a[1]-a[0]\nvar keks=1;\nfor (var i=2;i0){print(ar[n-1]+d);}\n\telse{print(ar[0]);}\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7cc27e7953bb9cfcbcc4cc0733a9fd30", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function getAmount(card) {\n\tswitch(card) {\n\t\tcase \"6\":\n\t\t\treturn 6;\n\t\tcase \"7\":\n\t\t\treturn 7;\n\t\tcase \"8\":\n\t\t\treturn 8;\n\t\tcase \"9\":\n\t\t\treturn 9;\n\t\tcase \"10\":\n\t\t\treturn 10;\n\t\tcase \"T\":\n\t\t\treturn 11;\n\t\tcase \"J\":\n\t\t\treturn 12;\n\t\tcase \"Q\":\n\t\t\treturn 13;\n\t\tcase \"K\":\n\t\t\treturn 14;\n\t\tcase \"A\":\n\t\t\treturn 15;\n\n\t}\n}\n\nvar kozyr = readline();\nvar input = readline().split(' ');\nvar a1 = getAmount(input[0][0]);\nvar m1 = input[0][1];\nvar a2 = getAmount(input[1][0]);\nvar m2 = input[1][1];\n\nvar cond1 = (m1 === m2) & (a1 > a2);\nvar cond2 = (m1 === kozyr) & (m2 !== kozyr);\nif (cond1 || cond2) {\n\tprint('YES');\n} else {\n\tprint('NO');\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "691cc3a49e1f2044e0d8c20d7638b1f3", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "//var input = readline()\n\nvar ar = readline().split(' ').map(x => parseInt(x));\nvar a = ar[0], b = ar[1];\n\n\nif(a < b && Math.abs(a-b) == 1) {\n print(a +' '+ b);\n}\nelse if(a == 9 && b == 1) {\n print(9 +' '+ 10);\n}\nelse print(a == b ? a+'1' +' '+ b+'2' : -1);\n\n//", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bda3d0c140b927587370eab02c247400", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(' ').map(function(num) {\n return parseInt(num);\n});\n\n// var nums = [9, 4]\n\nfunction main() {\n if (nums[0] === nums[1]) {\n return write(nums[0] + '1' + ' ' + nums[1] + '2');\n } else if (nums[0] + 1 === nums[1]) {\n return write(nums[0] + '9' + ' ' + nums[1] + '0');\n } else if (nums[0] === 9 && nums[1] === 1) {\n return write(nums[0] + '9' + ' ' + nums[1] + '00')\n } else {\n return write('-1');\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9b8a4c445096e2622c1987fa42525657", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n const [a, b] = d.split(' ').map(Number);\n const diff = Math.abs(a - b);\n\n if (a === 9 && b === 1) {\n console.log(9, 10);\n }\n else if (diff > 1 || a > b) {\n console.log(-1);\n }\n else if (a === b) {\n console.log(`${a}1`, `${b}2`);\n }\n else {\n console.log(a, b);\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ce3c60abc63cb843b859b23797a752af", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(' ').map(function(num) {\n return parseInt(num);\n});\n\n// var nums = [9, 4]\n\nfunction main() {\n if (nums[0] === nums[1]) {\n return write(nums[0] + '1' + ' ' + nums[1] + '2');\n } else if (nums[0] + 1 === nums[1]) {\n return write(nums[0] + '9' + ' ' + nums[1] + '0');\n } else {\n return write('-1');\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "194418e00f160a64b634c8c4a585043d", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n const [a, b] = d.split(' ').map(Number);\n const diff = Math.abs(a - b);\n\n if (diff > 1 || a > b) {\n console.log(-1);\n }\n else if (a === b) {\n console.log(`${a}1`, `${b}2`);\n }\n else {\n console.log(a, b);\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "efd89b73e6a9f2547fbf03ea741eb272", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "//var input = readline()\n\nvar ar = readline().split(' ').map(x => parseInt(x));\nvar a = ar[0], b = ar[1];\n\nif(a < b && Math.abs(a-b) == 1) print(a +' '+ b);\nelse print(a == b ? a+'1' +' '+ b+'2' : -1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dd50d2a4c460a3f973701d5e50f5d16a", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "print(readline().length * 25 + 1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1aeae9e803627eac9e3d1f1c40430cfe", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function toi(x){return parseInt(x);}\n(function(){\n var s=readline();\n var dic={};\n var alpha=\"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n for(var i=0;i<=s.length;i++){\n\tvar l=s.substring(0,i);\n\tvar r=s.substring(i);\n\tfor(var j=0;j {\n console.log(26* (str.length + 1) - str.length);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d3505f2af7ade5e8aa634bf279f7d7d2", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false ;\n this.INPUT_FILE_NAME = \"sample.in\" ;\n this.OUTPUT_FILE_NAME = \"sample.out\" ;\n this.DO_OUTPUT_TO_FILE = false ;\n this.CLEAR_ARRAY_PER_CASE = false ;\n\n this.solveCase = function() {\n var res , i , j , fl , cn , a , b , c ;\n res = 26 ;\n cn = this.s.length ;\n for( i = 0 ; i < cn ; i++ ) {\n res += 25 ;\n }\n print( res ) ;\n } ;\n\n this.init = function() {\n this.lim1 = 100010 ;\n this.lim2 = 110 ;\n this.cc = 1 ;\n this.ind = 1 ;\n this.n = 0 ;\n this.cn = 0 ;\n this.declareAndFillArrays() ;\n } ;\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i ;\n hasMoreInput = true ;\n try {\n this.s = irObj.nextString() ;\n }\n catch( ex ) {\n hasMoreInput = false ;\n }\n return hasMoreInput ;\n } ;\n\n this.clearArraysPerCase = function() {\n var i ;\n this.arr = new Array() ;\n this.adjList = new Array() ;\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 ) ;\n this.adjList.push( new Array() ) ;\n }\n } ;\n\n this.clearPerCase = function() {\n this.cn = 0 ;\n this.cc++ ;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n } ;\n\n this.declareAndFillArrays = function() {\n var i , j ;\n this.srr = new Array() ;\n this.vis = new Array() ;\n this.arr = new Array() ;\n this.brr = new Array() ;\n this.memo = new Array() ;\n this.done = new Array() ;\n this.adjList = new Array() ;\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( '' ) ;\n this.vis.push( 0 ) ;\n this.arr.push( 0 ) ;\n this.brr.push( 0 ) ;\n this.adjList.push( new Array() ) ;\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() ) ;\n this.done.push( new Array() ) ;\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 ) ;\n this.done[ i ].push( 0 ) ;\n }\n }\n } ;\n\n this.init() ;\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array() ;\n this.currrentLineNumber = 0 ;\n this.currrentCharacterIndex = 0 ;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine ;\n while( true ) {\n try {\n singleLine = readline() ;\n if( singleLine == null ) {\n break ;\n }\n }\n catch( ex ) {\n break ;\n }\n this.allLines.push( singleLine ) ;\n }\n } ;\n\n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n } ;\n\n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n } ;\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n } ;\n\n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n } ;\n\n this.parseRawData = function( data ) {\n var len , i , currentString ;\n len = data.length ;\n currentString = '' ;\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString ) ;\n currentString = '' ;\n }\n else {\n currentString += data[ i ] ;\n }\n }\n if( currentString != '' ) {\n this.allLines.push( currentString ) ;\n }\n } ;\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData ;\n fsObj = require( 'fs' ) ;\n currentDirectory = __dirname ;\n if( currentDirectory.indexOf( 'D:' ) != -1 ) {\n //on windows\n inputFilePath = currentDirectory + '\\\\' + inputFileName ;\n }\n else {\n //on linux\n inputFilePath = currentDirectory + '/' + inputFileName ;\n }\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" ) ;\n this.parseRawData( rawData ) ;\n } ;\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx ;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++ ;\n this.currrentCharacterIndex = 0 ;\n }\n res = '' ;\n len = this.allLines[ this.currrentLineNumber ].length ;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++ ;\n this.currrentCharacterIndex = 0 ;\n return res ;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( 'No more tokens available!' ) ;\n }\n startIdx = -1 ;\n len = this.allLines[ this.currrentLineNumber ].length ;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i ;\n break ;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++ ;\n this.currrentCharacterIndex = 0 ;\n continue ;\n }\n res = '' ;\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i ;\n break ;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n }\n this.currrentCharacterIndex = endIdx ;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++ ;\n this.currrentCharacterIndex = 0 ;\n }\n return res ;\n }\n } ;\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) ) ;\n } ;\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) ) ;\n } ;\n\n this.nextString = function() {\n return this.next( 1 ) ;\n } ;\n\n this.nextLine = function() {\n return this.next( 0 ) ;\n } ;\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array() ;\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString ) ;\n } ;\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array() ;\n } ;\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath ;\n res = '' ;\n sz = this.resultantStringArray.length ;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += '\\n' ;\n }\n res += this.resultantStringArray[ i ] ;\n }\n fsObj = require( 'fs' ) ;\n currentDirectory = __dirname ;\n if( currentDirectory.indexOf( 'D:' ) != -1 ) {\n //on windows\n outputFilePath = currentDirectory + '\\\\' + outputFileName ;\n }\n else {\n //on linux\n outputFilePath = currentDirectory + '/' + outputFileName ;\n }\n fsObj.writeFileSync( outputFilePath , res ) ;\n this.clearPercase() ;\n } ;\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader() ;\n this.psObj = new ProblemSolver() ;\n this.fohObj = new FileOutputHandler() ;\n\n this.runCases = function() {\n var testCases , hasMoreTestCases , i ;\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt() ;\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase() ;\n this.psObj.getInput( this.irObj ) ;\n this.psObj.solveCase() ;\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase() ;\n hasMoreTestCases = this.psObj.getInput( this.irObj ) ;\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase() ;\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME ) ;\n }\n } ;\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && ( __dirname.indexOf( 'D:') != -1 || __dirname.indexOf( '/media/') != -1 ) ) {\n environmentType = 'local-node-js' ;\n }\n else {\n environmentType = 'server-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n } ;\n\n this.configureStreamsAndReadInput = function() {\n var localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log ;\n }\n }\n catch( ex ) {\n print = console.log ;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj ;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments ) ;\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME ) ;\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log ;\n }\n }\n catch( ex ) {\n print = console.log ;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines() ;\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino() ;\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines() ;\n this.runCases() ;\n }\n } ;\n\n this.configureStreamsAndReadInput() ;\n}\n\nnew CodeExecutioner() ;\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ea50caef21c6a79e5a0500060c4891d5", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n \nlet inputString = '';\nlet currentLine = 0;\n \nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n \nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n const t = Number(readLine())\n for (let _i = 0; _i < t; _i++) {\n const [n, k, l] = readLine().split(/\\s/).map(Number)\n const ds = readLine().split(/\\s/).map(Number)\n let result = true\n for (let i = 0; i < n; i++) {\n const d = ds[i]\n let tide = l - d\n if (tide < 0) {\n result = false\n break\n }\n if (tide >= k) {\n continue\n }\n let increasing = tide === 0\n let iDiff = 1\n while(i + iDiff < n) {\n tide = increasing ? tide + 1 : tide - 1\n if (tide === 0) {\n increasing = true\n }\n const _d = ds[i + iDiff]\n if (_d <= l - k) {\n break\n }\n if (_d + tide > l) {\n tide = l - _d\n if (increasing || tide < 0) {\n result = false\n break\n }\n if (tide === 0) {\n increasing = true\n }\n }\n iDiff++\n }\n if (!result) {\n break\n }\n i = i + iDiff\n }\n console.log(result ? 'Yes' : 'No')\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "63a9e210a6a754395ecddc243a7c0289", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n \nlet inputString = '';\nlet currentLine = 0;\n \nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n \nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n const t = Number(readLine())\n for (let _i = 0; _i < t; _i++) {\n const [n, k, l] = readLine().split(/\\s/).map(Number)\n const ds = readLine().split(/\\s/).map(Number)\n let result = true\n const repeats = Array(k).fill(0)\n for (const d of ds) {\n const index = d - (l - k + 1)\n if (index >= k) {\n result = false\n break\n }\n for (let i = 0; i < k; i++) {\n repeats[i] = i > index ? 0 : repeats[i] + 1\n if (repeats[i] > k - i) {\n result = false\n break\n }\n }\n if (!result) {\n break\n }\n }\n console.log(result ? 'Yes' : 'No')\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cf0181d75088fcd60b21170cb6d84164", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n \nlet inputString = '';\nlet currentLine = 0;\n \nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n});\n \nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n const t = Number(readLine())\n for (let _i = 0; _i < t; _i++) {\n const [n, k, l] = readLine().split(/\\s/).map(Number)\n const ds = readLine().split(/\\s/).map(Number)\n let result = true\n const repeats = Array(k).fill(0)\n for (const d of ds) {\n const index = d - (l - k + 1)\n if (index >= k) {\n result = false\n break\n }\n for (let i = 0; i < k; i++) {\n repeats[i] = index < 0 ? 0 : i > index ? repeats[i] : repeats[i] + 1\n if (repeats[i] > k - i) {\n result = false\n break\n }\n }\n if (!result) {\n break\n }\n }\n console.log(result ? 'Yes' : 'No')\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cc33d7d5a3e4ad23f838995ab9efae48", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "function main(){\n var line = readline().split(\" \").map(Number);\n var evenSteps = line[0];\n var oddSteps = line[1];\n\n if(evenSteps + oddSteps === 0)\n return \"NO\";\n\n if(Math.abs(evenSteps - oddSteps) < 2)\n return \"YES\";\n return \"NO\";\n}\n\nprint(main());\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fabfc7ae48546d64ed75c71228884b84", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var diff;\nvar set = readline().split(\" \").map(Number);\nif (set[0] > 0 && set[0] === set[1]) {\n\tprint(\"YES\");\n}\nelse {\n\tdiff = Math.max.apply(Math, set) - Math.min.apply(Math, set);\n\tif (diff === 1) {\n\t\tprint(\"YES\");\n\t}\n\telse {\n\t\tprint(\"NO\");\n\t}\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e3da145c3a0300cd378ffd158a655d5", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var s=readline().split (' ').map(Number);\nvar mf= (x,y)=>{var z =Math.abs(x-y); if (z<=1 && x+y>0) {return 'YES';} return 'NO';};\nvar p =mf.apply(null,s);\nprint (p);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1230a52503ebdf55550ba06f37708360", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var s=readline().split (' ').map(Number);\nvar mf= (x,y)=>{var z =Math.abs(x-y); if (z<=1) {return 'YES';} return 'NO';};\nvar p =mf.apply(null,s);\nprint(p);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6309adaff74aa97984b53f7e7b922f33", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var s=readline().split (' ').map(Number);\nvar mf= (x,y)=>{var z =Math.abs(x-y); if (z<=1 && (x!==0 && y!==0)) {return 'YES';} return 'NO';};\nvar p =mf.apply(null,s);\nprint(p);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "46d97de158f812ab9bd50cca08ff605b", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "print(function(x, y){\n\tvar dx = Math.abs(x);\n\tvar dy = Math.abs(y);\n\tvar d = dx+dy;\n\tvar a = [ d*x/dx, 0 ];\n\tvar b = [ 0, d*y/dy ];\n\treturn ( x<0 ? a.concat(b) : b.concat(a) ).join(' ');\n}.apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5f20e4f9e38862191d19fab68ee380f0", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\ta = data[0], b = data[1],\n\t\tx = Math.abs(a) + Math.abs(b),\n\t\ty = x;\n\tx *= a/Math.abs(a);\n\ty *= b/Math.abs(b);\n\tif (x < 0) {\n\t\tprint(x, 0, 0, y);\n\t} else {\n\t\tprint(0, y, x, 0);\n\t}\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "037db6e28fb0475bf45eb8b9f81e6441", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tvar n = readline().split(' ').map(Number);\n\tvar t = Math.abs(n[0]) + Math.abs(n[1]);\n\n\tif (n[0] > 0 && n[1] > 0) print( [0, t, t, 0].join(' ') );\n\telse if (n[0] < 0 && n[1] > 0) print( [-t, 0, 0, t].join(' ') );\n\telse if (n[0] < 0 && n[1] < 0) print( [-t, 0, 0, -t].join(' ') );\n\telse if (n[0] > 0 && n[1] < 0) print( [0, -t, t, 0].join(' ') );\n\n}).call(this)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fdb870257a04ce0471deb144fedbdf7e", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = readline().split(' ').map(Number);\nvar x1 = 0, y1 = 0, x2 = 0, y2 = 0;\nif (n[0] > 0) {\n x2 = n[0] + Math.abs(n[1]);\n if (n[1] > 0) y1 = x2;\n else y1 = -x2;\n} else {\n x1 = n[0] - Math.abs(n[1]);\n if (n[1] > 0) y2 = -x1;\n else y2 = x1;\n}\nprint(x1, y1, x2, y2);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1911391b7d9a72e0f841d17efae4962d", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var c1 = readline();\nvar c2 = readline();\nvar c3 = readline();\nvar c4 = readline();\n\nif (((c1 == c4) && (c1 > 0)) || \n ((c1 == 0) && (c4 == 0) && (c3 == 0))){\n print('1');\n}else{\n print('0');\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e2c5fadd8a6c2336b0e52effee27fb19", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var c1 = readline();\nvar c2 = readline();\nvar c3 = readline();\nvar c4 = readline();\n//if (c1 = c4) and (c1 > 0) or ( (c1 = 0) and (c4 = 0) and (c3 = 0)) then writeln('1') \n\nif ((c1 == c4) && (c1 > 0)) || ((c1 == 0) && (c4 == 0) && (c3 == 0)){\n print('1')\n}\nelse print('0');", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "4ffe186781b393462343f0be3153805a", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function (a, b, c) {\n\t\treturn f(a, b, c);\n\n\t\tfunction f (a, b, c) {\n\t\t\tif (a < 2 || b < 2 || c < 2) return a * b * c;\n\t\t\telse return (a + b + c - 3) * 2 + f(a - 1, b - 1, c - 1);\n\t\t}\n\t}.apply(null, readline().split(' ').map(Number)));\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1838bd6331858421fc3d3461de9643e3", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "print(function(a, b, c) {\n\treturn a * b + a * (c - 1) + (b - 1) * (c - 1);\n} .apply(0, readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "84650d41ed303a82fbe127cd810f0bc5", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function (a, b, c) {\n\t\tvar min = Math.min(a, b, c),\n\t\t\tmax = Math.max(a, b, c),\n\t\t\tmid = a + b + c - min - max;\n\n\t\treturn (a + b + c - 3) * 2 + (max - 1) * (mid - 1);\n\t}.apply(null, readline().split(' ').map(Number)));\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "587e228bc1111546601b1126731cda97", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function (a, b, c) {\n\t\tvar min = Math.min(a, b, c),\n\t\t\tmax = Math.max(a, b, c),\n\t\t\tmid = a + b + c - min - max;\n\n\t\treturn a * b * c - min * mid;\n\t}.apply(null, readline().split(' ').map(Number)));\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "768096937dfd2a852c94f42cb16fe207", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function (a, b, c) {\n\t\treturn f(a, b, c);\n\n\t\tfunction f (a, b, c) {\n\t\t\tif (a === 1 && b === 1 && c === 1) return 1;\n\t\t\tif (a === 0 || b === 0 || c === 0) return 0;\n\t\t\telse return (a + b + c - 3) * 2 + f(a - 1, b - 1, c - 1);\n\t\t}\n\t}.apply(null, readline().split(' ').map(Number)));\n}).call(this);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eb11ad9e23f6fa17968c1c99f10a6adb", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = readline();\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color !== '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print(arr);\n print('YES1');\n} else {\n\n if (testChange()) {\n print('YES2');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "da29f1f94cb7f63d10e5215818259561", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = readline();\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color !== '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print('YES1');\n} else {\n\n if (testChange()) {\n print('YES2');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "69a481d9be2a0a836aac180cec1dedc9", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n var line = readline();\n var lineChars = line.split('');\n for (var j = 0; j < lineChars.length; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = lineChars[j];\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color !== '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print('YES');\n} else {\n\n if (testChange()) {\n print('YES');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5c1bcbbabe535955dbc5f34564a477b6", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = readline();\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color !== '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print('YES');\n} else {\n\n if (testChange()) {\n print('YES');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f5bd07aa25f239a3e7223d61823b5d12", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar b = [];\n\n\tfor (var i = 0 ; i < 4; i++)\n\t\tb.push(readline().split('').map(function (e) { return e == '.' ? 2 : 3 }));\n\n\tfor (var i = 0; i < 2; i++)\n\t\tfor (var j = 0; j < 2; j++) {\n\t\t\tvar p = b[i][j] * b[i+1][j] * b[i][j+1] * b[i+1][j+1];\n\t\t\tif (p === 16 || p === 81 || p === 24 || p === 54) {\n\t\t\t\tprint('YES');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\tprint('NO');\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0a6f34889d4e373af0f323d78c78ff25", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n var line = readline();\n var lineChars = line.split('');\n for (var j = 0; j < lineChars.length; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = lineChars[j];\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color !== '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print('YES1');\n} else {\n\n if (testChange()) {\n print('YES2');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3ec776bc517bc76275ada55b54fca7fd", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "\"use strict\";\n\nfunction check(s) {\n for (var i = 0; i < 3; i++) {\n for (var j = 0; j < 3; j++) {\n var c = s[i][j];\n if (c == s[i][j+1] && c == s[i+1][j] && c == s[i+1][j+1]) return true;\n }\n }\n return false;\n}\n\nfunction flip(c) {\n if (c == \"#\") return \".\";\n else return \"#\";\n}\n\nvar s = []\nfor (var i = 0; i < 4; i++) s.push(readline().split(\"\"));\n\nvar ans = false;\nfor (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n s[i][j] = flip(s[i][j]);\n if (check(s)) ans = true;\n s[i][j] = flip(s[i][j]);\n }\n}\nprint(ans ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e30bc471bb20a137a662a3f1a67fd46a", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var arr = [];\nfor (var i = 0; i < 4; i++) {\n var line = readline();\n var lineChars = line.split('');\n for (var j = 0; j < lineChars.length; j++) {\n if (!arr[i]) {\n arr[i] = [];\n }\n arr[i][j] = lineChars[j];\n }\n}\n\nvar testPosition = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {\n return true;\n }\n return false;\n};\n\nvar testSquare = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (testPosition(i, j)) {\n return true;\n }\n }\n }\n};\n\nvar change = function(x, y) {\n if (x + 1 == 4 || y + 1 == 4) {\n return false;\n }\n var colors = {\n firstColor: {\n color: '',\n found: 0\n },\n secondColor: {\n color: '',\n found: 0\n }\n };\n colors.firstColor.color = arr[x][y];\n for (var ix = x; ix <= x + 1; ix++) {\n for (var jy = y; jy <= y + 1; jy++) {\n if (colors.firstColor.color === arr[ix][jy]) {\n colors.firstColor.found += 1;\n } else {\n if (colors.secondColor.color === '')\n colors.secondColor.color = arr[ix][jy];\n colors.secondColor.found += 1;\n }\n }\n }\n if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {\n return true;\n }\n return false;\n};\n\nvar testChange = function() {\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (change(i, j)) {\n return true;\n }\n }\n }\n};\n\nif (testSquare()) {\n print('YES');\n} else {\n\n if (testChange()) {\n print('YES');\n } else {\n print('NO');\n }\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4cd40c3adf0cc16ccfe1ecf34b5c350b", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar b = [];\n\n\tfor (var i = 0 ; i < 4; i++)\n\t\tb.push(readline().split('').map(function (e) { return e == '.' ? 2 : 3 }));\n\n\tfor (var i = 0; i < 3; i++)\n\t\tfor (var j = 0; j < 3; j++) {\n\t\t\tvar p = b[i][j] * b[i+1][j] * b[i][j+1] * b[i+1][j+1];\n\t\t\tif (p === 16 || p === 81 || p === 24 || p === 54) {\n\t\t\t\tprint('YES');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\tprint('NO');\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "87ff1482763001957705509dd099ba27", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(){\n\tvar a=[];\n\tfor(var i=0;i<4;i++){\n\t\ta.push(readline().split('').map(function(v){\n\t\t\treturn v==='#'?1:-1;\n\t\t}));\n\t}\n\tfor(var i=0;i<3;i++){\n\t\tfor(var j=0;j<3;j++){\n\t\t\tif(a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1]!==0)\n\t\t\t\treturn 'YES';\n\t\t}\n\t}\n\treturn 'NO';\n}());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9a91d13ff2e78e0f836e3b2d13c81aba", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar input = tokenizeIntegers(readline());\n\n\tfunction isRightTriangle(input) {\n\t\tvar squares = [];\n\t\tfor (var i = 0; i < 3; i += 1) {\n\t\t\tsquares.push(Math.pow(input[(2*i+2)%6]-input[2*i], 2) +\n\t\t\t\t\t Math.pow(input[(2*i+3)%6]-input[2*i+1], 2));\n\t\t}\n\t\tsquares.sort(function(a, b) {\n\t\t\treturn a-b;\n\t\t});\n\t\tif (squares[0] == 0) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (squares[2] == squares[1] + squares[0]);\n\t}\n\n\tif (isRightTriangle(input)) {\n\t\tprint(\"RIGHT\");\n\t\treturn;\n\t}\n\n\tvar dx = [0, 1, 0, -1], dy = [-1, 0, 1, 0];\n\tfor (var i = 0; i < 3; i += 1) {\n\t\tfor (var j = 0; j < 4; j += 1) {\n\t\t\tinput[2*i] += dx[j];\n\t\t\tinput[2*i+1] += dy[j];\n\t\t\tif (isRightTriangle(input)) {\n\t\t\t\tprint(\"ALMOST\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tinput[2*i] -= dx[j];\n\t\t\tinput[2*i+1] -= dy[j];\n\t\t}\n\t}\n\n\tprint(\"NEITHER\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "de4e11c40bcf2a33e252a41decb02661", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\n\nlet x1 = lll[0]\nlet y1 = lll[1]\nlet x2 = lll[2]\nlet y2 = lll[3]\nlet x3 = lll[4]\nlet y3 = lll[5]\n\nfunction is (x1, y1, x2, y2, x3, y3) {\n let ss = []\n ss.push(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))\n ss.push(Math.pow(x1 - x3, 2) + Math.pow(y1 - y3, 2))\n ss.push(Math.pow(x2 - x3, 2) + Math.pow(y2 - y3, 2))\n ss = ss.sort((a, b) => a - b)\n return ss[0] + ss[1] == ss[2]\n && !(x1 === x2 === x3) && !(y1 === y2 === y3)\n && !(x1 === x2 && y1 === y2 || x1 === x3 && y1 === y3 || x2 === x3 && y2 === y3)\n}\n\nfunction vars (x1, y1, x2, y2, x3, y3) {\n return [\n [x1 - 1, y1, x2, y2, x3, y3],\n [x1, y1 - 1, x2, y2, x3, y3],\n [x1, y1, x2 - 1, y2, x3, y3],\n [x1, y1, x2, y2 - 1, x3, y3],\n [x1, y1, x2, y2, x3 - 1, y3],\n [x1, y1, x2, y2, x3, y3 - 1],\n [x1 + 1, y1, x2, y2, x3, y3],\n [x1, y1 + 1, x2, y2, x3, y3],\n [x1, y1, x2 + 1, y2, x3, y3],\n [x1, y1, x2, y2 + 1, x3, y3],\n [x1, y1, x2, y2, x3 + 1, y3],\n [x1, y1, x2, y2, x3, y3 + 1]\n ]\n}\n\n(function () {\n if (is(x1, y1, x2, y2, x3, y3)) return print('RIGHT')\n if (vars(x1, y1, x2, y2, x3, y3).some(v => is.apply(null, v))) return print('ALMOST')\n print('NEITHER')\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6d391362af9c1d090a643ae11d7a6fd8", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\n\nlet x1 = lll[0]\nlet y1 = lll[1]\nlet y2 = lll[2]\nlet x2 = lll[3]\nlet y3 = lll[4]\nlet x3 = lll[5]\n\nfunction is (x1, y1, x2, y2, x3, y3) {\n let ss = []\n ss.push(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))\n ss.push(Math.pow(x1 - x3, 2) + Math.pow(y1 - y3, 2))\n ss.push(Math.pow(x2 - x3, 2) + Math.pow(y2 - y3, 2))\n ss = ss.sort((a, b) => a - b)\n return ss[0] + ss[1] == ss[2]\n}\n\nfunction vars (x1, y1, x2, y2, x3, y3) {\n return [\n [x1 - 1, y1, x2, y2, x3, y3],\n [x1, y1 - 1, x2, y2, x3, y3],\n [x1, y1, x2 - 1, y2, x3, y3],\n [x1, y1, x2, y2 - 1, x3, y3],\n [x1, y1, x2, y2, x3 - 1, y3],\n [x1, y1, x2, y2, x3, y3 - 1],\n [x1 + 1, y1, x2, y2, x3, y3],\n [x1, y1 + 1, x2, y2, x3, y3],\n [x1, y1, x2 + 1, y2, x3, y3],\n [x1, y1, x2, y2 + 1, x3, y3],\n [x1, y1, x2, y2, x3 + 1, y3],\n [x1, y1, x2, y2, x3, y3 + 1]\n ]\n}\n\n(function () {\n if (is(x1, y1, x2, y2, x3, y3)) return print('RIGHT')\n if (vars(x1, y1, x2, y2, x3, y3).some(v => is.apply(null, v))) return print('ALMOST')\n print('NEITHER')\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0e80623f74bdba10fef15a4c40991965", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\n\nlet x1 = lll[0]\nlet y1 = lll[1]\nlet x2 = lll[2]\nlet y2 = lll[3]\nlet x3 = lll[4]\nlet y3 = lll[5]\n\nfunction is (x1, y1, x2, y2, x3, y3) {\n let ss = []\n ss.push(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))\n ss.push(Math.pow(x1 - x3, 2) + Math.pow(y1 - y3, 2))\n ss.push(Math.pow(x2 - x3, 2) + Math.pow(y2 - y3, 2))\n ss = ss.sort((a, b) => a - b)\n return ss[0] + ss[1] == ss[2]\n}\n\nfunction vars (x1, y1, x2, y2, x3, y3) {\n return [\n [x1 - 1, y1, x2, y2, x3, y3],\n [x1, y1 - 1, x2, y2, x3, y3],\n [x1, y1, x2 - 1, y2, x3, y3],\n [x1, y1, x2, y2 - 1, x3, y3],\n [x1, y1, x2, y2, x3 - 1, y3],\n [x1, y1, x2, y2, x3, y3 - 1],\n [x1 + 1, y1, x2, y2, x3, y3],\n [x1, y1 + 1, x2, y2, x3, y3],\n [x1, y1, x2 + 1, y2, x3, y3],\n [x1, y1, x2, y2 + 1, x3, y3],\n [x1, y1, x2, y2, x3 + 1, y3],\n [x1, y1, x2, y2, x3, y3 + 1]\n ]\n}\n\n(function () {\n if (is(x1, y1, x2, y2, x3, y3)) return print('RIGHT')\n if (vars(x1, y1, x2, y2, x3, y3).some(v => is.apply(null, v))) return print('ALMOST')\n print('NEITHER')\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3050aa1bdb4c84ef913ba404cb19c17e", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar input = tokenizeIntegers(readline());\n\n\tfunction isRightTriangle(input) {\n\t\tvar squares = [];\n\t\tfor (var i = 0; i < 3; i += 1) {\n\t\t\tsquares.push(Math.pow(input[(2*i+2)%6]-input[2*i], 2) +\n\t\t\t\t\t Math.pow(input[(2*i+3)%6]-input[2*i+1], 2));\n\t\t}\n\t\tsquares.sort(function(a, b) {\n\t\t\treturn a-b;\n\t\t});\n\t\treturn (squares[2] == squares[1] + squares[0]);\n\t}\n\n\tif (isRightTriangle(input)) {\n\t\tprint(\"RIGHT\");\n\t\treturn;\n\t}\n\n\tvar dx = [0, 1, 0, -1], dy = [-1, 0, 1, 0];\n\tfor (var i = 0; i < 3; i += 1) {\n\t\tinput[2*i] += dx[i];\n\t\tinput[2*i+1] += dy[i];\n\t\tif (isRightTriangle(input)) {\n\t\t\tprint(\"ALMOST\");\n\t\t\treturn;\n\t\t}\n\t\tinput[2*i] -= dx[i];\n\t\tinput[2*i+1] -= dy[i];\n\t}\n\n\tprint(\"NEITHER\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "23d361b6ecdca4f1636972a6d42b993f", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var n=+readline();\nvar s=readline();\nvar ans=0;\ns.replace(/B/g, function(_, i){\n\tans+=Math.pow(2, i);\n});\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "afa2ce908dabfa6781490105609b2b50", "src_uid": "d86a1b5bf9fe9a985f7b030fedd29d58", "difficulty": null} {"lang": "JavaScript", "source_code": "var ans=0;\nreadline();\nreadline().replace(/B/g, function(_, i){\n\tans+=Math.pow(2, i);\n});\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "27f1ec044ad6b48ec5d8eb0fee4df3f1", "src_uid": "d86a1b5bf9fe9a985f7b030fedd29d58", "difficulty": null} {"lang": "JavaScript", "source_code": "var ans=0;\nreadline();\nreadline().replace(/B/g, function(_, i){\n\tans+=1< nextSum) return n;\n\tif(currentSum < nextSum) return nextNumber;\n\treturn Math.max(n, nextNumber);\n}\n\nfunction getDigitsSum(digits) {\n\tif(!Array.isArray(digits)) digits = (\"\" + digits).split(\"\");\n\treturn digits.reduce(function (sum, n) {\n\t\treturn sum + 1*n;\n\t}, 0);\n}\n\nprint(findMax(x));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8d4d18c906274495a69406658a21f894", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var data = [];\n\ndata.push(readline());\n\nfunction sum(n) {\n return n.split('').map(function (d) {\n return parseInt(d);\n }).reduce(function (s, d) {\n return s + d;\n });\n}\n\nfunction solve() {\n var n1 = data[0];\n if (n1.length === 1) {\n return print(n1);\n }\n var s1 = sum(n1);\n var first = parseInt(n1[0]) - 1;\n var l = n1.length - 1;\n var newN = '9'.repeat(l);\n if (first !== 0) {\n newN = first + newN;\n }\n var s2 = sum(newN);\n print(s2 > s1 ? newN : n1);\n}\n\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "824cdd3a6c70f6e9638814c380e90cf9", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var xString = readline();\n\nfunction findMax(nString) {\n\tvar digits = nString.split(\"\"),\n\t\tcurrentSum = getDigitsSum(digits),\n\t\tprevBit = digits[0] - 1 > 0 ? digits[0] - 1 : \"\",\n\t\tnextNumberString = prevBit + (new Array(digits.length)).join(\"9\"),\n\t\tnextSum = getDigitsSum(nextNumberString);\n\n\tif(currentSum > nextSum) return nString;\n\tif(currentSum < nextSum) return nextNumberString;\n\treturn +nextNumberString > +nString ? nextNumberString : nString;\n}\n\nfunction getDigitsSum(digits) {\n\tif(!Array.isArray(digits)) digits = (\"\" + digits).split(\"\");\n\treturn digits.reduce(function (sum, n) {\n\t\treturn sum + 1*n;\n\t}, 0);\n}\n\nprint(findMax(xString));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f443b193e5339c8412329e07b3f82e6f", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var data = [];\n\ndata.push(readline());\n\nfunction sum(n) {\n return n.split('').map(function (d) {\n return parseInt(d);\n }).reduce(function (s, d) {\n return s + d;\n });\n}\n\nfunction solve() {\n var n1 = data[0];\n var s1 = sum(n1);\n var first = parseInt(n1[0]) - 1;\n var l = n1.length - 1;\n var newN = '9'.repeat(l);\n if (first !== 0) {\n newN = first + newN;\n }\n var s2 = sum(newN);\n print(s2 > s1 ? newN : n1);\n}\n\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "40847cac70ac824a642bf14e1f758dfe", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var line = readline().split(\" \"),\n digits = [],\n a = line[0],\n count = a.length,\n maxDigit = count-1, // \u043a\u0440\u0430\u0439\u043d\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u043d\u0430\u0447\u0430\u0442\u044c\n countD = 0,\n newLine = a.split(\"\"); \n\n\nfunction sumDigits(number) {\n var s = 0;\n for (var c in number) {\n s += +number[c];\n }\n return s;\n};\n\ndigits.push(a);\nwhile (countD < count) {\n for (var i = 0; i < count; i++) { \n newLine[maxDigit] = 9; // \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 9 \u0442\u0435\u043a\u0443\u0449\u0443\u044e 48 -> 49\n countD++; // \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0434\u0435\u0432\u044f\u0442\u043e\u043a\n newLine[(maxDigit-1)] = (new Number(newLine[maxDigit - 1]) > 0 ? --newLine[maxDigit - 1] : 0); // 49 -> 39\n --maxDigit; // \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442 \u043a\u0440\u0430\u0439\u043d\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441 \u043a\u0440\u0430\u044f\n var n = newLine.join(\"\");\n (n <= line ? digits.push(n.replace(/^0+/img, \"\")) : \"\");\n }\n}\n\nvar max = sumDigits(digits[0]), maxValue = digits[0];\nfor (var i = 1, l = digits.length; i < l; ++i) {\n var item = sumDigits(digits[i]);\n if (max < item) {\n max = item;\n \n maxValue = digits[i];\n }\n}\n\nprint(maxValue);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5f8afa43d2a967a6bdd3871f729ce0c4", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = readline().trim() + \"\";\n\nfunction sumOfDigitsInNumber(k){\n var s = 0;\n var a = k.split(\"\").map((h) => {s += +h;})\n return s;\n}\n\nfunction doingSmthWithNumberIDontKnowWhy(n){\n var k = n.split(\"\").reverse();\n var min = false;\n for(var i = 0; i < k.length; i++){\n if(k[i] != \"9\" && !min && i != k.length - 1){\n k[i] = 9;\n min = true;\n }else if(min){\n if(k[i] == \"0\"){\n k[i] = 9;\n }else{\n k[i] = (+k[i] - 1) + \"\";\n break;\n }\n }\n }\n \n if(k[k.length - 1] == \"0\"){\n k = k.reverse().join(\"\").substr(1, k.length);\n }else{\n k = k.reverse().join(\"\");\n }\n \n return (k == n ? \"-\" : k);\n}\n\nvar a = [];\nvar r = 0;\nvar t = n;\nvar max = 0;\nwhile(t != \"-\"){\n a[r] = [t, sumOfDigitsInNumber(t)];\n t = doingSmthWithNumberIDontKnowWhy(t);\n r++;\n}\n\n\na.sort((a, b) => {\n if(a[1] < b[1]){\n return 1\n }else{\n return -1;\n }\n return 0;\n})\n\nvar b = [];\nvar j = 0;\nfor(var i = 0; i < r; i++){\n if(a[0][1] == a[i][1]){\n b[j] = a[i];\n j++;\n if(max < a[i][0].length){\n max = a[i][0].length;\n }\n }\n}\n\nvar c = [];\nr = 0;\nfor(var i = 0; i < j; i++){\n if(b[i][0].length == max){\n c[r] = a[i];\n r++;\n }\n}\n\n\nfor(var i = 0; i < max; i++){\n var max_digit = 0;\n \n for(var j = 0; j < r; j++){\n if(+c[j][0][i] > max_digit) max_digit = +c[j][0][i];\n }\n \n \n max_digit = max_digit + \"\";\n for(var j = 0; j < r; j++){\n if(c[j][0][i] != max_digit){\n c.splice(j, 1);\n r--;\n }\n }\n \n}\n\nprint(c[0][0]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "28cbd0b5a6017d1d06a2b7e4f1a5e7d7", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "'use strict';\n\nvar data = [];\n\ndata.push(readline())\n\nfunction sum(n) {\n return n.split('').map(function (d) {\n return parseInt(d);\n }).reduce(function (s, d) {\n return s + d;\n });\n}\n\nfunction minus1(s, i) {\n if (!s) return '';\n if (s[i] === '0') {\n return rem0(minus1(s.substring(0, i), i - 1) + '9' + '9'.repeat(s.substring(i + 1).length));\n } else {\n return rem0(s.substring(0, i) + String(parseInt(s[i]) - 1) + '9'.repeat(s.substring(i + 1).length));\n }\n}\nfunction rem0(s) {\n var i = 0;\n while (s[i] === '0') {\n i++;\n }\n return s.substring(i);\n}\n\nfunction solve() {\n var n1 = data[0];\n if (n1.length === 1) {\n return print(n1);\n }\n var s1 = sum(n1);\n var s2 = 0;\n var n2 = void 0;\n for (var i = 0; i < n1.length - 1; i++) {\n var s9 = minus1(n1, i);\n var s9s = sum(s9);\n if (s9s >= s2) {\n s2 = s9s;\n n2 = s9;\n }\n }\n\n print(s2 > s1 ? n2 : n1);\n}\n\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "15ddc5b122ceb67ce0fd98d6599ce832", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var xString = readline(),\n\tdigits = xString.split(\"\"),\n\txLength = xString.length,\n\tmaxSum = getDigitsSum(xString),\n\tmaxNumber = xString,\n\tnewNumber, newDigits, newSum, nineDigits;\n\n\nfor(var i = 0; i < xLength; i++) {\n\tnineDigits = (new Array(xLength - i)).join(\"9\").split(\"\");\n\tnewDigits = digits.slice(0, i + 1).concat(nineDigits);\n\n\tif(--newDigits[i] < 0 && i) continue;\n\tnewDigits[i] = (!i && newDigits[i] <= 0) ? \"\" : \"\" + newDigits[i];\n\n\tnewNumber = newDigits.join(\"\");\n\tnewSum = getDigitsSum(newDigits);\n\n\tif(newSum > maxSum || (newSum == maxSum && +newNumber > +maxNumber)) {\n\t\tmaxNumber = newNumber;\n\t\tmaxSum = newSum;\n\t}\n}\n\nfunction getDigitsSum(digits) {\n\tif(!Array.isArray(digits)) digits = (\"\" + digits).split(\"\");\n\treturn digits.reduce(function (sum, n) {\n\t\treturn sum + 1*n;\n\t}, 0);\n}\n\nprint(maxNumber);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a7138149387b1645973245ad87952e41", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var g = [\"Washington\", \"Adams\", \"Jefferson\", \"Madison\", \"Monroe\"\n, \"Adams\", \"Jackson\", \"Van Buren\", \"Harrison\", \"Tyler\", \"Polk\", \"Taylor\",\n\"Fillmore\", \"Pierce\", \"Buchanan\", \"Lincoln\", \"Johnson\", \"Grant\", \"Hayes\",\n\"Garfield\", \"Arthur\", \"Cleveland\", \"Harrison\", \"Cleveland\", \"McKinley\",\n\"Roosevelt\", \"Taft\", \"Wilson\", \"Harding\", \"Coolidge\", \"Hoover\", \"Roosevelt\",\n\"Truman\", \"Eisenhower\", \"Kennedy\", \"Johnson\", \"Nixon\", \"Ford\", \"Carter\", \"Reagan\", \"Bush\", \"Clinton\", \"Bush\", \"Obama\"];\nvar c = readline();\nprint(g[c-1])", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5d5cd3bc9228e6ae4080d9816eaac37d", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function (n) {\n\n\t\tfor (var i = 1; i <= 4; i++) {\n\t\t\tvar l = readline().split(' ').map(Number),\n\t\t\t\tx = Math.min(l[0], l[1]),\n\t\t\t\ty = Math.min(l[2], l[3]);\n\n\t\t\tif (x + y <= n) {\n\t\t\t\treturn [i, x, n - x].join(' ');\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\n\t}(+readline()));\n}.call(this));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "85b1025e034f6651a4165348f85fc038", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(n) {\n\n\tfor (var i = 0; i < 4; i++) {\n\t\tvar a = readline().split(' ').map(Number);\n\t\tfor (var x = 0; x <= 1; x++) for (var y = 2; y <= 3; y++)\n\t\t\t\tif (a[x] + a[y] <= n)\n\t\t\t\t\treturn [i + 1, a[x], n - a[x]].join(' ');\n\t}\n\n\treturn -1;\n\n}(+readline()));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9290a80499a12b9d13c6329792c53e1b", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(n) {\n\n\tfor (var i = 0; i < 4; i++) {\n\t\tvar a = readline().split(' ').map(Number);\n\t\tfor (var x = 0; x <= 1; x++)\n\t\t\tfor (var y = 2; y <= 3; y++)\n\t\t\t\tif (a[x] + a[y] <= n) return [i + 1, a[x], n - a[x]].join(' ');\n\t}\n\n\treturn -1;\n\n}(+readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "35b8af1e7b046b7fceff1505fe185bf0", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "print(function(n) {\n\n\tfor (var i = 0; i < 4; i++) {\n\t\tvar a = readline().split(' ').map(Number);\n\t\tfor (var x = 0; x <= 1; x++)\n\t\t\tfor (var y = 2; y <= 3; y++)\n\t\t\t\tif (a[x] + a[y] <= n) return [i + 1, a[x], n - a[y]].join(' ');\n\t}\n\n\treturn -1;\n\n}(+readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3da71dc39cafc7db5b9832806a923101", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function Stack(){this.a=[]}function Queue(){this.l=new Stack,this.r=new Stack}function Reader(){this.b=[],this.c=0}function Writer(){this.l=[\"\"],this.c=0}Array.prototype.back=function(){return this[this.length-1]},Math.gcd=function(t,i){return i?gcd(i,t%i):t},Math.lcm=function(t,i){return t/gcd(t,i)*i},Math.sign=function(t){return(t>0)-(0>t)},Math.cmp=function(t,i){return(+t>+i)-(+i>+t)},Math.icmp=function(t,i){return(+i>+t)-(+t>+i)},Stack.prototype.empty=function(){return 0==this.a.length},Stack.prototype.push=function(t){this.a.push(t)},Stack.prototype.pop=function(){return this.empty()?void 0:this.a.pop()},Stack.prototype.top=function(){return this.empty()?void 0:this.a[this.a.length-1]},Stack.prototype.clear=function(){this.a=[]},Stack.prototype.size=function(){return this.a.length},Queue.prototype.push=function(t){this.l.push(t)},Queue.prototype.empty=function(){return this.r.empty()&&this.l.empty()},Queue.prototype.pop=function(){if(this.r.empty())for(;!this.l.empty();)this.r.push(this.l.pop());return this.r.empty()?void 0:this.r.pop()},Queue.prototype.front=function(){if(this.r.empty())for(;!this.l.empty();)this.r.push(this.l.pop());return this.r.empty()?void 0:this.r.top()},Queue.prototype.size=function(){return l.size()+r.size()},Queue.prototype.clear=function(){l.clear(),r.clear()},Reader.prototype.next=function(){return this.c==this.b.length&&(this.c=0,this.b=readline().split(\" \")),this.b[this.c++]},Writer.prototype.print=function(t){this.l[this.c]+=t},Writer.prototype.println=function(t){this.l[this.c]+=t,this.l.push(\"\"),++this.c},Writer.prototype.flush=function(){print(this.l.join(\"\\n\")),this.l=[]};\n\nfunction main(cin, cout)\n{\n var n = +cin.next();\n var k1 = +cin.next();\n var q1 = new Queue();\n var q2 = new Queue();\n var t;\n for(var i = 0; i < k1; ++i)\n {\n t = +cin.next();\n q1.push(t);\n }\n var k2 = +cin.next();\n for(var i = 0; i < k2; ++i)\n {\n t = +cin.next(); \n q2.push(t);\n }\n var iter = 0;\n var c1, c2;\n \n while(!q1.empty() && !q2.empty())\n {\n c1 = q1.front();\n q1.pop();\n c2 = q2.front();\n q2.pop();\n if (c1 > c2)\n {\n q1.push(c2);\n q1.push(c1);\n } else\n {\n q2.push(c1);\n q2.push(c2);\n }\n iter++;\n if (iter == 10000000)\n break;\n }\n if (iter == 10000000)\n cout.print(\"-1\");\n else\n cout.print(iter + \" \" + (q1.empty() ? 2 : 1));\n}\n\nvar cin = new Reader();\nvar cout = new Writer(); \n\nmain(cin, cout);\n\ncout.flush();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "429577392ac53ed69a570b99d3a5d93c", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n this.CLEAR_ARRAY_PER_CASE = false;\n \n this.rec = function( arr , brr , firstFlag ) {\n \tvar res , r1 , newArr , newBrr , fl , sz , i , sz1 , sz2 ;\n \tif( firstFlag == false && arr.length == this.baseCaseArr.length && brr.length == this.baseCaseBrr.length ) {\n \t\tfl = 1 ;\n \t\tsz = arr.length ;\n \t\tfor( i = 0 ; i < sz ; i++ ) {\n \t\t\tif( arr[ i ] != this.baseCaseArr[ i ] ) {\n \t\t\t\tfl = 0 ;\n \t\t\t\tbreak ;\n \t\t\t}\n \t\t}\n \t\tsz = brr.length ;\n \t\tfor( i = 0 ; i < sz ; i++ ) {\n \t\t\tif( brr[ i ] != this.baseCaseBrr[ i ] ) {\n \t\t\t\tfl = 0 ;\n \t\t\t\tbreak ;\n \t\t\t}\n \t\t}\n \t\tif( fl == 1 ) {\n \t\t\treturn -1 ;\n \t\t}\n \t}\n \tif( arr.length == 0 ) {\n \t\tthis.winner = 2 ;\n \t\treturn 0 ;\n \t}\n \tif( brr.length == 0 ) {\n \t\tthis.winner = 1 ;\n \t\treturn 0 ;\n \t}\n \tnewArr = [] ;\n \tnewBrr = [] ;\n \tsz1 = arr.length ;\n \tsz2 = brr.length ;\n \tfor( i = 1 ; i < sz1 ; i++ ) {\n\t\t\tnewArr.push( arr[ i ] ) ;\n\t\t}\n\t\tfor( i = 1 ; i < sz2 ; i++ ) {\n\t\t\tnewBrr.push( brr[ i ] ) ;\n\t\t}\n \tif( arr[ 0 ] > brr[ 0 ] ) {\n \t\tnewArr.push( brr[ 0 ] ) ;\n \t\tnewArr.push( arr[ 0 ] ) ;\n \t}\n \telse {\n \t\tnewBrr.push( arr[ 0 ] ) ;\n \t\tnewBrr.push( brr[ 0 ] ) ;\n \t}\n \tr1 = this.rec( newArr , newBrr , false ) ;\n \tif( r1 == -1 ) {\n \t\tres = -1 ;\n \t}\n \telse {\n \t\tres = r1 + 1 ;\n \t}\n \treturn res ;\n } ;\n\n this.solveCase = function() {\n var res , i , j , fl , cn , temp ;\n res = 0 ;\n this.baseCaseArr = [] ;\n for( i = 0 ; i < this.k1 ; i++ ) {\n \tthis.baseCaseArr.push( this.arr[ i ] ) ;\n }\n this.baseCaseBrr = [] ;\n for( i = 0 ; i < this.k2 ; i++ ) {\n \tthis.baseCaseBrr.push( this.brr[ i ] ) ;\n }\n this.winner = -1 ;\n res = this.rec( this.arr , this.brr , true ) ;\n if( res == -1 ) {\n \tprint( res );\n }\n else {\n \tprint( res + ' ' + this.winner );\n }\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.n = irObj.nextInt();\n this.k1 = irObj.nextInt();\n this.arr = [] ;\n for( i = 0 ; i < this.k1 ; i++ ) {\n this.arr.push( irObj.nextInt() ) ;\n }\n this.brr = [] ;\n this.k2 = irObj.nextInt();\n for( i = 0 ; i < this.k2 ; i++ ) {\n this.brr.push( irObj.nextInt() ) ;\n }\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.adj_list.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n };\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adj_list.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 );\n this.done[ i ].push( 0 );\n }\n }\n };\n\n this.init();\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n \n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n };\n \n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n };\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n };\n \n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n res = \"\";\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );\n }\n }\n this.currrentCharacterIndex = endIdx;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n return this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCases = function() {\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {\n environmentType = 'local-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n };\n\n this.configureStreamsAndReadInput = function() {\n var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino();\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n };\n \n this.configureStreamsAndReadInput();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "25a98fbba9897b2d776e0b896e11b500", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(function () {\n\tvar lines = readline().split(' ').map(function (e) {\n\t\treturn parseInt(e);\n\t});\n\tvar n = lines[0],\n\t\tt = lines[1];\n\tvar a = [{\n\t\tx: t,\n\t\ty: 1\n\t}];\n\tvar cnt = 0,nxt;\n\tfor(var i=0;i=a[j].y) {\n\t\t\t\t++cnt;\n\t\t\t} else {\n\t\t\t\ttmp.x = 0;\n\t\t\t}\n\t\t\tif(j) {\n\t\t\t\tnxt[j].x += tmp.x;\n\t\t\t} else {\n\t\t\t\tnxt.push({\n\t\t\t\t\tx: tmp.x,\n\t\t\t\t\ty: tmp.y\n\t\t\t\t});\n\t\t\t}\n\t\t\tnxt.push(tmp);\n\t\t}\n\t\ta = nxt;\n\t}\n\tprint(cnt);\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "20ea790f1d8d3c5b2fec586a743caf9e", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function main() {\n var input = readline().split(' ').map(Number);\n var n = input[0];\n var t = input[1];\n \n var count = 0;\n \n function isBigEnough(element, index, array) {\n return element >= 1;\n }\n \n var array = [t];\n count += array.filter(isBigEnough).length;\n for (var i = 2; i <= n; ++i) {\n var next_array = [];\n for (var j = 0; j < i; ++j) {\n var value = 0;\n if (j - 1 >= 0) {\n value += Math.max(0, array[j - 1] - 1);\n }\n if (j < array.length) {\n value += Math.max(0, array[j] - 1);\n }\n value /= 2;\n next_array.push(value);\n }\n array = next_array;\n count += array.filter(isBigEnough).length;\n }\n \n print(count);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5458df87e51d05d171e57cc027a26067", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var data = readline().split(\" \"),\n\n height = +data[0],\n time = +data[1],\n \n swap = [],\n level,\n gid = 1;\n \nfunction Glass(level, left, right) {\n this.value = 0;\n this.level = level;\n this.left = left;\n this.right = right;\n this.id = gid++;\n};\n\nGlass.prototype.toString = function() {\n return \"{ level = \" + this.level + \", inner = [ \" + this.left + \" , \" + this.right + \" ] }\"\n};\n\nGlass.prototype.add = function(v) {\n if (this.value < 1) {\n this.value += v;\n } else {\n if (this.getLeft()) {\n this.getLeft().add(v / 2);\n };\n if (this.getRight()) {\n this.getRight().add(v / 2);\n };\n };\n return this;\n};\n\nGlass.prototype.getLeft = function() {\n if (!swap[this.level + 1]) {\n return;\n };\n return swap[this.level + 1][this.left];\n}\n\nGlass.prototype.getRight = function() {\n if (!swap[this.level + 1]) {\n return;\n };\n return swap[this.level + 1][this.right];\n}\n \nfor (var i = 1; i <= height; ++i) {\n level = [];\n for (var j = 0; j < i; ++j) {\n level.push(new Glass(i - 1, j, j + 1));\n };\n swap.push(level);\n}\n\nfor (var i = 0; i < time; ++i) {\n swap[0][0].add(1);\n};\n\nvar result = 0;\n\nfor (var i = 0; i < swap.length; ++i) {\n for (var j = 0; j < swap[i].length; ++j) {\n if (swap[i][j].value == 1) {\n result++;\n };\n };\n};\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9586097ecb93eae22c8bc9d05e6161d5", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var data = readline().split(\" \"),\n\n height = +data[0],\n time = +data[1],\n \n swap = [],\n level,\n gid = 1;\n \nfunction Glass(level, left, right) {\n this.value = 0;\n this.level = level;\n this.left = left;\n this.right = right;\n this.id = gid++;\n};\n\nGlass.prototype.toString = function() {\n return \"{ level = \" + this.level + \", inner = [ \" + this.left + \" , \" + this.right + \" ] }\"\n};\n\nGlass.prototype.add = function(v) {\n if (this.value < 1) {\n this.value += v;\n } else {\n this.getLeft().add(v / 2);\n this.getRight().add(v / 2);\n };\n return this;\n};\n\nGlass.prototype.getLeft = function() {\n if (!swap[this.level + 1]) {\n return;\n };\n return swap[this.level + 1][this.left];\n}\n\nGlass.prototype.getRight = function() {\n if (!swap[this.level + 1]) {\n return;\n };\n return swap[this.level + 1][this.right];\n}\n \nfor (var i = 1; i <= height; ++i) {\n level = [];\n for (var j = 0; j < i; ++j) {\n level.push(new Glass(i - 1, j, j + 1));\n };\n swap.push(level);\n}\n\nfor (var i = 0; i < time; ++i) {\n swap[0][0].add(1);\n};\n\nvar result = 0;\n\nfor (var i = 0; i < swap.length; ++i) {\n for (var j = 0; j < swap[i].length; ++j) {\n if (swap[i][j].value == 1) {\n result++;\n };\n };\n};\n\nprint(result);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9da7ed061e28506dc48d5d1293d5d35e", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function substract(a, b) {\n if (a === 0 || b === 0) {\n return { a, b };\n } else if (a >= 2 * b) {\n a = a - 2 * b;\n return substract(a, b);\n } else if (b >= 2 * a) {\n b = b - 2 * a;\n return substract(a, b);\n } else {\n return { a, b };\n }\n}\n\nconst nd = readline().split(' ');\n\nconst result = substract(nd[0], nd[1]);\n\nprint(result.a + ' ' + result.b + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c4b118001d3c42057531cd7a4915a63b", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var bigInt = (function(undefined) {\n 'use strict';\n var BASE = 1e7,\n LOG_BASE = 7,\n MAX_INT = 9007199254740992,\n MAX_INT_ARR = smallToArray(MAX_INT),\n LOG_MAX_INT = Math.log(MAX_INT);\n function Integer(v, radix) {\n if (typeof v === 'undefined') return Integer[0];\n if (typeof radix !== 'undefined')\n return +radix === 10 ? parseValue(v) : parseBase(v, radix);\n return parseValue(v);\n }\n function BigInteger(value, sign) {\n this.value = value;\n this.sign = sign;\n this.isSmall = false;\n }\n BigInteger.prototype = Object.create(Integer.prototype);\n function SmallInteger(value) {\n this.value = value;\n this.sign = value < 0;\n this.isSmall = true;\n }\n SmallInteger.prototype = Object.create(Integer.prototype);\n function isPrecise(n) {\n return -MAX_INT < n && n < MAX_INT;\n }\n function smallToArray(n) {\n if (n < 1e7) return [n];\n if (n < 1e14) return [n % 1e7, Math.floor(n / 1e7)];\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\n }\n function arrayToSmall(arr) {\n trim(arr);\n var length = arr.length;\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\n switch (length) {\n case 0:\n return 0;\n case 1:\n return arr[0];\n case 2:\n return arr[0] + arr[1] * BASE;\n default:\n return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\n }\n }\n return arr;\n }\n function trim(v) {\n var i = v.length;\n while (v[--i] === 0);\n v.length = i + 1;\n }\n function createArray(length) {\n var x = new Array(length);\n var i = -1;\n while (++i < length) {\n x[i] = 0;\n }\n return x;\n }\n function truncate(n) {\n if (n > 0) return Math.floor(n);\n return Math.ceil(n);\n }\n function add(a, b) {\n var l_a = a.length,\n l_b = b.length,\n r = new Array(l_a),\n carry = 0,\n base = BASE,\n sum,\n i;\n for (i = 0; i < l_b; i++) {\n sum = a[i] + b[i] + carry;\n carry = sum >= base ? 1 : 0;\n r[i] = sum - carry * base;\n }\n while (i < l_a) {\n sum = a[i] + carry;\n carry = sum === base ? 1 : 0;\n r[i++] = sum - carry * base;\n }\n if (carry > 0) r.push(carry);\n return r;\n }\n function addAny(a, b) {\n if (a.length >= b.length) return add(a, b);\n return add(b, a);\n }\n function addSmall(a, carry) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n sum,\n i;\n for (i = 0; i < l; i++) {\n sum = a[i] - base + carry;\n carry = Math.floor(sum / base);\n r[i] = sum - carry * base;\n carry += 1;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n BigInteger.prototype.add = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.subtract(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) {\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\n }\n return new BigInteger(addAny(a, b), this.sign);\n };\n BigInteger.prototype.plus = BigInteger.prototype.add;\n SmallInteger.prototype.add = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.subtract(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n if (isPrecise(a + b)) return new SmallInteger(a + b);\n b = smallToArray(Math.abs(b));\n }\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\n };\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\n function subtract(a, b) {\n var a_l = a.length,\n b_l = b.length,\n r = new Array(a_l),\n borrow = 0,\n base = BASE,\n i,\n difference;\n for (i = 0; i < b_l; i++) {\n difference = a[i] - borrow - b[i];\n if (difference < 0) {\n difference += base;\n borrow = 1;\n } else borrow = 0;\n r[i] = difference;\n }\n for (i = b_l; i < a_l; i++) {\n difference = a[i] - borrow;\n if (difference < 0) difference += base;\n else {\n r[i++] = difference;\n break;\n }\n r[i] = difference;\n }\n for (; i < a_l; i++) {\n r[i] = a[i];\n }\n trim(r);\n return r;\n }\n function subtractAny(a, b, sign) {\n var value;\n if (compareAbs(a, b) >= 0) {\n value = subtract(a, b);\n } else {\n value = subtract(b, a);\n sign = !sign;\n }\n value = arrayToSmall(value);\n if (typeof value === 'number') {\n if (sign) value = -value;\n return new SmallInteger(value);\n }\n return new BigInteger(value, sign);\n }\n function subtractSmall(a, b, sign) {\n var l = a.length,\n r = new Array(l),\n carry = -b,\n base = BASE,\n i,\n difference;\n for (i = 0; i < l; i++) {\n difference = a[i] + carry;\n carry = Math.floor(difference / base);\n difference %= base;\n r[i] = difference < 0 ? difference + base : difference;\n }\n r = arrayToSmall(r);\n if (typeof r === 'number') {\n if (sign) r = -r;\n return new SmallInteger(r);\n }\n return new BigInteger(r, sign);\n }\n BigInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.add(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) return subtractSmall(a, Math.abs(b), this.sign);\n return subtractAny(a, b, this.sign);\n };\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\n SmallInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.add(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n return new SmallInteger(a - b);\n }\n return subtractSmall(b, Math.abs(a), a >= 0);\n };\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\n BigInteger.prototype.negate = function() {\n return new BigInteger(this.value, !this.sign);\n };\n SmallInteger.prototype.negate = function() {\n var sign = this.sign;\n var small = new SmallInteger(-this.value);\n small.sign = !sign;\n return small;\n };\n BigInteger.prototype.abs = function() {\n return new BigInteger(this.value, false);\n };\n SmallInteger.prototype.abs = function() {\n return new SmallInteger(Math.abs(this.value));\n };\n function multiplyLong(a, b) {\n var a_l = a.length,\n b_l = b.length,\n l = a_l + b_l,\n r = createArray(l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n b_j;\n for (i = 0; i < a_l; ++i) {\n a_i = a[i];\n for (var j = 0; j < b_l; ++j) {\n b_j = b[j];\n product = a_i * b_j + r[i + j];\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n r[i + j + 1] += carry;\n }\n }\n trim(r);\n return r;\n }\n function multiplySmall(a, b) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n carry = 0,\n product,\n i;\n for (i = 0; i < l; i++) {\n product = a[i] * b + carry;\n carry = Math.floor(product / base);\n r[i] = product - carry * base;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n function shiftLeft(x, n) {\n var r = [];\n while (n-- > 0) r.push(0);\n return r.concat(x);\n }\n function multiplyKaratsuba(x, y) {\n var n = Math.max(x.length, y.length);\n if (n <= 30) return multiplyLong(x, y);\n n = Math.ceil(n / 2);\n var b = x.slice(n),\n a = x.slice(0, n),\n d = y.slice(n),\n c = y.slice(0, n);\n var ac = multiplyKaratsuba(a, c),\n bd = multiplyKaratsuba(b, d),\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\n var product = addAny(\n addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)),\n shiftLeft(bd, 2 * n)\n );\n trim(product);\n return product;\n }\n function useKaratsuba(l1, l2) {\n return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;\n }\n BigInteger.prototype.multiply = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n sign = this.sign !== n.sign,\n abs;\n if (n.isSmall) {\n if (b === 0) return Integer[0];\n if (b === 1) return this;\n if (b === -1) return this.negate();\n abs = Math.abs(b);\n if (abs < BASE) {\n return new BigInteger(multiplySmall(a, abs), sign);\n }\n b = smallToArray(abs);\n }\n if (useKaratsuba(a.length, b.length))\n return new BigInteger(multiplyKaratsuba(a, b), sign);\n return new BigInteger(multiplyLong(a, b), sign);\n };\n BigInteger.prototype.times = BigInteger.prototype.multiply;\n function multiplySmallAndArray(a, b, sign) {\n if (a < BASE) {\n return new BigInteger(multiplySmall(b, a), sign);\n }\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\n }\n SmallInteger.prototype._multiplyBySmall = function(a) {\n if (isPrecise(a.value * this.value)) {\n return new SmallInteger(a.value * this.value);\n }\n return multiplySmallAndArray(\n Math.abs(a.value),\n smallToArray(Math.abs(this.value)),\n this.sign !== a.sign\n );\n };\n BigInteger.prototype._multiplyBySmall = function(a) {\n if (a.value === 0) return Integer[0];\n if (a.value === 1) return this;\n if (a.value === -1) return this.negate();\n return multiplySmallAndArray(\n Math.abs(a.value),\n this.value,\n this.sign !== a.sign\n );\n };\n SmallInteger.prototype.multiply = function(v) {\n return parseValue(v)._multiplyBySmall(this);\n };\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\n function square(a) {\n var l = a.length,\n r = createArray(l + l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n a_j;\n for (i = 0; i < l; i++) {\n a_i = a[i];\n carry = 0 - a_i * a_i;\n for (var j = i; j < l; j++) {\n a_j = a[j];\n product = 2 * (a_i * a_j) + r[i + j] + carry;\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n }\n r[i + l] = carry;\n }\n trim(r);\n return r;\n }\n BigInteger.prototype.square = function() {\n return new BigInteger(square(this.value), false);\n };\n SmallInteger.prototype.square = function() {\n var value = this.value * this.value;\n if (isPrecise(value)) return new SmallInteger(value);\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\n };\n function divMod1(a, b) {\n var a_l = a.length,\n b_l = b.length,\n base = BASE,\n result = createArray(b.length),\n divisorMostSignificantDigit = b[b_l - 1],\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\n remainder = multiplySmall(a, lambda),\n divisor = multiplySmall(b, lambda),\n quotientDigit,\n shift,\n carry,\n borrow,\n i,\n l,\n q;\n if (remainder.length <= a_l) remainder.push(0);\n divisor.push(0);\n divisorMostSignificantDigit = divisor[b_l - 1];\n for (shift = a_l - b_l; shift >= 0; shift--) {\n quotientDigit = base - 1;\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\n quotientDigit = Math.floor(\n (remainder[shift + b_l] * base + remainder[shift + b_l - 1]) /\n divisorMostSignificantDigit\n );\n }\n carry = 0;\n borrow = 0;\n l = divisor.length;\n for (i = 0; i < l; i++) {\n carry += quotientDigit * divisor[i];\n q = Math.floor(carry / base);\n borrow += remainder[shift + i] - (carry - q * base);\n carry = q;\n if (borrow < 0) {\n remainder[shift + i] = borrow + base;\n borrow = -1;\n } else {\n remainder[shift + i] = borrow;\n borrow = 0;\n }\n }\n while (borrow !== 0) {\n quotientDigit -= 1;\n carry = 0;\n for (i = 0; i < l; i++) {\n carry += remainder[shift + i] - base + divisor[i];\n if (carry < 0) {\n remainder[shift + i] = carry + base;\n carry = 0;\n } else {\n remainder[shift + i] = carry;\n carry = 1;\n }\n }\n borrow += carry;\n }\n result[shift] = quotientDigit;\n }\n remainder = divModSmall(remainder, lambda)[0];\n return [arrayToSmall(result), arrayToSmall(remainder)];\n }\n function divMod2(a, b) {\n var a_l = a.length,\n b_l = b.length,\n result = [],\n part = [],\n base = BASE,\n guess,\n xlen,\n highx,\n highy,\n check;\n while (a_l) {\n part.unshift(a[--a_l]);\n trim(part);\n if (compareAbs(part, b) < 0) {\n result.push(0);\n continue;\n }\n xlen = part.length;\n highx = part[xlen - 1] * base + part[xlen - 2];\n highy = b[b_l - 1] * base + b[b_l - 2];\n if (xlen > b_l) {\n highx = (highx + 1) * base;\n }\n guess = Math.ceil(highx / highy);\n do {\n check = multiplySmall(b, guess);\n if (compareAbs(check, part) <= 0) break;\n guess--;\n } while (guess);\n result.push(guess);\n part = subtract(part, check);\n }\n result.reverse();\n return [arrayToSmall(result), arrayToSmall(part)];\n }\n function divModSmall(value, lambda) {\n var length = value.length,\n quotient = createArray(length),\n base = BASE,\n i,\n q,\n remainder,\n divisor;\n remainder = 0;\n for (i = length - 1; i >= 0; --i) {\n divisor = remainder * base + value[i];\n q = truncate(divisor / lambda);\n remainder = divisor - q * lambda;\n quotient[i] = q | 0;\n }\n return [quotient, remainder | 0];\n }\n function divModAny(self, v) {\n var value,\n n = parseValue(v);\n var a = self.value,\n b = n.value;\n var quotient;\n if (b === 0) throw new Error('Cannot divide by zero');\n if (self.isSmall) {\n if (n.isSmall) {\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\n }\n return [Integer[0], self];\n }\n if (n.isSmall) {\n if (b === 1) return [self, Integer[0]];\n if (b == -1) return [self.negate(), Integer[0]];\n var abs = Math.abs(b);\n if (abs < BASE) {\n value = divModSmall(a, abs);\n quotient = arrayToSmall(value[0]);\n var remainder = value[1];\n if (self.sign) remainder = -remainder;\n if (typeof quotient === 'number') {\n if (self.sign !== n.sign) quotient = -quotient;\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\n }\n return [\n new BigInteger(quotient, self.sign !== n.sign),\n new SmallInteger(remainder)\n ];\n }\n b = smallToArray(abs);\n }\n var comparison = compareAbs(a, b);\n if (comparison === -1) return [Integer[0], self];\n if (comparison === 0)\n return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\n if (a.length + b.length <= 200) value = divMod1(a, b);\n else value = divMod2(a, b);\n quotient = value[0];\n var qSign = self.sign !== n.sign,\n mod = value[1],\n mSign = self.sign;\n if (typeof quotient === 'number') {\n if (qSign) quotient = -quotient;\n quotient = new SmallInteger(quotient);\n } else quotient = new BigInteger(quotient, qSign);\n if (typeof mod === 'number') {\n if (mSign) mod = -mod;\n mod = new SmallInteger(mod);\n } else mod = new BigInteger(mod, mSign);\n return [quotient, mod];\n }\n BigInteger.prototype.divmod = function(v) {\n var result = divModAny(this, v);\n return { quotient: result[0], remainder: result[1] };\n };\n SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\n BigInteger.prototype.divide = function(v) {\n return divModAny(this, v)[0];\n };\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over =\n BigInteger.prototype.divide;\n BigInteger.prototype.mod = function(v) {\n return divModAny(this, v)[1];\n };\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder =\n BigInteger.prototype.mod;\n BigInteger.prototype.pow = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n value,\n x,\n y;\n if (b === 0) return Integer[1];\n if (a === 0) return Integer[0];\n if (a === 1) return Integer[1];\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\n if (n.sign) {\n return Integer[0];\n }\n if (!n.isSmall)\n throw new Error('The exponent ' + n.toString() + ' is too large.');\n if (this.isSmall) {\n if (isPrecise((value = Math.pow(a, b))))\n return new SmallInteger(truncate(value));\n }\n x = this;\n y = Integer[1];\n while (true) {\n if (b & (1 === 1)) {\n y = y.times(x);\n --b;\n }\n if (b === 0) break;\n b /= 2;\n x = x.square();\n }\n return y;\n };\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\n BigInteger.prototype.modPow = function(exp, mod) {\n exp = parseValue(exp);\n mod = parseValue(mod);\n if (mod.isZero()) throw new Error('Cannot take modPow with modulus 0');\n var r = Integer[1],\n base = this.mod(mod);\n while (exp.isPositive()) {\n if (base.isZero()) return Integer[0];\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\n exp = exp.divide(2);\n base = base.square().mod(mod);\n }\n return r;\n };\n SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\n function compareAbs(a, b) {\n if (a.length !== b.length) {\n return a.length > b.length ? 1 : -1;\n }\n for (var i = a.length - 1; i >= 0; i--) {\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\n }\n return 0;\n }\n BigInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) return 1;\n return compareAbs(a, b);\n };\n SmallInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = Math.abs(this.value),\n b = n.value;\n if (n.isSmall) {\n b = Math.abs(b);\n return a === b ? 0 : a > b ? 1 : -1;\n }\n return -1;\n };\n BigInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (this.sign !== n.sign) {\n return n.sign ? 1 : -1;\n }\n if (n.isSmall) {\n return this.sign ? -1 : 1;\n }\n return compareAbs(a, b) * (this.sign ? -1 : 1);\n };\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\n SmallInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) {\n return a == b ? 0 : a > b ? 1 : -1;\n }\n if (a < 0 !== n.sign) {\n return a < 0 ? -1 : 1;\n }\n return a < 0 ? 1 : -1;\n };\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\n BigInteger.prototype.equals = function(v) {\n return this.compare(v) === 0;\n };\n SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq =\n BigInteger.prototype.equals;\n BigInteger.prototype.notEquals = function(v) {\n return this.compare(v) !== 0;\n };\n SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq =\n BigInteger.prototype.notEquals;\n BigInteger.prototype.greater = function(v) {\n return this.compare(v) > 0;\n };\n SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt =\n BigInteger.prototype.greater;\n BigInteger.prototype.lesser = function(v) {\n return this.compare(v) < 0;\n };\n SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt =\n BigInteger.prototype.lesser;\n BigInteger.prototype.greaterOrEquals = function(v) {\n return this.compare(v) >= 0;\n };\n SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq =\n BigInteger.prototype.greaterOrEquals;\n BigInteger.prototype.lesserOrEquals = function(v) {\n return this.compare(v) <= 0;\n };\n SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq =\n BigInteger.prototype.lesserOrEquals;\n BigInteger.prototype.isEven = function() {\n return (this.value[0] & 1) === 0;\n };\n SmallInteger.prototype.isEven = function() {\n return (this.value & 1) === 0;\n };\n BigInteger.prototype.isOdd = function() {\n return (this.value[0] & 1) === 1;\n };\n SmallInteger.prototype.isOdd = function() {\n return (this.value & 1) === 1;\n };\n BigInteger.prototype.isPositive = function() {\n return !this.sign;\n };\n SmallInteger.prototype.isPositive = function() {\n return this.value > 0;\n };\n BigInteger.prototype.isNegative = function() {\n return this.sign;\n };\n SmallInteger.prototype.isNegative = function() {\n return this.value < 0;\n };\n BigInteger.prototype.isUnit = function() {\n return false;\n };\n SmallInteger.prototype.isUnit = function() {\n return Math.abs(this.value) === 1;\n };\n BigInteger.prototype.isZero = function() {\n return false;\n };\n SmallInteger.prototype.isZero = function() {\n return this.value === 0;\n };\n BigInteger.prototype.isDivisibleBy = function(v) {\n var n = parseValue(v);\n var value = n.value;\n if (value === 0) return false;\n if (value === 1) return true;\n if (value === 2) return this.isEven();\n return this.mod(n).equals(Integer[0]);\n };\n SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\n function isBasicPrime(v) {\n var n = v.abs();\n if (n.isUnit()) return false;\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\n if (n.lesser(49)) return true;\n }\n function millerRabinTest(n, a) {\n var nPrev = n.prev(),\n b = nPrev,\n r = 0,\n d,\n t,\n i,\n x;\n while (b.isEven()) (b = b.divide(2)), r++;\n next: for (i = 0; i < a.length; i++) {\n if (n.lesser(a[i])) continue;\n x = bigInt(a[i]).modPow(b, n);\n if (x.equals(Integer[1]) || x.equals(nPrev)) continue;\n for (d = r - 1; d != 0; d--) {\n x = x.square().mod(n);\n if (x.isUnit()) return false;\n if (x.equals(nPrev)) continue next;\n }\n return false;\n }\n return true;\n }\n BigInteger.prototype.isPrime = function(strict) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var bits = n.bitLength();\n if (bits <= 64)\n return millerRabinTest(n, [\n 2,\n 325,\n 9375,\n 28178,\n 450775,\n 9780504,\n 1795265022\n ]);\n var logN = Math.log(2) * bits;\n var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt(i + 2));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\n BigInteger.prototype.isProbablePrime = function(iterations) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var t = iterations === undefined ? 5 : iterations;\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt.randBetween(2, n.minus(2)));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\n BigInteger.prototype.modInv = function(n) {\n var t = bigInt.zero,\n newT = bigInt.one,\n r = parseValue(n),\n newR = this.abs(),\n q,\n lastT,\n lastR;\n while (!newR.equals(bigInt.zero)) {\n q = r.divide(newR);\n lastT = t;\n lastR = r;\n t = newT;\n r = newR;\n newT = lastT.subtract(q.multiply(newT));\n newR = lastR.subtract(q.multiply(newR));\n }\n if (!r.equals(1))\n throw new Error(\n this.toString() + ' and ' + n.toString() + ' are not co-prime'\n );\n if (t.compare(0) === -1) {\n t = t.add(n);\n }\n if (this.isNegative()) {\n return t.negate();\n }\n return t;\n };\n SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\n BigInteger.prototype.next = function() {\n var value = this.value;\n if (this.sign) {\n return subtractSmall(value, 1, this.sign);\n }\n return new BigInteger(addSmall(value, 1), this.sign);\n };\n SmallInteger.prototype.next = function() {\n var value = this.value;\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\n return new BigInteger(MAX_INT_ARR, false);\n };\n BigInteger.prototype.prev = function() {\n var value = this.value;\n if (this.sign) {\n return new BigInteger(addSmall(value, 1), true);\n }\n return subtractSmall(value, 1, this.sign);\n };\n SmallInteger.prototype.prev = function() {\n var value = this.value;\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\n return new BigInteger(MAX_INT_ARR, true);\n };\n var powersOfTwo = [1];\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)\n powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\n var powers2Length = powersOfTwo.length,\n highestPower2 = powersOfTwo[powers2Length - 1];\n function shift_isSmall(n) {\n return (\n ((typeof n === 'number' || typeof n === 'string') &&\n +Math.abs(n) <= BASE) ||\n (n instanceof BigInteger && n.value.length <= 1)\n );\n }\n BigInteger.prototype.shiftLeft = function(n) {\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftRight(-n);\n var result = this;\n if (result.isZero()) return result;\n while (n >= powers2Length) {\n result = result.multiply(highestPower2);\n n -= powers2Length - 1;\n }\n return result.multiply(powersOfTwo[n]);\n };\n SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\n BigInteger.prototype.shiftRight = function(n) {\n var remQuo;\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftLeft(-n);\n var result = this;\n while (n >= powers2Length) {\n if (result.isZero() || (result.isNegative() && result.isUnit()))\n return result;\n remQuo = divModAny(result, highestPower2);\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n n -= powers2Length - 1;\n }\n remQuo = divModAny(result, powersOfTwo[n]);\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n };\n SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\n function bitwise(x, y, fn) {\n y = parseValue(y);\n var xSign = x.isNegative(),\n ySign = y.isNegative();\n var xRem = xSign ? x.not() : x,\n yRem = ySign ? y.not() : y;\n var xDigit = 0,\n yDigit = 0;\n var xDivMod = null,\n yDivMod = null;\n var result = [];\n while (!xRem.isZero() || !yRem.isZero()) {\n xDivMod = divModAny(xRem, highestPower2);\n xDigit = xDivMod[1].toJSNumber();\n if (xSign) {\n xDigit = highestPower2 - 1 - xDigit;\n }\n yDivMod = divModAny(yRem, highestPower2);\n yDigit = yDivMod[1].toJSNumber();\n if (ySign) {\n yDigit = highestPower2 - 1 - yDigit;\n }\n xRem = xDivMod[0];\n yRem = yDivMod[0];\n result.push(fn(xDigit, yDigit));\n }\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\n for (var i = result.length - 1; i >= 0; i -= 1) {\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\n }\n return sum;\n }\n BigInteger.prototype.not = function() {\n return this.negate().prev();\n };\n SmallInteger.prototype.not = BigInteger.prototype.not;\n BigInteger.prototype.and = function(n) {\n return bitwise(this, n, function(a, b) {\n return a & b;\n });\n };\n SmallInteger.prototype.and = BigInteger.prototype.and;\n BigInteger.prototype.or = function(n) {\n return bitwise(this, n, function(a, b) {\n return a | b;\n });\n };\n SmallInteger.prototype.or = BigInteger.prototype.or;\n BigInteger.prototype.xor = function(n) {\n return bitwise(this, n, function(a, b) {\n return a ^ b;\n });\n };\n SmallInteger.prototype.xor = BigInteger.prototype.xor;\n var LOBMASK_I = 1 << 30,\n LOBMASK_BI = ((BASE & -BASE) * (BASE & -BASE)) | LOBMASK_I;\n function roughLOB(n) {\n var v = n.value,\n x =\n typeof v === 'number'\n ? v | LOBMASK_I\n : (v[0] + v[1] * BASE) | LOBMASK_BI;\n return x & -x;\n }\n function integerLogarithm(value, base) {\n if (base.compareTo(value) <= 0) {\n var tmp = integerLogarithm(value, base.square(base));\n var p = tmp.p;\n var e = tmp.e;\n var t = p.multiply(base);\n return t.compareTo(value) <= 0\n ? { p: t, e: e * 2 + 1 }\n : { p: p, e: e * 2 };\n }\n return { p: bigInt(1), e: 0 };\n }\n BigInteger.prototype.bitLength = function() {\n var n = this;\n if (n.compareTo(bigInt(0)) < 0) {\n n = n.negate().subtract(bigInt(1));\n }\n if (n.compareTo(bigInt(0)) === 0) {\n return bigInt(0);\n }\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\n };\n SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\n function max(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.greater(b) ? a : b;\n }\n function min(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.lesser(b) ? a : b;\n }\n function gcd(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n if (a.equals(b)) return a;\n if (a.isZero()) return b;\n if (b.isZero()) return a;\n var c = Integer[1],\n d,\n t;\n while (a.isEven() && b.isEven()) {\n d = Math.min(roughLOB(a), roughLOB(b));\n a = a.divide(d);\n b = b.divide(d);\n c = c.multiply(d);\n }\n while (a.isEven()) {\n a = a.divide(roughLOB(a));\n }\n do {\n while (b.isEven()) {\n b = b.divide(roughLOB(b));\n }\n if (a.greater(b)) {\n t = b;\n b = a;\n a = t;\n }\n b = b.subtract(a);\n } while (!b.isZero());\n return c.isUnit() ? a : a.multiply(c);\n }\n function lcm(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n return a.divide(gcd(a, b)).multiply(b);\n }\n function randBetween(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n var low = min(a, b),\n high = max(a, b);\n var range = high.subtract(low).add(1);\n if (range.isSmall) return low.add(Math.floor(Math.random() * range));\n var length = range.value.length - 1;\n var result = [],\n restricted = true;\n for (var i = length; i >= 0; i--) {\n var top = restricted ? range.value[i] : BASE;\n var digit = truncate(Math.random() * top);\n result.unshift(digit);\n if (digit < top) restricted = false;\n }\n result = arrayToSmall(result);\n return low.add(\n typeof result === 'number'\n ? new SmallInteger(result)\n : new BigInteger(result, false)\n );\n }\n var parseBase = function(text, base) {\n var length = text.length;\n var i;\n var absBase = Math.abs(base);\n for (var i = 0; i < length; i++) {\n var c = text[i].toLowerCase();\n if (c === '-') continue;\n if (/[a-z0-9]/.test(c)) {\n if (/[0-9]/.test(c) && +c >= absBase) {\n if (c === '1' && absBase === 1) continue;\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n } else if (c.charCodeAt(0) - 87 >= absBase) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n }\n }\n if (2 <= base && base <= 36) {\n if (length <= LOG_MAX_INT / Math.log(base)) {\n var result = parseInt(text, base);\n if (isNaN(result)) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n return new SmallInteger(parseInt(text, base));\n }\n }\n base = parseValue(base);\n var digits = [];\n var isNegative = text[0] === '-';\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\n var c = text[i].toLowerCase(),\n charCode = c.charCodeAt(0);\n if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));\n else if (97 <= charCode && charCode <= 122)\n digits.push(parseValue(c.charCodeAt(0) - 87));\n else if (c === '<') {\n var start = i;\n do {\n i++;\n } while (text[i] !== '>');\n digits.push(parseValue(text.slice(start + 1, i)));\n } else throw new Error(c + ' is not a valid character');\n }\n return parseBaseFromArray(digits, base, isNegative);\n };\n function parseBaseFromArray(digits, base, isNegative) {\n var val = Integer[0],\n pow = Integer[1],\n i;\n for (i = digits.length - 1; i >= 0; i--) {\n val = val.add(digits[i].times(pow));\n pow = pow.times(base);\n }\n return isNegative ? val.negate() : val;\n }\n function stringify(digit) {\n if (digit <= 35) {\n return '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(digit);\n }\n return '<' + digit + '>';\n }\n function toBase(n, base) {\n base = bigInt(base);\n if (base.isZero()) {\n if (n.isZero()) return { value: [0], isNegative: false };\n throw new Error('Cannot convert nonzero numbers to base 0.');\n }\n if (base.equals(-1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n if (n.isNegative())\n return {\n value: [].concat.apply(\n [],\n Array.apply(null, Array(-n)).map(Array.prototype.valueOf, [1, 0])\n ),\n isNegative: false\n };\n var arr = Array.apply(null, Array(+n - 1)).map(Array.prototype.valueOf, [\n 0,\n 1\n ]);\n arr.unshift([1]);\n return { value: [].concat.apply([], arr), isNegative: false };\n }\n var neg = false;\n if (n.isNegative() && base.isPositive()) {\n neg = true;\n n = n.abs();\n }\n if (base.equals(1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n return {\n value: Array.apply(null, Array(+n)).map(Number.prototype.valueOf, 1),\n isNegative: neg\n };\n }\n var out = [];\n var left = n,\n divmod;\n while (left.isNegative() || left.compareAbs(base) >= 0) {\n divmod = left.divmod(base);\n left = divmod.quotient;\n var digit = divmod.remainder;\n if (digit.isNegative()) {\n digit = base.minus(digit).abs();\n left = left.next();\n }\n out.push(digit.toJSNumber());\n }\n out.push(left.toJSNumber());\n return { value: out.reverse(), isNegative: neg };\n }\n function toBaseString(n, base) {\n var arr = toBase(n, base);\n return (arr.isNegative ? '-' : '') + arr.value.map(stringify).join('');\n }\n BigInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n SmallInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n BigInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix !== 10) return toBaseString(this, radix);\n var v = this.value,\n l = v.length,\n str = String(v[--l]),\n zeros = '0000000',\n digit;\n while (--l >= 0) {\n digit = String(v[l]);\n str += zeros.slice(digit.length) + digit;\n }\n var sign = this.sign ? '-' : '';\n return sign + str;\n };\n SmallInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix != 10) return toBaseString(this, radix);\n return String(this.value);\n };\n BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {\n return this.toString();\n };\n BigInteger.prototype.valueOf = function() {\n return parseInt(this.toString(), 10);\n };\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\n SmallInteger.prototype.valueOf = function() {\n return this.value;\n };\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\n function parseStringValue(v) {\n if (isPrecise(+v)) {\n var x = +v;\n if (x === truncate(x)) return new SmallInteger(x);\n throw new Error('Invalid integer: ' + v);\n }\n var sign = v[0] === '-';\n if (sign) v = v.slice(1);\n var split = v.split(/e/i);\n if (split.length > 2)\n throw new Error('Invalid integer: ' + split.join('e'));\n if (split.length === 2) {\n var exp = split[1];\n if (exp[0] === '+') exp = exp.slice(1);\n exp = +exp;\n if (exp !== truncate(exp) || !isPrecise(exp))\n throw new Error(\n 'Invalid integer: ' + exp + ' is not a valid exponent.'\n );\n var text = split[0];\n var decimalPlace = text.indexOf('.');\n if (decimalPlace >= 0) {\n exp -= text.length - decimalPlace - 1;\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\n }\n if (exp < 0)\n throw new Error('Cannot include negative exponent part for integers');\n text += new Array(exp + 1).join('0');\n v = text;\n }\n var isValid = /^([0-9][0-9]*)$/.test(v);\n if (!isValid) throw new Error('Invalid integer: ' + v);\n var r = [],\n max = v.length,\n l = LOG_BASE,\n min = max - l;\n while (max > 0) {\n r.push(+v.slice(min, max));\n min -= l;\n if (min < 0) min = 0;\n max -= l;\n }\n trim(r);\n return new BigInteger(r, sign);\n }\n function parseNumberValue(v) {\n if (isPrecise(v)) {\n if (v !== truncate(v)) throw new Error(v + ' is not an integer.');\n return new SmallInteger(v);\n }\n return parseStringValue(v.toString());\n }\n function parseValue(v) {\n if (typeof v === 'number') {\n return parseNumberValue(v);\n }\n if (typeof v === 'string') {\n return parseStringValue(v);\n }\n return v;\n }\n for (var i = 0; i < 1e3; i++) {\n Integer[i] = new SmallInteger(i);\n if (i > 0) Integer[-i] = new SmallInteger(-i);\n }\n Integer.one = Integer[1];\n Integer.zero = Integer[0];\n Integer.minusOne = Integer[-1];\n Integer.max = max;\n Integer.min = min;\n Integer.gcd = gcd;\n Integer.lcm = lcm;\n Integer.isInstance = function(x) {\n return x instanceof BigInteger || x instanceof SmallInteger;\n };\n Integer.randBetween = randBetween;\n Integer.fromArray = function(digits, base, isNegative) {\n return parseBaseFromArray(\n digits.map(parseValue),\n parseValue(base || 10),\n isNegative\n );\n };\n return Integer;\n})();\nif (typeof module !== 'undefined' && module.hasOwnProperty('exports')) {\n module.exports = bigInt;\n}\nif (typeof define === 'function' && define.amd) {\n define('big-integer', [], function() {\n return bigInt;\n });\n}\n\nfunction substract(a, b) {\n if (a.eq(0) || b.eq(0)) {\n return { a, b };\n } else if (a.greaterOrEquals(b.multiply(2))) {\n a = a.mod(2 * b);\n return substract(a, b);\n } else if (b.greaterOrEquals(a.multiply(2))) {\n b = b.mod(2 * a);\n return substract(a, b);\n } else {\n return { a, b };\n }\n}\n\nconst nd = readline().split(' ');\n\nconst result = substract(nd[0], nd[1]);\n\nprint(result.a.toJSNumber() + ' ' + result.b.toJSNumber() + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dcd445a9afcd7e48cc69a26c1d847f35", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var bigInt = (function(undefined) {\n 'use strict';\n var BASE = 1e7,\n LOG_BASE = 7,\n MAX_INT = 9007199254740992,\n MAX_INT_ARR = smallToArray(MAX_INT),\n LOG_MAX_INT = Math.log(MAX_INT);\n function Integer(v, radix) {\n if (typeof v === 'undefined') return Integer[0];\n if (typeof radix !== 'undefined')\n return +radix === 10 ? parseValue(v) : parseBase(v, radix);\n return parseValue(v);\n }\n function BigInteger(value, sign) {\n this.value = value;\n this.sign = sign;\n this.isSmall = false;\n }\n BigInteger.prototype = Object.create(Integer.prototype);\n function SmallInteger(value) {\n this.value = value;\n this.sign = value < 0;\n this.isSmall = true;\n }\n SmallInteger.prototype = Object.create(Integer.prototype);\n function isPrecise(n) {\n return -MAX_INT < n && n < MAX_INT;\n }\n function smallToArray(n) {\n if (n < 1e7) return [n];\n if (n < 1e14) return [n % 1e7, Math.floor(n / 1e7)];\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\n }\n function arrayToSmall(arr) {\n trim(arr);\n var length = arr.length;\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\n switch (length) {\n case 0:\n return 0;\n case 1:\n return arr[0];\n case 2:\n return arr[0] + arr[1] * BASE;\n default:\n return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\n }\n }\n return arr;\n }\n function trim(v) {\n var i = v.length;\n while (v[--i] === 0);\n v.length = i + 1;\n }\n function createArray(length) {\n var x = new Array(length);\n var i = -1;\n while (++i < length) {\n x[i] = 0;\n }\n return x;\n }\n function truncate(n) {\n if (n > 0) return Math.floor(n);\n return Math.ceil(n);\n }\n function add(a, b) {\n var l_a = a.length,\n l_b = b.length,\n r = new Array(l_a),\n carry = 0,\n base = BASE,\n sum,\n i;\n for (i = 0; i < l_b; i++) {\n sum = a[i] + b[i] + carry;\n carry = sum >= base ? 1 : 0;\n r[i] = sum - carry * base;\n }\n while (i < l_a) {\n sum = a[i] + carry;\n carry = sum === base ? 1 : 0;\n r[i++] = sum - carry * base;\n }\n if (carry > 0) r.push(carry);\n return r;\n }\n function addAny(a, b) {\n if (a.length >= b.length) return add(a, b);\n return add(b, a);\n }\n function addSmall(a, carry) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n sum,\n i;\n for (i = 0; i < l; i++) {\n sum = a[i] - base + carry;\n carry = Math.floor(sum / base);\n r[i] = sum - carry * base;\n carry += 1;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n BigInteger.prototype.add = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.subtract(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) {\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\n }\n return new BigInteger(addAny(a, b), this.sign);\n };\n BigInteger.prototype.plus = BigInteger.prototype.add;\n SmallInteger.prototype.add = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.subtract(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n if (isPrecise(a + b)) return new SmallInteger(a + b);\n b = smallToArray(Math.abs(b));\n }\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\n };\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\n function subtract(a, b) {\n var a_l = a.length,\n b_l = b.length,\n r = new Array(a_l),\n borrow = 0,\n base = BASE,\n i,\n difference;\n for (i = 0; i < b_l; i++) {\n difference = a[i] - borrow - b[i];\n if (difference < 0) {\n difference += base;\n borrow = 1;\n } else borrow = 0;\n r[i] = difference;\n }\n for (i = b_l; i < a_l; i++) {\n difference = a[i] - borrow;\n if (difference < 0) difference += base;\n else {\n r[i++] = difference;\n break;\n }\n r[i] = difference;\n }\n for (; i < a_l; i++) {\n r[i] = a[i];\n }\n trim(r);\n return r;\n }\n function subtractAny(a, b, sign) {\n var value;\n if (compareAbs(a, b) >= 0) {\n value = subtract(a, b);\n } else {\n value = subtract(b, a);\n sign = !sign;\n }\n value = arrayToSmall(value);\n if (typeof value === 'number') {\n if (sign) value = -value;\n return new SmallInteger(value);\n }\n return new BigInteger(value, sign);\n }\n function subtractSmall(a, b, sign) {\n var l = a.length,\n r = new Array(l),\n carry = -b,\n base = BASE,\n i,\n difference;\n for (i = 0; i < l; i++) {\n difference = a[i] + carry;\n carry = Math.floor(difference / base);\n difference %= base;\n r[i] = difference < 0 ? difference + base : difference;\n }\n r = arrayToSmall(r);\n if (typeof r === 'number') {\n if (sign) r = -r;\n return new SmallInteger(r);\n }\n return new BigInteger(r, sign);\n }\n BigInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.add(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) return subtractSmall(a, Math.abs(b), this.sign);\n return subtractAny(a, b, this.sign);\n };\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\n SmallInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.add(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n return new SmallInteger(a - b);\n }\n return subtractSmall(b, Math.abs(a), a >= 0);\n };\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\n BigInteger.prototype.negate = function() {\n return new BigInteger(this.value, !this.sign);\n };\n SmallInteger.prototype.negate = function() {\n var sign = this.sign;\n var small = new SmallInteger(-this.value);\n small.sign = !sign;\n return small;\n };\n BigInteger.prototype.abs = function() {\n return new BigInteger(this.value, false);\n };\n SmallInteger.prototype.abs = function() {\n return new SmallInteger(Math.abs(this.value));\n };\n function multiplyLong(a, b) {\n var a_l = a.length,\n b_l = b.length,\n l = a_l + b_l,\n r = createArray(l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n b_j;\n for (i = 0; i < a_l; ++i) {\n a_i = a[i];\n for (var j = 0; j < b_l; ++j) {\n b_j = b[j];\n product = a_i * b_j + r[i + j];\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n r[i + j + 1] += carry;\n }\n }\n trim(r);\n return r;\n }\n function multiplySmall(a, b) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n carry = 0,\n product,\n i;\n for (i = 0; i < l; i++) {\n product = a[i] * b + carry;\n carry = Math.floor(product / base);\n r[i] = product - carry * base;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n function shiftLeft(x, n) {\n var r = [];\n while (n-- > 0) r.push(0);\n return r.concat(x);\n }\n function multiplyKaratsuba(x, y) {\n var n = Math.max(x.length, y.length);\n if (n <= 30) return multiplyLong(x, y);\n n = Math.ceil(n / 2);\n var b = x.slice(n),\n a = x.slice(0, n),\n d = y.slice(n),\n c = y.slice(0, n);\n var ac = multiplyKaratsuba(a, c),\n bd = multiplyKaratsuba(b, d),\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\n var product = addAny(\n addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)),\n shiftLeft(bd, 2 * n)\n );\n trim(product);\n return product;\n }\n function useKaratsuba(l1, l2) {\n return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;\n }\n BigInteger.prototype.multiply = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n sign = this.sign !== n.sign,\n abs;\n if (n.isSmall) {\n if (b === 0) return Integer[0];\n if (b === 1) return this;\n if (b === -1) return this.negate();\n abs = Math.abs(b);\n if (abs < BASE) {\n return new BigInteger(multiplySmall(a, abs), sign);\n }\n b = smallToArray(abs);\n }\n if (useKaratsuba(a.length, b.length))\n return new BigInteger(multiplyKaratsuba(a, b), sign);\n return new BigInteger(multiplyLong(a, b), sign);\n };\n BigInteger.prototype.times = BigInteger.prototype.multiply;\n function multiplySmallAndArray(a, b, sign) {\n if (a < BASE) {\n return new BigInteger(multiplySmall(b, a), sign);\n }\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\n }\n SmallInteger.prototype._multiplyBySmall = function(a) {\n if (isPrecise(a.value * this.value)) {\n return new SmallInteger(a.value * this.value);\n }\n return multiplySmallAndArray(\n Math.abs(a.value),\n smallToArray(Math.abs(this.value)),\n this.sign !== a.sign\n );\n };\n BigInteger.prototype._multiplyBySmall = function(a) {\n if (a.value === 0) return Integer[0];\n if (a.value === 1) return this;\n if (a.value === -1) return this.negate();\n return multiplySmallAndArray(\n Math.abs(a.value),\n this.value,\n this.sign !== a.sign\n );\n };\n SmallInteger.prototype.multiply = function(v) {\n return parseValue(v)._multiplyBySmall(this);\n };\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\n function square(a) {\n var l = a.length,\n r = createArray(l + l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n a_j;\n for (i = 0; i < l; i++) {\n a_i = a[i];\n carry = 0 - a_i * a_i;\n for (var j = i; j < l; j++) {\n a_j = a[j];\n product = 2 * (a_i * a_j) + r[i + j] + carry;\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n }\n r[i + l] = carry;\n }\n trim(r);\n return r;\n }\n BigInteger.prototype.square = function() {\n return new BigInteger(square(this.value), false);\n };\n SmallInteger.prototype.square = function() {\n var value = this.value * this.value;\n if (isPrecise(value)) return new SmallInteger(value);\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\n };\n function divMod1(a, b) {\n var a_l = a.length,\n b_l = b.length,\n base = BASE,\n result = createArray(b.length),\n divisorMostSignificantDigit = b[b_l - 1],\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\n remainder = multiplySmall(a, lambda),\n divisor = multiplySmall(b, lambda),\n quotientDigit,\n shift,\n carry,\n borrow,\n i,\n l,\n q;\n if (remainder.length <= a_l) remainder.push(0);\n divisor.push(0);\n divisorMostSignificantDigit = divisor[b_l - 1];\n for (shift = a_l - b_l; shift >= 0; shift--) {\n quotientDigit = base - 1;\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\n quotientDigit = Math.floor(\n (remainder[shift + b_l] * base + remainder[shift + b_l - 1]) /\n divisorMostSignificantDigit\n );\n }\n carry = 0;\n borrow = 0;\n l = divisor.length;\n for (i = 0; i < l; i++) {\n carry += quotientDigit * divisor[i];\n q = Math.floor(carry / base);\n borrow += remainder[shift + i] - (carry - q * base);\n carry = q;\n if (borrow < 0) {\n remainder[shift + i] = borrow + base;\n borrow = -1;\n } else {\n remainder[shift + i] = borrow;\n borrow = 0;\n }\n }\n while (borrow !== 0) {\n quotientDigit -= 1;\n carry = 0;\n for (i = 0; i < l; i++) {\n carry += remainder[shift + i] - base + divisor[i];\n if (carry < 0) {\n remainder[shift + i] = carry + base;\n carry = 0;\n } else {\n remainder[shift + i] = carry;\n carry = 1;\n }\n }\n borrow += carry;\n }\n result[shift] = quotientDigit;\n }\n remainder = divModSmall(remainder, lambda)[0];\n return [arrayToSmall(result), arrayToSmall(remainder)];\n }\n function divMod2(a, b) {\n var a_l = a.length,\n b_l = b.length,\n result = [],\n part = [],\n base = BASE,\n guess,\n xlen,\n highx,\n highy,\n check;\n while (a_l) {\n part.unshift(a[--a_l]);\n trim(part);\n if (compareAbs(part, b) < 0) {\n result.push(0);\n continue;\n }\n xlen = part.length;\n highx = part[xlen - 1] * base + part[xlen - 2];\n highy = b[b_l - 1] * base + b[b_l - 2];\n if (xlen > b_l) {\n highx = (highx + 1) * base;\n }\n guess = Math.ceil(highx / highy);\n do {\n check = multiplySmall(b, guess);\n if (compareAbs(check, part) <= 0) break;\n guess--;\n } while (guess);\n result.push(guess);\n part = subtract(part, check);\n }\n result.reverse();\n return [arrayToSmall(result), arrayToSmall(part)];\n }\n function divModSmall(value, lambda) {\n var length = value.length,\n quotient = createArray(length),\n base = BASE,\n i,\n q,\n remainder,\n divisor;\n remainder = 0;\n for (i = length - 1; i >= 0; --i) {\n divisor = remainder * base + value[i];\n q = truncate(divisor / lambda);\n remainder = divisor - q * lambda;\n quotient[i] = q | 0;\n }\n return [quotient, remainder | 0];\n }\n function divModAny(self, v) {\n var value,\n n = parseValue(v);\n var a = self.value,\n b = n.value;\n var quotient;\n if (b === 0) throw new Error('Cannot divide by zero');\n if (self.isSmall) {\n if (n.isSmall) {\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\n }\n return [Integer[0], self];\n }\n if (n.isSmall) {\n if (b === 1) return [self, Integer[0]];\n if (b == -1) return [self.negate(), Integer[0]];\n var abs = Math.abs(b);\n if (abs < BASE) {\n value = divModSmall(a, abs);\n quotient = arrayToSmall(value[0]);\n var remainder = value[1];\n if (self.sign) remainder = -remainder;\n if (typeof quotient === 'number') {\n if (self.sign !== n.sign) quotient = -quotient;\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\n }\n return [\n new BigInteger(quotient, self.sign !== n.sign),\n new SmallInteger(remainder)\n ];\n }\n b = smallToArray(abs);\n }\n var comparison = compareAbs(a, b);\n if (comparison === -1) return [Integer[0], self];\n if (comparison === 0)\n return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\n if (a.length + b.length <= 200) value = divMod1(a, b);\n else value = divMod2(a, b);\n quotient = value[0];\n var qSign = self.sign !== n.sign,\n mod = value[1],\n mSign = self.sign;\n if (typeof quotient === 'number') {\n if (qSign) quotient = -quotient;\n quotient = new SmallInteger(quotient);\n } else quotient = new BigInteger(quotient, qSign);\n if (typeof mod === 'number') {\n if (mSign) mod = -mod;\n mod = new SmallInteger(mod);\n } else mod = new BigInteger(mod, mSign);\n return [quotient, mod];\n }\n BigInteger.prototype.divmod = function(v) {\n var result = divModAny(this, v);\n return { quotient: result[0], remainder: result[1] };\n };\n SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\n BigInteger.prototype.divide = function(v) {\n return divModAny(this, v)[0];\n };\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over =\n BigInteger.prototype.divide;\n BigInteger.prototype.mod = function(v) {\n return divModAny(this, v)[1];\n };\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder =\n BigInteger.prototype.mod;\n BigInteger.prototype.pow = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n value,\n x,\n y;\n if (b === 0) return Integer[1];\n if (a === 0) return Integer[0];\n if (a === 1) return Integer[1];\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\n if (n.sign) {\n return Integer[0];\n }\n if (!n.isSmall)\n throw new Error('The exponent ' + n.toString() + ' is too large.');\n if (this.isSmall) {\n if (isPrecise((value = Math.pow(a, b))))\n return new SmallInteger(truncate(value));\n }\n x = this;\n y = Integer[1];\n while (true) {\n if (b & (1 === 1)) {\n y = y.times(x);\n --b;\n }\n if (b === 0) break;\n b /= 2;\n x = x.square();\n }\n return y;\n };\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\n BigInteger.prototype.modPow = function(exp, mod) {\n exp = parseValue(exp);\n mod = parseValue(mod);\n if (mod.isZero()) throw new Error('Cannot take modPow with modulus 0');\n var r = Integer[1],\n base = this.mod(mod);\n while (exp.isPositive()) {\n if (base.isZero()) return Integer[0];\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\n exp = exp.divide(2);\n base = base.square().mod(mod);\n }\n return r;\n };\n SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\n function compareAbs(a, b) {\n if (a.length !== b.length) {\n return a.length > b.length ? 1 : -1;\n }\n for (var i = a.length - 1; i >= 0; i--) {\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\n }\n return 0;\n }\n BigInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) return 1;\n return compareAbs(a, b);\n };\n SmallInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = Math.abs(this.value),\n b = n.value;\n if (n.isSmall) {\n b = Math.abs(b);\n return a === b ? 0 : a > b ? 1 : -1;\n }\n return -1;\n };\n BigInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (this.sign !== n.sign) {\n return n.sign ? 1 : -1;\n }\n if (n.isSmall) {\n return this.sign ? -1 : 1;\n }\n return compareAbs(a, b) * (this.sign ? -1 : 1);\n };\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\n SmallInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) {\n return a == b ? 0 : a > b ? 1 : -1;\n }\n if (a < 0 !== n.sign) {\n return a < 0 ? -1 : 1;\n }\n return a < 0 ? 1 : -1;\n };\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\n BigInteger.prototype.equals = function(v) {\n return this.compare(v) === 0;\n };\n SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq =\n BigInteger.prototype.equals;\n BigInteger.prototype.notEquals = function(v) {\n return this.compare(v) !== 0;\n };\n SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq =\n BigInteger.prototype.notEquals;\n BigInteger.prototype.greater = function(v) {\n return this.compare(v) > 0;\n };\n SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt =\n BigInteger.prototype.greater;\n BigInteger.prototype.lesser = function(v) {\n return this.compare(v) < 0;\n };\n SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt =\n BigInteger.prototype.lesser;\n BigInteger.prototype.greaterOrEquals = function(v) {\n return this.compare(v) >= 0;\n };\n SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq =\n BigInteger.prototype.greaterOrEquals;\n BigInteger.prototype.lesserOrEquals = function(v) {\n return this.compare(v) <= 0;\n };\n SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq =\n BigInteger.prototype.lesserOrEquals;\n BigInteger.prototype.isEven = function() {\n return (this.value[0] & 1) === 0;\n };\n SmallInteger.prototype.isEven = function() {\n return (this.value & 1) === 0;\n };\n BigInteger.prototype.isOdd = function() {\n return (this.value[0] & 1) === 1;\n };\n SmallInteger.prototype.isOdd = function() {\n return (this.value & 1) === 1;\n };\n BigInteger.prototype.isPositive = function() {\n return !this.sign;\n };\n SmallInteger.prototype.isPositive = function() {\n return this.value > 0;\n };\n BigInteger.prototype.isNegative = function() {\n return this.sign;\n };\n SmallInteger.prototype.isNegative = function() {\n return this.value < 0;\n };\n BigInteger.prototype.isUnit = function() {\n return false;\n };\n SmallInteger.prototype.isUnit = function() {\n return Math.abs(this.value) === 1;\n };\n BigInteger.prototype.isZero = function() {\n return false;\n };\n SmallInteger.prototype.isZero = function() {\n return this.value === 0;\n };\n BigInteger.prototype.isDivisibleBy = function(v) {\n var n = parseValue(v);\n var value = n.value;\n if (value === 0) return false;\n if (value === 1) return true;\n if (value === 2) return this.isEven();\n return this.mod(n).equals(Integer[0]);\n };\n SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\n function isBasicPrime(v) {\n var n = v.abs();\n if (n.isUnit()) return false;\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\n if (n.lesser(49)) return true;\n }\n function millerRabinTest(n, a) {\n var nPrev = n.prev(),\n b = nPrev,\n r = 0,\n d,\n t,\n i,\n x;\n while (b.isEven()) (b = b.divide(2)), r++;\n next: for (i = 0; i < a.length; i++) {\n if (n.lesser(a[i])) continue;\n x = bigInt(a[i]).modPow(b, n);\n if (x.equals(Integer[1]) || x.equals(nPrev)) continue;\n for (d = r - 1; d != 0; d--) {\n x = x.square().mod(n);\n if (x.isUnit()) return false;\n if (x.equals(nPrev)) continue next;\n }\n return false;\n }\n return true;\n }\n BigInteger.prototype.isPrime = function(strict) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var bits = n.bitLength();\n if (bits <= 64)\n return millerRabinTest(n, [\n 2,\n 325,\n 9375,\n 28178,\n 450775,\n 9780504,\n 1795265022\n ]);\n var logN = Math.log(2) * bits;\n var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt(i + 2));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\n BigInteger.prototype.isProbablePrime = function(iterations) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var t = iterations === undefined ? 5 : iterations;\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt.randBetween(2, n.minus(2)));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\n BigInteger.prototype.modInv = function(n) {\n var t = bigInt.zero,\n newT = bigInt.one,\n r = parseValue(n),\n newR = this.abs(),\n q,\n lastT,\n lastR;\n while (!newR.equals(bigInt.zero)) {\n q = r.divide(newR);\n lastT = t;\n lastR = r;\n t = newT;\n r = newR;\n newT = lastT.subtract(q.multiply(newT));\n newR = lastR.subtract(q.multiply(newR));\n }\n if (!r.equals(1))\n throw new Error(\n this.toString() + ' and ' + n.toString() + ' are not co-prime'\n );\n if (t.compare(0) === -1) {\n t = t.add(n);\n }\n if (this.isNegative()) {\n return t.negate();\n }\n return t;\n };\n SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\n BigInteger.prototype.next = function() {\n var value = this.value;\n if (this.sign) {\n return subtractSmall(value, 1, this.sign);\n }\n return new BigInteger(addSmall(value, 1), this.sign);\n };\n SmallInteger.prototype.next = function() {\n var value = this.value;\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\n return new BigInteger(MAX_INT_ARR, false);\n };\n BigInteger.prototype.prev = function() {\n var value = this.value;\n if (this.sign) {\n return new BigInteger(addSmall(value, 1), true);\n }\n return subtractSmall(value, 1, this.sign);\n };\n SmallInteger.prototype.prev = function() {\n var value = this.value;\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\n return new BigInteger(MAX_INT_ARR, true);\n };\n var powersOfTwo = [1];\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)\n powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\n var powers2Length = powersOfTwo.length,\n highestPower2 = powersOfTwo[powers2Length - 1];\n function shift_isSmall(n) {\n return (\n ((typeof n === 'number' || typeof n === 'string') &&\n +Math.abs(n) <= BASE) ||\n (n instanceof BigInteger && n.value.length <= 1)\n );\n }\n BigInteger.prototype.shiftLeft = function(n) {\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftRight(-n);\n var result = this;\n if (result.isZero()) return result;\n while (n >= powers2Length) {\n result = result.multiply(highestPower2);\n n -= powers2Length - 1;\n }\n return result.multiply(powersOfTwo[n]);\n };\n SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\n BigInteger.prototype.shiftRight = function(n) {\n var remQuo;\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftLeft(-n);\n var result = this;\n while (n >= powers2Length) {\n if (result.isZero() || (result.isNegative() && result.isUnit()))\n return result;\n remQuo = divModAny(result, highestPower2);\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n n -= powers2Length - 1;\n }\n remQuo = divModAny(result, powersOfTwo[n]);\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n };\n SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\n function bitwise(x, y, fn) {\n y = parseValue(y);\n var xSign = x.isNegative(),\n ySign = y.isNegative();\n var xRem = xSign ? x.not() : x,\n yRem = ySign ? y.not() : y;\n var xDigit = 0,\n yDigit = 0;\n var xDivMod = null,\n yDivMod = null;\n var result = [];\n while (!xRem.isZero() || !yRem.isZero()) {\n xDivMod = divModAny(xRem, highestPower2);\n xDigit = xDivMod[1].toJSNumber();\n if (xSign) {\n xDigit = highestPower2 - 1 - xDigit;\n }\n yDivMod = divModAny(yRem, highestPower2);\n yDigit = yDivMod[1].toJSNumber();\n if (ySign) {\n yDigit = highestPower2 - 1 - yDigit;\n }\n xRem = xDivMod[0];\n yRem = yDivMod[0];\n result.push(fn(xDigit, yDigit));\n }\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\n for (var i = result.length - 1; i >= 0; i -= 1) {\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\n }\n return sum;\n }\n BigInteger.prototype.not = function() {\n return this.negate().prev();\n };\n SmallInteger.prototype.not = BigInteger.prototype.not;\n BigInteger.prototype.and = function(n) {\n return bitwise(this, n, function(a, b) {\n return a & b;\n });\n };\n SmallInteger.prototype.and = BigInteger.prototype.and;\n BigInteger.prototype.or = function(n) {\n return bitwise(this, n, function(a, b) {\n return a | b;\n });\n };\n SmallInteger.prototype.or = BigInteger.prototype.or;\n BigInteger.prototype.xor = function(n) {\n return bitwise(this, n, function(a, b) {\n return a ^ b;\n });\n };\n SmallInteger.prototype.xor = BigInteger.prototype.xor;\n var LOBMASK_I = 1 << 30,\n LOBMASK_BI = ((BASE & -BASE) * (BASE & -BASE)) | LOBMASK_I;\n function roughLOB(n) {\n var v = n.value,\n x =\n typeof v === 'number'\n ? v | LOBMASK_I\n : (v[0] + v[1] * BASE) | LOBMASK_BI;\n return x & -x;\n }\n function integerLogarithm(value, base) {\n if (base.compareTo(value) <= 0) {\n var tmp = integerLogarithm(value, base.square(base));\n var p = tmp.p;\n var e = tmp.e;\n var t = p.multiply(base);\n return t.compareTo(value) <= 0\n ? { p: t, e: e * 2 + 1 }\n : { p: p, e: e * 2 };\n }\n return { p: bigInt(1), e: 0 };\n }\n BigInteger.prototype.bitLength = function() {\n var n = this;\n if (n.compareTo(bigInt(0)) < 0) {\n n = n.negate().subtract(bigInt(1));\n }\n if (n.compareTo(bigInt(0)) === 0) {\n return bigInt(0);\n }\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\n };\n SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\n function max(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.greater(b) ? a : b;\n }\n function min(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.lesser(b) ? a : b;\n }\n function gcd(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n if (a.equals(b)) return a;\n if (a.isZero()) return b;\n if (b.isZero()) return a;\n var c = Integer[1],\n d,\n t;\n while (a.isEven() && b.isEven()) {\n d = Math.min(roughLOB(a), roughLOB(b));\n a = a.divide(d);\n b = b.divide(d);\n c = c.multiply(d);\n }\n while (a.isEven()) {\n a = a.divide(roughLOB(a));\n }\n do {\n while (b.isEven()) {\n b = b.divide(roughLOB(b));\n }\n if (a.greater(b)) {\n t = b;\n b = a;\n a = t;\n }\n b = b.subtract(a);\n } while (!b.isZero());\n return c.isUnit() ? a : a.multiply(c);\n }\n function lcm(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n return a.divide(gcd(a, b)).multiply(b);\n }\n function randBetween(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n var low = min(a, b),\n high = max(a, b);\n var range = high.subtract(low).add(1);\n if (range.isSmall) return low.add(Math.floor(Math.random() * range));\n var length = range.value.length - 1;\n var result = [],\n restricted = true;\n for (var i = length; i >= 0; i--) {\n var top = restricted ? range.value[i] : BASE;\n var digit = truncate(Math.random() * top);\n result.unshift(digit);\n if (digit < top) restricted = false;\n }\n result = arrayToSmall(result);\n return low.add(\n typeof result === 'number'\n ? new SmallInteger(result)\n : new BigInteger(result, false)\n );\n }\n var parseBase = function(text, base) {\n var length = text.length;\n var i;\n var absBase = Math.abs(base);\n for (var i = 0; i < length; i++) {\n var c = text[i].toLowerCase();\n if (c === '-') continue;\n if (/[a-z0-9]/.test(c)) {\n if (/[0-9]/.test(c) && +c >= absBase) {\n if (c === '1' && absBase === 1) continue;\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n } else if (c.charCodeAt(0) - 87 >= absBase) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n }\n }\n if (2 <= base && base <= 36) {\n if (length <= LOG_MAX_INT / Math.log(base)) {\n var result = parseInt(text, base);\n if (isNaN(result)) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n return new SmallInteger(parseInt(text, base));\n }\n }\n base = parseValue(base);\n var digits = [];\n var isNegative = text[0] === '-';\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\n var c = text[i].toLowerCase(),\n charCode = c.charCodeAt(0);\n if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));\n else if (97 <= charCode && charCode <= 122)\n digits.push(parseValue(c.charCodeAt(0) - 87));\n else if (c === '<') {\n var start = i;\n do {\n i++;\n } while (text[i] !== '>');\n digits.push(parseValue(text.slice(start + 1, i)));\n } else throw new Error(c + ' is not a valid character');\n }\n return parseBaseFromArray(digits, base, isNegative);\n };\n function parseBaseFromArray(digits, base, isNegative) {\n var val = Integer[0],\n pow = Integer[1],\n i;\n for (i = digits.length - 1; i >= 0; i--) {\n val = val.add(digits[i].times(pow));\n pow = pow.times(base);\n }\n return isNegative ? val.negate() : val;\n }\n function stringify(digit) {\n if (digit <= 35) {\n return '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(digit);\n }\n return '<' + digit + '>';\n }\n function toBase(n, base) {\n base = bigInt(base);\n if (base.isZero()) {\n if (n.isZero()) return { value: [0], isNegative: false };\n throw new Error('Cannot convert nonzero numbers to base 0.');\n }\n if (base.equals(-1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n if (n.isNegative())\n return {\n value: [].concat.apply(\n [],\n Array.apply(null, Array(-n)).map(Array.prototype.valueOf, [1, 0])\n ),\n isNegative: false\n };\n var arr = Array.apply(null, Array(+n - 1)).map(Array.prototype.valueOf, [\n 0,\n 1\n ]);\n arr.unshift([1]);\n return { value: [].concat.apply([], arr), isNegative: false };\n }\n var neg = false;\n if (n.isNegative() && base.isPositive()) {\n neg = true;\n n = n.abs();\n }\n if (base.equals(1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n return {\n value: Array.apply(null, Array(+n)).map(Number.prototype.valueOf, 1),\n isNegative: neg\n };\n }\n var out = [];\n var left = n,\n divmod;\n while (left.isNegative() || left.compareAbs(base) >= 0) {\n divmod = left.divmod(base);\n left = divmod.quotient;\n var digit = divmod.remainder;\n if (digit.isNegative()) {\n digit = base.minus(digit).abs();\n left = left.next();\n }\n out.push(digit.toJSNumber());\n }\n out.push(left.toJSNumber());\n return { value: out.reverse(), isNegative: neg };\n }\n function toBaseString(n, base) {\n var arr = toBase(n, base);\n return (arr.isNegative ? '-' : '') + arr.value.map(stringify).join('');\n }\n BigInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n SmallInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n BigInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix !== 10) return toBaseString(this, radix);\n var v = this.value,\n l = v.length,\n str = String(v[--l]),\n zeros = '0000000',\n digit;\n while (--l >= 0) {\n digit = String(v[l]);\n str += zeros.slice(digit.length) + digit;\n }\n var sign = this.sign ? '-' : '';\n return sign + str;\n };\n SmallInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix != 10) return toBaseString(this, radix);\n return String(this.value);\n };\n BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {\n return this.toString();\n };\n BigInteger.prototype.valueOf = function() {\n return parseInt(this.toString(), 10);\n };\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\n SmallInteger.prototype.valueOf = function() {\n return this.value;\n };\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\n function parseStringValue(v) {\n if (isPrecise(+v)) {\n var x = +v;\n if (x === truncate(x)) return new SmallInteger(x);\n throw new Error('Invalid integer: ' + v);\n }\n var sign = v[0] === '-';\n if (sign) v = v.slice(1);\n var split = v.split(/e/i);\n if (split.length > 2)\n throw new Error('Invalid integer: ' + split.join('e'));\n if (split.length === 2) {\n var exp = split[1];\n if (exp[0] === '+') exp = exp.slice(1);\n exp = +exp;\n if (exp !== truncate(exp) || !isPrecise(exp))\n throw new Error(\n 'Invalid integer: ' + exp + ' is not a valid exponent.'\n );\n var text = split[0];\n var decimalPlace = text.indexOf('.');\n if (decimalPlace >= 0) {\n exp -= text.length - decimalPlace - 1;\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\n }\n if (exp < 0)\n throw new Error('Cannot include negative exponent part for integers');\n text += new Array(exp + 1).join('0');\n v = text;\n }\n var isValid = /^([0-9][0-9]*)$/.test(v);\n if (!isValid) throw new Error('Invalid integer: ' + v);\n var r = [],\n max = v.length,\n l = LOG_BASE,\n min = max - l;\n while (max > 0) {\n r.push(+v.slice(min, max));\n min -= l;\n if (min < 0) min = 0;\n max -= l;\n }\n trim(r);\n return new BigInteger(r, sign);\n }\n function parseNumberValue(v) {\n if (isPrecise(v)) {\n if (v !== truncate(v)) throw new Error(v + ' is not an integer.');\n return new SmallInteger(v);\n }\n return parseStringValue(v.toString());\n }\n function parseValue(v) {\n if (typeof v === 'number') {\n return parseNumberValue(v);\n }\n if (typeof v === 'string') {\n return parseStringValue(v);\n }\n return v;\n }\n for (var i = 0; i < 1e3; i++) {\n Integer[i] = new SmallInteger(i);\n if (i > 0) Integer[-i] = new SmallInteger(-i);\n }\n Integer.one = Integer[1];\n Integer.zero = Integer[0];\n Integer.minusOne = Integer[-1];\n Integer.max = max;\n Integer.min = min;\n Integer.gcd = gcd;\n Integer.lcm = lcm;\n Integer.isInstance = function(x) {\n return x instanceof BigInteger || x instanceof SmallInteger;\n };\n Integer.randBetween = randBetween;\n Integer.fromArray = function(digits, base, isNegative) {\n return parseBaseFromArray(\n digits.map(parseValue),\n parseValue(base || 10),\n isNegative\n );\n };\n return Integer;\n})();\nif (typeof module !== 'undefined' && module.hasOwnProperty('exports')) {\n module.exports = bigInt;\n}\nif (typeof define === 'function' && define.amd) {\n define('big-integer', [], function() {\n return bigInt;\n });\n}\n\nfunction substract(a, b) {\n if (a.eq(0) || b.eq(0)) {\n return { a, b };\n } else if (a.greaterOrEquals(b.multiply(2))) {\n a = a.mod(b.multiply(2));\n return substract(a, b);\n } else if (b.greaterOrEquals(a.multiply(2))) {\n b = b.mod(a.multiply(2));\n return substract(a, b);\n } else {\n return { a, b };\n }\n}\n\nconst nd = readline().split(' ');\n\nconst result = substract(bigInt(nd[0]), bigInt(nd[1]));\n\nprint(result.a.toString() + ' ' + result.b.toString() + '\\n');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b509df8197f7cc61c2476e4e14c24c87", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var bigInt = (function(undefined) {\n 'use strict';\n var BASE = 1e7,\n LOG_BASE = 7,\n MAX_INT = 9007199254740992,\n MAX_INT_ARR = smallToArray(MAX_INT),\n LOG_MAX_INT = Math.log(MAX_INT);\n function Integer(v, radix) {\n if (typeof v === 'undefined') return Integer[0];\n if (typeof radix !== 'undefined')\n return +radix === 10 ? parseValue(v) : parseBase(v, radix);\n return parseValue(v);\n }\n function BigInteger(value, sign) {\n this.value = value;\n this.sign = sign;\n this.isSmall = false;\n }\n BigInteger.prototype = Object.create(Integer.prototype);\n function SmallInteger(value) {\n this.value = value;\n this.sign = value < 0;\n this.isSmall = true;\n }\n SmallInteger.prototype = Object.create(Integer.prototype);\n function isPrecise(n) {\n return -MAX_INT < n && n < MAX_INT;\n }\n function smallToArray(n) {\n if (n < 1e7) return [n];\n if (n < 1e14) return [n % 1e7, Math.floor(n / 1e7)];\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\n }\n function arrayToSmall(arr) {\n trim(arr);\n var length = arr.length;\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\n switch (length) {\n case 0:\n return 0;\n case 1:\n return arr[0];\n case 2:\n return arr[0] + arr[1] * BASE;\n default:\n return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\n }\n }\n return arr;\n }\n function trim(v) {\n var i = v.length;\n while (v[--i] === 0);\n v.length = i + 1;\n }\n function createArray(length) {\n var x = new Array(length);\n var i = -1;\n while (++i < length) {\n x[i] = 0;\n }\n return x;\n }\n function truncate(n) {\n if (n > 0) return Math.floor(n);\n return Math.ceil(n);\n }\n function add(a, b) {\n var l_a = a.length,\n l_b = b.length,\n r = new Array(l_a),\n carry = 0,\n base = BASE,\n sum,\n i;\n for (i = 0; i < l_b; i++) {\n sum = a[i] + b[i] + carry;\n carry = sum >= base ? 1 : 0;\n r[i] = sum - carry * base;\n }\n while (i < l_a) {\n sum = a[i] + carry;\n carry = sum === base ? 1 : 0;\n r[i++] = sum - carry * base;\n }\n if (carry > 0) r.push(carry);\n return r;\n }\n function addAny(a, b) {\n if (a.length >= b.length) return add(a, b);\n return add(b, a);\n }\n function addSmall(a, carry) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n sum,\n i;\n for (i = 0; i < l; i++) {\n sum = a[i] - base + carry;\n carry = Math.floor(sum / base);\n r[i] = sum - carry * base;\n carry += 1;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n BigInteger.prototype.add = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.subtract(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) {\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\n }\n return new BigInteger(addAny(a, b), this.sign);\n };\n BigInteger.prototype.plus = BigInteger.prototype.add;\n SmallInteger.prototype.add = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.subtract(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n if (isPrecise(a + b)) return new SmallInteger(a + b);\n b = smallToArray(Math.abs(b));\n }\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\n };\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\n function subtract(a, b) {\n var a_l = a.length,\n b_l = b.length,\n r = new Array(a_l),\n borrow = 0,\n base = BASE,\n i,\n difference;\n for (i = 0; i < b_l; i++) {\n difference = a[i] - borrow - b[i];\n if (difference < 0) {\n difference += base;\n borrow = 1;\n } else borrow = 0;\n r[i] = difference;\n }\n for (i = b_l; i < a_l; i++) {\n difference = a[i] - borrow;\n if (difference < 0) difference += base;\n else {\n r[i++] = difference;\n break;\n }\n r[i] = difference;\n }\n for (; i < a_l; i++) {\n r[i] = a[i];\n }\n trim(r);\n return r;\n }\n function subtractAny(a, b, sign) {\n var value;\n if (compareAbs(a, b) >= 0) {\n value = subtract(a, b);\n } else {\n value = subtract(b, a);\n sign = !sign;\n }\n value = arrayToSmall(value);\n if (typeof value === 'number') {\n if (sign) value = -value;\n return new SmallInteger(value);\n }\n return new BigInteger(value, sign);\n }\n function subtractSmall(a, b, sign) {\n var l = a.length,\n r = new Array(l),\n carry = -b,\n base = BASE,\n i,\n difference;\n for (i = 0; i < l; i++) {\n difference = a[i] + carry;\n carry = Math.floor(difference / base);\n difference %= base;\n r[i] = difference < 0 ? difference + base : difference;\n }\n r = arrayToSmall(r);\n if (typeof r === 'number') {\n if (sign) r = -r;\n return new SmallInteger(r);\n }\n return new BigInteger(r, sign);\n }\n BigInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.add(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) return subtractSmall(a, Math.abs(b), this.sign);\n return subtractAny(a, b, this.sign);\n };\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\n SmallInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.add(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n return new SmallInteger(a - b);\n }\n return subtractSmall(b, Math.abs(a), a >= 0);\n };\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\n BigInteger.prototype.negate = function() {\n return new BigInteger(this.value, !this.sign);\n };\n SmallInteger.prototype.negate = function() {\n var sign = this.sign;\n var small = new SmallInteger(-this.value);\n small.sign = !sign;\n return small;\n };\n BigInteger.prototype.abs = function() {\n return new BigInteger(this.value, false);\n };\n SmallInteger.prototype.abs = function() {\n return new SmallInteger(Math.abs(this.value));\n };\n function multiplyLong(a, b) {\n var a_l = a.length,\n b_l = b.length,\n l = a_l + b_l,\n r = createArray(l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n b_j;\n for (i = 0; i < a_l; ++i) {\n a_i = a[i];\n for (var j = 0; j < b_l; ++j) {\n b_j = b[j];\n product = a_i * b_j + r[i + j];\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n r[i + j + 1] += carry;\n }\n }\n trim(r);\n return r;\n }\n function multiplySmall(a, b) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n carry = 0,\n product,\n i;\n for (i = 0; i < l; i++) {\n product = a[i] * b + carry;\n carry = Math.floor(product / base);\n r[i] = product - carry * base;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n function shiftLeft(x, n) {\n var r = [];\n while (n-- > 0) r.push(0);\n return r.concat(x);\n }\n function multiplyKaratsuba(x, y) {\n var n = Math.max(x.length, y.length);\n if (n <= 30) return multiplyLong(x, y);\n n = Math.ceil(n / 2);\n var b = x.slice(n),\n a = x.slice(0, n),\n d = y.slice(n),\n c = y.slice(0, n);\n var ac = multiplyKaratsuba(a, c),\n bd = multiplyKaratsuba(b, d),\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\n var product = addAny(\n addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)),\n shiftLeft(bd, 2 * n)\n );\n trim(product);\n return product;\n }\n function useKaratsuba(l1, l2) {\n return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;\n }\n BigInteger.prototype.multiply = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n sign = this.sign !== n.sign,\n abs;\n if (n.isSmall) {\n if (b === 0) return Integer[0];\n if (b === 1) return this;\n if (b === -1) return this.negate();\n abs = Math.abs(b);\n if (abs < BASE) {\n return new BigInteger(multiplySmall(a, abs), sign);\n }\n b = smallToArray(abs);\n }\n if (useKaratsuba(a.length, b.length))\n return new BigInteger(multiplyKaratsuba(a, b), sign);\n return new BigInteger(multiplyLong(a, b), sign);\n };\n BigInteger.prototype.times = BigInteger.prototype.multiply;\n function multiplySmallAndArray(a, b, sign) {\n if (a < BASE) {\n return new BigInteger(multiplySmall(b, a), sign);\n }\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\n }\n SmallInteger.prototype._multiplyBySmall = function(a) {\n if (isPrecise(a.value * this.value)) {\n return new SmallInteger(a.value * this.value);\n }\n return multiplySmallAndArray(\n Math.abs(a.value),\n smallToArray(Math.abs(this.value)),\n this.sign !== a.sign\n );\n };\n BigInteger.prototype._multiplyBySmall = function(a) {\n if (a.value === 0) return Integer[0];\n if (a.value === 1) return this;\n if (a.value === -1) return this.negate();\n return multiplySmallAndArray(\n Math.abs(a.value),\n this.value,\n this.sign !== a.sign\n );\n };\n SmallInteger.prototype.multiply = function(v) {\n return parseValue(v)._multiplyBySmall(this);\n };\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\n function square(a) {\n var l = a.length,\n r = createArray(l + l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n a_j;\n for (i = 0; i < l; i++) {\n a_i = a[i];\n carry = 0 - a_i * a_i;\n for (var j = i; j < l; j++) {\n a_j = a[j];\n product = 2 * (a_i * a_j) + r[i + j] + carry;\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n }\n r[i + l] = carry;\n }\n trim(r);\n return r;\n }\n BigInteger.prototype.square = function() {\n return new BigInteger(square(this.value), false);\n };\n SmallInteger.prototype.square = function() {\n var value = this.value * this.value;\n if (isPrecise(value)) return new SmallInteger(value);\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\n };\n function divMod1(a, b) {\n var a_l = a.length,\n b_l = b.length,\n base = BASE,\n result = createArray(b.length),\n divisorMostSignificantDigit = b[b_l - 1],\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\n remainder = multiplySmall(a, lambda),\n divisor = multiplySmall(b, lambda),\n quotientDigit,\n shift,\n carry,\n borrow,\n i,\n l,\n q;\n if (remainder.length <= a_l) remainder.push(0);\n divisor.push(0);\n divisorMostSignificantDigit = divisor[b_l - 1];\n for (shift = a_l - b_l; shift >= 0; shift--) {\n quotientDigit = base - 1;\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\n quotientDigit = Math.floor(\n (remainder[shift + b_l] * base + remainder[shift + b_l - 1]) /\n divisorMostSignificantDigit\n );\n }\n carry = 0;\n borrow = 0;\n l = divisor.length;\n for (i = 0; i < l; i++) {\n carry += quotientDigit * divisor[i];\n q = Math.floor(carry / base);\n borrow += remainder[shift + i] - (carry - q * base);\n carry = q;\n if (borrow < 0) {\n remainder[shift + i] = borrow + base;\n borrow = -1;\n } else {\n remainder[shift + i] = borrow;\n borrow = 0;\n }\n }\n while (borrow !== 0) {\n quotientDigit -= 1;\n carry = 0;\n for (i = 0; i < l; i++) {\n carry += remainder[shift + i] - base + divisor[i];\n if (carry < 0) {\n remainder[shift + i] = carry + base;\n carry = 0;\n } else {\n remainder[shift + i] = carry;\n carry = 1;\n }\n }\n borrow += carry;\n }\n result[shift] = quotientDigit;\n }\n remainder = divModSmall(remainder, lambda)[0];\n return [arrayToSmall(result), arrayToSmall(remainder)];\n }\n function divMod2(a, b) {\n var a_l = a.length,\n b_l = b.length,\n result = [],\n part = [],\n base = BASE,\n guess,\n xlen,\n highx,\n highy,\n check;\n while (a_l) {\n part.unshift(a[--a_l]);\n trim(part);\n if (compareAbs(part, b) < 0) {\n result.push(0);\n continue;\n }\n xlen = part.length;\n highx = part[xlen - 1] * base + part[xlen - 2];\n highy = b[b_l - 1] * base + b[b_l - 2];\n if (xlen > b_l) {\n highx = (highx + 1) * base;\n }\n guess = Math.ceil(highx / highy);\n do {\n check = multiplySmall(b, guess);\n if (compareAbs(check, part) <= 0) break;\n guess--;\n } while (guess);\n result.push(guess);\n part = subtract(part, check);\n }\n result.reverse();\n return [arrayToSmall(result), arrayToSmall(part)];\n }\n function divModSmall(value, lambda) {\n var length = value.length,\n quotient = createArray(length),\n base = BASE,\n i,\n q,\n remainder,\n divisor;\n remainder = 0;\n for (i = length - 1; i >= 0; --i) {\n divisor = remainder * base + value[i];\n q = truncate(divisor / lambda);\n remainder = divisor - q * lambda;\n quotient[i] = q | 0;\n }\n return [quotient, remainder | 0];\n }\n function divModAny(self, v) {\n var value,\n n = parseValue(v);\n var a = self.value,\n b = n.value;\n var quotient;\n if (b === 0) throw new Error('Cannot divide by zero');\n if (self.isSmall) {\n if (n.isSmall) {\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\n }\n return [Integer[0], self];\n }\n if (n.isSmall) {\n if (b === 1) return [self, Integer[0]];\n if (b == -1) return [self.negate(), Integer[0]];\n var abs = Math.abs(b);\n if (abs < BASE) {\n value = divModSmall(a, abs);\n quotient = arrayToSmall(value[0]);\n var remainder = value[1];\n if (self.sign) remainder = -remainder;\n if (typeof quotient === 'number') {\n if (self.sign !== n.sign) quotient = -quotient;\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\n }\n return [\n new BigInteger(quotient, self.sign !== n.sign),\n new SmallInteger(remainder)\n ];\n }\n b = smallToArray(abs);\n }\n var comparison = compareAbs(a, b);\n if (comparison === -1) return [Integer[0], self];\n if (comparison === 0)\n return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\n if (a.length + b.length <= 200) value = divMod1(a, b);\n else value = divMod2(a, b);\n quotient = value[0];\n var qSign = self.sign !== n.sign,\n mod = value[1],\n mSign = self.sign;\n if (typeof quotient === 'number') {\n if (qSign) quotient = -quotient;\n quotient = new SmallInteger(quotient);\n } else quotient = new BigInteger(quotient, qSign);\n if (typeof mod === 'number') {\n if (mSign) mod = -mod;\n mod = new SmallInteger(mod);\n } else mod = new BigInteger(mod, mSign);\n return [quotient, mod];\n }\n BigInteger.prototype.divmod = function(v) {\n var result = divModAny(this, v);\n return { quotient: result[0], remainder: result[1] };\n };\n SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\n BigInteger.prototype.divide = function(v) {\n return divModAny(this, v)[0];\n };\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over =\n BigInteger.prototype.divide;\n BigInteger.prototype.mod = function(v) {\n return divModAny(this, v)[1];\n };\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder =\n BigInteger.prototype.mod;\n BigInteger.prototype.pow = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n value,\n x,\n y;\n if (b === 0) return Integer[1];\n if (a === 0) return Integer[0];\n if (a === 1) return Integer[1];\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\n if (n.sign) {\n return Integer[0];\n }\n if (!n.isSmall)\n throw new Error('The exponent ' + n.toString() + ' is too large.');\n if (this.isSmall) {\n if (isPrecise((value = Math.pow(a, b))))\n return new SmallInteger(truncate(value));\n }\n x = this;\n y = Integer[1];\n while (true) {\n if (b & (1 === 1)) {\n y = y.times(x);\n --b;\n }\n if (b === 0) break;\n b /= 2;\n x = x.square();\n }\n return y;\n };\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\n BigInteger.prototype.modPow = function(exp, mod) {\n exp = parseValue(exp);\n mod = parseValue(mod);\n if (mod.isZero()) throw new Error('Cannot take modPow with modulus 0');\n var r = Integer[1],\n base = this.mod(mod);\n while (exp.isPositive()) {\n if (base.isZero()) return Integer[0];\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\n exp = exp.divide(2);\n base = base.square().mod(mod);\n }\n return r;\n };\n SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\n function compareAbs(a, b) {\n if (a.length !== b.length) {\n return a.length > b.length ? 1 : -1;\n }\n for (var i = a.length - 1; i >= 0; i--) {\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\n }\n return 0;\n }\n BigInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) return 1;\n return compareAbs(a, b);\n };\n SmallInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = Math.abs(this.value),\n b = n.value;\n if (n.isSmall) {\n b = Math.abs(b);\n return a === b ? 0 : a > b ? 1 : -1;\n }\n return -1;\n };\n BigInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (this.sign !== n.sign) {\n return n.sign ? 1 : -1;\n }\n if (n.isSmall) {\n return this.sign ? -1 : 1;\n }\n return compareAbs(a, b) * (this.sign ? -1 : 1);\n };\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\n SmallInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) {\n return a == b ? 0 : a > b ? 1 : -1;\n }\n if (a < 0 !== n.sign) {\n return a < 0 ? -1 : 1;\n }\n return a < 0 ? 1 : -1;\n };\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\n BigInteger.prototype.equals = function(v) {\n return this.compare(v) === 0;\n };\n SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq =\n BigInteger.prototype.equals;\n BigInteger.prototype.notEquals = function(v) {\n return this.compare(v) !== 0;\n };\n SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq =\n BigInteger.prototype.notEquals;\n BigInteger.prototype.greater = function(v) {\n return this.compare(v) > 0;\n };\n SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt =\n BigInteger.prototype.greater;\n BigInteger.prototype.lesser = function(v) {\n return this.compare(v) < 0;\n };\n SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt =\n BigInteger.prototype.lesser;\n BigInteger.prototype.greaterOrEquals = function(v) {\n return this.compare(v) >= 0;\n };\n SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq =\n BigInteger.prototype.greaterOrEquals;\n BigInteger.prototype.lesserOrEquals = function(v) {\n return this.compare(v) <= 0;\n };\n SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq =\n BigInteger.prototype.lesserOrEquals;\n BigInteger.prototype.isEven = function() {\n return (this.value[0] & 1) === 0;\n };\n SmallInteger.prototype.isEven = function() {\n return (this.value & 1) === 0;\n };\n BigInteger.prototype.isOdd = function() {\n return (this.value[0] & 1) === 1;\n };\n SmallInteger.prototype.isOdd = function() {\n return (this.value & 1) === 1;\n };\n BigInteger.prototype.isPositive = function() {\n return !this.sign;\n };\n SmallInteger.prototype.isPositive = function() {\n return this.value > 0;\n };\n BigInteger.prototype.isNegative = function() {\n return this.sign;\n };\n SmallInteger.prototype.isNegative = function() {\n return this.value < 0;\n };\n BigInteger.prototype.isUnit = function() {\n return false;\n };\n SmallInteger.prototype.isUnit = function() {\n return Math.abs(this.value) === 1;\n };\n BigInteger.prototype.isZero = function() {\n return false;\n };\n SmallInteger.prototype.isZero = function() {\n return this.value === 0;\n };\n BigInteger.prototype.isDivisibleBy = function(v) {\n var n = parseValue(v);\n var value = n.value;\n if (value === 0) return false;\n if (value === 1) return true;\n if (value === 2) return this.isEven();\n return this.mod(n).equals(Integer[0]);\n };\n SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\n function isBasicPrime(v) {\n var n = v.abs();\n if (n.isUnit()) return false;\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\n if (n.lesser(49)) return true;\n }\n function millerRabinTest(n, a) {\n var nPrev = n.prev(),\n b = nPrev,\n r = 0,\n d,\n t,\n i,\n x;\n while (b.isEven()) (b = b.divide(2)), r++;\n next: for (i = 0; i < a.length; i++) {\n if (n.lesser(a[i])) continue;\n x = bigInt(a[i]).modPow(b, n);\n if (x.equals(Integer[1]) || x.equals(nPrev)) continue;\n for (d = r - 1; d != 0; d--) {\n x = x.square().mod(n);\n if (x.isUnit()) return false;\n if (x.equals(nPrev)) continue next;\n }\n return false;\n }\n return true;\n }\n BigInteger.prototype.isPrime = function(strict) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var bits = n.bitLength();\n if (bits <= 64)\n return millerRabinTest(n, [\n 2,\n 325,\n 9375,\n 28178,\n 450775,\n 9780504,\n 1795265022\n ]);\n var logN = Math.log(2) * bits;\n var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt(i + 2));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\n BigInteger.prototype.isProbablePrime = function(iterations) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var t = iterations === undefined ? 5 : iterations;\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt.randBetween(2, n.minus(2)));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\n BigInteger.prototype.modInv = function(n) {\n var t = bigInt.zero,\n newT = bigInt.one,\n r = parseValue(n),\n newR = this.abs(),\n q,\n lastT,\n lastR;\n while (!newR.equals(bigInt.zero)) {\n q = r.divide(newR);\n lastT = t;\n lastR = r;\n t = newT;\n r = newR;\n newT = lastT.subtract(q.multiply(newT));\n newR = lastR.subtract(q.multiply(newR));\n }\n if (!r.equals(1))\n throw new Error(\n this.toString() + ' and ' + n.toString() + ' are not co-prime'\n );\n if (t.compare(0) === -1) {\n t = t.add(n);\n }\n if (this.isNegative()) {\n return t.negate();\n }\n return t;\n };\n SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\n BigInteger.prototype.next = function() {\n var value = this.value;\n if (this.sign) {\n return subtractSmall(value, 1, this.sign);\n }\n return new BigInteger(addSmall(value, 1), this.sign);\n };\n SmallInteger.prototype.next = function() {\n var value = this.value;\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\n return new BigInteger(MAX_INT_ARR, false);\n };\n BigInteger.prototype.prev = function() {\n var value = this.value;\n if (this.sign) {\n return new BigInteger(addSmall(value, 1), true);\n }\n return subtractSmall(value, 1, this.sign);\n };\n SmallInteger.prototype.prev = function() {\n var value = this.value;\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\n return new BigInteger(MAX_INT_ARR, true);\n };\n var powersOfTwo = [1];\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)\n powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\n var powers2Length = powersOfTwo.length,\n highestPower2 = powersOfTwo[powers2Length - 1];\n function shift_isSmall(n) {\n return (\n ((typeof n === 'number' || typeof n === 'string') &&\n +Math.abs(n) <= BASE) ||\n (n instanceof BigInteger && n.value.length <= 1)\n );\n }\n BigInteger.prototype.shiftLeft = function(n) {\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftRight(-n);\n var result = this;\n if (result.isZero()) return result;\n while (n >= powers2Length) {\n result = result.multiply(highestPower2);\n n -= powers2Length - 1;\n }\n return result.multiply(powersOfTwo[n]);\n };\n SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\n BigInteger.prototype.shiftRight = function(n) {\n var remQuo;\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftLeft(-n);\n var result = this;\n while (n >= powers2Length) {\n if (result.isZero() || (result.isNegative() && result.isUnit()))\n return result;\n remQuo = divModAny(result, highestPower2);\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n n -= powers2Length - 1;\n }\n remQuo = divModAny(result, powersOfTwo[n]);\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n };\n SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\n function bitwise(x, y, fn) {\n y = parseValue(y);\n var xSign = x.isNegative(),\n ySign = y.isNegative();\n var xRem = xSign ? x.not() : x,\n yRem = ySign ? y.not() : y;\n var xDigit = 0,\n yDigit = 0;\n var xDivMod = null,\n yDivMod = null;\n var result = [];\n while (!xRem.isZero() || !yRem.isZero()) {\n xDivMod = divModAny(xRem, highestPower2);\n xDigit = xDivMod[1].toJSNumber();\n if (xSign) {\n xDigit = highestPower2 - 1 - xDigit;\n }\n yDivMod = divModAny(yRem, highestPower2);\n yDigit = yDivMod[1].toJSNumber();\n if (ySign) {\n yDigit = highestPower2 - 1 - yDigit;\n }\n xRem = xDivMod[0];\n yRem = yDivMod[0];\n result.push(fn(xDigit, yDigit));\n }\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\n for (var i = result.length - 1; i >= 0; i -= 1) {\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\n }\n return sum;\n }\n BigInteger.prototype.not = function() {\n return this.negate().prev();\n };\n SmallInteger.prototype.not = BigInteger.prototype.not;\n BigInteger.prototype.and = function(n) {\n return bitwise(this, n, function(a, b) {\n return a & b;\n });\n };\n SmallInteger.prototype.and = BigInteger.prototype.and;\n BigInteger.prototype.or = function(n) {\n return bitwise(this, n, function(a, b) {\n return a | b;\n });\n };\n SmallInteger.prototype.or = BigInteger.prototype.or;\n BigInteger.prototype.xor = function(n) {\n return bitwise(this, n, function(a, b) {\n return a ^ b;\n });\n };\n SmallInteger.prototype.xor = BigInteger.prototype.xor;\n var LOBMASK_I = 1 << 30,\n LOBMASK_BI = ((BASE & -BASE) * (BASE & -BASE)) | LOBMASK_I;\n function roughLOB(n) {\n var v = n.value,\n x =\n typeof v === 'number'\n ? v | LOBMASK_I\n : (v[0] + v[1] * BASE) | LOBMASK_BI;\n return x & -x;\n }\n function integerLogarithm(value, base) {\n if (base.compareTo(value) <= 0) {\n var tmp = integerLogarithm(value, base.square(base));\n var p = tmp.p;\n var e = tmp.e;\n var t = p.multiply(base);\n return t.compareTo(value) <= 0\n ? { p: t, e: e * 2 + 1 }\n : { p: p, e: e * 2 };\n }\n return { p: bigInt(1), e: 0 };\n }\n BigInteger.prototype.bitLength = function() {\n var n = this;\n if (n.compareTo(bigInt(0)) < 0) {\n n = n.negate().subtract(bigInt(1));\n }\n if (n.compareTo(bigInt(0)) === 0) {\n return bigInt(0);\n }\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\n };\n SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\n function max(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.greater(b) ? a : b;\n }\n function min(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.lesser(b) ? a : b;\n }\n function gcd(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n if (a.equals(b)) return a;\n if (a.isZero()) return b;\n if (b.isZero()) return a;\n var c = Integer[1],\n d,\n t;\n while (a.isEven() && b.isEven()) {\n d = Math.min(roughLOB(a), roughLOB(b));\n a = a.divide(d);\n b = b.divide(d);\n c = c.multiply(d);\n }\n while (a.isEven()) {\n a = a.divide(roughLOB(a));\n }\n do {\n while (b.isEven()) {\n b = b.divide(roughLOB(b));\n }\n if (a.greater(b)) {\n t = b;\n b = a;\n a = t;\n }\n b = b.subtract(a);\n } while (!b.isZero());\n return c.isUnit() ? a : a.multiply(c);\n }\n function lcm(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n return a.divide(gcd(a, b)).multiply(b);\n }\n function randBetween(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n var low = min(a, b),\n high = max(a, b);\n var range = high.subtract(low).add(1);\n if (range.isSmall) return low.add(Math.floor(Math.random() * range));\n var length = range.value.length - 1;\n var result = [],\n restricted = true;\n for (var i = length; i >= 0; i--) {\n var top = restricted ? range.value[i] : BASE;\n var digit = truncate(Math.random() * top);\n result.unshift(digit);\n if (digit < top) restricted = false;\n }\n result = arrayToSmall(result);\n return low.add(\n typeof result === 'number'\n ? new SmallInteger(result)\n : new BigInteger(result, false)\n );\n }\n var parseBase = function(text, base) {\n var length = text.length;\n var i;\n var absBase = Math.abs(base);\n for (var i = 0; i < length; i++) {\n var c = text[i].toLowerCase();\n if (c === '-') continue;\n if (/[a-z0-9]/.test(c)) {\n if (/[0-9]/.test(c) && +c >= absBase) {\n if (c === '1' && absBase === 1) continue;\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n } else if (c.charCodeAt(0) - 87 >= absBase) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n }\n }\n if (2 <= base && base <= 36) {\n if (length <= LOG_MAX_INT / Math.log(base)) {\n var result = parseInt(text, base);\n if (isNaN(result)) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n return new SmallInteger(parseInt(text, base));\n }\n }\n base = parseValue(base);\n var digits = [];\n var isNegative = text[0] === '-';\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\n var c = text[i].toLowerCase(),\n charCode = c.charCodeAt(0);\n if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));\n else if (97 <= charCode && charCode <= 122)\n digits.push(parseValue(c.charCodeAt(0) - 87));\n else if (c === '<') {\n var start = i;\n do {\n i++;\n } while (text[i] !== '>');\n digits.push(parseValue(text.slice(start + 1, i)));\n } else throw new Error(c + ' is not a valid character');\n }\n return parseBaseFromArray(digits, base, isNegative);\n };\n function parseBaseFromArray(digits, base, isNegative) {\n var val = Integer[0],\n pow = Integer[1],\n i;\n for (i = digits.length - 1; i >= 0; i--) {\n val = val.add(digits[i].times(pow));\n pow = pow.times(base);\n }\n return isNegative ? val.negate() : val;\n }\n function stringify(digit) {\n if (digit <= 35) {\n return '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(digit);\n }\n return '<' + digit + '>';\n }\n function toBase(n, base) {\n base = bigInt(base);\n if (base.isZero()) {\n if (n.isZero()) return { value: [0], isNegative: false };\n throw new Error('Cannot convert nonzero numbers to base 0.');\n }\n if (base.equals(-1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n if (n.isNegative())\n return {\n value: [].concat.apply(\n [],\n Array.apply(null, Array(-n)).map(Array.prototype.valueOf, [1, 0])\n ),\n isNegative: false\n };\n var arr = Array.apply(null, Array(+n - 1)).map(Array.prototype.valueOf, [\n 0,\n 1\n ]);\n arr.unshift([1]);\n return { value: [].concat.apply([], arr), isNegative: false };\n }\n var neg = false;\n if (n.isNegative() && base.isPositive()) {\n neg = true;\n n = n.abs();\n }\n if (base.equals(1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n return {\n value: Array.apply(null, Array(+n)).map(Number.prototype.valueOf, 1),\n isNegative: neg\n };\n }\n var out = [];\n var left = n,\n divmod;\n while (left.isNegative() || left.compareAbs(base) >= 0) {\n divmod = left.divmod(base);\n left = divmod.quotient;\n var digit = divmod.remainder;\n if (digit.isNegative()) {\n digit = base.minus(digit).abs();\n left = left.next();\n }\n out.push(digit.toJSNumber());\n }\n out.push(left.toJSNumber());\n return { value: out.reverse(), isNegative: neg };\n }\n function toBaseString(n, base) {\n var arr = toBase(n, base);\n return (arr.isNegative ? '-' : '') + arr.value.map(stringify).join('');\n }\n BigInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n SmallInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n BigInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix !== 10) return toBaseString(this, radix);\n var v = this.value,\n l = v.length,\n str = String(v[--l]),\n zeros = '0000000',\n digit;\n while (--l >= 0) {\n digit = String(v[l]);\n str += zeros.slice(digit.length) + digit;\n }\n var sign = this.sign ? '-' : '';\n return sign + str;\n };\n SmallInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix != 10) return toBaseString(this, radix);\n return String(this.value);\n };\n BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {\n return this.toString();\n };\n BigInteger.prototype.valueOf = function() {\n return parseInt(this.toString(), 10);\n };\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\n SmallInteger.prototype.valueOf = function() {\n return this.value;\n };\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\n function parseStringValue(v) {\n if (isPrecise(+v)) {\n var x = +v;\n if (x === truncate(x)) return new SmallInteger(x);\n throw new Error('Invalid integer: ' + v);\n }\n var sign = v[0] === '-';\n if (sign) v = v.slice(1);\n var split = v.split(/e/i);\n if (split.length > 2)\n throw new Error('Invalid integer: ' + split.join('e'));\n if (split.length === 2) {\n var exp = split[1];\n if (exp[0] === '+') exp = exp.slice(1);\n exp = +exp;\n if (exp !== truncate(exp) || !isPrecise(exp))\n throw new Error(\n 'Invalid integer: ' + exp + ' is not a valid exponent.'\n );\n var text = split[0];\n var decimalPlace = text.indexOf('.');\n if (decimalPlace >= 0) {\n exp -= text.length - decimalPlace - 1;\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\n }\n if (exp < 0)\n throw new Error('Cannot include negative exponent part for integers');\n text += new Array(exp + 1).join('0');\n v = text;\n }\n var isValid = /^([0-9][0-9]*)$/.test(v);\n if (!isValid) throw new Error('Invalid integer: ' + v);\n var r = [],\n max = v.length,\n l = LOG_BASE,\n min = max - l;\n while (max > 0) {\n r.push(+v.slice(min, max));\n min -= l;\n if (min < 0) min = 0;\n max -= l;\n }\n trim(r);\n return new BigInteger(r, sign);\n }\n function parseNumberValue(v) {\n if (isPrecise(v)) {\n if (v !== truncate(v)) throw new Error(v + ' is not an integer.');\n return new SmallInteger(v);\n }\n return parseStringValue(v.toString());\n }\n function parseValue(v) {\n if (typeof v === 'number') {\n return parseNumberValue(v);\n }\n if (typeof v === 'string') {\n return parseStringValue(v);\n }\n return v;\n }\n for (var i = 0; i < 1e3; i++) {\n Integer[i] = new SmallInteger(i);\n if (i > 0) Integer[-i] = new SmallInteger(-i);\n }\n Integer.one = Integer[1];\n Integer.zero = Integer[0];\n Integer.minusOne = Integer[-1];\n Integer.max = max;\n Integer.min = min;\n Integer.gcd = gcd;\n Integer.lcm = lcm;\n Integer.isInstance = function(x) {\n return x instanceof BigInteger || x instanceof SmallInteger;\n };\n Integer.randBetween = randBetween;\n Integer.fromArray = function(digits, base, isNegative) {\n return parseBaseFromArray(\n digits.map(parseValue),\n parseValue(base || 10),\n isNegative\n );\n };\n return Integer;\n})();\nif (typeof module !== 'undefined' && module.hasOwnProperty('exports')) {\n module.exports = bigInt;\n}\nif (typeof define === 'function' && define.amd) {\n define('big-integer', [], function() {\n return bigInt;\n });\n}\n\nfunction substract(a, b) {\n if (a.eq(0) || b.eq(0)) {\n return { a, b };\n } else if (a.greaterOrEquals(b.multiply(2))) {\n a = a.mod(b.multiply(2));\n return substract(a, b);\n } else if (b.greaterOrEquals(a.multiply(2))) {\n b = b.mod(a.multiply(2));\n return substract(a, b);\n } else {\n return { a, b };\n }\n}\n\nconst nd = readline().split(' ');\n\nconst result = substract(bigInt(nd[0]), bigInt(nd[1]));\n\nprint(result.a.toString() + ' ' + result.b.toString() + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f474fc2933eb6f56c7297a520befc654", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var bigInt = (function(undefined) {\n 'use strict';\n var BASE = 1e7,\n LOG_BASE = 7,\n MAX_INT = 9007199254740992,\n MAX_INT_ARR = smallToArray(MAX_INT),\n LOG_MAX_INT = Math.log(MAX_INT);\n function Integer(v, radix) {\n if (typeof v === 'undefined') return Integer[0];\n if (typeof radix !== 'undefined')\n return +radix === 10 ? parseValue(v) : parseBase(v, radix);\n return parseValue(v);\n }\n function BigInteger(value, sign) {\n this.value = value;\n this.sign = sign;\n this.isSmall = false;\n }\n BigInteger.prototype = Object.create(Integer.prototype);\n function SmallInteger(value) {\n this.value = value;\n this.sign = value < 0;\n this.isSmall = true;\n }\n SmallInteger.prototype = Object.create(Integer.prototype);\n function isPrecise(n) {\n return -MAX_INT < n && n < MAX_INT;\n }\n function smallToArray(n) {\n if (n < 1e7) return [n];\n if (n < 1e14) return [n % 1e7, Math.floor(n / 1e7)];\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\n }\n function arrayToSmall(arr) {\n trim(arr);\n var length = arr.length;\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\n switch (length) {\n case 0:\n return 0;\n case 1:\n return arr[0];\n case 2:\n return arr[0] + arr[1] * BASE;\n default:\n return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\n }\n }\n return arr;\n }\n function trim(v) {\n var i = v.length;\n while (v[--i] === 0);\n v.length = i + 1;\n }\n function createArray(length) {\n var x = new Array(length);\n var i = -1;\n while (++i < length) {\n x[i] = 0;\n }\n return x;\n }\n function truncate(n) {\n if (n > 0) return Math.floor(n);\n return Math.ceil(n);\n }\n function add(a, b) {\n var l_a = a.length,\n l_b = b.length,\n r = new Array(l_a),\n carry = 0,\n base = BASE,\n sum,\n i;\n for (i = 0; i < l_b; i++) {\n sum = a[i] + b[i] + carry;\n carry = sum >= base ? 1 : 0;\n r[i] = sum - carry * base;\n }\n while (i < l_a) {\n sum = a[i] + carry;\n carry = sum === base ? 1 : 0;\n r[i++] = sum - carry * base;\n }\n if (carry > 0) r.push(carry);\n return r;\n }\n function addAny(a, b) {\n if (a.length >= b.length) return add(a, b);\n return add(b, a);\n }\n function addSmall(a, carry) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n sum,\n i;\n for (i = 0; i < l; i++) {\n sum = a[i] - base + carry;\n carry = Math.floor(sum / base);\n r[i] = sum - carry * base;\n carry += 1;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n BigInteger.prototype.add = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.subtract(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) {\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\n }\n return new BigInteger(addAny(a, b), this.sign);\n };\n BigInteger.prototype.plus = BigInteger.prototype.add;\n SmallInteger.prototype.add = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.subtract(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n if (isPrecise(a + b)) return new SmallInteger(a + b);\n b = smallToArray(Math.abs(b));\n }\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\n };\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\n function subtract(a, b) {\n var a_l = a.length,\n b_l = b.length,\n r = new Array(a_l),\n borrow = 0,\n base = BASE,\n i,\n difference;\n for (i = 0; i < b_l; i++) {\n difference = a[i] - borrow - b[i];\n if (difference < 0) {\n difference += base;\n borrow = 1;\n } else borrow = 0;\n r[i] = difference;\n }\n for (i = b_l; i < a_l; i++) {\n difference = a[i] - borrow;\n if (difference < 0) difference += base;\n else {\n r[i++] = difference;\n break;\n }\n r[i] = difference;\n }\n for (; i < a_l; i++) {\n r[i] = a[i];\n }\n trim(r);\n return r;\n }\n function subtractAny(a, b, sign) {\n var value;\n if (compareAbs(a, b) >= 0) {\n value = subtract(a, b);\n } else {\n value = subtract(b, a);\n sign = !sign;\n }\n value = arrayToSmall(value);\n if (typeof value === 'number') {\n if (sign) value = -value;\n return new SmallInteger(value);\n }\n return new BigInteger(value, sign);\n }\n function subtractSmall(a, b, sign) {\n var l = a.length,\n r = new Array(l),\n carry = -b,\n base = BASE,\n i,\n difference;\n for (i = 0; i < l; i++) {\n difference = a[i] + carry;\n carry = Math.floor(difference / base);\n difference %= base;\n r[i] = difference < 0 ? difference + base : difference;\n }\n r = arrayToSmall(r);\n if (typeof r === 'number') {\n if (sign) r = -r;\n return new SmallInteger(r);\n }\n return new BigInteger(r, sign);\n }\n BigInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n if (this.sign !== n.sign) {\n return this.add(n.negate());\n }\n var a = this.value,\n b = n.value;\n if (n.isSmall) return subtractSmall(a, Math.abs(b), this.sign);\n return subtractAny(a, b, this.sign);\n };\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\n SmallInteger.prototype.subtract = function(v) {\n var n = parseValue(v);\n var a = this.value;\n if (a < 0 !== n.sign) {\n return this.add(n.negate());\n }\n var b = n.value;\n if (n.isSmall) {\n return new SmallInteger(a - b);\n }\n return subtractSmall(b, Math.abs(a), a >= 0);\n };\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\n BigInteger.prototype.negate = function() {\n return new BigInteger(this.value, !this.sign);\n };\n SmallInteger.prototype.negate = function() {\n var sign = this.sign;\n var small = new SmallInteger(-this.value);\n small.sign = !sign;\n return small;\n };\n BigInteger.prototype.abs = function() {\n return new BigInteger(this.value, false);\n };\n SmallInteger.prototype.abs = function() {\n return new SmallInteger(Math.abs(this.value));\n };\n function multiplyLong(a, b) {\n var a_l = a.length,\n b_l = b.length,\n l = a_l + b_l,\n r = createArray(l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n b_j;\n for (i = 0; i < a_l; ++i) {\n a_i = a[i];\n for (var j = 0; j < b_l; ++j) {\n b_j = b[j];\n product = a_i * b_j + r[i + j];\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n r[i + j + 1] += carry;\n }\n }\n trim(r);\n return r;\n }\n function multiplySmall(a, b) {\n var l = a.length,\n r = new Array(l),\n base = BASE,\n carry = 0,\n product,\n i;\n for (i = 0; i < l; i++) {\n product = a[i] * b + carry;\n carry = Math.floor(product / base);\n r[i] = product - carry * base;\n }\n while (carry > 0) {\n r[i++] = carry % base;\n carry = Math.floor(carry / base);\n }\n return r;\n }\n function shiftLeft(x, n) {\n var r = [];\n while (n-- > 0) r.push(0);\n return r.concat(x);\n }\n function multiplyKaratsuba(x, y) {\n var n = Math.max(x.length, y.length);\n if (n <= 30) return multiplyLong(x, y);\n n = Math.ceil(n / 2);\n var b = x.slice(n),\n a = x.slice(0, n),\n d = y.slice(n),\n c = y.slice(0, n);\n var ac = multiplyKaratsuba(a, c),\n bd = multiplyKaratsuba(b, d),\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\n var product = addAny(\n addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)),\n shiftLeft(bd, 2 * n)\n );\n trim(product);\n return product;\n }\n function useKaratsuba(l1, l2) {\n return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;\n }\n BigInteger.prototype.multiply = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n sign = this.sign !== n.sign,\n abs;\n if (n.isSmall) {\n if (b === 0) return Integer[0];\n if (b === 1) return this;\n if (b === -1) return this.negate();\n abs = Math.abs(b);\n if (abs < BASE) {\n return new BigInteger(multiplySmall(a, abs), sign);\n }\n b = smallToArray(abs);\n }\n if (useKaratsuba(a.length, b.length))\n return new BigInteger(multiplyKaratsuba(a, b), sign);\n return new BigInteger(multiplyLong(a, b), sign);\n };\n BigInteger.prototype.times = BigInteger.prototype.multiply;\n function multiplySmallAndArray(a, b, sign) {\n if (a < BASE) {\n return new BigInteger(multiplySmall(b, a), sign);\n }\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\n }\n SmallInteger.prototype._multiplyBySmall = function(a) {\n if (isPrecise(a.value * this.value)) {\n return new SmallInteger(a.value * this.value);\n }\n return multiplySmallAndArray(\n Math.abs(a.value),\n smallToArray(Math.abs(this.value)),\n this.sign !== a.sign\n );\n };\n BigInteger.prototype._multiplyBySmall = function(a) {\n if (a.value === 0) return Integer[0];\n if (a.value === 1) return this;\n if (a.value === -1) return this.negate();\n return multiplySmallAndArray(\n Math.abs(a.value),\n this.value,\n this.sign !== a.sign\n );\n };\n SmallInteger.prototype.multiply = function(v) {\n return parseValue(v)._multiplyBySmall(this);\n };\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\n function square(a) {\n var l = a.length,\n r = createArray(l + l),\n base = BASE,\n product,\n carry,\n i,\n a_i,\n a_j;\n for (i = 0; i < l; i++) {\n a_i = a[i];\n carry = 0 - a_i * a_i;\n for (var j = i; j < l; j++) {\n a_j = a[j];\n product = 2 * (a_i * a_j) + r[i + j] + carry;\n carry = Math.floor(product / base);\n r[i + j] = product - carry * base;\n }\n r[i + l] = carry;\n }\n trim(r);\n return r;\n }\n BigInteger.prototype.square = function() {\n return new BigInteger(square(this.value), false);\n };\n SmallInteger.prototype.square = function() {\n var value = this.value * this.value;\n if (isPrecise(value)) return new SmallInteger(value);\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\n };\n function divMod1(a, b) {\n var a_l = a.length,\n b_l = b.length,\n base = BASE,\n result = createArray(b.length),\n divisorMostSignificantDigit = b[b_l - 1],\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\n remainder = multiplySmall(a, lambda),\n divisor = multiplySmall(b, lambda),\n quotientDigit,\n shift,\n carry,\n borrow,\n i,\n l,\n q;\n if (remainder.length <= a_l) remainder.push(0);\n divisor.push(0);\n divisorMostSignificantDigit = divisor[b_l - 1];\n for (shift = a_l - b_l; shift >= 0; shift--) {\n quotientDigit = base - 1;\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\n quotientDigit = Math.floor(\n (remainder[shift + b_l] * base + remainder[shift + b_l - 1]) /\n divisorMostSignificantDigit\n );\n }\n carry = 0;\n borrow = 0;\n l = divisor.length;\n for (i = 0; i < l; i++) {\n carry += quotientDigit * divisor[i];\n q = Math.floor(carry / base);\n borrow += remainder[shift + i] - (carry - q * base);\n carry = q;\n if (borrow < 0) {\n remainder[shift + i] = borrow + base;\n borrow = -1;\n } else {\n remainder[shift + i] = borrow;\n borrow = 0;\n }\n }\n while (borrow !== 0) {\n quotientDigit -= 1;\n carry = 0;\n for (i = 0; i < l; i++) {\n carry += remainder[shift + i] - base + divisor[i];\n if (carry < 0) {\n remainder[shift + i] = carry + base;\n carry = 0;\n } else {\n remainder[shift + i] = carry;\n carry = 1;\n }\n }\n borrow += carry;\n }\n result[shift] = quotientDigit;\n }\n remainder = divModSmall(remainder, lambda)[0];\n return [arrayToSmall(result), arrayToSmall(remainder)];\n }\n function divMod2(a, b) {\n var a_l = a.length,\n b_l = b.length,\n result = [],\n part = [],\n base = BASE,\n guess,\n xlen,\n highx,\n highy,\n check;\n while (a_l) {\n part.unshift(a[--a_l]);\n trim(part);\n if (compareAbs(part, b) < 0) {\n result.push(0);\n continue;\n }\n xlen = part.length;\n highx = part[xlen - 1] * base + part[xlen - 2];\n highy = b[b_l - 1] * base + b[b_l - 2];\n if (xlen > b_l) {\n highx = (highx + 1) * base;\n }\n guess = Math.ceil(highx / highy);\n do {\n check = multiplySmall(b, guess);\n if (compareAbs(check, part) <= 0) break;\n guess--;\n } while (guess);\n result.push(guess);\n part = subtract(part, check);\n }\n result.reverse();\n return [arrayToSmall(result), arrayToSmall(part)];\n }\n function divModSmall(value, lambda) {\n var length = value.length,\n quotient = createArray(length),\n base = BASE,\n i,\n q,\n remainder,\n divisor;\n remainder = 0;\n for (i = length - 1; i >= 0; --i) {\n divisor = remainder * base + value[i];\n q = truncate(divisor / lambda);\n remainder = divisor - q * lambda;\n quotient[i] = q | 0;\n }\n return [quotient, remainder | 0];\n }\n function divModAny(self, v) {\n var value,\n n = parseValue(v);\n var a = self.value,\n b = n.value;\n var quotient;\n if (b === 0) throw new Error('Cannot divide by zero');\n if (self.isSmall) {\n if (n.isSmall) {\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\n }\n return [Integer[0], self];\n }\n if (n.isSmall) {\n if (b === 1) return [self, Integer[0]];\n if (b == -1) return [self.negate(), Integer[0]];\n var abs = Math.abs(b);\n if (abs < BASE) {\n value = divModSmall(a, abs);\n quotient = arrayToSmall(value[0]);\n var remainder = value[1];\n if (self.sign) remainder = -remainder;\n if (typeof quotient === 'number') {\n if (self.sign !== n.sign) quotient = -quotient;\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\n }\n return [\n new BigInteger(quotient, self.sign !== n.sign),\n new SmallInteger(remainder)\n ];\n }\n b = smallToArray(abs);\n }\n var comparison = compareAbs(a, b);\n if (comparison === -1) return [Integer[0], self];\n if (comparison === 0)\n return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\n if (a.length + b.length <= 200) value = divMod1(a, b);\n else value = divMod2(a, b);\n quotient = value[0];\n var qSign = self.sign !== n.sign,\n mod = value[1],\n mSign = self.sign;\n if (typeof quotient === 'number') {\n if (qSign) quotient = -quotient;\n quotient = new SmallInteger(quotient);\n } else quotient = new BigInteger(quotient, qSign);\n if (typeof mod === 'number') {\n if (mSign) mod = -mod;\n mod = new SmallInteger(mod);\n } else mod = new BigInteger(mod, mSign);\n return [quotient, mod];\n }\n BigInteger.prototype.divmod = function(v) {\n var result = divModAny(this, v);\n return { quotient: result[0], remainder: result[1] };\n };\n SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\n BigInteger.prototype.divide = function(v) {\n return divModAny(this, v)[0];\n };\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over =\n BigInteger.prototype.divide;\n BigInteger.prototype.mod = function(v) {\n return divModAny(this, v)[1];\n };\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder =\n BigInteger.prototype.mod;\n BigInteger.prototype.pow = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value,\n value,\n x,\n y;\n if (b === 0) return Integer[1];\n if (a === 0) return Integer[0];\n if (a === 1) return Integer[1];\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\n if (n.sign) {\n return Integer[0];\n }\n if (!n.isSmall)\n throw new Error('The exponent ' + n.toString() + ' is too large.');\n if (this.isSmall) {\n if (isPrecise((value = Math.pow(a, b))))\n return new SmallInteger(truncate(value));\n }\n x = this;\n y = Integer[1];\n while (true) {\n if (b & (1 === 1)) {\n y = y.times(x);\n --b;\n }\n if (b === 0) break;\n b /= 2;\n x = x.square();\n }\n return y;\n };\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\n BigInteger.prototype.modPow = function(exp, mod) {\n exp = parseValue(exp);\n mod = parseValue(mod);\n if (mod.isZero()) throw new Error('Cannot take modPow with modulus 0');\n var r = Integer[1],\n base = this.mod(mod);\n while (exp.isPositive()) {\n if (base.isZero()) return Integer[0];\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\n exp = exp.divide(2);\n base = base.square().mod(mod);\n }\n return r;\n };\n SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\n function compareAbs(a, b) {\n if (a.length !== b.length) {\n return a.length > b.length ? 1 : -1;\n }\n for (var i = a.length - 1; i >= 0; i--) {\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\n }\n return 0;\n }\n BigInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) return 1;\n return compareAbs(a, b);\n };\n SmallInteger.prototype.compareAbs = function(v) {\n var n = parseValue(v),\n a = Math.abs(this.value),\n b = n.value;\n if (n.isSmall) {\n b = Math.abs(b);\n return a === b ? 0 : a > b ? 1 : -1;\n }\n return -1;\n };\n BigInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (this.sign !== n.sign) {\n return n.sign ? 1 : -1;\n }\n if (n.isSmall) {\n return this.sign ? -1 : 1;\n }\n return compareAbs(a, b) * (this.sign ? -1 : 1);\n };\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\n SmallInteger.prototype.compare = function(v) {\n if (v === Infinity) {\n return -1;\n }\n if (v === -Infinity) {\n return 1;\n }\n var n = parseValue(v),\n a = this.value,\n b = n.value;\n if (n.isSmall) {\n return a == b ? 0 : a > b ? 1 : -1;\n }\n if (a < 0 !== n.sign) {\n return a < 0 ? -1 : 1;\n }\n return a < 0 ? 1 : -1;\n };\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\n BigInteger.prototype.equals = function(v) {\n return this.compare(v) === 0;\n };\n SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq =\n BigInteger.prototype.equals;\n BigInteger.prototype.notEquals = function(v) {\n return this.compare(v) !== 0;\n };\n SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq =\n BigInteger.prototype.notEquals;\n BigInteger.prototype.greater = function(v) {\n return this.compare(v) > 0;\n };\n SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt =\n BigInteger.prototype.greater;\n BigInteger.prototype.lesser = function(v) {\n return this.compare(v) < 0;\n };\n SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt =\n BigInteger.prototype.lesser;\n BigInteger.prototype.greaterOrEquals = function(v) {\n return this.compare(v) >= 0;\n };\n SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq =\n BigInteger.prototype.greaterOrEquals;\n BigInteger.prototype.lesserOrEquals = function(v) {\n return this.compare(v) <= 0;\n };\n SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq =\n BigInteger.prototype.lesserOrEquals;\n BigInteger.prototype.isEven = function() {\n return (this.value[0] & 1) === 0;\n };\n SmallInteger.prototype.isEven = function() {\n return (this.value & 1) === 0;\n };\n BigInteger.prototype.isOdd = function() {\n return (this.value[0] & 1) === 1;\n };\n SmallInteger.prototype.isOdd = function() {\n return (this.value & 1) === 1;\n };\n BigInteger.prototype.isPositive = function() {\n return !this.sign;\n };\n SmallInteger.prototype.isPositive = function() {\n return this.value > 0;\n };\n BigInteger.prototype.isNegative = function() {\n return this.sign;\n };\n SmallInteger.prototype.isNegative = function() {\n return this.value < 0;\n };\n BigInteger.prototype.isUnit = function() {\n return false;\n };\n SmallInteger.prototype.isUnit = function() {\n return Math.abs(this.value) === 1;\n };\n BigInteger.prototype.isZero = function() {\n return false;\n };\n SmallInteger.prototype.isZero = function() {\n return this.value === 0;\n };\n BigInteger.prototype.isDivisibleBy = function(v) {\n var n = parseValue(v);\n var value = n.value;\n if (value === 0) return false;\n if (value === 1) return true;\n if (value === 2) return this.isEven();\n return this.mod(n).equals(Integer[0]);\n };\n SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\n function isBasicPrime(v) {\n var n = v.abs();\n if (n.isUnit()) return false;\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\n if (n.lesser(49)) return true;\n }\n function millerRabinTest(n, a) {\n var nPrev = n.prev(),\n b = nPrev,\n r = 0,\n d,\n t,\n i,\n x;\n while (b.isEven()) (b = b.divide(2)), r++;\n next: for (i = 0; i < a.length; i++) {\n if (n.lesser(a[i])) continue;\n x = bigInt(a[i]).modPow(b, n);\n if (x.equals(Integer[1]) || x.equals(nPrev)) continue;\n for (d = r - 1; d != 0; d--) {\n x = x.square().mod(n);\n if (x.isUnit()) return false;\n if (x.equals(nPrev)) continue next;\n }\n return false;\n }\n return true;\n }\n BigInteger.prototype.isPrime = function(strict) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var bits = n.bitLength();\n if (bits <= 64)\n return millerRabinTest(n, [\n 2,\n 325,\n 9375,\n 28178,\n 450775,\n 9780504,\n 1795265022\n ]);\n var logN = Math.log(2) * bits;\n var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt(i + 2));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\n BigInteger.prototype.isProbablePrime = function(iterations) {\n var isPrime = isBasicPrime(this);\n if (isPrime !== undefined) return isPrime;\n var n = this.abs();\n var t = iterations === undefined ? 5 : iterations;\n for (var a = [], i = 0; i < t; i++) {\n a.push(bigInt.randBetween(2, n.minus(2)));\n }\n return millerRabinTest(n, a);\n };\n SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\n BigInteger.prototype.modInv = function(n) {\n var t = bigInt.zero,\n newT = bigInt.one,\n r = parseValue(n),\n newR = this.abs(),\n q,\n lastT,\n lastR;\n while (!newR.equals(bigInt.zero)) {\n q = r.divide(newR);\n lastT = t;\n lastR = r;\n t = newT;\n r = newR;\n newT = lastT.subtract(q.multiply(newT));\n newR = lastR.subtract(q.multiply(newR));\n }\n if (!r.equals(1))\n throw new Error(\n this.toString() + ' and ' + n.toString() + ' are not co-prime'\n );\n if (t.compare(0) === -1) {\n t = t.add(n);\n }\n if (this.isNegative()) {\n return t.negate();\n }\n return t;\n };\n SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\n BigInteger.prototype.next = function() {\n var value = this.value;\n if (this.sign) {\n return subtractSmall(value, 1, this.sign);\n }\n return new BigInteger(addSmall(value, 1), this.sign);\n };\n SmallInteger.prototype.next = function() {\n var value = this.value;\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\n return new BigInteger(MAX_INT_ARR, false);\n };\n BigInteger.prototype.prev = function() {\n var value = this.value;\n if (this.sign) {\n return new BigInteger(addSmall(value, 1), true);\n }\n return subtractSmall(value, 1, this.sign);\n };\n SmallInteger.prototype.prev = function() {\n var value = this.value;\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\n return new BigInteger(MAX_INT_ARR, true);\n };\n var powersOfTwo = [1];\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)\n powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\n var powers2Length = powersOfTwo.length,\n highestPower2 = powersOfTwo[powers2Length - 1];\n function shift_isSmall(n) {\n return (\n ((typeof n === 'number' || typeof n === 'string') &&\n +Math.abs(n) <= BASE) ||\n (n instanceof BigInteger && n.value.length <= 1)\n );\n }\n BigInteger.prototype.shiftLeft = function(n) {\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftRight(-n);\n var result = this;\n if (result.isZero()) return result;\n while (n >= powers2Length) {\n result = result.multiply(highestPower2);\n n -= powers2Length - 1;\n }\n return result.multiply(powersOfTwo[n]);\n };\n SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\n BigInteger.prototype.shiftRight = function(n) {\n var remQuo;\n if (!shift_isSmall(n)) {\n throw new Error(String(n) + ' is too large for shifting.');\n }\n n = +n;\n if (n < 0) return this.shiftLeft(-n);\n var result = this;\n while (n >= powers2Length) {\n if (result.isZero() || (result.isNegative() && result.isUnit()))\n return result;\n remQuo = divModAny(result, highestPower2);\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n n -= powers2Length - 1;\n }\n remQuo = divModAny(result, powersOfTwo[n]);\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\n };\n SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\n function bitwise(x, y, fn) {\n y = parseValue(y);\n var xSign = x.isNegative(),\n ySign = y.isNegative();\n var xRem = xSign ? x.not() : x,\n yRem = ySign ? y.not() : y;\n var xDigit = 0,\n yDigit = 0;\n var xDivMod = null,\n yDivMod = null;\n var result = [];\n while (!xRem.isZero() || !yRem.isZero()) {\n xDivMod = divModAny(xRem, highestPower2);\n xDigit = xDivMod[1].toJSNumber();\n if (xSign) {\n xDigit = highestPower2 - 1 - xDigit;\n }\n yDivMod = divModAny(yRem, highestPower2);\n yDigit = yDivMod[1].toJSNumber();\n if (ySign) {\n yDigit = highestPower2 - 1 - yDigit;\n }\n xRem = xDivMod[0];\n yRem = yDivMod[0];\n result.push(fn(xDigit, yDigit));\n }\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\n for (var i = result.length - 1; i >= 0; i -= 1) {\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\n }\n return sum;\n }\n BigInteger.prototype.not = function() {\n return this.negate().prev();\n };\n SmallInteger.prototype.not = BigInteger.prototype.not;\n BigInteger.prototype.and = function(n) {\n return bitwise(this, n, function(a, b) {\n return a & b;\n });\n };\n SmallInteger.prototype.and = BigInteger.prototype.and;\n BigInteger.prototype.or = function(n) {\n return bitwise(this, n, function(a, b) {\n return a | b;\n });\n };\n SmallInteger.prototype.or = BigInteger.prototype.or;\n BigInteger.prototype.xor = function(n) {\n return bitwise(this, n, function(a, b) {\n return a ^ b;\n });\n };\n SmallInteger.prototype.xor = BigInteger.prototype.xor;\n var LOBMASK_I = 1 << 30,\n LOBMASK_BI = ((BASE & -BASE) * (BASE & -BASE)) | LOBMASK_I;\n function roughLOB(n) {\n var v = n.value,\n x =\n typeof v === 'number'\n ? v | LOBMASK_I\n : (v[0] + v[1] * BASE) | LOBMASK_BI;\n return x & -x;\n }\n function integerLogarithm(value, base) {\n if (base.compareTo(value) <= 0) {\n var tmp = integerLogarithm(value, base.square(base));\n var p = tmp.p;\n var e = tmp.e;\n var t = p.multiply(base);\n return t.compareTo(value) <= 0\n ? { p: t, e: e * 2 + 1 }\n : { p: p, e: e * 2 };\n }\n return { p: bigInt(1), e: 0 };\n }\n BigInteger.prototype.bitLength = function() {\n var n = this;\n if (n.compareTo(bigInt(0)) < 0) {\n n = n.negate().subtract(bigInt(1));\n }\n if (n.compareTo(bigInt(0)) === 0) {\n return bigInt(0);\n }\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\n };\n SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\n function max(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.greater(b) ? a : b;\n }\n function min(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n return a.lesser(b) ? a : b;\n }\n function gcd(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n if (a.equals(b)) return a;\n if (a.isZero()) return b;\n if (b.isZero()) return a;\n var c = Integer[1],\n d,\n t;\n while (a.isEven() && b.isEven()) {\n d = Math.min(roughLOB(a), roughLOB(b));\n a = a.divide(d);\n b = b.divide(d);\n c = c.multiply(d);\n }\n while (a.isEven()) {\n a = a.divide(roughLOB(a));\n }\n do {\n while (b.isEven()) {\n b = b.divide(roughLOB(b));\n }\n if (a.greater(b)) {\n t = b;\n b = a;\n a = t;\n }\n b = b.subtract(a);\n } while (!b.isZero());\n return c.isUnit() ? a : a.multiply(c);\n }\n function lcm(a, b) {\n a = parseValue(a).abs();\n b = parseValue(b).abs();\n return a.divide(gcd(a, b)).multiply(b);\n }\n function randBetween(a, b) {\n a = parseValue(a);\n b = parseValue(b);\n var low = min(a, b),\n high = max(a, b);\n var range = high.subtract(low).add(1);\n if (range.isSmall) return low.add(Math.floor(Math.random() * range));\n var length = range.value.length - 1;\n var result = [],\n restricted = true;\n for (var i = length; i >= 0; i--) {\n var top = restricted ? range.value[i] : BASE;\n var digit = truncate(Math.random() * top);\n result.unshift(digit);\n if (digit < top) restricted = false;\n }\n result = arrayToSmall(result);\n return low.add(\n typeof result === 'number'\n ? new SmallInteger(result)\n : new BigInteger(result, false)\n );\n }\n var parseBase = function(text, base) {\n var length = text.length;\n var i;\n var absBase = Math.abs(base);\n for (var i = 0; i < length; i++) {\n var c = text[i].toLowerCase();\n if (c === '-') continue;\n if (/[a-z0-9]/.test(c)) {\n if (/[0-9]/.test(c) && +c >= absBase) {\n if (c === '1' && absBase === 1) continue;\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n } else if (c.charCodeAt(0) - 87 >= absBase) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n }\n }\n if (2 <= base && base <= 36) {\n if (length <= LOG_MAX_INT / Math.log(base)) {\n var result = parseInt(text, base);\n if (isNaN(result)) {\n throw new Error(c + ' is not a valid digit in base ' + base + '.');\n }\n return new SmallInteger(parseInt(text, base));\n }\n }\n base = parseValue(base);\n var digits = [];\n var isNegative = text[0] === '-';\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\n var c = text[i].toLowerCase(),\n charCode = c.charCodeAt(0);\n if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));\n else if (97 <= charCode && charCode <= 122)\n digits.push(parseValue(c.charCodeAt(0) - 87));\n else if (c === '<') {\n var start = i;\n do {\n i++;\n } while (text[i] !== '>');\n digits.push(parseValue(text.slice(start + 1, i)));\n } else throw new Error(c + ' is not a valid character');\n }\n return parseBaseFromArray(digits, base, isNegative);\n };\n function parseBaseFromArray(digits, base, isNegative) {\n var val = Integer[0],\n pow = Integer[1],\n i;\n for (i = digits.length - 1; i >= 0; i--) {\n val = val.add(digits[i].times(pow));\n pow = pow.times(base);\n }\n return isNegative ? val.negate() : val;\n }\n function stringify(digit) {\n if (digit <= 35) {\n return '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(digit);\n }\n return '<' + digit + '>';\n }\n function toBase(n, base) {\n base = bigInt(base);\n if (base.isZero()) {\n if (n.isZero()) return { value: [0], isNegative: false };\n throw new Error('Cannot convert nonzero numbers to base 0.');\n }\n if (base.equals(-1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n if (n.isNegative())\n return {\n value: [].concat.apply(\n [],\n Array.apply(null, Array(-n)).map(Array.prototype.valueOf, [1, 0])\n ),\n isNegative: false\n };\n var arr = Array.apply(null, Array(+n - 1)).map(Array.prototype.valueOf, [\n 0,\n 1\n ]);\n arr.unshift([1]);\n return { value: [].concat.apply([], arr), isNegative: false };\n }\n var neg = false;\n if (n.isNegative() && base.isPositive()) {\n neg = true;\n n = n.abs();\n }\n if (base.equals(1)) {\n if (n.isZero()) return { value: [0], isNegative: false };\n return {\n value: Array.apply(null, Array(+n)).map(Number.prototype.valueOf, 1),\n isNegative: neg\n };\n }\n var out = [];\n var left = n,\n divmod;\n while (left.isNegative() || left.compareAbs(base) >= 0) {\n divmod = left.divmod(base);\n left = divmod.quotient;\n var digit = divmod.remainder;\n if (digit.isNegative()) {\n digit = base.minus(digit).abs();\n left = left.next();\n }\n out.push(digit.toJSNumber());\n }\n out.push(left.toJSNumber());\n return { value: out.reverse(), isNegative: neg };\n }\n function toBaseString(n, base) {\n var arr = toBase(n, base);\n return (arr.isNegative ? '-' : '') + arr.value.map(stringify).join('');\n }\n BigInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n SmallInteger.prototype.toArray = function(radix) {\n return toBase(this, radix);\n };\n BigInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix !== 10) return toBaseString(this, radix);\n var v = this.value,\n l = v.length,\n str = String(v[--l]),\n zeros = '0000000',\n digit;\n while (--l >= 0) {\n digit = String(v[l]);\n str += zeros.slice(digit.length) + digit;\n }\n var sign = this.sign ? '-' : '';\n return sign + str;\n };\n SmallInteger.prototype.toString = function(radix) {\n if (radix === undefined) radix = 10;\n if (radix != 10) return toBaseString(this, radix);\n return String(this.value);\n };\n BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {\n return this.toString();\n };\n BigInteger.prototype.valueOf = function() {\n return parseInt(this.toString(), 10);\n };\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\n SmallInteger.prototype.valueOf = function() {\n return this.value;\n };\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\n function parseStringValue(v) {\n if (isPrecise(+v)) {\n var x = +v;\n if (x === truncate(x)) return new SmallInteger(x);\n throw new Error('Invalid integer: ' + v);\n }\n var sign = v[0] === '-';\n if (sign) v = v.slice(1);\n var split = v.split(/e/i);\n if (split.length > 2)\n throw new Error('Invalid integer: ' + split.join('e'));\n if (split.length === 2) {\n var exp = split[1];\n if (exp[0] === '+') exp = exp.slice(1);\n exp = +exp;\n if (exp !== truncate(exp) || !isPrecise(exp))\n throw new Error(\n 'Invalid integer: ' + exp + ' is not a valid exponent.'\n );\n var text = split[0];\n var decimalPlace = text.indexOf('.');\n if (decimalPlace >= 0) {\n exp -= text.length - decimalPlace - 1;\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\n }\n if (exp < 0)\n throw new Error('Cannot include negative exponent part for integers');\n text += new Array(exp + 1).join('0');\n v = text;\n }\n var isValid = /^([0-9][0-9]*)$/.test(v);\n if (!isValid) throw new Error('Invalid integer: ' + v);\n var r = [],\n max = v.length,\n l = LOG_BASE,\n min = max - l;\n while (max > 0) {\n r.push(+v.slice(min, max));\n min -= l;\n if (min < 0) min = 0;\n max -= l;\n }\n trim(r);\n return new BigInteger(r, sign);\n }\n function parseNumberValue(v) {\n if (isPrecise(v)) {\n if (v !== truncate(v)) throw new Error(v + ' is not an integer.');\n return new SmallInteger(v);\n }\n return parseStringValue(v.toString());\n }\n function parseValue(v) {\n if (typeof v === 'number') {\n return parseNumberValue(v);\n }\n if (typeof v === 'string') {\n return parseStringValue(v);\n }\n return v;\n }\n for (var i = 0; i < 1e3; i++) {\n Integer[i] = new SmallInteger(i);\n if (i > 0) Integer[-i] = new SmallInteger(-i);\n }\n Integer.one = Integer[1];\n Integer.zero = Integer[0];\n Integer.minusOne = Integer[-1];\n Integer.max = max;\n Integer.min = min;\n Integer.gcd = gcd;\n Integer.lcm = lcm;\n Integer.isInstance = function(x) {\n return x instanceof BigInteger || x instanceof SmallInteger;\n };\n Integer.randBetween = randBetween;\n Integer.fromArray = function(digits, base, isNegative) {\n return parseBaseFromArray(\n digits.map(parseValue),\n parseValue(base || 10),\n isNegative\n );\n };\n return Integer;\n})();\nif (typeof module !== 'undefined' && module.hasOwnProperty('exports')) {\n module.exports = bigInt;\n}\nif (typeof define === 'function' && define.amd) {\n define('big-integer', [], function() {\n return bigInt;\n });\n}\n\nfunction substract(a, b) {\n if (a.eq(0) || b.eq(0)) {\n return { a, b };\n } else if (a.greaterOrEquals(b.multiply(2))) {\n a = a.mod(b.multiply(2));\n return substract(a, b);\n } else if (b.greaterOrEquals(a.multiply(2))) {\n b = b.mod(a.multiply(2));\n return substract(a, b);\n } else {\n return { a, b };\n }\n}\n\nconst nd = readline().split(' ');\n\nconst result = substract(bigInt(nd[0]), bigInt(nd[1]));\n\nprint(result.a.toJSNumber() + ' ' + result.b.toJSNumber() + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "26df5ea2ee32bd0317759f0db749efd9", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "var input = readline()\nvar touched = Array(parseInt(input)).fill(false)\nvar step = 1\n\n\nfor(var i=0;i<=input;i++){\n step += i\n \tif(step>input) step-=input\n \ttouched[step]=true\n}\n\nvar isAllVisited=true\nfor(var i=1;i<=input;i++){ \n if(!touched[i]) isAllVisited=false\n}\n\nisAllVisited? print(\"YES\"):print(\"NO\")", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0cc4cbfdc2c3e8bebd39a334a325a196", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": " var n = parseInt(readline());\n var res = 0;\n res += (n - 1) / 2 | 0;\n print(res);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1cc64b551b0261097d236ab5963c677e", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nif (n%2 == 0) print (n/2 - 1);\nelse print (Math.floor(n/2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ab3b42741be06a3225d1c49bac06959a", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\n var money = 0;\n if(n>2){\n \tmoney += (n - 1) / 2;\n }else{\n \tmoney += 0;\n }\n print(parseInt(money));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "51e5fd5964b3e34741f47544f509b8cb", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nprint(Math.floor((n-1)/2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "19eaba303761dc0e312444ced7c7f70b", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = +readline();\n if (n % 2 == 1) {\n n++;\n }\n \n print(n/2 -1 );", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f729ea65fc32f41c29550ae36f4aa8ce", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "const input = readline();\nconst lastIndex = input.length - 1;\nconst halfLength = Math.floor(lastIndex * 0.5);\nconst flip = [8, NaN, NaN, 3, 6, 9, 4, 7, 0, 5];\nprint((() => {\n for (var i = 0; i <= halfLength; i++)\n if (flip[input.charCodeAt(i) - 48 /* 0 */] !== input.charCodeAt(lastIndex - i) - 48 /* 0 */) return false;\n return true;\n})() ? \"Yes\" : \"No\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "809be8370641b16e027d500690ea2276", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "function stradd(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) + (parseInt(b[j])||0) + carry\n carry = tmp >= 10 ? 1 : 0\n res = (tmp%10).toString() + res\n }\n return carry ? '1'+res : res\n}\n\nfunction strsub(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) - (parseInt(b[j])||0) - carry\n if (tmp < 0) tmp += 10, carry = 1\n else carry = 0\n res = tmp.toString() + res\n }\n return res\n}\n\nfunction strz(a, n) {\n if (a.length >= n) return a\n var res = a\n for (var i = a.length ; i < n ; i++) {\n res = '0' + res\n }\n return res\n}\n\nfunction trimz(a) {\n var i = 0\n while (a[i] === '0') i++\n return a.substr(i)||'0'\n}\n\nvar given = readline().split(' '),\n length = given.reduce((p,v,i,a)=>{return Math.max(p,v.length)}, 0),\n normz = given.map((v,i,a)=>{return strz(v, length)}),\n start = normz[0] > normz[2] ? normz[0] : normz[2],\n end = normz[1] > normz[3] ? normz[3] : normz [1]\n\nif (end < start) print('0')\nelse if (normz[4] >= start && normz[4] <= end) print(trimz(strsub(end,start)))\nelse print(trimz(stradd('1', strsub(end, start))))\n\n/*\nfunction readIntTabLine(n) {\n var l = readline().split(' ')\n for (var i = 0 ; i < n ; i++) {\n l[i] = parseInt(l[i])\n }\n return l\n}\n\nvar given = readIntTabLine(5)\n\nvar start = Math.max(given[0],given[2]),\n end = Math.min(given[1],given[3])\n\nif (end < start) print(0)\nelse if (given[4] >= start && given[4] <= end) print(end - start)\nelse print(end - start + 1)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "82ab77d9dff521bc3a230432b5c29c6e", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function stradd(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) + (parseInt(b[j])||0) + carry\n carry = tmp >= 10 ? 1 : 0\n res = (tmp%10).toString() + res\n }\n return carry ? '1'+res : res\n}\n\nfunction strsub(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) - (parseInt(b[j])||0) - carry\n if (tmp < 0) tmp += 10, carry = 1\n res = tmp.toString() + res\n }\n return res\n}\n\nfunction strz(a, n) {\n if (a.length >= n) return a\n var res = a\n for (var i = a.length ; i < n ; i++) {\n res = '0' + res\n }\n return res\n}\n\nfunction trimz(a) {\n var i = 0\n while (a[i] === '0') i++\n return a.substr(i)||'0'\n}\n\nvar given = readline().split(' '),\n length = given.reduce((p,v,i,a)=>{return Math.max(p,v.length)}, 0),\n normz = given.map((v,i,a)=>{return strz(v, length)}),\n start = normz[0] > normz[2] ? normz[0] : normz[2],\n end = normz[1] > normz[3] ? normz[3] : normz [1]\n\nif (end < start) print('0')\nelse if (normz[4] >= start && normz[4] <= end) print(trimz(strsub(end,start)))\nelse print(trimz(stradd('1', strsub(end, start))))\n\n/*\nfunction readIntTabLine(n) {\n var l = readline().split(' ')\n for (var i = 0 ; i < n ; i++) {\n l[i] = parseInt(l[i])\n }\n return l\n}\n\nvar given = readIntTabLine(5)\n\nvar start = Math.max(given[0],given[2]),\n end = Math.min(given[1],given[3])\n\nif (end < start) print(0)\nelse if (given[4] >= start && given[4] <= end) print(end - start)\nelse print(end - start + 1)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "960f18ddca689f0239f8dd944ee5e44e", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function stradd(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) + (parseInt(b[j])||0) + carry\n carry = tmp >= 10 ? 1 : 0\n res = (tmp%10).toString() + res\n }\n return carry ? '1'+res : res\n}\n\nfunction strsub(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) - (parseInt(b[j])||0) - carry\n if (tmp < 0) tmp += 10, carry = 1\n res = tmp.toString() + res\n }\n return res\n}\n\nfunction strz(a, n) {\n if (a.length >= n) return a\n var res = a\n for (var i = a.length ; i < n ; i++) {\n res = '0' + res\n }\n return res\n}\n\nfunction trimz(a) {\n var i = 0\n while (a[i] === '0') i++\n return a.substr(i)\n}\n\nvar given = readline().split(' '),\n length = given.reduce((p,v,i,a)=>{return Math.max(p,v.length)}, 0),\n normz = given.map((v,i,a)=>{return strz(v, length)}),\n start = normz[0] > normz[2] ? normz[0] : normz[2],\n end = normz[1] > normz[3] ? normz[3] : normz [1]\n\nif (end < start) print('0')\nelse if (normz[4] >= start && normz[4] <= end) print(trimz(strsub(end,start)))\nelse print(trimz(stradd(1, strsub(end, start))))\n\n/*\nfunction readIntTabLine(n) {\n var l = readline().split(' ')\n for (var i = 0 ; i < n ; i++) {\n l[i] = parseInt(l[i])\n }\n return l\n}\n\nvar given = readIntTabLine(5)\n\nvar start = Math.max(given[0],given[2]),\n end = Math.min(given[1],given[3])\n\nif (end < start) print(0)\nelse if (given[4] >= start && given[4] <= end) print(end - start)\nelse print(end - start + 1)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "be83e9def8fca2a67be341ccecd9b62a", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function stradd(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) + (parseInt(b[j])||0) + carry\n carry = tmp >= 10 ? 1 : 0\n res = (tmp%10).toString() + res\n }\n return carry ? '1'+res : res\n}\n\nfunction strsub(a, b) {\n var res = \"\",\n carry = 0,\n tmp = 0\n for (var i = a.length-1, j = b.length-1 ; i >= 0 || j >= 0 ; i--, j--) {\n tmp = (parseInt(a[i])||0) - (parseInt(b[j])||0) - carry\n if (tmp < 0) tmp += 10, carry = 1\n res = tmp.toString() + res\n }\n return res\n}\n\nfunction strz(a, n) {\n if (a.length >= n) return a\n var res = a\n for (var i = a.length ; i < n ; i++) {\n res = '0' + res\n }\n return res\n}\n\nfunction trimz(a) {\n var i = 0\n while (a[i] === '0') i++\n return a.substr(i)\n}\n\nvar given = readline().split(' '),\n length = given.reduce((p,v,i,a)=>{return Math.max(p,v.length)}, 0),\n normz = given.map((v,i,a)=>{return strz(v, length)}),\n start = normz[0] > normz[2] ? normz[0] : normz[2],\n end = normz[1] > normz[3] ? normz[3] : normz [1]\n\nif (end < start) print('0')\nelse if (normz[4] >= start && normz[4] <= end) print(trimz(strsub(end,start)))\nelse print(trimz(stradd('1', strsub(end, start))))\n\n/*\nfunction readIntTabLine(n) {\n var l = readline().split(' ')\n for (var i = 0 ; i < n ; i++) {\n l[i] = parseInt(l[i])\n }\n return l\n}\n\nvar given = readIntTabLine(5)\n\nvar start = Math.max(given[0],given[2]),\n end = Math.min(given[1],given[3])\n\nif (end < start) print(0)\nelse if (given[4] >= start && given[4] <= end) print(end - start)\nelse print(end - start + 1)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "20d883cc1e7e607e99579bb107f2c703", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function readIntTabLine(n) {\n var l = readline().split(' ')\n for (var i = 0 ; i < n ; i++) {\n l[i] = parseInt(l[i])\n }\n return l\n}\n\nvar given = readIntTabLine(5)\n\nvar start = Math.max(given[0],given[2]),\n end = Math.min(given[1],given[3])\n\nif (end < start) print(0)\nelse if (given[4] >= start && given[4] <= end) print(end - start)\nelse print(end - start + 1)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32024616326a89b4a19a158fdce217d0", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const input = readline();\nconst arr = [\"Danil\", \"Olya\", \"Slava\", \"Ann\" , \"Nikita\"];\nvar arr2 = [false, false,false,false,false];\nvar check = false;\nfor (var i =0 ;i 0; --j) {\n\t\t\tvar leftB = Math.min(points[j-1], points[j]),\n\t\t\t\trightB = Math.max(points[j-1], points[j]);\n\t\t\tif (Math.min(rightA, rightB) <= Math.max(leftA, leftB)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (leftA >= leftB && rightA <= rightB) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (leftB >= leftA && rightB <= rightA) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprint(\"yes\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\tprint(\"no\");\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e2046685bd4fe08843e13250779ec77", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tprint(function (n) {\n\n\t\tvar s = readline().split(' ').map(Number),\n\t\t\tv = [];\n\n\t\tfor (var i = 0, _i = n - 1; i < _i; i++) {\n\t\t\tv.push([s[i], s[i + 1]]);\n\t\t}\n\n\t\tfor (var i = 0, _i = v.length - 1; i < _i; i++) {\n\t\t\tfor (var j = i + 1, _j = v.length; j < _j; j++) {\n\t\t\t\tvar a = v[i], b = v[j];\n\n\t\t\t\tif ((a[0] < b[0] && a[1] < b[1]) ||\t(b[0] < a[0] && b[1] < a[1])) {\n\t\t\t\t\treturn 'yes';\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn 'no';\n\n\t}(+readline()));\n\n}.call(this));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "890b115767332a5bf6a1b43bf835751f", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tprint(function (n) {\n\n\t\tvar s = readline().split(' ').map(Number),\n\t\t\tv = [];\n\n\t\tfor (var i = 0, _i = n - 1; i < _i; i++) {\n\t\t\tv.push([s[i], s[i + 1]]);\n\t\t}\n\n\t\tfor (var i = 0, _i = v.length - 1; i < _i; i++) {\n\t\t\tfor (var j = i + 1, _j = v.length; j < _j; j++) {\n\t\t\t\tvar a = v[i], b = v[j];\n\n\t\t\t\tif ((a[0] < b[0] && b[0] < a[1] && a[1] < b[1]) || (b[0] < a[0] && a[0] < b[1] && b[1] < a[1])) {\n\t\t\t\t\treturn 'yes';\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn 'no';\n\n\t}(+readline()));\n\n}.call(this));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e0dc2caedde78ff6f46bce2af6e3b81c", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "print(function(n, x) {\n\n\tvar left = -Infinity,\n\t\tright = Infinity;\n\tfor (var i = 1; i < n; i++) {\n\t\tif (x[i] > x[i - 1]) {\n\t\t\tif (x[i] > right) return 'yes';\n\t\t\telse left = x[i - 1];\n\t\t} else {\n\t\t\tif (x[i] < left) return 'yes';\n\t\t\telse right = x[i - 1];\n\t\t}\n\t}\n\n\treturn 'no';\n\n}(+readline(), readline().split(' ').map(Number)));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e41ce621c7847e6b0f896656aebd24f6", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nlet a, b;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n a = +d;\n return;\n }\n\n b = +d;\n const a1 = Math.floor(Math.abs(a - b) / 2);\n const b1 = Math.ceil(Math.abs(a - b) / 2);\n const leftSum = a1 * (a1 + 1) / 2;\n const rigthSum = b1 * (b1 + 1) / 2;\n const ans = leftSum + rigthSum;\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3b44f275ab895d1b93c46b00c38f03b2", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "a = readline();\nb = readline();\n\nvar max = Math.max(a, b);\nvar min = Math.min(a, b);\nvar way = max - min;\n\nvar fatigueA = 0, fatigueB = 0, fatigueACount = 1, fatigueBCount = 1;\n\nwhile (way > 1) {\n\tfatigueA = fatigueA + fatigueACount;\n\tfatigueB = fatigueB + fatigueBCount;\n\n\tfatigueACount++;\n\tfatigueBCount++;\n\n\tway = way - 2;\n};\n\nif (way !== 0) {\n\tfatigueA = fatigueA + fatigueACount;\n};\n\nprint(fatigueA + fatigueB);\n\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c51ba945a59c5f57778c1d650adf7c04", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar a = nextInt();\n\tvar b = nextInt();\n\tvar diff = Math.abs(a - b);\n\tif(diff % 2 == 0){\n\t\tdiff /= 2;\n\t\tmyout(diff * (diff + 1));\n\t}else{\n\t\tvar tmp = diff - 1;\n\t\ttmp /= 2;\n\t\tmyout((tmp * (tmp + 1)) + (tmp + 1));\n\t}\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bfe14f2df9923a9036affa76f8ab6b30", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var line = readline().split('');\n if(line.length < 26){\n return print(-1);\n }\n var start = 0;\n var end = 26;\n var found = false;\n while(end <= line.length && !found){\n var pos = [];\n for(var i=65;i<=90;i++){\n pos[i-65] = false;\n }\n var unknown = 0;\n for(var i=start;i it).length + unknown != 26){\n start++;\n end++;\n } else {\n found = true;\n for(var i=start;i it ==\"?\").length < 26){\n return print('-1');\n }\n for(var i=0;i90){\n j=65;\n }\n line[i] = String.fromCharCode(j);\n all[j] = true;\n }\n print(line.join(''))\n}\n\n\nmain()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e5b321ef7a78e79376d904822a047faf", "src_uid": "a249431a4b0b1ade652997fe0b82edf3", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var line = readline();\nvar alp = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nfunction check(start){\n var map = {}, ch = \"\";\n for(var i = start; i < start + 26; i++) {\n ch = line[i];\n if (map[ch]) return false;\n if (ch == \"?\") continue;\n map[ch] = 1\n }\n return true\n}\n\nvar index = -1;\nif (line.length < 26) {\n write(-1);\n} else {\n for(var i = 0; i <= line.length - 26; i++) {\n if (check(i)) {\n index = i;\n break\n }\n }\n if (index == -1) {\n write(-1)\n } else {\n var str = line.substr(index, 26);\n while (str.indexOf(\"?\") > -1) {\n str = str.replace(\"?\", function () {\n for(var i = 0 ; i < alp.length; i++) {\n if (str.indexOf(alp[i]) == -1) return alp[i]\n }\n });\n }\n write(str)\n }\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ed52c5c44e95754b3ff91ca519a328d1", "src_uid": "a249431a4b0b1ade652997fe0b82edf3", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function main() {\n var line = readline().split('');\n var all = {};\n for(var i=65;i<=90;i++){\n all[i] = false;\n }\n var used = 0;\n for(var i=0;i it ==\"?\").length != 26){\n return print('-1');\n }\n for(var i=0;i90){\n return print('-1');\n }\n line[i] = String.fromCharCode(j);\n all[j] = true;\n }\n print(line)\n}\n\n\nmain()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4afa971b064a02c377b48142596b6012", "src_uid": "a249431a4b0b1ade652997fe0b82edf3", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function sa(n ,moves){\n var positionX = 0;\n var positionY = 0;\n for(var i=0;i 20000) {\n result = 'NO';\n break;\n }\n}\n\nprint(yPos === 0 ? result : 'NO');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f190e1fec9b6826f862be39f4208b53d", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function sa(n ,moves){\n var positionX = 0;\n var positionY = 0;\n for(var i=0;i currentTime[1]) {\n sleepTimeHours = 23;\n}\n\nvar sleepTime = sleepTimeHours.toString().lpad(\"0\", 2) + \":\" + sleepTimeMinutes.toString().lpad(\"0\", 2);\n\nprint(sleepTime);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3c0aa8f022972dd09d68bdef1060ff89", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "JavaScript", "source_code": " String.prototype.ceros = function(cad, tam) {\n var cadF = this;\n while (cadF.length < tam)\n cadF = cad + cadF;\n return cadF;\n };\n /*\n 05:50\"\n 05:44\n */\n //var vec1 = \"05:50\".split(\":\");\n var vec1 = readline().split(\":\");\n vec1[0] = parseInt(vec1[0]);\n vec1[1] = parseInt(vec1[1]);\n var vec2 = readline().split(\":\");\n // var vec2= \"05:44\".split(\":\");\n vec2[0] = parseInt(vec2[0]);\n vec2[1] = parseInt(vec2[1]);\n\n var tiempoHora = (vec1[0] - vec2[0]);\n var tiempoMin = (vec1[1] - vec2[1]);\n\n if (vec2[1] > vec1[1])\n tiempoHora--;\n if (tiempoHora < 0)\n tiempoHora = 24 + tiempoHora;\n if (tiempoMin < 0)\n tiempoMin = 60 + tiempoMin;\n print(tiempoHora.toString().ceros(\"0\", 2) + \":\" + tiempoMin.toString().ceros(\"0\", 2));\n // console.log(tiempoHora.toString().ceros(\"0\", 2) + \":\" + tiempoMin.toString().ceros(\"0\", 2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "60c93bcf82a00f4dca96abade4fbe505", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "(function() {\n var awake = readline().split(':');\n awake[0] = parseInt(awake[0]);\n awake[1] = parseInt(awake[1]);\n var sleep = readline().split(':');\n sleep[0] = parseInt(sleep[0]);\n sleep[1] = parseInt(sleep[1]);\n \n awake[1] -= sleep[1];\n if ( awake[1] < 0 ){\n awake[1] += 60;\n --awake[0];\n }\n awake[0] -= sleep[0];\n if ( awake[0] < 0 ){\n awake[0] += 24; \n }\n if ( awake[0] < 10 ){\n awake[0] = \"0\" + awake[0];\n }\n if ( awake[1] < 10 ){\n awake[1] = \"0\" + awake[1];\n }\n print(awake[0]+\":\"+awake[1]);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ac80ae27e259f8cf4a1e9039236be425", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "String.prototype.lpad = function(padString, length) {\n var str = this;\n while (str.length < length)\n str = padString + str;\n return str;\n};\n\nvar currentTime = readline().split(\":\");\ncurrentTime[0] = parseInt(currentTime[0]);\ncurrentTime[1] = parseInt(currentTime[1]);\nvar sleepLength = readline().split(\":\");\nsleepLength[0] = parseInt(sleepLength[0]);\nsleepLength[1] = parseInt(sleepLength[1]);\n\nvar sleepTimeHours = (currentTime[0] - sleepLength[0]);\nvar sleepTimeMinutes = (currentTime[1] - sleepLength[1]);\n\nif (sleepLength[1] > currentTime[1]) {\n sleepTimeHours--;\n}\n\nif (sleepTimeHours < 0) sleepTimeHours = 24 + sleepTimeHours;\nif (sleepTimeMinutes < 0) sleepTimeMinutes = 60 + sleepTimeMinutes;\n\nvar sleepTime = sleepTimeHours.toString().lpad(\"0\", 2) + \":\" + sleepTimeMinutes.toString().lpad(\"0\", 2);\n\nprint(sleepTime);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7d2a6d4ee5a91232ad0967c6273b9a16", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tvar s = readline().split(':').map(Number);\n\ts = s[0] * 60 + s[1];\n\n\tvar t = readline().split(':').map(Number);\n\tt = t[0] * 60 + t[1];\n\n\tvar d = s - t;\n\n\tif (d < 0) d += 1440\n\n\ts = Math.floor(d/60);\n\tt = d % 60;\n\n\tprint( (s < 10 ? '0' : '') + s + ':' + (t < 10 ? '0' : '') + t );\n\n}).call(this);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0dc8a72cc7580d9fc02e54af2f6943af", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Prelude_1 = __webpack_require__(1);\n\tvar List = __webpack_require__(2);\n\tvar _a = List.map(parseInt, readline().split(' ')), n = _a[0], T = _a[1];\n\tvar a = List.map(parseInt, readline().split(' '));\n\tvar x = List.nub(List.sort(a, function (x, y) { return x - y; }));\n\tvar m = x.length;\n\tvar z = List.create(301, 0);\n\tfor (var i = 0; i < x.length; i++) {\n\t z[x[i]] = i;\n\t}\n\tvar dp = List.create2D(m, m, 0);\n\tfunction solve(d, s, k) {\n\t d[s] = 1;\n\t for (var i = k + 1; i < n; i++) {\n\t var c = z[a[i]];\n\t if (c >= s) {\n\t d[c] = List.maximumInRange(d, s, c) + 1;\n\t }\n\t }\n\t}\n\tfor (var i = 0; i < n; i++) {\n\t var s = z[a[i]];\n\t if (dp[s][s] === 0) {\n\t solve(dp[s], s, i);\n\t }\n\t}\n\tfunction normalize(a) {\n\t for (var s = 0; s < m; s++) {\n\t for (var e = s + 1; e < m; e++) {\n\t a[s][e] = Prelude_1.max(a[s][e], a[s][e - 1]);\n\t }\n\t }\n\t}\n\tnormalize(dp);\n\tfunction combine(a, b) {\n\t var result = List.create2D(m, m, 0);\n\t for (var i = 0; i < m; i++) {\n\t for (var j = i; j < m; j++) {\n\t var x_1 = 0;\n\t for (var k = i; k <= j; k++) {\n\t x_1 = Prelude_1.max(x_1, a[i][k] + b[k][j]);\n\t }\n\t result[i][j] = x_1;\n\t }\n\t }\n\t return result;\n\t}\n\tfunction fastCombine(t) {\n\t if (t === 1)\n\t return dp;\n\t var a = fastCombine(Math.floor(t / 2));\n\t a = combine(a, a);\n\t if (t % 2 === 0) {\n\t return a;\n\t }\n\t else {\n\t return combine(a, dp);\n\t }\n\t}\n\tvar r = fastCombine(T);\n\tprint(List.maximumWith(r, function (xs) { return List.maximum(xs); }));\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tfunction min(a, b) {\n\t return a < b ? a : b;\n\t}\n\texports.min = min;\n\tfunction max(a, b) {\n\t return a < b ? b : a;\n\t}\n\texports.max = max;\n\tfunction curry(f) {\n\t return function (x) { return function (y) { return f(x, y); }; };\n\t}\n\texports.curry = curry;\n\tfunction uncurry(f) {\n\t return function (x, y) { return f(x)(y); };\n\t}\n\texports.uncurry = uncurry;\n\tfunction id(x) {\n\t return x;\n\t}\n\texports.id = id;\n\tfunction constant(x) {\n\t return function (_) { return x; };\n\t}\n\texports.constant = constant;\n\tfunction flip(f) {\n\t return function (y) { return function (x) { return f(x)(y); }; };\n\t}\n\texports.flip = flip;\n\tfunction flip2(f) {\n\t return function (y, x) { return f(x, y); };\n\t}\n\texports.flip2 = flip2;\n\tfunction compose(g, f) {\n\t return function (x) { return g(f(x)); };\n\t}\n\texports.compose = compose;\n\tfunction gcd(a, b) {\n\t var r = a % b;\n\t while (r !== 0) {\n\t a = b;\n\t b = r;\n\t r = a % b;\n\t }\n\t return b;\n\t}\n\texports.gcd = gcd;\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Prelude_1 = __webpack_require__(1);\n\tfunction add(xs, ys) {\n\t return xs.concat(ys);\n\t}\n\texports.add = add;\n\tfunction head(xs) {\n\t return xs[0];\n\t}\n\texports.head = head;\n\tfunction last(xs) {\n\t return xs[xs.length - 1];\n\t}\n\texports.last = last;\n\tfunction tail(xs) {\n\t return xs.slice(1);\n\t}\n\texports.tail = tail;\n\tfunction init(xs) {\n\t return xs.slice(0, xs.length - 1);\n\t}\n\texports.init = init;\n\tfunction map(f, xs) {\n\t var result = new Array(xs.length);\n\t for (var i = 0; i < xs.length; i++) {\n\t result[i] = f(xs[i]);\n\t }\n\t return result;\n\t}\n\texports.map = map;\n\tfunction reverse(xs) {\n\t return xs.slice().reverse();\n\t}\n\texports.reverse = reverse;\n\tfunction intersperse(x, xs) {\n\t if (xs.length == 0) {\n\t return [];\n\t }\n\t var result = new Array(xs.length + xs.length - 1);\n\t for (var i = 0; i + 1 < xs.length; i++) {\n\t result[i + i] = xs[i];\n\t result[i + i + 1] = x;\n\t }\n\t result[result.length - 1] = xs[xs.length - 1];\n\t return result;\n\t}\n\texports.intersperse = intersperse;\n\tfunction intercalate(xs, xss) {\n\t return concat(intersperse(xs, xss));\n\t}\n\texports.intercalate = intercalate;\n\tfunction foldl(f, initial, xs) {\n\t var result = initial;\n\t for (var i = 0; i < xs.length; i++) {\n\t result = f(result, xs[i]);\n\t }\n\t return result;\n\t}\n\texports.foldl = foldl;\n\tfunction foldr(f, initial, xs) {\n\t var result = initial;\n\t for (var i = xs.length - 1; i >= 0; i--) {\n\t result = f(xs[i], result);\n\t }\n\t return result;\n\t}\n\texports.foldr = foldr;\n\tfunction concat(xss) {\n\t var total = sum(map(function (xs) { return xs.length; }, xss));\n\t var result = new Array(total);\n\t var m = 0;\n\t for (var i = 0; i < xss.length; i++) {\n\t var xs = xss[i];\n\t for (var j = 0; j < xs.length; j++) {\n\t result[m++] = xs[j];\n\t }\n\t }\n\t return result;\n\t}\n\texports.concat = concat;\n\tfunction sum(xs) {\n\t var result = 0;\n\t for (var i = 0; i < xs.length; i++) {\n\t result += xs[i];\n\t }\n\t return result;\n\t}\n\texports.sum = sum;\n\tfunction product(xs) {\n\t var result = 1;\n\t for (var i = 0; i < xs.length; i++) {\n\t result *= xs[i];\n\t }\n\t return result;\n\t}\n\texports.product = product;\n\tfunction sort(xs, compare) {\n\t return copy(xs).sort(compare);\n\t}\n\texports.sort = sort;\n\tfunction sortInPlace(xs, compare) {\n\t xs.sort(compare);\n\t return xs;\n\t}\n\texports.sortInPlace = sortInPlace;\n\tfunction maximumInRange(xs, s, e) {\n\t var result = xs[s];\n\t for (var i = s + 1; i <= e; i++) {\n\t if (result < xs[i])\n\t result = xs[i];\n\t }\n\t return result;\n\t}\n\texports.maximumInRange = maximumInRange;\n\tfunction maximum(xs) {\n\t return maximumInRange(xs, 0, xs.length - 1);\n\t}\n\texports.maximum = maximum;\n\tfunction maximumInRangeWith(xs, s, e, f) {\n\t var result = f(xs[s]);\n\t for (var i = s + 1; i <= e; i++) {\n\t var candidate = f(xs[i]);\n\t if (result < candidate)\n\t result = candidate;\n\t }\n\t return result;\n\t}\n\texports.maximumInRangeWith = maximumInRangeWith;\n\tfunction maximumWith(xs, f) {\n\t return maximumInRangeWith(xs, 0, xs.length - 1, f);\n\t}\n\texports.maximumWith = maximumWith;\n\tfunction minimumInRange(xs, s, e) {\n\t var result = xs[s];\n\t for (var i = s + 1; i <= e; i++) {\n\t if (result > xs[i])\n\t result = xs[i];\n\t }\n\t return result;\n\t}\n\texports.minimumInRange = minimumInRange;\n\tfunction minimum(xs) {\n\t return minimumInRange(xs, 0, xs.length - 1);\n\t}\n\texports.minimum = minimum;\n\tfunction minimumInRangeWith(xs, s, e, f) {\n\t var result = f(xs[s]);\n\t for (var i = s + 1; i <= e; i++) {\n\t var candidate = f(xs[i]);\n\t if (result > candidate)\n\t result = candidate;\n\t }\n\t return result;\n\t}\n\texports.minimumInRangeWith = minimumInRangeWith;\n\tfunction minimumWith(xs, f) {\n\t return minimumInRangeWith(xs, 0, xs.length - 1, f);\n\t}\n\texports.minimumWith = minimumWith;\n\tfunction replicate(n, x) {\n\t var result = new Array(n);\n\t for (var i = 0; i < result.length; i++) {\n\t result[i] = x;\n\t }\n\t return result;\n\t}\n\texports.replicate = replicate;\n\tfunction take(n, xs) {\n\t return xs.slice(0, n);\n\t}\n\texports.take = take;\n\tfunction drop(n, xs) {\n\t return xs.slice(n);\n\t}\n\texports.drop = drop;\n\tfunction splitAt(n, xs) {\n\t return [take(n, xs), drop(n, xs)];\n\t}\n\texports.splitAt = splitAt;\n\tfunction takeWhile(f, xs) {\n\t for (var i = 0; i < xs.length; i++) {\n\t if (!f(xs[i])) {\n\t return xs.slice(0, i);\n\t }\n\t }\n\t return xs.slice();\n\t}\n\texports.takeWhile = takeWhile;\n\tfunction dropWhile(f, xs) {\n\t for (var i = 0; i < xs.length; i++) {\n\t if (!f(xs[i])) {\n\t return xs.slice(i);\n\t }\n\t }\n\t return [];\n\t}\n\texports.dropWhile = dropWhile;\n\tfunction group(xs) {\n\t if (xs.length == 0)\n\t return [];\n\t var result = [];\n\t var last = [xs[0]];\n\t for (var i = 1; i < xs.length; i++) {\n\t if (last[0] === xs[i]) {\n\t last.push(xs[i]);\n\t }\n\t else {\n\t result.push(last);\n\t last = [xs[i]];\n\t }\n\t }\n\t result.push(last);\n\t return result;\n\t}\n\texports.group = group;\n\tfunction nub(xs) {\n\t if (xs.length == 0)\n\t return [];\n\t var result = [];\n\t result.push(xs[0]);\n\t for (var i = 1; i < xs.length; i++) {\n\t if (xs[i] !== xs[i - 1]) {\n\t result.push(xs[i]);\n\t }\n\t }\n\t return result;\n\t}\n\texports.nub = nub;\n\tfunction filter(f, xs) {\n\t var result = [];\n\t for (var i = 0; i < xs.length; i++) {\n\t if (f(xs[i]))\n\t result.push(xs[i]);\n\t }\n\t return result;\n\t}\n\texports.filter = filter;\n\tfunction zip(xs, ys) {\n\t var n = Prelude_1.min(xs.length, ys.length);\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = [xs[i], ys[i]];\n\t }\n\t return result;\n\t}\n\texports.zip = zip;\n\tfunction unzip(xs) {\n\t var r1 = new Array(xs.length);\n\t var r2 = new Array(xs.length);\n\t for (var i = 0; i < xs.length; i++) {\n\t r1[i] = xs[i][0];\n\t r2[i] = xs[i][1];\n\t }\n\t return [r1, r2];\n\t}\n\texports.unzip = unzip;\n\tfunction range(from, to) {\n\t var result = Array(to - from + 1);\n\t for (var i = from; i <= to; i++) {\n\t result[i - from] = i;\n\t }\n\t return result;\n\t}\n\texports.range = range;\n\tfunction copy(xs) {\n\t return xs.slice(0);\n\t}\n\texports.copy = copy;\n\tfunction apply_permutation(p, xs) {\n\t var n = xs.length;\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = xs[p[i]];\n\t }\n\t return result;\n\t}\n\texports.apply_permutation = apply_permutation;\n\tfunction next_permutation(p) {\n\t var n = p.length;\n\t if (n < 2)\n\t return null;\n\t var r = copy(p);\n\t var k = n - 2;\n\t for (; k >= 0 && r[k] >= r[k + 1]; k--)\n\t ;\n\t if (k < 0)\n\t return null;\n\t for (var i = k + 1, j = n - 1; i < j; i++, j--) {\n\t var t_1 = r[i];\n\t r[i] = r[j];\n\t r[j] = t_1;\n\t }\n\t var next = k + 1;\n\t for (; r[next] <= r[k]; next++)\n\t ;\n\t var t = r[k];\n\t r[k] = r[next];\n\t r[next] = t;\n\t return r;\n\t}\n\texports.next_permutation = next_permutation;\n\tfunction create(n, value) {\n\t return replicate(n, value);\n\t}\n\texports.create = create;\n\tfunction createWith(n, f) {\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = f(i);\n\t }\n\t return result;\n\t}\n\texports.createWith = createWith;\n\tfunction create2D(n1, n2, value) {\n\t return map(function (_) { return replicate(n2, value); }, replicate(n1, 0));\n\t}\n\texports.create2D = create2D;\n\tfunction create2DWith(n1, n2, f) {\n\t var result = new Array(n1);\n\t for (var i = 0; i < n1; i++) {\n\t result[i] = new Array(n2);\n\t for (var j = 0; j < n2; j++) {\n\t result[i][j] = f(i, j);\n\t }\n\t }\n\t return result;\n\t}\n\texports.create2DWith = create2DWith;\n\n\n/***/ }\n/******/ ]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9e1362211403a1d16b01827a99ae5269", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Prelude_1 = __webpack_require__(1);\n\tvar List = __webpack_require__(2);\n\tvar _a = List.map(parseInt, readline().split(' ')), n = _a[0], T = _a[1];\n\tvar a = List.map(parseInt, readline().split(' '));\n\tvar x = List.nub(List.copy(a).sort());\n\tvar m = x.length;\n\tvar z = List.create(301, 0);\n\tfor (var i = 0; i < x.length; i++) {\n\t z[x[i]] = i;\n\t}\n\tvar dp = List.create2D(m, m, 0);\n\tfunction solve(d, s, k) {\n\t d[s] = 1;\n\t for (var i = k + 1; i < n; i++) {\n\t var c = z[a[i]];\n\t if (c >= s) {\n\t d[c] = List.maximumInRange(d, s, c) + 1;\n\t }\n\t }\n\t for (var i = s + 1; i < m; i++) {\n\t d[i] = Prelude_1.max(d[i], d[i - 1]);\n\t }\n\t}\n\tfor (var i = 0; i < n; i++) {\n\t var s = z[a[i]];\n\t if (dp[s][s] === 0) {\n\t solve(dp[s], s, i);\n\t }\n\t}\n\tfunction combine(a, b) {\n\t var result = List.create2D(m, m, 0);\n\t for (var i = 0; i < m; i++) {\n\t for (var j = i; j < m; j++) {\n\t var x_1 = 0;\n\t for (var k = i; k <= j; k++) {\n\t x_1 = Prelude_1.max(x_1, a[i][k] + b[k][j]);\n\t }\n\t result[i][j] = x_1;\n\t }\n\t }\n\t return result;\n\t}\n\tfunction fastCombine(t) {\n\t if (t == 1)\n\t return dp;\n\t var a = fastCombine(Math.floor(t / 2));\n\t a = combine(a, a);\n\t if (t % 2 === 0) {\n\t return a;\n\t }\n\t else {\n\t return combine(a, dp);\n\t }\n\t}\n\tvar r = fastCombine(T);\n\tprint(List.maximumWith(r, function (x) { return List.maximum(x); }));\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tfunction min(a, b) {\n\t return a < b ? a : b;\n\t}\n\texports.min = min;\n\tfunction max(a, b) {\n\t return a < b ? b : a;\n\t}\n\texports.max = max;\n\tfunction curry(f) {\n\t return function (x) { return function (y) { return f(x, y); }; };\n\t}\n\texports.curry = curry;\n\tfunction uncurry(f) {\n\t return function (x, y) { return f(x)(y); };\n\t}\n\texports.uncurry = uncurry;\n\tfunction id(x) {\n\t return x;\n\t}\n\texports.id = id;\n\tfunction constant(x) {\n\t return function (_) { return x; };\n\t}\n\texports.constant = constant;\n\tfunction flip(f) {\n\t return function (y) { return function (x) { return f(x)(y); }; };\n\t}\n\texports.flip = flip;\n\tfunction flip2(f) {\n\t return function (y, x) { return f(x, y); };\n\t}\n\texports.flip2 = flip2;\n\tfunction compose(g, f) {\n\t return function (x) { return g(f(x)); };\n\t}\n\texports.compose = compose;\n\tfunction gcd(a, b) {\n\t var r = a % b;\n\t while (r !== 0) {\n\t a = b;\n\t b = r;\n\t r = a % b;\n\t }\n\t return b;\n\t}\n\texports.gcd = gcd;\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Prelude_1 = __webpack_require__(1);\n\tfunction add(xs, ys) {\n\t return xs.concat(ys);\n\t}\n\texports.add = add;\n\tfunction head(xs) {\n\t return xs[0];\n\t}\n\texports.head = head;\n\tfunction last(xs) {\n\t return xs[xs.length - 1];\n\t}\n\texports.last = last;\n\tfunction tail(xs) {\n\t return xs.slice(1);\n\t}\n\texports.tail = tail;\n\tfunction init(xs) {\n\t return xs.slice(0, xs.length - 1);\n\t}\n\texports.init = init;\n\tfunction map(f, xs) {\n\t var result = new Array(xs.length);\n\t for (var i = 0; i < xs.length; i++) {\n\t result[i] = f(xs[i]);\n\t }\n\t return result;\n\t}\n\texports.map = map;\n\tfunction reverse(xs) {\n\t return xs.slice().reverse();\n\t}\n\texports.reverse = reverse;\n\tfunction intersperse(x, xs) {\n\t if (xs.length == 0) {\n\t return [];\n\t }\n\t var result = new Array(xs.length + xs.length - 1);\n\t for (var i = 0; i + 1 < xs.length; i++) {\n\t result[i + i] = xs[i];\n\t result[i + i + 1] = x;\n\t }\n\t result[result.length - 1] = xs[xs.length - 1];\n\t return result;\n\t}\n\texports.intersperse = intersperse;\n\tfunction intercalate(xs, xss) {\n\t return concat(intersperse(xs, xss));\n\t}\n\texports.intercalate = intercalate;\n\tfunction foldl(f, initial, xs) {\n\t var result = initial;\n\t for (var i = 0; i < xs.length; i++) {\n\t result = f(result, xs[i]);\n\t }\n\t return result;\n\t}\n\texports.foldl = foldl;\n\tfunction foldr(f, initial, xs) {\n\t var result = initial;\n\t for (var i = xs.length - 1; i >= 0; i--) {\n\t result = f(xs[i], result);\n\t }\n\t return result;\n\t}\n\texports.foldr = foldr;\n\tfunction concat(xss) {\n\t var total = sum(map(function (xs) { return xs.length; }, xss));\n\t var result = new Array(total);\n\t var m = 0;\n\t for (var i = 0; i < xss.length; i++) {\n\t var xs = xss[i];\n\t for (var j = 0; j < xs.length; j++) {\n\t result[m++] = xs[j];\n\t }\n\t }\n\t return result;\n\t}\n\texports.concat = concat;\n\tfunction sum(xs) {\n\t var result = 0;\n\t for (var i = 0; i < xs.length; i++) {\n\t result += xs[i];\n\t }\n\t return result;\n\t}\n\texports.sum = sum;\n\tfunction product(xs) {\n\t var result = 1;\n\t for (var i = 0; i < xs.length; i++) {\n\t result *= xs[i];\n\t }\n\t return result;\n\t}\n\texports.product = product;\n\tfunction maximumInRange(xs, s, e) {\n\t var result = xs[s];\n\t for (var i = s + 1; i <= e; i++) {\n\t if (result < xs[i])\n\t result = xs[i];\n\t }\n\t return result;\n\t}\n\texports.maximumInRange = maximumInRange;\n\tfunction maximum(xs) {\n\t return maximumInRange(xs, 0, xs.length - 1);\n\t}\n\texports.maximum = maximum;\n\tfunction maximumInRangeWith(xs, s, e, f) {\n\t var result = f(xs[s]);\n\t for (var i = s + 1; i <= e; i++) {\n\t var candidate = f(xs[i]);\n\t if (result < candidate)\n\t result = candidate;\n\t }\n\t return result;\n\t}\n\texports.maximumInRangeWith = maximumInRangeWith;\n\tfunction maximumWith(xs, f) {\n\t return maximumInRangeWith(xs, 0, xs.length - 1, f);\n\t}\n\texports.maximumWith = maximumWith;\n\tfunction minimumInRange(xs, s, e) {\n\t var result = xs[s];\n\t for (var i = s + 1; i <= e; i++) {\n\t if (result > xs[i])\n\t result = xs[i];\n\t }\n\t return result;\n\t}\n\texports.minimumInRange = minimumInRange;\n\tfunction minimum(xs) {\n\t return minimumInRange(xs, 0, xs.length - 1);\n\t}\n\texports.minimum = minimum;\n\tfunction minimumInRangeWith(xs, s, e, f) {\n\t var result = f(xs[s]);\n\t for (var i = s + 1; i <= e; i++) {\n\t var candidate = f(xs[i]);\n\t if (result > candidate)\n\t result = candidate;\n\t }\n\t return result;\n\t}\n\texports.minimumInRangeWith = minimumInRangeWith;\n\tfunction minimumWith(xs, f) {\n\t return minimumInRangeWith(xs, 0, xs.length - 1, f);\n\t}\n\texports.minimumWith = minimumWith;\n\tfunction replicate(n, x) {\n\t var result = new Array(n);\n\t for (var i = 0; i < result.length; i++) {\n\t result[i] = x;\n\t }\n\t return result;\n\t}\n\texports.replicate = replicate;\n\tfunction take(n, xs) {\n\t return xs.slice(0, n);\n\t}\n\texports.take = take;\n\tfunction drop(n, xs) {\n\t return xs.slice(n);\n\t}\n\texports.drop = drop;\n\tfunction splitAt(n, xs) {\n\t return [take(n, xs), drop(n, xs)];\n\t}\n\texports.splitAt = splitAt;\n\tfunction takeWhile(f, xs) {\n\t for (var i = 0; i < xs.length; i++) {\n\t if (!f(xs[i])) {\n\t return xs.slice(0, i);\n\t }\n\t }\n\t return xs.slice();\n\t}\n\texports.takeWhile = takeWhile;\n\tfunction dropWhile(f, xs) {\n\t for (var i = 0; i < xs.length; i++) {\n\t if (!f(xs[i])) {\n\t return xs.slice(i);\n\t }\n\t }\n\t return [];\n\t}\n\texports.dropWhile = dropWhile;\n\tfunction group(xs) {\n\t if (xs.length == 0)\n\t return [];\n\t var result = [];\n\t var last = [xs[0]];\n\t for (var i = 1; i < xs.length; i++) {\n\t if (last[0] === xs[i]) {\n\t last.push(xs[i]);\n\t }\n\t else {\n\t result.push(last);\n\t last = [xs[i]];\n\t }\n\t }\n\t result.push(last);\n\t return result;\n\t}\n\texports.group = group;\n\tfunction nub(xs) {\n\t if (xs.length == 0)\n\t return [];\n\t var result = [];\n\t result.push(xs[0]);\n\t for (var i = 1; i < xs.length; i++) {\n\t if (xs[i] !== xs[i - 1]) {\n\t result.push(xs[i]);\n\t }\n\t }\n\t return result;\n\t}\n\texports.nub = nub;\n\tfunction filter(f, xs) {\n\t var result = [];\n\t for (var i = 0; i < xs.length; i++) {\n\t if (f(xs[i]))\n\t result.push(xs[i]);\n\t }\n\t return result;\n\t}\n\texports.filter = filter;\n\tfunction zip(xs, ys) {\n\t var n = Prelude_1.min(xs.length, ys.length);\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = [xs[i], ys[i]];\n\t }\n\t return result;\n\t}\n\texports.zip = zip;\n\tfunction unzip(xs) {\n\t var r1 = new Array(xs.length);\n\t var r2 = new Array(xs.length);\n\t for (var i = 0; i < xs.length; i++) {\n\t r1[i] = xs[i][0];\n\t r2[i] = xs[i][1];\n\t }\n\t return [r1, r2];\n\t}\n\texports.unzip = unzip;\n\tfunction range(from, to) {\n\t var result = Array(to - from + 1);\n\t for (var i = from; i <= to; i++) {\n\t result[i - from] = i;\n\t }\n\t return result;\n\t}\n\texports.range = range;\n\tfunction copy(xs) {\n\t return xs.slice(0);\n\t}\n\texports.copy = copy;\n\tfunction apply_permutation(p, xs) {\n\t var n = xs.length;\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = xs[p[i]];\n\t }\n\t return result;\n\t}\n\texports.apply_permutation = apply_permutation;\n\tfunction next_permutation(p) {\n\t var n = p.length;\n\t if (n < 2)\n\t return null;\n\t var r = copy(p);\n\t var k = n - 2;\n\t for (; k >= 0 && r[k] >= r[k + 1]; k--)\n\t ;\n\t if (k < 0)\n\t return null;\n\t for (var i = k + 1, j = n - 1; i < j; i++, j--) {\n\t var t_1 = r[i];\n\t r[i] = r[j];\n\t r[j] = t_1;\n\t }\n\t var next = k + 1;\n\t for (; r[next] <= r[k]; next++)\n\t ;\n\t var t = r[k];\n\t r[k] = r[next];\n\t r[next] = t;\n\t return r;\n\t}\n\texports.next_permutation = next_permutation;\n\tfunction create(n, value) {\n\t return replicate(n, value);\n\t}\n\texports.create = create;\n\tfunction createWith(n, f) {\n\t var result = new Array(n);\n\t for (var i = 0; i < n; i++) {\n\t result[i] = f(i);\n\t }\n\t return result;\n\t}\n\texports.createWith = createWith;\n\tfunction create2D(n1, n2, value) {\n\t return map(function (_) { return replicate(n2, value); }, replicate(n1, 0));\n\t}\n\texports.create2D = create2D;\n\tfunction create2DWith(n1, n2, f) {\n\t var result = new Array(n1);\n\t for (var i = 0; i < n1; i++) {\n\t result[i] = new Array(n2);\n\t for (var j = 0; j < n2; j++) {\n\t result[i][j] = f(i, j);\n\t }\n\t }\n\t return result;\n\t}\n\texports.create2DWith = create2DWith;\n\n\n/***/ }\n/******/ ]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e6d813b57282259b2e2063974a27c95c", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "//var input = readline()\nvar k = readline()\n\nif(k==2) print(2)\nelse print(1)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "637456b62052e589898115c5d9066d77", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n const n = +d;\n\n if (n === 2) {\n console.log(2);\n }\n else {\n console.log(1);\n }\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "428f2f5fc341ba13e6ae669e0e9023ae", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar N = nextInt();\n\tif(N <= 2){\n\t\tmyout(N);\n\t}else{\n\t\tmyout(1);\n\t}\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4ef68ee6b38310fb43c752c97589338d", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "// My first java script code :D\nif(readline()==2) print(2); else print(1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b234956fadc86a4e147fdba140deabcf", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n const n = +d;\n console.log(1);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a480737317bad46068c9d33d0db9bd4b", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "const a = readline();\n\nif (a > 2) {\n print(a);\n} else {\n print(1);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3360d4b139c91a822ea894fce34bb75d", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "print(2 - parseInt(readline()) ** 2);", "lang_cluster": "Javascript", "compilation_error": true, "code_uid": "b619f17246cf438b06000220fbefdce0", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const n = +lines[l++]\n output[i] = solve(n)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n) {\n return 2 - n * n\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "03da8477665cd1e4cd1bd573c3e6bb3b", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "JavaScript", "source_code": "print(2 - Math.pow(parseInt(readline()), 2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fa5107fb63380708f376747843c50a7d", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "JavaScript", "source_code": "print(parseInt(readline()) & 1);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "94c3d91304652c81c82cdff908fad1b8", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "JavaScript", "source_code": "const boyCount = Number(readline());\nconst girlCount = Number(readline());\nconst participantCount = Number(readline());\nvar result = 0;\nfor (var i = 0; i <= participantCount; i++)\n if (i <= boyCount && participantCount - i <= girlCount) result++;\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "73304fd03cf5f17a079f572720ebd8cd", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const b = +readline(); // 5, 5\nconst g = +readline(); // 6, 3\nconst n = +readline(); // 3, 5\nprint(n + 1 - (b < n ? n - b : 0) - (g < n ? n - g : 0)); // 3 + 1 - 0 - 0 = 4, 5 + 1 - 0 - 2 = 4", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5736229a361aeaa126243e838deda9d5", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const boyCount = Number(readline());\nconst girlCount = Number(readline());\nconst participantCount = Number(readline());\nvar result = 0;\nfor (var i = 0; i <= participantCount; i++)\n if (i <= boyCount && participantCount - i <= girlCount) result++;\nprint(result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f3b5690d0635620d7ff102d706017261", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "let i = '';\nprocess.stdin.on('data', (c) => {\n i += c;\n});\nprocess.stdin.on('end', () => {\n const { EOL } = require('os');\n const lines = i.split(EOL);\n const b = parseInt(lines[0], 10);\n const g = parseInt(lines[1], 10);\n const n = parseInt(lines[2], 10);\n console.log(badges(b, g, n));\n});\n\n\nfunction badges(b, g, n) {\n const min = Math.min(b, g);\n return min >= n ? 1 + n : 1 + min;\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f4adf76a3bbe90ee0ce5d736fe307fe6", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "const b = readline(); // 5, 5\nconst g = readline(); // 6, 3\nconst n = readline(); // 3, 5\nprint(n + 1 - (b < n ? n - b : 0) - (g < n ? n - g : 0)); // 3 + 1 - 0 - 0 = 4, 5 + 1 - 0 - 2 = 4", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3db3ecb9f80da16e9147a28a69bfdfd3", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "JavaScript", "source_code": "function main() {\n var line = readline().split(' ').map(Number);\n var n = line[0];\n var l = line[1];\n var r = line[2];\n if (n == 0) {\n return print(0);\n }\n if (n == 1) {\n return print(1);\n }\n var length = 1;\n var current = 1;\n for (var i = 1; i < 52; i++) {\n current *= 2;\n if (n <= current) {\n break;\n }\n \n length = length * 2 + 1;\n }\n var result = [];\n for (var i = 0; i < length; i++) {\n if (i % 2 == 0) {\n result[i] = 1;\n } \n }\n var initL = length;\n while (n > 1) {\n var d = Math.floor(n / 2);\n var m = Math.floor(length / 2);\n result[m] = n % 2;\n n = d;\n length = m;\n }\n var res = 0;\n for (var i = l - 1; i < r; i++) {\n var length = initL;\n if(i%2==0){\n res += 1;\n continue;\n }\n var curI = i;\n while(true){\n var m = Math.floor(length / 2);\n if(m<=1){\n curI -= 1;\n }\n if(curI == m || m<=1){\n res += result[curI];\n break;\n }\n curI = curI%m;\n length = m;\n }\n }\n print(res);\n}\n\nmain()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5236e695eb6af42a49d3949e8edef133", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "function main() {\n var line = readline().split(' ').map(Number);\n var n = line[0];\n var l = line[1];\n var r = line[2];\n if (n == 0) {\n return print(0);\n }\n if (n == 1) {\n return print(1);\n }\n var length = 1;\n var current = 1;\n for (var i = 1; i < 52; i++) {\n current *= 2;\n if (n < current) {\n break;\n }\n\n length = length * 2 + 1;\n }\n var res = 0;\n for(var i=l;i<=r;i++){\n if(i%2!=0){\n res++;\n continue;\n }\n\n var current = i;\n var currentLenth = length;\n var currentN = n;\n \n while(true){\n var m = Math.floor(currentLenth / 2) + 1;\n var d = Math.floor(currentN / 2);\n if (current == m) {\n res += currentN % 2;\n break;\n } else {\n current = current % m;\n currentLenth = Math.floor(currentLenth / 2);\n currentN = d;\n }\n }\n }\n print(res);\n}\n\nmain()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "378e82340bd6a193019d08c6f69b3da1", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var x = 12345;\nfor(var i = 0; i < 100000000; i += 1) {\n x %= i;\n}\nprint(readline().split(' ').slice(1).map(function(x) { return parseInt(x); }).sort(function(a, b) { return a - b; }).concat(x).slice(0, -1).join(' '));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "363d7aea26311bc325dd55516af4ed2f", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var x = 12345;\nfor(var i = 0; i < 10000000; i += 1) {\n x %= i;\n}\nprint(readline().split(' ').slice(1).map(function(x) { return parseInt(x); }).sort(function(a, b) { return a - b; }).concat(x).slice(0, -1).join(' '));\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6e61a984e9c8b2f88531f399455c2884", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "setTimeout(function() { print(readline().split(' ').slice(1).map(function(x) { return parseInt(x); }).sort(function(a, b) { return a - b; }).join(' ')); }, 1000);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6c7c78724343d7b8b97e2aab7e72ddae", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "print(readline().split(' ').slice(1).map(function(x) { return parseInt(x); }).sort(function(a, b) { return a - b; }).concat(x).slice(0, -1).join(' '));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5732e608a24b5c8360f053e0e66c2e43", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "function exam (restArgs) {\n\tconst a = parseInt(restArgs[0]);\n\tconst b = parseInt(restArgs[1]);\n\tconst c = parseInt(restArgs[2]);\n\tconst n = parseInt(restArgs[3]);\n\tif (a>=c && b>=c) {\n\t\tconst total = a+b-c+1;\n\t\tif (total <= n) {\n\t\t\treturn (n-total+1);\n\t\t}\n\t}\n\treturn -1;\n}\nprint(exam(readline().split(\" \")));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "36f94a8678ce96793367cef57f3f0f6e", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var distribution = readline().split(' ').map(Number);\nvar bdStudents = distribution[0];\nvar bkStudents = distribution[1];\nvar both = distribution[2];\n\nvar result = distribution[3] - bdStudents - bkStudents + both;\nif(both > bdStudents || both > bkStudents || result <= 0) {\n print(-1);\n} else {\n print(result);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "01cd6fc75f08d772d6addf061812596f", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function exam (restArgs) {\n\tconst a = parseInt(restArgs[0]);\n\tconst b = parseInt(restArgs[1]);\n\tconst c = parseInt(restArgs[2]);\n\tconst n = parseInt(restArgs[3]);\n\tconst aux = n-(a+b-c);\n\tif (a>=c && b>=c && aux>=1) {\n\t\treturn aux;\n\t}\n\treturn -1;\n}\nprint(exam(readline().split(\" \")));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e328debca946d2e1bee62403e2e81523", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(' ').map(function(x) { return parseInt(x); });\nvar first = (nums[0] -nums[2])\nvar second = (nums[1] - nums[2])\nvar cel = (first + second + nums[2])\n\nprint((first < 0 || second < 0) ? -1 : nums[3] > cel ? nums[3] - cel : -1 )", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aed092a1f2d79067ed8d26ed986f948b", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var nums = readline().split(' ').map(function(x) { return parseInt(x); });\nvar cel = ((nums[0] -nums[2]) + (nums[1] - nums[2]) + nums[2])\nprint(nums[3] > cel ? nums[3] - cel : -1 )", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "424a35e52ebc1673ac5805c80c1ad45c", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function exam (a,b,c,n) {\n\tif (a>=c && b>=c) {\n\t\tvar total = a+b-c+1\n\t\tif (total <= n) {\n\t\t\treturn (n-total+1)\n\t\t}\n\t}\n\treturn -1\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "068af9ef8b134f4c3d6e68e3c01c2aaf", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var tok = null;\nvar index = 0;\nfunction next() {\n while (tok == null || index == tok.length) {\n tok = readline().split(' ');\n index = 0;\n }\n var res = tok[index++];\n return res;\n}\n\nfunction nextInt() {\n return parseInt(next());\n}\n\nfunction sortNumber(a, b) {\n return a - b;\n}\n\nfunction sortByLength(a, b) {\n return a.length - b.length;\n}\n\nfunction main() {\n var arrS = [];\n for (var i = 0; i < 4; i++) {\n arrS[i] = next();\n }\n arrS.sort(sortByLength);\n if ((arrS[3].length - 2) >= 2 * (arrS[2].length - 2)) {\n print(arrS[3].charAt(0));\n } else if ((arrS[1].length - 2) >= 2 * (arrS[0].length - 2)) {\n print(arrS[0].charAt(0));\n } else {\n print('C');\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1ce9470f018a89131603ffd32652aba2", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": ";(function () {\n\tprint(function () {\n\t\tvar A = readline().length - 2,\n\t\t\tB = readline().length - 2,\n\t\t\tC = readline().length - 2,\n\t\t\tD = readline().length - 2;\n\n\t\tvar t = [];\n\t\tif (isIt(A, B, C, D)) t.push('A');\n\t\tif (isIt(B, A, C, D)) t.push('B');\n\t\tif (isIt(C, B, A, D)) t.push('C');\n\t\tif (isIt(D, B, C, A)) t.push('D');\n\t\t\n\t\treturn t.length === 1 ? t[0] : 'C';\n\n\t\tfunction isIt (q, w, e, r) {\n\t\t\tif ((q >= w * 2) && (q >= e * 2) && (q >= r * 2)) return true;\n\t\t\tif ((w >= q * 2) && (e >= q * 2) && (r >= q * 2)) return true;\n\t\t\treturn false;\n\t\t}\n\t}());\n}.call(this));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "23c9d8b95f04613e718efcc457f18e2d", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var inSarr = [];\nvar minArr = [0, 0, 0, 0];\nvar maxArr = [0, 0, 0, 0];\nfor (var i=0; i<4; i++) {\n inSarr[i] = readline();\n}\n\nfor (i=0; i<4; i++) {\n for (var j=0; j<4; j++) {\n if (i!=j && inSarr[i].length-2 <= (inSarr[j].length-2)/2) {\n minArr[i] += 1;\n }\n if (i!=j && (inSarr[i].length-2)/2 >= inSarr[j].length-2) {\n maxArr[i] += 1;\n }\n }\n}\nfor (i=0; i<4; i++) {\n for (var j=0; j<4; j++) {\n if (i!=j) {\n if (minArr[i] == 3 && maxArr[j] == 3) {\n minArr[i] = 0;\n maxArr[j] = 0;\n break;\n }\n }\n }\n}\nif (minArr[0] == 3 || maxArr[0] == 3) {\nprint(\"A\");\n}\nelse if (minArr[1] == 3 || maxArr[1] == 3) {\nprint(\"B\");\n}\nelse if (minArr[2] == 3 || maxArr[2] == 3) {\nprint(\"C\");\n}\nelse if (minArr[3] == 3 || maxArr[3] == 3) {\nprint(\"D\");\n}\nelse {\nprint(\"C\");\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "626882aec5d7160a0dca68e26e8e6b4f", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var tok = null;\nvar index = 0;\nfunction next() {\n while (tok == null || index == tok.length) {\n tok = readline().split(' ');\n index = 0;\n }\n var res = tok[index++];\n return res;\n}\n\nfunction nextInt() {\n return parseInt(next());\n}\n\nfunction sortNumber(a, b) {\n return a - b;\n}\n\nfunction sortByLength(a, b) {\n return a.length - b.length;\n}\n\nfunction main() {\n var arrS = [];\n for (var i = 0; i < 4; i++) {\n arrS[i] = next();\n }\n arrS.sort(sortByLength);\n if ((arrS[3].length - 2) >= 2 * (arrS[2].length - 2)&&(arrS[1].length - 2) >= 2 * (arrS[0].length - 2)){\nprint('C');\n}else if((arrS[3].length - 2) >= 2 * (arrS[2].length - 2)) {\n print(arrS[3].charAt(0));\n } else if ((arrS[1].length - 2) >= 2 * (arrS[0].length - 2)) {\n print(arrS[0].charAt(0));\n } else {\n print('C');\n }\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4c07efa7adde1ffbd07440fedf282c5e", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar info = [];\n\tfor (var i = 0; i < 4; ++i) {\n\t\tvar line = trim(readline());\n\t\tinfo.push({ choice: line.charAt(0), length: line.length - 2 });\n\t}\n\tinfo.sort(function (a, b) {\n\t\treturn a.length - b.length;\n\t});\n\tvar superShort = info[0].length*2 <= info[1].length,\n\t\tsuperLong = info[3].length >= 2*info[2].length;\n\tif (superShort ^ superLong) {\n\t\tif (superShort) {\n\t\t\tprint(info[0].choice);\n\t\t} else {\n\t\t\tprint(info[3].choice);\n\t\t}\n\t} else {\n\t\tprint('C');\n\t}\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9d7d187fe5258f0e8fe64974e5ef60b8", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\tsizeA = data[0], sizeB = data[1];\n\tdata = tokenizeIntegers(readline());\n\tvar winA = data[0], multiple = data[1],\n\t\tseeds = parseInt(readline());\n\tvar needWinners = winA*multiple - seeds,\n\t\tneedProblems = 0;\n\tif (winA*sizeB > sizeA) {\n\t\tvar rounds = Math.floor(needWinners / winA);\n\t\tneedProblems = rounds * sizeA;\n\t\tneedWinners -= rounds * winA;\n\t\tneedProblems += Math.min(sizeA, needWinners * sizeB);\n\t} else {\n\t\tneedProblems = needWinners * sizeB;\n\t}\n\tprint(needProblems);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9cc6647f3a4100370d63b891c1d8fd6a", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "if (!this.readline) print = console.log, readline = require('./readline');\n\nfunction readNums() {\n\treturn readline().split(' ').map(Number);\n}\n\n\nprint(function(c, d, n, m, k) {\n\tm -= Math.floor(k / n);\n\tk %= n;\n\treturn m <= 0 ? 0 : Math.min(m * c, Math.min((n - k) * d + (m - 1) * c, (n - k) * n + (m - 1) * n * n));\n}.apply(0, readNums().concat(readNums()).concat(readNums())));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "61a7efc3afaaa27dd3bb2f90db42d6b7", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "\nfunction tokenize(s) {\n\treturn s.split(/\\s+/);\n}\n\nfunction tokenize_integers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i++) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\nfunction nextArray() {\n\treturn tokenize_integers(readline());\n}\nfunction nextInt() {\n\treturn parseInt(readline());\n\t//\treturn tokenize_integers(readline())[0];\n}\nfunction main() {\n\tvar data = nextArray();\n\tvar c = data[0], d = data[1];\n\tdata = nextArray();\n\tvar n = data[0], m = data[1];\n\tvar k = nextInt();\n\tvar needWinners = Math.max(0, n * m - k);\n//\tprint(needWinners);\n\tvar ret = -1;\n\tfor(var x = 0; x <= 10000; x++) {\n\t\tvar y = needWinners - c * x * n ;\n\t\ty /= d;\n\t\ty = Math.max(y, 0);\n\t\tvar tmp = c * x + y * d;\n\t\tif(ret == -1 || tmp < ret) {\n\t\t\tret = tmp;\n\t\t}\n\t}\n\tprint(ret);\n}\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "521a2461f412b44b004259d64fee4f29", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\tsizeA = data[0], sizeB = data[1];\n\tdata = tokenizeIntegers(readline());\n\tvar winA = data[0], multiple = data[1],\n\t\tseeds = parseInt(readline());\n\tvar needWinners = Math.max(0, winA*multiple - seeds),\n\t\tneedProblems = 0;\n\tif (winA*sizeB > sizeA) {\n\t\tvar rounds = Math.floor(needWinners / winA);\n\t\tneedProblems = rounds * sizeA;\n\t\tneedWinners -= rounds * winA;\n\t\tneedProblems += Math.min(sizeA, needWinners * sizeB);\n\t} else {\n\t\tneedProblems = needWinners * sizeB;\n\t}\n\tprint(needProblems);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2b32324307f613a0f5516330d4301bbe", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function calc(n, k, tabs) {\n var max = -1;\n var temp, tempE, tempF, abs;\n \n for (var i = 0; i < k; i++) {\n temp = tabs.filter((elem, index) => index % k !== i);\n// console.log(temp);\n tempE = temp.filter(elem => elem === 1).length;\n// console.log(tempE);\n tempF = temp.filter(elem => elem === -1).length;\n// console.log(tempF);\n abs = Math.abs(tempE - tempF);\n if (abs > max) {\n max = abs;\n }\n }\n \n return max;\n}\n\nvar nk = readline().split(\" \");\nvar n = parseInt(nk[0]);\nvar k = parseInt(nk[1]);\nvar tabs = readline().split(\" \").map(elem => parseInt(elem));\n\nprint(calc(n, k, tabs));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cde8980ca70820afcaf58392497ce04c", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var queries = parseInt(readline());\n// var queries = 1;\n\nfunction initialReps(shows, d) {\n var reps = {};\n \n for (var i = 0; i < d; i++) {\n reps[shows[i] + ''] = reps[shows[i] + ''] + 1 || 1 \n }\n\n return reps;\n}\n\nfunction main(stats, shows) {\n var d = stats[2];\n var reps = initialReps(shows, d);\n var pointerLow = 0;\n var pointerHigh = d-1;\n var minSubs = Object.keys(reps).length;\n\n while (pointerHigh < shows.length - 1) {\n pointerHigh++;\n reps[shows[pointerHigh] + ''] = reps[shows[pointerHigh] + ''] + 1 || 1 \n if (reps[shows[pointerLow] + ''] > 1) {\n reps[shows[pointerLow] + ''] = reps[shows[pointerLow] + ''] - 1 \n } else {\n delete reps[shows[pointerLow] + '']\n }\n minSubs = Math.min(minSubs, Object.keys(reps).length)\n pointerLow++;\n }\n\n return write(minSubs + '\\n');\n}\n\nfor (var i = 0; i < queries; i++) {\n var stats = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n var shows = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n\n // var stats = [1,1,8]\n // var shows = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3]\n\n main(stats, shows);\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8c228eca133894f559612cf0b558e35e", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var queries = parseInt(readline());\n// var queries = 1;\n\nfunction initialReps(shows, d) {\n var reps = {};\n \n for (var i = 0; i < d; i++) {\n reps[shows[i] + ''] = reps[shows[i] + ''] + 1 || 1 \n }\n\n return reps;\n}\n\nfunction main(stats, shows) {\n var d = stats[2];\n var reps = initialReps(shows, d);\n var pointerLow = 0;\n var pointerHigh = d-1;\n var minSubs = Object.keys(reps).length;\n\n while (pointerHigh < shows.length - 1) {\n pointerHigh++;\n reps[shows[pointerHigh] + ''] = reps[shows[pointerHigh] + ''] + 1 || 1 \n reps[shows[pointerLow] + ''] = reps[shows[pointerLow] + ''] - 1 || undefined \n minSubs = Math.min(minSubs, Object.keys(reps).length)\n pointerLow++;\n }\n\n return console.log(minSubs);\n}\n\nfor (var i = 0; i < queries; i++) {\n var stats = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n var shows = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n\n // var stats = [1,1,4]\n // var shows = [10, 8, 6, 4]\n\n main(stats, shows);\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0693f7241da4b6a595e8aa6cb212e39b", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var queries = parseInt(readline());\n// var queries = 1;\n\nfunction initialReps(shows, d) {\n var reps = {};\n \n for (var i = 0; i < d; i++) {\n reps[shows[i] + ''] = reps[shows[i] + ''] + 1 || 1 \n }\n\n return reps;\n}\n\nfunction main(stats, shows) {\n var d = stats[2];\n var reps = initialReps(shows, d);\n var pointerLow = 0;\n var pointerHigh = d-1;\n var minSubs = Object.keys(reps).length;\n\n while (pointerHigh < shows.length - 1) {\n pointerHigh++;\n reps[shows[pointerHigh] + ''] = reps[shows[pointerHigh] + ''] + 1 || 1 \n reps[shows[pointerLow] + ''] = reps[shows[pointerLow] + ''] - 1 || undefined \n minSubs = Math.min(minSubs, Object.keys(reps).length)\n pointerLow++;\n }\n\n return write(minSubs);\n}\n\nfor (var i = 0; i < queries; i++) {\n var stats = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n var shows = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n\n // var stats = [1,1,4]\n // var shows = [10, 8, 6, 4]\n\n main(stats, shows);\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "22990db0114313a9b3fbe632afc47aab", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var queries = parseInt(readline());\n// var queries = 1;\n\nfunction initialReps(shows, d) {\n var reps = {};\n \n for (var i = 0; i < d; i++) {\n reps[shows[i] + ''] = reps[shows[i] + ''] + 1 || 1 \n }\n\n return reps;\n}\n\nfunction main(stats, shows) {\n var d = stats[2];\n var reps = initialReps(shows, d);\n var pointerLow = 0;\n var pointerHigh = d-1;\n var minSubs = Object.keys(reps).length;\n\n while (pointerHigh < shows.length - 1) {\n pointerHigh++;\n reps[shows[pointerHigh] + ''] = reps[shows[pointerHigh] + ''] + 1 || 1 \n reps[shows[pointerLow] + ''] = reps[shows[pointerLow] + ''] - 1 || undefined \n minSubs = Math.min(minSubs, Object.keys(reps).length)\n pointerLow++;\n }\n\n return write(minSubs + '\\n');\n}\n\nfor (var i = 0; i < queries; i++) {\n var stats = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n var shows = readline().split(' ').map(function(num) {\n return parseInt(num);\n });\n\n // var stats = [1,1,4]\n // var shows = [10, 8, 6, 4]\n\n main(stats, shows);\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e203c8ee0b65efebd975522426a479b", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var tokens = [];\nvar numTokens = 0;\nfunction next(){\n\twhile(numTokens>=tokens.length){\n\t\ttokens = readline().split(/[\\s]+/);\n\t\tnumTokens = 0;\n\t}\n\treturn tokens[numTokens++];\n}\nfunction invertir(n){\n\tvar s = 0,c;\n\twhile(n>0){\n\t\tc = Math.floor(n/10);\n\t\ts = s*10 + n - c*10;\n\t\tn = c;\n\t}\n\treturn s;\n}\nfunction cumple(h,m){\n\treturn invertir(h) == m || h == invertir(m);\n}\nfunction solve(h){\n\twhile(h < 24*60 ){\n\t\tc = Math.floor(h/60);\n\t\tif(cumple(c,h-c*60))\n\t\t\treturn h;\n\t\th++;\n\t}\n\treturn 0;\n}\nfunction impri(n){\n\tif(n<10) return \"0\"+n;\n\treturn \"\"+n;\n}\nfunction main(){\n\tvar a = next();\n\tvar h = parseInt(a.substring(0,2),10)*60\t+ parseInt(a.substring(3,5),10);\n\th = solve(h+1);\n\tvar c = Math.floor(h/60);\n\tvar x = c;\n\tvar y = h - c*60;\n\tprint(impri(x)+\":\"+impri(y));\n}\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "77c15aa43eb1ab326b45ffc6421170a7", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function main() {\n var n = readline().split(':');\n var h = parseInt(n[0]);\n var m = parseInt(n[1]);\n var dh = ~~(h / 10);\n var oh = h % 10;\n var reh = 10 * oh + dh;\n if (m >= reh) {\n ++h; \n if (h > 23) h = 0;\n dh = ~~(h / 10);\n oh = h % 10;\n }\n if (oh >= 6) {\n oh = 0;\n ++dh;\n }\n print('' + dh + oh + ':' + oh + dh); \n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ad4b78c29c13a7c692f47d7b67e2f96d", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction printValues() {\n\tvar parts = [];\n\tfor (var i = 0; i < arguments.length; i += 2) {\n\t\tparts.push(arguments[i]+' = '+arguments[i+1]);\n\t}\n\tprint(parts.join(', '));\n}\n\nfunction main() {\n\tvar time = trim(readline());\n function getNext(time) {\n var parts = time.split(':'),\n h = parseInt(parts[0], 10), m = parseInt(parts[1], 10);\n m += 1;\n if (m == 60) {\n m = 0;\n h += 1;\n if (h == 24) {\n h = 0;\n }\n }\n var hs = '00'+h, ms = '00'+m;\n hs = hs.substring(hs.length - 2);\n ms = ms.substring(ms.length - 2);\n return hs + ':' + ms;\n }\n function isPalindrome(time) {\n return time.charAt(0) == time.charAt(4) &&\n time.charAt(1) == time.charAt(3);\n }\n while (true) {\n time = getNext(time);\n if (isPalindrome(time)) {\n print(time);\n return;\n }\n }\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "55c930110851b54c439d4c189ea4ede7", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst r = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n\nr.on('line',(line)=>{\n console.log(compute(line));\n });\n\nfunction* range(start, end) {\n while (start <= end) yield start++;\n}\n\nfunction getTimeIndex(str) {\n let [h,m] = str.split(\":\").map(n => +n);\n return h * 60 + m;\n}\nfunction isPalindrome(str)\n{\n return str === (str.split(\"\").reverse().join(\"\"))\n}\nlet hours = [...range(0, 23)].map(n => n < 10 ? \"0\" + n : \"\" + n);\nlet minutes = [...range(0, 59)].map(n => n < 10 ? \"0\" + n : \"\" + n);\n\nlet time = hours.reduce((ac, h) => {\n minutes.forEach(m => ac.push(h + \":\" + m));\n return ac;\n}, []);\nlet times = [...time, ...time];\n\nfunction compute(str) {\n let startIndex = getTimeIndex(str)+1;\n while( startIndex < times.length)\n {\n if(isPalindrome(times[startIndex]))\n return times[startIndex];\n \n startIndex++;\n }\n\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "93e242238287d73b75c561c1e98dc393", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var tokens = [];\nvar numTokens = 0;\nfunction next(){\n\twhile(numTokens>=tokens.length){\n\t\ttokens = readline().split(/[\\s]+/);\n\t\tnumTokens = 0;\n\t}\n\treturn tokens[numTokens++];\n}\nfunction invertir(n){\n\treturn n.split(\"\").reverse().join(\"\"); \n}\nfunction impri(n){\n\tif(n<10) return \"0\"+n;\n\treturn \"\"+n;\n}\n\nfunction cumple(h,m){\n\tif(h<24 && m < 60)\n\t\treturn invertir(impri(h)) == impri(m);\n\treturn false;\n}\nfunction solve(h){\n\twhile(h < 24*60 ){\n\t\tc = Math.floor(h/60);\n\t\tif(cumple(c,h-c*60))\n\t\t\treturn h;\n\t\th++;\n\t}\n\treturn 0;\n}\nfunction main(){\n\tvar a = next();\n\tvar h = parseInt(a.substring(0,2),10)*60\t+ parseInt(a.substring(3,5),10);\n\th = solve(h+1);\n\tvar c = Math.floor(h/60);\n\tvar x = c;\n\tvar y = h - c*60;\n\tprint(impri(x)+\":\"+impri(y));\n}\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8a91dbefa9da5949b486e79da8c0b6a9", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar l=readline().split(' ');\nvar n=+l[0];\nvar c=+l[1];\nvar x=readline().split(' ').map(function(v){return +v});\nvar ans = 0;\nfor(var i=1; imax) max = days[i]-days[i+1]-c; \n}\nprint(max);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2cd6c47d4c90c981de36bd21ac4e246d", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function() {\n var nc = readline().split(' ');\n var mx = 0, pr;\n \n readline().split(' ').forEach(function (x){\n if ( pr !== undefined ) {\n mx = Math.max(mx,pr-x-nc[1]);\n }\n pr = x;\n });\n \n print(mx);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d3dc43ab264d71d936e6003992054303", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var input = readline().split(\" \").map(Number), n = input[0], c = input[1], x = readline().split(\" \").map(Number);\nvar max = -Infinity;\n\nfor(i = 0; i < n-1; i++){\n\tmax = Math.max(max, (x[i]-x[i+1]));\n}\n\nmax -= c;\n\nmax = Math.max(max, 0);\n\nwrite(max);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4a96af5336f3852116ce54341020de74", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar integers = tokenizeIntegers(readline());\n\tvar numDays = integers[0], borrowCost = integers[1];\n\tvar honeyCosts = tokenizeIntegers(readline());\n\n\tvar bestProfit = 0;\n\tfor (var i = 0; i < numDays-1; i += 1) {\n\t\tif (honeyCosts[i] < honeyCosts[i+1]) {\n\t\t\tcontinue;\n\t\t}\n\t\tvar profit = honeyCosts[i]-honeyCosts[i+1]-borrowCost;\n\t\tif (profit > bestProfit) {\n\t\t\tbestProfit = profit;\n\t\t}\n\t}\n\n\tprint(bestProfit);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dc7020f5673d7529422f1022c23df2a4", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "\nvar l=readline().split(' ');\nvar n=+l[0];\nvar c=+l[1];\nvar x=readline().split(' ').map(function(v){return +v});\nvar ans = 0;\nfor(var i=1; i {\n const [l, n] = d;\n let ans = 8;\n\n if (l === 'a' || l === 'h' || n === '8' || n === '1') {\n ans = 5;\n }\n\n if (d === 'a1' || d === 'a8' || d === 'h1' || d === 'h8') {\n ans = 3;\n }\n\n console.log(ans);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0761cd3c28059b989b2beb7e2ca7349a", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('ascii');\n\nvar input = '';\n\nprocess.stdin.on('data', function (data) {\n\tinput += data;\n});\n\nprocess.stdin.on('end', function () {\n\t//input = input.split(\"\\n\");\n\tprocessData();\n});\n\nfunction processData() {\n\tvar ans = 8;\n\tif (input[0] == 'a' || input[0] == 'h') {\n\t\tans--;\n\t}\n\tif (input[1] == '1' || input[0] == '8') {\n\t\tans--;\n\t}\n\tprocess.stdout.write(ans);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9f751bfe000ac1f68837ff3b234a770f", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n const [n, k] = d.split(' ').map(BigInt);\n const ans = n / k;\n\n if (ans % 2n === 0n) {\n console.log('NO');\n }\n else {\n console.log('YES');\n }\n\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3eadd920ddb52212b7f09612ad469af5", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var r = readline().split(' ').map((xs)=>Array.from(xs).map(Number));\nvar multonlist1 = function (xs,y){\n var t=0;\n var res=[];\n for (var i=xs.length-1;i>=0;i--){\n res.unshift((xs[i]*y+t)%10);\n t=Math.floor((xs[i]*y+t)/10);}\n if (t!==0) {res.unshift(t);}\n return res;\n};\nvar multonlist2 = (xs,ys)=>ys.reverse().map((y,i)=>{var a =multonlist1(xs,y); while (i>0) {a.push(0);i--;} return a;});\nvar divonlist1 = (xs,ys)=>{for (var i=0;i<=9;i++){t =multonlist1(ys,i); if (t==xs) {i++;break;} else if (t>xs && t.length==xs.length||t.length>xs.length) {break} } return i-1;};\nvar divonlist2 = (xs,ys)=>{\n var xs1 = xs.slice(0,ys.length);\n var xs2 = xs.slice(ys.length);\n var t=divonlist1(xs1,ys);\n var rs=[];\n if (t!==0) {rs=[t];}\n var fun = function (as) {while (as[0]===0) {as.shift();} return as};\n var zs=fun(subonlist1(xs1,multonlist1(ys,t)));\n var t3=xs2.length;\n while (t3!==0) {\n zs.push(xs2[0]);\n xs2.shift();\n t=divonlist1(zs,ys);\n rs.push(t);\n zs=fun(subonlist1(zs,multonlist1(ys,t)));\n t3--;}\n return rs;\n};\nvar subonlist1 = function (xs,ys){\n var t=0;\n var res=[];\n while (ys.length=0;i--){\n var t2 = xs[i]-ys[i]-t;\n if (t2>=0) {t=0; res.unshift(t2);}\n else {t=1;res.unshift(t2+10);}\n }\n while (res[0]===0) {res.shift();}\n return res;};\nprint( (()=>{var a = divonlist2 (r[0],r[1]); if (a[a.length-1]%2!==0) {return \"YES\"} else {return \"NO\"}})());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d90eca32c7f1c915d17b0f34a5ae9022", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ').map(Number);\nvar end = (function () {if (line[0]/(2*line[1])<1) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n})();\nprint (end);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6adafd5cc04dfc413ecbae1ce253fa2a", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ').map(Number);\n\nvar t= ((x,y)=>Math.max(x.toString().length-y.toString().length-1,0)).apply(null,line);\nvar end = (function () {if (parseInt(line[0]/((Math.pow(10,t))*line[1]))%2==1) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n})();\nprint (end);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b90d67b6abb2aba3c76d6d3903fb19ba", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ').map(Number);\n\nvar end = (function () {if (parseInt(line[0]/(line[1]))%2==1) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n})();\nprint (end);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "87317804c5c93e3564f5e9b058eaf48d", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ').map(Number);\n\nvar t= ((x,y)=>Math.max(x.toString().length-y.toString().length-2,0)).apply(null,line);\nvar end = (function () {if (parseInt(line[0]/((Math.pow(10,t))*line[1]))%2==1) {\n return \"YES\";\n} else {\n return \"NO\";\n}\n})();\nprint (end);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f5a56bc7a43dd653b77dd30ed9edd8c2", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll\nlll = readline().split(' ').map(v => parseInt(v))\nlet n = lll[0]\nlet x1 = lll[1]\nlet y1 = lll[2]\nlet x2 = lll[3]\nlet y2 = lll[4]\n\nlet s = 0\n\nlet by\nif (x1 == 0) {\n by = y1\n} else if (y1 == 0) {\n by = n - x1\n} else if (x1 == n) {\n by = n - y1\n} else {\n by = x1\n}\n\nlet ag\nif (x2 == 0) {\n ag = n - y2\n} else if (y2 == 0) {\n ag = x2\n} else if (x2 == n) {\n ag = y2\n} else {\n ag = n - x1\n}\n\nif (x1 == 0 && x2 == n || y1 == 0 && y2 == n) {\n s = by + ag + n\n s = Math.min(s, 4 * n - s)\n} else {\n s = by + ag\n s = Math.min(s, 2 * n - s)\n}\n\nprint(s)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a2a92ea5ee879b0ce0ec0401e6d599ea", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll\nlll = readline().split(' ').map(v => parseInt(v))\nlet n = lll[0]\nlet x1 = lll[1]\nlet y1 = lll[2]\nlet x2 = lll[3]\nlet y2 = lll[4]\n\nlet s = x1 + x2 + y1 + y2\nprint(Math.min(s, 4 * n - s))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "93facb72334ffbb0473b5476598453af", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var getNums = function() {\n\treturn readline().split(' ').map(function(a) {return parseInt(a)});\n};\n\nvar d = getNums();\n\nvar n = d[0];\nvar x1 = d[1];\nvar y1 = d[2];\nvar x2 = d[3];\nvar y2 = d[4];\n\nfunction getZ(x, y, n) {\n\tif (y === 0) {\n\t\tz = x;\n\t} else if(x === n) {\n\t\tz = n + y;\n\t} else if (y == n) {\n\t\tz = 2 * n + (n - x);\n\t} else {\n\t\tz = 3 * n + (n - y);\n\t}\n\treturn z;\n}\n\nvar z1 = getZ(x1, y1, n);\nvar z2 = getZ(x2, y2, n);\n\nvar s1 = Math.abs(z1 - z2);\nvar s2 = Math.min(z1, z2) + 4 * n - Math.max(z1, z2);\n\nprint(Math.min(s1, s2));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bd501c3ba1ad8b3c5b694683df7de0d3", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n var one = nextIntArray();\n var N = one[0];\n var D = one[1];\n var list = next();\n var dp = new Array(N).fill(-1);\n dp[0] = 0;\n for(var i = 0; i < N; i++){\n if(list[i] == \"1\"){\n for(var j = 1; j <= D; j++){\n if(list[i + j] == \"1\"){\n if(dp[i + j] == -1){\n dp[i + j] = dp[i] + 1;\n }else{\n dp[i + j] = Math.min(dp[i] + 1, dp[i + j]);\n }\n }\n }\n }\n }\n myout(dp[N - 1]);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fef86b33c59c5693bb91c58d3ff4ed41", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n var one = nextIntArray();\n var N = one[0];\n var D = one[1];\n var list = next();\n var dp = new Array(N).fill(-1);\n dp[0] = 0;\n for(var i = 0; i < N; i++){\n if(list[i] == \"1\" && dp[i] != -1){\n for(var j = 1; j <= D; j++){\n if(list[i + j] == \"1\"){\n if(dp[i + j] == -1){\n dp[i + j] = dp[i] + 1;\n }else{\n dp[i + j] = Math.min(dp[i] + 1, dp[i + j]);\n }\n }\n }\n }\n }\n myout(dp[N - 1]);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5db85015ff4eed45557fe688fc86c770", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "s=readline().split(' ')\nn=+s[0]\nk=+s[1]\nres=0\nif (k>=1)\n{\n ++res\n}\nif (k>=2)\n{\n res+=(n*(n-1))/2\n}\nif (k>=3)\n{\n res+=(n*(n-1)*(n-2)/3)\n}\nif (k>=4)\n{\n res+=(n*(n-1)*(n-2)*(n-3)*3/8)\n}\nprint(res)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1c140da9876e1a9909f7bbf2997dd9a4", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "'use strict';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString='';\nlet currentLine=0;\nprocess.stdin.on('data',inputStdin=>{\n inputString+=inputStdin;\n});\nprocess.stdin.on('end',_=>{\n inputString=inputString.trim().split(\"\\n\").map(string=>{\n return string.trim();\n });\n main();\n});\nfunction readLine()\n{\n return inputString[currentLine++]; \n}\nfunction ans(s)\n{\n let zer=[-1,-1],tw=-1,se=-1,fi=-1;\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='7')\n {\n se=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='2')\n {\n tw=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='5')\n {\n fi=i;\n break;\n }\n }\n let k=0;\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='0')\n {\n zer[k++]=i;\n if(k==2)\n break;\n }\n }\n zer.length=k;\n if(fi==-1)\n {\n if(zer.length<2)\n return -1;\n return (2*s.length-3-zer[0]-zer[1]);\n }\n else\n {\n let ac=[];\n if(zer.length>=2)\n {\n ac.push(2*s.length-3-zer[0]-zer[1]);\n }\n if((zer.length>=1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-zer[0]-fi+(fi>zer[0]?1:0));\n }\n if((tw!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-tw-fi+(tw>fi?1:0));\n }\n if((se!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-se-fi+(se>fi?1:0));\n }\n if(ac.length!=0)\n return Math.min.apply(Math,ac);\n else\n return -1;\n }\n}\nfunction main()\n{\n let n=readLine().trim();\n console.log(ans(n));\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c1622011170fa85f4c0efe245415e72d", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "'use strict';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString='';\nlet currentLine=0;\nprocess.stdin.on('data',inputStdin=>{\n inputString+=inputStdin;\n});\nprocess.stdin.on('end',_=>{\n inputString=inputString.trim().split(\"\\n\").map(string=>{\n return string.trim();\n });\n main();\n});\nfunction readLine()\n{\n return inputString[currentLine++]; \n}\nfunction ans(s)\n{\n let zer=[-1,-1],tw=-1,se=-1,fi=-1,fnz=-1;\n for(let i=1;i=0;--i)\n {\n if(s[i]=='7')\n {\n se=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='2')\n {\n tw=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='5')\n {\n fi=i;\n break;\n }\n }\n let k=0;\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='0')\n {\n zer[k++]=i;\n if(k==2)\n break;\n }\n }\n zer.length=k;\n if(fi==-1)\n {\n if(zer.length<2)\n return -1;\n return (2*s.length-3-zer[0]-zer[1]);\n }\n else\n {\n let ac=[];\n if(zer.length>=2)\n {\n ac.push(2*s.length-3-zer[0]-zer[1]);\n }\n if((zer.length>=1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-zer[0]-fi+(fi>zer[0]?1:0)+(fi===0?fnz:0));\n }\n if((tw!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-tw-fi+(tw>fi?1:0)+(Math.min(fi,tw)===0?fnz:0));\n }\n if((se!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-se-fi+(se>fi?1:0)+(Math.min(fi,se)===0?fnz:0));\n }\n if(ac.length!==0)\n return Math.min.apply(Math,ac);\n else\n return -1;\n }\n}\nfunction main()\n{\n let n=readLine().trim();\n console.log(ans(n));\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2cd47eff0fdb5f0bd1f6983bfbe543f1", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "Node.js", "source_code": "'use strict';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString='';\nlet currentLine=0;\nprocess.stdin.on('data',inputStdin=>{\n inputString+=inputStdin;\n});\nprocess.stdin.on('end',_=>{\n inputString=inputString.trim().split(\"\\n\").map(string=>{\n return string.trim();\n });\n main();\n});\nfunction readLine()\n{\n return inputString[currentLine++]; \n}\nfunction ans(s)\n{\n let zer=[-1,-1],tw=-1,se=-1,fi=-1,fnz=-1;\n for(let i=1;i=0;--i)\n {\n if(s[i]=='7')\n {\n se=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='2')\n {\n tw=i;\n break;\n }\n }\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='5')\n {\n fi=i;\n break;\n }\n }\n let k=0;\n for(let i=s.length-1;i>=0;--i)\n {\n if(s[i]=='0')\n {\n zer[k++]=i;\n if(k==2)\n break;\n }\n }\n zer.length=k;\n if(fi==-1)\n {\n if(zer.length<2)\n return -1;\n return (2*s.length-3-zer[0]-zer[1]);\n }\n else\n {\n let ac=[];\n if(zer.length>=2)\n {\n ac.push(2*s.length-3-zer[0]-zer[1]);\n }\n if((zer.length>=1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-zer[0]-fi+(fi>zer[0]?1:0)+(fi===0?(zer[0]==1?0:fnz):0));\n }\n if((tw!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-tw-fi+(tw>fi?1:0)+(Math.min(fi,tw)===0?fnz:0));\n }\n if((se!=-1)&&(fi!=-1))\n {\n ac.push(2*s.length-3-se-fi+(se>fi?1:0)+(Math.min(fi,se)===0?fnz:0));\n }\n if(ac.length!==0)\n return Math.min.apply(Math,ac);\n else\n return -1;\n }\n}\nfunction main()\n{\n let n=readLine().trim();\n console.log(ans(n));\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4f89fb14615f050d206dbabe6535488d", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "JavaScript", "source_code": "'use strict';\n\n// let inpFileStrArr = `\n// 2 1\n// 2 1\n// 10\n// `.trim().split('\\n'), inpFileCounter = 0;\n// function readline() {\n// return inpFileStrArr[inpFileCounter++];\n// }\n// function print(x) {\n// console.log(x);\n// }\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _readline$split$map = readline().split(' ').map(Number);\n\nvar _readline$split$map2 = _slicedToArray(_readline$split$map, 2);\n\nvar n = _readline$split$map2[0];\nvar d = _readline$split$map2[1];\n\nvar arr = readline().split(' ').map(Number);arr.sort();\nvar m = Number(readline());\n\nprint(arr.slice(0, 2).reduce(function (a, b) {\n return a + b;\n}, 0) - (m > n ? (m - n) * d : 0));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eb47a2f3d75604614341305ba344a639", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict';\n\n// let inpFileStrArr = `\n// 3 96\n// 83 22 17\n// 19\n// `.trim().split('\\n'), inpFileCounter = 0;\n// function readline() {\n// return inpFileStrArr[inpFileCounter++];\n// }\n// function print(x) {\n// console.log(x);\n// }\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _readline$split$map = readline().split(' ').map(Number);\n\nvar _readline$split$map2 = _slicedToArray(_readline$split$map, 2);\n\nvar n = _readline$split$map2[0];\nvar d = _readline$split$map2[1];\n\nvar arr = readline().split(' ').map(Number);arr.sort();\nvar m = Number(readline());\n\nprint(arr.slice(0, m).reduce(function (a, b) {\n return a + b;\n}, 0) - (m > n ? (m - n) * d : 0));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bb25e5caa2f68de3a899c7fbc1f72146", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "print(function(n, d) {\n\n\tvar a = readline().split(' ').map(Number).sort(function(a, b) { return a - b; }),\n\t\tm = +readline(),\n\t\tans = 0;\n\n\tfor (var i = 0; i < m; i++)\n\t\tans += i < n ? a[i] : -d;\n\n\treturn ans;\n\n}.apply(0, readline().split(' ').map(Number)));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2a656e176fcfab730ec50eba5b7f9cc8", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "'use strict';\n\n// let inpFileStrArr = `\n// 90 24\n// 41 65 43 20 14 92 5 19 33 51 6 76 40 4 23 99 48 85 49 72 65 14 76 46 13 47 79 70 63 20 86 90 45 66 41 46 9 19 71 2 24 33 73 53 88 71 64 2 4 24 28 1 70 16 66 29 44 48 89 44 38 10 64 50 82 89 43 9 61 22 59 55 89 47 91 50 44 31 21 49 68 37 84 36 27 86 39 54 30 25\n// 49\n// `.trim().split('\\n'), inpFileCounter = 0;\n// function readline() {\n// return inpFileStrArr[inpFileCounter++];\n// }\n// function print(x) {\n// console.log(x);\n// }\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _readline$split$map = readline().split(' ').map(Number);\n\nvar _readline$split$map2 = _slicedToArray(_readline$split$map, 2);\n\nvar n = _readline$split$map2[0];\nvar d = _readline$split$map2[1];\n\nvar arr = readline().split(' ').map(Number);arr.sort(function (a, b) {\n return a - b;\n});\nvar m = Number(readline());\n\nprint(arr.slice(0, m).reduce(function (a, b) {\n return a + b;\n}, 0) - (m > n ? (m - n) * d : 0));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b1aef000cdbce7a390db3bb560394c4e", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function (){\n var line = readline().split(' ');\n var n = parseInt(line[0]);\n var d = parseInt(line[1]);\n var a = readline().split(' ');\n var m = parseInt(readline());\n a.sort(function(a,b){\n return parseInt(a)-parseInt(b);\n });\n var profit = 0, i;\n for( i = 0 ; i < m && i < n ; ++i){\n profit += parseInt(a[i]);\n }\n if ( i < m ){\n profit -= (m-i) * d;\n }\n print(profit);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3f668d869a181739bbfaa7a56e1b0999", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var inp = readline().split(' ');\nvar n = Number(inp[0]);\nvar d = Number(inp[1]);\nvar A = readline().split(' ').map((x)=>Number(x));\nvar m = Number(readline().split());\nA.sort((x,y) => x-y);\n\nvar ats = 0;\nif(m > n)\n{\nats = -(m-n)*d;\nm=n;\n}\n\nfor(var i=0; i n ? (m - n) * d : 0));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3e8429c3260001eb09dadc12caf1822c", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var xy = readline();\nxy = xy.split(\" \");\nvar x = parseInt(xy[0]);\nvar y = parseInt(xy[1]);\nif((y == 0 && x == 0) || (y == 0 && x == 1))\n{\n print(\"0\");\n}\nelse if((Math.abs(x) < Math.abs(y) && y > 0) || -x == y)\n{\n print(Math.abs(y*4) - 2);\n}\nelse if((Math.abs(x) > Math.abs(y) && x < 0) || (x == y && x < 0))\n{\n print(Math.abs(x*4) - 1);\n}\nelse if((Math.abs(x) <= Math.abs(y) && y < 0) || x == -y + 1)\n{\n print(Math.abs(y*4));\n}\nelse if((Math.abs(x) > Math.abs(y)-2 && x > 0) || (x == y && x > 0))\n{\n print(Math.abs(y*4) + 1);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "931035a68e2acdcb93bfb76c33f10644", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var xy = readline();\nxy = xy.split(\" \");\nvar x = parseInt(xy[0]);\nvar y = parseInt(xy[1]);\nif((y == 0 && x == 0) || (y == 0 && x == 1))\n{\n print(\"0\");\n}\nelse if((Math.abs(x) < Math.abs(y) && y > 0) || (-x == y && y > 0))\n{\n print(Math.abs(y*4) - 2);\n}\nelse if((Math.abs(x) > Math.abs(y) && x < 0) || (x == y && x < 0))\n{\n print(Math.abs(x*4) - 1);\n}\nelse if((Math.abs(x) < Math.abs(y) && y < 0) || (-x == y && y < 0) || x == -y + 1)\n{\n print(Math.abs(y*4));\n}\nelse if((Math.abs(x) > Math.abs(y) && x > 0) || (x == y && x > 0))\n{\n print(Math.abs((x-1)*4) + 1);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9d96a0948944bade00b3a91f6e494e9d", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input= '', cin, cout;\n\nprocess.stdin.on('data', function(chunk) {\n input+=chunk;\n});\n\nprocess.stdin.on('end', function() {\n input = input.split('\\n');\n cout = function(data) {process.stdout.write(data+'\\n')};\n var inputLineIndex = 0;\n cin = function(){return inputLineIndex>=input.length?undefined:input[inputLineIndex++]};\n process.exit(main() || 0);\n});\n\nfunction main() {\n [n, m, k] = cin().split(' ');\n let res = 0;\n for (let i = 0; i < k; i++) {\n res += 2*(+n + +m - 8*(+i)) - 4;\n }\n cout(res);\n return 0;\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "90b160a58d5513d7379d1adb4a5ced99", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline').createInterface({\n input: process.stdin\n});\n\nreadline.on('line', line => {\n const [w, h, k] = line.split(' ').map(x => parseInt(x));\n let result = 0;\n for (let i = 1; i <= k; i++)\n result += 2*(w - 4*(i - 1) + h - 4*(i - 1) - 2);\n console.log(result);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3dcc1c28b3b9b4edfe5ae08a67d22d9a", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nvar x = line[0];\nvar y = line[1];\nvar k = line[2];\nvar count = 0;\nfor(i=0; i+v);\nvar start = fl[0] * 2 + fl[1] * 2 - 4;\nvar sum = start;\n\nfor(var i = 1, minus = 16; i < fl[2]; i++, minus+=16) sum += start - minus;\nprint(sum);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e63b2704560b74e7deb1a7b61a757720", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ');\n\nvar w = Number(input[0]);\nvar h = Number(input[1]);\nvar k = Number(input[2]);\nvar count = 0;\n\nprint(w,h,k);\n\nwhile(k > 0) {\n count += (w*h)-((w-2)*(h-2));\n k--;\n w = w-2;\n h = h-2;\n}\n\nprint(count);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5b65fde58e538cd97d3d1c6d333c9def", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var input = readline().split(' ');\n\nvar w = Number(input[0]);\nvar h = Number(input[1]);\nvar k = Number(input[2]);\nvar count = 0;\n\nwhile(k > 0) {\n count += (w*h)-((w-2)*(h-2));\n k--;\n w = w-2;\n h = h-2;\n}\n\nprint(count);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "018b6f25ffb9c90d1e7e5a60f8330dfb", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "print(readline()*3/2);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "315636c69c363369388c5f2a4429c91b", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n const n = +ipt.split(EOL)[0]\n \n console.log(n / 2 * 3)\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "debfab6c88b02648ce187e7031aa25cd", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "JavaScript", "source_code": ";(function () {\n\n\tprint( +readline() * 1.5 );\n\n}).call(this)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fda3d59d7a5c2d041c0ff1106221c35e", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "Node.js", "source_code": "function main() {\n const n = +stdin[0];\n console.log(n * 3 / 2);\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\n\nvar stdin = [];\n\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ac6aa80fa381e45be3c3b65967bbe44b", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "Node.js", "source_code": "function main() {\n const n = +stdin[0];\n var a = [];\n for (var z = 0; z < 20; z++) {\n a[z] = []\n for (var i = 0; i < 500000; i++) {\n a[z][i] = i * z;\n }\n }\n var s = 0;\n for (var z = 0; z < 20; z++) {\n for (var i = 0; i < 500000; i++) {\n s += a[z][i];\n }\n }\n console.log(n * 3 / 2);\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\n\nvar stdin = [];\n\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3d1e9c6eca4edfcb223ee8639154b111", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n if (+d === 2) {\n console.log(3);\n }\n else {\n console.log(6);\n }\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5412d87a84e4a97d28818435d27e82a6", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var bessi = readline()\n.split('')\n.concat(readline().split('').reverse())\n.filter(function (v) {\n return v !== 'X'\n})\n\nvar elsi = readline()\n.split('')\n.concat(readline().split('').reverse())\n.filter(function (v) {\n return v !== 'X'\n})\n\nvar friends = true\n\n\nvar b = bessi.indexOf('A')\nvar e = elsi.indexOf('A')\n\nfor (var i = 0 ; i < 3; i++) {\n if (bessi[b] !== elsi[e]) {\n friends = false\n break\n }\n\n b = ++b % 3\n e = ++e % 3\n\n}\n\nprint(friends ? \"YES\" : \"NO\")", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f640f83816d36eafb1a9f5846bcf95b1", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var p1 = [];\nvar t = '';\nvar s = '';\n \nfor(var i = 0; i < 2; i++)\n{\n p1[i] = readline().split('');\n}\n\ns += readline().replace('X', '');\ns += readline().split('').reverse().join('').replace('X', '');\n\nt = p1[0][0] + p1[0][1] + p1[1][1] + p1[1][0];\nif (s == t.replace('X', '')) \n{\n print('YES');\n quit(0);\n}\n\nt= p1[0][1] + p1[1][1] + p1[1][0] + p1[0][0];\nif (s == t.replace('X', '')) \n{\n print('YES');\n quit(0);\n}\n\nt = p1[1][1] + p1[1][0] + p1[0][0] + p1[0][1];\nif (s == t.replace('X', '')) \n{\n print('YES');\n quit(0);\n}\n\nt = p1[1][0] + p1[0][0] + p1[0][1] + p1[1][1];\nif (s == t.replace('X', '')) \n{\n print('YES');\n quit(0);\n}\n\nprint( 'NO' );\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6978f63c11fd1f787313793ee70d38b4", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var pazzle1 = []\n , pazzle2 = []\n , test = ''\n , sample = '';\n \nfor(var i = 0; i < 2; i++){\n pazzle1[i] = readline().split('');\n}\n\nsample += readline().replace('X', '');\nsample += readline().split('').reverse().join('').replace('X', '');\n\n//clockwise\ntest = pazzle1[0][0] + pazzle1[0][1] + pazzle1[1][1] + pazzle1[1][0];\nif (sample == test.replace('X', '')) {\n print('YES');\n quit();\n}\ntest = pazzle1[0][1] + pazzle1[1][1] + pazzle1[1][0] + pazzle1[0][0];\nif (sample == test.replace('X', '')) {\n print('YES');\n quit();\n}\ntest = pazzle1[1][1] + pazzle1[1][0] + pazzle1[0][0] + pazzle1[0][1];\nif (sample == test.replace('X', '')) {\n print('YES');\n quit();\n}\ntest = pazzle1[1][0] + pazzle1[0][0] + pazzle1[0][1] + pazzle1[1][1];\nif (sample == test.replace('X', '')) {\n print('YES');\n quit();\n}\n\nprint( 'NO' );", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "20951d05a45ecb5de78e1001f8ce7552", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n//const lineReader = require('fs');\n//const scanner = lineReader.createReadStream('main.in');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n}); \n\nrl.on('line', (input) => {\n let n = parseInt(input);\n for (let i = 1; i * i <= n; i++){\n let eq = ((n - 1) - i - (i * i)) / (2 * i);\n if (eq === parseInt(eq)){\n console.log(i + \" \" + eq);\n process.exit(0);\n }\n }\n console.log(\"NO\");\n rl.close(); \n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "81d1c8a8963cd09358e6a973609ebcfd", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n//const lineReader = require('fs');\n//const scanner = lineReader.createReadStream('main.in');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n}); \n\nrl.on('line', (input) => {\n let n = parseInt(input);\n for (let i = 1; i * i <= n; i++){\n let eq = ((n - 1) - i - (i * i)) / (2 * i);\n if (eq === parseInt(eq) || eq > 0){\n console.log(i + \" \" + eq);\n process.exit(0);\n }\n }\n console.log(\"NO\");\n rl.close(); \n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "177805830cd2f7ab8823c30b4dab49dd", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n//const lineReader = require('fs');\n//const scanner = lineReader.createReadStream('main.in');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n}); \n\nrl.on('line', (input) => {\n let n = parseInt(input);\n for (let i = 1; i * i <= n; i++){\n let eq = ((n - 1) - i - (i * i)) / (2 * i);\n if (eq === parseInt(eq) || eq < 0){\n console.log(i + \" \" + eq);\n process.exit(0);\n }\n }\n console.log(\"NO\");\n rl.close(); \n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f9e6680dd3437b54621219859580530f", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n//const lineReader = require('fs');\n//const scanner = lineReader.createReadStream('main.in');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n}); \n\nrl.on('line', (input) => {\n let n = parseInt(input);\n for (let i = 1; i * i <= n; i++){\n let eq = ((n - 1) - i - (i * i)) / (2 * i);\n if (eq === parseInt(eq) && eq > 0){\n console.log(i + \" \" + eq);\n process.exit(0);\n }\n }\n console.log(\"NO\");\n rl.close(); \n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "70e195ede262f7f5ff6cd275f4f01887", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const str = lines[l++]\n output[i] = solve(str)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(str) {\n const base = 'A'.charCodeAt(0)\n for (let i = 2; i < str.length; i++) {\n const a = str.charCodeAt(i - 2) - base\n const b = str.charCodeAt(i - 1) - base\n const c = str.charCodeAt(i) - base\n if (((a + b) % 26) !== c) return 'NO'\n }\n return 'YES'\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1b4cbebaf92846133247098f70a39d2f", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "process.stdin.resume()\r\nprocess.stdin.setEncoding('utf-8')\r\n\r\nlet inputString = ''\r\nlet inputArray = null\r\nlet currentLine = 0\r\n\r\nprocess.stdin.on('data', (inputStdin) => {\r\n inputString += inputStdin\r\n})\r\n\r\nprocess.stdin.on('end', (_) => {\r\n inputArray = inputString\r\n .trim()\r\n .split('\\n')\r\n .map((s) => s.trim())\r\n\r\n main()\r\n})\r\n\r\nfunction readline() {\r\n return inputArray[currentLine++]\r\n}\r\n\r\nfunction main() {\r\n const s = readline()\r\n for (let i = 2; i < s.length; i++) {\r\n if (\r\n (s.charCodeAt(i - 2) -\r\n 'A'.charCodeAt() +\r\n s.charCodeAt(i - 1) -\r\n 'A'.charCodeAt()) %\r\n 26 !==\r\n s.charCodeAt(i) - 'A'.charCodeAt()\r\n ) {\r\n console.log('NO')\r\n return\r\n }\r\n }\r\n console.log('YES')\r\n}\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7498f2049be58f3816ab4a0754828583", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "process.stdin.resume()\r\nprocess.stdin.setEncoding('utf-8')\r\n\r\nprocess.stdin.on('data', (/** @type {string} */ s) => {\r\n for (let i = 3; i < s.length; i++) {\r\n if (\r\n s.charCodeAt(i - 2) -\r\n 'A'.charCodeAt() +\r\n s.charCodeAt(i - 1) -\r\n 'A'.charCodeAt() !==\r\n s.charCodeAt(i)\r\n ) {\r\n console.log('NO')\r\n return\r\n }\r\n }\r\n console.log('YES')\r\n})\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b2d4740dd0427fa351c6a9ab2e0591cd", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "process.stdin.resume()\r\nprocess.stdin.setEncoding('utf-8')\r\n\r\nlet inputString = ''\r\nlet inputArray = null\r\nlet currentLine = 0\r\n\r\nprocess.stdin.on('data', (inputStdin) => {\r\n inputString += inputStdin\r\n})\r\n\r\nprocess.stdin.on('end', (_) => {\r\n inputArray = inputString\r\n .trim()\r\n .split('\\n')\r\n .map((s) => s.trim())\r\n\r\n main()\r\n})\r\n\r\nfunction readline() {\r\n return inputArray[currentLine++]\r\n}\r\n\r\nfunction main() {\r\n const s = readline()\r\n for (let i = 2; i < s.length; i++) {\r\n if (\r\n s.charCodeAt(i - 2) -\r\n 'A'.charCodeAt() +\r\n s.charCodeAt(i - 1) -\r\n 'A'.charCodeAt() !==\r\n s.charCodeAt(i) - 'A'.charCodeAt()\r\n ) {\r\n console.log('NO')\r\n return\r\n }\r\n }\r\n console.log('YES')\r\n}\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "da91edabe3a684c94df8ae4027d368aa", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "print('10 10');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "45bd2368d2a7bccc92c883252847efb8", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var a ,h ,x;\nx = readline().split('\\n');\nfor(var i = 1; i <=10 ; i++)\n{\n for(var j = 1; j <= 10 ;j++)\n {\n a = i ;\n h = j;\n a /= 2.0;\n if((Math.abs(a*h/Math.sqrt(a*a+h*h))-x)<0.000001)\n {\n print(i+j);\n }\n }\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "302bfbfb3428942148c0e68224f9dced", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var dp = new Int32Array(18257);\ndp[0] = 1;\nfor (var i = 1; i < 18257; i++)\n\tdp[i] = dp[i - 1] + 12 * i;\n\nprint(dp[readline() - 1]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d49b0376c169041faf3493f201dbb409", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "const r = Number(readline());\nsearch: for (var aHalf = 0.5; aHalf <= 5; aHalf += 0.5)\n for (var h = 1; h <= 10; h++)\n if (Math.abs(aHalf * h / Math.hypot(aHalf, h) - r) <= 0.000001) {\n print(`${aHalf * 2} ${h}`);\n break search;\n }\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bf75c967dc93effb69039400536bfcb1", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var as = parseFloat(readline());\nfunction out(a, b){write(a, b, '\\n');}\nfunction equ(a, b)\n{\n\tif(Math.abs(a - b) < 1e-5) return true;\n\treturn false;\n}\nfunction solve(callback)\n{\n\tvar i, j;\n\tfor(i = 1; i <= 10; ++i)\n\t\tfor(j = 1; j <= 10; ++j)\n\t\t\tif(equ(as, (i * j / 2) / Math.sqrt((i * i) / 4 + j * j)))\n\t\t\t{\n\t\t\t\tcallback(i, j);\n\t\t\t\treturn;\n\t\t\t}\n\treturn;\n}\nsolve(out);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8329f7b0b6fee1725852441d86477ff1", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var a ,h ,x;\nx = readline();\nvar flag = 0;\nfor(var i = 1; i <=10 ; i++)\n{\n for(var j = 1; j <= 10 ;j++)\n {\n a = i ;\n h = j;\n a /= 2.0;\n if(Math.abs(a*h/Math.sqrt(a*a+h*h)-x)<0.000001)\n {\n print(i+' '+j);\n flag = 1;\n break;\n }\n }\n if(flag === 1)\n break;\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1d735eb1051b1275d89d343e0e2ed1eb", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "print(function(x) {\n\tfor (var i = 1; i <= 10; i++) {\n\t\tvar a = i / 2;\n\t\tfor (var b = 1; b <= 10; b++) {\n\t\t\tif (Math.abs(Math.sqrt(a * a + b * b) * x - a * b) < 0.001) {\n\t\t\t\treturn i + ' ' + b;\n\t\t\t}\n\t\t}\n\t}\n}(+readline()));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "00a9883f00e29ebceefc166885c0ce9c", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar a = readline();\nvar b = readline();\nvar c = readline();\n\nif ( n <= 1 ) print(0);\nelse if ( n === 2 ) print(Math.min(a,b));\nelse print(Math.min(a,b) + Math.min(a, Math.min(b,c)) * (n-2))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "01ca770275f14784c15470573f3b639c", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar a = readline();\nvar b = readline();\nvar c = readline();\n\nif ( n === 0 ) print(0);\nelse if ( n === 1 ) print(b);\nelse if ( n === 2 ) print(b + Math.min(b,c));\nelse print(b + Math.min(b,c) + Math.min(a, Math.min(b,c)) * (n-2))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f352b9d8d7c44c613928eef92d83b935", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "print(\"0\\n1\\n1\\n0\\n1\\n1\\n0\\n1\\n1\\n1\\n1\\n1\\n0\\n1\\n0\\n1\\n1\\n1\\n0\\n1\\n1\\n1\\n1\\n1\\n0\\n1\\n0\\n1\\n1\\n1\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8b24eeb71bacf4a8c2c20aa4f32b777c", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "JavaScript", "source_code": "var n=readline();\n//print(n);\nvar str=readline();\n//print(str);\nvar cnt=0,mn=0;\nfor(var i=0;i +item);\n }\n }\n\n var n = read.number();\n var s = readline();\n\n var res = 0;\n for(var i = 0; i < n; i++) {\n if(s[i] === '-'){\n res--;\n }\n else {\n res++;\n }\n \n if(res < 0) {\n res = 0;\n }\n }\n print(res);\n}());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "04b9394f5182cf259ad43cc500aebdf6", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require(\"readline\");\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false,\n});\n\nlet c = 0;\n\nrl.on(\"line\", (str) => {\n if (c === 0) {\n c++;\n return;\n }\n\n let ans = 0;\n\n for (let i = 0; i < str.length; i++) {\n if (str[i] === \"+\") {\n ans++;\n } else {\n ans = Math.max(0, --ans);\n }\n }\n\n console.log(ans);\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "84b95513e683af19ad1618703028f14d", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nvar STATE = 1;\nvar n;\nrl.on('line', function (input) {\n switch (STATE) {\n case 1:\n n = parseInt(input, 10);\n // console.log(STATE + ':', n);\n STATE = 2;\n break;\n case 2:\n // console.log(STATE + ':', input);\n var init = 0;\n var added = 0;\n for (var i = 0, len = input.length; i < len; i++) {\n var char = input[i];\n switch (char) {\n case '+':\n added++;\n break;\n case '-':\n if (added) {\n added--;\n } else {\n init++;\n }\n break; \n default:\n throw new Error('Error case');\n }\n }\n // console.log(init, added);\n console.log(added);\n STATE = 1;\n break;\n default:\n // code\n }\n}).on('close', function() {\n process.exit(0);\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "10d8ce5dd5721b0750bbf30d5c774022", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "n = +readline();\nif (n < 10){\n print(n);\n} else {\n ar = (n+'').split('').map(Number);\n acc = 9;\n digit = 1;\n while (acc < n){\n acc *= 10;\n acc += 9;\n digit++;\n }\n if (acc === n){\n print(digit*9);\n } else {\n acc = ar[0]-1;\n digit--;\n while (digit-->0){\n acc *= 10;\n acc +=9;\n }\n sum = 0;\n ((n - acc)+'').split('').map(Number).forEach(x=>sum+=x);\n (acc+'').split('').map(Number).forEach(x=>sum+=x);\n print(sum);\n }\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "300f98ce3453f08f0ebad55b192c6587", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nrl.on('line', (input) => {\n //console.log(input);\n //ar = input.split(' ');\n\n\n let a = Math.floor(input / 2);\n let b = input - a;\n let ar = a.toString().split(\"\")\n\n let total = 0;\n let ten = 0;\n\n for (let i = ar.length - 1; i>0; i--) {\n let fix = 9 - parseInt(ar[i], 10);\n ar[i] = 9;\n b -= fix * (Math.pow(10, ten));\n ten++;\n }\n let br = b.toString().split(\"\")\n\n ar.forEach(elem => {\n total += parseInt(elem, 10);\n });\n br.forEach(elem => {\n total += parseInt(elem, 10);\n });\n\n console.log(total);\n\n rl.close();\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "11a3b58304b0b5f76b2e32a99213871e", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface(process.stdin, process.stdout);\nrl.question('', (arg)=>{\n\tlet sum = 0;\n\tif(arg>10){\n\t\tlet b = 0;\n\t\tlet a = arg;\n\t\twhile(a>10){\n\t\t\tb = b*10+9;\n\t\t\ta=a/10;\n\t\t}\n\t\ta = arg - b;\n\twhile(a!=0|| b!=0){\n\t\t\tsum = sum + a%10 + b%10;\n\t\t\ta= Math.floor(a/10);\n\t\t\tb=Math.floor(b/10);\n\t\t}\n\n\t\t}else{\n\t\t\tsum = arg;\n\t\t}\n\tconsole.log(sum);\n\trl.close();\n}); ", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6c127bb79250ecf859853ac4efd8e5f1", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nconst arr = [];\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n arr.push(d.split(' ').map(Number));\n\n c++;\n});\n\nrl.on('close', () => {\n let ans = 0;\n let n = arr.length;\n\n for (let i = 0; i < arr.length; i++) {\n for (let j = 0; j < arr.length; j++) {\n if (i == j || i == Math.floor(n / 2) || j == Math.floor(n / 2) || i + j == n-1) {\n ans += arr[i][j];\n }\n }\n }\n\n console.log(ans);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "81bba4f770a5f7cb7ff3327e4bf546c2", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function main() {\n var n = readline();\n \n var len = n.length;\n \n if ((n[len - 1] - '0') & 1) {\n print('1');\n } else {\n print('2');\n }\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e5986f18d4577e5cc2fec7ad5c1625b9", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "print(Math.pow(parseInt(readline())-2,2))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c83bae118c665884c2dce83643deb006", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet count = 0;\nlet n, c;\nlet p, t;\n\nrl.on('line', (d) => {\n if (count === 0) {\n [n, c] = d.split(' ').map(Number);\n count++;\n return;\n }\n\n if (count === 1) {\n count++;\n p = d.split(' ').map(Number);\n return;\n }\n\n t = d.split(' ').map(Number);\n\n let ans = 'Tie';\n let score1 = 0;\n let score2 = 0;\n let spentTime = 0;\n\n for (let i = 0; i < n; i++) {\n spentTime += t[i];\n score1 += Math.max(0, p[i] - c * spentTime);\n }\n\n spentTime = 0;\n for (let i = n - 1; i >= 0; i--) {\n spentTime += t[i];\n score2 += Math.max(0, p[i] - c * spentTime);\n }\n\n if (score1 > score2) {\n ans = 'Limak';\n }\n\n if (score2 > score1) {\n ans = 'Radewoosh';\n }\n\n console.log(ans);\n\n count++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2d0cfef05b4e47e2294964cadaeefb42", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var l1 = readline().split(\" \"),\n\tscores = readline().split(\" \"),\n\ttimes = readline().split(\" \"),\n\n\tcount = +l1[0], // n\n\tspeed = +l1[1], // c\n\ttasks = scores.map(function (item, index) {\n\t\treturn {\n\t\t\tscore: +item,\n\t\t\ttime: +times[index]\n\t\t};\n\t}),\n\n\tlim = 0, // \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\n\trad = 0, // \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\n\n\tqLim,\n\tqRad,\n\n\tcLim,\n\tcRad,\n\n\ttLim = 0, // \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442\n\ttRad = 0; // \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \n\nfunction getScoreTaskByTime (score, time) {\n\treturn Math.max(0, score - speed * time);\n};\n\nfor (var i = 0, l = tasks.length - 1; i <= l; ++i) {\n\tqLim = tasks[i];\n\tlim += getScoreTaskByTime(qLim.score, tLim += qLim.time);\n\t\n\tqRad = tasks[l - i];\n\trad += getScoreTaskByTime(qRad.score, tRad += qRad.time);\n}\n\nif (lim == rad) {\n\tprint(\"Tie\");\n} else {\n\tprint(lim < rad ? \"Radewoosh\" : \"Limak\");\n\t\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f096b4adc26d57d33bba3b328f10327d", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "/**\n * Created by Utilisateur on 28/03/2016.\n */\n\nvar l1 = readline().split(' '),\n n = parseInt(l1[0]),\n c = parseInt(l1[1]),\n p = readline().split(' '),\n t = readline().split(' '),\n L = 0,\n R = 0\n\nfor (i = 0 ; i < n ; i++) {\n p[i] = parseInt(p[i])\n t[i] = parseInt(t[i])\n}\n\nfor (i = 0, j = n-1, xL = 0, xR = 0 ; i < n ; i++, j--) {\n xL += t[i]\n L += Math.max(0, p[i] - c * xL)\n xR += t[j]\n R += Math.max(0, p[j] - c * xR)\n}\n\nprint(L==R ? \"Tie\" : L>R ? \"Limak\" : \"Radewoosh\")\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1acc30b2a069933e5af81c38f701524f", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "Node.js", "source_code": "let input = [];\n \nconst RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n});\n\nRL.on('line', (line) => {\n input.push(line);\n});\n\n\nRL.on('close', () => {\n let {0:n, 1:c} = {...input[0].split(' ')};\n n = parseInt(n); c = parseInt(c);\n let points = []; input[1].split(' ').forEach( i => points.push(parseInt(i)) );\n let times = []; input[2].split(' ').forEach( i => times.push(parseInt(i)) );\n let secondTimes = []; times.forEach(i => secondTimes.push(parseInt(i)));\n\n let firstPlayer = 0; let secondPlayer = 0;\n let j = n-1;\n\n for(let i = 0; i < n; i++) {\n firstPlayer += max(0, points[i] - c*times[i]);\n secondPlayer += max(0, points[j] - c*secondTimes[j]);\n \n if(i + 1 != n) {\n times[i+1] += times[i];\n }\n if(j - 1 >= 0) {\n secondTimes[j-1] += secondTimes[j];\n }\n j--;\n //console.log(`fp = ${firstPlayer}; sp = ${secondPlayer}`);\n }\n\n if(firstPlayer > secondPlayer) {\n console.log('Limak');\n } else if(secondPlayer > firstPlayer) {\n console.log('Radewoosh');\n } else \n console.log('Tie')\n});\n\nfunction max(a, b) {\n return (a > b) ? a : b;\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "279b0a4c98090e52b9582a13823aad6c", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var parseIntFunc = function(x) { return parseInt(x); };\nvar numbers = readline().split(\" \").map(parseIntFunc);\nvar n = numbers[0];\nvar c = numbers[1];\n\nvar p = readline().split(\" \").map(parseIntFunc);\nvar t = readline().split(\" \").map(parseIntFunc);\n\nvar countFunc = function(){\n var time = 0;\n var summ = 0;\n for (var i = 0; i < n; i++){\n time += t[i];\n summ += Math.max(0, p[i] - c * time);\n }\n return summ;\n}\n\nvar limakScore = countFunc();\np.reverse();\nt.reverse();\nvar radewooshScore = countFunc();\nif (limakScore > radewooshScore){\n print('Limak');\n} else if (limakScore < radewooshScore) {\n print('Radewoosh');\n} else {\n print('Tie');\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cf3be602dd0da7229fa331b529e59e08", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var l1 = readline().split(\" \"),\n\tscores = readline().split(\" \"),\n\ttimes = readline().split(\" \"),\n\n\tcount = +l1[0], // n\n\tspeed = +l1[1], // c\n\ttasks = scores.map(function (item, index) {\n\t\treturn {\n\t\t\tscore: +item,\n\t\t\ttime: +times[index]\n\t\t};\n\t}),\n\n\tlim = 0, // \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\n\trad = 0, // \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\n\n\tqLim,\n\tqRad,\n\n\tcLim,\n\tcRad,\n\n\ttLim = 0, // \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442\n\ttRad = 0; // \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \n\nfunction getScoreTaskByTime (score, time) {\n\treturn Math.max(0, score - speed * time);\n};\n\nfor (var i = 0, l = tasks.length - 1; i <= l; ++i) {\n\tqLim = tasks[i];\n\tlim += getScoreTaskByTime(qLim.score, tLim += qLim.time);\n\t\n\tqRad = tasks[l - i];\n\trad += getScoreTaskByTime(qRad.score, tRad += qRad.time);\n}\nprint(lim); print(rad);\nif (lim == rad) {\n\tprint(\"Tie\");\n} else {\n\tprint(lim < rad ? \"Radewoosh\" : \"Limak\");\n\t\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d72c9db06e804b85bc6b33750994f971", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet L = readline()\nL = {x: ltd(L[0]), y: +L[1]}\nlet K = readline()\nK = {x: ltd(K[0]), y: +K[1]}\n\nlet ps = 0\nlet d = []\n\nfor (let x = 1; x <= 8; x++) {\n for (let y = 1; y <= 8; y++) {\n if (!d[x]) d[x] = []\n d[x][y] = is(x, y) ? 1 : 0\n if (is(x, y)) {\n ps++\n }\n }\n}\nprint(ps)\n\nfunction is (x, y) {\n if (x == K.x && y == K.y || x == L.x && y == L.y) return false\n if (x == L.x || y == L.y) return false\n if (x == K.x + 1 && y == K.y + 2\n || x == K.x + 2 && y == K.y - 1\n || x == K.x + 2 && y == K.y + 1\n || x == K.x + 1 && y == K.y - 2\n || x == K.x - 1 && y == K.y - 2\n || x == K.x - 2 && y == K.y - 1\n || x == K.x - 2 && y == K.y + 1\n || x == K.x - 1 && y == K.y + 2\n ) return false\n if (x == L.x + 1 && y == L.y + 2\n || x == L.x + 2 && y == L.y - 1\n || x == L.x + 2 && y == L.y + 1\n || x == L.x + 1 && y == L.y - 2\n || x == L.x - 1 && y == L.y - 2\n || x == L.x - 2 && y == L.y - 1\n || x == L.x - 2 && y == L.y + 1\n || x == L.x - 1 && y == L.y + 2\n ) return false\n return true\n}\n\nfunction ltd (l) {\n switch (l) {\n case 'a': return 1\n case 'b': return 2\n case 'c': return 3\n case 'd': return 4\n case 'e': return 5\n case 'f': return 6\n case 'g': return 7\n case 'h': return 8\n }\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "655d4d4c76472566e93054d11eed911d", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet L = readline()\nL = {x: ltd(L[0]), y: +L[1]}\nlet K = readline()\nK = {x: ltd(K[0]), y: +K[1]}\n\n\nlet ps = 0\nlet d = []\n\nfor (let x = 1; x <= 8; x++) {\n for (let y = 1; y <= 8; y++) {\n if (!d[x]) d[x] = []\n d[x][y] = is(x, y) ? 1 : 0\n if (is(x, y)) {\n ps++\n }\n }\n}\nprint(ps - 2)\n\nfunction is (x, y) {\n if (x == K.x && y == K.y || x == L.x && y == L.y) return false\n if (x == L.x || y == L.y) return false\n if (x == K.x + 1 && y == K.y + 2\n || x == K.x + 2 && y == K.y - 1\n || x == K.x + 2 && y == K.y + 1\n || x == K.x + 1 && y == K.y - 2\n || x == K.x - 1 && y == K.y - 2\n || x == K.x - 2 && y == K.y - 1\n || x == K.x - 2 && y == K.y + 1\n || x == K.x - 1 && y == K.y + 2\n ) return false\n return true\n}\n\nfunction ltd (l) {\n switch (l) {\n case 'a': return 1\n case 'b': return 2\n case 'c': return 3\n case 'd': return 4\n case 'e': return 5\n case 'f': return 6\n case 'g': return 7\n case 'h': return 8\n }\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1b0413ff48870e9968bc15aadc0b12f7", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar N = nextInt();\n\tvar list = next();\n\tvar output = \"\";\n\tvar mae = \"\";\n\tvar ng = new Set([\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]);\n\tfor(var i = 0; i < N; i++){\n\t\tif(!ng.has(mae) || !ng.has(list[i])){\n\t\t\tmae = list[i];\n\t\t\toutput += list[i];\n\t\t}\n\t}\n\tmyout(output);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0dc11d8f27c8f08366eac29ced74dfb9", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require(\"readline\");\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false,\n});\n\nlet c = 0;\n\nrl.on(\"line\", (str) => {\n if (c === 0) {\n c++;\n return;\n }\n\n let ans = str[0];\n const vowels = {\n a: true,\n e: true,\n i: true,\n o: true,\n u: true,\n y: true,\n };\n\n for (let i = 1; i < str.length; i++) {\n if (vowels[str[i]] && vowels[ans[ans.length - 1]]) {\n continue;\n } else {\n ans += str[i];\n }\n }\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e1fd11655bc7ea3deaa0415c8b897572", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "var lettersToCheck = parseInt(readline());\nvar word = readline();\nvar vowels = ['a', 'e', 'i', 'o', 'u', 'y'];\nfor (var index = 0; index < word.length;) {\n if (vowels.includes(word[index]) && vowels.includes(word[index + 1])) {\n word = word.slice(0, index + 1) + word.slice(index + 2, word.length);\n } else {\n index++;\n }\n}\nprint(word)\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "801937ed0ccf642a3b3feb9fb6b45f0b", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar count = 0, max = parseInt(readline());\n\tfunction go(x, a, b) {\n\t\tif (x > max) {\n\t\t\treturn;\n\t\t}\n\t\t++count;\n\t\tgo(10*x + a, a, b);\n\t\tif (b === undefined) {\n\t\t\tfor (var b = 0; b < 10; ++b) {\n\t\t\t\tif (b != a) {\n\t\t\t\t\tgo(10*x + b, a, b);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tgo(10*x + b, a, b);\n\t\t}\n\t}\n\tfor (var x = 1; x < 10; ++x) {\n\t\tgo(x, x);\n\t}\n\tprint(count);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "24b2d1c11a112a08aec501c870c80702", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\nprocess.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nvar arr = ''\nprocess.stdin.on('data', (i) => {\n arr += i\n})\n\n\nprocess.stdin.on('end', () => {\n arr = arr.split('\\n').map(a => a.replace(/(\\r\\n|\\n|\\r)/gm, ''))\n\n const n = readInt(arr)\n const sqrt = Math.ceil(Math.sqrt(n))\n // wr(n, sqrt)\n\n let a, b\n for(let i = sqrt; i >=1; i--) {\n a = i\n if(n % a != 0) continue\n b = n / a\n if(a == b) continue\n else if(gcd(a, b) != 1) continue\n else break\n }\n wr(a, b)\n})\n\nfunction wr(...x) {\n console.log(...x)\n}\n\nfunction sort(a, inc = true) {\n if(inc) a.sort((a, b) => a - b)\n else a.sort((a, b) => b - a)\n}\n\nfunction readInt(a, i) {\n if(i === undefined) return parseInt(a.shift())\n else return parseInt(a[i])\n}\n\nfunction readInts(a, i) {\n if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))\n else return arr[i].split(' ').map(a => parseInt(a))\n}\n\nfunction gcd(a, b) {\n if(b == 0) return a\n else return gcd(b, a % b)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "07e99567f1979ef64e0466aed4b3da7d", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "main();\n\nfunction main(){\n var x = parseInt(readline());\n\n var guess=Math.round(Math.sqrt(x));\n //print(guess);\n\n for(var i=guess;i>=1;i--){\n if(x%i===0){\n //print(\"no remainder\");\n //print(lcm(i,x/i));\n if(x==lcm(i,x/i)){print(i+\" \"+x/i);return;}\n }//whole number divisor\n}\n \n}//main, added for return\n\nfunction lcm(a,b){\n return a*b/gcd(a,b);\n}\n\nfunction gcd(a,b){\n while(a>0){\n var temp=a;\n a=b%a;\n b=temp;\n }\n return b;\n}\n\n\n\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b571db4a3ba89f00dbfc29b6c4f2578a", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "'use strict';\n\nvar readline = require('readline');\n\nfunction gcd(x, y) {\n x = Math.abs(x);\n y = Math.abs(y);\n\n while (y) {\n var t = y;\n y = x % y;\n x = t;\n }\n\n return x;\n}\n\nfunction lcm(x, y) {\n if (typeof x !== 'number' || typeof y !== 'number') return false;\n return !x || !y ? 0 : Math.abs(x * y / gcd(x, y));\n}\n\nfunction* unsortedFactors(n, emitPairs = true) {\n if (n < 1) {\n return;\n }\n\n yield n;\n\n if (n === 1) {\n return;\n }\n\n const end = Math.sqrt(n);\n\n for (var i = 1; i <= end; i++) {\n if (n % i === 0) {\n yield i;\n\n if (i !== Math.sqrt(n) && i !== 1) {\n yield n / i;\n }\n }\n }\n}\n\nconst stdin = readline.createInterface(process.stdin).once('line', input => {\n stdin.close();\n const X = +input;\n let min = null;\n let answer = '';\n\n for (const factor of unsortedFactors(X, false)) {\n const partner = X / factor;\n const max = Math.max(factor, partner);\n\n if ((min === null || max < min) && lcm(factor, partner) === X) {\n min = max;\n answer = `${factor} ${partner}`;\n }\n }\n\n console.log(answer);\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bc44fc9360357a75ccf6804f97b78fa4", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "(function main() {\n var n = readline().split(':');\n var h = parseInt(n[0]);\n var m = parseInt(n[1]);\n var dh = ~~(h / 10);\n var oh = h % 10;\n var reh = 10 * oh + dh;\n if (m >= reh) {\n ++h; \n if (h > 23) h = 0;\n dh = ~~(h / 10);\n oh = h % 10;\n }\n if (oh >= 6) {\n oh = 0;\n ++dh;\n }\n print('' + dh + oh + ':' + oh + dh); \n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ca4bb38d6b1dc4df85ee45a287d3d373", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "(function main() {\n var n = parseInt(readline());\n var s = 0;\n var i = 0;\n var re = new RegExp('[' + n + ']');\n for ( ; i * i < n ; ++i) \n if (n % i == 0) {\n if (re.test(i)) ++s;\n if (re.test(n / i)) ++s;\n }\n if (i * i == n && re.test(i)) ++s;\n print(s);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0403cc135ba71d1f5e00d5c57ec0e7c9", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var t = readline().split(' '),\n n = +t[0],\n k = +t[1]\n\nif (k === 0 || k === n) print('0 0')\nelse if (k <= Math.floor(n/3)) print([1, 2*k].join(' '))\nelse print([1, n-k].join(' '))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "183dbf8eddb523d212d9d15e4ced7508", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var primes = [];\n\nfunction decompose(n) {\n var res = [];\n var p = 2;\n while (true) {\n if (n >= p * p) {\n if (n % p === 0) {\n res.push(p);\n n /= p;\n } else {\n p++;\n }\n } else {\n res.push(n);\n break;\n }\n }\n return res;\n}\n\nfunction resolve(n) {\n var d1 = decompose(n);\n var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;\n var min = Infinity;\n var d2;\n var px2;\n for (var i = px1; i < n; i++) {\n d2 = decompose(i);\n px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;\n if (px2 < min && px2 >= 3) {\n min = px2;\n }\n }\n if (min === Infinity) {\n return px1;\n }\n return min;\n}\n\nconst k = parseInt(readline(), 10);\n\nconst result = resolve(k);\n\nprint(result + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "398c23dc75d31ee2ae354bee87d1e6af", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var primes = [];\n\nfunction decompose(n) {\n var res = [];\n var p = 2;\n while (true) {\n if (n >= p * p) {\n if (n % p === 0) {\n res.push(p);\n n /= p;\n } else {\n p++;\n }\n } else {\n res.push(n);\n break;\n }\n }\n return res;\n}\n\n\nfunction resolve(n) {\n var d1 = decompose(n);\n var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;\n var min = Infinity;\n var d2;\n var px2;\n for (var i = px1; i < n; i++) {\n d2 = decompose(i);\n px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;\n if (px2 < min && px2 >= 3) {\n min = px2;\n }\n }\n if (min === Infinity) {\n return px1;\n }\n return min;\n}\n\nconst k = parseInt(readline(), 10);\n\nconst result = resolve(k);\n\nprint(result + '\\n');", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "79517e6aa9eac1fea172bd4bf30edbfa", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var primes = [];\n\nfunction findPrimes(n) {\n for (var i = 2; i < n; i++) {\n var isPrime = true;\n for (var p of primes) {\n if (i % p === 0) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n}\n\nfunction decompose(n) {\n var res = [];\n var i = 0;\n while (primes[i] <= n) {\n while (true) {\n if (n % primes[i] === 0) {\n res.push(primes[i]);\n n /= primes[i];\n } else {\n break;\n }\n }\n i++;\n }\n return res;\n}\n\nfunction resolve(n) {\n findPrimes(n);\n var d1 = decompose(n);\n var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;\n var min = Infinity;\n var d2;\n var px2;\n for (var i = px1; i < n; i++) {\n d2 = decompose(i);\n px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;\n console.log(i, px2);\n if (px2 < min && px2 >= 3) {\n min = px2;\n }\n }\n if (min === Infinity) {\n return px1;\n }\n return min;\n}\n\nconst k = parseInt(readline(), 10);\n\nconst result = resolve(k);\n\nprint(result + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "562c75f4d44f08affd87ea13260b3e78", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var primes = [];\n\nfunction findPrimes(n) {\n for (var i = 2; i < n; i++) {\n var isPrime = true;\n for (var p of primes) {\n if (i % p === 0) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n}\n\nfunction decompose(n) {\n var res = [];\n var i = 0;\n while (primes[i] <= n) {\n while (true) {\n if (n % primes[i] === 0) {\n res.push(primes[i]);\n n /= primes[i];\n } else {\n break;\n }\n }\n i++;\n }\n return res;\n}\n\nfunction resolve(n) {\n findPrimes(n);\n var d1 = decompose(n);\n var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;\n var min = Infinity;\n var d2;\n var px2;\n for (var i = px1; i < n; i++) {\n d2 = decompose(i);\n px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;\n console.log(i, px2);\n if (px2 < min && px2 >= 3) {\n min = px2;\n }\n }\n if (min === Infinity) {\n return px1;\n }\n return min;\n}\n\nconsole.log(resolve(8192));\n\n/*const k = parseInt(readline(), 10);\n\nconst result = resolve(k);\n\nprint(result + '\\n');*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5300410aac397c460dc7861ef1989ff0", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "var primes = [];\n\nfunction findPrimes(n) {\n for (var i = 2; i < n; i++) {\n var isPrime = true;\n for (var p of primes) {\n if (i % p === 0) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n}\n\nfunction decompose(n) {\n var res = [];\n var i = 0;\n while (primes[i] <= n) {\n while (true) {\n if (n % primes[i] === 0) {\n res.push(primes[i]);\n n /= primes[i];\n } else {\n break;\n }\n }\n i++;\n }\n return res;\n}\n\nfunction resolve(n) {\n findPrimes(n);\n var d1 = decompose(n);\n var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;\n var min = Infinity;\n var d2;\n var px2;\n for (var i = px1; i < n; i++) {\n d2 = decompose(i);\n px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;\n if (px2 < min && px2 >= 3) {\n min = px2;\n }\n }\n if (min === Infinity) {\n return px1;\n }\n return min;\n}\n\nconst k = parseInt(readline(), 10);\n\nconst result = resolve(k);\n\nprint(result + '\\n');\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "49d4e9cad791f2f282f2ef4ea274f45d", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "var dataitr;\r\nvar stdin_input = \"\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"ascii\");\r\nprocess.stdin.on(\"data\", function (input) { stdin_input += input; });\r\nprocess.stdin.on(\"end\", function () { dataitr = stdin_input.split('\\n').values(); main(); });\r\n\r\nconst rl = () => dataitr.next().value.trim();\r\nconst rn = () => Number(rl());\r\nconst ra = () => rl().split(' ');\r\nconst rna = () => ra().map(x => Number(x));\r\n\r\nconst MOD = 998244353;\r\n\r\nfunction countDivisors (n) {\r\n let cnt = 0; let i;\r\n for (i = 1; i*i < n; i++) \r\n if (n % i == 0)\r\n cnt += 2;\r\n cnt += i*i == n;\r\n return cnt;\r\n}\r\n\r\nfunction main () {\r\n\tconst n = rn();\r\n\r\n\tlet ans = 0;\r\n\tlet psm = 0;\r\n\tfor (let i = 1; i <= n ; i++) {\r\n\t\tans = countDivisors(i) + psm;\r\n\t\tpsm = (psm + ans) % MOD;\r\n\t}\r\n\r\n\tconsole.log(ans);\r\n}\r\n\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d44062d963c0c3f08bc54f36bffb2222", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\n \nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nvar lines = [];\nrl.on('line', function(input) {\n lines.push(input);\n});\nrl.on('close', function() {\n var l = 0;\n console.log(solve(+lines[l++]))\n});\n\nfunction solve(n) {\n const dp = Array(n + 1).fill(0)\n for (let i = 1; i < n; i++) {\n for (let j = i + i; j <= n; j += i) {\n dp[j]++\n }\n }\n let sum = 1\n for (let i = 1; i <= n; i++) {\n dp[i] = add(dp[i], sum)\n sum = add(sum, dp[i])\n }\n return dp[n]\n}\n\nfunction add(a, b) {\n return (a + b) % 998244353\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a4df627f7f4fa11884723c2b0c861bdf", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet G = readline().split(' ').map(v => parseInt(v))\nlet B = readline().split(' ').map(v => parseInt(v))\n\nlet test = (g, b) => {\n return (g - b <= 1) && (b - g <= 3)\n}\n\nprint((test(G[0], B[1]) || test(G[1], B[0]) ? 'YES' : 'NO'))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c27decbde2d66cd1111a0779696d158f", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet G = readline().split(' ').map(v => parseInt(v))\nlet B = readline().split(' ').map(v => parseInt(v))\n\nlet test = (g, b) => {\n return (g - b <= 1) && (b - g * 2 - 2 <= 0)\n}\n\nprint((test(G[0], B[1]) || test(G[1], B[0]) ? 'YES' : 'NO'))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "329e83fa7861cd618fe5ad666c6e2400", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', (inputStd) => {\n inputString += inputStd;\n});\nprocess.stdin.on('end', function () {\n inputString = inputString\n .trim()\n .split('\\n')\n .map((str) => {\n return str.trim();\n });\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n let brain = readLine();\n while (brain.includes('>')) {\n brain = brain.replace('>', '1000');\n }\n while (brain.includes('<')) {\n brain = brain.replace('<', '1001');\n }\n while (brain.includes('+')) {\n brain = brain.replace('+', '1010');\n }\n while (brain.includes('-')) {\n brain = brain.replace('-', '1011');\n }\n while (brain.includes('.')) {\n brain = brain.replace('.', '1100');\n }\n while (brain.includes(',')) {\n brain = brain.replace(',', '1101');\n }\n while (brain.includes('[')) {\n brain = brain.replace('[', '1110');\n }\n while (brain.includes(']')) {\n brain = brain.replace(']', '1111');\n }\n let ans = convertBase(brain, 2, 10);\n\n let final = 0;\n let length = ans.length;\n for (let i = 0; i < length; i++) {\n final = (final * 10 + (ans[i] - 0)) % 1000003;\n }\n console.log(final);\n}\n\nfunction parseBigInt(bigint, base) {\n //convert bigint string to array of digit values\n for (var values = [], i = 0; i < bigint.length; i++) {\n values[i] = parseInt(bigint.charAt(i), base);\n }\n return values;\n}\n\nfunction formatBigInt(values, base) {\n //convert array of digit values to bigint string\n for (var bigint = '', i = 0; i < values.length; i++) {\n bigint += values[i].toString(base);\n }\n return bigint;\n}\n\nfunction convertBase(bigint, inputBase, outputBase) {\n //takes a bigint string and converts to different base\n var inputValues = parseBigInt(bigint, inputBase),\n outputValues = [], //output array, little-endian/lsd order\n remainder,\n len = inputValues.length,\n pos = 0,\n i;\n while (pos < len) {\n //while digits left in input array\n remainder = 0; //set remainder to 0\n for (i = pos; i < len; i++) {\n //long integer division of input values divided by output base\n //remainder is added to output array\n remainder = inputValues[i] + remainder * inputBase;\n inputValues[i] = Math.floor(remainder / outputBase);\n remainder -= inputValues[i] * outputBase;\n if (inputValues[i] == 0 && i == pos) {\n pos++;\n }\n }\n outputValues.push(remainder);\n }\n outputValues.reverse(); //transform to big-endian/msd order\n return formatBigInt(outputValues, outputBase);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9291913e06ee9961fc6db502fba1a4d4", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', (inputStd) => {\n inputString += inputStd;\n});\nprocess.stdin.on('end', function () {\n inputString = inputString\n .trim()\n .split('\\n')\n .map((str) => {\n return str.trim();\n });\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n let brain = readLine();\n while (brain.includes('>')) {\n brain = brain.replace('>', '1000');\n }\n while (brain.includes('<')) {\n brain = brain.replace('<', '1001');\n }\n while (brain.includes('+')) {\n brain = brain.replace('+', '1010');\n }\n while (brain.includes('-')) {\n brain = brain.replace('-', '1011');\n }\n while (brain.includes('.')) {\n brain = brain.replace('.', '1100');\n }\n while (brain.includes(',')) {\n brain = brain.replace(',', '1101');\n }\n while (brain.includes('[')) {\n brain = brain.replace('[', '1110');\n }\n while (brain.includes(']')) {\n brain = brain.replace(']', '1111');\n }\n // console.log(brain);\n let ans = convertBase(brain, 2, 10);\n // let ansString = ans.toString();\n // let final = ans % 1000003;\n let final = 0;\n let length = ans.toString().length;\n for (let i = 0; i < length; i++) {\n final = (final * 10 + (ansString[i] - 0)) % 1000003;\n }\n console.log(final);\n}\nfunction parseBigInt(bigint, base) {\n //convert bigint string to array of digit values\n for (var values = [], i = 0; i < bigint.length; i++) {\n values[i] = parseInt(bigint.charAt(i), base);\n }\n return values;\n}\n\nfunction formatBigInt(values, base) {\n //convert array of digit values to bigint string\n for (var bigint = '', i = 0; i < values.length; i++) {\n bigint += values[i].toString(base);\n }\n return bigint;\n}\n\nfunction convertBase(bigint, inputBase, outputBase) {\n //takes a bigint string and converts to different base\n var inputValues = parseBigInt(bigint, inputBase),\n outputValues = [], //output array, little-endian/lsd order\n remainder,\n len = inputValues.length,\n pos = 0,\n i;\n while (pos < len) {\n //while digits left in input array\n remainder = 0; //set remainder to 0\n for (i = pos; i < len; i++) {\n //long integer division of input values divided by output base\n //remainder is added to output array\n remainder = inputValues[i] + remainder * inputBase;\n inputValues[i] = Math.floor(remainder / outputBase);\n remainder -= inputValues[i] * outputBase;\n if (inputValues[i] == 0 && i == pos) {\n pos++;\n }\n }\n outputValues.push(remainder);\n }\n outputValues.reverse(); //transform to big-endian/msd order\n return formatBigInt(outputValues, outputBase);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "8f1942d43fa907134ba4d94d5c15439f", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nlet inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', (inputStd) => {\n inputString += inputStd;\n});\nprocess.stdin.on('end', function () {\n inputString = inputString\n .trim()\n .split('\\n')\n .map((str) => {\n return str.trim();\n });\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction main() {\n let brain = readLine();\n while (brain.includes('>')) {\n brain = brain.replace('>', '1000');\n }\n while (brain.includes('<')) {\n brain = brain.replace('<', '1001');\n }\n while (brain.includes('+')) {\n brain = brain.replace('+', '1010');\n }\n while (brain.includes('-')) {\n brain = brain.replace('-', '1011');\n }\n while (brain.includes('.')) {\n brain = brain.replace('.', '1100');\n }\n while (brain.includes(',')) {\n brain = brain.replace(',', '1101');\n }\n while (brain.includes('[')) {\n brain = brain.replace('[', '1110');\n }\n while (brain.includes(']')) {\n brain = brain.replace(']', '1111');\n }\n // console.log(brain);\n console.log(parseInt(brain, 2) % 1000003);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "85ea3665209568147ff6b338db046d57", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "let inputString = \"\";\nlet currentLine = 0;\nprocess.stdin.on(\"data\", (data) => {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n const n = +readLine();\n const MOD = 1e9 + 7;\n let [fact, twoPow] = [1, 1];\n\n for (let i = 1; i <= n; i++) fact = (fact * i) % MOD;\n\n for (let i = 1; i <= n - 1; i++) twoPow = (twoPow * 2) % MOD;\n\n console.log((fact - twoPow + MOD) % MOD);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "318277a4c22138b888fa1e3b80bca5d9", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n this.CLEAR_ARRAY_PER_CASE = false;\n\n\tthis.calc = function() {\n\t\tvar i , fl , idx , j , crr , cnt , k ;\n\t\twhile( true ) {\n\t\t\tfl = 0 ;\n\t\t\tfor( i = 0 ; i < this.cn ; i++ ) {\n\t\t\t\tcnt = 1 ;\n\t\t\t\tfor( j = i + 1 ; j < this.cn ; j++ ) {\n\t\t\t\t\tif( this.brr[ i ] != this.brr[ j ] ) {\n\t\t\t\t\t\tbreak ;\n\t\t\t\t\t}\n\t\t\t\t\tcnt++ ;\n\t\t\t\t\tk = j ;\n\t\t\t\t}\n\t\t\t\tif( cnt >= 3 ) {\n\t\t\t\t\tidx = 0 ;\n\t\t\t\t\tcrr = new Array() ;\n\t\t\t\t\tfor( j = 0 ; j < i ; j++ ) {\n\t\t\t\t\t\tcrr.push( this.brr[ j ] ) ;\n\t\t\t\t\t\tidx++ ;\n\t\t\t\t\t}\n\t\t\t\t\tfor( j = k + 1 ; j < this.cn ; j++ ) {\n\t\t\t\t\t\tcrr.push( this.brr[ j ] ) ;\n\t\t\t\t\t\tidx++ ;\n\t\t\t\t\t}\n\t\t\t\t\tthis.brr = crr ;\n\t\t\t\t\tthis.cn = idx ;\n\t\t\t\t\tfl = 1 ;\n\t\t\t\t\tbreak ;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif( fl == 0 ) {\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\t\treturn this.n - this.cn ;\n\t} ;\n\t\n this.solveCase = function() {\n var res , i , j , fl , cn , temp ;\n res = 0 ;\n //at the start\n this.cn = 0 ;\n this.brr[ this.cn++ ] = this.x ;\n for( i = 0 ; i < this.n ; i++ ) {\n \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n }\n res = Math.max( res , this.calc() ) ;\n //at the end\n this.cn = 0 ;\n for( i = 0 ; i < this.n ; i++ ) {\n \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n }\n this.brr[ this.cn++ ] = this.x ;\n res = Math.max( res , this.calc() ) ;\n //anywhere in the middle\n for( j = 0 ; j < this.n - 1 ; j++ ) {\n \tthis.cn = 0 ;\n\t for( i = 0 ; i <= j ; i++ ) {\n\t \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n\t }\n\t this.brr[ this.cn++ ] = this.x ;\n\t for( i = j + 1 ; i < this.n ; i++ ) {\n\t \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n\t }\n \tres = Math.max( res , this.calc() ) ;\n \t//print( j , res , this.cn ) ;\n\t }\n print( res );\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.n = irObj.nextInt();\n this.k = irObj.nextInt();\n this.x = irObj.nextInt();\n for( i = 0 ; i < this.n ; i++ ) {\n this.arr[ i ] = irObj.nextInt();\n }\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.adj_list.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n };\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adj_list.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 );\n this.done[ i ].push( 0 );\n }\n }\n };\n\n this.init();\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n \n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n };\n \n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n };\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n };\n \n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n res = \"\";\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );\n }\n }\n this.currrentCharacterIndex = endIdx;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n return this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCases = function() {\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {\n environmentType = 'local-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n };\n\n this.configureStreamsAndReadInput = function() {\n var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino();\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n };\n \n this.configureStreamsAndReadInput();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "21f15eb0a60628c84a17f1c3aae32718", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\tballNum = data[0], colorNum = data[1], ball = data[2],\n\t\tballs = tokenizeIntegers(readline()),\n\t\tmaxDestroyed = 0;\n\tfor (var pos = 1; pos < ballNum; ++pos) {\n\t\tvar countDestroyed = -1,\n\t\t\tdestroy = [];\n\t\tfor (var i = 0; i < ballNum; ++i) {\n\t\t\tif (i == pos) {\n\t\t\t\tdestroy.push(ball);\n\t\t\t}\n\t\t\tdestroy.push(balls[i]);\n\t\t}\n\t\twhile (destroy.length != 0) {\n\t\t\tvar color = destroy[0], count = 1;\n\t\t\tfor (var i = 1; i < destroy.length; ++i) {\n\t\t\t\tif (destroy[i] == color) {\n\t\t\t\t\t++count;\n\t\t\t\t\tif (count == 3) {\n\t\t\t\t\t\tvar begin = i-2, end = i;\n\t\t\t\t\t\twhile (end+1 < destroy.length && destroy[end+1]==color){\n\t\t\t\t\t\t\t++end;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcountDestroyed += end-begin+1;\n\t\t\t\t\t\tvar newDestroy = [];\n\t\t\t\t\t\tfor (var j = 0; j < destroy.length; ++j) {\n\t\t\t\t\t\t\tif (j < begin || j > end) {\n\t\t\t\t\t\t\t\tnewDestroy.push(destroy[j]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdestroy = newDestroy;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcolor = destroy[i];\n\t\t\t\t\tcount = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (count < 3) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tmaxDestroyed = Math.max(maxDestroyed, countDestroyed);\n\t}\n\tprint(maxDestroyed);\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ea73455cf1b0ca21207049637bc73143", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n this.CLEAR_ARRAY_PER_CASE = false;\n\n\tthis.calc = function() {\n\t\tvar i , fl , idx , j , crr ;\n\t\twhile( true ) {\n\t\t\tfl = 0 ;\n\t\t\tfor( i = 0 ; i <= this.cn - 3 ; i++ ) {\n\t\t\t\tif( this.brr[ i ] == this.brr[ i + 1 ] && this.brr[ i + 1 ] == this.brr[ i + 2 ] ) {\n\t\t\t\t\tfl = 1 ;\n\t\t\t\t\tidx = 0 ;\n\t\t\t\t\tcrr = new Array() ;\n\t\t\t\t\tfor( j = 0 ; j < this.cn ; j++ ) {\n\t\t\t\t\t\tif( j != i && j != i + 1 && j != i + 2 ) {\n\t\t\t\t\t\t\tcrr.push( this.brr[ j ] ) ;\n\t\t\t\t\t\t\tidx++ ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.brr = crr ;\n\t\t\t\t\tthis.cn = idx ;\n\t\t\t\t\tbreak ;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif( fl == 0 ) {\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\t\treturn this.n + 1 - this.cn ;\n\t} ;\n\t\n this.solveCase = function() {\n var res , i , j , fl , cn , temp ;\n res = 0 ;\n //at the start\n this.cn = 0 ;\n this.brr[ this.cn++ ] = this.x ;\n for( i = 0 ; i < this.n ; i++ ) {\n \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n }\n res = Math.max( res , this.calc() ) ;\n //at the end\n this.cn = 0 ;\n for( i = 0 ; i < this.n ; i++ ) {\n \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n }\n this.brr[ this.cn++ ] = this.x ;\n res = Math.max( res , this.calc() ) ;\n //anywhere in the middle\n for( j = 0 ; j < this.n - 1 ; j++ ) {\n \tthis.cn = 0 ;\n\t for( i = 0 ; i <= j ; i++ ) {\n\t \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n\t }\n\t this.brr[ this.cn++ ] = this.x ;\n\t for( i = j + 1 ; i < this.n ; i++ ) {\n\t \tthis.brr[ this.cn++ ] = this.arr[ i ] ;\n\t }\n \tres = Math.max( res , this.calc() ) ;\n\t }\n print( res );\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.n = irObj.nextInt();\n this.k = irObj.nextInt();\n this.x = irObj.nextInt();\n for( i = 0 ; i < this.n ; i++ ) {\n this.arr[ i ] = irObj.nextInt();\n }\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.adj_list.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n };\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adj_list = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adj_list.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 );\n this.done[ i ].push( 0 );\n }\n }\n };\n\n this.init();\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n \n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n };\n \n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n };\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n };\n \n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n res = \"\";\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );\n }\n }\n this.currrentCharacterIndex = endIdx;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n return this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCases = function() {\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {\n environmentType = 'local-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n };\n\n this.configureStreamsAndReadInput = function() {\n var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino();\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n };\n \n this.configureStreamsAndReadInput();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5aa8a30ade857cf9a2af33aed46ad1c8", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n this.CLEAR_ARRAY_PER_CASE = false;\n\n\tthis.dp = function( i , rem , fl ) {\n\t\tvar ret , res , r1 , re , a ;\n\t\tif( i >= this.n ) {\n\t\t\tif( rem == 0 && fl == 1 ) {\n\t\t\t\treturn 1 ;\n\t\t\t}\n\t\t\treturn 0 ;\n\t\t}\n\t\tre = this.done[ i ][ rem ][ fl ] ;\n\t\tret = this.memo[ i ][ rem ][ fl ] ;\n\t\tif( re == this.cc ) {\n\t\t\treturn ret ;\n\t\t}\n\t\tthis.done[ i ][ rem ][ fl ] = this.cc ;\n\t\tres = 0 ;\n\t\tr1 = this.dp( i + 1 , rem , fl ) ;\n\t\tres |= r1 ;\n\t\ta = this.s.charCodeAt( i ) - '0'.charCodeAt( 0 ) ;\n\t\tr1 = this.dp( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;\n\t\tres |= r1 ;\n\t\tthis.memo[ i ][ rem ][ fl ] = res ;\n\t\treturn res ;\n\t} ;\n\t\n\tthis.dpPrint = function( i , rem , fl ) {\n\t\tvar r1 , a ;\n\t\tif( i >= this.n ) {\n\t\t\treturn '' ;\n\t\t}\n\t\tr1 = this.dp( i + 1 , rem , fl ) ;\n\t\tif( r1 == 1 ) {\n\t\t\treturn this.dpPrint( i + 1 , rem , fl ) ;\n\t\t}\n\t\ta = this.s.charCodeAt( i ) - '0'.charCodeAt( 0 ) ;\n\t\tr1 = this.dp( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;\n\t\tif( r1 == 1 ) {\n\t\t\treturn this.s.charAt( i ) + this.dpPrint( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;\n\t\t}\n\t} ;\n\n this.solveCase = function() {\n var res , i , j , fl , cn , temp , len , numberString , resNumber ;\n res = 0 ;\n this.n = this.s.length ;\n res = this.dp( 0 , 0 , 0 ) ;\n if( res == 0 ) {\n \tprint( 'NO' );\n }\n else {\n \tprint( 'YES' );\n \tnumberString = this.dpPrint( 0 , 0 , 0 ) ;\n \tlen = numberString.length ;\n \tresNumber = '' ;\n \tfl = 0 ;\n \tfor( i = 0 ; i < len ; i++ ) {\n \t\tif( numberString.charCodeAt( i ) > '0'.charCodeAt( 0 ) ) {\n \t\t\tfl = 1 ;\n \t\t}\n \t\tif( fl == 1 ) {\n \t\t\tresNumber += numberString.charAt( i ) ;\n \t\t}\n \t}\n \tif( resNumber == '' ) {\n \t\tresNumber = '0' ;\n \t}\n \tprint( resNumber );\n }\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.s = irObj.nextString();\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.adjList = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.adjList.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n };\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adjList = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adjList.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( new Array() );\n this.done[ i ].push( new Array() );\n for( k = 0 ; k < 2 ; k++ ) {\n \tthis.memo[ i ][ j ].push( -1 );\n \tthis.done[ i ][ j ].push( 0 );\n }\n }\n }\n };\n\n this.init();\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n \n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n };\n \n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n };\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n };\n \n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n res = \"\";\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );\n }\n }\n this.currrentCharacterIndex = endIdx;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n return this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCases = function() {\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {\n environmentType = 'local-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n };\n\n this.configureStreamsAndReadInput = function() {\n var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino();\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n };\n \n this.configureStreamsAndReadInput();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2271d4badb7ba9fa8ac9c4efe1c7a9b6", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var input = readline();\nvar check = [];\nfor (var i = 0;i<1000;i++){\n if (i%8 == 0){\n check.push(i.toString());\n }\n}\nvar finded = false;\nfor (var k = 0 ;k=3){\n print('YES');\n print(input[0]+'000');\n }\n else\n print('NO');\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "943a39933a34ccbce892e4357d6a2a19", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const memo = {};\n\nfunction isDivisibleBy8(n) {\n if (n.length >= 3) {\n var lastThree = parseInt(n.slice(n.length - 3), 10);\n if (lastThree % 8 === 0) {\n return true;\n }\n return false;\n }\n var remainder = parseInt(n, 10) % 8;\n return remainder === 0;\n}\n\nfunction resolve(n) {\n if (n.length === 0) {\n return null;\n }\n if (memo[n] === null) {\n return null;\n }\n if (isDivisibleBy8(n)) {\n return n;\n }\n if (n.length >= 3) {\n var arr = n.split('');\n for (var i = 1; i < 4; i++) {\n var sub = arr\n .slice(0, n.length - i)\n .concat(arr.slice(n.length - i + 1))\n .join('');\n var res = resolve(sub);\n if (res !== null) {\n return res;\n }\n }\n }\n if (n.length === 2) {\n if (n[0] === '8' || n[1] === '8') {\n return '8';\n }\n if (n[0] === '0' || n[1] === '0') {\n return '0';\n }\n }\n memo[n] = null;\n return null;\n}\n\nconst k = readline();\n\nconst result = resolve(k);\n\nprint(result === null ? 'NO' : 'YES\\n' + result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3a88064796dd7d864439ca00e9b9f111", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const memo = {};\n\nfunction isDivisibleBy8(n) {\n if (n.length >= 3) {\n var lastThree = parseInt(n.slice(n.length - 3), 10);\n if (lastThree % 8 === 0) {\n return true;\n }\n return false;\n }\n var remainder = parseInt(n, 10) % 8;\n return remainder === 0;\n}\n\nfunction resolve(n) {\n if (memo[n] === null) {\n return null;\n }\n if (isDivisibleBy8(n)) {\n return n;\n } else {\n var arr = n.split('');\n for (var i = 0; i < arr.length; i++) {\n var sub = arr\n .slice(0, i)\n .concat(arr.slice(i + 1))\n .join('');\n var res = resolve(sub);\n if (res !== null) {\n return res;\n }\n }\n memo[n] = null;\n return null;\n }\n}\n\nconst k = readline();\n\nconst result = resolve(k);\n\nprint(result === null ? 'NO' : 'YES\\n' + result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "02322798526a60d132d0c811a664bb31", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const memo = {};\n\nfunction isDivisibleBy8(n) {\n if (n.length >= 3) {\n var lastThree = parseInt(n.slice(n.length - 3), 10);\n if (lastThree % 8 === 0) {\n return true;\n }\n return false;\n }\n var remainder = parseInt(n, 10) % 8;\n return remainder === 0;\n}\n\nfunction resolve(n) {\n if (memo[n] === null) {\n return null;\n }\n if (isDivisibleBy8(n)) {\n return n;\n } else {\n var arr = n.split('');\n for (var i = 1; i < 4; i++) {\n var sub = arr\n .slice(0, n.length - i)\n .concat(arr.slice(n.length - i + 1))\n .join('');\n var res = resolve(sub);\n if (res !== null) {\n return res;\n }\n }\n memo[n] = null;\n return null;\n }\n}\n\nconst k = readline();\n\nconst result = resolve(k);\n\nprint(result === null ? 'NO' : 'YES\\n' + result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "70f1ef4a9e72284d57c2026afb2020e9", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const memo1 = Array(100000);\nconst memo2 = Array(100000);\n\nfunction check(arr) {\n var k = 0;\n for (var i = arr.length - 1; i >= 0; i--) {\n if (!memo1[arr[i]]) {\n memo1[arr[i]] = true;\n k++;\n }\n memo2[i] = k;\n }\n}\n\nfunction resolve(arr, ls) {\n check(arr);\n for (var i = 0; i < ls.length; i++) {\n print(memo2[ls[i] - 1]);\n // console.log(memo2[ls[i] - 1]);\n }\n}\n\n/*\nconst arr = '1 2 3 4 1 2 3 4 100000 99999'.split(' ');\nconst l = '1 2 3 4 5 6 7 8 9 10'.split(' ');\n\nresolve(arr, l);\n*/\n\nconst p = readline().split(' ');\nconst m = parseInt(p[1], 10);\nconst arr = readline().split(' ');\nconst ls = [];\n\nfor (var i = 0; i < m; i++) {\n var l = readline();\n ls.push(l);\n}\n\nresolve(arr, ls);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3516696ea74d9524fc9c75889d985ba8", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "const memo = {};\n\nfunction isDivisibleBy8(n) {\n if (n.length >= 3) {\n var lastThree = parseInt(n.slice(n.length - 3), 10);\n if (lastThree % 8 === 0) {\n return true;\n }\n return false;\n }\n var remainder = n % 8;\n return remainder === 0;\n}\n\nfunction resolve(n) {\n if (memo[n] === null) {\n return null;\n }\n if (isDivisibleBy8(n)) {\n return n;\n } else {\n var arr = n.split('');\n for (var i = 0; i < arr.length; i++) {\n var sub = arr\n .slice(0, i)\n .concat(arr.slice(i + 1))\n .join('');\n var res = resolve(sub);\n if (res !== null) {\n return res;\n }\n }\n memo[n] = null;\n return null;\n }\n}\n\nconst k = readline();\n\nconst result = resolve(k);\n\nprint(result === null ? 'NO' : 'YES\\n' + result);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7d8a4189d7b5767294a28a0724b0e489", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var count = parseInt(readline());\nvar inputList = readline().split(\" \").map(function (x) { return parseInt(x); });\nvar res = 0;\nfor (var i = 1; i < count; ++i) {\n if (inputList[i] + inputList[i - 1] === 5) {\n print(\"Infinite\");\n break;\n }\n else if (inputList[i] + inputList[i - 1] === 4) {\n res += 4;\n }\n else if (i > 1 && inputList[i - 2] === 3) {\n res += 2;\n }\n else {\n res += 3;\n }\n}\nif (i === count) {\n print(\"Finite\");\n print(res);\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "19dc7ac11894533d778a6df8e00027dd", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "var ip = readline().split(' ').map(Number);\nvar n = ip[0], k= ip[1];\nif (k <= n){\n print(Math.floor((k-1)/2));\n} else if ((k+1)/2 <= n){\n print(Math.floor((n-(k-n)+1)/2));\n}else\nprint(0)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "1a89e60e77f849a0190209ec74ff2b6a", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "//Solved by RuX\nvar _0x4fdd=['line','exec','index','lastIndex','floor','createInterface','stdin','stdout'];(function(_0x2b23ce,_0x1f3085){var _0x2ac399=function(_0x39796d){while(--_0x39796d){_0x2b23ce['push'](_0x2b23ce['shift']());}};_0x2ac399(++_0x1f3085);}(_0x4fdd,0x1ed));var _0x891b=function(_0x1c3df1,_0x44e524){_0x1c3df1=_0x1c3df1-0x0;var _0x5b31e0=_0x4fdd[_0x1c3df1];return _0x5b31e0;};var readline=require('readline');var rl=readline[_0x891b('0x0')]({'input':process[_0x891b('0x1')],'output':process[_0x891b('0x2')]});var readString='';var ___c=0x0;rl['on'](_0x891b('0x3'),function(_0x56c738){___c+=0x1;if(___c==0x1){readString=_0x56c738;rl['close']();var _0x503784=parse(readString,0x2);console['log'](result(parseInt(_0x503784[0x0]),parseInt(_0x503784[0x1])));}});function parse(_0x2c642c,_0x5b2db2){var _0x50927a=[];var _0x5eda5e=/\\d+/gm;var _0x245740=_0x2c642c;var _0xfb3210;var _0x2940ba=0x0;while((_0xfb3210=_0x5eda5e[_0x891b('0x4')](_0x245740))!==null){if(_0xfb3210[_0x891b('0x5')]===_0x5eda5e['lastIndex']){_0x5eda5e[_0x891b('0x6')]++;}if(_0x2940ba==_0x5b2db2){break;}_0x50927a[_0x2940ba]=_0xfb3210[0x0];_0x2940ba+=0x1;}return _0x50927a;}function result(_0x29a132,_0x1aea3a){var _0x22dd2e=_0x29a132>_0x1aea3a?_0x1aea3a:_0x29a132;_0x22dd2e=_0x29a132>=_0x1aea3a?_0x22dd2e-0x1:_0x22dd2e;var _0x301f27=_0x1aea3a-_0x29a132;_0x301f27=_0x301f27<=0x0?0x1:_0x301f27>=_0x29a132?_0x29a132:_0x301f27;return Math[_0x891b('0x7')]((_0x22dd2e-_0x301f27+0x1)/0x2);}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d786d52374c57699f227144852bdbef0", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "\nfunction main() {\n const is = new Scanner();\n const [n, k] = is.nextArray(Number);\n let answer = Math.trunc((k - 1) / 2);\n if (k > n)\n answer = Math.max(0, answer - (k - n - 1));\n console.log(answer);\n}\n\n\n/*\n * Api Scanner\n */\nclass Scanner {\n constructor() {\n this.index = -1;\n this.lines = stdinInput.trim().split('\\n'); // eslint-disable-line\n }\n\n nextLine() {\n this.index += 1;\n return this.lines[this.index].trim();\n }\n\n nextInt() {\n return parseInt(this.nextLine(), 10);\n }\n\n nextDouble() {\n return parseFloat(this.nextLine());\n }\n\n nextArray(fn) {\n const array = this.nextLine().split(' ');\n return fn === String ? array : array.map(fn);\n }\n\n hasNext() {\n return this.index < this.lines.length;\n }\n}\n\nlet stdinInput = '';\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\nprocess.stdin.on('data', (input) => { stdinInput += input; });\nprocess.stdin.on('end', () => { main(); });\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b3f5279b3858a82fe1cba655938b2ba7", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "Node.js", "source_code": "var readline = require('readline');\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar templateString = \"\"\n\nvar c = 0;\nrl.on('line', function (line) {\n c += 1;\n if (c == 1) {\n templateString = line;\n rl.close();\n var _p = parse(templateString, 2)\n console.log(result(parseInt(_p[0]), parseInt(_p[1])));\n }\n});\n\nfunction parse(template, iLoop) {\n var out=[]\n var regex = /\\d+/gm;\n var str = template;\n var m;\n var c = 0;\n while ((m = regex.exec(str)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n if (c==iLoop) {break}\n out[c] = m[0];\n c+=1;\n }\n return out;\n}\n\nfunction result(n,k) {\n if (k-n>=n) {return 0};\n if (k-n==n-1) {return 1};\n if (k-n==1) {return Math.floor(k / 2)};\n}\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "48158b879beb1d48b87a29e0839cbcc0", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": " \n var tmp = readline().split(' ').map(x => parseInt(x));\n var n = tmp[0];\n var m = tmp[1];\n var l = readline().split(' ').map(x => parseInt(x));\n var res = new Array(n + 1).fill(-1);\n var used = [];\n var fail = false;\n for(var i = 1; i < m && ! fail; i += 1) {\n var x = ((l[i] - l[i - 1]) + n + n) % n;\n if(x === 0) {\n x = n;\n }\n if(used.indexOf(x) !== -1 && x !== n) {\n fail = true;\n }\n if(used.indexOf(x) === -1) {\n used.push(x);\n }\n if(res[l[i - 1]] !== -1 && x !== n) {\n fail = true;\n }\n res[l[i - 1]] = x;\n }\n for(var i = 1; i <= n && ! fail; i += 1) {\n if(res[i] === -1) {\n for(var j = 1; j <= n; j += 1) {\n if(used.indexOf(j) === -1) {\n res[i] = j;\n used.push(j);\n break;\n }\n }\n }\n }\n print(fail ? -1 : res.slice(1).join(' '));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c087371588ecee298ad2777f362aaaab", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "\n var tmp = readline().split(' ').map(x => parseInt(x));\n var n = tmp[0];\n var m = tmp[1];\n var l = readline().split(' ').map(x => parseInt(x));\n var res = new Array(n).fill(-1);\n var used = [];\n var fail = false;\n for(var i = 1; i < m && ! fail; i += 1) {\n var x = ((l[i] - l[i - 1]) + n + n) % n;\n if(x === 0) {\n x = n;\n }\n if(used.indexOf(x) !== -1) {\n fail = true;\n }\n used.push(x);\n if(res[l[i - 1]] !== -1 && x !== n) {\n fail = true;\n }\n res[l[i - 1]] = x;\n }\n for(var i = 1; i <= n && ! fail; i += 1) {\n if(res[i] === -1) {\n for(var j = 1; j <= n; j += 1) {\n if(used.indexOf(j) === -1) {\n res[i] = j;\n used.push(j);\n }\n }\n }\n }\n print(fail ? -1 : res.slice(1).join(' '));\n \n ", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e6d4bb1c7a5dda84ee46e3f13bc381c7", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": " \n var tmp = readline().split(' ').map(x => parseInt(x));\n var n = tmp[0];\n var m = tmp[1];\n var l = readline().split(' ').map(x => parseInt(x));\n var res = new Array(n + 1).fill(-1);\n var used = [];\n var fail = false;\n for(var i = 1; i < m && ! fail; i += 1) {\n var x = ((l[i] - l[i - 1]) + n + n) % n;\n if(x === 0) {\n x = n;\n }\n if(used.indexOf(x) === -1) {\n used.push(x);\n }\n if(res[l[i - 1]] !== -1 && x !== res[l[i - 1]]) {\n fail = true;\n }\n res[l[i - 1]] = x;\n }\n var used2 = [];\n for(var i = 1; i <= n; i += 1) {\n if(res[i] !== -1) {\n if(used2.indexOf(res[i]) === -1) {\n used2.push(res[i]);\n } else {\n fail = true;\n }\n }\n }\n for(var i = 1; i <= n && ! fail; i += 1) {\n if(res[i] === -1) {\n for(var j = 1; j <= n; j += 1) {\n if(used.indexOf(j) === -1) {\n res[i] = j;\n used.push(j);\n break;\n }\n }\n }\n }\n print(fail ? -1 : res.slice(1).join(' '));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "61236590c998fe4eca76e00f08aaddd7", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "var N = parseInt(readline());\nvar ar = readline().split(' ').map(function(a) {return parseInt(a);});\nar.sort(function(a, b) { return a-b;});\n\nvar sum = 0;\nfor (var i = 0; i < ar.length; i++) {\n sum += ar[i];\n}\n\nvar r = 0;\nvar navg = Math.round( sum / ar.length );\n\nfor (var i = 0; i < ar.length && navg < 5; i++) {\n sum -= ar[i];\n sum += 5;\n navg = Math.round( sum / ar.length );\n r++;\n}\n\nprint(r);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9c4bc99c80c67f01b01314221868cf07", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nvar readline = require('readline');\r\n\r\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\r\n\r\nvar readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);\r\n\r\nasync function solve(read) {\r\n const rn = async () => Number(await read());\r\n const n = await rn();\r\n const check = m => {\r\n let ans = Math.floor((m - 1) / 2) + Math.floor(m / 4) - 1;\r\n return ans >= n;\r\n };\r\n let l = 3,\r\n r = 10 ** 12;\r\n while (l < r) {\r\n const m = Math.floor((l + r) / 2);\r\n if (check(m)) {\r\n r = m;\r\n } else {\r\n l = m + 1;\r\n }\r\n }\r\n return l;\r\n}\r\n\r\nasync function main(r) {\r\n try {\r\n let t = 1;\r\n let res = new Array(t);\r\n for (let i = 0; i < t; i++) {\r\n res[i] = await solve(r);\r\n }\r\n return res.join('\\n');\r\n } catch (error) {\r\n console.log('zdebug' + error);\r\n }\r\n}\r\n\r\nconst rl = readline__default[\"default\"].createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\nconst it = rl[Symbol.asyncIterator]();\r\nasync function read() {\r\n return (await it.next()).value;\r\n}\r\nvoid async function () {\r\n const output = await main(read);\r\n process.stdout.write(output);\r\n}();\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f121997285e949bf2ef0423804b3b123", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "Node.js", "source_code": "'use strict';\r\n\r\nvar readline = require('readline');\r\n\r\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\r\n\r\nvar readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);\r\n\r\nasync function solve(read) {\r\n const rn = async () => Number(await read());\r\n const n = await rn();\r\n const check = m => {\r\n let ans = Math.floor((m - 1) / 2);\r\n if (m > 4) ans += Math.floor(m / 4) - 1;\r\n return ans >= n;\r\n };\r\n let l = 3,\r\n r = 10 ** 12;\r\n while (l < r) {\r\n const m = Math.floor((l + r) / 2);\r\n if (check(m)) {\r\n r = m;\r\n } else {\r\n l = m + 1;\r\n }\r\n }\r\n return l;\r\n}\r\n\r\nasync function main(r) {\r\n try {\r\n let t = 1;\r\n let res = new Array(t);\r\n for (let i = 0; i < t; i++) {\r\n res[i] = await solve(r);\r\n }\r\n return res.join('\\n');\r\n } catch (error) {\r\n console.log('zdebug' + error);\r\n }\r\n}\r\n\r\nconst rl = readline__default[\"default\"].createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\nconst it = rl[Symbol.asyncIterator]();\r\nasync function read() {\r\n return (await it.next()).value;\r\n}\r\nvoid async function () {\r\n const output = await main(read);\r\n process.stdout.write(output);\r\n}();\r\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c639287035de8bb451616bf02e298075", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var differentShiftsCount = function( s ) {\n var shitfs,\n i;\n shifts = new Set();\n s = s.split( \"\" );\n for ( i = 0; i < s.length; ++i ) {\n shifts.add( s.toString() );\n s.unshift(s.pop());\n }\n return shifts.size;\n};\n\nprint( differentShiftsCount ( readline() ) );", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "48114aab9be958b9edefc91f7bea5b93", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "(function main(){\n //http://codeforces.com/problemset/problem/745/A\n var palabra = readline();\n\n var combinaciones = [palabra];\n for (var i = 0; i < palabra.length; i++) {\n palabra = palabra.substring(1) + palabra.charAt(0);\n if(combinaciones.indexOf(palabra) == -1){\n combinaciones.push(palabra);\n }\n }\n\n print(combinaciones.length);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "975723e20a3eac9007b7b129718a8764", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "//var print = require('./print');\n//var readline = require('./readline');\nvar n = parseInt(readline());\nvar sum = n + (n - 1);\nvar t = sum;\nvar k = 0;\nwhile(t){\n k++;\n t=parseInt(t/10);\n}\nvar cur = Math.pow(10,k-1) - 1;\nif(cur * 10 + 9 == sum){\n print(1);\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n //print(p);\n if(p <= (n+1)){\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans += 1 + parseInt((n+(n-1)-p)/2);\n }\n }\n print(ans);\n}\n/*\nvar cur = Math.pow(10,k-1) - 1;\nif(sum == cur * 10 + 9){\n print(1);\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n if(p <= (n+1)){\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans += (n+(n-1)-)\n }\n }\n}*/\n/*\nvar start = max - n;\nif(n > max){\n start = n % Math.pow(10,k);\n}\nvar count = n - start + 1;\nvar ans = parseInt(count / 2);\nprint('n: ' + n);\nprint('max: ' + max);\nprint('start: ' + start);\nprint('count: ' + count);\nprint('ans: ' + ans)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eb9c558c9f4145b00b6c149e588b2256", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "//var print = require('./print');\n//var readline = require('./readline');\nvar n = parseInt(readline());\nvar t = n;\nvar k = 0;\nwhile(t){\n k++;\n t=parseInt(t/10);\n}\nif(n < 5 * Math.pow(10,k - 1)){\n k--;\n}\nvar target = 5 * Math.pow(10,k - 1);\nif(k == 0){\n print(parseInt(n/2));\n}\nelse{\n var target = 5 * Math.pow(10,k - 1);\n var ans = n - target + 1;\n var t = n;\n var k2 = 0;\n var allNine = true;\n while(t){\n k2++;\n if(parseInt(t/10)%9 != 0){\n allNine = false;\n }\n t=parseInt(t/10);\n }\n if(k2>k){\n ans --;\n }\n if(allNine){\n ans--;\n }\n print(ans);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a3eefa59ca7d97860e2b5ae20afc7d2d", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "//var print = require('./print');\n//var readline = require('./readline');\nvar n = parseInt(readline());\nvar sum = n + (n - 1);\nvar t = sum;\nvar k = 0;\nwhile(t){\n k++;\n t=parseInt(t/10);\n}\nvar cur = Math.pow(10,k-1) - 1;\nif(cur * 10 + 9 == sum){\n print(1);\n}\nelse if(n<5){\n if(n == 2)\n\t{\n\t\tprint(1);\n\t}\n\tif(n == 3)\n\t{\n\t\tprint(3);\n\t}\n\tif(n == 4)\n\t{\n\t\tprint(6);\n\t}\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n //print(p);\n if(p <= (n+1)){\n //print('v1')\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans +=1 + parseInt((n+(n-1)-p)/2);\n }\n\n //print(ans);\n }\n print(ans);\n}\n/*\nvar cur = Math.pow(10,k-1) - 1;\nif(sum == cur * 10 + 9){\n print(1);\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n if(p <= (n+1)){\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans += (n+(n-1)-)\n }\n }\n}*/\n/*\nvar start = max - n;\nif(n > max){\n start = n % Math.pow(10,k);\n}\nvar count = n - start + 1;\nvar ans = parseInt(count / 2);\nprint('n: ' + n);\nprint('max: ' + max);\nprint('start: ' + start);\nprint('count: ' + count);\nprint('ans: ' + ans)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "a55d6ee9d87d81be3f7d92531f029423", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var print = require('./print');\nvar readline = require('./readline');\nvar n = parseInt(readline());\nvar sum = n + (n - 1);\nvar t = sum;\nvar k = 0;\nwhile(t){\n k++;\n t=parseInt(t/10);\n}\nvar cur = Math.pow(10,k-1) - 1;\nif(cur * 10 + 9 == sum){\n print(1);\n}\nelse if(n<5){\n if(n == 2)\n\t{\n\t\tprint(1);\n\t}\n\tif(n == 3)\n\t{\n\t\tprint(3);\n\t}\n\tif(n == 4)\n\t{\n\t\tprint(6);\n\t}\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n //print(p);\n if(p <= (n+1)){\n //print('v1')\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans +=1 + parseInt((n+(n-1)-p)/2);\n }\n\n //print(ans);\n }\n print(ans);\n}\n/*\nvar cur = Math.pow(10,k-1) - 1;\nif(sum == cur * 10 + 9){\n print(1);\n}\nelse{\n var ans = 0;\n for(var i=0;i<9;i++){\n var p = Math.pow(10,k-1) * i + cur;\n if(p <= (n+1)){\n ans += parseInt(p/2);\n }\n else if(p<=(n+(n-1))){\n ans += (n+(n-1)-)\n }\n }\n}*/\n/*\nvar start = max - n;\nif(n > max){\n start = n % Math.pow(10,k);\n}\nvar count = n - start + 1;\nvar ans = parseInt(count / 2);\nprint('n: ' + n);\nprint('max: ' + max);\nprint('start: ' + start);\nprint('count: ' + count);\nprint('ans: ' + ans)\n*/\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e4e01410b67517696b257ed0b7c80762", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "(function main() {\n var l = readline().split(' ');\n var n = parseInt(l[0]);\n var k = parseInt(l[1]);\n print(Math.max(0, 3 * n - k));\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "223e112a143aee237020658e87acc712", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "Node.js", "source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n const arr = d.split(' ').map(Number);\n arr.sort((a, b) => a - b);\n let ans = Math.max(0, arr[arr.length - 1] - 25);\n\n console.log(ans);\n\n c++;\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b39d8f5eb75c666bde257f5f796d2bcb", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "Node.js", "source_code": "//Don't have to see. start------------------------------------------\nvar read = require('readline').createInterface({\n\tinput: process.stdin, output: process.stdout\n});\nvar obj; var inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n\tobj = init(inLine);\n\tconsole.error('\\n\u2191\u5165\u529b \u2193\u51fa\u529b');\n\tMain();\n});\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n\treturn {\n\t\tlist : input, index : 0, max : input.length,\n\t\thasNext : function(){return (this.index < this.max);},\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u201aThere is no more input';}}\n\t};\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\n//param \"no\" is\n//unknown or outlier : return i. 1: parseInt.\n//2: split space. 4: split space and parseInt.\n//6: split 1 character. 7: split 1 character and parseInt.\n//8: join space. 9: join nextline. 0: join no character.\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\n\n//Don't have to see. end------------------------------------------\nfunction Main(){\n\tvar N = nextInt();\n\tvar list = nextIntArray();\n\tvar max = Math.max.apply(null, list);\n\tif(max <= 25){\n\t\tmyout(0);\n\t}else{\n\t\tmyout(max - 25);\n\t}\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2bfff1c497560e3c19d7b41d600e2e2b", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "JavaScript", "source_code": "function readNumbers() {\n\treturn readline().split(' ').map(function (x) {\n\t\treturn parseInt(x);\n\t});\n}\n\nvar k = parseInt(readline());\nvar r = readNumbers();\n\nvar decline = Math.max.apply(null, r) - 25;\n\nprint(\n\tdecline > 0\n\t\t? decline\n\t\t: 0\n);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "70c47aa8264034d8abb2dbf3d3cd72d3", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const [n, m] = lines[l++].trim().split(' ').map(Number)\n output[i] = solve(n, m) ? 'YES' : 'NO'\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n, m) {\n const s = n.toString(m)\n // console.log(s)\n const map = {}\n for (let i = 0; i < s.length; i++) {\n if (map[s[i]]) return false\n map[s[i]] = 1\n }\n return true\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6077bb4340fd9b8fdba17687b5443293", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "input = readline().split(' ');\nd = 0;\ntemp_year = year = parseInt(input[0]);\nwhile (true) {\n if (!(d % 7) && is_leap(year) == is_leap(temp_year) && d) {\n print(temp_year);\n break\n }\n temp_year++;\n d += (is_leap(temp_year) ? 366 : 365)\n}\n\nfunction is_leap(year) {\n return (!(year % 400) || (year % 100)) && !(year % 4)\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "dcfb6549c3cbd46c0840b2c58ba75a8f", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "//var input = \"WBWBWBWB\\nBWBBBWBW\\nBWBWBWBW\\nBWBWBWBW\\nWBWBWBWB\\nWBWBWBWB\\nBWBWBWBW\\nWBWBWBWB\";\n//var index = 0;\n//\n//function readline(){\n// var data = input.split('\\n');\n// if(index < data.length)\n// return data[index++];\n//}\n//\n//function print(output){\n// console.log(output);\n//}\n\nfunction test(str){\n for(var i = 1; i < str.length; i++){\n if(str.charAt(i) == str.charAt(i - 1))\n return false;\n }\n return true;\n}\n\nfunction main(){\n for(var i = 0; i < 8; i++){\n var str = readline();\n if(!test(str)){\n print('NO');\n return;\n }\n\n }\n print('YES');\n}\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0b6beaa5f9d8d815364d81dd1bc3e9ad", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "print(function() {\n\tvar i, ans = 'YES';\n\tfor (i = 0; i < 8; i++)\n\t\treadline().split('').reduce(function(a, b) {\n\t\t\tif (a === b) ans = 'NO';\n\t\t\treturn b;\n\t\t});\n\treturn ans;\n}());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "fce837eb31d4736844b578cfef2c7360", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nvar n = parseInt(line[0]);\nvar v = parseInt(line[1]);\nvar arr = readline().split(' ');\nvar a = [];\nvar cur = [];\nvar sum = 0;\nfor (var i = 0; i < arr.length; i ++)\n{\n a[i] = parseInt(arr[i]);\n cur[i] = a[i]%2===0?a[i]/2:parseInt(a[i]/2)+1;\n sum += cur[i];\n}\nif (sum > v)\n{\n print(-1);\n}\nelse\n{\n while(v-sum > 0)\n {\n var max = 0;\n var maxi = 0;\n for (var i = 0; i < a.length; i ++)\n {\n if (a[i] > max && cur[i]!=a[i])\n {\n max = a[i];\n maxi = i;\n }\n }\n var put = Math.min(Math.min(v-sum), (a[maxi]-cur[maxi]));\n cur[maxi]+=put;\n sum+=put;\n }\n \n print( cur.join(\" \") );\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9aa27f8e9570f63b7edaca8bbb144614", "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function solve() {\n var input = readline().split(' ');\n var n = +input[0];\n var w = +input[1];\n var a = readline().split(' ');\n for (var i = 0; i < a.length; i++) {\n a[i] = {\n val: a[i],\n id: i\n }\n }\n a.sort((a, b) => {\n a = +a.val;\n b = +b.val;\n if (a > b) {\n return 1;\n }\n if (a === b) {\n return 0;\n }\n return -1;\n });\n \n var ans = [];\n \n for (var i = 0; i < a.length; i++) {\n var val = Math.ceil(a[i].val / 2);\n if (val > w) {\n print(-1);\n return;\n }\n w -= val;\n ans[i] = val;\n }\n \n var i = ans.length - 1;\n while (w > 0) {\n var val = ans[i] + w;\n if (val > a[i].val) {\n val = a[i].val;\n }\n w -= (val - ans[i]);\n ans[i] = val;\n i--;\n }\n \n var tmp = Array.from(ans);\n \n for (var i = 0; i < n; i++) {\n ans[a[i].id] = tmp[i];\n }\n \n print(ans.join(' '));\n}\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e56c8ade4ab52f8bf3ac7b29a50d2d13", "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "function solve() {\n var input = readline().split(' ');\n var n = +input[0];\n var w = +input[1];\n var a = readline().split(' ');\n for (var i = 0; i < a.length; i++) {\n a[i] = {\n val: a[i],\n id: i\n }\n }\n a.sort((a, b) => {\n a = +a.val;\n b = +b.val;\n if (a > b) {\n return 1;\n }\n if (a === b) {\n return 0;\n }\n return -1;\n });\n \n var ans = [];\n \n for (var i = 0; i < a.length; i++) {\n var val = Math.ceil(a[i].val / 2);\n if (val > w) {\n print(-1);\n return;\n }\n w -= val;\n ans[i] = val;\n }\n \n if (w > 0) {\n ans[ans.length - 1] += w;\n }\n \n var tmp = Array.from(ans);\n \n for (var i = 0; i < n; i++) {\n ans[a[i].id] = tmp[i];\n }\n \n print(ans.join(' '));\n}\nsolve();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4913eea934c59cc556d16b83635ff394", "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "/* TEST CASE\ninput\n6\nURLLDR\noutput\n2\ninput\n4\nDLUU\noutput\n0\ninput\n7\nRLRLRLR\noutput\n12\n */\nfunction main() {\n\tvar n = parseInt(readline());\n\tvar s = readline();\n\tvar answer = 0;\n\t\n\tfor (var i = 0; i < n; i++) {\n\t\tvar x = 0;\n\t\tvar y = 0;\n\t\tfor (var j = i; j < n; j++) {\n\t\t\tswitch (s.charCodeAt(j)) {\n\t\t\t\tcase 0x55: //'U'\n\t\t\t\t\ty--;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x44: //'D'\n\t\t\t\t\ty++\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x4C: //'L'\n\t\t\t\t\tx--;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x52: //'R'\n\t\t\t\t\tx++;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (x == 0 && y == 0) {\n\t\t\t\tanswer++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprint(answer);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9a215f1bb01302312bbd82f2be4c9c13", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "/* TEST CASE\ninput\n6\nURLLDR\noutput\n2\ninput\n4\nDLUU\noutput\n0\ninput\n7\nRLRLRLR\noutput\n12\n */\nfunction main() {\n\tvar n = parseInt(readline());\n\tvar s = readline();\n\tvar answer = 0;\n\t\n\tfor (var i = 0; i < n; i++) {\n\t\tvar x = 0;\n\t\tvar y = 0;\n\t\tfor (var j = i; j < n; j++) {\n\t\t\tvar c = s.charCodeAt(j);\n\t\t\tif (c == 0x55 /*'U'*/) {\n\t\t\t\ty--;\n\t\t\t} else if (c == 0x44 /*'D'*/) {\n\t\t\t\ty++\n\t\t\t} else if (c == 0x4C /*'L'*/) {\n\t\t\t\tx--;\n\t\t\t} else if (c == 0x52 /*'R'*/) {\n\t\t\t\tx++;\n\t\t\t}\n\t\t\tif (x == 0 && y == 0) {\n\t\t\t\tanswer++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprint(answer);\n}\n\nmain();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "9f09c2fe551017742d116f1c1ff1107e", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var n = parseInt(readline());\nvar d = readline().split(' ').map(x => parseInt(x));\nvar largest = -Infinity;\nfor(var i = 0; i < n; i += 1) {\n largest = Math.max(d[i], largest);\n}\nprint(largest ^ d[n - 1]);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "16524ad7e81bd78eec7b482874ec6c08", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "const n = Number(readline());\nconst a = readline().split(\" \").slice(0, n).map(x => Number(x));\nprint(Math.max(...a) ^ a[n - 1]);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "da1326a1339f46dcc30f99b891c5dd36", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "\n///////////////////////////////////////////////////\n//http://codeforces.com/contest/1073/problem/D\nvar param = `5184`;\n\nparam = param.split('\\n');\nvar paramInd = 0;\n\nfunction readline() {\n return param[paramInd++]\n}\n\nfunction print(str) {\n console.log(str)\n}\n\nvar BigNum = {\n\n plus: function plus(number1, number2, minus1, minus2) {\n\n if (typeof number1 === 'number' && Math.abs(number1) < BigNum.limit2 &&\n typeof number2 === 'number' && Math.abs(number2) < BigNum.limit2)\n\n return number1 + number2;\n\n var result = [];\n\n var ranks1 = BigNum._getRanks(number1);\n var ranks2 = BigNum._getRanks(number2);\n\n if (minus1 === undefined) minus1 = ranks1.minus;\n if (minus2 === undefined) minus2 = ranks2.minus;\n\n\n if (!minus1) {\n if (minus2) {\n return BigNum.minus(ranks1, ranks2, false, false);\n }\n } else if (!minus2) {\n return BigNum.minus(ranks2, ranks1, false, false);\n } else {\n result.minus = true;\n }\n\n var maxRank = Math.max(ranks1.length, ranks2.length);\n for (var i = 0; i < maxRank; i++) {\n result[i] = (result[i] || 0)\n + (ranks1[i] || 0)\n + (ranks2[i] || 0);\n\n if (result[i] >= BigNum.limit) {\n result[i + 1] = 1;\n result[i] -= BigNum.limit;\n }\n }\n\n return result;\n },\n\n minus: function minus(number1, number2, minus1, minus2) {\n\n if (typeof number1 === 'number' && number1 < BigNum.limit2 &&\n typeof number2 === 'number' && number2 < BigNum.limit2)\n\n return number1 - number2;\n\n var result = [];\n\n var ranks1 = BigNum._getRanks(number1);\n var ranks2 = BigNum._getRanks(number2);\n\n if (minus1 === undefined) minus1 = ranks1.minus;\n if (minus2 === undefined) minus2 = ranks2.minus;\n\n\n if (!minus1) {\n if (minus2) {\n return BigNum.plus(ranks1, ranks2, false, false);\n }\n } else if (!minus2) {\n result = BigNum.plus(ranks1, ranks2, false, false);\n result.minus = true;\n return result;\n } else {\n return BigNum.minus(ranks2, ranks1, false, false);\n }\n\n var maxRank = Math.max(ranks1.length - 1, ranks2.length - 1);\n for (var i = maxRank; i >= 0; i--) {\n\n result[i] = (ranks1[i] || 0)\n - (ranks2[i] || 0);\n\n if (result[i] < 0) {\n if (result.minus === undefined) {\n result.minus = true;\n result[i] = -result[i];\n\n var swap = ranks1;\n ranks1 = ranks2;\n ranks2 = swap;\n } else {\n var j = i;\n do {\n result[j + 1] -= 1;\n result[j] += BigNum.limit;\n } while (result[++j] < 0);\n }\n } else if (result.minus === undefined && result[i] > 0) {\n result.minus = false;\n }\n }\n\n while(result[result.length - 1] === 0) {\n result.pop();\n }\n if (result.length < 3) {\n return BigNum.toInt(result);\n }\n\n return result;\n },\n\n multiply: function multiply(number1, number2) {\n\n if (typeof number1 === 'number' && number1 < BigNum.limit &&\n typeof number2 === 'number' && number2 < BigNum.limit)\n\n return number1 * number2;\n\n var result = [];\n\n var ranks1 = BigNum._getRanks(number1);\n var ranks2 = BigNum._getRanks(number2);\n\n for (var i = 0; i < ranks1.length; i++) {\n for (var j = 0; j < ranks2.length; j++) {\n var rank = i + j;\n var prod = ranks1[i] * ranks2[j];\n if (prod > BigNum.limit) {\n result[rank] = (result[rank] || 0)\n + prod % BigNum.limit;\n result[rank + 1] = (result[rank + 1] || 0)\n + Math.floor(prod / BigNum.limit);\n } else {\n result[rank] = (result[rank] || 0)\n + prod;\n }\n }\n }\n\n for (i = 0; i < result.length; i++) {\n if (result[i] > BigNum.limit) {\n result[i] -= BigNum.limit;\n result[i + 1] = (result[i + 1] || 0) + 1;\n }\n }\n\n result.minus = (ranks1.minus != ranks2.minus);\n return result;\n },\n\n divide: function divide(number1, number2) {\n\n if (typeof number1 === 'number' && number1 < BigNum.limit2 &&\n typeof number2 === 'number' && number2 < BigNum.limit2)\n\n return number1 / number2;\n\n var ranks1 = BigNum._getRanks(number1);\n var ranks2 = BigNum._getRanks(number2);\n\n var result = BigNum.toStr(ranks1) / BigNum.toStr(ranks2);\n return result;\n },\n\n ////////////////////////////////////////////////\n // comparision\n more: function more(number1, number2) {\n return BigNum.compare(number1, number2) > 0;\n },\n\n less: function less(number1, number2) {\n return BigNum.compare(number1, number2) < 0;\n },\n\n equal: function equal(number1, number2) {\n return BigNum.compare(number1, number2) === 0;\n },\n\n max: function max(number1, number2) {\n if(number2 !== undefined) {\n return BigNum.more(number1, number2) ? number1 : number2;\n }\n\n var numberArr = number1;\n var max = numberArr[0];\n\n for(var i = 1; i < numberArr.length; i++) {\n if(BigNum.more(numberArr[i], max)) {\n max = numberArr[i];\n }\n }\n\n return max;\n },\n\n min: function max(number1, number2) {\n if(number2 !== undefined) {\n return BigNum.compare(number1, number2) < 0 ? number1 : number2;\n }\n\n var numberArr = number1;\n var min = numberArr[0];\n\n for(var i = 1; i < numberArr.length; i++) {\n if(BigNum.compare(numberArr[i], min) < 0) {\n min = numberArr[i]\n }\n }\n\n return min;\n },\n\n compare: function compareNumbers(number1, number2) {\n var numberTypes = [typeof number1, typeof number2];\n\n if(numberTypes[0] === numberTypes[1]) {\n if(numberTypes[0] === 'number') {\n return number1 - number2;\n }\n } else {\n if (numberTypes[1] === 'number') {\n if (number1[2]) {\n return 1;\n }\n } else if (numberTypes[0] === 'number') {\n if(number2[2]) {\n return -1;\n }\n }\n }\n\n var ranks1 = BigNum._getRanks(number1);\n var ranks2 = BigNum._getRanks(number2);\n\n var diff;\n\n if(ranks1.minus !== ranks2.minus) {\n return !ranks1.minus > !ranks2.minus ? 1 : -1\n } else if(diff = ranks1.length - ranks2.length) {\n return diff;\n }\n\n for (var i = ranks1.length - 1; i >= 0; i--) {\n if(diff = ranks1[i] - ranks2[i]) {\n return diff;\n }\n }\n\n return 0;\n },\n\n toInt: function (number) {\n if (typeof number === 'object') {\n if(!number.length) return 0;\n else return +BigNum.toStr(number);\n }\n else return +number;\n },\n\n toStr: function (number) {\n\n if (typeof number === 'string') return number;\n else if(typeof number === 'number') return '' + number;\n\n var str = '';\n for (var i = 0; i < number.length - 1; i++) {\n str = ('000000' + number[i]).substr(-7) + str;\n }\n str = number[i] + str;\n return (number.minus ? '-' : '') + str;\n },\n\n getBig: function (number) {\n if (typeof number === 'string') {\n if (number.length < 16) return +number;\n }\n\n return BigNum._getRanks(number);\n },\n\n _getRanks: function (number) {\n\n if (typeof number === 'object') {\n return number;\n } else if (typeof number === 'number') {\n number = '' + number;\n }\n\n var ranks = [];\n if (number[0] === '-') {\n ranks.minus = true;\n number = number.substr(1);\n }\n\n if (number.length > 7) {\n\n number = '' + number;\n for (var i = 7; i <= number.length; i += 7) {\n ranks.push(+number.substr(-i, 7));\n }\n\n var rest = number.length % 7;\n if (rest) {\n ranks.push(+number.substr(0, rest));\n }\n\n } else {\n ranks.push(+number);\n }\n\n if (ranks[ranks.length - 1] < 0) {\n ranks[ranks.length - 1] = -ranks[ranks.length - 1];\n ranks.minus = true;\n }\n\n return ranks;\n },\n\n rand: function getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min)) + min;\n },\n\n /*runTests: function tests(count = 10) {\n var correct = 0;\n var values = [];\n for(var i = 0; i < count; i++) {\n var val1 = BigNum.rand(-999999999999999, 999999999999999);\n var val2 = BigNum.rand(-999999999999999, 999999999999999);\n\n var resBn = BigNum.plus(val1, val2);\n var resBnInt = BigNum.toInt(resBn);\n var res = val1 + val2;\n\n if(resBnInt !== res) {\n console.log('!!! ' + val1 + ' + ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.minus(val1, val2);\n resBnInt = BigNum.toInt(resBn);\n res = val1 - val2;\n\n if(resBnInt !== res) {\n console.log('!!! ' + val1 + ' - ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.divide(val1, val2);\n resBnInt = Math.round(resBn, 4);\n res = Math.round(val1 / val2, 4);\n\n if(resBnInt !== res) {\n console.log('!!! ' + val1 + ' / ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.more(val1, val2);\n res = val1 > val2;\n\n if(resBn !== res) {\n console.log('!!! ' + val1 + ' > ' + val2);\n console.log(' Bn: ' + resBn);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.less(val1, val2);\n res = val1 < val2;\n\n if(resBn !== res) {\n console.log('!!! ' + val1 + ' < ' + val2);\n console.log(' Bn: ' + resBn);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.equal(val1, val2);\n res = val1 === val2;\n\n if(resBn !== res) {\n console.log('!!! ' + val1 + ' === ' + val2);\n console.log(' Bn: ' + resBn);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n resBn = BigNum.equal(val1, val1);\n res = val1 === val1;\n\n if(resBn !== res) {\n console.log('!!! ' + val1 + ' === ' + val1);\n console.log(' Bn: ' + resBn);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n var resBn = BigNum.max(val1, val2);\n var resBnInt = BigNum.toInt(resBn);\n var res = Math.max(val1, val2);\n\n if(resBnInt !== res) {\n console.log('!!! max ' + val1 + ', ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n var resBn = BigNum.min(val1, val2);\n var resBnInt = BigNum.toInt(resBn);\n var res = Math.min(val1, val2);\n\n if(resBnInt !== res) {in\n console.log('!!! min ' + val1 + ', ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n var val3 = BigNum.rand(-999999999999999, 999999999999999);\n var resBn = BigNum.max([val1, val2, val3]);\n var resBnInt = BigNum.toInt(resBn);\n var res = Math.max(val1, val2, val3);\n\n if(resBnInt !== res) {\n console.log('!!! max ' + val1 + ', ' + val2 + ', ' + val3);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n var resBn = BigNum.min([val1, val2, val3]);\n var resBnInt = BigNum.toInt(resBn);\n var res = Math.min(val1, val2, val3);\n\n if(resBnInt !== res) {\n console.log('!!! min ' + val1 + ', ' + val2 + ', ' + val3);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n val1 = BigNum.rand(-99999999, 99999999);\n val2 = BigNum.rand(-9999999, 9999999);\n\n resBn = BigNum.multiply(val1, val2);\n resBnInt = BigNum.toInt(resBn);\n res = Math.round(val1 * val2, 4);\n\n if(resBnInt !== res) {\n console.log('!!! ' + val1 + ' * ' + val2);\n console.log(' Bn: ' + resBnInt);\n console.log(' Nm: ' + res);\n } else {\n correct++;\n }\n\n }\n console.log('correct:' + correct);\n\n\n },*/\n /*runTimeTests: function timeTests(count = 10000, ranks = 15) {\n\n var max = Math.pow(10, ranks);\n\n var values = [];\n for(var i = 0; i < count; i++) {\n var val1 = BigNum.rand(-max, max);\n var val2 = BigNum.rand(-max, max);\n\n values.push([val1, val2]);\n }\n\n var testF = function (funcs, operation) {\n var results = [];\n for(var f = 0; f < 2; f++) {\n var func = funcs[f];\n var t = performance.now();\n for(var i = 0; i < count; i++) {\n res = func(values[i][0], values[i][1]);\n }\n results[f] = Math.floor(performance.now() - t);\n }\n\n console.log('test ' + operation + ': diff ' + (results[1] - results[0]));\n }\n\n var testsFuncs = {\n plus: [\n (val1, val2) => val1 + val2,\n (val1, val2) => BigNum.plus(val1, val2),\n ],\n\n minus: [\n (val1, val2) => val1 - val2,\n (val1, val2) => BigNum.minus(val1, val2),\n ],\n\n divide: [\n (val1, val2) => val1 / val2,\n (val1, val2) => BigNum.divide(val1, val2),\n ],\n\n miltiply: [\n (val1, val2) => val1 * val2,\n (val1, val2) => BigNum.multiply(val1, val2),\n ],\n };\n\n for(k in testsFuncs) {\n testF(testsFuncs[k], k);\n }\n },*/\n\n limit: 10000000,\n limit2: 100000000000000,\n}\n\nfunction rand(min, max) {\n return Math.floor(Math.random() * (max - min)) + min;\n}\n\n/////////////////////////////////////////\n// CODE START\n\n//1. Reading data\n\nvar n = readline();\nvar actions = 0;\nvar multiply = 0;\nwhile (true) {\n var square = Math.sqrt(n);\n if (square !== Math.round(square)) {\n var start = Math.ceil(square);\n var step = 2 - n % 2;\n start += start % step;\n\n var finish = n / (4 - step);\n\n for (var i = start; i <= finish; i += step) {\n if (Math.pow(i, 2) % n === 0) break;\n }\n if (i <= n / 2) {\n actions += 1;\n multiply = 1;\n n = i;\n } else {\n break;\n }\n } else {\n actions += 1;\n n = square;\n }\n}\n\nprint('' + n + ' ' + (actions + multiply));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "052c8dcfff6957a50e978dd2442bf246", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var n = readline();\nvar actions = 0;\nwhile (true) {\n var square = Math.sqrt(n);\n if (square !== Math.round(square)) {\n var step = 2 - n % 2;\n\n for (var i = 2; i < square; i += step) {\n if (n % i === 0) {\n var div = n / i;\n if(n % 2 || div % 2 === 0) break;\n } \n }\n if (i < square) {\n actions += 2;\n n = n / i;\n } else {\n break;\n }\n } else {\n actions += 1;\n n = square;\n }\n}\n\nprint('' + n + ' ' + actions);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "ffed84ca9e8d97959a9a51e6b3d6d6a9", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "function getSimpleDividers(num) {\n\n var dividersMap = {};\n var dividers = [];\n\n var sqrt = Math.sqrt(num), i = 2;\n while(i <= sqrt) {\n if(num % i === 0) {\n if(!(i in dividersMap)) {\n dividersMap[i] = 1;\n dividers.push(i);\n }\n\n sqrt = Math.sqrt(num = num / i);\n } else {\n i++;\n }\n }\n\n if(!(num in dividersMap)) dividers.push(num);\n\n return dividers;\n}\n\nfunction doTask(num) {\n var cnt = 0;\n\n var product = 1;\n var divs = getSimpleDividers(num);\n\n for(var i = 0; i < divs.length; i++) product *= divs[i];\n if(product !== num) {\n cnt += 2;\n }\n\n var p = product;\n while((p *= p) % num !== 0) cnt++;\n\n print('' + product + ' ' + cnt);\n}\n\ndoTask(+readline());", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "80ba4b87e0434bbd2326052454ff1473", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "var Axy = readline(); Axy = Axy.split(\" \"); Axy[0] = parseInt(Axy[0]); Axy[1] = parseInt(Axy[1]); \nvar Bxy = readline(); Bxy = Bxy.split(\" \"); Bxy[0] = parseInt(Bxy[0]); Bxy[1] = parseInt(Bxy[1]);\nvar Cxy = readline(); Cxy = Bxy.split(\" \"); Cxy[0] = parseInt(Cxy[0]); Cxy[1] = parseInt(Cxy[1]);\nif((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) == 0){print(\"TOWARDS\");}\nelse if((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) < 0){print(\"LEFT\");}\nelse if((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) > 0){print(\"RIGHT\");}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "aae4c10d281ac6e46284b7b08b67d1b9", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "write(parseInt(readline() / 2520))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "916900cf9bb9daabe29752d780fe6bc1", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n const [ils] = ipt.split(EOL).slice(0, -1)\n const [a, b, c, d, e, f] = ils.split(' ')\n if (b == 0 || d == 0 || f == 0) return console.log('Hermione')\n if (a == 0 || c == 0 || e == 0) return console.log('Ron')\n console.log(1 / a * b / c * d / e * f <= 1 ? 'Hermione' : 'Ron')\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d148886eb58a12c786314a7fbaf769e5", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "// sand a grams -> b grams lead\n\t// lead c grams -> d grams gold\n\t// gold e grams -> f grams sand\n\t// a : b, c : d, e : f\n\t// s : 125, l : 250, g : 150\n\t// 0 : stol, 1 : ltog, 2 : gtos\n\tvar inputs = readline().split(/\\s/gi).map(Number),\n\t\tstol = inputs[1] / inputs[0], ltog = inputs[3] / inputs[2], gtos = inputs[5] / inputs[4],\n\t\tstol = { 'rate' : 'stol', 'value' : isNaNCheck(stol) },\n\t\tltog = { 'rate' : 'ltog', 'value' : isNaNCheck(ltog) },\n\t\tgtos = { 'rate' : 'gtos', 'value' : isNaNCheck(gtos) },\n\t\tturn = [],\n\t\trates = [ stol.value, ltog.value, gtos.value ],\n\t\tmaxRates = stol.value,\n\t\tinit = 1000, send = 0, lead = 0, gold = 0, first = 0;\n\t\n\trates.forEach(function(rate, index)\t{\n\t\tif(rate >= maxRates)\t{\n\t\t\tmaxRates = rate;\n\t\t\t\n\t\t\tswitch(index)\t{\n\t\t\t\tcase 0 :\n\t\t\t\t\tsend = init;\n\t\t\t\t\tturn = [];\n\t\t\t\t\tturn.push(stol);\n\t\t\t\t\tturn.push(ltog);\n\t\t\t\t\tturn.push(gtos);\n\t\t\t\t\tfirst = 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1 :\n\t\t\t\t\tlead = init;\n\t\t\t\t\tturn = [];\n\t\t\t\t\tturn.push(ltog);\n\t\t\t\t\tturn.push(gtos);\n\t\t\t\t\tturn.push(stol);\n\t\t\t\t\tfirst = 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2 :\n\t\t\t\t\tgold = init;\n\t\t\t\t\tturn = [];\n\t\t\t\t\tturn.push(gtos);\n\t\t\t\t\tturn.push(stol);\n\t\t\t\t\tturn.push(ltog);\n\t\t\t\t\tfirst = 2;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n\t\n\tcheckLoop(init, turn);\n\t\n\tfunction checkLoop(init, turn)\t{\n\t\tvar loopValue = init;\n\t\t\n\t\tturn.forEach(function(rate)\t{\n\t\t\t//console.log(rate);\n\t\t\tloopValue *= rate.value;\n\t\t\t//console.log(loopValue);\n\t\t});\n\t\t\n\t\t//console.log(loopValue, init);\n\t\t\n\t\tif(!isFinite(loopValue))\tprint('Ron');\n\t\telse if(loopValue > init) \tprint('Ron');\n\t\telse\tprint('Hermione');\n\t}\n\t\n\tfunction isNaNCheck(value)\t{\n\t\treturn isNaN(value) ? 0 : value;\n\t}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "800d701ea15373a5917cb7330153011e", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n const [ils] = ipt.split(EOL).slice(0, -1)\n const [a, b, c, d, e, f] = ils.split(' ')\n\n if (c == 0 && d > 0) return console.log('Ron')\n if (b == 0 || d == 0 || f == 0) return console.log('Hermione')\n if (a == 0 || c == 0 || e == 0) return console.log('Ron')\n console.log(1 / a * b / c * d / e * f <= 1 ? 'Hermione' : 'Ron')\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0f494feaaa9f8fe45ab79bce65d95603", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "function ProblemSolver() {\n this.HAS_TEST_CASES = false;\n this.INPUT_FILE_NAME = \"test.in\";\n this.OUTPUT_FILE_NAME = \"out.txt\";\n this.DO_OUTPUT_TO_FILE = false;\n this.CLEAR_ARRAY_PER_CASE = false;\n\n this.solveCase = function() {\n var res , i , j , fl , cn , temp , lim , mask , mi , ma , tot ;\n res = 0 ;\n lim = ( 1 << this.n ) ;\n for( i = 0 ; i < lim ; i++ ) {\n \tmask = i ;\n \ttot = 0 ;\n \tmi = 1000000000000 ;\n \tma = -1 ;\n \tfor( j = 0 ; j < this.n ; j++ ) {\n \t\tif( ( mask & ( 1 << j ) ) != 0 ) {\n \t\t\tmi = Math.min( mi , this.arr[ j ] ) ;\n \t\t\tma = Math.max( ma , this.arr[ j ] ) ;\n \t\t\ttot += this.arr[ j ] ;\n \t\t}\n \t}\n \tif( tot >= this.l && tot <= this.r && ma - mi >= this.x ) {\n \t\tres++ ;\n \t}\n }\n print( res );\n };\n\n this.init = function() {\n this.lim1 = 100010;\n this.lim2 = 110;\n this.cc = 1;\n this.ind = 1;\n this.n = 0;\n this.cn = 0;\n this.declareAndFillArrays();\n };\n\n this.getInput = function( irObj ) {\n var hasMoreInput , i;\n hasMoreInput = true;\n try {\n this.n = irObj.nextInt();\n this.l = irObj.nextInt();\n this.r = irObj.nextInt();\n this.x = irObj.nextInt();\n this.arr = [] ;\n for( i = 0 ; i < this.n ; i++ ) {\n this.arr.push( irObj.nextInt() ) ;\n }\n }\n catch( ex ) {\n hasMoreInput = false;\n }\n return hasMoreInput;\n };\n\n this.clearArraysPerCase = function() {\n var i;\n this.arr = new Array();\n this.adjList = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.arr.push( 0 );\n this.adjList.push( new Array() );\n }\n };\n\n this.clearPerCase = function() {\n this.cn = 0;\n this.cc++;\n if( this.CLEAR_ARRAY_PER_CASE == true ) {\n this.clearArraysPerCase() ;\n }\n };\n\n this.declareAndFillArrays = function() {\n var i , j;\n this.srr = new Array();\n this.vis = new Array();\n this.arr = new Array();\n this.brr = new Array();\n this.memo = new Array();\n this.done = new Array();\n this.adjList = new Array();\n for( i = 0 ; i < this.lim1 ; i++ ) {\n this.srr.push( \"\" );\n this.vis.push( 0 );\n this.arr.push( 0 );\n this.brr.push( 0 );\n this.adjList.push( new Array() );\n }\n for( i = 0 ; i < this.lim2 ; i++ ) {\n this.memo.push( new Array() );\n this.done.push( new Array() );\n for( j = 0 ; j < this.lim2 ; j++ ) {\n this.memo[ i ].push( -1 );\n this.done[ i ].push( 0 );\n }\n }\n };\n\n this.init();\n}\n\nfunction InputReader() {\n var self = this ;\n this.allLines = new Array();\n this.currrentLineNumber = 0;\n this.currrentCharacterIndex = 0;\n this.callBackFunction = null ;\n this.parentContext = null ;\n\n this.readAllLines = function() {\n var singleLine;\n while( true ) {\n try {\n singleLine = readline();\n if( singleLine == null ) {\n break;\n }\n }\n catch( ex ) {\n break;\n }\n this.allLines.push( singleLine );\n }\n };\n \n this.readAllLinesFromRhino = function() {\n var brObj , line ;\n importPackage( java.io ) ;\n importPackage( java.lang ) ;\n brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;\n this.allLines = [] ;\n while( true ) {\n line = brObj.readLine() ;\n if( line == null ) {\n break;\n }\n this.allLines.push( line ) ;\n }\n };\n \n this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {\n self.chunkData += chunk ;\n };\n\n this.readEndFromNodeJsJudgeServer = function() {\n self.parseRawData( self.chunkData ) ;\n self.parentContext.runCases() ;\n };\n \n this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {\n this.parentContext = parentContext ;\n process.stdin.resume() ;\n process.stdin.setEncoding( 'utf8' ) ;\n this.chunkData = '' ;\n process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;\n process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;\n };\n\n this.parseRawData = function( data ) {\n var len , i , currentString;\n len = data.length;\n currentString = \"\";\n this.allLines = [] ;\n for( i = 0 ; i < len ; i++ ) {\n if( data[ i ] == '\\r' ) {\n }\n else if( data[ i ] == '\\n' ) {\n this.allLines.push( currentString );\n currentString = \"\";\n }\n else {\n currentString += data[ i ];\n }\n }\n if( currentString != \"\" ) {\n this.allLines.push( currentString );\n }\n };\n\n this.readAllLinesFromFile = function( inputFileName ) {\n var currentDirectory , fsObj , inputFilePath , rawData;\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n inputFilePath = currentDirectory + \"\\\\\" + inputFileName;\n rawData = fsObj.readFileSync( inputFilePath , \"utf8\" );\n this.parseRawData( rawData );\n };\n\n this.next = function( flag ) {\n var len , i , startIdx , res , endIdx;\n if( flag == 0 ) {\n if( this.currrentCharacterIndex != 0 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n res = \"\";\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;\n }\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n return res;\n }\n while( true ) {\n if( this.currrentLineNumber >= this.allLines.length ) {\n throw new Error( \"No more tokens available!\" );\n }\n startIdx = -1;\n len = this.allLines[ this.currrentLineNumber ].length;\n if( typeof( len ) == 'function' ) {\n len = this.allLines[ this.currrentLineNumber ].length() ;\n }\n for( i = this.currrentCharacterIndex ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {\n startIdx = i;\n break;\n }\n }\n if( startIdx == -1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n continue;\n }\n res = \"\";\n endIdx = len - 1 ;\n for( i = startIdx ; i < len ; i++ ) {\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {\n endIdx = i;\n break;\n }\n if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {\n res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;\n }\n else {\n res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );\n }\n }\n this.currrentCharacterIndex = endIdx;\n if( endIdx == len - 1 ) {\n this.currrentLineNumber++;\n this.currrentCharacterIndex = 0;\n }\n return res;\n }\n };\n\n this.nextInt = function() {\n return parseInt( this.next( 1 ) );\n };\n\n this.nextDouble = function() {\n return parseFloat( this.next( 1 ) );\n };\n\n this.nextString = function() {\n return this.next( 1 );\n };\n\n this.nextLine = function() {\n return this.next( 0 );\n };\n}\n\nfunction FileOutputHandler() {\n this.resultantStringArray = new Array();\n\n this.addNewLine = function( newString ) {\n this.resultantStringArray.push( newString );\n };\n\n this.clearPercase = function() {\n this.resultantStringArray = new Array();\n };\n\n this.flushOutOutputToFile = function( outputFileName ) {\n var i , sz , res , currentDirectory , fsObj , outputFilePath;\n res = \"\";\n sz = this.resultantStringArray.length;\n for( i = 0 ; i < sz ; i++ ) {\n if( i != 0 ) {\n res += \"\\n\";\n }\n res += this.resultantStringArray[ i ];\n }\n fsObj = require( 'fs' );\n currentDirectory = __dirname;\n outputFilePath = currentDirectory + \"\\\\\" + outputFileName;\n fsObj.writeFileSync( outputFilePath , res );\n this.clearPercase();\n };\n}\n\nfunction CodeExecutioner() {\n this.irObj = new InputReader();\n this.psObj = new ProblemSolver();\n this.fohObj = new FileOutputHandler();\n\n this.runCases = function() {\n if( this.psObj.HAS_TEST_CASES == true ) {\n testCases = this.irObj.nextInt();\n for( i = 0 ; i < testCases ; i++ ) {\n this.psObj.clearPerCase();\n this.psObj.getInput( this.irObj );\n this.psObj.solveCase();\n }\n }\n else {\n while( true ) {\n this.psObj.clearPerCase();\n hasMoreTestCases = this.psObj.getInput( this.irObj );\n if( hasMoreTestCases == false ) {\n break;\n }\n this.psObj.solveCase();\n }\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );\n }\n };\n\n this.detectEnvironmentType = function() {\n var environmentType = null ;\n try {\n if( importPackage != null ) {\n environmentType = 'rhino' ;\n }\n }\n catch( ex1 ) {\n try {\n //for nodejs local server check\n if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {\n environmentType = 'local-node-js' ;\n }\n }\n catch( ex2 ) {\n try {\n if( readline == null || typeof( readline ) != 'function' ) {\n environmentType = 'server-node-js' ;\n }\n else {\n try {\n if( Map != null ) {\n environmentType = 'spider-monkey' ;\n }\n else {\n environmentType = 'javascript-v8' ;\n }\n }\n catch( ex3 ) {\n environmentType = 'javascript-v8' ;\n }\n }\n }\n catch( ex3 ) {\n environmentType = 'server-node-js' ;\n }\n }\n }\n return environmentType ;\n };\n\n this.configureStreamsAndReadInput = function() {\n var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;\n isNodeJsJudgeServer = false ;\n environmentType = this.detectEnvironmentType() ;\n if( environmentType == 'local-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n if( this.psObj.DO_OUTPUT_TO_FILE == true ) {\n localContext = this.fohObj;\n print = function() {\n localContext.addNewLine.apply( localContext , arguments );\n }\n }\n this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );\n this.runCases() ;\n }\n else if( environmentType == 'server-node-js' ) {\n try {\n if( print == null || typeof( print ) != 'function' ) {\n print = console.log;\n }\n }\n catch( ex ) {\n print = console.log;\n }\n this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;\n }\n else if( environmentType == 'javascript-v8' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n else if( environmentType == 'rhino' ) {\n this.irObj.readAllLinesFromRhino();\n this.runCases() ;\n }\n else if( environmentType == 'spider-monkey' ) {\n this.irObj.readAllLines();\n this.runCases() ;\n }\n };\n \n this.configureStreamsAndReadInput();\n}\n\nnew CodeExecutioner();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "51ecb7ca524519f514b88fc498ceaf3c", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const [n, m] = lines[l++].trim().split(' ').map(Number)\n const grid = lines.slice(l, l + n).map(str => str.trim())\n l += n\n output[i] = solve(n, m, grid)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n, m, grid) {\n const q = [[0, 0, 0]]\n let count = q.length\n const map = {}\n while (count) {\n while (count--) {\n const [x, y, c] = q.shift()\n const add = grid[x][y] === '.' ? 0 : 1\n if (x === n - 1 && y === m - 1) {\n map[c + add] = (map[c + add] || 0) + 1\n }\n // ans[x] = ans[x] || []\n // ans[x][y] = c\n if (x + 1 < n) q.push([x + 1, y, c + add])\n if (y + 1 < m) q.push([x, y + 1, c + add])\n }\n count = q.length\n }\n let ans\n let max = -1\n for (let k in map) {\n k = +k\n if (max < 0 || map[k] > ans || (map[k] === ans && k > max)) {\n max = k\n ans = map[k]\n }\n }\n // console.log(map)\n return max\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5f43ebe442c12d6f117afdda6364288c", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const [n, m] = lines[l++].trim().split(' ').map(Number)\n const grid = lines.slice(l, l + n).map(str => str.trim())\n l += n\n output[i] = solve(n, m, grid)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n, m, grid) {\n const q = [[0, 0, 0]]\n let count = q.length\n const map = {}\n while (count) {\n while (count--) {\n const [x, y, c] = q.shift()\n const add = grid[x][y] === '.' ? 0 : 1\n if (x === n - 1 && y === m - 1) {\n map[c + add] = (map[c + add] || 0) + 1\n }\n // ans[x] = ans[x] || []\n // ans[x][y] = c\n if (x + 1 < n) q.push([x + 1, y, c + add])\n if (y + 1 < m) q.push([x, y + 1, c + add])\n }\n count = q.length\n }\n let ans\n let max\n for (let k in map) {\n k = +k\n if (!max || map[k] > ans || (map[k] === ans && k > max)) {\n max = k\n ans = map[k]\n }\n }\n // console.log(map)\n return max\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7b45e80b223e8c4929ddc21c24ba0ca6", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n// (function() {\n // const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1//+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const [n, m] = lines[l++].trim().split(' ').map(Number)\n const grid = lines.slice(l, l + n).map(str => str.trim())\n l += n\n output[i] = solve(n, m, grid)\n }\n console.log(output.join('\\n'))\n// })()\n})\n\nfunction solve(n, m, grid) {\n let x = 0\n let y = 0\n let ans = grid[x][y] === '*' ? 1 : 0\n while (1) {\n [x, y] = bfs(n, m, grid, x, y)\n // console.log(x, y)\n if (grid[x][y] === '*') {\n ans++\n } else {\n break\n }\n }\n return ans\n}\nfunction bfs(n, m, grid, rx, ry,) {\n const q = [[rx, ry]]\n let count = q.length\n while (count) {\n while (count--) {\n const [x, y] = q.shift()\n if (grid[x][y] === '*' && !(x === rx && y === ry)) return [x, y]\n if (y + 1 < m) q.push([x, y + 1])\n if (x + 1 < n) q.push([x + 1, y])\n }\n count = q.length\n }\n return [n - 1, m - 1]\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5efcd1112913c74bb97c991afa0e1dfc", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "let inputString = \"\";\nlet currentLine = 0;\nprocess.stdin.on(\"data\", (data) => {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\n\n// utils\nconst MOD = 1e9 + 7;\nconst mod = (n) => ((n % MOD) + MOD) % MOD;\nconst add = (a, b) => mod(mod(a) + mod(b));\nconst sub = (a, b) => mod(mod(a) - mod(b));\nfunction mul() {\n for (var a = arguments, r = a[0], i = a.length; --i; )\n r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;\n return r;\n}\nfunction inv(b) {\n for (var a = MOD, u = 0, v = 1, t; b; v = t)\n (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);\n u %= MOD;\n return u < 0 ? u + MOD : u;\n}\nfunction pow(base, n) {\n if (n === 0) return 1;\n let p = pow(base, Math.floor(n / 2));\n let res = mul(mod(p), mod(p));\n if (n % 2 === 1) res = mul(mod(res), base);\n return res;\n}\nfunction highestOneBit(i) {\n i |= i >> 1;\n i |= i >> 2;\n i |= i >> 4;\n i |= i >> 8;\n i |= i >> 16;\n return i - (i >>> 1);\n}\nfunction permutation(arr, len, store = \"\", permutations = []) {\n if (store.length === len) {\n permutations.push(store);\n return;\n }\n for (let i = 0; i < arr.length; i++) {\n const newArr = [...arr];\n const newChar = newArr.splice(i, 1);\n permutation(newArr, len, store.concat(newChar), permutations);\n }\n return permutations;\n}\n\nfunction main() {\n const n = +readLine();\n let count = 0;\n\n for (let i = n; i >= 1; i--) {\n let [left, right] = [1, i - 1];\n const target = i * i;\n while (left < right) {\n const sum = left * left + right * right;\n if (sum === target) {\n count++;\n left++;\n right--;\n } else if (sum < target) left++;\n else right--;\n }\n }\n console.log(count);\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bf054b3b0840ca6c8b92516012719022", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var keyboard = 'qwertyuiopasdfghjkl;zxcvbnm,./';\n\nvar d = readline()\nvar str = readline();\nvar res = '';\nfor(var i=0;i10000)\n\t{\n\t var t1 = x%10000;\n\t\tvar t2 = (x-t1)/10000;\n\t\tvar tt1 = (y*t1)%MOD;\n\t\tvar tt = (t2*y)%MOD;\n\t\ttt = (tt*10000)%MOD;\n\t\treturn (tt+tt1)%MOD;\n\t}\n\telse\n\t{\n\t return (x*y)%MOD;\n\t}\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "cf7eea4be18ac40ab5ad9a61a73112d8", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet ns = readline().split(' ').map(v => parseInt(v))\nlet ops = readline().split(' ')\nlet res = []\n\n\nfunction aop (op, a, b) {\n if (op == '+') return a + b\n if (op == '*') return a * b\n}\n\nfor (let i = 0; i < 4; i++) {\n for (let j = i; j < 3; j++) {\n for (let k = 0; k < 3; k++) {\n for (let t = k; t < 2; t++) {\n let cns = ns.map(v => v)\n let a = cns.splice(i, 1)[0]\n let b = cns.splice(j, 1)[0]\n let x = aop(ops[0], a, b)\n cns.push(x)\n let c = cns.splice(k, 1)[0]\n let d = cns.splice(t, 1)[0]\n let y = aop(ops[1], c, d)\n cns.push(y)\n let z = aop(ops[2], cns[0], cns[1])\n res.push(z)\n }\n }\n }\n}\n\nprint(res.reduce((m, v) => Math.min(m, v)))", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "455e67f021fd33e91946246e1ccc00cc", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "var readline = (()=>{\n process.stdin.resume();\n process.stdin.setEncoding('utf-8');\n \n let inputString = '';\n let currentLine = 0;\n \n process.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n });\n \n process.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n });\t\n \n function readline() {\n return inputString[currentLine++];\n }\n return readline;\n})()\n \n\nfunction main() {\n\treturn readline().match(/(.)\\1*/g).filter(str=>str.length%2===0).length;\n \n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "eb9bbee21e8179fb6d365fc457ce31f9", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "Node.js", "source_code": "var readline = (()=>{\n process.stdin.resume();\n process.stdin.setEncoding('utf-8');\n \n let inputString = '';\n let currentLine = 0;\n \n process.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n });\n \n process.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main(); \n });\t\n \n function readline() {\n return inputString[currentLine++];\n }\n return readline;\n})()\n \n \nfunction main() {\n\tconsole.log(readline().match(/(.)\\1*/g).filter(str=>str.length%2===0).length);\n \n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "bf2ce4bb80623948465ccb153ec277dd", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "JavaScript", "source_code": "'use strict'\n\nconst gcd = (x, y) => { while(y) y = x % (x = y); return x; }\n\nconst prime_factors = n => {\n if (n === 1) return [ 1 ];\n let i = 2;\n const factors = [];\n while (i * i <= n) {\n if (n % i) i += 1;\n else {\n while (n % i === 0) n /= i;\n factors.push(i);\n }\n }\n if (n > 1) factors.push(n);\n return factors;\n}\n\nconst factors = prime_factors(+readline());\nprint(factors.slice(1).reduce((r, i) => gcd(r, i), factors[0]));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "618565ccc3d81c5f6c91cb08ce1c8e32", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nconst gcd = (x, y) => { while(y) y = x % (x = y); return x; }\n\nconst prime_factors = n => {\n let i = 2;\n const factors = [];\n while (i * i <= n) {\n if (n % i) i += 1;\n else {\n while (n % i === 0) n /= i;\n factors.push(i);\n }\n }\n if (n > 1) factors.push(n)\n return factors;\n}\n\nconst factors = prime_factors(+readline());\nprint(factors.slice(1).reduce((r, i) => gcd(r, i), factors[0]))\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e00ee358c0ea1e01a46e8e06ef63e68e", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "// var arr = readline().split(' ');\n// var a = parseInt(arr[0]);\n// var b = parseInt(arr[1]);\n// var h = parseInt(arr[2]);\n// var w = parseInt(arr[3]);\n// var n = parseInt(arr[4]);\nvar v = [];\nvar h = [0,0,0,0];\nfor (var i = 0; i < 4; i ++)\n{\n var arr = readline().split(' ');\n var l = [];\n for (var j = 0; j < 3; j ++)\n {\n if (parseInt(arr[j]) == 1)\n {\n h[ i ] = 1;\n h[ (i+3-j)%4 ] = 1;\n }\n }\n v.push(parseInt(arr[3]));\n}\nvar ret = false;\nfor (var i = 0; i < 4; i ++)\n{\n if (v[i]*h[i] == 1)\n {\n ret = true;\n }\n}\nprint(ret?\"YES\":\"NO\");\n// v.sort(function(a,b){return b-a;});\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "499022c8d2f4def0693c81db09bbaebf", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var l = [];\nvar s = [];\nvar r = [];\nvar p = [];\n\nfor(var i= 0; i < 4;i++){\n\tvar numbers = readline().split(\" \").map(function(x){ return parseInt(x)});\n\tl.push(numbers[0]);\n\ts.push(numbers[1]);\n\tr.push(numbers[2]);\n\tp.push(numbers[3]);\n}\nvar result = false;\nfor(var i =0; i < 4;i++){\n\tif(p[i] == 1){\n\t\tif(l[i] == 1 || s[i] == 1 || r[i] == 1){\n\t\t\tresult = true;\n\t\t}\n\t}\n}\nif(!result){\n\tfor(var i =0; i < 4;i++){\n\t\tif(p[i] == 1){\n\t\t\tif(l[(i+1)%4] == 1 || s[(i+2)%4] == 1 || r[(i+3)%4] == 1)\n\t\t\t\tresult = true;\n\t\t}\n\t}\n}\nif(result)\n\tprint(\"YES\");\nelse print(\"NO\");", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5bf1b7206d39e8aff1412f9345dfcbc7", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n const N = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']\n let [a, b, c] = ipt.split(EOL)[0].split(' ').map(n => N.indexOf(n)).sort((a, b) => a - b)\n if (\n 12 - c + a == 3 && b - a == 4\n || b - a == 3 && c - b == 4\n || c - b == 3 && 12 - c + a == 4\n ) console.log('minor')\n else if (\n 12 - c + a == 4 && b - a == 3\n || b - a == 4 && c - b == 3\n || c - b == 4 && 12 - c + a == 3\n ) console.log('major')\n else console.log('strange')\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "5a75be2ea3710d08699761e4826719d2", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": " var n;\n var dp = new Array(120);\n for(var i = 0; i < 120; i++){\n dp[i] = [-1, -1, -1];\n }\n\n function solve (arr, ind, last){\n if(ind === n){\n return 0;\n }\n \n if(dp[ind][last] != -1){\n return dp[ind][last];\n }\n var mn = 100000;\n mn = Math.min(mn, solve(arr, ind+1, 0)+1);\n if((arr[ind] == 1 || arr[ind] == 3) && last != 1){\n mn = Math.min(mn, solve(arr, ind+1, 1));\n }\n if((arr[ind] == 2 || arr[ind] == 3) && last != 2){\n mn = Math.min(mn, solve(arr, ind+1, 2));\n }\n \n //print(ind, last);\n //print(\"hi0: \",dp[1][1]);\n dp[ind][last] = mn;\n //print(\"hi1: \",dp[1][1]);\n \n return mn;\n }\n\n n = Number(readline());\n var arr = readline().split(' ').map(Number);\n print(solve(arr, 0, 0));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "6b87215d1b9a73bddcf8ddaf37a8d3a6", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "const input = readline();\nconst arr = Array.from(input, c => \"AEFHIKLMNTVWXYZ\".includes(c));\nprint(arr.every(x => x) || arr.every(x => !x) ? \"YES\" : \"NO\");\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e0296789945d28ef163bce2f7ba9ce25", "src_uid": "15008dcb8dc8506c39aef0e3d8fca70c", "difficulty": null} {"lang": "JavaScript", "source_code": "var input = readline();\n\n\nfunction foo(str) {\n\n var aToZAscii = {};\n var aToZ = 'abcdefghijklmnopqrstuvwxyz';\n for (var data of aToZ) {\n aToZAscii[data] = {\n code: data.charCodeAt(0),\n mark: false\n };\n }\n\n var strAscii = []\n\n for (var data of str) {\n strAscii.push(data.charCodeAt(0));\n }\n\n var startJ = 0;\n for (var alphabets in aToZAscii) {\n\n\n for (var j = startJ; j < strAscii.length; j++) {\n if (aToZAscii[alphabets].code >= strAscii[j]) {\n aToZAscii[alphabets].mark = true;\n startJ = j + 1;\n break;\n }\n }\n }\n\n\n\n var everyMarked = true;\n for (var alpha in aToZAscii) {\n if (!aToZAscii[alpha].mark) {\n everyMarked = false;\n break;\n }\n }\n\n //console.log(everyMarked ? aToZ : -1);\n print(everyMarked ? aToZ : -1)\n}\n\n\n//foo('aacceeggiikkmmooqqssuuwwyy')\n//foo('thereisnoanswer')\nfoo(input);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "d54a5bf2d6aad446599a456fab68776a", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var input = readline();\n\n\nfunction foo(str) {\n\n var aToZAscii = {};\n var aToZ = 'abcdefghijklmnopqrstuvwxyz';\n for (var data of aToZ) {\n aToZAscii[data] = {\n code: data.charCodeAt(0),\n mark: false\n };\n }\n\n var strAscii = []\n\n for (var data of str) {\n strAscii.push(data.charCodeAt(0));\n }\n\n var startJ = 0;\n for (var alphabets in aToZAscii) {\n\n\n for (var j = startJ; j < strAscii.length; j++) {\n if (aToZAscii[alphabets].code >= strAscii[j]) {\n strAscii[j] = aToZAscii[alphabets].code;\n aToZAscii[alphabets].mark = true;\n startJ = j + 1;\n break;\n }\n }\n }\n\n\n\n var everyMarked = true;\n for (var alpha in aToZAscii) {\n if (!aToZAscii[alpha].mark) {\n everyMarked = false;\n break;\n }\n }\n\n var finalStr = '';\n if (everyMarked) {\n for (var data of strAscii) {\n finalStr += String.fromCharCode(data)\n }\n }\n //console.log(everyMarked ? finalStr : -1);\n print(everyMarked ? finalStr : -1)\n}\n\n\n//foo('aacceeggiikkmmooqqssuuwwyy')\n//foo('thereisnoanswer')\nfoo(input);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "4d911bd67946a1f04a0fedc4c9a4c9fe", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "(function() {\nvar INPUT = ``;\nvar OUTPUT = ``;\n \nvar main = function() {\"use strict\";\n // TODO\n var a1 = rdN();\n var a2 = rdN();\n var k1 = rdN();\n var k2 = rdN();\n var n = rdN();\n \n if (k1 > k2) {\n var buf = a1;\n a1 = a2;\n a2 = buf;\n var buf = k1;\n k1 = k2;\n k2 = buf;\n }\n \n var maxForTeam1 = a1*(k1-1);\n var maxForTeam2 = a2*(k2-1);\n var minRemove = Math.max(0, n - (maxForTeam1 + maxForTeam2));\n \n var maxRemoveTeam1 = Math.min(a1, Math.floor(n/k1));\n n -= maxRemoveTeam1*k1;\n var maxRemoveTeam2 = Math.min(a2, Math.floor(n/k2));\n var maxremove = maxRemoveTeam1 + maxRemoveTeam2;\n \n wr(minRemove, maxremove);\n};\n \nif(INPUT){INPUT=INPUT.split('\\n').reverse();\nreadline=()=>INPUT.pop();\nwrite=(...s)=>{OUTPUT+=[...s].join(' ')};\nprint=(...s)=>{write(...s);OUTPUT+='\\n'};}\nconst\nrdS=readline,\nrdN=()=>+rdS(),\nrdArS=()=>rdS().split(' '),\nrdArN=()=>rdArS().map(v=>+v),\nwr=write,\npr=print,\nprAr=(a)=>pr(...a),\nprOb=(o)=>pr(JSON.stringify(o,null,4)),\ncrAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},\ngetPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},\ndefineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});\ndefineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});\ndefineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});\n \nmain();\nreturn OUTPUT;\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "12267786f2ff330ce3a8f202bca155dd", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "var a1 = Number(readline());\nvar a2 = Number(readline());\nvar k1 = Number(readline());\nvar k2 = Number(readline());\nif (k1 > k2) {\n var t = a1;\n a1 = a2;\n a2 = t;\n t = k1;\n k1 = k2;\n k2 = t;\n}\nconst n = Number(readline());\nconst a = Math.min(Math.floor(n / k1), a1);\nconst b = Math.min(Math.floor(Math.max(n - a * k1, 0) / k2), a2);\nprint(`${Math.min(Math.max(n - (a1 * (k1 - 1) + a2 * (k2 - 1)), 0), a1 + a2)} ${a + b}`);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "009f90eeb178af433c7ed27727882fb9", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "(function () {\n var read = {\n number: function () {\n return +readline();\n },\n arr: function (divider) {\n return readline().split(divider ? divider : '');\n },\n arrNumber: function (divider) {\n return readline()\n .split(divider ? divider : '')\n .map(item => +item);\n }\n };\n var line = read.arrNumber(' ');\n var n = line[0];\n var M = line[1];\n var t = read.arrNumber( ' ');\n\n var sum = 0;\n var res = '';\n for(var i = 0; i < n; i++) {\n sum += t[i];\n if(M >= sum) {\n res += '0 ';\n }\n else {\n var nj = sum - M;\n var newT = t.slice(0, i).sort((a,b) => b - a);\n\n var count = 0;\n while(nj > 0) {\n nj -= newT[count];\n count++;\n }\n\n res += count + ' ';\n }\n }\n print(res);\n}());\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "82bf9816d4631af5bbcd033b5f457df6", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var ln = readline().split(' ').map(e => +e);\nvar std = ln[0], TIME = ln[1];\n\nvar ln = readline().split(' ').map(e => +e);\nvar dp = Array(std);\n\ndp[0] = ln[0];\nfor (var i=1; i TIME) {\n var sub = ln.slice(0, i).sort((a, b) => a - b);\n while (sub.length) {\n if (dp[i] > TIME) count ++, dp[i] -= sub.pop();\n else break;\n } \n }\n \n write(String(count) + ' ');\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "af17eb115881bcd41a9197d357b3235f", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "'use strict';\n\n/*let input = `000B:00001`.split('\\n');\nfunction print(output) {\n\tconsole.log(output);\n}\nfunction readline() {\n\treturn input.shift();\n}*/\n\n//code\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar digits = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"];\n\nvar _readline$split = readline().split(':');\n\nvar _readline$split2 = _slicedToArray(_readline$split, 2);\n\nvar hours = _readline$split2[0];\nvar min = _readline$split2[1];\n\nvar minRadix = [hours, min].join('').split('').reduce(function (acc, curr) {\n\tif (digits.indexOf(curr) > acc) {\n\t\treturn digits.indexOf(curr);\n\t} else {\n\t\treturn acc;\n\t}\n}, 0);\nminRadix++;\nvar radix = minRadix,\n infinite = false,\n lastRadixVal = void 0;\nwhile (true) {\n\t/*\n let hoursVal = hours.split('').reduce((acc, curr) => {\n return acc*radix + digits.indexOf(curr);\n }, 0);*/\n\n\tvar _map = [hours, min].map(function (time) {\n\t\treturn time.split('').reduce(function (acc, curr) {\n\t\t\treturn acc * radix + digits.indexOf(curr);\n\t\t}, 0);\n\t});\n\n\tvar _map2 = _slicedToArray(_map, 2);\n\n\tvar hoursVal = _map2[0];\n\tvar minVal = _map2[1];\n\n\tif (hoursVal >= 24 || minVal >= 60) {\n\t\tbreak;\n\t}\n\tif (lastRadixVal && lastRadixVal === hoursVal * 60 + minVal) {\n\t\tinfinite = true;\n\t\tbreak;\n\t}\n\tlastRadixVal = hoursVal * 60 + minVal;\n\tradix++;\n}\nvar maxRadix = radix;\nif (minRadix === maxRadix) {\n\tprint(\"0\");\n} else if (infinite) {\n\tprint(\"-1\");\n} else {\n\tvar result = [];\n\tfor (var i = minRadix; i < maxRadix; i++) {\n\t\tresult.push(i);\n\t}\n\tprint(result.join(' '));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "400b7888aea44a543eaf3f7f5fa29e01", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "JavaScript", "source_code": "'use strict';\n\n/*let input = `00000:00000`.split('\\n');\nfunction print(output) {\n\tconsole.log(output);\n}\nfunction readline() {\n\treturn input.shift();\n}*/\n\n//code\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar digits = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"];\n\nvar _readline$split = readline().split(':');\n\nvar _readline$split2 = _slicedToArray(_readline$split, 2);\n\nvar hours = _readline$split2[0];\nvar min = _readline$split2[1];\n\nvar minRadix = [hours, min].join('').split('').reduce(function (acc, curr) {\n\tif (digits.indexOf(curr) > acc) {\n\t\treturn digits.indexOf(curr);\n\t} else {\n\t\treturn acc;\n\t}\n}, 0);\nminRadix++;\nvar radix = minRadix,\n infinite = false,\n lastRadixVal = void 0;\nwhile (true) {\n\t/*\n let hoursVal = hours.split('').reduce((acc, curr) => {\n return acc*radix + digits.indexOf(curr);\n }, 0);*/\n\n\tvar _map = [hours, min].map(function (time) {\n\t\treturn time.split('').reduce(function (acc, curr) {\n\t\t\treturn acc * radix + digits.indexOf(curr);\n\t\t}, 0);\n\t});\n\n\tvar _map2 = _slicedToArray(_map, 2);\n\n\tvar hoursVal = _map2[0];\n\tvar minVal = _map2[1];\n\n\tif (hoursVal >= 24 || minVal >= 60) {\n\t\tbreak;\n\t}\n\tif (lastRadixVal !== undefined && lastRadixVal === hoursVal * 60 + minVal) {\n\t\tinfinite = true;\n\t\tbreak;\n\t}\n\tlastRadixVal = hoursVal * 60 + minVal;\n\tradix++;\n}\nvar maxRadix = radix;\nif (minRadix === maxRadix) {\n\tprint(\"0\");\n} else if (infinite) {\n\tprint(\"-1\");\n} else {\n\tvar result = [];\n\tfor (var i = minRadix; i < maxRadix; i++) {\n\t\tresult.push(i);\n\t}\n\tprint(result.join(' '));\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "135171da7540dd11623191235a81803f", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "\"use strict\";var readline=require(\"readline\"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return\"function\"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&\"number\"==typeof r.length}}();function isObject(r){return null!==r&&\"object\"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+\" errors occurred during unsubscription:\\n\"+r.map((function(r,t){return t+1+\") \"+r.toString()})).join(\"\\n \"):\"\",this.name=\"UnsubscriptionError\",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;ithis.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(\" \").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),b=Math.floor(r.length/2),h=p-t,f=b-n,l=function(r,t){\"any\"===r?e+=1===t?0:1:\"even\"===r?f>=t?f-=t:e+=1:h>=t?h-=t:e+=1};o.sort((function(r,t){return t.distance-r.distance})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;\"even\"===t&&\"odd\"===n||\"odd\"===t&&\"even\"===n?e+=1:\"any\"===t?l(n,o):\"any\"===n?l(t,o):\"even\"===t?(f-=o)<0&&(e+=2):\"odd\"===t&&(h-=o)<0&&(e+=2)})),console.log(e)}));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "35ed607429b1edd38340c6ecc44233f3", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "\"use strict\";var readline=require(\"readline\"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return\"function\"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&\"number\"==typeof r.length}}();function isObject(r){return null!==r&&\"object\"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+\" errors occurred during unsubscription:\\n\"+r.map((function(r,t){return t+1+\") \"+r.toString()})).join(\"\\n \"):\"\",this.name=\"UnsubscriptionError\",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;ithis.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(\" \").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),b=Math.floor(r.length/2),h=p-t,f=b-n,l=function(r,t){\"any\"===r?e+=1:\"even\"===r?f>=t?f-=t:e+=1:h>=t?h-=t:e+=1};o.sort((function(r,t){return t.distance-r.distance})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;\"even\"===t&&\"odd\"===n||\"odd\"===t&&\"even\"===n?e+=1:\"any\"===t?l(n,o):\"any\"===n?l(t,o):\"even\"===t?(f-=o)<0&&(e+=2):\"odd\"===t&&(h-=o)<0&&(e+=2)})),console.log(e)}));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "83e82c93492242590d905c3e071d7736", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "Node.js", "source_code": "\"use strict\";var readline=require(\"readline\"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return\"function\"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&\"number\"==typeof r.length}}();function isObject(r){return null!==r&&\"object\"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+\" errors occurred during unsubscription:\\n\"+r.map((function(r,t){return t+1+\") \"+r.toString()})).join(\"\\n \"):\"\",this.name=\"UnsubscriptionError\",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;ithis.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(\" \").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),h=Math.floor(r.length/2),b=p-t,f=h-n,l=function(r,t){\"any\"===r?e+=1===t?0:1:\"even\"===r?f>=t?f-=t:e+=1:b>=t?b-=t:e+=1},d=function(r){var t=r.left,n=r.right,e=r.distance;return\"any\"===t||\"any\"===n?e+1e4:e};o.sort((function(r,t){return d(r)-d(t)})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;\"even\"===t&&\"odd\"===n||\"odd\"===t&&\"even\"===n?e+=1:\"any\"===t?l(n,o):\"any\"===n?l(t,o):\"even\"===t?f>=o?f-=o:e+=2:\"odd\"===t&&(b>=o?b-=o:e+=2)})),console.log(e)}));\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "c3fe825d462e0ff76b65274ecdbbf02b", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "const data = readline().split(\" \").map(x => Number(x));\nconst n = data[0];\nconst price = data[1];\nconst buyers = new Array(n).fill().map(() => readline().length >= 8);\nvar count = 0;\nvar total = 0;\nfor (var i = n; i;) {\n count *= 2;\n if (buyers[--i]) count++;\n total += count;\n}\nprint(total * 0.5 * price);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "757bd05137a7dd091c45fbf737791b0b", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "(function() {\n\tvar isValidHexagon = function(a) {\n\t\t//Valid hexagon cannot have random sides.\n\t\t//Starting at (0, 0) in 2D space we must return to the same point when follow all the sides.\n\t\tvar x = a[0] + a[1] / 2 - a[2] / 2 - a[3] - a[4] / 2 + a[5] / 2;\n\t\tvar y = a[1] + a[2] - a[4] - a[5];\n\t\treturn x === 0 && y === 0;\n\t};\n\t//Reading the values validation.\n\tvar line = readline().trim();\n\tvar a = line.split(/\\s+/);\n\ta = a.map(function(item) {\n\t\tvar n = parseInt(item);\n\t\tif(!isFinite(n) || n <= 0) {\n\t\t\tthrow new Error('Invalid hexagon length: ' + n);\n\t\t}\n\t\treturn n;\n\t});\n\tif(a.length !== 6) {\n\t\tthrow new Error('Invalid hexagon sides count: ' + a.length);\n\t}\n\t//Hexagon validation.\n\tif(!isValidHexagon(a)) {\n\t\tthrow new Error('The sides specified do not form valid hexagon: [' + a.join(', ') + ']');\n\t}\n\t//The magic: read the hexagon row by row.\n\tvar b = [], r = [];\n\t//Calculation the first part, where sides of hexagon row are like this / \\\n\tb[0] = Math.min(a[1], a[5]);\n\tr[0] = (a[0] + b[0]) * (a[0] + b[0]) - a[0] * a[0];\n\t//Calculating the second (possibly missing) part of hexagon where the sides are like this / / or this \\ \\\n\tb[1] = 2 * (a[0] + b[0]);\n\tb[2] = Math.max(a[1], a[5]) - b[0];\n\t//Finally calculate mirror image of the first part (same formula) where the sides are like the \\ /\n\tr[1] = b[1] * b[2];\n\tb[3] = Math.min(a[2], a[4]);\n\tr[2] = (a[3] + b[3]) * (a[3] + b[3]) - a[3] * a[3];\n\t//Sum the triangles from the tree parts. Value only valid when hexagon is valid.\n\tprint(r[0] + r[1] + r[2]);\n})();", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "46bf03c78f8681c70b117ba09541f0fc", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "Node.js", "source_code": "const {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n let [x, y] = ipt.split(EOL).slice(0, -1)[0].split(' ').map(v => parseInt(v))\n for (let i = 0; ; i++) {\n if (i % 2) {\n if (y >= 22) {\n y -= 22\n } else if (y >= 12 && x >= 1) {\n x -= 1\n y -= 12\n } else if (y >= 2 && x >= 2) {\n x -= 2\n y -= 2\n } else {\n return console.log('Ciel')\n }\n } else {\n if (x >= 2 && y >= 2) {\n x -= 2\n y -= 2\n } else if (x == 1 && y >= 12) {\n x = 0\n y -= 12\n } else if (y >= 22) {\n y -= 22\n } else {\n return console.log('Hanako')\n }\n }\n }\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "32b1e3fde82b020f2e91bf5d331a15d1", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet X = lll[0]\nlet Y = lll[1]\n\nlet r = Math.sqrt(X * X + Y * Y)\n\nlet r0 = r | 0\nlet even = !(r0 % 2)\nlet q\nif (X > 0 && Y > 0) {q = 1}\nif (X > 0 && Y < 0) {q = 2}\nif (X < 0 && Y < 0) {q = 1}\nif (X < 0 && Y > 0) {q = 2}\n\n;(function () {\n if (r == r0 || X == 0 || Y == 0) return print('black')\n if (q == 1 && even || q == 2 && !even) return print('black')\n if (q == 1 && !even || q == 2 && even) return print('white')\n})()", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b753212bcbe76ba194287d595bc21c24", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "// since javascript only has 53bit number, \n// we need to operate it as big number by using string\nfunction multiply(x, strNum)\n{\n\tvar carry = 0;\n\tvar num = strNum.split('').map(Number).reverse();\n\tvar result = [];\n\n\tfor(var i = 0; i < num.length; i++)\n\t{\n\t\tvar prod = x * num[i] + carry;\n\t\tresult.push(prod % 10);\n\t\tcarry = Math.floor(prod / 10);\n\t}\n\n\t// the possible biggest carry is \n\t// 99999 * 9 = 899991\n\twhile(carry)\n\t{\n\t\tresult.push(carry % 10);\n\t\tcarry = Math.floor(carry / 10);\n\t}\n\n\treturn result.reverse().join('');\n}\n\nfunction pow(x, pow)\n{\n\tvar result = '1';\n\tfor(var i = 0; i < pow; i++)\n\t\tresult = multiply(x, result);\n\n\treturn result;\n}\n\n\nvar input = readline();\nvar digits = input[0] + input[2] + input[4] + input[3] + input[1];\n\nvar result = pow(digits, 5);\nprint(result.substr(result.length - 5));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "e7969d53688d9f375e43e1b2c66f318c", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "JavaScript", "source_code": "\nfunction multiply(x, strNum)\n{\n\tvar carry = 0;\n\tvar num = strNum.split('').map(Number).reverse();\n\tvar result = [];\n\n\tfor(var i = 0; i < num.length; i++)\n\t{\n\t\tvar prod = x * num[i] + carry;\n\t\tresult.push(prod % 10);\n\t\tcarry = Math.floor(prod / 10);\n\t}\n\n\twhile(carry)\n\t{\n\t\tresult.push(carry % 10);\n\t\tcarry = Math.floor(carry / 10);\n\t}\n\n\treturn result.reverse().join('');\n}\n\nfunction pow(x, pow)\n{\n\tvar result = '1';\n\tfor(var i = 0; i < pow; i++)\n\t\tresult = multiply(x, result);\n\n\treturn result;\n}\n\n\nvar input = readline();\nvar digits = input[0] + input[2] + input[4] + input[3] + input[1];\n\nvar result = pow(digits, 5);\nprint(result.substr(result.length - 5));", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "0e985d05fa3959ac056981d1bda1ac3d", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "Node.js", "source_code": "'use strict'\n\nconst B = '127'\nconst S = '32767'\nconst I = '2147483647'\nconst L = '9223372036854775807'\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n ipt = ipt.trim()\n console.log(\n fit(ipt, B) && 'byte'\n || fit (ipt, S) && 'short'\n || fit (ipt, I) && 'int'\n || fit (ipt, L) && 'long'\n || 'BigInteger'\n )\n\n function fit (a, b) {\n if (a.length < b.length) return true\n if (a.length > b.length) return false\n for (let i = 0; i < a.length; i += 5) {\n const ap = +a.slice(i, i + 5)\n const bp = +b.slice(i, i + 5)\n if (ap < bp) return true\n if (ap > bp) return false\n }\n return true\n }\n})", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "74e622d705ad73206b8ac1e45896a5ef", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var s = readline().trim()\nvar t = [];\nvar d = {}\nvar abc = 'abcdefghijklmnopqrstuvwxyz';\nfor (var i in s.split('')) {\n var c = s[i];\n if (!d[c]) {\n t.push(c);\n d[c] = true;\n }\n}\n//t.sort()\n//print(t.join(''))\nvar len = t.length;\nvar abc2 = abc.slice(0, len)\nprint (t.join('') === abc2 ? 'YES' : 'NO')", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "560c641567faad745e51f35ab13f8597", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0} {"lang": "Node.js", "source_code": "function For(a, b, fn) {\n if (!fn) return For(0, a - 1, b);\n let res;\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) != null) return res;\n }\n}\nfunction ForR(a, b, fn) {\n if (!fn) return ForR(a - 1, 0, b);\n let res;\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) != null) return res;\n }\n}\n\nfunction Arr(a, b, fn, init) {\n if (typeof (b) == 'function') return Arr(0, a - 1, b, fn);\n if (b < a) return [];\n let arr = Array(b - a + 1).fill(0);\n if (init) init(arr);\n for (let i = a; i <= b; i++) arr[i] = fn(i, arr);\n return arr;\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () { return Object.keys(this) }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () { return Object.values(this) }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () { return Object.entries(this) }\n});\nArray.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }\nArray.prototype.uniq = function (fn) {\n var set = new Set();\n return this.filter(v => {\n var newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n}\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn ? fn(v) : v).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n}\nArray.prototype.min = function (fn) {\n let min = 1e20, index = -1, x;\n for (let i = 0; i < this.length; i++) {\n x = fn ? fn(this[i], i, this) : this[i];\n if (x < min) { min = x; index = i }\n }\n return [this[index], index, min];\n}\nArray.prototype.max = function (fn) {\n let max = -1e20, index = -1, x;\n for (let i = 0; i < this.length; i++) {\n x = fn ? fn(this[i], i, this) : this[i];\n if (x > max) { max = x; index = i }\n }\n return [this[index], index, max];\n}\nArray.prototype.rev = function (first, last) {\n for (let i = first; i < (first + last) / 2; i++) {\n [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]\n }\n}\nArray.prototype.set = function (pos, arr) {\n for (let i = pos; i < pos + arr.length; i++) {\n this[i] = arr[i - pos];\n }\n}\nArray.prototype.for = function (a, b, fn) {\n let res\n for (let i = a; i <= b; i++) {\n if ((res = fn(this[i], i, this)) != null) return res;\n }\n}\nArray.prototype.forR = function (a, b, fn) {\n let res\n for (let i = a; i >= b; i--) {\n if ((res = fn(this[i], i, this)) != null) return res;\n }\n}\n\nfunction gcd(a, b) {\n while (b) [a, b] = [b, a % b];\n return a;\n}\nfunction mul(a, b, m) {\n return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m\n}\nfunction pow(a, n, m) {\n let r = 1;\n while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]\n return r;\n}\nlet MOD = 998244353\nfunction inv(b) {\n for (var a = MOD, u = 0, v = 1, t; b; v = t)\n (t = a / b | 0, a -= t * b, u -= t * v, t = a, a = b, b = t, t = u, u = v);\n return (u + MOD) % MOD;\n}\n// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));\n// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[998244353 % i], MOD));\n// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });\n// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);\n\n// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1\n// for (i = pos; i; i -= i & -i) ans += fen[i];\n\n// let p = [2];\n// for (let i = 3; i < 1e5; i += 2) {\n// let j, x = Math.sqrt(i);\n// for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;\n// if (i % p[j] != 0) p.push(i);\n// }\n\nlet input = '';\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', main);\nfunction main() {\n let inp = input.split(/\\s+/), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],\n out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, min = Math.min, max = Math.max, abs = Math.abs;\n let [n, a1, a2, a3, b1, b2, b3] = $(7)\n let Max = min(a1, b2) + min(a2, b3) + min(a3, b1)\n\n let c = [], d = [], A1, A2, A3, B1, B2, B3, m, Min = 1e10;\n let gen = i => {\n if (i == 6) {\n [A1, A2, A3, B1, B2, B3] = [a1, a2, a3, b1, b2, b3]\n For(6, j => {\n if (c[j] == 0) (m = min(A1, B1), A1 -= m, B1 -= m);\n if (c[j] == 1) (m = min(A1, B3), A1 -= m, B3 -= m);\n if (c[j] == 2) (m = min(A2, B2), A2 -= m, B2 -= m);\n if (c[j] == 3) (m = min(A2, B1), A2 -= m, B1 -= m);\n if (c[j] == 4) (m = min(A3, B3), A3 -= m, B3 -= m);\n if (c[j] == 5) (m = min(A3, B2), A3 -= m, B2 -= m);\n })\n Min = min(Min, A1 + A2 + A3)\n return;\n }\n For(6, j => {\n if (d[j]) return;\n d[j] = 1; c[i] = j; gen(i + 1); d[j] = 0;\n });\n }\n gen(0)\n\n log(Min, Max)\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "2c3d5fe4c7d728196c2b3cfa3d857c89", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "JavaScript", "source_code": "var root = function(dsu, v) {\n if (dsu[v] === v) {\n return v;\n } else {\n dsu[v] = root(dsu, dsu[v]);\n return dsu[v];\n }\n}\n\nvar main = function () {\n var n = parseInt(readline());\n var p = [], prev = [], next = [];\n readline().split(/\\s+/).forEach(function (t, i) {\n p.push(parseFloat(t));\n });\n\n for (var i = -1; i <= n; ++i) {\n prev[i] = next[i] = i;\n }\n\n var s = [];\n p.forEach(function(e, i) {\n s.push({pos: i, val: e});\n });\n\n s.sort(function(a, b) {\n return (a.val !== b.val) ? (a.val - b.val) : (a.pos - b.pos);\n });\n\n var ans = 0;\n var dec = 0;\n var left = n - 2;\n s.forEach(function (e, i) {\n if (left <= 0) {\n return;\n }\n \n var i = e.pos;\n next[i] = i + 1;\n prev[i] = i - 1;\n var lf = root(prev, i);\n var rg = root(next, i);\n \n var cur = e.val - dec;\n dec = e.val;\n ans += left * cur;\n left--;\n\n if (0 <= lf && lf <= rg && rg < n) {\n ans += Math.min(p[lf] - dec, p[rg] - dec);\n }\n\n return left > 0;\n });\n\n print(ans);\n};\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f0efdfe5301f0802fc894bb0caf1f4ad", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0} {"lang": "Node.js", "source_code": "\nlet _inputLines;\nlet _lineNumber = 0;\nlet inputReader = _inputReader ();\n\nfunction _main() {\n\t\n\t_inputLines = _inputData.trim().split('\\n').map((string) => {\n\t\treturn string.trim();\n\t});;\n\tlet str = inputReader.readLine();\n\tlet n = inputReader.readNumber();\n\tlet arr = [];\n\t\n\tlet bool = false;\n\tfor (let i = 0; i < n; i++) {\n\t\tarr[i] = inputReader.readLine();\n\t\tif (arr[i] === str) {\n\t\t\tbool = true;\n\t\t}\n\t}\n\t\n\tif (n === 1) {\n\t\tlet str1 = \"\" + arr[0] + arr[0];\n\t\tif (str[0] == str1[1] && str[1] == str1[2]) {\n\t\t\tbool = true;\n\t\t}\n\t\t//console.log(str1,str1[1],str[0]);\n\t} else if (!bool) {\n\t\tfor (let i = 0; i < n; i++) {\n\t\t\tfor (let j = 0; j < n; j++) {\n\t\t\t\tlet res = arr[i] + arr[j];\n\t\t\t\tif (str[0] == res[1] && str[1] == res[2]) {\n\t\t\t\t\tbool = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (bool) break;\n\t\t}\n\t}\n\tif (bool) {\n\t\tconsole.log(\"YES\");\n\t} else {\n\t\tconsole.log(\"NO\");\n\t}\n\n}\n\nvar _inputData = '';\nfunction cacheInput(data) {\n\t_inputData += data;\n}\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf8');\nprocess.stdin.on('data', cacheInput).on('end', _main);\n\nfunction _inputReader () {\n\tfunction readNumber(){\n\t\treturn Number(_inputLines[_lineNumber++]);\n\t}\n\t\t\n\tfunction readLine(){\n\t\treturn _inputLines[_lineNumber++];\n\t}\n\t\t\n\t\n\treturn {\n\t\treadNumber,\n\t\treadLine,\n\t}\n}", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7cf6af48a98e1b6bc5910a1723e1fdf5", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0} {"lang": "JavaScript", "source_code": "T=readline().split(' ')\nvar n=Number(T[0]),pos=Number(T[1]),l=Number(T[2]),r=Number(T[3]);\n\nfunction q1(l,r,pos) {\n var A=0;\n if (l>1) {\n A += Math.abs(l-pos) + 1\n pos = l\n }\n if (r1) {\n A += Math.abs(l-pos) + 1\n }\n return A;\n}\n\nif (l==1 && r==n) {\n print(0)\n} else {\n print(Math.min(q1(l,r,pos),q2(l,r,pos)))\n}\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "b3ed3787621bdf2c432b119db6d5db20", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function readArr()\n{\n return readline().split(' ').map(function(x){return +x;})\n}\n\nkek=new Array(25)\nkek[0]=0\nxxxx=1\nreadline().split(' ').map(function(x){kek[xxxx]=x;++xxxx;})\n\nfunction good(arr)\n{\n\n for (i=0;i<6;i++)\n {\n a0=i*4+1\n a1=i*4+2\n a2=i*4+3\n a3=i*4+4\n if (arr[a0]!=arr[a1]||arr[a0]!=arr[a2]||arr[a0]!=arr[a3])\n {\n return 0\n }\n }\n return 1\n}\n\nrolls=[[22,21,18,17,6,5,14,13],[3,4,17,19,10,9,16,14],\n[7,8,19,20,2,1,15,16],[1,3,5,7,9,11,24,22],\n[4,2,21,23,12,10,8,6],[1,2,18,20,12,11,15,13]]\n\nres=\"NO\"\nxx=0\nfor (r=0;r<6;r++)\n{\n kok=new Array(25);for (i=0;i<25;i++){kok[i]=kek[i];}\n z4=kok[rolls[r][0]]\n z5=kok[rolls[r][1]]\n for (i=0;i<6;i++)\n {\n kok[rolls[r][i]]=kok[rolls[r][i+2]]\n }\n kok[rolls[r][6]]=z4\n kok[rolls[r][7]]=z5\n //if (r==4)\n // print(kok)\n if (good(kok))\n {\n res=\"YES\"\n break\n }\n kok=new Array(25);for (i=0;i<25;i++){kok[i]=kek[i];}\n //print(kek)\n z11=kok[rolls[r][7]]\n z10=kok[rolls[r][6]]\n for (i=7;i>1;i--)\n {\n kok[rolls[r][i]]=kok[rolls[r][i-2]]\n }\n kok[rolls[r][1]]=z11\n kok[rolls[r][0]]=z10\n //if (r==4) \n // print(kok)\n if (good(kok))\n {\n res=\"YES\"\n break\n } \n}\nprint(res)", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "50fad2b1542b661b4d17721c09ddec59", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "JavaScript", "source_code": "/* read input here */\nvar n = readline();\nvar line = readline();\nn = parseInt(n);\n\n/* solution begin here */\n\tvar r = 0, g = 0, b = 0;\n\tfor(var i = 0; i < n; i++ ){\n\t\tr += line[i] == 'R' ? 1 : 0;\n\t\tb += line[i] == 'B' ? 1 : 0;\n\t\tg += line[i] == 'G' ? 1 : 0;\n\t}\n\tif ((r > 0 && g > 0) || (r > 1 && b > 0) || (g > 1 && b > 0) || (r && g))\n print('B');\n\tif ((r > 0 && b > 0) || (r > 1 && g > 0) || (b > 1 && g > 0) || (r && b))\n print('G');\n\tif ((b > 0 && g > 0) || (b > 1 && r > 0) || (g > 1 && r > 0) || (b && g))\n print('R');\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "927b231bf2fcc899215bdc9e6871096f", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "/* read input here */\nvar n = readline();\nvar line = readline();\nn = parseInt(n);\n\n/* solution begin here */\n\tvar r = 0, g = 0, b = 0;\n\tfor(var i = 0; i < n; i++ ){\n\t\tr += line[i] == 'R' ? 1 : 0;\n\t\tb += line[i] == 'B' ? 1 : 0;\n\t\tg += line[i] == 'G' ? 1 : 0;\n\t}\n\tvar res = \"\";\n\tif ((r > 0 && g > 0) || (r > 1 && b > 0) || (g > 1 && b > 0) || (r && g))\n res += \"B\";\n\tif ((r > 0 && b > 0) || (r > 1 && g > 0) || (b > 1 && g > 0) || (r && b))\n res += \"G\";\n\tif ((b > 0 && g > 0) || (b > 1 && r > 0) || (g > 1 && r > 0) || (b && g))\n res += \"R\";\n print(res);\n\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "f8660b71f0a8afb1d057d6e919f47638", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "var n = +readline();\nvar t = readline().split(' ').map(function(v){\n\treturn +v;\n}).sort(function(a,b){\n\treturn a===b?0:a>b?1:-1;\n});\nvar T = +readline();\nvar ret = 0;\nfor(var i=0; i parseInt(x));\n var n = tmp[0];\n var x = tmp[1];\n var y = tmp[2];\n var finding = true;\n var res = -1;\n var sucs = Infinity;\n for(var i = 0; finding && i < 10000; i += 1) {\n var target = x + 50 * i;\n var found = false;\n var ii = ((target / 50) | 0) % 475;\n for(var j = 0; !found && j < 25; j += 1) {\n ii = (ii * 96 + 42) % 475;\n if(ii + 26 === n) {\n found = true;\n if(sucs > ((i + 1) / 2 | 0)) {\n res = i;\n sucs = (i + 1) / 2 | 0\n }\n }\n }\n if(finding && x - 50 * i >= y) {\n target = x - 50 * i;\n found = false;\n ii = ((target / 50) | 0) % 475;\n for(var j = 0; !found && j < 25; j += 1) {\n ii = (ii * 96 + 42) % 475;\n if(ii + 26 === n) {\n found = true;\n res = -i;\n sucs = 0;\n }\n }\n }\n }\n print(sucs);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "08f04214941bc17cea10373ca8e2b26b", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "JavaScript", "source_code": "function main(iPeb) {\n const getIdealRows = n => {\n \tvar best = 1;\n \tfor(var i = 1; i < n; i++) {\n best = i > best && n % i === 0 ? i : best;\n \t}\n \treturn best;\n }\n\n const iterateRows = n => {\n var x = n;\n \twhile(n > 1) {\n n = getIdealRows(n);\n \t\tx += n;\n \t}\n \treturn x;\n }\n\n return (iPeb < 2 || iPeb > 1000000000) ? '' : iterateRows(parseInt(iPeb));\n}\n\nconst input1 = readline();\nconst output = main(input1);\n\nprint(output);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "858b50d1d9056eb6383e2d9b32166167", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1000.0} {"lang": "JavaScript", "source_code": "function main() {\n var n = +next(), a = [+next(), +next()];\n var t = 0;\n if (a[0] > a[1]) t = 1;\n var ans = [Infinity, Infinity];\n for (var i = 1; i * i <= 6 * n; ++i) {\n var f = Math.ceil(6 * n / i);\n // console.error(i, f);\n var u = Math.max(a[t], i), v = Math.max(a[t ^ 1], f);\n if (u * v < 6 * n) continue;\n if (ans[0] * ans[1] > u * v) {\n ans[t] = u;\n ans[t ^ 1] = v;\n }\n }\n print(ans[0] * ans[1]);\n print(ans[0] + \" \" + ans[1]);\n}\n\nvar line = null, linepos = 0;\nfunction next() {\n if (!line || linepos === line.length) {\n line = readline().split(' ');\n linepos = 0;\n }\n return line[linepos++];\n}\n\nif (typeof readline == 'undefined') {\n process.stdin.resume();\n process.stdin.setEncoding('ascii');\n \n var input_stdin = \"\";\n process.stdin.on('data', function (data) { input_stdin += data; });\n process.stdin.on('end', function () {\n // input_stdin = input_stdin.split(/\\s/);\n input_stdin = input_stdin.split('\\n');\n var curline = 0;\n readline = () => input_stdin[curline++];\n if (typeof print === 'undefined') print = console.log;\n main();\n });\n} else main();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "89a40c887d29a71dd1a4febfa0a0646a", "src_uid": "6a2a584d36008151d18e5080aea5029c", "difficulty": 2000.0} {"lang": "Node.js", "source_code": "const lines = [];\n\nconst helpers = {\n arrStringtoInt: (arr, splitter) => {\n return arr.split(splitter).map(num => parseInt(num));\n },\n insterAt: (arr, idx, item) => {\n const newArray = [...arr];\n newArray.splice(idx, 0, item);\n return newArray;\n },\n sortAscending: (arr) => {\n return arr.sort((a, b) => a - b);\n },\n sortDescending(arr) {\n return arr.sort((a, b) => b - a);\n }\n}\n\nconst readline = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\n// multi line input\nreadline.on('line', line => {\n lines.push(line);\n});\n\nreadline.on('close', line => {\n let eggs = parseInt(lines[0]);\n let colorsSequence = ['R', 'O', 'Y', 'G', 'B', 'I', 'V'];\n let extraColors = eggs % 7;\n let cycles = Math.floor(eggs / 7);\n\n // Repeate complete cycles\n if (cycles > 1) for (let jj = 1; jj < cycles; colorsSequence.push(...['R', 'O', 'Y', 'G', 'B', 'I', 'V']), jj++);\n\n // Add extra colors in the right position\n for (let ii = 0; ii < extraColors; ii++) colorsSequence = helpers.insterAt(colorsSequence, ii + 4, colorsSequence[ii]);\n\n\n console.log(colorsSequence.join(''))\n\n\n});\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "3a43984623c8c8f524db79477c522390", "src_uid": "dc3817c71b1fa5606f316e5e94732296", "difficulty": 1200.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\n\tvar n = Number(line[0]);\n\tvar d = Number(line[1]);\n\tvar numbers = readline().split(' ');\n\tnumbers.sort(function(a, b) {\n\t\treturn a-b;\n\t});\n\n\tvar i=0;\n\tvar j=n-1;\n\tvar count=0;\n\tvar ready=false;\n\n\twhile(i globalStdin += i);\n\nprocess.stdin.on('end', async () => {\n const lines = globalStdin.split(EOL);\n let [n, k] = lines[0].split(' ').map((v) => parseInt(v));\n let dp = Array.from({length: n+1}, () => new Array(n+1).fill(0));\n dp[0][0] = 1;\n let prev = {};\n for (let i = 1; i <= n; i++) {\n dp[i][0] = 1;\n let c = lines[1][i-1];\n for (let j = 1; j <= n; j++) {\n dp[i][j] = dp[i-1][j-1] + dp[i-1][j];\n if (prev[c]) dp[i][j] -= dp[prev[c] - 1][j - 1];\n }\n prev[c] = i;\n }\n let sum = 0;\n for (let i = n; i >= 0; i--) {\n if (dp[n][i] > k) {\n sum += (n - i) * k;\n k = 0;\n break;\n }\n k -= dp[n][i];\n sum += (n - i) * dp[n][i];\n } \n console.log(k ? -1 : sum);\n});", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "7a85244d5591264a320ba3a6d4ea70fa", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "JavaScript", "source_code": "var line = readline().split(' ');\nvar n = parseInt(line[0], 10), p = parseFloat(line[1], 10), t = parseInt(line[2], 10);\nif (t < n) {\n\tn = t;\n}\nvar f = new Array(t+1);\nfor (var i = 0; i < t + 1; i++) {\n\tf[i] = new Array(n + 1);\n}\nf[1][1] = p;\nf[1][0] = 1 - p;\nfor (var i = 2; i <= t; i++) {\n\tfor (var j = 0; j <= n; j++) {\n\t\tf[i][j] = 0.0;\n\t\tif (j != 0) {\n\t\t\tif (f[i-1][j-1] === undefined) {\n\t\t\t\tf[i-1][j-1] = 0;\n\t\t\t}\n\t\t\tf[i][j] += f[i - 1][j - 1] * p;\n\t\t}\n\t\tif (f[i-1][j] === undefined) {\n\t\t\tf[i-1][j] = 0;\n\t\t}\n\t\tif (j == n) {\n\t\t\tf[i][j] += f[i-1][j];\n\t\t} else {\n\t\t\tf[i][j] += f[i-1][j] * (1 - p);\t\t\t\n\t\t}\n\t}\n}\n\nvar ans = 0.0;\nfor (var i = 1; i <= n; i++) {\n\tans += f[t][i] * i;\n}\n\nprint(ans);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "070ccfecbbc3941b11a4ddfbe279f71a", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar integers = tokenizeIntegers(readline());\n\tvar rowNum = integers[0], colNum = integers[1], jumpSize = integers[2];\n\n\tfunction solve(distance, jump) {\n\t\tvar count = Math.floor(distance/jump);\n\t\tif (distance%jump != 0) {\n\t\t\tcount += 1;\n\t\t}\n\t\tvar rightmost = (count-1)*jump;\n\t\tvar moves = distance - rightmost;\n\t\treturn count*moves;\n\t}\n\n\tprint(solve(rowNum, jumpSize) * solve(colNum, jumpSize));\n}\n\nmain();\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "06682b2edae121520d17074600168835", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "JavaScript", "source_code": "\nvar x = readline().split(\" \").map( function (x) { return parseInt(x); } );\nvar n = 0, ans = -1;\n\nfor (var i = 0, str = readline(); i < str.length; i++)\n if (str.charAt(i) == '1') n++;\n\nfor (var i = 1; i <= n; i++) {\n var nm = parseInt(x[0] / i);\n var cost = (i - x[0] % i) * (x[1] + x[2] * Math.pow(nm - 1, 2)) +\n (x[0] % i) * (x[1] + x[2] * nm * nm);\n if (ans == -1 || cost < ans)\n ans = cost;\n}\n\nprint(ans);\n", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "37475e08f7171ce7d11d99b376406fc3", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "difficulty": 2100.0} {"lang": "JavaScript", "source_code": "\nvar l = readline().split(' ');\nvar a,b,w,x,c;\na=+l[0];\nb=+l[1];\nw=+l[2];\nx=+l[3];\nc=+l[4];\n\nvar _b=b;\nvar _a=a;\nvar step=0;\nwhile(c>a){\n\tc--;\n\tif(b>=x){\n\t\tb=b-x;\n\t}else{\n\t\ta=a-1;\n\t\tb=w+(b-x);\n\t}\n\tstep++;\n\tif(b==_b){\n\t\tbreak;\n\t}\n}\n\n\nvar o=step;\nvar _a=_a-a;\nif(c>a){\n\n\twhile(c>a){\n\t\tc-=o*1000;\n\t\ta-=_a*1000;\n\t\tstep+=o*1000;\n\t}\n\twhile(ca){\n\t\tc--;\n\t\tif(b>=x){\n\t\t\tb=b-x;\n\t\t}else{\n\t\t\ta=a-1;\n\t\t\tb=w+(b-x);\n\t\t}\n\t\tstep++;\n\t}\n}\n\n\nprint(step);", "lang_cluster": "Javascript", "compilation_error": false, "code_uid": "315a3cc65a53aedf18c82ecf8d561147", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0}