source
stringclasses
4 values
task_type
stringclasses
1 value
in_source_id
stringlengths
0
138
problem_statement
stringlengths
219
13.2k
gold_standard_solution
stringlengths
0
413k
problem_id
stringlengths
5
10
metadata
dict
verification_info
dict
apps
verifiable_code
156
Solve the following coding problem using the programming language python: Today, Osama gave Fadi an integer $X$, and Fadi was wondering about the minimum possible value of $max(a, b)$ such that $LCM(a, b)$ equals $X$. Both $a$ and $b$ should be positive integers. $LCM(a, b)$ is the smallest positive integer that is divisible by both $a$ and $b$. For example, $LCM(6, 8) = 24$, $LCM(4, 12) = 12$, $LCM(2, 3) = 6$. Of course, Fadi immediately knew the answer. Can you be just like Fadi and find any such pair? -----Input----- The first and only line contains an integer $X$ ($1 \le X \le 10^{12}$). -----Output----- Print two positive integers, $a$ and $b$, such that the value of $max(a, b)$ is minimum possible and $LCM(a, b)$ equals $X$. If there are several possible such pairs, you can print any. -----Examples----- Input 2 Output 1 2 Input 6 Output 2 3 Input 4 Output 1 4 Input 1 Output 1 1 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import math x = int(input()) ans = 10**13 ab = [1, 1] for i in range(1, int(x**(1/2))+1): if x % i == 0: a = x//i b = i g = math.gcd(a, b) a *= g b *= g if ans > max(a, b): ans = max(a, b) ab = [a, b] print(ab[0], ab[1]) ```
vfc_10378
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1285/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n", "output": "1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "1 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n", "output": "8 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200560490130\n", "output": "448630 447051\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999989\n", "output": "1 999999999989\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000\n", "output": "4096 244140625\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999966000289\n", "output": "1 999966000289\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "991921850317\n", "output": "1 991921850317\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "997167959139\n", "output": "1043317 955767\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "244641009859\n", "output": "15703 15579253\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483524125987\n", "output": "1967 245818061\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "726702209411\n", "output": "623971 1164641\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "965585325539\n", "output": "163 5923836353\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "213058376259\n", "output": "3 71019458753\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "690824608515\n", "output": "45 15351657967\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "551519879446\n", "output": "142 3883942813\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179452405440\n", "output": "429120 418187\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "665808572289\n", "output": "8043 82781123\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "438282886646\n", "output": "652531 671666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "451941492387\n", "output": "427623 1056869\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "934002691939\n", "output": "23 40608812693\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "375802030518\n", "output": "438918 856201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "614685146646\n", "output": "6 102447524441\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "857863230070\n", "output": "1040215 824698\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "101041313494\n", "output": "176374 572881\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "344219396918\n", "output": "2 172109698459\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "583102513046\n", "output": "2 291551256523\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "821985629174\n", "output": "2 410992814587\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69458679894\n", "output": "6 11576446649\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "308341796022\n", "output": "234 1317699983\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "418335521569\n", "output": "119 3515424551\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "904691688417\n", "output": "576747 1568611\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "147869771841\n", "output": "314347 470403\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "386752887969\n", "output": "147 2630972027\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "629930971393\n", "output": "16938637 37189\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "873109054817\n", "output": "5981551 145967\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111992170945\n", "output": "459005 243989\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "355170254369\n", "output": "7 50738607767\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "946248004555\n", "output": "1855 510106741\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "185131120683\n", "output": "213 869160191\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "432604171403\n", "output": "2083223 207661\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "671487287531\n", "output": "389527 1723853\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "914665370955\n", "output": "105 8711098771\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "157843454379\n", "output": "382083 413113\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "401021537803\n", "output": "583081 687763\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "639904653932\n", "output": "1004 637355233\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "878787770060\n", "output": "1274860 689321\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "126260820780\n", "output": "22380 5641681\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "713043603670\n", "output": "1056710 674777\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "956221687094\n", "output": "1024054 933761\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "199399770518\n", "output": "12662 15747889\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "681460970070\n", "output": "910590 748373\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "924639053494\n", "output": "598 1546219153\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "167817136918\n", "output": "94606 1773853\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "406700253046\n", "output": "2 203350126523\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "645583369174\n", "output": "7222 89391217\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "893056419894\n", "output": "102 8755455097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484134170081\n", "output": "1186583 408007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "723017286209\n", "output": "528287 1368607\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "966195369633\n", "output": "39 24774240247\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "205078485761\n", "output": "185921 1103041\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "452551536481\n", "output": "11 41141048771\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "691434652609\n", "output": "1005947 687347\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "934612736033\n", "output": "89 10501266697\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "173495852161\n", "output": "1 173495852161\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "416673935585\n", "output": "309655 1345607\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "659852019009\n", "output": "2104677 313517\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "287784545004\n", "output": "482119 596916\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "526667661132\n", "output": "214836 2451487\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "769845744556\n", "output": "1229116 626341\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8728860684\n", "output": "348 25082933\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "256201911404\n", "output": "4 64050477851\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "495085027532\n", "output": "53932 9179801\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "738263110956\n", "output": "4956 148963501\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "981441194380\n", "output": "438980 2235731\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "220324310508\n", "output": "12 18360359209\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "463502393932\n", "output": "2372 195405731\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "54580144118\n", "output": "2 27290072059\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2038074743\n", "output": "1 2038074743\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "252097800623\n", "output": "1 252097800623\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "518649879439\n", "output": "1 518649879439\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "963761198400\n", "output": "969408 994175\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
157
Solve the following coding problem using the programming language python: Nikolay has a lemons, b apples and c pears. He decided to cook a compote. According to the recipe the fruits should be in the ratio 1: 2: 4. It means that for each lemon in the compote should be exactly 2 apples and exactly 4 pears. You can't crumble up, break up or cut these fruits into pieces. These fruits — lemons, apples and pears — should be put in the compote as whole fruits. Your task is to determine the maximum total number of lemons, apples and pears from which Nikolay can cook the compote. It is possible that Nikolay can't use any fruits, in this case print 0. -----Input----- The first line contains the positive integer a (1 ≤ a ≤ 1000) — the number of lemons Nikolay has. The second line contains the positive integer b (1 ≤ b ≤ 1000) — the number of apples Nikolay has. The third line contains the positive integer c (1 ≤ c ≤ 1000) — the number of pears Nikolay has. -----Output----- Print the maximum total number of lemons, apples and pears from which Nikolay can cook the compote. -----Examples----- Input 2 5 7 Output 7 Input 4 7 13 Output 21 Input 2 3 2 Output 0 -----Note----- In the first example Nikolay can use 1 lemon, 2 apples and 4 pears, so the answer is 1 + 2 + 4 = 7. In the second example Nikolay can use 3 lemons, 6 apples and 12 pears, so the answer is 3 + 6 + 12 = 21. In the third example Nikolay don't have enough pears to cook any compote, so the answer is 0. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n1 = int( input() ) n2 = int( input() ) n3 = int( input() ) print( min( n1 , n2 // 2 , n3 // 4 ) * 7 ) ```
vfc_10382
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/746/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n5\n7\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n7\n13\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n1000\n1000\n", "output": "1750\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1000\n1000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n1\n1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n2\n1000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n500\n1000\n", "output": "1750\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n1000\n4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n1000\n3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n8\n12\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n20\n40\n", "output": "70\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n200\n399\n", "output": "693\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n400\n800\n", "output": "1400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "199\n400\n800\n", "output": "1393\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "201\n400\n800\n", "output": "1400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n399\n800\n", "output": "1393\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n401\n800\n", "output": "1400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n400\n799\n", "output": "1393\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n400\n801\n", "output": "1400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "139\n252\n871\n", "output": "882\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109\n346\n811\n", "output": "763\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "237\n487\n517\n", "output": "903\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "161\n331\n725\n", "output": "1127\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "39\n471\n665\n", "output": "273\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n270\n879\n", "output": "63\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "137\n422\n812\n", "output": "959\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n313\n525\n", "output": "105\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "189\n407\n966\n", "output": "1323\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n268\n538\n", "output": "126\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "146\n421\n978\n", "output": "1022\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70\n311\n685\n", "output": "490\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "244\n405\n625\n", "output": "1092\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "168\n454\n832\n", "output": "1176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n344\n772\n", "output": "322\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "174\n438\n987\n", "output": "1218\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "144\n387\n693\n", "output": "1008\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n481\n633\n", "output": "154\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "196\n280\n848\n", "output": "980\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "190\n454\n699\n", "output": "1218\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "231\n464\n928\n", "output": "1617\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "151\n308\n616\n", "output": "1057\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88\n182\n364\n", "output": "616\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n26\n52\n", "output": "84\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "204\n412\n824\n", "output": "1428\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "127\n256\n512\n", "output": "889\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "224\n446\n896\n", "output": "1561\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "146\n291\n584\n", "output": "1015\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83\n164\n332\n", "output": "574\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n38\n80\n", "output": "133\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "198\n393\n792\n", "output": "1372\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "120\n239\n480\n", "output": "833\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "208\n416\n831\n", "output": "1449\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "130\n260\n517\n", "output": "903\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67\n134\n267\n", "output": "462\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "245\n490\n979\n", "output": "1708\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "182\n364\n727\n", "output": "1267\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "104\n208\n413\n", "output": "721\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2\n100\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100\n100\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3\n8\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n8\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n200\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4\n16\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n10\n10\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n4\n8\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4\n1000\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n6\n12\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n7\n4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10\n100\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3\n4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n999\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n10\n20\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n18\n20\n", "output": "35\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1\n100\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n7\n80\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n8\n24\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n100\n100\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1\n8\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5\n23\n", "output": "14\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
158
Solve the following coding problem using the programming language python: Berland annual chess tournament is coming! Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organizers should guarantee the win for the team of BerOil. Thus, organizers should divide all 2·n players into two teams with n people each in such a way that the first team always wins. Every chess player has its rating r_{i}. It is known that chess player with the greater rating always wins the player with the lower rating. If their ratings are equal then any of the players can win. After teams assignment there will come a drawing to form n pairs of opponents: in each pair there is a player from the first team and a player from the second team. Every chess player should be in exactly one pair. Every pair plays once. The drawing is totally random. Is it possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing? -----Input----- The first line contains one integer n (1 ≤ n ≤ 100). The second line contains 2·n integers a_1, a_2, ... a_2n (1 ≤ a_{i} ≤ 1000). -----Output----- If it's possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing, then print "YES". Otherwise print "NO". -----Examples----- Input 2 1 3 2 4 Output YES Input 1 3 3 Output NO The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) z = list(map(int, input().split())) z.sort() if z[n - 1] < z[n]: print("YES") else: print("NO") ```
vfc_10386
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/845/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n1 3 2 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 2 2 3 3 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 1 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\n919 240 231 858 456 891 959 965 758 30 431 73 505 694 874 543 975 445 16 147 904 690 940 278 562 127 724 314 30 233 389 442 353 652 581 383 340 445 487 283 85 845 578 946 228 557 906 572 919 388 686 181 958 955 736 438 991 170 632 593 475 264 178 344 159 414 739 590 348 884\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 10 10 6 7 8 9\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 1 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10 4 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 4 5 4 6 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 5 4 5 8 3 1 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n8 2 2 4 1 4 10 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 8 10 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 4 4 5 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 3 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 2 7 3 9 4 1 5 10 3 6 1 10 7 8 5 7 6 1 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 3 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 2 3 4 5 6 7 7 8 9 10 11 12 19\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 5 3 3 5 6 7\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 2 2 3 3 3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "51\n576 377 63 938 667 992 959 997 476 94 652 272 108 410 543 456 942 800 917 163 931 584 357 890 895 318 544 179 268 130 649 916 581 350 573 223 495 26 377 695 114 587 380 424 744 434 332 249 318 522 908 815 313 384 981 773 585 747 376 812 538 525 997 896 859 599 437 163 878 14 224 733 369 741 473 178 153 678 12 894 630 921 505 635 128 404 64 499 208 325 343 996 970 39 380 80 12 756 580 57 934 224\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 3 3 2 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 3 3 6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 7 19 19 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 3 5 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n6 6 5 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 1 3 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 3 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 1 3 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 5 6 4 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 2 3 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n100 99 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 6 5 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2 1 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 4 5 6 7 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n6 5 3 3 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 5 6 8 6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 5 3 3 3 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n7 7 4 5 319 19\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 4 4 3 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 3 4 5 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 4 5 3 6 7 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 3 4 4 5 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 4 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 5 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 3 4 5 6 7 8 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 3 5 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 4 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 4 5 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 1 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 5 6 7 8 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 3 3 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 1 2 4 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3 3 4 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 2 4 5 5 5 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 3 2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 4 4 2 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 7 1 2 3 5 6 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 2 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 3 1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n8 6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n6 7 6 7 3 1 9 4 6 10 8 2 5 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 9 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 3 3 3\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
159
Solve the following coding problem using the programming language python: You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want not greater than 10^9 in any place in the array. An array is co-prime if any two adjacent numbers of it are co-prime. In the number theory, two integers a and b are said to be co-prime if the only positive integer that divides both of them is 1. -----Input----- The first line contains integer n (1 ≤ n ≤ 1000) — the number of elements in the given array. The second line contains n integers a_{i} (1 ≤ a_{i} ≤ 10^9) — the elements of the array a. -----Output----- Print integer k on the first line — the least number of elements needed to add to the array a to make it co-prime. The second line should contain n + k integers a_{j} — the elements of the array a after adding k elements to it. Note that the new array should be co-prime, so any two adjacent values should be co-prime. Also the new array should be got from the original array a by adding k elements to it. If there are multiple answers you can print any one of them. -----Example----- Input 3 2 7 28 Output 1 2 7 9 28 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import fractions n = int(input()) A = [int(x) for x in input().split()] B = [] for i in range(n-1): B.append(A[i]) if fractions.gcd(A[i], A[i+1]) != 1: B.append(1) B.append(A[-1]) print(len(B) - n) print(' '.join(map(str, B))) ```
vfc_10390
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/660/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n2 7 28\n", "output": "1\n2 7 1 28\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "0\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n548\n", "output": "0\n548\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n963837006\n", "output": "0\n963837006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n1 1 1 1 1 1 1 1 1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n26 723 970 13 422 968 875 329 234 983\n", "output": "2\n26 723 970 13 422 1 968 875 1 329 234 983\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n319645572 758298525 812547177 459359946 355467212 304450522 807957797 916787906 239781206 242840396\n", "output": "7\n319645572 1 758298525 1 812547177 1 459359946 1 355467212 1 304450522 807957797 916787906 1 239781206 1 242840396\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 2 1 1 2 1 1 1 2 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 2 1 1 1 1 2 2 2 2 2 2 2 1 1 1 2 1 2 1\n", "output": "19\n1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 2 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n591 417 888 251 792 847 685 3 182 461 102 348 555 956 771 901 712 878 580 631 342 333 285 899 525 725 537 718 929 653 84 788 104 355 624 803 253 853 201 995 536 184 65 205 540 652 549 777 248 405 677 950 431 580 600 846 328 429 134 983 526 103 500 963 400 23 276 704 570 757 410 658 507 620 984 244 486 454 802 411 985 303 635 283 96 597 855 775 139 839 839 61 219 986 776 72 729 69 20 917\n", "output": "38\n591 1 417 1 888 251 792 1 847 685 3 182 461 102 1 348 1 555 956 771 901 712 1 878 1 580 631 342 1 333 1 285 899 525 1 725 537 718 929 653 84 1 788 1 104 355 624 803 1 253 853 201 995 536 1 184 65 1 205 1 540 1 652 549 1 777 248 405 677 950 431 580 1 600 1 846 1 328 429 134 983 526 103 500 963 400 23 1 276 1 704 1 570 757 410 1 658 507 620 1 984 1 244 1 486 1 454 1 802 411 985 303 635 283 96 1 597 1 855 1 775 139 839 1 839 61 219 986 1 776 1 72 1 729 1 69 20 917\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n472882027 472882027 472882027 472882027 472882027\n", "output": "4\n472882027 1 472882027 1 472882027 1 472882027 1 472882027\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 1000000000\n", "output": "1\n1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n8 6\n", "output": "1\n8 1 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n100000000 1000000000 1000000000\n", "output": "2\n100000000 1 1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 5\n", "output": "0\n1 2 3 4 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000\n", "output": "19\n2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000 1 2 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n223092870 23\n", "output": "1\n223092870 1 23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100000003 100000003\n", "output": "1\n100000003 1 100000003\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999937 999999937\n", "output": "1\n999999937 1 999999937\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n999 999999937 999999937 999\n", "output": "1\n999 999999937 1 999999937 999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999929 999999929\n", "output": "1\n999999929 1 999999929\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1049459 2098918\n", "output": "1\n1049459 1 2098918\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n352229 704458\n", "output": "1\n352229 1 704458\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n7293 4011\n", "output": "1\n7293 1 4011\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5565651 3999930\n", "output": "1\n5565651 1 3999930\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n997 997\n", "output": "1\n997 1 997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n9994223 9994223 9994223\n", "output": "2\n9994223 1 9994223 1 9994223\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99999998 1000000000\n", "output": "1\n99999998 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1000000000 1000000000 1000000000\n", "output": "2\n1000000000 1 1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n130471 130471\n", "output": "1\n130471 1 130471\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1000000000 2 2\n", "output": "2\n1000000000 1 2 1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n223092870 66526\n", "output": "1\n223092870 1 66526\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n1000000000 1000000000 223092870 223092870 6 105 2 2 510510 510510 999999491 999999491 436077930 570018449\n", "output": "10\n1000000000 1 1000000000 1 223092870 1 223092870 1 6 1 105 2 1 2 1 510510 1 510510 999999491 1 999999491 436077930 1 570018449\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3996017 3996017\n", "output": "1\n3996017 1 3996017\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999983 999983\n", "output": "1\n999983 1 999983\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n618575685 773990454\n", "output": "1\n618575685 1 773990454\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n9699690 3 7\n", "output": "1\n9699690 1 3 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999999 999999996\n", "output": "1\n999999999 1 999999996\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99999910 99999910\n", "output": "1\n99999910 1 99999910\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n1000000000 1000000000 223092870 223092870 6 105 2 2 510510 510510 999999491 999999491\n", "output": "9\n1000000000 1 1000000000 1 223092870 1 223092870 1 6 1 105 2 1 2 1 510510 1 510510 999999491 1 999999491\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n999999937 999999937 999999937\n", "output": "2\n999999937 1 999999937 1 999999937\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99839 99839\n", "output": "1\n99839 1 99839\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n19999909 19999909 19999909\n", "output": "2\n19999909 1 19999909 1 19999909\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1000000000 1 1000000000\n", "output": "0\n1 1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n64006 64006\n", "output": "1\n64006 1 64006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1956955 1956955\n", "output": "1\n1956955 1 1956955\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1000000000 1000000000\n", "output": "1\n1 1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n982451707 982451707\n", "output": "1\n982451707 1 982451707\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999733 999999733\n", "output": "1\n999999733 1 999999733\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n999999733 999999733 999999733\n", "output": "2\n999999733 1 999999733 1 999999733\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3257 3257\n", "output": "1\n3257 1 3257\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n223092870 181598\n", "output": "1\n223092870 1 181598\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n959919409 105935 105935\n", "output": "2\n959919409 1 105935 1 105935\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n510510 510510\n", "output": "1\n510510 1 510510\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n223092870 1000000000 1000000000\n", "output": "2\n223092870 1 1000000000 1 1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n1000000000 2 1000000000 3 1000000000 6 1000000000 1000000000 15 1000000000 1000000000 1000000000 100000000 1000\n", "output": "11\n1000000000 1 2 1 1000000000 3 1000000000 1 6 1 1000000000 1 1000000000 1 15 1 1000000000 1 1000000000 1 1000000000 1 100000000 1 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 982451653 982451653 1 982451653 982451653 982451653\n", "output": "3\n1 982451653 1 982451653 1 982451653 1 982451653 1 982451653\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100000007 100000007\n", "output": "1\n100000007 1 100000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n999999757 999999757 999999757\n", "output": "2\n999999757 1 999999757 1 999999757\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n99999989 99999989 99999989\n", "output": "2\n99999989 1 99999989 1 99999989\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 4 982451707 982451707 3\n", "output": "2\n2 1 4 982451707 1 982451707 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n20000014 20000014\n", "output": "1\n20000014 1 20000014\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99999989 99999989\n", "output": "1\n99999989 1 99999989\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n111546435 111546435\n", "output": "1\n111546435 1 111546435\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n55288874 33538046\n", "output": "1\n55288874 1 33538046\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n179424673 179424673 179424673 179424673 179424673\n", "output": "4\n179424673 1 179424673 1 179424673 1 179424673 1 179424673\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n199999978 199999978\n", "output": "1\n199999978 1 199999978\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 2\n", "output": "1\n1000000000 1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n19999897 19999897 19999897\n", "output": "2\n19999897 1 19999897 1 19999897\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n19999982 19999982\n", "output": "1\n19999982 1 19999982\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10000007 10000007\n", "output": "1\n10000007 1 10000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n999999937 999999937 2\n", "output": "1\n999999937 1 999999937 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2017 2017 2017 2017 2017\n", "output": "4\n2017 1 2017 1 2017 1 2017 1 2017\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n19999909 39999818\n", "output": "1\n19999909 1 39999818\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n62615533 7919\n", "output": "1\n62615533 1 7919\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n39989 39989 33 31 29\n", "output": "1\n39989 1 39989 33 31 29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 100000\n", "output": "1\n1000000000 1 100000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1938 10010\n", "output": "1\n1938 1 10010\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n199999 199999\n", "output": "1\n199999 1 199999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n107273 107273\n", "output": "1\n107273 1 107273\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n49999 49999 49999\n", "output": "2\n49999 1 49999 1 49999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1999966 1999958\n", "output": "1\n1999966 1 1999958\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n86020 300846\n", "output": "1\n86020 1 300846\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999997 213\n", "output": "1\n999999997 1 213\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n200000014 200000434\n", "output": "1\n200000014 1 200000434\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
160
Solve the following coding problem using the programming language python: We have a sequence of N integers: A_1, A_2, \cdots, A_N. You can perform the following operation between 0 and K times (inclusive): - Choose two integers i and j such that i \neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element. Compute the maximum possible positive integer that divides every element of A after the operations. Here a positive integer x divides an integer y if and only if there exists an integer z such that y = xz. -----Constraints----- - 2 \leq N \leq 500 - 1 \leq A_i \leq 10^6 - 0 \leq K \leq 10^9 - All values in input are integers. -----Input----- Input is given from Standard Input in the following format: N K A_1 A_2 \cdots A_{N-1} A_{N} -----Output----- Print the maximum possible positive integer that divides every element of A after the operations. -----Sample Input----- 2 3 8 20 -----Sample Output----- 7 7 will divide every element of A if, for example, we perform the following operation: - Choose i = 2, j = 1. A becomes (7, 21). We cannot reach the situation where 8 or greater integer divides every element of A. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python # 割り切る数は、Aの総和の約数である # 自分自身を除く約数について大きい順にすべて試して、当てはまるものがあれば答え # 8,20を7の倍数に近づけるとき、 # 8 -> mod 7が1であり、-1か+6で7の倍数になる # 20 -> mod 7が6であり、-6か+1で7の倍数になる # -1と+1をペアにすることが出来て、この操作回数1をK = 3から引くと2となり、これが偶数ならOK import sys readline = sys.stdin.readline N,K = map(int,readline().split()) A = list(map(int,readline().split())) all = sum(A) divisors = [] for i in range(1,int(all ** 0.5) + 1): if all % i == 0: divisors.append(i) divisors.append(all // i) divisors = sorted(divisors,reverse = True) #print(divisors) for d in divisors: mods = [0] * (N) for i in range(len(A)): mods[i] = A[i] % d mods = sorted(mods) #print("d",d,"mods",mods) mods_front = [0] * N mods_front[0] = mods[0] for i in range(1,N): mods_front[i] = mods_front[i - 1] + mods[i] mods_back = [0] * N mods_back[-1] = d - mods[-1] #print("mods_front",mods_front) for i in range(N - 2,-1,-1): mods_back[i] = mods_back[i + 1] + (d - mods[i]) #print("mods_back",mods_back) for i in range(N - 1): if mods_front[i] == mods_back[i + 1]: if K >= min(mods_front[i],mods_back[i + 1]): print(d) return else: print(1) ```
vfc_10394
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://atcoder.jp/contests/abc136/tasks/abc136_e", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 3\n8 20\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n3 5\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n10 1 2 22\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 7\n1 7 5 6 8 2 6 5\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 1000000000\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 834276\n829289 870458\n", "output": "1699747\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n123817 819725\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 411810\n561589 20609\n", "output": "582198\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n593967 290959\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 426922\n243129 295272\n", "output": "538401\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n555782 754358\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 453659\n60979 705813 913579 278694 782818 795359 44732 929966 831304\n", "output": "144412\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 11\n513652 691723 327713 3573 278 203302 761284 125217 249435 17 200103 213023 753 440561 339013 3685 915608 957575\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 303798\n233279 936038 30152 626165 894770\n", "output": "4244\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 11\n585497 618838 999873 998905 999451 65474 332724 996156 631456 989790 999956 266177 168809 996188\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "496 143612745\n577323 1 4 99829 619 657602 1 627656 26634 828423 66791 890222 849875 943454 330663 1 367068 1 909810 762354 163338 1 1 944683 960492 915295 223444 796681 306235 1 882479 1525 773499 1 889 232264 1 715173 494832 1 410632 645478 1 324735 840094 170757 1 147194 391322 278797 1 625305 1 1 910019 1 932782 1 53 627451 503657 625484 1 310815 1 332698 317382 80975 537812 864519 217146 536543 821480 3364 926128 825125 957769 1 1 371549 1 233730 917069 953183 808773 1 1 956579 493300 1 375783 157240 6074 1 322360 270167 132549 532086 1 1 98998 677594 131446 20545 811201 824993 308467 450722 928869 1 503884 1 159201 587083 429308 955057 590878 736958 543778 549143 564628 840936 712959 22834 228786 269516 284826 853739 390429 517984 287129 264839 1 113251 923336 957070 1 524545 1 1 380518 517232 1 1 395134 223358 1 23613 814268 50871 1 50407 507390 864366 1 217827 1 799855 1 1 215593 1914 136845 545831 175034 793244 695937 742128 593567 507606 1 402419 905422 233687 218319 748868 2766 18055 485213 104819 125733 839205 1 758203 1 1 653037 359945 1 138652 160082 768083 109237 46053 1 82544 674271 950752 166656 1 1 1 1 869865 1 1 749724 1 767949 995589 274072 1 335996 607115 1 133914 912543 2257 1 468991 506833 876641 850811 54088 85479 532551 1 1 774341 655605 238581 13 717026 309318 689741 488071 1 1 918182 359757 1 88767 327183 635138 155073 445730 1 137457 1 403494 627427 600135 1 405101 1 1 208781 531114 1 609347 61194 1 697472 609424 321419 1 1 1 1 347926 13638 348578 748386 237295 105018 992506 69747 697302 1 156596 245993 1 711444 1 748958 476196 269302 616532 387693 58251 1 243395 800248 932688 46408 477955 227442 190096 639726 743705 247374 1 1 489150 1 8588 496737 69767 847426 200402 163972 1 8204 177768 969868 614027 484709 258915 359930 1 1 324503 1 523872 490076 125131 741725 149292 325551 2119 905177 1 703064 436476 1 515074 968721 35969 710060 997665 1 752132 523483 805627 179673 1 579436 124199 1 956214 191397 411463 1 197465 640808 454111 448543 533920 850236 1 567699 1 8088 690193 605243 253622 894419 1 1 523900 522955 1 1 1 99891 206077 576461 387165 141429 1 307982 496230 48 646835 886161 810752 428118 1 3452 580936 218798 998817 157890 25600 1 519006 686356 89722 1 1 924989 1 1 634865 718832 196085 795403 916480 968508 281351 119546 240751 1 497756 620852 950510 2561 457740 972927 154002 1 391302 1 1 623311 3416 1 836015 4 137986 193895 1 1 472316 412898 451724 278275 586526 1 486074 733750 184105 138010 809582 1 1 98501 573818 832905 897921 962003 1 172344 449138 1 492629 806858 626705 522535 857259 1 670904 169523 562106 1 445088 224348 971547 27753 1 344761 186466 1 348939 679436 71516 1 736605 75438 396792 594258 621829 47972 860469 237907 196415 604987 818789 1 700249 1 1 634252 1 100522 901598\n", "output": "4323409\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 30\n1000000 977013 1000000 1000000 1000000 1000000 475337 106308 27010 1000000 814397 1000000 793497 1000000 1000000 1000000 275683 332344 198618 1000000 1000000 1000000 96106 967744 1000000 1000000 1000000 1000000 1000000 391750 1000000 1000000 290817 479743 1000000 1000000 1000000 1000000 43331 1000000 104569 1000000 1000000 1000000 1000000 311327 370271 112822 1000000 64701 949178 941985 50582 1000000 864725 1000000 1000000 999429 661160 1000000 1000000 411892 1000000 1000000 505215 1000000 1000000 1000000 453356 1000000 309491 1000000 1000000 1000000 767957 437328 1000000 767784 191465 1000000 877619 1000000 418441 1000000 1000000 1000000 1000000 223595 796696 26690 858774 1000000 870215 1000000 1000000 695987 177735 905752 1000000 653500 1000000 261531 1000000 1000000 354206 1000000 1000000 1000000 38224 1000000 347150 1000000 1000000 1000000 372602 1000000 1000000 258682 1000000 1000000 664439 1000000 1000000 1000000 1000000 806845 329681 251991 1000000 33754 1000000 1000000 967976 536285 1000000 1000000 885012 1000000 1000000 1000000 1000000 540246 190410 1000000 743866 692311 1000000 1000000 1000000 626544 47382 1000000 1000000 1000000 1000000 983882 1000000 743569 1000000 198052 1000000 282901 1000000 1000000 1000000 1000000 1000000 796060 1000000 17055 72236 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 719021 1000000 653785 1000000 517502 1000000 1000000 1000000 670555 1000000 1000000 75585 1000000 1000000 1000000 1000000 33542 1000000 1000000 384816 1000000 1000000 1000000 1000000 1000000 412134 1000000 840209 1000000 1000000 1000000 336374 1000000 1000000 1000000 282717 1000000 1000000 516109 1000000 1000000 129442 1000000 981095 1000000 683615 311423 1000000 638684 1000000 136459 271248 999351 965848 1000000 1000000 1000000 230939 1000000 1000000 1000000 131784 405956 204089 802679 193867 1000000 261784 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 805721 372748 808385 1000000 587461 1000000 1000000 771038 60701 7062 1000000 1000000 1000000 1000000 65589 971899 1000000 1000000 1000000 1000000 656136 1000000 425020 1000000 1000000 400900 1000000 999662 1000000 793150 684100 1000000 718790 149334 236904 375656 1000000 1000000 1000000 1000000 1000000 1000000 894028 813888 1000000 1000000 1000000 412766 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 322125 1000000 339919 666734 1000000 1000000 1000000 6060 1000000 198114 1000000 1000000 907442 1000000 1000000 180537 1000000 225916 960346 1000000 1000000 1000000 1000000 517823 1000000 1000000 1000000 29902 1000000 1000000 1000000 1000000 1000000 1000000 1000000 631149 1000000 1000000 1000000 1000000 1000000 367879 1000000 1000000 1000000 1000000 341448 1000000 1000000 1000000 797607 1000000 1000000 1000000 121047 1000000 1000000 1000000 856281 1000000 1000000 230932 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 981905 1000000 1000000 761829 292640 1000000 829186 999998 1000000 645089 1000000 54195 107752 1000000 807516 1000000 425725 1000000 573831 1000000 735660 1000000 598790 1000000 1000000 1000000 1000000 155322 239470 1000000 585210 1000000 1000000 1000000 1000000 611007 1000000 1000000 1000000 492086 1000000 1000000 1000000 1000000 308254 1000000 1000000 4257 1000000 1000000 1000000 462816 930164 1000000 515310 575466 597654 1000000 1000000 1000000 81359 1000000 1000000 144868 1000000 1000000 1000000 510033 95439 1000000 652288 1000000 1000000 1000000 1000000 95827 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 167468 1000000 255129 193671 533718 1000000 1000000 1000000 91803 1000000 1000000 1000000 1000000 1000000 1000000 1000000 810260 999975 1000000 323426 1000000 862116 577058 1000000 1000000 316878 1000000 1000000 1000000 257130 1000000 404849 1000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "482 7782029\n709172 1 1 1 1 1 1 700969 1 1 1 945725 7062 1 1 601320 1 1 1 441026 1 1 462950 1 294698 1 1 1 1 1 1 1 1 1 1 1 69845 1 1 1 1 1 1 1 1 1 1 1 1 863153 1 1 334985 1 1 1 1 15 1 1 682304 1 1 1 1 1 38588 1 1 910908 1 1 1 1 446329 1 1 868805 1 817638 1 1 1 120 1 1 1 1 1 895524 1 937309 1 1 1 1 1 1 1 1 1 6416 1 1 1 1 1 1 83048 1 309576 786374 1 1 1 1 96593 1 1 944235 1 354965 1 1 1 1 1 635544 1 1 102 955005 1 1 1 346608 1 1 1 1 521085 1 1 1 1 1 1 811354 446813 1 1 1 890734 1 1 1 1 1 1 1 865929 1 425 1 175565 1 1 1 1 1 1 1 1 1 1 1 1 884875 1 1 1 1 1 1 1 1 287177 1 1 1 1 1 1 1 447251 1 1 1 1 1 690854 704320 1 1 1 1 1 1 1 1 1 401350 1 1 1 1 1 1 1 1 1 1 1 1 1 77129 1 905424 469593 1 1 1 529529 1 1 1 556728 1 1 1 1 1 1 727573 1 1 18804 1 1 1 1 852661 1 1 624892 1 1 1 1 1 1 1 1 794627 2066 1 1 190071 1 1 1 1 1 1 1 1 1 452544 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20215 1 1 1 1 1 1 1 1 1 1 1 526386 1 1 597835 960077 246242 1 1 457 1 252202 1 1 156457 1 336732 1 1 828627 1 847117 1 1 1 1 1 740835 1 1 1 680244 993297 1 1 1 1 1 386838 19206 1 1 1 1 1 1 10 1 1 1 1 1 598818 1 1 546347 1 1 1 464861 290545 1 1 5873 1 758484 1 1 694941 1 1 469595 560217 1 1 1 1 1 1 1 1 356162 1 1 1 1 1 1 1 1 1 1 1 1 1 12036 1 786717 1 1 1 1 302110 491771 239794 1 1 1 1 13 1 1 1 1 1 112181 1 1 1 1 1 1 7845 1 1 131652 274577 1 1 1 1 1 1 193796 1 1 1 1 141828 1 419803 1 9 1 60 1 1 1 1 1 1 1 1 1 1 1 1 1 149534 131895 455706 1 1 1 1 1 1 1 1 1 1 1 1 1 1 952475\n", "output": "343426\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "493 95\n1 1 1 1 1 1 1 1 1 1 254 1 1 1 1 1 1 1 1 1 1 444590 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 90 1 1 1 1 1 1 1 1 1 517215 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 394771 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 668 1 1 1 1 1 1 1 1 597147 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 711355 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 36 211 886442 1 101271 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 345 1 1 1 1 242638 1 1 1 1 1 1 2320 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 270313 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 700619 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1459 1 1 43564 1 1 1 1 16746 1 1 1 1 1 1 1 1 1 1 481 1 1 1 437086 1 1 1 1 1 1 1 22898 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 388498 1 1 1 1 1 1 1 1 1 1 1 175410 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11035 1 1 736788 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 680006 1 1 1 1 1 1 1 1 259549 1 1 1 1 1 1 1 1 1 1 1 1 1 835793 1 1 1 1 1 1 1 1 1 1 1 357043 1 1 1 1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "489 208848192\n1000000 203713 1000000 1000000 1000000 1000000 779207 1000000 1000000 1000000 1000000 1000000 60202 47278 481054 99756 1000000 1000000 1000000 1000000 279601 1000000 1000000 440093 1000000 1000000 1000000 1000000 732416 358627 345757 1000000 141430 236585 804495 440937 1000000 1000000 468474 1000000 1000000 433472 1000000 107844 966674 85090 329213 609359 1000000 168783 591649 257510 557069 1000000 1000000 647940 1000000 128277 909710 1000000 676510 567068 1000000 995777 1000000 852662 1000000 891530 970358 1000000 1000000 1000000 1000000 759984 1000000 740017 722790 1000000 793627 371560 1000000 1000000 1000000 269296 1000000 1000000 1000000 877261 248259 576290 438396 1000000 602740 1000000 258544 1000000 893001 1000000 1000000 746437 1000000 1000000 1000000 727246 1000000 631652 168995 1000000 1000000 996518 1000000 156288 854857 1000000 16862 1000000 1000000 764086 526201 230804 489516 1000000 450971 1000000 1000000 1000000 1000000 132360 820471 1000000 1000000 673563 1000000 362496 1000000 713999 1000000 355697 1000000 517703 722291 1000000 1000000 1000000 550827 934571 1000000 1000000 1000000 298085 1000000 1000000 372877 251528 401238 115201 1000000 1000000 1000000 26284 543774 895553 1000000 816391 1000000 1000000 1000000 136033 1000000 1000000 105886 999997 1000000 999972 1000000 943509 55124 1000000 1000000 203352 387890 1000000 999996 1000000 884508 616591 394555 328619 1000000 1000000 1000000 1000000 449155 419414 1000000 891124 72743 254851 1000000 656492 1000000 1000000 1000000 552213 1000000 351015 158856 374703 812656 1000000 1000000 684852 105195 1000000 133283 1000000 999994 274118 835649 173766 1000000 317783 1000000 1000000 1000000 1000000 80733 967242 866783 882206 611015 1000000 1000000 462267 25333 1000000 878563 1000000 999487 97721 1000000 1000000 1000000 1000000 57685 816852 290447 969377 1000000 1000000 1000000 1000000 891159 1000000 940187 743184 1000000 1000000 566078 761722 270591 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 513527 277372 1000000 1000000 1000000 700677 382678 1000000 306218 809444 911153 18712 1000000 1000000 1000000 1000000 1000000 48551 838826 740590 1000000 1000000 1000000 109198 1000000 989067 323189 1000000 988390 424654 1000000 745623 533877 695147 1000000 1000000 352675 1000000 1000000 941957 1000000 1000000 956555 918579 1000000 1000000 1000000 714037 16555 918838 1000000 449628 990487 494970 893002 921167 371398 1000000 334902 620583 600831 1000000 1000000 1000000 1000000 149399 1000000 1000000 1000000 999994 1000000 635262 73703 1000000 295837 1000000 1000000 920981 1000000 296931 808585 1000000 1000000 1000000 426400 537605 339988 240550 435548 294805 1000000 864969 612539 1000000 999995 486364 813148 985722 1000000 1000000 301728 437351 122197 1000000 1000000 201230 1000000 800995 1000000 35719 66547 60970 575057 390337 105461 521464 1000000 1000000 294180 605754 1000000 1000000 957811 1000000 1000000 1000000 1000000 1000000 74984 1000000 655691 1000000 705656 1000000 127571 650684 999993 709152 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 118420 944686 1000000 809460 754650 1000000 1000000 819807 999865 1000000 70161 347955 713700 1000000 905511 1000000 150908 813127 181530 342332 805749 1000000 31487 1000000 1000000 1000000 1000000 1000000 1000000 1000000 978233 1000000 1000000 1000000 1000000 236283 636026 1000000 284503 1000000 681465 999991 50292 1000000 232600 1000000 250966 1000000 1000000 1000000 1000000 253683 603092 1000000 786238 880540 990614 887153 722004 911939 699094 1000000 782750 1000000 1000000 999999 1000000 1000000 1000000 1000000 446112\n", "output": "1464182\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 153\n823822 202652 1000000 386974 1000000 1000000 677799 1000000 1000000 1000000 1000000 273155 48035 267410 801978 867387 1000000 1000000 1000000 1000000 88931 1000000 993092 64944 1000000 1000000 1000000 377952 1000000 1000000 858094 1000000 89156 1000000 813870 968151 942852 628466 936333 848587 1000000 440597 545572 827752 754648 1000000 1000000 1000000 1000000 999949 1000000 1000000 589378 137553 1000000 961009 1000000 1000000 543961 632372 286379 750132 861064 1000000 1000000 16494 1000000 682881 420296 1000000 830539 1000000 531131 993894 179310 988046 974967 58264 996093 729016 540026 1000000 1000000 1000000 913620 1000000 411136 371564 744602 960904 652447 427466 602508 1000000 540660 751984 1000000 312446 981892 1000000 1000000 1000000 954661 1000000 986512 1000000 508204 602398 395891 213148 1000000 758670 899206 1000000 236707 1000000 838768 109760 511052 1000000 545108 1000000 812750 335887 738810 1000000 99024 1000000 237780 887317 534333 1000000 1000000 534965 129564 352359 561717 1000000 869804 225873 1000000 1000000 523621 767328 1000000 436990 411192 427878 1000000 588831 1000000 289486 434301 280969 176500 957015 1000000 209455 991511 1000000 1000000 1000000 352863 568473 435552 998312 687280 1000000 199521 980017 1000000 1000000 1000000 1000000 998842 1000000 1000000 1000000 528379 269669 1000000 118277 105380 211663 535529 284763 102537 1000000 545312 767431 628186 53907 1000000 706372 117763 143365 1000000 679174 356609 689931 1000000 1000000 21350 946712 890134 516322 901927 1000000 1000000 1000000 182668 1000000 1000000 570111 854950 1000000 1000000 1000000 874135 950009 314644 898988 1000000 394372 286115 611659 1000000 528568 229250 1000000 83094 38275 586365 505425 529356 253927 88453 916621 1000000 1000000 1000000 549058 524694 242162 840361 54811 511846 905683 678745 1000000 1000000 1000000 946144 899951 1000000 1000000 953699 961684 1000000 1000000 478850 1000000 860156 13710 308534 1000000 181032 1000000 834015 925653 941336 895119 349644 1000000 525043 1000000 337520 381880 933422 48504 1000000 168252 1000000 1000000 269896 653355 304280 858862 86404 863109 754664 259638 139379 1000000 1000000 739565 306215 676600 1000000 165933 1000000 59599 366001 1000000 1000000 1000000 1000000 391403 309318 451744 1000000 1000000 1000000 222817 802179 999946 1000000 1000000 764028 1000000 700754 105601 257438 10805 142305 989431 808160 1000000 1000000 298365 833037 564452 994847 1000000 1000000 1000000 1000000 1000000 1000000 1000000 546660 298940 1000000 728837 4393 1000000 1000000 1000000 445330 814960 937387 1000000 1000000 1000000 917316 1000000 1000000 1000000 1000000 207335 89086 750075 340516 812391 1000000 770679 358733 530193 952494 1000000 639124 652699 1000000 852793 204143 436257 1000000 45646 294958 991657 1000000 1000000 462660 72102 835259 841672 529329 1000000 579484 1000000 1000000 1000000 117966 610990 169434 1000000 1000000 1000000 476136 1000000 960675 802853 828280 662815 1000000 384704 999490 159455 1000000 1000000 1000000 745194 1000000 500207 1000000 747332 573909 1000000 1000000 531522 538551 1000000 791405 1000000 337276 535960 938102 923245 175941 730164 894332 399468 598634 42574 1000000 837092 314647 862207 305558 60101 725067 1000000 261610 1000000 1000000 816872 916738 1000000 1000000 1000000 1000000 1000000 1000000 949445 435953 255582 45344 308738 277684 1000000 673343 875603 406075 107254 977518 974635 1000000 1000000 11972 18784 130939 229721 1000000 741530 518086 1000000 324252 310073 827238 881680 643155 37768 1000000 1000000 1000000 362069 634240 635577 1000000 1000000 1000000 402054 1000000 1000000 1000000 113935 524919 219289 458145 1000000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "493 90356827\n831971 963581 542088 336502 434265 307999 487050 1 114907 707882 647039 797676 716300 79984 412374 488184 730857 69095 8143 503130 689912 262550 32 288974 145694 1 435738 895139 1 800375 234623 429302 38044 226142 98101 447847 311215 854414 337329 1 529234 61810 575159 140198 81838 742439 1 634225 113852 250725 306662 778419 106841 852447 631577 528591 439645 473889 793915 487617 85813 164626 583812 272323 323020 945181 566311 1 523481 2 224676 126002 739089 8 22416 355291 884004 930180 606830 443912 325530 133890 155331 890858 810540 38402 729881 449977 556118 3444 584686 883677 661355 834304 422746 864228 466364 10 118638 833978 163053 877143 425189 693566 81050 623295 746609 881179 366465 235374 60436 1 400380 322645 784467 963843 153514 950556 313884 20756 978075 612186 502753 133718 129325 522359 967834 90742 829998 558628 499134 914365 481676 835769 430692 593340 867384 330704 1 52126 11 850260 517 930213 609660 780290 116921 1 959735 672712 1 3 298359 1 265229 173138 118245 879053 422791 187453 40345 67590 461397 252110 866916 615626 777255 1 1 960863 245254 784465 818826 159387 30370 269255 1 620844 18853 308859 936959 871253 937306 1 810026 35986 2 973889 148285 363093 271688 710429 1 796416 874088 206239 607454 157235 43286 22636 848092 308506 826771 777533 111423 794434 940737 332853 1 521210 532188 308528 263627 575717 744047 789139 258451 114879 720421 452343 507747 158347 223773 268902 483045 579405 754062 613348 764203 183065 167667 88223 1 363558 68214 693697 1 988316 813893 362140 518427 148364 706271 702 182236 226365 36341 666832 839948 744994 1 719605 480283 990160 51850 478184 902938 328645 493182 729813 1 122059 1967 791630 90475 821449 818871 770790 75985 471278 160870 732807 273265 947900 677346 362257 202411 886990 1 830138 262087 246308 346650 888080 346396 667628 834967 5 888177 1 166556 30480 121824 1 427480 529256 408360 1 497876 459106 957857 586515 380081 174387 499384 478034 22686 803775 646416 10232 278256 806947 486154 583793 51397 386910 2 53 430103 442585 227108 270581 563210 726906 379506 673449 288789 1 162189 177543 980124 539253 193122 390944 88547 630277 359976 252619 166123 507108 1 155584 613387 663509 421355 538940 753487 614164 10 283111 683403 700890 877033 178609 5718 872221 28096 374072 807095 752609 565201 18 488724 58776 125142 329 988153 91405 19697 553262 821107 925150 555172 695361 174226 931748 1 746862 482280 33120 418030 202462 539087 11909 458753 460513 193626 181982 386492 78778 828965 327673 752849 663248 192955 234462 579719 1 219794 150171 329269 781058 719188 92008 751453 188698 524707 831801 637236 641193 147025 740613 416317 786522 330085 549260 673708 858755 477773 338448 733757 917511 46213 147297 932817 351757 978268 378251 533935 562800 776352 409867 245886 1 465144 442802 607164 299460 191087 48440 509916 549504 618735 906108 99749 92186 138114 334170 800855 349961 641524 485683 848270 1979 149418 699969 122991 400494 557604 115287 32741 591884 1 568869 538241 365426 463664 607026 960481 933023 567713 317395 117490 475852 124685 247046 515022 695457 838912 167382 841335 1 847611 799800 752214 475218 784263 542385 1 1 144131 768603 762491\n", "output": "20717\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "490 124\n768552 116654 1 1 1 806039 1 1 1 1 1 768227 921453 171167 1 1 190972 230167 1 1 1 780378 1 415751 812996 1 33195 622492 1 1 661491 588926 801526 1 1 634422 921727 899025 572158 1 170695 623924 489467 1 660066 819338 1 654991 1 1 703835 1 1 525014 857815 208717 1 1 488391 1 1 1 493263 466120 1 378413 63301 406808 1 1 81155 878038 610737 1 1 644401 1 1 806823 1 50917 1 1 603533 1 1 1 840937 1 1 5397 600534 625371 1 455790 10827 23442 842430 711381 1 1 516271 1 1 1 822329 369307 1 481582 1 1 1 1 1 1 979416 1 256876 1 1 282680 1 1 21389 1 1 1 150211 1 10157 281230 1 337803 1 713881 443225 1 1 641578 1 1 105200 582712 562195 965183 980141 1 668500 1 944302 1 1 401041 172581 1 542068 89748 34305 601665 281771 1 1 930479 1 1 1 608698 1 977398 1 1 146741 1 729625 1 1 1 69475 647824 1 1 264171 1 461511 1 240913 1 1 831540 1 1 1 777472 362404 663201 1 93833 1 1 78249 855477 1 948736 1 1 172053 949102 361800 548916 106555 461014 1 1 1 960379 1 222729 1 640527 364037 1 603578 226516 1 1 778674 1 1 590663 756309 1 1 1 1 1 1 1 284215 1 1 1 8 154349 198776 906313 1 82812 1 1 72567 1 1 1 1 1 648241 405531 1 343603 5561 1 1 603465 1 517005 1 1 882529 1 852374 1 1 133203 1 643407 1 1 1 1 655066 8794 170035 1 1 2 282915 177647 1 808827 601408 1 1 1 1 284552 852024 939468 1 1 1 1 1 309167 1 799776 148570 890668 1 1 723383 708244 982036 549040 1 1 1 546466 120484 1 260002 1 15537 360463 1 683010 824171 254511 135 146229 1 1 1 1 1 52075 1 94280 1 303806 890984 381544 911928 1 1 1 1 1 1 1 1 535429 286299 1 549 396167 745700 115336 943155 1 210099 1 59284 1 1 567096 1 95061 1 295376 1 1 800656 1 546641 1 1 252411 163655 1 16574 450890 1 151784 1 1 1 1 807175 40303 1 1 1 762354 229046 1 1 694520 741480 1 1 1 1 1 594802 901348 522888 809709 459516 507196 220894 1 1 388974 1 374105 709924 12909 193357 92799 1 821329 1 652859 1 134421 1 629972 1 1 1 1 443474 298974 903376 149343 89181 1 1 1 772067 1 1 1 1 1 1 1 810514 1 1 366373 1 260045 1 73750 750402 173010 150254 1 17347 1 245582 548275 46617 19625 1 1 1 1 330223 56378 451600 1 369206 826841 1 1 682817 235049 727437 1 1 1 1 1 803517 426558 231269 1 680889\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483 594773048\n1000000 996289 1000000 429349 973226 992436 845303 931570 999811 960106 1000000 1000000 965435 422055 990486 952203 1000000 1000000 1000000 649428 856735 999569 970146 371418 1000000 412502 158977 856158 972317 1000000 996925 977785 391832 860900 898897 1000000 1000000 952948 660749 999999 966032 1000000 1000000 996124 1000000 1000000 1000000 1000000 867262 940102 951088 1000000 466113 877283 772852 1000000 942949 999994 267880 1000000 945563 1000000 1000000 962295 958239 725390 1000000 916112 1000000 1000000 1000000 650638 1000000 697593 1000000 963521 980728 935468 710017 896595 1000000 1000000 827924 788164 1000000 1000000 1000000 1000000 589901 1000000 964006 1000000 993531 1000000 1000000 1000000 971860 1000000 704938 930598 816449 1000000 1000000 611353 993989 452087 746222 1000000 476316 681437 1000000 1000000 1000000 1000000 934458 979354 1 1000000 991466 993234 998438 876630 589040 876481 912810 1000000 962241 986267 1000000 1000000 990209 985900 930019 704704 987126 127059 1000000 903616 1000000 486582 1000000 985005 922821 628605 1000000 1000000 1000000 633419 829199 1000000 967835 488000 984698 1000000 960290 720310 507557 791443 890418 884227 999436 1000000 929301 1000000 859272 789010 290825 1000000 982399 1000000 1000000 932580 999995 1000000 699267 1000000 937296 1000000 294664 998748 999768 1000000 1000000 995646 1000000 1000000 1000000 999994 318080 1000000 839164 1000000 1000000 1000000 967411 1000000 1000000 923768 1000000 885769 988822 1000000 827476 1000000 1000000 998501 1000000 978254 1000000 1000000 1000000 803639 997544 999976 932777 772394 925135 1000000 999983 1000000 961462 1000000 1000000 1000000 1000000 910229 1000000 874024 991400 1000000 997718 981056 999993 995329 676458 981598 837504 1000000 672053 1000000 976542 555064 1000000 960451 319964 862964 1000000 871909 822310 997155 1000000 717275 1000000 1000000 264693 1000000 845991 1000000 978736 838413 986494 992322 535760 757515 952948 435950 1000000 1000000 1000000 875328 659178 984332 1000000 904851 999999 756994 624363 999999 991458 940089 964881 1000000 1000000 906970 1000000 1000000 6742 1000000 999374 993424 467494 795640 1000000 893960 1000000 253112 1000000 583206 642713 1000000 992145 744126 741059 1000000 1000000 612297 725994 1000000 947853 1000000 1000000 658292 815088 932788 966062 1000000 999999 1000000 877095 1000000 501549 751936 762788 1000000 996690 999934 1000000 719677 1000000 670540 991242 995876 1000000 1000000 999988 1000000 997854 1000000 1000000 1000000 1000000 1000000 1000000 951964 1000000 782639 1000000 993892 973153 341233 1000000 446303 1000000 587609 999994 1000000 1000000 1000000 999971 974122 1000000 1000000 1000000 1000000 883346 991920 934377 999999 990393 444858 954015 932667 1000000 266130 928987 998496 938820 999994 1000000 1000000 1000000 983585 992730 893975 1000000 995784 1000000 934091 1000000 1000000 993151 975399 999999 986696 1000000 1000000 967866 956868 999816 1000000 999999 1000000 972063 1000000 884876 771050 356618 967944 1000000 996042 1000000 1000000 991622 970862 1000000 560332 992771 993140 833316 974954 948405 1000000 263459 1000000 978733 875958 996130 970248 1000000 981534 975232 997412 1 987832 786925 1000000 1000000 999990 1000000 981101 999902 834921 978329 466551 1000000 1000000 1000000 913673 949099 900889 856774 1000000 1000000 802903 1000000 767712 889291 961260 1000000 996840 1000000 994233 985674 44083 618542 960117 937525 541140 1000000 917924 997960 991167 999999 999879 956039 739464 1000000 977261 1000000 127469 1000000 999999 659408\n", "output": "432626200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "494 239761345\n879331 782877 999999 993274 1 999999 1000000 759744 1000000 972819 695436 732939 993819 1000000 1000000 1000000 999995 972982 995938 1000000 999999 514435 178093 1000000 755337 1000000 951261 1000000 990924 999628 558113 1000000 987676 1000000 1000000 997380 991748 983888 719516 1000000 996668 999969 1000000 992984 991870 981749 841710 986072 1000000 582649 1000000 1000000 1000000 1000000 549872 68282 996966 999655 989595 995038 656842 1000000 1000000 999965 1000000 999770 442374 756879 1000000 881089 993252 915029 996531 1000000 1000000 981834 946908 995522 986886 684656 991505 999820 1000000 957209 1000000 791029 519851 1000000 1000000 978383 952663 898976 778960 999864 563215 995972 1000000 734359 970011 982250 1000000 1000000 1000000 1000000 998531 581087 161336 995410 957156 858023 988723 830618 636376 968643 917712 990625 999335 772780 1000000 956268 960518 983821 997481 796410 1000000 899252 343047 144185 851168 1000000 851746 550524 999999 959562 1000000 816905 871848 999918 873546 1000000 256036 974029 1000000 781242 682090 999428 964944 933971 944118 976854 999459 912108 1000000 168391 663411 827928 1000000 998515 867630 727710 851880 998035 78143 656253 991523 1000000 185321 390792 400663 1000000 159123 1000000 999004 830936 624448 993704 649767 998708 997763 958380 954427 998691 999277 1000000 1000000 1000000 993053 346755 1000000 1 897895 886096 1000000 1000000 996322 991261 956555 798559 911486 899332 952924 879957 1000000 956199 999729 1000000 633539 991847 8323 914364 986265 254922 1000000 1000000 1000000 998296 747290 783738 999999 961967 999999 852484 999999 1000000 998246 1000000 702565 992219 993267 997646 1000000 857709 690483 967855 251169 1000000 982337 835523 999998 992355 876570 325663 953972 614538 998976 1000000 989888 729951 1000000 988625 928084 1000000 1000000 999707 1000000 1000000 982153 943293 1000000 993911 1000000 348377 1000000 999944 981483 929503 569553 1000000 996238 925242 992768 1000000 1000000 999887 967962 212811 1000000 999999 1000000 1000000 904823 1000000 677047 1000000 924838 808064 793244 946107 999889 958404 978733 998250 767825 985374 1000000 1000000 331694 634123 1000000 1000000 15437 954376 994382 1000000 992439 875037 482132 983812 990025 1000000 1000000 977024 842789 1000000 986325 999990 894512 3018 949916 965525 1000000 878903 1000000 106419 915605 571466 909685 378752 157835 1000000 1000000 986092 891121 999017 972690 1000000 777198 1000000 844092 1000000 660576 989252 999970 999799 989533 829239 999617 923649 924957 911034 158581 1000000 1000000 1000000 947723 434789 992318 941567 986333 947199 849327 994371 999983 1000000 1000000 649842 1000000 986878 1000000 946164 985337 993392 1000000 1000000 1000000 977420 1000000 1000000 968931 997744 1000000 1000000 1000000 864119 1000000 1000000 897116 776741 970537 620544 1000000 948495 998256 995914 991624 879141 915859 999986 1000000 1000000 962997 572582 1000000 756474 965251 966672 1000000 1000000 1000000 1 983662 1000000 1000000 871122 982905 994009 1000000 720335 1000000 760969 942509 28277 696570 999560 954930 1000000 997875 999991 999940 1000000 1000000 441994 925588 1000000 1000000 999999 1000000 586502 865452 293318 999999 865189 1000000 1000000 1000000 942357 1000000 999990 999321 1000000 991651 998342 1000000 1000000 828667 745864 1000000 1000000 887823 815745 986105 1 990536 925841 1000000 822210 1000000 984613 997324 1000000 912600 454451 1 999773 1000000 908966 999999 993127 999995 974795 984032 572633 946350 1000000 943960 995799 967030 1000000 994236 999975 998105 989739 408545 127027\n", "output": "2095743\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "496 117295257\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 776912 1000000 1000000 1000000 1000000 1000000 1000000 971140 1000000 1000000 1000000 1000000 1000000 1000000 999999 194228 1000000 971140 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999454 999999 999875 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 582684 1000000 1000000 1000000 582684 1000000 1000000 1000000 1000000 1000000 1000000 1000000 388583 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 971140 1000000 1000000 1000000 1 1000000 976165 1000000 1000000 1000000 1000000 779525 1000000 1000000 999994 1000000 1000000 1000000 1000000 1000000 776912 1000000 1000000 1000000 1000000 998187 1000000 1000000 1000000 1000000 1000000 1000000 1000000 682043 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 862514 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 196003 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 776912 1000000 1000000 1000000 1000000 971140 975541 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 971221 971140 1000000 1000000 1000000 979926 582691 1000000 1000000 1000000 1000000 1000000 194228 1000000 999999 1000000 1000000 1000000 1000000 925248 1000000 1000000 1000000 1000000 1000000 1000000 205074 1000000 194228 1000000 1000000 1000000 1000000 388456 999999 776912 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 194228 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 194228 1000000 1000000 1000000 582684 1000000 999997 1000000 1000000 1000000 194228 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 971154 1000000 194228 1000000 388457 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 776912 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 388456 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 194228 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 999194 776912 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 388457 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 999221 1000000 1000000 1000000 1000000 1000000 1000000 582684 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 582684 1000000 194890 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 194228 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 796456 1000000 971140 1000000 1000000 999571 1000000 1000000 582684 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 587 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 971140 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 989495 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 388456 388456 1000000 1000000 1000000 1000000 1000000 1000000 1000000 194229 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999842 1000000 1000000\n", "output": "1132448\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "490 95415357\n626785 1000000 1000000 1000000 877499 1000000 999977 1000000 1000000 1000000 1000000 1000000 376071 626785 1000000 1000000 1000000 752142 1000000 1000000 1000000 1000000 1000000 376071 1000000 1000000 1000000 501428 1000000 1000000 1000000 1000000 125357 1000000 1000000 1000000 1000000 501428 1000000 1000000 1000000 1000000 1000000 1000000 1000000 501428 1000000 1000000 1000000 1000000 125357 1000000 1000000 1000000 1000000 877504 1000000 999442 1000000 1000000 1000000 1000000 752998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 376071 1000000 1000000 626785 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 250714 1000000 1000000 501428 125362 250714 1000000 999934 1000000 1000000 999999 377624 1000000 501428 1000000 1000000 996114 752142 1000000 1000000 867361 1000000 1000000 1000000 1000000 752142 1000000 501428 1000000 1000000 376071 1000000 1000000 1000000 1000000 1000000 250750 752142 1000000 1000000 501428 1000000 1000000 125357 1000000 1000000 1000000 1000000 1 999999 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 626785 1000000 1000000 250714 877499 376071 992479 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 501429 250714 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 250714 999988 752142 125357 1000000 1000000 1000000 376071 626793 1000000 1000000 1000000 1000000 1000000 1000000 877499 1000000 1000000 1000000 999999 1000000 1000000 250714 997477 1000000 1000000 1000000 1000000 626785 999999 250714 1000000 1000000 1000000 877499 1000000 1000000 1 1000000 1000000 1000000 1000000 821367 1000000 250714 501428 125357 125357 125357 127161 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 877499 1000000 1000000 1000000 1000000 125357 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 752142 501428 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 501428 1000000 501428 125359 1000000 125357 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 752142 1000000 1000000 1000000 627048 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 752142 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 501428 626785 1000000 1000000 1000000 1000000 1000000 752142 1000000 1000000 1000000 376071 1000000 1000000 1000000 1000000 1000000 501428 1000000 1000000 1000000 1000000 752142 1000000 376071 1000000 1000000 1000000 501428 1000000 1000000 1000000 997199 1000000 1000000 395 1000000 125357 1000000 1000000 1000000 877499 1000000 1000000 1000000 1000000 250714 999999 1000000 1000000 1000000 1000000 125357 1000000 1000000 877499 1000000 999993 1000000 626785 1000000 877499 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 125357 1000000 1000000 1000000 1000000 877499 1000000 1000000 1000000 1000000 1 752142 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 626785 1000000 1000000 1000000 1000000 1000000 1000000 1000000 501428 1000000 1000000 626785 1000000 877499 626785 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 250714 1000000 1000000 877499 1000000 1000000 1000000 1000000 877499 376071 1000000 997718 1000000 626785 1000000 1000000 553792 752142 1000000 1000000 1 1000000 1000000 1000000 1000000 250714 125361 1000000 1000000 1000000 1000000 125357 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "924274\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484 153770869\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999635 1000000 999926 1000000 999998 1000000 995462 1000000 1000000 1000000 1000000 999890 1000000 997233 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 999999 1000000 1000000 1000000 999959 1000000 998968 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 986347 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999905 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 994986 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999859 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 994230 1000000 1000000 1000000 1000000 1000000 1000000 988907 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999736 1000000 1000000 999999 1000000 1000000 999781 1000000 1000000 984542 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996834 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999527 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 995104 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 999866 1000000 1000000 1000000 999956 999714 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999890 946812 1000000 1000000 999967 997482 1000000 1000000 999970 1000000 999999 1000000 1000000 1000000 1000000 998413 1000000 1000000 1000000 999993 999999 1000000 1000000 1000000 1000000 999955 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 966979 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999942 1000000 1000000 1000000 1000000 1000000 999999 1000000 965628 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999563 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999961 1000000 1000000 1000000 1000000 1000000 1000000 996534 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999827 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999904 1000000 1000000 961259 1000000 1000000 999987 1000000 999981 1000000 1000000 1000000 1000000 1000000 999979 1000000 1000000 1000000 999974 999859 1000000 999960 999943 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 987991 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 992306 1000000 1000000 1000000 1000000 1000000 1000000 1000000 991123 999992 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999977 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1289956\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "486 129982195\n1000000 1000000 400021 1000000 825894 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999805 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 610396 603035 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999961 1000000 1000000 1000000 1000000 1000000 1000000 1000000 608038 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1305 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 681 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999991 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 512596 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999478 440328 1000000 1000000 806167 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 999968 1000000 999917 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 414232 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 680595 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 980498 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999981 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998820 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 894313 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "199990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "481 433328578\n1000000 1000000 999967 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999933 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999169 1000000 1000000 1000000 980985 1000000 999993 1000000 1000000 999999 1000000 1000000 999963 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 994935 1000000 1000000 1000000 999817 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999901 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999950 1000000 997601 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 995696 999886 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999973 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999919 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998976 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998133 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 1000000 1000000 1000000 999788 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999892 1000000 1000000 1000000 1000000 1000000 1000000 999163 1000000 1000000 1000000 993446 1000000 1000000 999996 1000000 999988 1000000 1000000 1000000 1000000 1000000 999997 1000000 999986 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 999166 1000000 1000000 1000000 999972 998053 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999981 1000000 1000000 1000000 999939 1000000 1000000 1000000 999990 1000000 1000000 1000000 999989 1000000 1000000 999999 1000000 1000000 997932 1000000 1000000 1000000 1000000 999997 1000000 999990 1000000 1000000 999999 982534 1000000 1000000 1000000 1000000 999997 1000000 1000000 1000000 1000000 1000000 999994 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999986 1000000 1000000 1000000 999875 1000000 1000000 1000000 1000000 1000000 1000000 999975 1000000 1000000 996096 1000000 1000000 1000000 1000000 999804 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999973 999991 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999988 1000000 1000000 1000000 1000000 1000000 999999 999998 1000000 1000000 1000000 1000000 999988 999774 997198 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999203 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999959 1000000 999998 1000000 1000000 999986 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 999318 1000000 1000000 988131 1000000\n", "output": "7514278\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "495 139161575\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 865278 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 995472 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 884835 998636 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999388 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1366695\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "498 116624261\n999945 1000000 1000000 1000000 1000000 1000000 1000000 985832 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 743666 1000000 1000000 732288 1000000 999999 1000000 1000000 457680 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 813333 1000000 1000000 1000000 366144 1000000 9 1000000 1000000 1000000 1000000 1000000 1000000 366144 1000000 1000000 1000000 1000000 1000000 823823 1000000 1000000 1000000 1000000 1000000 915360 732308 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 183381 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 366144 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 964313 1000000 1000000 366144 999989 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 732288 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 823824 274608 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999572 1000000 1000000 549216 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 805044 1000000 1000000 977368 1000000 999704 1000000 1000000 855583 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 457680 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 91536 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 457683 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 823824 1000000 1000000 1000000 1000000 1000000 1000000 1000000 549216 1000000 1000000 1000000 1000000 1000000 549220 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 457680 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 458468 1000000 1000000 999999 1000000 999999 1000000 274660 1000000 1000000 1000000 1000000 1000000 1000000 1000000 823824 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 640752 1000000 1000000 640752 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 457680 1000000 1000000 1000000 185743 1000000 1000000 1000000 1000000 549216 999920 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 823824 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 551757 1000000 1000000 274608 1000000 1000000 1000000 1000000 1000000 549217 915360 1000000 1000000 162239 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 549216 1000000 1000000 1000000 1000000 183072 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 640752 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 593431 274608 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 732288 1000000 915360\n", "output": "1189968\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "495 119556913\n1000000 1000000 1000000 127086 756767 838404 1000000 1000000 1000000 1000000 1000000 955793 1000000 1000000 1000000 1000000 1000000 1000000 14 918394 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 976303 999974 1000000 1000000 943747 1000000 1000000 1000000 1000000 1000000 1 1000000 879221 985409 1000000 1000000 987825 1000000 1000000 1000000 1000000 1000000 1000000 979605 999966 997834 975173 1000000 919430 1000000 1000000 1000000 1000000 1000000 997815 1000000 967253 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 847008 1000000 1000000 1000000 1000000 1000000 1000000 999286 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 343729 999998 1000000 273377 662422 1000000 1000000 1000000 1000000 1000000 1000000 993464 999743 999642 1000000 1000000 381827 879355 1000000 282257 1000000 317628 1000000 1000000 999999 1000000 1000000 994222 987467 1000000 998870 1000000 1000000 1000000 999999 1000000 1000000 423505 1000000 998224 1000000 1000000 1000000 982891 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 826282 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 989339 1000000 995364 1000000 1000000 998727 968597 1000000 1000000 717744 1000000 896408 1000000 634407 1000000 346506 1000000 1000000 1000000 1000000 1000000 999993 999540 1000000 1000000 588868 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 992306 1000000 968553 1000000 999980 245669 987428 1000000 964885 999781 997549 987048 1000000 999974 1000000 999943 874719 1000000 903669 999319 1000000 1000000 1000000 1000000 990918 1000000 1000000 977586 1000000 1000000 999126 994880 1000000 975295 1000000 936019 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996229 1000000 1000000 434157 1000000 1000000 983353 1000000 1000000 285636 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996796 1000000 1000000 1000000 722293 1000000 1000000 993686 1000000 877418 997973 1000000 907298 1000000 477010 995929 1000000 831123 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999408 954462 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998139 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 966850 1000000 1000000 893153 1000000 1000000 1000000 863655 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 988327 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 980512 1000000 1000000 1000000 922582 765959 1000000 1000000 997121 1000000 232734 1000000 1000000 378440 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 29643 1000000 1000000 1000000 940542 1000000 1000000 1000000 236712 765905 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 948895 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999978 1000000 679892 1000000 981076 326710 1000000 1000000 1000000 1000000 1000000 740882 1000000 1000000 1000000 1000000 995817 999671 1000000 591488 1000000 1000000 211752 999974 1000000 1000000 1000000 1000000 1000000 905116 1000000 997327 1000000 289240 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 999107 738213 1000000 1000000 974642 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 964557 728014 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 923605 999996\n", "output": "1244043\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "495 101703237\n999997 1000000 834218 1000000 1000000 1000000 748046 1000000 999999 1000000 1 1000000 834218 1000000 417109 1000000 1000000 834218 1000000 1000000 1000000 138519 952318 1000000 1000000 1000000 1000000 1000000 1000000 999797 1000000 1000000 170091 1000000 1000000 834218 1000000 834218 9 1000000 1000000 1000000 1000000 1 1000000 1000000 834218 1000000 1000000 417204 1000000 1000000 1 1000000 1 1 999999 1000000 1000000 1000000 999999 1000000 999999 1000000 1000000 834218 1000000 1000000 999999 980941 884032 1000000 1000000 1000000 999570 628032 110609 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 834218 417109 800299 1000000 1 1000000 999999 417109 1000000 834218 1 695699 1000000 417109 417109 118218 1000000 1000000 834218 1000000 1000000 1000000 1000000 1000000 1000000 1000000 417110 1000000 1000000 417187 1000000 1000000 1000000 417110 1000000 1000000 999999 834217 1000000 417109 1000000 1000000 1000000 834218 1000000 9566 1000000 1000000 417109 921171 972252 591547 16 1000000 417109 1000000 417109 1000000 1000000 1000000 1000000 1000000 417109 857720 1000000 1 999999 1000000 1 1000000 417109 1000000 1000000 417109 1000000 1000000 999993 1 1000000 1000000 1000000 834218 834218 834218 1000000 834218 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 925721 1000000 1000000 1000000 1000000 1000000 834218 1000000 1000000 999999 1000000 571651 1000000 1000000 999999 1000000 1000000 1000000 999999 1000000 1 999999 1000000 1000000 1000000 451933 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999905 1000000 417109 1000000 834218 1000000 1000000 1000000 834218 743291 864327 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 120 1 1000000 999999 1000000 876314 1000000 1000000 999999 855212 1000000 1000000 1000000 834217 834218 969891 1000000 1000000 1000000 1000000 417109 834218 1000000 1000000 1000000 1000000 976504 1000000 1000000 417109 1000000 1000000 1000000 1000000 1000000 1000000 1000000 417109 1000000 834218 1000000 1000000 1000000 1 525246 999999 999999 1000000 829910 1000000 1000000 999999 1000000 1000000 1000000 1000000 1 1000000 1000000 999999 1000000 1000000 1 1000000 1000000 999999 91274 834218 1000000 1 1 1000000 1000000 1000000 999999 926747 1000000 834218 374758 1000000 534259 123687 1000000 1000000 1000000 1000000 1000000 984846 1000000 171400 1000000 1000000 1000000 1000000 561897 417109 1 1000000 1000000 1000000 1000000 417109 1000000 1000000 1000000 1000000 999948 1000000 1000000 1000000 881900 834218 417109 834218 1000000 1 873206 1000000 417109 1000000 1000000 999999 1000000 1000000 1000000 986807 1000000 1000000 417109 1 1000000 1000000 1000000 896667 1000000 1000000 1000000 417108 1000000 1000000 900605 1000000 1000000 1000000 1000000 1000000 1 1000000 999999 1000000 834218 1000000 1000000 1000000 1 1000000 465742 1000000 1000000 1000000 1000000 1000000 1000000 999999 1 1000000 999989 847659 1000000 417109 1000000 1000000 1000000 999999 417861 1000000 834218 616812 1000000 417596 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 417109 152342 1000000 1 1 999999 834218 1000000 1000000 1000000 1000000 1000000 1000000 999999 242672 1000000 1000000 1000000 913047 836694 1000000 837675 999998 1000000 1000000 1000000 1000000 1000000 1000000 965379 1000000 850863 1000000 417109 999881 1000000 1000000 1000000 417109 1000000 1000000 1000000 1000000 1000000 834218 1000000 1000000 1000000 999999 86447 999978 950186 1000000 834218 1000000 1000000 828601 1000000 1000000 1\n", "output": "1310914\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "491 119368094\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 570298 1000000 1000000 997042 1000000 999699 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 763575 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 828875 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 665271 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999985 877834 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 480653 1000000 1000000 855342 1000000 1000000 1000000 1000000 853017 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 855346 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 95038 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 891933 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 855343 1000000 1000000 1000000 1000000 998212 1000000 1000000 1000000 1000000 993530 1000000 1000000 1000000 1000000 998275 1000000 1000000 998939 1000000 1000000 1000000 1000000 1000000 639665 1000000 1000000 1000000 999997 1000000 1000000 1000000 1000000 1000000 1000000 1000000 190076 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999447 1000000 1000000 1000000 1000000 250400 1000000 1000000 1000000 1000000 999966 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 380152 1000000 1000000 1000000 1000000 1000000 475394 1000000 1000000 1000000 950380 1000000 1000000 1000000 1000000 1000000 1000000 531924 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 285413 1000000 1000000 1000000 1000000 1000000 760304 1000000 285122 999999 1000000 1000000 1000000 380152 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 647532 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 667218 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 63 1000000 1000000 1000000 95039 784232 1000000 1000000 1000000 190078 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1255502\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "489 512526804\n1000000 1000000 993695 992135 1000000 1000000 362397 954764 998252 754926 999999 1000000 990358 930436 1000000 909150 1000000 999927 1000000 1000000 1000000 1000000 869234 1000000 1000000 1000000 1000000 1000000 979724 999998 1000000 1000000 1000000 1000000 237363 991034 245134 944187 986591 605696 1000000 622919 1000000 469990 1000000 988340 1000000 818761 999359 52472 985002 1000000 953545 1000000 999996 34455 1000000 984701 803972 994342 907176 1000000 803135 1000000 1000000 929077 1000000 1000000 996726 1000000 999756 975078 519333 984408 1000000 473626 1000000 1000000 1000000 1000000 996684 812191 1000000 1000000 1000000 957604 950560 927806 985913 1000000 1000000 1000000 732150 999999 999999 1000000 1000000 1000000 919236 779237 876646 999014 839367 909105 1000000 781996 1000000 328210 1000000 1000000 985450 999823 1000000 758098 999516 862532 1000000 936708 998008 1000000 1000000 1000000 998698 1000000 1000000 818238 1000000 999995 1000000 1000000 1000000 996131 1000000 215791 999999 902362 1000000 941036 995025 1000000 1000000 774505 986213 1000000 999847 998401 1000000 12913 856681 1000000 561289 1000000 986513 954222 727571 984353 1000000 850316 998676 877104 1000000 1000000 908204 1000000 1000000 1000000 1000000 582787 546885 1000000 1000000 1000000 1000000 994337 1000000 946357 1000000 1000000 1000000 945295 1000000 795350 999996 1000000 1000000 1000000 1000000 1000000 985636 1000000 1000000 1000000 998478 1000000 983551 1000000 983572 941317 1000000 957524 1000000 867288 999864 1000000 1000000 1000000 1000000 1000000 1000000 1000000 893736 1000000 1000000 1000000 997387 908058 999894 998140 999277 772385 818885 952264 837069 1000000 581680 1000000 963516 1000000 823042 969403 1000000 999357 1000000 1000000 998947 903974 999611 1000000 1000000 1000000 1000000 1000000 989077 1000000 663722 1000000 1000000 1000000 994667 995934 993917 732150 880251 805916 894282 1000000 1000000 840291 733038 989351 1000000 826352 1000000 876321 1000000 857003 503611 1000000 1000000 963526 1000000 991631 1000000 999999 1000000 1000000 904266 1000000 997193 1000000 807487 1000000 1000000 877201 1000000 954201 1000000 1000000 789687 1000000 1000000 990677 977200 1000000 1000000 306148 993556 947144 958949 1000000 443738 1000000 1000000 1000000 1000000 1000000 945390 1000000 1000000 1000000 977507 1000000 962639 1000000 1000000 1000000 1000000 1000000 1000000 753452 1000000 998692 999538 1000000 780093 408471 884981 983914 1000000 999706 953775 1000000 1000000 1000000 941255 859680 784655 1000000 1000000 1000000 1000000 1000000 999433 1000000 162972 1000000 864 997502 960731 1000000 1000000 866243 999618 489819 1000000 933932 1000000 1000000 999999 999432 969172 942673 1000000 955917 991096 1000000 906358 1000000 1000000 1000000 1000000 1000000 1000000 1000000 637373 1000000 975034 729246 787688 1000000 1000000 952664 1000000 732150 999999 1000000 1000000 1000000 1000000 1000000 968834 999498 1000000 941044 1000000 953419 332705 1000000 992339 1000000 788525 1000000 1000000 355903 1000000 1000000 995236 997620 1000000 1000000 1000000 972486 929208 999993 982397 999992 812734 999999 939168 1000000 1000000 1000000 496530 999992 991978 1000000 667381 927765 988663 1000000 1000000 1000000 993859 690238 743452 1000000 876289 588325 949754 1000000 1000000 1000000 985011 1000000 915648 903075 1000000 999444 988078 945067 1000000 999788 973377 1000000 1000000 1000000 1000000 922444 999464 970266 836031 497272 1000000 1000000 730700 1000000 999565 820024 998038 1000000 1000000 1000000 996269 1000000 1000000 1000000 1000000 749610 1000000 929295 1000000 1000000 1000000 1000000 995393 1000000 1000000 1000000 1000000\n", "output": "455397300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "491 193311239\n1000000 999999 999999 112905 991201 1000000 1000000 1000000 990492 852871 838884 1000000 927741 988336 997089 1000000 1000000 961504 947391 1000000 954961 999999 1000000 995059 1000000 1000000 777256 761939 919013 982557 627291 960314 913094 768902 982482 959407 996290 900277 1000000 251911 1000000 829562 955937 930953 200420 1000000 833463 897179 996939 756136 922793 1000000 312923 1000000 999999 398624 1000000 996929 941334 650832 359229 996453 1000000 1000000 999257 888290 895173 726609 972461 993455 1000000 997540 1000000 999865 999992 1000000 866530 989753 231268 1000000 850818 1000000 934741 1000000 176058 772754 459244 877768 1000000 953205 710034 966908 991203 999014 945874 955477 954220 1000000 1000000 379562 617556 403284 1000000 957979 347983 912514 987341 262123 687044 687162 997395 1000000 256502 1000000 990572 166436 998839 772383 826535 415398 864576 999630 999999 997791 362033 610475 705082 1000000 940415 816315 998104 485142 877218 937178 948869 998599 994425 610576 997985 970138 1000000 930843 691754 823745 567868 1000000 1000000 998361 652016 1000000 884295 842842 997720 820182 699523 62555 929982 445773 259539 1000000 71348 898122 927653 887593 1000000 994627 1000000 473509 463336 1000000 542171 997777 872066 1000000 953639 798835 986790 929870 975271 863323 893059 963866 932755 733585 897382 784348 667443 994602 889178 477197 770238 999177 723308 1000000 1000000 595734 999994 999178 950862 775572 943091 1000000 410537 745414 971574 216501 1000000 993290 947781 843324 808580 1000000 1000000 988208 311975 997856 993086 970544 1000000 1000000 801470 999999 884310 1000000 345815 999990 979976 1000000 1000000 848431 787803 650305 999999 983611 982487 694503 1000000 999996 828800 944679 747989 906074 994669 1000000 999999 999999 811188 1000000 883829 999554 1000000 728131 166909 975505 999998 200420 844053 629018 425379 473016 1000000 1000000 886362 1000000 260101 255715 1000000 260767 739142 1000000 950705 995409 919090 805569 925669 1000000 999512 842997 1000000 704017 1000000 1000000 272424 816662 958463 991776 617951 1000000 936912 935432 910998 986841 1000000 999546 787277 696829 868655 763926 1000000 1000000 1 860699 1000000 1000000 830828 906665 972363 399677 872548 1000000 200379 1000000 1000000 1000000 831712 644742 1000000 486881 979540 1000000 857753 1000000 924047 934707 998080 130599 728371 834175 965270 998739 1000000 988616 613273 880052 1000000 1000000 1000000 620395 370991 969180 526132 999984 1000000 996292 956981 1000000 1000000 999705 958187 999986 969543 916668 1 949904 904760 1 616108 680163 984027 554664 970714 742580 891346 892111 773423 88731 822217 847895 838931 991102 714397 999999 965714 763172 879554 1000000 959425 583478 730109 790352 949082 546219 1000000 1000000 134739 722279 953514 474592 890347 914968 1000000 1000000 1000000 1000000 857413 934465 622500 966059 999995 697814 918590 864649 342977 932612 250217 876859 999561 632080 1000000 904616 1000000 999999 1000000 575333 659681 1000000 1000000 812293 999993 932382 333273 989868 801871 250997 1000000 955720 887252 1000000 276011 1000000 907809 29759 987415 377829 668273 1000000 962070 909274 1000000 795978 667650 601912 940971 603718 910379 1000000 415256 918768 1000000 972991 599098 998309 931726 996530 998694 1000000 964796 453142 1000000 1000000 757505 743503 911214 887067 1000000 433823 801004 880146 981329 881285 674367 955220 1000000 967164 919997 999669 717974 1000000 634061 873744 1000000 989820 788758 1000000 158918 838323 1000000 894271 1000000 974688 998148\n", "output": "1865728\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "485 120063494\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 987945 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999020 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999808 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 979566 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999986 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998878 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999799 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "148262\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "487 103378853\n1000000 1000000 1000000 203090 1000000 1000000 1000000 999999 1000000 1000000 1 1000000 1000000 406180 1000000 1000000 1000000 812360 1000000 1000000 1000000 1000000 609270 609333 1000000 406180 1000000 10456 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 709627 1000000 406180 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 203091 406180 1000000 1000000 1000000 1000000 406181 1 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 609270 875119 999999 1000000 1000000 609270 1000000 1000000 1000000 1000000 1000000 1000000 803743 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 609270 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 406180 1 406185 406180 1000000 1000000 1000000 1000000 1000000 610590 812360 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 406180 205696 1000000 1000000 1000000 609272 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 1000000 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 609272 406180 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 1000000 1 1000000 1000000 990 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 474122 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 999997 1000000 1000000 1000000 1000000 1000000 611853 1000000 1000000 609270 1000000 1000000 812361 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 203090 1000000 1000000 999999 1000000 609270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 913631 1000000 1000000 1000000 1000000 406180 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 1000000 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 812360 1000000 1000000 1000000 1000000 1000000 609274 1000000 1000000 406180 1000000 203090 406180 999999 1000000 1000000 999999 1000000 1000000 1000000 1000000 1 1000000 1 1000000 609568 1000000 998556 1000000 1000000 406942 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 406180 1000000 1000000 1000000 1000000 999996 812360 1000000 1000000 1 812360 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 665990 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 609270 609270 609270 1000000 812360 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 609270 1000000 999869 1000000 1000000 203090 1000000 999999 1000000 203090 923345 1000000 1000000 1000000\n", "output": "1259158\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "485 261441483\n995822 1000000 1000000 1000000 967886 1000000 1000000 1000000 975187 904392 1000000 1000000 1000000 507779 956947 982244 1000000 1000000 1000000 999075 870298 1000000 849567 1000000 407944 1000000 1000000 1000000 570027 999999 1000000 948534 1000000 825396 304724 998905 998193 304724 1000000 958544 1000000 992896 989707 492890 986158 975707 1000000 1000000 997054 990496 1000000 721342 947525 932664 944668 987402 1000000 1000000 824759 1000000 988987 939410 1000000 983260 1000000 1000000 1000000 1000000 765253 1000000 999956 934793 891991 1000000 954687 999978 1000000 979879 757109 774203 1000000 999998 914171 1000000 999946 854637 1000000 1000000 838481 954207 1000000 1000000 1000000 999806 852600 1000000 1000000 1000000 1000000 1000000 1000000 797614 979647 1000000 866331 999981 538691 968471 1000000 645565 980626 999999 1000000 979663 1000000 1000000 998923 993046 597067 1000000 912563 999155 719823 929770 1000000 1000000 1000000 843361 1000000 1000000 1000000 998473 999998 1000000 755734 996299 963941 1000000 957142 919389 1000000 998126 936533 595164 988724 1000000 971751 1000000 1000000 999205 1000000 1000000 1000000 999826 1000000 896020 941475 913331 1000000 1000000 830340 866029 990903 995620 982191 575601 557153 971986 1000000 1000000 1000000 1000000 999999 999717 1000000 971526 1000000 1000000 59934 1000000 1000000 1000000 979411 1000000 939915 1000000 988794 846327 936057 1000000 1000000 902377 1000000 1000000 301520 775705 955717 991195 935724 792103 1000000 976182 1000000 1000000 999956 1000000 1000000 992466 1000000 1000000 1000000 988563 1000000 952864 1000000 983338 1000000 1000000 996951 886739 1000000 310028 998203 1000000 1000000 1000000 1000000 1000000 1000000 1000000 866608 1000000 1000000 926535 994447 904851 409226 1000000 999999 1000000 249375 1000000 1000000 1000000 918007 993923 1000000 926504 1000000 875562 1000000 1000000 922293 984373 1000000 917528 498269 967127 1000000 986837 1000000 1000000 1000000 1000000 1000000 988629 1000000 1000000 990653 999989 502332 999809 1000000 1000000 1000000 994389 238956 960096 1000000 1000000 1000000 997200 964039 995057 997828 1000000 923209 1000000 566364 999971 992775 1000000 1000000 1000000 567788 1000000 1000000 1000000 589859 996166 1000000 596881 1000000 881278 724404 1000000 1000000 968245 984585 883520 999693 1000000 1000000 923386 1000000 779045 985387 979239 995611 995625 1000000 949757 1000000 999060 1000000 970843 882164 1000000 1000000 858368 603115 689973 997176 765917 990529 1000000 999650 937159 1000000 978684 1000000 942529 999999 803869 955630 999649 985282 663661 914489 1000000 903927 981824 581991 989300 1000000 1000000 1000000 1000000 998328 888732 999994 1000000 1000000 1000000 1000000 1000000 974641 986058 750626 1000000 996148 1000000 1000000 999689 1000000 1000000 1000000 997982 1000000 957779 947079 261221 1000000 1000000 583517 955448 1000000 977518 997733 1000000 650797 1000000 1000000 977794 712367 1000000 895378 1000000 779002 1000000 999999 999963 1000000 1000000 1000000 1000000 951376 724038 1000000 1000000 943917 999997 999565 487167 990698 994466 999170 993841 1000000 965243 999321 636549 1000000 806072 1000000 442964 1000000 1000000 1000000 1 958674 997549 999998 965177 1000000 988127 823148 1000000 873282 975725 999710 1000000 999999 1000000 1000000 1000000 918775 616949 983606 1000000 813056 1000000 945377 1000000 995929 1000000 999668 1000000 989227 1000000 991814 949298 940222 966254 962872 998467 1000000 1000000 1000000 871633 1000000 1000000 1000000 694077 969096 992554 1000000 434623 999999 1000000 1000000 924767 1000000 799925 1000000\n", "output": "2285430\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "497 82294484\n1000000 681073 1000000 1000000 1000000 1000000 681064 999999 1000000 999999 681064 681064 999999 1000000 999999 1000000 1000000 1000000 1000000 681064 1 1000000 340532 999999 1000000 340532 999999 1000000 340532 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 681064 681064 1000000 1000000 1000000 681070 681064 1 1000000 1000000 1000000 999999 1 1000000 999986 1000000 340532 1000000 340532 1000000 1000000 1000000 340532 1000000 1000000 681064 999999 1000000 1000000 341081 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 681064 1000000 999996 1000000 340531 1000000 1000000 1000000 999999 681064 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 340532 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 681064 999999 1000000 340532 1000000 1 1000000 532663 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 999999 340532 1000000 681064 1000000 681064 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 681064 1 1000000 1000000 1000000 340532 1000000 1000000 1000000 340532 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1 999999 1000000 1000000 1000000 681064 1000000 1000000 1 1000000 1000000 342244 494005 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1 1 1000000 999992 1 1000000 681064 343950 1000000 1000000 1000000 1000000 1000000 1 340531 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 681064 340532 340532 999999 1000000 1000000 1000000 1 1000000 1000000 681064 1000000 1000000 999999 1000000 681064 340532 1 340532 1000000 1000000 1000000 1000000 999999 1 999999 340532 1000000 1000000 1000000 681064 1000000 1000000 1000000 340532 681076 1000000 1000000 1000000 681064 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 681064 681064 999999 1000000 1000000 1000000 1000000 525732 1000000 1000000 1 1 1000000 30971 681064 1000000 1000000 1000000 999999 1000000 1000000 1 1 1000000 340532 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 681064 1000000 1 681064 681064 681064 1000000 340532 1000000 999999 1000000 1000000 1000000 1000000 999999 340532 1000000 1000000 1 1000000 1000000 1000000 999999 340532 1000000 1 1000000 1000000 1000000 1000000 1 1000000 340532 1000000 999880 1000000 340532 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 2 1000000 48 1000000 340532 340532 681064 1 1000000 340532 1000000 1000000 340531 1 681064 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 981140 1000000 681064 999999 1000000 1000000 1000000 999462 1000000 1000000 999999 1000000 1 999992 1000000 1 1000000 1000000 1000000 340531 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1 973169 681064 1000000 1000000 1000000 999999 1 1000000 1000000 1 1000000 1000000 681064 1000000 999999 681063 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 41257 1000000 22606 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1 1000000 340717 1000000 1000000 1000000 1000000 1000000 1000000 681064 999999 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "340532\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "482 511257447\n859133 935776 1000000 1000000 991005 829977 801631 1000000 263924 986419 999582 945021 995710 1000000 1000000 1000000 927318 360245 869458 914010 1 781969 886228 905359 73233 999951 840169 122894 999830 998370 981213 1000000 957619 429869 1000000 936458 1000000 1000000 891405 762995 1000000 856949 1000000 97405 794352 946302 1000000 1000000 978747 774161 978522 886628 779670 1000000 978345 1000000 998841 849957 1000000 1000000 993885 1000000 715355 1000000 953929 983176 1000000 970775 1000000 1000000 1000000 857975 433612 683503 1000000 455226 999719 546003 1000000 927209 1000000 828262 520488 1000000 997106 974729 986965 981352 997209 999469 828234 844357 831253 1000000 919552 1000000 1000000 1000000 987259 963039 1000000 799419 1000000 915598 789537 1000000 874136 454146 991466 996406 997727 1000000 965850 967537 999999 758466 855084 983486 911910 989860 1000000 999317 663462 819965 755310 912616 1000000 691248 740904 657332 968288 863542 997997 804700 986540 1 1000000 966624 265175 572423 1000000 1000000 800787 768205 999883 922490 970260 968959 645637 814227 840743 904073 967878 1000000 970660 944417 592837 1000000 1000000 857257 1000000 966143 1000000 1000000 377018 1000000 973128 1000000 949677 848404 999997 912807 972720 998075 993143 958246 736441 981237 970436 892223 992452 1 999687 994463 962417 1000000 968638 992533 999344 976018 1000000 803797 996770 898570 998924 995507 856996 656750 934977 982355 1000000 998965 1000000 912179 652761 999339 999987 994952 885684 569443 966500 999999 979907 1000000 998554 896916 949084 1000000 1000000 983590 575912 527765 1000000 622914 999987 871563 974259 959238 983402 976334 1000000 991508 999016 968546 950153 327935 990274 994104 999161 955045 965728 1000000 1000000 999771 1000000 951001 987302 1000000 842840 1000000 981189 917675 911018 377452 385945 1000000 320831 1000000 490655 841488 491464 980462 999643 999864 996490 937680 909824 1000000 1000000 971628 998797 1000000 978125 992030 1000000 999808 414563 999982 144819 1000000 998923 999999 991276 993577 805528 1 998648 1000000 1000000 999958 998045 693806 247922 1000000 956261 999137 1000000 1000000 1000000 903586 991861 963010 964400 505393 991548 418614 983353 997517 1000000 967000 1000000 954630 841181 546058 993468 751802 964070 969044 999559 930868 912100 886916 999528 1000000 913398 981500 999979 1000000 987627 981949 1000000 1000000 1000000 800658 990835 1000000 471132 980022 436542 999999 900845 1000000 765464 999951 1000000 986394 988465 1000000 954423 1000000 973382 883864 913315 1000000 945729 810475 924642 955917 974501 761799 984959 999985 976275 987725 818974 995170 937303 951073 943261 999714 999001 841670 738060 438153 655142 997147 998553 668821 999246 762033 978971 994574 991324 1000000 1000000 751928 772074 981825 996630 1000000 902488 71102 987248 980407 1000000 1000000 530793 996808 1000000 1000000 918731 1000000 979206 994435 636140 785258 992368 951231 938408 843292 829795 931230 997879 964937 1000000 1000000 736066 846549 1000000 723064 1000000 999587 876306 997046 985928 790051 978273 1000000 1000000 1000000 983692 52817 999999 232129 976042 286841 999999 986163 981187 999999 985272 876305 1000000 609676 812742 992200 1000000 872596 996534 999699 416595 993170 986292 1000000 264792 1000000 1000000 998319 679057 893514 551963 963115 909698 913234 871076 1000000 999702 1000000 777456 457645 957730 1 900750 1000000 276573 863915 894742 997102 955580 1000000 979572 1000000\n", "output": "425884716\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "490 123039010\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 987137 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 999136 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 706847 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 244497 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999937 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999589 1000000 1000000 1000000 1000000 1000000 936372 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999491 1000000 1000000 1000000 1000000 1000000 238874 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 656742 1000000 667674 1000000 1000000 1000000 1000000 1000000 1000000 1000000 995130 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1200570\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "491 90472066\n1000000 1000000 1000000 292617 1000000 1000000 1000000 999991 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 292617 1000000 1000000 585234 1000000 1000000 1000000 1000000 1000000 1000000 1000000 292620 1000000 1000000 1000000 585234 1000000 1000000 1000000 1000000 1000000 1000000 1000000 292616 1000000 1000000 292617 877851 1000000 1000000 1000000 292617 1000000 660984 1000000 292617 1000000 585234 292617 1000000 999999 1000000 999999 1000000 1000000 1000000 585234 1000000 877851 1000000 1000000 1000000 1000000 813736 1000000 1000000 1000000 877851 1000000 1000000 999998 1000000 1 1000000 1000000 1 999999 1000000 1000000 292617 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 585234 1000000 1 1000000 1000000 292617 999999 999998 1000000 1000000 1000000 1000000 993838 1000000 999999 877851 1 877850 294522 877851 1000000 1000000 1000000 1 1000000 999982 1000000 1000000 1000000 585234 585234 1000000 1000000 1000000 1 1000000 292626 1000000 999999 1000000 1000000 998728 1000000 292650 1000000 1000000 1000000 292617 1000000 1000000 1000000 999999 1000000 585234 999999 585234 1000000 1000000 999999 1000000 1000000 1 1000000 1000000 292617 1 1000000 585234 1000000 877851 1000000 1000000 585234 1000000 877851 1 292617 877851 292617 1000000 1 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 999999 585234 292616 585234 1000000 1000000 585497 292617 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1 999999 1000000 877851 877975 1000000 1000000 1000000 1000000 1000000 1000000 1000000 292617 1000000 1000000 1000000 1000000 1000000 292617 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 999989 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 877851 1000000 999947 1 877850 1000000 585234 1 1000000 1000000 877851 1000000 1000000 1000000 1000000 1000000 1000000 997034 292617 1000000 1000000 1 1000000 877851 292617 1000000 1 585234 585234 1000000 877855 1000000 1000000 1000000 292617 1000000 1000000 585234 1000000 1000000 1000000 1000000 997254 1000000 1000000 863497 1000000 1000000 292617 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 292617 1000000 1000000 1000000 892053 292617 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1 585234 1000000 292616 1000000 1000000 1000000 1000000 585274 1000000 1000000 1 292617 292617 1000000 1000000 1000000 1000000 877851 1000000 999999 585234 1 1000000 1000000 1000000 877851 1000000 1000000 1000000 877851 1000000 1000000 1000000 999999 1000000 1 1000000 1000000 1000000 1000000 1000000 878024 585234 1000000 999999 862006 1000000 1000000 1 1000000 1000000 292617 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 585234 1000000 1000000 292617 1000000 1000000 585234 1 877851 877851 1000000 1000000 1000000 585234 1 1000000 292617 1000000 1000000 877851 332 1 1000000 1000000 585234 1000000 292616 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 292617 877851 1000000 1000000 585234 1000000 1 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 292617 1000000 999999 292617 1000000 292617 999999 877851 1000000 1000000 1 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 292617 1000000 1000000 7455 1000000 1000000 1 1000000 877851 1000000 877851 1000000 1000000 877851 1000000 1000000 1000000 877851 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999\n", "output": "1130493\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "486 573616932\n1000000 981498 1000000 999434 629617 1000000 1000000 966382 1000000 378554 1000000 999999 932015 997166 1000000 929821 931490 987867 914126 1000000 995466 996940 941323 335322 1000000 955348 942359 575164 998123 1000000 981851 999984 1000000 953296 973557 1000000 953548 978917 1000000 799862 979662 1000000 874011 573487 1000000 1000000 982451 954114 939477 1000000 958408 987736 999981 1000000 781648 1000000 994096 799061 904173 1000000 993939 1000000 811971 607975 1000000 985609 1000000 995359 1000000 1000000 1000000 977951 999999 963910 1000000 858346 598010 620053 878432 668319 994557 1000000 1000000 183918 1000000 997963 1000000 1000000 988416 999984 1 924476 999999 1000000 1000000 1000000 1000000 999999 1000000 963625 61254 1000000 1000000 852908 780322 995535 1000000 1000000 995585 1000000 217463 996999 1000000 975427 1000000 1000000 998138 40355 1000000 1000000 737418 967169 999999 1000000 661630 1000000 842549 807883 983849 999999 999893 941117 1000000 1000000 468499 1000000 849130 957350 991833 1000000 985085 969721 1000000 1000000 977005 517580 358931 996806 998411 996027 999999 992708 1000000 1000000 265770 1000000 223693 993624 951685 948453 999999 998785 1000000 1000000 402370 999348 950007 995033 911745 998726 999998 957095 1000000 1000000 956236 1000000 1000000 1000000 695161 989835 881256 83608 1000000 988494 999996 466718 1000000 292262 913563 1000000 877417 999994 689238 1000000 1000000 908471 1000000 900743 1000000 931475 1000000 990239 791900 410003 999855 999663 1000000 967472 960159 993738 1000000 1000000 543483 1000000 654748 1000000 911340 983877 862224 1000000 1000000 1000000 822222 1000000 999954 936276 715011 1000000 984521 1000000 945286 998784 996008 1000000 1000000 965126 927287 972508 1000000 808629 990962 914838 1000000 979674 997329 1000000 1000000 944756 1000000 1000000 1000000 887936 998974 955079 1000000 961403 907262 983371 993306 1000000 1000000 1000000 1000000 983593 1000000 1000000 955774 915822 844303 1000000 888751 677893 995123 897877 762029 39238 995673 961004 985948 995940 918024 999562 1000000 1000000 996448 1000000 1000000 999103 607895 995113 866603 828873 960113 925777 957033 826479 1000000 1000000 1000000 654379 997454 423016 1000000 905547 133518 962063 863779 1000000 982877 954434 648829 999997 618852 914064 999999 999777 1000000 1000000 911138 1000000 928256 992079 1000000 901868 320974 314601 1000000 369895 942328 1000000 971726 999998 922200 912273 865216 1000000 978957 709089 1000000 824719 1000000 968600 1000000 872262 1000000 972781 885319 993289 961705 1000000 984641 1000000 949322 832799 1000000 1 1000000 816612 987905 1000000 998321 1000000 954054 974101 621447 937270 996347 990934 880960 993500 1000000 968812 991250 889406 1000000 999999 1000000 1000000 958296 1000000 597631 1000000 1000000 1000000 1000000 239277 1000000 995860 998189 921132 984685 996032 1000000 1 1000000 813677 1000000 976862 997761 934225 1000000 1000000 1000000 371255 600127 916172 1 993584 981769 954678 1000000 984215 995464 1000000 1000000 948542 986043 930821 1000000 1000000 1000000 1000000 1000000 1000000 999852 999811 483884 774463 799104 1000000 892427 999613 1000000 998621 993480 303470 388203 728644 1000000 999341 549661 999949 1000000 910082 1000000 993871 990469 62047 807933 987077 179484 968214 1000000 846366 1000000 997768 1000000 724710 1000000 1000000 995469 540264 959043 1000000 997147 442874 1000000 998816 211459 999999 986004 947670 988068 1000000 990606 996042 1000000 999999 928002 800804 775348 1000000 999978 1000000 978274 1000000\n", "output": "437626962\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "499 179045852\n1000000 1000000 1000000 1000000 1000000 962252 948209 1000000 1000000 910117 995886 999352 886974 697557 1000000 1000000 1000000 971345 1000000 982250 996758 1000000 845237 898565 1000000 963040 999360 1000000 1000000 980081 971745 999938 742352 1000000 1000000 1000000 1000000 1000000 689617 1000000 1000000 1000000 814774 1000000 998213 329092 999999 983988 242930 999999 678951 1000000 1000000 1000000 1000000 844472 986995 1000000 1000000 915944 948033 975145 998670 820244 1000000 776612 999948 1000000 524740 1000000 965941 1000000 999868 388198 523636 1000000 999489 1000000 937600 929272 971068 1000000 608033 1000000 999975 999953 811767 619535 1000000 1000000 955435 992095 967176 580953 1000000 1000000 1000000 999991 1000000 995292 992234 958475 999996 935813 804489 1 999966 967989 999988 732172 998847 999996 992856 921094 1000000 1000000 1000000 1000000 1000000 966106 821479 1000000 998903 726104 1000000 974938 410098 999992 999609 1000000 891743 205521 1000000 855110 893503 1000000 884490 873951 1000000 1000000 656921 639669 999997 768511 976244 942027 984045 1000000 1000000 999900 997208 999212 994846 1000000 936533 660096 998268 1000000 715855 831266 992780 1000000 904777 1 999996 95806 1000000 1000000 998476 973909 1000000 1000000 997016 978156 886225 712665 841293 615003 987328 999893 787149 943654 1000000 970443 333679 1000000 1000000 979797 968078 1000000 1000000 963515 1000000 961330 1000000 1000000 959413 1000000 1000000 994982 1000000 1000000 1000000 1000000 1000000 412835 802901 951882 1000000 934210 1000000 886532 999376 849903 922545 366431 919359 810689 1000000 984626 963938 692336 986459 322907 410122 806193 996615 594791 952408 126475 999826 999302 1000000 1000000 439828 1000000 969843 990880 819505 994056 492150 723707 999642 973891 1000000 920640 405145 960578 1000000 983837 984569 990197 1000000 990370 1000000 1000000 921199 999780 1000000 953588 944871 1000000 1000000 1000000 1000000 1000000 750845 1000000 995284 1000000 1000000 770870 998545 994804 998712 996268 1000000 923671 845625 757302 1000000 303988 958798 1000000 999960 960107 38146 1000000 515560 1000000 980020 1000000 1000000 1000000 37500 998076 1000000 901191 1000000 506574 1000000 1000000 939306 950031 26 1000000 1000000 1000000 697053 965517 999857 984897 1000000 1000000 651419 1000000 851340 1000000 950749 629771 992781 977468 990795 999953 1000000 933995 1000000 999983 1000000 779261 1000000 718782 965168 1000000 703044 1000000 1000000 1000000 866599 993671 981705 1000000 943236 1000000 747254 891532 809491 1000000 951414 999144 992112 1000000 1000000 1000000 988072 1000000 1000000 999555 973982 1000000 931395 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 801928 1000000 999822 941434 588364 1000000 1000000 968129 774828 1000000 985872 1000000 1000000 1000000 1000000 1000000 1000000 509427 1000000 999999 1000000 999109 153279 998934 1000000 1000000 1000000 974168 1000000 1000000 999074 1000000 974640 984993 1000000 941249 886549 1000000 1000000 865099 1000000 989707 995844 998911 839444 670865 910089 999473 978707 694504 1000000 999554 994574 971627 730656 1000000 1000000 1000000 1000000 1000000 993247 999995 886738 1000000 968237 983403 984883 912322 856164 896500 1000000 338927 1000000 925137 848877 964595 802709 660241 998014 999999 1000000 841880 684567 1000000 957490 475947 776977 918207 999964 1000000 1000000 974432 1000000 973108 537649 1000000 888476 989907 1000000 936770 958782 974126 999999 852776 1000000 714062 1000000 1000000 1000000 999972 926201 997303 971838 999999 871203 787229 999739 999996 963187 999999 831338 947204 1000000 907923 995578 572500 999887 855897 1000000 988058\n", "output": "615183\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "487 130685463\n1000000 1000000 1000000 957273 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 999317 1000000 999635 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 999999 1000000 999902 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 957296 1000000 957271 1 1000000 1000000 1000000 1000000 1 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478635 1000000 1000000 478635 1000000 1000000 1000000 1000000 483190 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 478635 478635 999999 957270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 44764 1000000 478634 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 957270 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478634 1000000 1000000 1000000 957270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478635 1000000 710343 1000000 1000000 957270 1000000 1000000 1000000 1000000 969558 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1000000 999998 1000000 999999 1000000 957270 1000000 1000000 1000000 1000000 1000000 1 978286 478635 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999994 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 764923 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 762071 1000000 1000000 1000000 957270 1000000 1000000 1000000 478635 1000000 1000000 1000000 478635 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999958 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 957270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 957270 1000000 1000000 478635 1000000 478635 1000000 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 478642 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 601356 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 957270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 12 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 998354 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 81 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 957270 1000000 478635 981087 1000000 1000000 1000000 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 957270 957270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 1000000 1000000 1000000 1000000 1 1000000 1 999999 1000000 1000000 1000000 1000000 1000000 478635 1000000 1000000 1000000 1000000 1000000 957270 1000000 1000000 1000000 1000000 1000000 478635 1000000 999999 1000000 1000000 1000000 1000000 478635\n", "output": "994810\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "481 640058574\n1000000 68845 967535 734070 512362 997908 964719 939387 980217 999252 420753 968221 1000000 782867 1000000 813064 981804 995740 1000000 291231 182666 988118 999503 856414 916666 917188 498276 920515 915601 945361 999956 996249 714423 972869 753204 1000000 950028 1000000 1000000 785990 1000000 950121 226008 914827 540324 982974 960375 999139 934356 1000000 991313 454470 560102 1000000 808517 1000000 877476 960498 1000000 1000000 1000000 978892 766327 604286 971297 946441 998295 367348 859147 5620 1000000 1000000 817281 855317 998114 740001 1000000 457153 990260 829108 981717 997635 614322 333162 1000000 818954 815582 968636 958802 1000000 635664 683401 788822 342169 710690 541943 990322 999088 545904 1000000 993170 988668 1000000 24853 1000000 18707 516244 987240 893079 1000000 790919 932172 624701 966759 997955 745787 630989 859595 895179 997125 1000000 473564 115797 986985 588721 925028 659187 1000000 991673 1000000 920096 884826 21639 1000000 1000000 921347 630508 1000000 1000000 746079 966205 869903 998928 999967 968510 1000000 1000000 292084 964606 797321 958805 999822 919774 853235 988596 1000000 974162 527500 856218 833625 600767 859819 997890 1000000 958990 1000000 891376 1000000 1000000 1000000 175192 794597 868550 1000000 623902 879384 994780 699878 672233 951209 665186 997456 939670 970438 999240 859595 785683 945569 972474 447467 997092 876416 992588 739066 87224 999353 982177 450052 937153 962017 883253 482000 928535 1000000 986386 996702 995981 1000000 790111 1000000 411112 672589 1000000 998293 19021 954549 88636 650600 660292 842096 394715 984648 919384 828395 962691 999502 1000000 999641 846485 984628 794589 458519 766105 955065 351038 964766 998743 1000000 947156 379885 1000000 999791 992708 986765 990844 728893 1000000 730802 757877 920863 936893 641814 804646 757062 511436 969873 999774 209182 811518 1000000 1000000 902454 1000000 988664 979027 921149 999073 994866 472372 462468 27411 18047 974101 994301 858219 995759 993210 6538 982292 417405 1000000 949819 927100 1000000 861296 204696 832100 972642 993229 550466 253747 988628 1000000 1000000 877078 1000000 396258 770364 988611 831392 970942 633021 1000000 995256 232131 891206 14862 854267 924110 1000000 934014 888946 745367 933900 994089 651670 1000000 918260 1000000 1029 36499 998759 746303 1000000 1000000 339197 873918 773568 994206 509238 992537 986742 1000000 592333 1000000 614859 1000000 225880 171410 953213 916757 778166 997908 346314 998126 1000000 865381 996993 996479 1000000 749285 992567 998698 966244 660465 1000000 968679 704624 1000000 764995 997690 941030 1000000 1000000 1000000 897998 1000000 727963 990155 862442 983445 1000000 924848 980808 1000000 947411 978423 1000000 767495 988190 723952 999880 992775 115046 884587 282882 933704 1000000 871404 972414 999023 970453 1000000 591031 672985 855298 1000000 976654 849993 989773 880164 841234 997775 910978 822473 987756 1000000 514389 1000000 999764 922369 932109 1000000 413396 1000000 840997 994843 907813 565345 988819 508730 831146 927291 946994 997916 924770 986304 995921 1000000 901052 956725 843050 999997 974614 998442 1000000 602447 863022 981111 994023 815122 994723 41563 1000000 935124 979453 647270 1000000 999258 992606 707350 632068 985246 910822 955244 1000000 716902 980271 235933 961118 994720 261387 575835 942059 1000000 982238 829154 980955 1000000 999923 999069 971004 750271 808295 958794 989733 948524 901745 1000000 944379 998393\n", "output": "400750667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484 931628662\n871247 684091 999918 960063 828969 992704 842579 977863 853522 983255 999911 999961 997690 988155 990965 723450 987317 955780 923902 855471 826543 917479 763700 995203 992539 997387 892827 984027 995704 959115 999837 723333 999980 919203 967154 851754 969498 706501 998393 999291 541222 999751 996203 942915 809949 893074 999381 944785 806312 899997 997579 673509 641550 975084 972850 963483 975405 941727 946842 992145 982716 838389 986101 905455 740419 989646 951846 994258 1000000 975101 995505 999094 779197 959000 985936 954172 815487 828616 935519 839502 919819 978993 961657 998043 987261 974669 986417 736963 998940 904107 892081 925200 957493 964200 999694 999999 974503 945684 999807 781817 953015 794528 999994 851121 945721 540068 983115 937820 996562 999911 995304 968002 996867 949531 1000000 999997 915247 968087 847083 962781 980500 987208 910274 851451 939468 769413 993185 600301 843568 999754 999967 554241 977126 935554 968696 827814 987445 956612 999223 688821 797069 957962 987105 844441 995768 993239 912156 998422 973474 998816 1000000 977754 714331 901297 1000000 877949 977432 996611 507453 986275 992444 1000000 986113 991534 567879 945221 990845 906482 837749 1000000 970169 664838 980388 943926 834694 907362 997480 947514 945033 943819 968340 770332 999758 925980 995217 971904 995392 938985 722412 949448 724522 974291 702913 995854 938662 979874 975313 649213 985858 1000000 999827 953372 997165 829136 969114 821492 984387 837225 814251 815826 870685 707568 999945 961805 594397 733528 994454 837336 995068 760927 901095 987736 979363 816043 759676 849812 801498 999959 736975 998628 997348 987166 988189 919875 915835 982093 908861 686419 997420 947480 973839 823830 997814 997961 809242 828424 885982 948555 957946 591673 960608 416352 907102 997664 764934 773050 960059 894876 967989 896579 854529 517807 803018 714902 919805 390331 993254 976214 872064 997085 984772 991967 928521 968956 899226 782882 999517 943537 999959 972298 611899 906966 877071 987253 995652 467418 933160 996632 999633 966860 703007 984228 986683 931906 997016 996839 993394 990330 894187 999943 996687 920055 976343 999463 984374 197233 993042 978997 934767 999969 933963 942565 920820 488060 871602 910620 990537 964485 966722 990665 998760 679051 889832 941727 953727 961220 841114 999787 999926 906774 999285 850046 798905 876489 955755 898630 987650 881730 657541 932365 989949 987608 943299 998623 997439 992777 884908 992139 873496 947938 928844 1000000 999960 821799 988431 900908 987190 832792 949017 971920 818525 996423 930537 958959 947323 988721 954965 687950 908587 849782 968617 973936 984371 430234 925368 967705 915023 992320 825738 997933 999110 976237 998760 944633 969383 924952 999306 991563 975367 829770 990267 989777 933863 925824 939331 999978 950103 914651 894709 926819 943396 987099 583189 892870 990584 968177 999739 991460 910797 983329 991576 911446 859366 999907 999861 999917 698466 999147 995087 999172 963399 937206 765055 940022 967343 944911 871833 842682 851928 978979 998117 953342 745958 987115 981652 503608 894937 991753 817314 997643 999979 997706 899979 995228 998993 997698 620774 759468 995579 965771 989971 997730 936840 932153 999990 947466 858681 999932 994363 974669 924518 926618 900711 901659 971191 444190 972355 971234 999452 846105 769178 999000 912616 983173 934534 992605 985471 987889 969605 999730 978059 859079 765793 891097\n", "output": "441594170\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484 450342599\n270622 1000000 1000000 1000000 1000000 1000000 1000000 144353 1000000 1000000 1000000 420689 1000000 1000000 571758 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 690663 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 446585 999981 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 887671 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999970 1000000 1000000 1000000 1000000 1000000 1000000 173517 1000000 1000000 1000000 1000000 943033 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 202843 1000000 621824 1000000 1000000 1000000 1000000 1000000 1000000 1000000 149552 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 484228 1000000 1000000 1000000 1000000 999898 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 662660 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999466 1000000 364554 1000000 1000000 1000000 1000000 1000000 101547 712061 940973 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 74554 1000000 1000000 510065 1000000 1000000 284477 1000000 1000000 1000000 1000000 1000000 1000000 1000000 452261 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999982 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 201359 1000000 1000000 1000000 1000000 1000000 1000000 371149 1000000 1000000 1000000 16504 754766 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 644558 1000000 1000000 1000000 816551 1000000 939741 1000000 1000000 1000000 326850 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 565 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 498703 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 297888 1000000 1000000 1000000 1000000 1000000 1000000 935384 1000000 1000000 1000000 1000000 1000000 320783 980074 1000000 1000000 1000000 1000000 987608 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 39675 155843 83960 1000000 1000000 1000000 14757 1000000 1000000 1000000 1000000 1000000 827723 1000000 711448 1000000 154438 1000000 1000000 1000000 1000000 1000000 439303 1000000 1000000 1000000 1000000 517423 1000000 1000000 1000000 213510 1000000 1000000 1000000 1000000 1000000 1000000 1000000 125390 1000000 1000000 1000000 1000000 923973 1000000 1000000 37218 1000000 1000000 1000000 1000000 417628 1000000 1000000 1000000 1000000 94507 1000000 1000000 1000000 785742 641631 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 39681 1000000 1000000 488056 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 892568 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 708381 1000000 1000000 1000000 1000000 697581 129893 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "451342598\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "481 387700795\n1000000 1000000 320227 455362 338497 564176 1000000 1000000 545964 178947 1000000 88594 793021 1000000 1000000 602761 1000000 1000000 117318 991221 423355 1000000 1000000 75907 521931 1000000 1000000 591991 299569 999703 660087 137020 1000000 1000000 848809 800023 616222 997197 1000000 943913 1000000 585565 1000000 664997 539820 1000000 1000000 1000000 1000000 1000000 97133 1000000 1000000 1000000 398891 1000000 1000000 1000000 664754 1000000 256080 1000000 1000000 673165 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 968778 1000000 1000000 903856 1000000 686273 109065 865145 1000000 1000000 1000000 966840 732203 1000000 770717 1000000 174239 415455 1000000 931540 382314 776987 1000000 180187 699711 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 337121 747112 967240 1000000 1000000 1000000 1000000 844901 1000000 613379 1000000 1000000 346033 1000000 1000000 325608 1000000 1000000 1000000 1000000 509894 1000000 1000000 1000000 482100 711583 1000000 321567 646765 54699 1000000 980842 1000000 1000000 374280 468292 1000000 1000000 1000000 291552 1000000 1000000 1000000 1000000 466016 1000000 825794 1000000 1000000 699136 1000000 353567 929247 1000000 801292 1000000 272467 1000000 1000000 1000000 1000000 1000000 401064 1000000 626172 814011 1000000 1000000 1000000 726066 1000000 1000000 1000000 502299 1000000 1000000 997766 1000000 1000000 673149 1000000 261799 1000000 1000000 1000000 1000000 696055 1000000 212541 1000000 203470 1000000 1000000 474899 520868 1000000 158991 962559 1000000 281068 291010 1000000 733480 776547 1000000 1000000 1000000 195422 1000000 932172 515998 1000000 920039 1000000 322320 1000000 718906 181996 1000000 69686 1000000 314095 997933 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 115723 1000000 1000000 1000000 1000000 1000000 998999 1000000 967739 257224 1000000 150895 480688 1000000 885659 1000000 800971 466024 953940 1000000 1000000 1000000 1000000 1000000 1000000 480046 1000000 1000000 727002 1000000 1000000 1000000 641886 1000000 878407 1000000 908521 797185 234266 806537 1000000 1000000 504776 1000000 49204 1000000 542867 1000000 383096 1000000 1000000 482115 1000000 1000000 487674 273659 338953 16544 1000000 1000000 1000000 44631 1000000 1000000 1000000 1000000 1000000 1000000 724815 1000000 1000000 1000000 1000000 1000000 1000000 1000000 945571 1000000 999950 1000000 688165 1000000 1000000 1000000 1000000 226961 926006 1000000 15278 1000000 405205 1000000 28341 1000000 1000000 531884 1000000 388061 171299 968637 32373 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 899865 1000000 519048 1000000 1000000 1000000 1000000 1000000 1000000 841903 1000000 1000000 1000000 1000000 421040 1000000 999925 1000000 628264 808867 1000000 1000000 72309 512750 402139 1000000 1000000 78413 1000000 973599 801203 1000000 1000000 820287 663443 1000000 1000000 760878 1000000 1000000 736821 501472 921366 385624 1000000 182516 573774 1000000 553622 743587 1000000 430282 1000000 1000000 1000000 1000000 1000000 137676 454715 532514 843563 1000000 1000000 1000000 1000000 869793 1000000 129666 53179 1000000 1000000 638208 1000000 749069 649965 422630 66469 1000000 1000000 1000000 807572 1000000 1000000 447439 899951 1000000 742056 1000000 582311 1000000 1000000 906124 1000000 1000000 934889 17562 403001 117638 1000000 224913 1000000 1000000 723415 478503 1000000 1000000 1000000 255112 1000000 87206 769384 1000000 1000000 1000000 1000000 117933 1000000 1000000 1000000 1000000 1000000 255488 146143 1000000 67544 1000000 999999\n", "output": "194350400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "492 456838172\n975465 1000000 736317 1000000 999726 1000000 475997 972130 1000000 970248 677708 973505 771357 1000000 930080 854833 985891 1000000 911136 184770 1000000 1000000 888763 1000000 1000000 1000000 981426 1000000 1000000 999985 624917 1000000 1000000 1000000 658692 840654 965782 968912 911195 1000000 118408 700639 892440 409222 1000000 1000000 1000000 1000000 814886 1000000 999994 1000000 666361 1000000 1000000 704161 1000000 999518 1000000 997792 674252 1000000 937022 955730 1000000 1000000 1000000 833477 834587 1000000 917211 1000000 948471 1000000 1000000 1000000 1000000 1000000 1000000 994592 1000000 897846 934553 834704 998427 1000000 1000000 1000000 1000000 1000000 633327 803148 999990 997582 918317 1000000 1000000 1000000 1000000 732572 783000 1000000 1000000 811162 1000000 1000000 1000000 1000000 929134 998631 1000000 1000000 1000000 1000000 520271 822895 851696 743251 994449 1000000 1000000 1000000 997529 1000000 1000000 986027 570296 1000000 999082 981853 997888 1000000 988299 961568 1000000 1000000 998818 998172 212918 872974 1000000 943137 996986 939277 1000000 963687 1000000 982489 819010 1000000 1000000 794257 973420 1000000 1000000 740861 1000000 1000000 1000000 1000000 974484 927130 770377 1000000 1000000 981379 999041 945915 553387 998639 958592 1000000 1000000 43407 983765 1000000 677916 944219 1000000 961561 249757 1000000 1000000 1000000 998224 1000000 847596 1000000 1000000 329789 1000000 403092 1000000 1000000 1000000 1000000 1000000 998032 1000000 397565 1000000 1000000 1000000 988790 1000000 445280 1000000 1000000 735391 991674 999384 1000000 1000000 1000000 1000000 1000000 1000000 830669 1000000 1000000 999862 1000000 960706 480541 1000000 516981 1000000 968529 985828 951692 881244 1000000 584378 472540 916815 807538 837159 981113 662523 1000000 962190 1000000 945269 1000000 999542 934333 900358 977847 981982 992475 1000000 1000000 1000000 174772 1000000 1000000 1000000 996542 920024 1000000 977862 999833 344606 1000000 988822 1000000 997081 1000000 1000000 1000000 1000000 269411 1000000 1000000 1000000 963686 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 769937 1000000 999986 1000000 1000000 1000000 793001 1000000 771453 978727 1000000 787542 793723 1000000 912650 999994 1000000 1000000 429335 740957 1000000 1000000 980560 1000000 921493 967860 87906 1000000 922944 720039 833657 1000000 855417 1000000 1000000 1000000 1000000 1000000 1000000 1000000 923807 981039 1000000 1000000 1000000 1000000 543561 1000000 1000000 1000000 1000000 999966 237217 1000000 739405 1000000 1000000 472954 1000000 1000000 996492 1000000 642165 1000000 1000000 847379 998206 1000000 1000000 609204 1000000 1000000 1000000 1000000 843210 732593 939113 1000000 320793 1000000 1000000 1000000 1000000 1000000 981526 1000000 1000000 963891 1000000 1000000 1000000 1000000 990519 997910 1000000 946511 1000000 999926 831820 1000000 1000000 902467 1000000 1000000 835688 992226 907337 695271 900719 987405 801484 1000000 1000000 956392 999990 1000000 886539 1000000 902774 1000000 1000000 916006 1000000 980761 1000000 1000000 958736 1000000 1000000 841676 1000000 1000000 1000000 1000000 749157 1000000 910559 998816 998574 997707 1000000 1000000 996030 778222 1000000 1000000 1000000 1000000 931858 1000000 1000000 1000000 867722 1000000 709863 1000000 990536 1000000 1000000 999999 1000000 933217 1000000 1000000 982669 1000000 645066 1000000 1000000 1000000 1000000 999928 999362 902021 1000000 1000000 990535 309640 720934 1000000 1000000 869338 799844 981131 1000000 1000000 983163 1000000 694629 861846 712047 474780 1000000 864494 969894 828234 891049 642580 982999 918437 1000000 947392 1000000 1000000\n", "output": "452957024\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484 264046616\n1000000 194902 142851 735387 59352 971809 108296 831641 476924 938383 736871 756707 249298 980195 61645 1000000 619959 565430 1000000 724218 713045 403837 465778 976375 989869 773099 951519 519457 983215 885478 845954 711817 354566 325711 933677 932023 290120 165954 579850 370184 279023 652704 566110 803284 780959 27589 759454 450722 499494 182472 566075 957966 15920 375805 991757 426306 1000000 603210 189719 270779 129368 63478 959691 34311 999998 422637 825097 891231 750347 493290 715945 440553 89243 930315 117418 58366 35785 992946 1000000 719115 856065 1000000 770928 1000000 337740 296045 866147 180907 767687 288847 151669 1000000 803550 1000000 293586 944450 543933 44570 295266 380284 883595 51186 400856 532407 873136 724490 283228 738697 428558 852148 792348 570423 358359 697452 999985 503679 961177 605532 999999 117922 673921 573393 803909 23073 917010 686780 36710 378965 264141 728743 845627 303557 617609 975987 842688 1000000 882420 89416 57070 126714 304969 571245 979121 298129 61339 896887 377987 605767 363378 173730 666551 982799 39464 507164 521988 452214 917385 1000000 683419 694698 795170 70148 945102 1000000 952741 108144 27561 255387 316090 455637 788248 189072 216244 6543 92909 586672 330584 221913 772091 745948 492726 977896 745609 550950 529693 777574 990667 679563 601953 267420 368702 672184 220080 428806 952502 492105 136388 419201 715341 857887 817180 817141 623845 470196 509494 1000000 499626 20629 1000000 1000000 16276 144883 788965 540373 238910 81270 28722 1000000 745620 707649 358222 435486 5437 405510 180009 349934 118096 1000000 239324 97692 1000000 403300 305785 99604 1000000 294452 456482 519794 557957 436047 811998 1000000 843554 1000000 530878 513613 722123 69139 80562 418426 268695 758198 769335 468250 907740 106993 602127 453521 629037 5131 118933 669386 1000000 1000000 1000000 537117 339827 706496 52194 259556 743501 151338 619120 824350 5917 1000000 300210 999427 729045 601383 405155 669162 1515 711913 476190 332327 14410 13162 98977 248339 668309 44661 810588 477346 212232 671954 177029 907567 684080 236099 603076 366048 136275 392779 839833 968774 291678 386745 754600 801539 833736 795521 235236 978468 582737 897038 326822 861246 444927 969337 655342 1000000 856932 673742 621618 828209 710650 107922 999996 108145 1000000 391951 642253 303653 589230 4546 966569 556470 235180 821933 297543 973135 973439 925278 810128 1000000 453203 324575 522432 788945 361314 41256 218705 88266 1000000 688729 371933 1000000 1000000 510322 899684 507260 517496 997204 306417 1000000 228654 581237 1000000 153920 398965 864366 931634 381594 749896 628098 136364 786501 339173 199131 570528 288354 152003 999871 586648 738166 767664 484220 189231 639128 349223 289415 288419 755088 380252 630652 51982 262088 662768 1000000 452358 398891 483745 322418 801897 166290 746935 795946 155426 8596 999783 748140 102572 960809 391651 282570 99571 1000000 721360 106115 496493 374380 915554 98945 449757 344574 101712 467614 281519 936662 445959 771937 978418 275361 345215 770406 601562 411918 600337 517858 698604 31058 113653 618108 32737 433133 1000000 589204 217494 1000000 985786 809815 11658 96178 216690 1000000 1000000 390584 939914 1000000 415189 538553 888867 678089 91911 111311 639029 508546 30472 634648 606011 214457 1000000 29194 953105 685102 448796 808996 796244 237893 472924 903822 482576 109571\n", "output": "37863803\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "487 715896921\n820747 812731 943038 18139 864528 741236 820107 913721 838141 1000000 954137 981571 28399 874534 117184 564896 640786 808512 546840 1000000 956403 704321 972667 14181 91315 685154 264432 420851 69880 417496 50246 795794 765353 993451 894562 989159 859316 677255 999153 921057 973759 665881 419641 998159 931754 169527 822084 987710 353860 999616 947703 941238 76375 659536 814007 1000000 694252 902079 838742 241057 522856 613312 499899 555727 780614 777954 432040 256504 797437 796688 695012 1000000 148503 544807 965404 993430 4492 980309 980943 184171 996252 935971 888835 858868 976653 933269 584880 808514 605873 884899 953059 999298 996601 564977 882570 991514 715369 360117 350814 901115 421903 865458 919280 333485 1000000 851705 801307 748101 334252 999802 836487 708651 724403 485664 463072 538333 871351 934104 930772 979492 963188 607724 971944 182970 216420 726684 874553 472796 983239 1000000 1000000 979433 733204 999907 1000000 993073 393316 503580 956209 18337 964659 550859 897853 999726 662584 1000000 579621 943217 789782 951578 1000000 996290 855564 955139 862992 995114 996211 185045 775523 906236 821161 994816 991179 155082 344306 998287 28191 947657 999078 921995 944921 932170 1000000 963207 942924 406732 1000000 724392 411504 30349 781051 257439 848370 596354 708746 1000000 1000000 524657 850160 206913 977263 527454 749273 807195 748290 891153 708501 601771 447364 846071 993360 918359 743938 153900 997783 987064 998001 896203 730393 991665 1000000 1000000 800503 704850 963885 800772 1000000 999999 701197 998090 930617 434294 52284 331727 999797 111697 1000000 871793 887056 994072 928357 588785 873473 420565 959341 902553 999749 981929 583017 766021 227991 872527 995141 1000000 613449 67224 1000000 841481 999998 727503 823168 566122 909217 1000000 853908 864361 742446 407227 409325 27103 968956 1000000 646411 268635 473678 106664 945178 929412 999999 1000000 159741 672120 858247 388367 187714 934132 606842 994936 1000000 216551 897025 138675 955438 701415 655 803492 941518 493435 654603 999986 1000000 280284 1000000 853097 1000000 529793 861866 1000000 973710 774840 483480 900809 982016 998795 789557 335102 984423 1000000 918513 987373 378977 510261 999406 999985 692790 986778 609271 716161 305443 91880 906717 775064 219839 993661 188667 441764 1000000 930546 347770 745696 985567 756169 626799 892488 858465 497612 716613 304318 312632 1000000 287225 963909 414367 1000000 951077 857845 363831 853851 361454 170506 864852 307514 890784 897286 558422 563199 271999 1000000 1000000 142623 1000000 514642 999774 601439 997743 697702 467887 1000000 949176 932088 117650 924323 987915 674762 690708 550218 899940 997498 1000000 36332 779853 1000000 1000000 876015 880243 581269 974762 825452 446114 584414 678634 808972 305729 25491 318590 783396 898957 790958 92151 186503 61870 961076 60834 804136 892890 238157 43717 894664 983788 990897 829984 197461 985427 950262 982249 420065 824249 735910 971923 750634 608480 990217 716793 51738 1000000 374904 333180 497240 860030 110393 963793 720113 19654 398682 788008 1000000 292474 627814 1000000 997395 719790 971605 102597 903531 995852 727454 812569 486193 346456 949280 975757 974834 980431 412400 708071 381546 749411 155012 713712 999970 326918 648881 992580 996046 782361 125720 530168 659056 591003 989120 77645 1000000 810857 55469 389931 930745 1000000 712810 965760 926363 977491 999063 554884 200463 919749 1000000 998932\n", "output": "346907724\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "485 355083633\n1000000 1000000 860702 1000000 530756 1000000 171749 238969 398727 974843 1000000 1000000 99496 22786 1000000 1000000 1000000 491957 411917 124760 880841 343869 22759 744559 1000000 1000000 1000000 1000000 1000000 1000000 894203 1000000 999999 1000000 379203 1000000 16038 1000000 540192 1000000 395178 460612 1000000 74874 386283 919146 999993 773893 1000000 1000000 1000000 973485 1000000 788325 530972 424149 1000000 296469 603870 1000000 1000000 656580 1000000 469655 641221 1000000 544627 282257 1000000 405446 1000000 82425 1000000 1000000 306866 485892 761561 957720 1000000 927266 368271 18355 1000000 1000000 1000000 1000000 1000000 72698 637520 240530 1000000 312958 484546 358292 112622 453735 82043 855237 1000000 127280 893640 1000000 567351 590110 895993 1000000 1000000 1000000 667126 1000000 1000000 271534 569923 1000000 1000000 1000000 522569 1000000 864285 400933 989000 704258 518685 135706 277825 297736 1000000 1000000 81661 910294 332357 585048 1000000 488645 786407 1000000 672923 1000000 407273 999974 728513 444272 820893 1000000 1000000 1000000 1000000 210532 1000000 1000000 1000000 424311 877903 415886 1000000 1000000 33266 189128 66239 1000000 47173 642251 407591 1000000 1000000 966566 373107 694526 1000000 249272 1000000 319255 1000000 1000000 687523 1000000 999842 552869 1000000 1000000 1000000 1000000 1000000 1000000 835474 656225 153703 753668 664 746767 697355 1000000 1000000 1000000 1000000 336492 636432 1000000 933035 832003 679747 580468 1000000 813647 1000000 1000000 499064 258078 1000000 726567 787794 112934 1000000 927507 1000000 1000000 1000000 365907 1000000 1000000 587135 331166 1000000 1000000 844198 1000000 1000000 996220 342879 1000000 11759 153767 753497 161289 4576 1000000 1000000 998033 714574 277434 573107 1000000 574403 1000000 523999 883165 776234 820707 1000000 559014 431146 1000000 999977 614839 1000000 897700 1000000 1000000 1000000 999451 1000000 1000000 625380 1000000 1000000 1000000 1000000 887316 1000000 88961 409422 511854 839259 547106 1000000 614390 1000000 290775 996188 1000000 2820 1000000 515683 1000000 276094 329292 6290 564907 1000000 1000000 367255 248914 967175 893833 1000000 317267 635317 1000000 955035 1000000 782214 16678 1000000 1000000 1000000 975139 1000000 956487 728893 1000000 431831 1000000 856403 1000000 1000000 1000000 1000000 1000000 1000000 661103 642410 105746 361609 282209 1000000 1000000 814889 179559 1000000 1000000 1000000 47064 802104 922900 1000000 225429 879621 417862 1000000 643797 1000000 889949 522769 1000000 1000000 1000000 1000000 907718 675221 370127 859392 1000000 277110 1000000 1000000 576816 122508 448722 954574 1000000 1000000 182102 926315 1000000 32688 1000000 144364 56725 164650 616321 627147 138662 1000000 1000000 647999 1000000 992390 1000000 996494 1000000 1000000 1000000 1000000 1000000 972693 455961 1000000 82551 1000000 904246 153435 201447 319481 1000000 1000000 1000000 668515 249028 999641 644274 985652 1000000 455188 1000000 1000000 507431 1000000 1000000 835870 1000000 1000000 69057 221140 177514 1000000 1000000 87059 1000000 1000000 1000000 815281 642066 580956 1000000 554933 1000000 1000000 1000000 1000000 1000000 40088 379724 412957 336307 1000000 67986 1000000 801837 1000000 618154 1000000 864071 1000000 1000000 270249 1000000 1000000 43481 999968 378326 6314 791795 579504 996865 513705 160871 1000000 884649 510815 1000000 1000000 1000000 1000000 230657 214503 810312 1000000 918223 1000000 1000000 95942 104666 835102 1000000 999818 920186 1000000 316880 1000000 1000000 562864 1000000 910995 1000000 1000000\n", "output": "356083627\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "489 301693503\n904326 915838 146863 153749 624668 200184 389309 14379 616544 273834 280840 154311 821125 562211 374216 1000000 528980 757788 27501 1000000 46900 702427 184406 475238 1000000 427826 248538 999773 1000000 742505 464357 790199 41267 365236 932378 585544 956313 1000000 1000000 447662 937452 149723 296816 697733 37718 51471 748018 793706 152831 1000000 65834 637519 999989 48657 140102 181363 748554 838855 909561 301778 478186 146592 1000000 177878 1000000 954941 822585 402976 112008 412626 564466 1000000 253822 288796 999946 1000000 1000000 576072 883636 859725 371449 433433 888455 745224 1000000 520887 679744 993240 873141 1000000 130742 756539 554460 899233 945950 874950 930541 1000000 765390 999997 216572 1000000 1000000 1000000 509709 1000000 934018 1000000 697928 527540 1000000 267389 1000000 384271 467154 397769 511928 583692 615833 1000000 841217 816582 977687 943590 772744 770197 379692 1000000 1000000 1000000 837633 139990 805146 51933 276775 857552 965061 782733 71315 453557 196671 1000000 140274 870571 345750 332871 595901 311891 706743 573587 990826 993026 93354 332744 906539 707451 598678 899859 759141 1000000 302034 362888 1000000 1000000 302176 998318 706029 268778 1000000 92760 157899 228149 1000000 355561 671058 859235 540751 887664 632848 149857 776063 422973 633790 1000000 144830 813129 953404 978524 469008 226152 698727 564045 692791 74984 860366 1000000 1000000 168183 68908 136353 711790 266068 933697 368479 776128 264023 657560 699425 371073 872346 927935 955313 973914 1000000 3301 533774 765796 924135 175027 731800 661173 60329 1000000 275078 421546 683 751486 159415 723937 106973 271931 334997 1000000 999966 706058 994192 167636 887225 164199 998615 478300 1000000 634800 846148 24861 1000000 96047 380951 1000000 289631 183419 117588 144476 810577 900453 414417 1000000 327778 374758 587843 728790 664291 443206 841991 374607 1000000 569013 783362 466487 609755 806127 958690 966233 369272 669811 459790 989886 1000000 1000000 1000000 359996 779714 948340 793426 686656 995924 173532 820999 1000000 886753 1000000 1000000 1000000 1000000 379922 516479 362108 999967 1000000 958265 459307 1000000 662363 437309 1000000 440439 255733 262099 1000000 1000000 426422 46041 71907 1000000 136922 990813 1000000 341334 428394 944662 1000000 1000000 1000000 205199 988333 956591 938910 620529 791598 647614 73570 1000000 945676 1000000 902762 175295 617943 614450 912847 769959 999836 506261 1000000 709 458093 756416 909128 1000000 744296 101909 999929 40713 1000000 401387 777465 303158 1000000 824942 95067 334803 189227 961683 927101 1000000 521345 471497 138677 105153 16937 278973 791919 1000000 1000000 1000000 635532 890718 587856 1000000 828974 718050 717267 512148 461125 833767 1000000 150790 724823 185288 763197 605037 1000000 905815 491386 999991 1000000 237425 1000000 420748 610278 938658 21086 907470 100728 999999 47189 829392 331464 704204 275477 143143 93332 56404 530332 149455 80253 1000000 240549 908611 301264 507513 159026 878235 1000000 524229 975925 578981 815290 221671 631879 1000000 164442 443857 854010 999841 1000000 289212 603322 141176 1000000 999027 1000000 89494 295064 1000000 408190 717283 64958 437201 1000000 1000000 153080 973073 370868 73435 587667 239748 793135 1000000 780460 1000000 294071 161023 348854 1000000 5714 358808 1000000 150048 496531 930747 333256 668675 809595 528736 1000000 209221 5994 1000000 682284 379583 1000000 92752 822245 740345 1000000 40400 104928 461871 459327\n", "output": "302693496\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "489 438230204\n1000000 979846 802671 1000000 963362 731891 914541 695316 894459 186405 753695 426857 1000000 986795 804167 1000000 1000000 776976 987484 467461 989189 29386 999814 999919 1000000 972990 766713 486173 500530 330569 461708 1000000 999999 854695 874560 406535 174849 814890 993754 892224 812146 939085 793833 156395 546199 678083 1000000 936863 1000000 21171 785435 1000000 580 907852 943283 186260 616134 851724 144998 1000000 691605 618965 888345 939289 498660 370755 1000000 977870 818220 861332 1000000 768516 483477 943669 1000000 978200 742438 459335 514007 35811 660399 999942 476322 870545 1000000 916818 358540 750558 831730 838868 601840 48859 640994 984166 268463 938972 993552 1000000 762091 901126 1000000 815686 691026 451751 998019 976593 1000000 1000000 901884 9364 999630 1000000 1000000 999518 95954 1000000 468906 999814 909913 998439 1000000 310026 1000000 931297 997104 901984 600596 928763 726423 539985 654739 156097 608268 972097 950275 486752 816453 991935 1000000 880958 1000000 334787 228631 2469 953778 165084 1000000 898484 221645 657436 912236 955965 1000000 993242 263666 1000000 589493 527569 487141 969339 1000000 596530 1000000 302834 228121 578103 876196 890859 451695 711995 828149 726300 839420 1000000 999027 526236 980459 588913 1000000 996088 880771 999377 81700 1000000 893477 962909 736738 1000000 728571 985064 1000000 999538 999988 928601 117685 276623 406655 220382 981323 997809 1000000 695144 740317 852814 952649 865499 1000000 158538 963451 1000000 975593 276745 819818 1000000 1000000 964166 799422 440286 846094 541635 1000000 675560 512779 999421 751121 847088 988576 841341 1000000 1000000 911739 703671 380121 1000000 69509 375821 996119 865267 998988 979522 986381 1000000 592763 830788 947719 995965 609952 853386 96115 790402 1000000 1000000 65395 403470 836494 970622 482492 1000000 753756 414834 548 138957 674632 17482 122301 92960 406046 367569 808226 334780 986831 677868 756797 868918 885654 666236 1000000 477323 755384 741818 1000000 746058 880278 383011 813986 694564 999921 708978 106940 1000000 1000000 995662 999987 902410 929336 230535 1000000 543816 238008 1000000 782249 909965 45641 154715 992175 999903 1000000 986055 362421 386218 802995 885401 670179 14120 881748 722271 903370 841446 649516 851097 767946 852517 518012 823915 683412 247275 8753 962326 951493 798903 999979 1000000 1000000 73285 977696 1000000 665663 445130 994351 873112 619844 293697 498516 946459 577043 157829 923560 961499 99066 960070 401879 878930 1000000 913805 1000000 999556 972532 926706 947363 641699 1000000 962292 622374 1000000 913255 119267 400473 630811 873550 648020 785809 1000000 464566 1000000 958648 671648 791963 1000000 749483 349367 171271 1000000 925481 939019 971720 999840 307904 1000000 767033 548271 395798 311114 939874 914713 989164 65153 796726 1000000 993495 973612 178334 976614 44482 726026 593139 986479 987296 933029 999996 79457 761955 973489 751723 559021 541378 1000000 134528 914894 998221 734438 710251 901926 937732 1000000 1000000 1000000 637134 385161 1000000 469210 757421 619986 788095 708289 748946 170274 256014 966845 1000000 965528 220191 884448 904562 602433 801060 234846 796242 697864 358440 795396 752844 826 108284 92017 670773 664089 1000000 1242 1000000 908621 967176 474430 1000000 771629 895665 995753 977650 919875 473666 746046 824142 982015 203900 836953 787043 723572 984324 761659 462686 989592 48366 887690 1000000 155787 844018 1000000 850080 864117 698767\n", "output": "356972371\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "499 509697025\n1000000 998133 1000000 992299 961842 996213 902175 962505 1000000 1000000 999958 1000000 995201 740917 1000000 995226 995044 830418 545751 952422 987644 802619 954193 837017 1000000 978776 972637 999495 985252 998458 632750 1000000 996107 973566 907077 999934 977307 966908 999816 847561 987591 999439 849148 991691 999549 877281 972573 994565 1000000 968847 997458 1000000 998184 999718 1000000 994108 971126 998700 988397 990096 998298 1000000 757212 976384 982113 560206 957054 987957 971314 1000000 961742 1000000 991273 995625 1000000 987583 1000000 998551 973433 1000000 794939 999167 934531 994896 851291 726113 992771 996633 999583 1000000 987596 991342 1000000 942667 999462 999564 970129 991424 1000000 919172 1000000 968979 993444 1000000 983894 999289 999457 884824 759222 963971 997130 998752 999355 999431 999148 1000000 982499 999997 991025 961722 990266 765587 991971 984479 996935 998976 1000000 860286 1000000 994887 997175 999990 999951 768830 843178 674739 984286 998881 999435 982494 995791 776395 984676 913473 980068 741778 1000000 757304 999999 986843 998088 976043 938037 703160 998081 927377 833753 945532 961921 976573 997290 999978 976672 1000000 1000000 822193 1000000 929333 1000000 995883 997776 995597 977929 893752 952163 999990 998079 998914 978537 961610 1000000 998026 999999 961686 1000000 989586 990745 1000000 964820 999852 991534 998811 1000000 998717 999026 1000000 971092 906664 651727 1000000 999982 934294 990543 999994 990475 1000000 999863 999998 997381 951207 999406 925143 999938 997269 964596 999917 1000000 999999 974440 996541 999651 983336 1000000 999967 999498 981597 998255 1000000 999881 831656 1000000 999997 974197 919727 995026 996315 999597 1000000 955606 985692 892558 982223 993427 1000000 687634 800457 1000000 996981 978194 754704 994009 991904 769033 996917 972555 933764 977804 974570 999999 845107 996299 911648 962666 709480 895326 999967 1000000 996191 999924 986594 1000000 999276 1000000 962897 999999 991217 1000000 956914 1000000 999219 999959 823629 991177 974857 997708 1000000 988519 926612 999010 997482 996325 999723 982056 936409 999982 928615 713899 978007 995694 1000000 1000000 999004 1000000 1000000 999806 884176 990023 980712 998852 730114 1000000 996114 833841 1000000 992273 1000000 933099 1000000 928785 998456 794690 999848 986159 1000000 1000000 825600 962775 671464 943116 1000000 923195 622268 1000000 937329 977695 999999 1000000 999569 985968 984947 1000000 988946 1000000 991527 1000000 999116 999568 780113 871195 999885 955414 999867 881906 984998 995003 999378 1000000 999988 952687 821761 893765 993271 989182 951068 997960 967763 968856 975851 999933 1000000 997711 1000000 997044 999890 975127 995515 657641 999977 994676 999718 998419 945548 994661 999935 912419 975997 873153 891168 952023 999287 949777 976297 1000000 934788 984067 906583 989876 997729 985035 1000000 955548 978411 842134 980392 995045 1000000 999892 998716 822603 890066 872842 999997 857020 1000000 999202 981561 784490 977015 999999 1000000 997424 1000000 999278 973872 943537 418816 1000000 995924 824095 1000000 921276 1000000 995288 924147 991837 916436 1000000 976931 996681 999992 973830 840166 990905 986570 958147 600345 998740 555508 938364 828108 1000000 114561 999928 1000000 965469 993125 999516 993604 1000000 997272 921230 707268 938931 993620 1000000 857963 985841 932648 995804 999953 716729 978581 992684 671122 1000000 982243 999777 954434 998330 988810 925651 999972 995232 997690 1000000 982045 999739 905056 941290 993232 1000000 851138 948000 999114 998865 998743 997671 913749 999979\n", "output": "475871877\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "486 2541\n1000000 1000000 1000000 1000000 1000000 999044 1000000 1000000 1000000 1000000 1000000 1000000 999994 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999736 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 927324 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 979307 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999162 999950 1000000 1000000 562932 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999849 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 993188 1000000 1000000 1000000 999920 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 802661 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 994338 1000000 1000000 999819 1000000 1000000 1000000 253867 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483 3560\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "102\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "491 30616\n1000000 1000000 999971 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999988 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999936 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "369\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483 24675\n1000000 610645 1000000 1000000 1000000 370252 1000000 1000000 1000000 952219 1000000 1000000 1000000 5095 107814 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 521252 1000000 1000000 1000000 1000000 1000000 1000000 1000000 238942 1000000 1000000 1000000 1000000 1000000 1000000 1000000 992652 1000000 1000000 1000000 1000000 1000000 300600 558398 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 585880 1000000 531822 1000000 1000000 1000000 711210 1000000 411677 1000000 533742 1000000 1000000 1000000 999498 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 163986 1000000 1000000 1000000 1000000 1000000 600980 1000000 1000000 1000000 135900 1000000 1000000 999917 1000000 1000000 1000000 35938 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 380774 1000000 1000000 862512 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 31408 1000000 1000000 1000000 1000000 420988 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 407096 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 912412 1000000 1000000 1000000 1000000 1000000 999648 1000000 189356 1000000 1000000 1000000 1000000 1000000 1000000 1000000 687352 1000000 1000000 1000000 1000000 1000000 293544 1000000 739296 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 560211 1000000 1000000 1000000 1000000 999569 865663 768892 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 890760 1000000 1000000 1000000 1000000 1000000 1000000 997747 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 299282 1000000 1000000 104482 1000000 478972 438202 1000000 1000000 110834 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 997412 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 650206 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 255496 1000000 634094 1000000 302906 1000000 498959 28086 1000000 1000000 227406 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 698526 1000000 1000000 1000000 842580 55266 1000000 1000000 1000000 1000000 234050 951330 1000000 1000000 1000000 1000000 1000000 1000000 1000000 441322 1000000 708323 1000000 1000000 1000000 1000000 999999 705774 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 169737 999993 1000000 1000000 1000000 1000000 1000000 999720 1000000 1000000 1000000 1000000 1000000 1000000 363306 288712 1000000 1000000 1000000 1000000 1000000 480784 1000000 1000000 1000000 1000000 1000000 533030 1000000 999990 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 549338 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 928650 1000000 1000000 1000000 719968 1000000 1000000 1000000 1000000 1000000 1000000 997234 1000000 1000000 1000000 1000000\n", "output": "151\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "494 24885\n1000000 1000000 429312 1000000 1000000 1000000 1000000 1000000 290983 1000000 1000000 1000000 823680 1000000 1000000 1000000 1000000 1000000 1000000 999234 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 282880 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 892320 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 585232 947714 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 661024 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 877194 1000000 1000000 381861 1000000 999999 1000000 1000000 1000000 1000000 383968 1000000 586977 1000000 1000000 1000000 1000000 1000000 1000000 601120 1000000 1000000 1000000 1000000 1000000 913120 1000000 1000000 1000000 794144 1000000 446368 1000000 1000000 1000000 424223 1000000 1000000 1000000 408928 1000000 11649 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 768352 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 175968 1000000 1000000 1000000 1000000 1000000 936832 1000000 1000000 1000000 1000000 448893 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 755872 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999935 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 306592 999473 1000000 561600 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 776181 1000000 1000000 1000000 116038 1000000 1000000 1000000 1000000 1000000 366080 999999 1000000 1000000 1000000 997782 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 352362 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999980 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 994842 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 195520 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 363168 1000000 220896 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 649792 1000000 1000000 1000000 1000000 1000000 989515 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 149760 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 172224 1000000 1000000 1000000 245119 1000000 739459 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "520\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "480 20951\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 340839 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 570650 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 173495 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 301151 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 250295 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999853 1000000 1000000 1000000 892713 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 333139 1000000 1000000 1000000 1000000 1000000 1000000 134021 1000000 1000000 1000000 1000000 313129 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 546844 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 697210 999167 1000000 999534 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999718 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 48025 1000000 1000000 1000000 1000000 1000000 1000000 1000000 981319 770847 1000000 1000000 1000000 1000000 1000000 73597 1000000 397522 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 552293 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996830 175770 1000000 1000000 384201 737115 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 280241 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999343 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 364529 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 497448 1000000 643005 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "565\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "492 28095\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999964 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999943 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999959 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999804 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999982 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000\n", "output": "85\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484 86498\n1000000 1000000 1000000 1000000 999644 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 169548 380195 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 349821 1000000 326054 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 658876 1000000 1000000 1000000 1000000 1000000 975450 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 601298 1000000 1000000 1000000 1000000 1000000 501148 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 897637 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 440154 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996774 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999983 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 83686 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 769901 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 408081 1000000 1000000 1000000 764716 1000000 1000000 411399 1000000 1000000 1000000 1000000 1000000 208963 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 741754 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 712134 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999966 1000000 1000000 1000000 1000000 1000000 329215 1000000 1000000 342447 1000000 1000000 1000000\n", "output": "1653\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "490 94215\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 565056 1000000 1000000 669667 1000000 892517 1000000 1000000 1000000 619512 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999241 1000000 1000000 806976 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 989280 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 22464 1000000 1000000 1000000 1000000 1000000 1000000 1000000 995085 1000000 1000000 1000000 1000000 965952 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 30630 775008 1000000 1000000 1000000 1000000 1000000 1000000 1000000 515808 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 469040 1000000 1000000 263541 1000000 1000000 1000000 1000000 720576 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 705896 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 771552 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 875797 1000000 1000000 1000000 1000000 1000000 946090 1000000 271296 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 394848 1000000 710244 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 726903 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 840672 1000000 1000000 1000000 1000000 292032 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999915 1000000 1000000 88128 1000000 552960 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 228960 1000000 1000000 448416 1000000 1000000 1000000 1000000 875235 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 740448 1000000 1000000 1000000 1000000 59616 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 550368 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 939807 827712 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 416448 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999987 1000000 678240 1000000 1000000 1000000 1000000 436347 539136 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 124416 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998130 522445 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 452485 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 946664\n", "output": "864\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "496 100858\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 997095 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 880270 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 378989 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 338597 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 702293 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 35864 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 709929 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999997 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 788060 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 954656 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 985535 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999978 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999966 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 986908 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999897 1000000 1000000 980010 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999994 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 734125 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "451\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483 127593\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999805 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998958 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999968 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999665 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999785 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 997667 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1061\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "489 139003\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998032 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999959 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999769 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 999823 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999541 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "2062\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "495 2528\n1000000 1000000 1000000 1000000 1000000 1000000 999985 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999250 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999979 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999993 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999969 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999975 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 972650 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "409\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "496 35492\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999907 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999972 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999883 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999980 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1309\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "492 175243\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 349446 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 327140 1000000 1000000 1000000 1000000 1000000 1000000 275095 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 41636 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 465836 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 801349 1000000 1000000 1000000 1000000 1000000 1000000 1000000 179927 1000000 920453 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 811498 1000000 199279 1000000 999981 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 967598 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 49071 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 242389 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 359856 1000000 1000000 1000000 1000000 714513 1000000 1000000 1000000 1000000 1000000 646018 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 757181 1000000 1000000 1000000 1000000 1000000 1000000 791084 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 336062 1000000 1000000 1000000 1000000 1000000 979915 1000000 1000000 1000000 1000000 1000000 746475 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 984669 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 52045 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 989427 999996 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 516151 1000000 395520 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 895898 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 993965 1000000 1000000 1000000\n", "output": "1487\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "493 194563\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999973 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999976 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999527 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999972 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999624 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999515 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "793\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "487 187240\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999538 1000000 999989 1000000 1000000 1000000 999959 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999983 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1635\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "498 191707\n1000000 271596 6990 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999973 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 172436 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 238519 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999853 865277 1000000 31647 1000000 1000000 1000000 1000000 1000000 468329 1000000 283783 964514 1000000 1000000 1000000 1000000 1000000 993228 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 41784 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 788767 1000000 998679 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998600 1000000 1000000 893133 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 200866 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 139724 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 511857 1000000 1000000 1000000 1000000 41976 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 781508 1000000 207179 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 119481 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 278460 1000000 229824 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 652974 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999893 1000000 1000000 1000000 1000000 1000000 999334 1000000 552578 1000000 1000000 1000000 1000000 1000000 1000000 1000000 904178 1000000 1000000 1000000 1000000 50642 1000000 1000000 673295 1000000 1000000 1000000 1000000 1000000 1000000 1000000 421322 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 396949 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 537973 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 666832 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 243740 1000000 285524 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 348200 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 853249 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999997 1000000 1000000 1000000 569307 1000000 1000000 1000000 1000000 829479 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 927953 1000000\n", "output": "1741\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "483 113423\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999241 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999603 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998832 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999957 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "911\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "488 221246\n1000000 1000000 963443 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 934151 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 149734 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999413 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999420 973254 1000000 1000000 1000000 1000000 999888 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 396232 978781 1000000 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 357550 1000000 1000000 1000000 939711 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 992922 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 265369 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 579284 1000000 1000000 991024 999160 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 965629 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 255909 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 527126 1000000 1000000 1000000 1000000 999379 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 293005 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999891 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 150048 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "2785\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 65\n1000000 547584 203912 1000000 1000000 491308 706966 728966 913530 1000000 1000000 1000000 1000000 144647 1000000 1000000 71928 1000000 627720 1000000 881139 1000000 171793 683770 744177 1000000 824491 60212 56760 1000000 866488 1000000 780170 1000000 69401 1000000 1000000 154124 1000000 592813 373477 1000000 323628 222735 999978 608998 1000000 221319 796461 1000000 1000000 7062 1000000 39116 673733 1000000 1000000 17922 976507 963346 1000000 953879 1000000 719519 626330 1000000 1000000 514422 1000000 1000000 411581 1000000 1000000 1000000 1000000 1000000 985922 1000000 508791 911311 1000000 586233 682983 1000000 619179 1000000 951248 421600 723824 1000000 1000000 444970 1000000 190729 1000000 1000000 1000000 62434 1000000 1000000 580332 1000000 904497 291759 431810 21887 47349 509345 357217 1000000 721940 125922 459997 1000000 507613 1000000 1000000 1000000 1000000 969700 1000000 1000000 1000000 801695 1000000 1000000 82259 1000000 1000000 187644 258735 1000000 448374 1000000 832832 23415 1000000 576268 1000000 1000000 1000000 1000000 1000000 276663 1000000 181458 1000000 1000000 1000000 1000000 651261 612788 1000000 136532 1000000 1000000 1000000 125740 1000000 1000000 12836 1000000 787407 806692 1000000 781625 1000000 971756 1000000 816077 1000000 1000000 712412 193947 198230 847618 1000000 1000000 373325 595793 389836 5966 287291 537826 1000000 1000000 1000000 1000000 1000000 830670 772633 1000000 1000000 324320 1000000 303871 1000000 988936 1000000 1000000 1000000 62182 1000000 157045 1000000 867827 1000000 579598 920852 152508 270412 1000000 228493 1000000 1000000 1000000 1000000 154434 372084 1000000 1000000 278884 1000000 989775 424395 237914 1000000 1000000 713996 807572 372498 1000000 428466 758599 964687 947242 1000000 281450 1000000 489175 563335 1000000 369663 1000000 16828 424851 1000000 1000000 83715 559395 1000000 819601 506853 601908 119658 685661 162883 1000000 1000000 104589 449546 114581 1000000 1000000 1000000 1000000 1000000 1000000 1000000 436645 1000000 416744 167260 962435 262453 845365 1000000 260058 561571 52837 999997 785281 211703 537297 983256 278290 317530 1000000 745152 1000000 1000000 1000000 734270 1000000 910623 179265 1000000 258475 445387 963359 942020 123164 503203 329102 1000000 1000000 477574 1000000 442841 787946 1000000 681603 230591 847714 1000000 116590 705318 1000000 1000000 1000000 1000000 91402 1000000 1000000 1000000 1000000 1000000 1000000 226513 737158 1000000 1000000 17614 529162 553943 468231 1000000 805170 1000000 25879 849012 817483 576371 943647 419589 765323 397460 1000000 1000000 1000000 867830 1000000 1000000 1000000 1000000 1000000 727686 299818 925899 1000000 1000000 1000000 402944 653707 216287 1000000 1000000 904663 663944 999418 369363 1000000 1000000 723970 1000000 1000000 472495 1000000 1000000 722256 1000000 196426 1000000 234037 861603 753040 1000000 1000000 1000000 1000000 1000000 990020 1000000 1000000 1000000 285685 1000000 269229 313122 444394 1000000 22138 999895 380541 1000000 58445 441854 1000000 379443 699780 1000000 943042 1000000 1000000 939114 652472 366138 837802 937941 863958 929910 274655 845326 1000000 534752 137050 1000000 17466 1000000 1000000 261983 943722 797002 1000000 814217 1000000 241315 1000000 343300 1000000 591619 814263 717912 56161 1000000 1000000 258571 279026 928599 999999 1000000 858939 725504 1000000 447775 878032 967038 1000000 994827 1000000 969295 1000000 1000000 182802 365562 1000000 349512 145610 1000000 287574 1000000 1000000 125615 473421 1000000 1000000 1000000 1000000 1000000 1000000 10587 1000000 1000000 36202 1000000 1000000 866860 993015 1000000 1000000 1000000 247756 265297 1000000 485083 687029 126609 452451 197337 524955\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 114\n94191 278785 306413 546153 682696 1000000 1000000 1000000 915040 584376 1000000 58887 1000000 258907 290027 421888 560617 430379 552788 534231 1000000 542138 335665 761304 46920 27599 910116 974234 957824 724020 668254 408450 87209 257751 144698 999917 939718 1000000 70019 1000000 933012 847648 551977 616629 202375 421623 754450 929695 464355 920817 1000000 25305 7723 710555 693973 981253 1000000 1000000 64675 888340 523675 557755 761890 333307 253706 203171 846024 498427 1000000 1000000 103207 547641 799254 671192 178164 1000000 797634 347501 511419 799903 511811 936984 519176 135767 772750 710177 170003 556591 38065 1000000 309015 194755 575367 503669 1000000 262052 649089 442384 993865 37706 644010 263039 92769 1000000 104851 1000000 487294 48861 429172 909718 753551 467077 639564 713065 1000000 913326 1000000 1000000 580899 392727 1000000 751446 386447 589110 1000000 595240 818349 625821 89923 877200 134258 625481 115972 315901 449396 830952 549061 775635 6371 1000000 559237 549605 596982 549273 389685 515472 1000000 1000000 282119 990155 29618 515073 732180 825775 610157 1000000 123515 872221 498836 142389 1000000 10145 54921 475879 53590 881921 763022 373445 1000000 165536 731396 705062 154768 754944 827487 1000000 540433 384089 436856 271947 745161 691824 254525 284092 539756 561415 547043 877274 362895 508107 856681 1000000 1000000 632308 787373 809592 781372 164948 661876 589198 527967 917094 116443 834527 903255 27055 999961 1000000 14120 878807 535638 440242 1000000 869182 576495 702675 632018 640321 117792 30813 1000000 613633 870469 241233 606826 782736 123075 192090 351683 1000000 527832 630334 508285 119750 158024 333939 311792 324758 341366 340965 215239 226290 1000000 504040 490679 67592 76601 420333 330338 162426 685771 1000000 581741 749018 62917 562199 434752 975373 562159 885880 467386 834687 153729 1000000 792238 441896 500965 484925 169255 1000000 1000000 501573 729377 927081 559886 825546 389532 1000000 53944 663609 517225 397206 326632 629073 854106 978051 568470 98489 136695 143696 58045 191739 164495 107280 816318 657763 375925 670337 1000000 1000000 954566 176690 442378 866005 786591 999998 1000000 1000000 515501 207857 11764 1000000 307662 1000000 580257 658624 681582 717195 184153 542581 129773 298939 197392 1000000 297680 475886 469792 999670 671054 1000000 999887 2196 921620 500437 1000000 725460 508629 840242 327433 1000000 1000000 1000000 241046 31111 587096 962550 224379 999578 706952 20349 810182 1000000 1000000 494842 220090 73654 911511 999968 332695 389789 456389 896306 328063 747334 617049 1000000 189951 747355 581148 568280 1000000 190159 392921 1000000 80168 759258 223661 269017 492622 65851 986264 265261 378748 817213 878217 230640 720107 369479 829136 230281 817743 806711 876491 750445 988970 646390 275820 541007 269166 870346 874128 49972 1000000 532569 505676 1000000 165688 1000000 224618 379623 661840 422617 113106 409501 880430 399377 975141 1000000 209009 408253 719833 1000000 501070 1000000 664496 908274 50764 1000000 1000000 680544 626741 1000000 268951 12683 1000000 705726 406807 192766 432309 1000000 1000000 611031 335621 216135 1000000 567660 996718 136261 614459 563410 1000000 474113 749038 1000000 302125 449744 999258 459225 1000000 628168 464214 190913 1000000 462111 73983 30827 586106 906130 607342 694242 857035 86099 947154 994338 185629 1000000 794361 341031 292086 557582 851555 965697 576877 522723 1000000 572338 1000000 928325 501293 413788 625351 833691 584241 356482 502553 358366 982475 1000000 1000000 1000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 7\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 987093 1000000 1000000 1000000 1000000 1000000 618689 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999998 1000000 1000000 1000000 1000000 1000000 999742 193383 1000000 102479 1000000 1000000 1000000 1000000 1000000 1000000 951770 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 998623 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999905 1000000 1000000 1000000 1000000 1000000 1000000 1000000 454258 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999940 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 299136 1000000 1000000 999868 374010 999895 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 826630 1000000 1000000 999998 1000000 1000000 999995 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 285163 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 229040 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 996724 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 997050 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 961884 1000000 1000000 1000000 1000000 886198 1000000 1000000 1000000 1000000 1000000 520634 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 734988 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999992 1000000 700965 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 251140 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 999854 1000000 1000000 1000000 674145 1000000 1000000 1000000 1000000 965398 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 214906 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 378695 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 552981 1000000 934433 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 62\n631644 725400 1000000 1000000 343921 1000000 1000000 244478 1000000 981049 170802 117263 1000000 1000000 584142 1000000 673789 855889 662182 385439 1000000 146597 970806 1000000 849303 1000000 821160 354213 1000000 620882 80988 233311 758094 1000000 887108 1000000 206409 1000000 374926 1000000 663710 1000000 1000000 1000000 1000000 702611 1000000 981250 1000000 1000000 300026 1000000 927564 1000000 306386 349512 1000000 346223 1000000 901520 302869 998687 1000000 702542 147186 1000000 1000000 1000000 1000000 191681 1000000 1000000 428652 946342 1000000 1000000 278287 982561 205717 720679 940917 61313 1000000 949909 1000000 64736 1000000 766787 69104 317017 251038 1000000 587244 1000000 1000000 1000000 1000000 751984 1000000 1000000 1000000 1000000 713525 866001 281305 676259 106149 501642 1000000 1000000 742788 939334 1000000 979063 348746 1000000 981860 734376 1000000 1000000 607279 1000000 614358 998328 1000000 97352 1000000 1000000 1000000 1000000 1000000 708526 1000000 1000000 1000000 117715 975113 794312 204751 800514 1000000 715254 1000000 597346 1000000 852597 1000000 438254 627112 1000000 927512 1000000 432833 1000000 327453 939426 1000000 609361 822528 1000000 207891 819006 322012 1000000 88115 514102 1000000 1000000 336085 608044 551950 379018 1000000 891461 256128 175657 685286 229446 57395 1000000 846693 1000000 837110 1000000 793583 525988 1000000 1000000 669448 1000000 1000000 18545 386824 83166 738972 1000000 1000000 438947 537926 767737 416245 487615 1000000 34590 1000000 336545 971338 436388 1000000 263745 1000000 1000000 622969 1000000 586402 247266 1000000 567371 1000000 1000000 1000000 1000000 1000000 838798 1000000 898837 1000000 907323 1000000 1000000 1000000 458238 1000000 1000000 1000000 335995 1000000 1000000 64878 322018 1000000 1000000 1000000 1000000 822909 999999 619288 534380 861775 460071 374487 1000000 999902 1000000 793991 1000000 252250 1000000 1000000 291872 88337 332590 326167 524029 1000000 351582 587142 1000000 266258 1000000 677291 998574 370081 820980 603369 1000000 1000000 891806 878142 313031 1000000 1000000 418236 1000000 1000000 973356 1000000 488903 1000000 337597 1000000 1000000 1000000 517254 1000000 1000000 1000000 173517 1000000 853079 780081 575852 235736 122062 368045 224359 808908 1000000 777321 104901 779589 581356 854942 1000000 805507 979038 499830 1000000 100342 420308 497195 244068 562463 158886 998866 1000000 1000000 475534 184829 329219 692926 1000000 1000000 328451 945698 560159 1000000 1000000 1000000 119937 554424 1000000 459614 306808 928036 187071 1000000 258682 791270 650586 470776 132003 1000000 1000000 121600 142899 663220 637 1000000 883895 965496 213147 513221 416963 282400 1000000 938370 638810 861976 1000000 1000000 325625 1000000 516505 1000000 1000000 912284 301999 809759 778065 1000000 1000000 686270 957271 1000000 1000000 746267 1000000 712232 1000000 1000000 1000000 929578 735909 1000000 454896 1000000 1000000 1000000 1000000 1000000 255225 992370 1000000 1000000 650172 1000000 1000000 1000000 1000000 271226 1000000 528928 1000000 1000000 85031 1000000 97710 1000000 382633 36448 1000000 638516 684015 417478 969604 1000000 201566 999999 104318 1000000 422045 599566 752841 1000000 783057 978854 717060 1000000 136705 1000000 1000000 1000000 1000000 999998 72624 440869 862724 934742 1000000 215737 820322 4440 1000000 1000000 59593 208369 213124 979068 828294 266470 1000000 1000000 1000000 949922 348525 827492 889690 1000000 1000000 515711 595072 45486 1000000 536192 574501 7490 1000000 788141 1000000 1000000 1000000 1000000 394593 549211 426988 1000000 26191 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 110612 955500 781008\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 55\n1000000 334540 891625 1000000 281442 1000000 1000000 1000000 463382 280097 1000000 1000000 452139 815770 1000000 1000000 1000000 631989 996270 1000000 1000000 1000000 1000000 1000000 1000000 795828 1000000 1000000 1000000 1000000 962606 928241 698713 883552 1000000 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 776645 917772 1000000 993836 1000000 677572 1000000 1000000 1000000 959463 1000000 174912 782573 236619 1000000 891134 423283 446152 1000000 1000000 1000000 547885 1000000 1000000 996419 1000000 1000000 880057 1000000 1000000 881930 1000000 683875 943968 634002 1000000 1000000 1000000 872307 972441 1000000 1000000 975926 1000000 1000000 1000000 1000000 508617 1000000 1000000 650957 1000000 987315 1000000 1000000 1000000 1000000 1000000 1000000 1000000 819218 106024 1000000 474460 977399 1000000 358603 1000000 368660 1000000 743935 1000000 967215 1000000 1000000 655987 1000000 1000000 1000000 713729 1000000 1000000 363671 1000000 864219 1000000 1000000 1000000 254539 1000000 1000000 456973 912268 286259 1000000 1000000 997857 1000000 1000000 316561 1000000 1000000 1000000 995992 254531 1000000 1000000 570664 353003 685983 545993 1000000 1000000 1000000 1000000 716848 1000000 733488 555799 666361 527750 1000000 965372 1000000 1000000 1000000 878630 1000000 138000 1000000 1000000 909705 872583 709545 1000000 700668 1000000 1000000 813739 932934 1000000 964327 1000000 693475 1000000 1000000 797296 1000000 764480 985204 1000000 1000000 1000000 1000000 1000000 1000000 1000000 535462 476079 984367 1000000 967654 856275 1000000 1000000 1000000 1000000 1000000 1000000 867952 879942 1000000 154407 1000000 1000000 911749 1000000 993559 555758 558804 1000000 1000000 973939 1000000 1000000 1000000 685565 1000000 1000000 760700 609879 501796 842928 1000000 1000000 1000000 615818 1000000 984958 993760 912636 911254 978741 1000000 1000000 961351 1000000 829953 1000000 887629 975436 638855 1000000 1000000 942628 995881 1000000 780088 1000000 420106 1000000 1000000 660756 530127 1000000 1000000 163418 815463 886126 684287 1000000 1000000 955622 1000000 982895 1000000 912574 1000000 866208 1000000 948902 195050 1000000 1000000 941585 404226 1000000 721447 1000000 1000000 1000000 999814 920770 1000000 800099 1000000 1000000 1000000 968501 1000000 996652 968157 917097 1000000 806353 1000000 516982 1000000 1000000 868946 290092 1000000 857874 940045 395165 1000000 1000000 355186 1000000 1000000 1000000 1000000 685630 932351 1000000 1000000 1000000 1000000 1000000 221542 910433 714135 1000000 250408 880260 1000000 1000000 1000000 1000000 919358 495872 687096 1000000 905777 999094 936461 995177 1000000 1000000 1000000 872999 1000000 837544 1000000 838134 880058 1000000 395271 999187 923355 1000000 543459 980298 1000000 480711 1000000 1000000 1000000 1000000 979331 92282 984480 1000000 779663 1000000 1000000 1000000 689599 1000000 338444 1000000 1000000 476308 798177 1000000 542177 1000000 996188 999152 963781 999993 710941 1000000 1000000 843994 1000000 387062 1000000 1000000 160681 1000000 1000000 1000000 1000000 157509 993434 1000000 1000000 1000000 988046 1000000 991580 675549 956441 644135 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 974441 935008 932845 1000000 1000000 489120 1000000 1000000 482596 858537 161521 1000000 1000000 940690 1000000 1000000 1000000 707102 1000000 1000000 1000000 1000000 1000000 1000000 763746 868334 746818 1000000 1000000 844243 1000000 1000000 1000000 1000000 885510 919665 1000000 992051 1000000 1000000 1000000 1000000 854150 672202 984101 1000000 999914 1000000 206729 979213 1000000 1000000 644524 1000000 1000000 1000000 881814 1000000 1000000 667605 1000000 1000000 1000000 999034 1000000 816945 1000000 632692 987805 1000000\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
161
Solve the following coding problem using the programming language python: Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat. Assume that we have a cat with a number $x$. A perfect longcat is a cat with a number equal $2^m - 1$ for some non-negative integer $m$. For example, the numbers $0$, $1$, $3$, $7$, $15$ and so on are suitable for the perfect longcats. In the Cat Furrier Transform, the following operations can be performed on $x$: (Operation A): you select any non-negative integer $n$ and replace $x$ with $x \oplus (2^n - 1)$, with $\oplus$ being a bitwise XOR operator. (Operation B): replace $x$ with $x + 1$. The first applied operation must be of type A, the second of type B, the third of type A again, and so on. Formally, if we number operations from one in the order they are executed, then odd-numbered operations must be of type A and the even-numbered operations must be of type B. Neko wants to produce perfect longcats at industrial scale, thus for each cat Neko only wants to perform at most $40$ operations. Can you help Neko writing a transformation plan? Note that it is not required to minimize the number of operations. You just need to use no more than $40$ operations. -----Input----- The only line contains a single integer $x$ ($1 \le x \le 10^6$). -----Output----- The first line should contain a single integer $t$ ($0 \le t \le 40$) — the number of operations to apply. Then for each odd-numbered operation print the corresponding number $n_i$ in it. That is, print $\lceil \frac{t}{2} \rceil$ integers $n_i$ ($0 \le n_i \le 30$), denoting the replacement $x$ with $x \oplus (2^{n_i} - 1)$ in the corresponding step. If there are multiple possible answers, you can print any of them. It is possible to show, that there is at least one answer in the constraints of this problem. -----Examples----- Input 39 Output 4 5 3 Input 1 Output 0 Input 7 Output 0 -----Note----- In the first test, one of the transforms might be as follows: $39 \to 56 \to 57 \to 62 \to 63$. Or more precisely: Pick $n = 5$. $x$ is transformed into $39 \oplus 31$, or $56$. Increase $x$ by $1$, changing its value to $57$. Pick $n = 3$. $x$ is transformed into $57 \oplus 7$, or $62$. Increase $x$ by $1$, changing its value to $63 = 2^6 - 1$. In the second and third test, the number already satisfies the goal requirement. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def main(): x = int(input()) n = x.bit_length() t = 0 ans = [] while True: if (x + 1) & (x) == 0: break if t & 1: x += 1 else: for i in range(n - 1, -1, -1): if not (1 << i) & x: ans.append(i + 1) x ^= (1 << (i + 1)) - 1 break t += 1 print(t) print(*ans) return 0 main() ```
vfc_10398
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1152/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "39\n", "output": "4\n5 3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000\n", "output": "7\n14 6 9 15 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524288\n", "output": "1\n19 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524289\n", "output": "2\n19 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524287\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "699050\n", "output": "19\n1 2 4 6 8 10 12 14 16 18 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "349525\n", "output": "19\n0 1 3 5 7 9 11 13 15 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "1\n1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "2\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "1\n1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n", "output": "3\n0 2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n", "output": "2\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "545860\n", "output": "11\n19 2 6 10 12 14 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "917503\n", "output": "3\n0 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "174762\n", "output": "17\n1 2 4 6 8 10 12 14 16 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "43690\n", "output": "15\n1 2 4 6 8 10 12 14 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "10922\n", "output": "13\n1 2 4 6 8 10 12 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2730\n", "output": "11\n1 2 4 6 8 10 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "682\n", "output": "9\n1 2 4 6 8 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "170\n", "output": "7\n1 2 4 6 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n", "output": "5\n1 2 4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "87381\n", "output": "17\n0 1 3 5 7 9 11 13 15 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "21845\n", "output": "15\n0 1 3 5 7 9 11 13 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "5461\n", "output": "13\n0 1 3 5 7 9 11 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "1365\n", "output": "11\n0 1 3 5 7 9 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "341\n", "output": "9\n0 1 3 5 7 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "85\n", "output": "7\n0 1 3 5 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n", "output": "5\n0 1 3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "1\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "1\n3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "2\n3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "3\n1 2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n", "output": "1\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n", "output": "1\n1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n", "output": "1\n4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n", "output": "2\n4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n", "output": "3\n4 1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n", "output": "4\n2 4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n", "output": "3\n2 3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n", "output": "3\n1 3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n", "output": "3\n0 3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n", "output": "1\n3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "25\n", "output": "2\n3 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\n", "output": "3\n1 2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "27\n", "output": "3\n0 2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n", "output": "1\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "29\n", "output": "2\n2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n", "output": "1\n1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "31\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32\n", "output": "1\n5 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "33\n", "output": "2\n5 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "34\n", "output": "3\n5 1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\n", "output": "4\n2 5 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "36\n", "output": "3\n5 2 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "98\n", "output": "3\n5 1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "130\n", "output": "3\n7 1 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "354\n", "output": "5\n5 1 7 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "949\n", "output": "7\n0 1 3 6 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "1557\n", "output": "7\n9 0 2 4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2677\n", "output": "11\n0 1 3 7 8 10 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "5845\n", "output": "11\n0 1 3 5 8 11 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "11061\n", "output": "13\n0 1 3 6 7 10 12 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "32661\n", "output": "7\n7 0 2 4 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "62453\n", "output": "9\n0 1 3 10 11 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "75861\n", "output": "13\n16 0 2 4 6 11 13 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "187573\n", "output": "15\n0 1 3 6 8 9 13 16 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "364821\n", "output": "13\n15 0 2 4 8 12 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524416\n", "output": "3\n19 7 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "540673\n", "output": "5\n19 0 14 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "794628\n", "output": "5\n18 2 13 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524641\n", "output": "9\n5 0 7 19 9 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "524636\n", "output": "9\n2 5 7 19 9 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "592548\n", "output": "13\n19 2 5 7 9 11 16 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "895360\n", "output": "11\n7 9 10 12 14 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "542413\n", "output": "15\n0 1 4 5 8 19 11 14 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "885114\n", "output": "11\n1 2 7 15 9 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "575965\n", "output": "15\n0 1 5 14 9 11 19 16 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "896794\n", "output": "13\n1 2 8 5 12 14 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "776441\n", "output": "11\n3 0 11 8 13 18 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "761841\n", "output": "9\n4 0 13 14 18 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "842719\n", "output": "11\n0 5 10 13 16 17 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "769527\n", "output": "9\n0 3 9 14 18 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "704511\n", "output": "7\n0 14 16 18 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "915455\n", "output": "5\n0 11 17 ", "type": "stdin_stdout" } ] }
apps
verifiable_code
162
Solve the following coding problem using the programming language python: Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly a_{i} each hour. Luba can't water any parts of the garden that were already watered, also she can't water the ground outside the garden. Luba has to choose one of the buckets in order to water the garden as fast as possible (as mentioned above, each hour she will water some continuous subsegment of length a_{i} if she chooses the i-th bucket). Help her to determine the minimum number of hours she has to spend watering the garden. It is guaranteed that Luba can always choose a bucket so it is possible water the garden. See the examples for better understanding. -----Input----- The first line of input contains two integer numbers n and k (1 ≤ n, k ≤ 100) — the number of buckets and the length of the garden, respectively. The second line of input contains n integer numbers a_{i} (1 ≤ a_{i} ≤ 100) — the length of the segment that can be watered by the i-th bucket in one hour. It is guaranteed that there is at least one bucket such that it is possible to water the garden in integer number of hours using only this bucket. -----Output----- Print one integer number — the minimum number of hours required to water the garden. -----Examples----- Input 3 6 2 3 5 Output 2 Input 6 7 1 2 3 4 5 6 Output 7 -----Note----- In the first test the best option is to choose the bucket that allows to water the segment of length 3. We can't choose the bucket that allows to water the segment of length 5 because then we can't water the whole garden. In the second test we can choose only the bucket that allows us to water the segment of length 1. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, k = map(int, input().split()) a = list(map(int, input().split())) maxd = -1 for x in a: if k % x == 0: maxd = max(maxd, x) print(k // maxd) ```
vfc_10402
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/915/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 6\n2 3 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7\n1 2 3 4 5 6\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 97\n1 10 50 97 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 97\n1 10 50 100 2\n", "output": "97\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n2 46 24 18 86 90 31 38 84 49 58 28 15 80 14 24 87 56 62 87 41 87 55 71 87 32 41 56 91 32 24 75 43 42 35 30 72 53 31 26 54 61 87 85 36 75 44 31 7 38 77 57 61 54 70 77 45 96 39 57 11 8 91 42 52 15 42 30 92 41 27 26 34 27 3 80 32 86 26 97 63 91 30 75 14 7 19 23 45 11 8 43 44 73 11 56 3 55 63 16\n", "output": "50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 91\n13 13 62 96 74 47 81 46 78 21 20 42 4 73 25 30 76 74 58 28 25 52 42 48 74 40 82 9 25 29 17 22 46 64 57 95 81 39 47 86 40 95 97 35 31 98 45 98 47 78 52 63 58 14 89 97 17 95 28 22 20 36 68 38 95 16 2 26 54 47 42 31 31 81 21 21 65 40 82 53 60 71 75 33 96 98 6 22 95 12 5 48 18 27 58 62 5 96 36 75\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 8\n8 7 6 5 4 3 2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n4 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n2 4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n1 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n3 2 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n4 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n2 3 5 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n5 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 12\n6 4 3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 18\n1 9 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 9\n3 2 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n5 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n5 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 18\n6 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 12\n1 2 12 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n3 2 1\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n3 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10\n5 4 3 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 16\n8 4 2 1 7\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7\n6 5 4 3 7 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n4 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 8\n2 4 1 3 5 7\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 8\n6 5 4 3 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 15\n5 2 3 6 4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 8\n2 4 8 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n5 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n3 1 1 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10\n2 10 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 12\n12 4 4 4 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n6 3 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 18\n1 9 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n7 2 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100\n99 1\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 12\n1 3 4 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n2 3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n3 2 5 12\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 97\n97 1 50 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12\n1 12 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 12\n1 4 3 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 19\n7 1 1\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 12\n12 4 3 4 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n8 4 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n3 2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n3 2 4 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 16\n8 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n10 2 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n2 4 5 3 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 99\n1 2 3 6 5 4 7 8 99 33 66\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12\n3 12 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 25\n24 5 15 25 23\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n8 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100\n2 50 4 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 28\n7 14 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 8\n2 8 4 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n6 1 2 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 12\n4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 12\n1 2 4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 12\n2 3 12 6 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 2 2 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n2 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 21\n21 20 21 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n3 4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 25\n25\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 12\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98 12\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79 12\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 32\n1 1 1 1\n", "output": "32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n1\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100\n7 1\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 24\n1 3 6 4 5 2 7\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 87\n1 2 8 4 5 7\n", "output": "87\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 88\n1\n", "output": "88\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 89\n1\n", "output": "89\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
163
Solve the following coding problem using the programming language python: On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopper to one of the empty cells and a small insect in another empty cell. The grasshopper wants to eat the insect. Ostap knows that grasshopper is able to jump to any empty cell that is exactly k cells away from the current (to the left or to the right). Note that it doesn't matter whether intermediate cells are empty or not as the grasshopper makes a jump over them. For example, if k = 1 the grasshopper can jump to a neighboring cell only, and if k = 2 the grasshopper can jump over a single cell. Your goal is to determine whether there is a sequence of jumps such that grasshopper will get from his initial position to the cell with an insect. -----Input----- The first line of the input contains two integers n and k (2 ≤ n ≤ 100, 1 ≤ k ≤ n - 1) — the number of cells in the line and the length of one grasshopper's jump. The second line contains a string of length n consisting of characters '.', '#', 'G' and 'T'. Character '.' means that the corresponding cell is empty, character '#' means that the corresponding cell contains an obstacle and grasshopper can't jump there. Character 'G' means that the grasshopper starts at this position and, finally, 'T' means that the target insect is located at this cell. It's guaranteed that characters 'G' and 'T' appear in this line exactly once. -----Output----- If there exists a sequence of jumps (each jump of length k), such that the grasshopper can get from his initial position to the cell with the insect, print "YES" (without quotes) in the only line of the input. Otherwise, print "NO" (without quotes). -----Examples----- Input 5 2 #G#T# Output YES Input 6 1 T....G Output YES Input 7 3 T..#..G Output NO Input 6 2 ..GT.. Output NO -----Note----- In the first sample, the grasshopper can make one jump to the right in order to get from cell 2 to cell 4. In the second sample, the grasshopper is only able to jump to neighboring cells but the way to the insect is free — he can get there by jumping left 5 times. In the third sample, the grasshopper can't make a single jump. In the fourth sample, the grasshopper can only jump to the cells with odd indices, thus he won't be able to reach the insect. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python from math import * from sys import * from queue import * from decimal import * n,k=(int(z) for z in input().split()) s=input() i=0 while i<len(s) and s[i] not in ["G","T"]: i+=1 i+=k while i<len(s) and s[i] not in ["G","T","#"]: i+=k if i>=len(s) or s[i]=="#": print("NO") else: print("YES") ```
vfc_10406
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/735/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5 2\n#G#T#\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1\nT....G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3\nT..#..G\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\n..GT..\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\nGT\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 5\nG####.####.####.####.####.####.####.####.####.####.####.####.####.####.####.####.####.####.####T####\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 5\nG####.####.####.####.####.####.####.####.####.####.####.####.####.#########.####.####.####.####T####\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\nTG\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 1\n...T.............................................................................................G.\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 2\nG............#.....#...........#....#...........##............#............#......................T.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 20\n.....G.#.#..................#.........##....#...................#.#..........#...#.#.T..#.......#...\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 20\n.....G................................................................................T.............\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n#.#.#.##..#..##.#....##.##.##.#....####..##.#.##..GT..##...###.#.##.#..#..##.###..#.####..#.#.##..##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 2\n..#####.#.#.......#.#.#...##..####..###..#.#######GT####.#.#...##...##.#..###....##.#.#..#.###....#.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\nG..................................................................................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\nG..................................................................................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\nG..................................#......#......#.......#.#..........#........#......#..........#.T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\nG..............#..........#...#..............#.#.....................#......#........#.........#...T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\nG##################################################################################################T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG..................................................................................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG..................................................................................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG.........#........#..........#..............#.................#............................#.#....T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG.......#..................#..............................#............................#..........T.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG#..........##...#.#.....................#.#.#.........##..#...........#....#...........##...#..###T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG..#.#..#..####......#......##...##...#.##........#...#...#.##....###..#...###..##.#.....#......#.T.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG#....#..#..##.##..#.##.#......#.#.##..##.#.#.##.##....#.#.....####..##...#....##..##..........#...T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG#######.#..##.##.#...#..#.###.#.##.##.#..#.###..####.##.#.##....####...##..####.#..##.##.##.#....#T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 33\nG#####.#.##.###########.##..##..#######..########..###.###..#.####.######.############..####..#####T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\nT..................................................................................................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\nT..................................................................................................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\nT.#...............................#............#..............................##...................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\nT..#....#.##...##########.#.#.#.#...####..#.....#..##..#######.######..#.....###..###...#.......#.#G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\nG##################################################################################################T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\nT..................................................................................................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\nT.................................................................................................G.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\nT................................................................................................G..\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\nT...........................................................................................G.......\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\nG..........................................................................................T........\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\nG..................................................................................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\nT..................................................................................................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n##########G.........T###############################################################################\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n#################################################################################################G.T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\n##########G################.################.################.################T#####################\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\n####.#..#.G######.#########.##..##########.#.################.################T######.####.#########\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\n.########.G##.####.#.######.###############..#.###########.##.#####.##.#####.#T.###..###.########.##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\nG.............................................#....................................................T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\nT.#................................................................................................G\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n##########G....#....T###############################################################################\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n#################################################################################################G#T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\nG################.#################################.################T###############################\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\nG################.###############..###.######.#######.###.#######.##T######################.###.####\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 17\nG####.##.##.#####.####....##.####.#########.##.#..#.###############.T############.#########.#.####.#\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48 1\nT..............................................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23 1\nT.....................G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 1\nG...............................................T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\nTG#\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\n..TG..\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 3\n...G.....#..T.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n##GT#\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\nT#..G.\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 3\nT.#.#.G.....\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 1\n...TG#...\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\nT.G.#\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1\nT...G#\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\nTG###\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n.G..T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 2\nT#...#G\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1\n##TG###\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1\n###GT##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\nG..T.\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\nG.T##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\nG.T###\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\nG#T###\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2\n####T..G..\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\nGT#\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\nTG##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1\n.G..T.\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 3\n......G..T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\nG.T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n#G.T\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\nT#G##\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\nG#.T\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\nGT##\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
164
Solve the following coding problem using the programming language python: It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guys. For example, he can hit the ball directly to the specified point. And yet, the notion of a giveaway is foreign to him. The combination of these features makes the Robo-Wallace the perfect footballer — as soon as the ball gets to him, he can just aim and hit the goal. He followed this tactics in the first half of the match, but he hit the goal rarely. The opposing team has a very good goalkeeper who catches most of the balls that fly directly into the goal. But Robo-Wallace is a quick thinker, he realized that he can cheat the goalkeeper. After all, they are playing in a football box with solid walls. Robo-Wallace can kick the ball to the other side, then the goalkeeper will not try to catch the ball. Then, if the ball bounces off the wall and flies into the goal, the goal will at last be scored. Your task is to help Robo-Wallace to detect a spot on the wall of the football box, to which the robot should kick the ball, so that the ball bounces once and only once off this wall and goes straight to the goal. In the first half of the match Robo-Wallace got a ball in the head and was severely hit. As a result, some of the schemes have been damaged. Because of the damage, Robo-Wallace can only aim to his right wall (Robo-Wallace is standing with his face to the opposing team's goal). The football box is rectangular. Let's introduce a two-dimensional coordinate system so that point (0, 0) lies in the lower left corner of the field, if you look at the box above. Robo-Wallace is playing for the team, whose goal is to the right. It is an improvised football field, so the gate of Robo-Wallace's rivals may be not in the middle of the left wall. [Image] In the given coordinate system you are given: y_1, y_2 — the y-coordinates of the side pillars of the goalposts of robo-Wallace's opponents; y_{w} — the y-coordinate of the wall to which Robo-Wallace is aiming; x_{b}, y_{b} — the coordinates of the ball's position when it is hit; r — the radius of the ball. A goal is scored when the center of the ball crosses the OY axis in the given coordinate system between (0, y_1) and (0, y_2). The ball moves along a straight line. The ball's hit on the wall is perfectly elastic (the ball does not shrink from the hit), the angle of incidence equals the angle of reflection. If the ball bounces off the wall not to the goal, that is, if it hits the other wall or the goal post, then the opposing team catches the ball and Robo-Wallace starts looking for miscalculation and gets dysfunctional. Such an outcome, if possible, should be avoided. We assume that the ball touches an object, if the distance from the center of the ball to the object is no greater than the ball radius r. -----Input----- The first and the single line contains integers y_1, y_2, y_{w}, x_{b}, y_{b}, r (1 ≤ y_1, y_2, y_{w}, x_{b}, y_{b} ≤ 10^6; y_1 < y_2 < y_{w}; y_{b} + r < y_{w}; 2·r < y_2 - y_1). It is guaranteed that the ball is positioned correctly in the field, doesn't cross any wall, doesn't touch the wall that Robo-Wallace is aiming at. The goal posts can't be located in the field corners. -----Output----- If Robo-Wallace can't score a goal in the described manner, print "-1" (without the quotes). Otherwise, print a single number x_{w} — the abscissa of his point of aiming. If there are multiple points of aiming, print the abscissa of any of them. When checking the correctness of the answer, all comparisons are made with the permissible absolute error, equal to 10^{ - 8}. It is recommended to print as many characters after the decimal point as possible. -----Examples----- Input 4 10 13 10 3 1 Output 4.3750000000 Input 1 4 6 2 2 1 Output -1 Input 3 10 15 17 9 2 Output 11.3333333333 -----Note----- Note that in the first and third samples other correct values of abscissa x_{w} are also possible. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python y1, y2, w, x, y, r = map(int, input().strip().split()) w -= r y1 = 2 * w - y1 - y - r y2 = 2 * w - y2 - y if x * x * (y2 - y1) * (y2 - y1) <= (y1 * y1 + x * x) * r * r: print(-1) else: print(f"{x * (y1 + y - w) / y1:.10f}") ```
vfc_10410
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/248/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 10 13 10 3 1\n", "output": "4.3750000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4 6 2 2 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 15 17 9 2\n", "output": "11.3333333333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 30 3 3 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 13 2 3 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 13 1 1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 6 6 3\n", "output": "4.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 24 10 3 1\n", "output": "4.7368421053\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 20 10 3 1\n", "output": "4.6666666667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 8 10 8 3 3\n", "output": "3.4285714286\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 4 6 3\n", "output": "2.6666666667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 6 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 7 3 3\n", "output": "3.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 9 5 3\n", "output": "5.4000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 6 5 3\n", "output": "3.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 5 5 3\n", "output": "3.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 9 3 3\n", "output": "3.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 9 5 3\n", "output": "5.4000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 8 10 3 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 5 5 3\n", "output": "3.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 5 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 8 5 3\n", "output": "4.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 9 5 3\n", "output": "4.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 10 4 5 3\n", "output": "2.4000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 8 10 5 5 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 10 9 5 3\n", "output": "4.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 8 8 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 58 81 5\n", "output": "48.8764044944\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 601 76 5\n", "output": "479.5212765957\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 7193 39 5\n", "output": "4118.1297709924\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 40766 18 5\n", "output": "20114.8026315789\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 30 100 243890 31 5\n", "output": "131595.3237410072\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 30 10 3 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "56 90 100 9 56 9\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29 62 100 88 37 9\n", "output": "43.5887850467\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "712 950 1000 98 727 92\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7788 8844 10000 70 4902 63\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 67 100 986 29 7\n", "output": "361.2079207921\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "190 212 1000 103 795 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5234 7681 10000 985 8825 847\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "94603 96309 100000 728 25633 556\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 73 100 5089 24 9\n", "output": "2223.7647058824\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "330 357 1000 625 129 8\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5010 6384 10000 9022 3213 187\n", "output": "3713.0485021398\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 17 100 56205 62 2\n", "output": "40017.9600000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "626 705 1000 10072 858 35\n", "output": "7449.8491484185\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1727 5232 10000 67443 5399 62\n", "output": "43315.9683953342\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10995 85967 100000 47813 44507 2442\n", "output": "29321.4167104074\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "845391 929573 1000000 87612 108825 1400\n", "output": "12769.2918746832\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "78 90 100 535782 61 4\n", "output": "153080.5714285714\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2846 8620 10000 466361 3155 1292\n", "output": "210537.3673812111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "138623 763216 1000000 366229 316563 160243\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111724 287004 931554 512877 139642 23002\n", "output": "257255.6532044368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70276 182564 238201 222757 154128 55592\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "65775 300705 686095 383961 189161 72083\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "303226 381701 395142 301908 2696 244\n", "output": "57074.3018919422\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "451924 493579 637450 231345 530245 20087\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67933 96355 131374 588846 12918 4897\n", "output": "188927.5585923950\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "149195 164613 287623 72041 223411 5390\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "448887 492030 560100 388288 354938 20867\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "435582 479389 540004 905521 413521 1624\n", "output": "405317.7264116302\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64887 100252 122962 146510 74262 15718\n", "output": "65461.4966203183\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "246310 320553 585881 278070 443362 23788\n", "output": "197686.6564327557\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "154137 199509 247827 186170 112705 19967\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "652284 765064 966501 110259 224662 46292\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1437 1945 9737 17190 7829 114\n", "output": "14064.2286640989\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "61880 74283 78517 551852 20330 1475\n", "output": "107291.2729442180\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "196112 214848 221935 465535 132387 3661\n", "output": "82508.1717726175\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20296 469893 481654 239118 236770 20582\n", "output": "155898.4832985775\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "476636 647171 684372 48498 122589 5636\n", "output": "12660.0741578319\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 149 150 13 78 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 149 150 16 36 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 149 150 13 134 3\n", "output": "3.0588235294\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 149 150 11 76 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 78 292 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 89 829 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 75 585 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 67 240 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 64 276 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 43 926 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1400 1490 1500 83 1362 40\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 149 150 18 80 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 25 10 3 1\n", "output": "-1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
165
Solve the following coding problem using the programming language python: Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes how many times he had a breakfast, a dinner and a supper (thus, the card contains three integers). Vasiliy could sometimes have missed some meal, for example, he could have had a breakfast and a supper, but a dinner, or, probably, at some days he haven't been at the dining room at all. Vasiliy doesn't remember what was the time of the day when he arrived to sanatorium (before breakfast, before dinner, before supper or after supper), and the time when he left it (before breakfast, before dinner, before supper or after supper). So he considers any of these options. After Vasiliy arrived to the sanatorium, he was there all the time until he left. Please note, that it's possible that Vasiliy left the sanatorium on the same day he arrived. According to the notes in the card, help Vasiliy determine the minimum number of meals in the dining room that he could have missed. We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left. -----Input----- The only line contains three integers b, d and s (0 ≤ b, d, s ≤ 10^18, b + d + s ≥ 1) — the number of breakfasts, dinners and suppers which Vasiliy had during his vacation in the sanatorium. -----Output----- Print single integer — the minimum possible number of meals which Vasiliy could have missed during his vacation. -----Examples----- Input 3 2 1 Output 1 Input 1 0 0 Output 0 Input 1 1 1 Output 0 Input 1000000000000000000 0 1000000000000000000 Output 999999999999999999 -----Note----- In the first sample, Vasiliy could have missed one supper, for example, in case he have arrived before breakfast, have been in the sanatorium for two days (including the day of arrival) and then have left after breakfast on the third day. In the second sample, Vasiliy could have arrived before breakfast, have had it, and immediately have left the sanatorium, not missing any meal. In the third sample, Vasiliy could have been in the sanatorium for one day, not missing any meal. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a = list(map(int, input().split())) m = max(a) ans = 0 for i in range(3): if a[i] < m - 1: ans += (m - 1) - a[i] a[i] = m - 1 print(ans) ```
vfc_10414
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/732/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 0 1000000000000000000\n", "output": "999999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 0 0\n", "output": "1998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 999999999999999999 999999999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 999999999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 999999999999999999 999999999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 1000000000000000000 999999999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 1000000000000000000 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 999999999999999998 999999999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 999999999999999999 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 10\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 11 11\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 8 8\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 18 14\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "94 87 14\n", "output": "85\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 91 108\n", "output": "88\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1671 24 419\n", "output": "2897\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7759 10296 4966\n", "output": "7865\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8912 10561 8205\n", "output": "4003\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000100 1000000083 1000000047\n", "output": "68\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999996782 1000007108 1000009860\n", "output": "15828\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999342691 1000075839 1000144842\n", "output": "871152\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "951468821 1005782339 1063348170\n", "output": "169445178\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "498556507 1820523034 1566999959\n", "output": "1575489600\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999999938 99999999999999971 99999999999999944\n", "output": "58\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999995757 100000000000000116 99999999999999158\n", "output": "5315\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000481729714 100000000353636209 99999999472937283\n", "output": "1136885934\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000330161030627 99999005090484867 99999729994406004\n", "output": "1925237170381\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100040306518636197 100049788380618015 99377557930019414\n", "output": "681712312580417\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "117864695669097197 53280311324979856 171825292362519668\n", "output": "172505577730962281\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64058874468711639 248004345115813505 265277488186534632\n", "output": "218491756788544118\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 323940200031019351 1000000000000000000\n", "output": "1676059799968980647\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1000000000000000000 0\n", "output": "1999999999999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1000000000000000000\n", "output": "1999999999999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 0 0\n", "output": "1999999999999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1000000000000000000 1000000000000000000\n", "output": "999999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 0\n", "output": "999999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6436340231848 215 5328562123\n", "output": "12867351901356\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4352626266226 1\n", "output": "8705252532448\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "647397084215 513125 15999899\n", "output": "1294777655404\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "429 42 132\n", "output": "682\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 6 0\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 99\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99 100\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 70 80\n", "output": "38\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 10\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 200000 10\n", "output": "399978\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 0\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1 0\n", "output": "1999999999999999997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0 0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 100000000000000000 0\n", "output": "1899999999999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1 1\n", "output": "1999999999999999996\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 5\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0 5\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 0\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1000 0\n", "output": "1998\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
166
Solve the following coding problem using the programming language python: There is a matrix A of size x × y filled with integers. For every $i \in [ 1 . . x ]$, $j \in [ 1 . . y ]$ A_{i}, j = y(i - 1) + j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a_1, a_2, ..., a_{n} denoting that you started in the cell containing the number a_1, then moved to the cell with the number a_2, and so on. From the cell located in i-th line and j-th column (we denote this cell as (i, j)) you can move into one of the following cells: (i + 1, j) — only if i < x; (i, j + 1) — only if j < y; (i - 1, j) — only if i > 1; (i, j - 1) — only if j > 1. Notice that making a move requires you to go to an adjacent cell. It is not allowed to stay in the same cell. You don't know x and y exactly, but you have to find any possible values for these numbers such that you could start in the cell containing the integer a_1, then move to the cell containing a_2 (in one step), then move to the cell containing a_3 (also in one step) and so on. Can you choose x and y so that they don't contradict with your sequence of moves? -----Input----- The first line contains one integer number n (1 ≤ n ≤ 200000) — the number of cells you visited on your path (if some cell is visited twice, then it's listed twice). The second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9) — the integers in the cells on your path. -----Output----- If all possible values of x and y such that 1 ≤ x, y ≤ 10^9 contradict with the information about your path, print NO. Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be positive integers not exceeding 10^9. -----Examples----- Input 8 1 2 3 6 9 8 5 2 Output YES 3 3 Input 6 1 2 1 2 5 3 Output NO Input 2 1 10 Output YES 4 9 -----Note----- The matrix and the path on it in the first test looks like this: [Image] Also there exist multiple correct answers for both the first and the third examples. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python MAXN = 1000000000 n = int(input()) a = list(map(int, input().split())) def solve1(): for i in range(n-1): if abs(a[i]-a[i+1]) != 1: return False print("YES\n%d %d" % (MAXN, 1)) return True def solve2(): w = -1 for i in range(n-1): d = abs(a[i]-a[i+1]) if d != 1: if w == -1: w = d elif w != d: return False if w <= 0: return False for i in range(n-1): if abs(a[i]-a[i+1]) == 1 and (a[i]-1)//w != (a[i+1]-1)//w: return False print("YES\n%d %d" % (MAXN, w)) return True if solve1(): pass elif solve2(): pass else: print("NO") ```
vfc_10418
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/954/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "8\n1 2 3 6 9 8 5 2\n", "output": "YES\n1000000000 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 1 2 5 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 10\n", "output": "YES\n1000000000 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n6\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 1\n", "output": "YES\n1000000000 999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 2 4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 5 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 4\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1000000000\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 4 5 6 3 2\n", "output": "YES\n1000000000 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 2 3 6 9 8 7 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n4 3 2 1 5 6 7 8 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n2 5 8 9 6 3 2 1\n", "output": "YES\n1000000000 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 1 3\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n3 5 2 1 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 999999999\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 4 3\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n10 8 6 4 2 1\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 4 7 8 9 10 11\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 2 3 2 3 4 3 8\n", "output": "YES\n1000000000 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 4 3 5\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 4 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1 3 4 6 5 3 1 2 4 6 5 3 1\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n4 3 6 9 8 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 4 3 5 6\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 4 3 1\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 4 3 5\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 6 5 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37\n94 7 32 29 57 22 11 70 57 61 12 75 93 24 4 47 98 43 99 22 50 32 37 64 80 9 40 87 38 70 17 41 77 76 20 66 48\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99999999 100000000\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 4 5 6 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n3 8 7 6 5 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1000000000 999999998\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n8 9 10 14 13\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 3 5 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n5 6 4\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1000000\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n9 10 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n1 3 5 7 9 10 8 6 4 2 1 2 4 3 5 6 8 7 9 10 8 7 5 6 4 3 1 2\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 4 5 6 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n6 8 7\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n100000000\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 4 6 5 6 5\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999999 1000000000\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 6 7 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n92 34 58 40 76 3 38 66 76 23 85 36 47 43 22 46 98 72 97 80 57 77 96\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n6 7 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 4 3\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 4 3 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 3 5 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n19260816 19260817 19260818\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n999999998 1000000000\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n2 4 6 5 6 5 3 4\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n246642 246641\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n9 7 5\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 2 1 2 1 2 1 2 1 2\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 3 5 7 8\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 10 9 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 4\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 2 4 3 5 6 8 7\n", "output": "YES\n1000000000 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 3 2\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 1\n", "output": "YES\n1000000000 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n999 1000 2000 2001\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 2 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n500000000 1000000000\n", "output": "YES\n1000000000 500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 5 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 3 4 5 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n550 555 554 553 554 555 560\n", "output": "YES\n1000000000 5\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
167
Solve the following coding problem using the programming language python: You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen that you will not need to remove any characters at all, or maybe you will have to remove all of the characters from b and make it empty. Subsequence of string s is any such string that can be obtained by erasing zero or more characters (not necessarily consecutive) from string s. -----Input----- The first line contains string a, and the second line — string b. Both of these strings are nonempty and consist of lowercase letters of English alphabet. The length of each string is no bigger than 10^5 characters. -----Output----- On the first line output a subsequence of string a, obtained from b by erasing the minimum number of consecutive characters. If the answer consists of zero characters, output «-» (a minus sign). -----Examples----- Input hi bob Output - Input abca accepted Output ac Input abacaba abcdcba Output abcba -----Note----- In the first example strings a and b don't share any symbols, so the longest string that you can get is empty. In the second example ac is a subsequence of a, and at the same time you can obtain it by erasing consecutive symbols cepted from string b. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def get_substr_ends(haystack, needle): ans = [-1] index = 0 for char in needle: while index < len(haystack) and char != haystack[index]: index += 1 ans.append(index) if index < len(haystack): index += 1 return ans haystack = input() needle = input() pref = get_substr_ends(haystack, needle) suff = get_substr_ends(haystack[::-1], needle[::-1]) pref_index = 0 suff_len = 0 while suff_len < len(suff) and suff[suff_len] < len(haystack): suff_len += 1 suff_len -= 1 best_str = needle[len(needle) - suff_len:] if len(best_str) == len(needle): print(needle) return for pref_len in range(1, len(pref)): while suff_len >= 0 and suff[suff_len] + pref[pref_len] + 2 > len(haystack): suff_len -= 1 ans = pref_len + suff_len if ans > len(best_str) and suff_len >= 0: best_str = needle[:pref_len] + needle[len(needle) - suff_len:] print(best_str if best_str else '-') ```
vfc_10422
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/762/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "hi\nbob\n", "output": "-\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abca\naccepted\n", "output": "ac\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abacaba\nabcdcba\n", "output": "abcba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "lo\neuhaqdhhzlnkmqnakgwzuhurqlpmdm\n", "output": "-\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaeojkdyuilpdvyewjfrftkpcobhcumwlaoiocbfdtvjkhgda\nmlmarpivirqbxcyhyerjoxlslyfzftrylpjyouypvk\n", "output": "ouypvk\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "npnkmawey\nareakefvowledfriyjejqnnaeqheoh\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "fdtffutxkujflswyddvhusfcook\nkavkhnhphcvckogqqqqhdmgwjdfenzizrebefsbuhzzwhzvc\n", "output": "kvc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abacaba\naa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "edbcd\nd\n", "output": "d\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abc\nksdksdsdsnabc\n", "output": "abc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abxzxzxzzaba\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abcd\nzzhabcd\n", "output": "abcd\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa\naa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "test\nt\n", "output": "t\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa\na\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaabbbbaaaa\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa\nzzaa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "zhbt\nztjihmhebkrztefpwty\n", "output": "zt\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaaaaaaaaaaaaaaa\naaaaaaaa\n", "output": "aaaaaaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abba\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abbba\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaaaaaaa\naaaaaaaaaaaa\n", "output": "aaaaaaaaaaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaa\naa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaaaaaaa\naaa\n", "output": "aaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaabbbbbbaaaaaa\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ashfaniosafapisfasipfaspfaspfaspfapsfjpasfshvcmvncxmvnxcvnmcxvnmxcnvmcvxvnxmcvxcmvh\nashish\n", "output": "ashish\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\na\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaab\naab\n", "output": "aab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaa\naaaa\n", "output": "aaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\naaa\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaabbbbbbaaaaaa\naba\n", "output": "aba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "def\nabcdef\n", "output": "def\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaaaa\na\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bababsbs\nabs\n", "output": "abs\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "hddddddack\nhackyz\n", "output": "hack\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aba\na\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ofih\nihfsdf\n", "output": "ih\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "b\nabb\n", "output": "b\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "lctsczqr\nqvkp\n", "output": "q\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "dedcbaa\ndca\n", "output": "dca\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "haddack\nhack\n", "output": "hack\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abcabc\nabc\n", "output": "abc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "asdf\ngasdf\n", "output": "asdf\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abab\nab\n", "output": "ab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaa\naaa\n", "output": "aaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "asdf\nfasdf\n", "output": "asdf\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bbaabb\nab\n", "output": "ab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "accac\nbaacccbcccabaabbcacbbcccacbaabaaac\n", "output": "aac\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "az\naaazazaa\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bbacaabbaaa\nacaabcaa\n", "output": "acaabaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "c\ncbcbcbbacacacbccaaccbcabaaabbaaa\n", "output": "c\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bacb\nccacacbacbccbbccccaccccccbcbabbbaababa\n", "output": "ba\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ac\naacacaacbaaacbbbabacaca\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\nzazaa\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abcd\nfaaaabbbbccccdddeda\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abcde\nfabcde\n", "output": "abcde\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\nab\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ababbbbbbbbbbbb\nabbbbb\n", "output": "abbbbb\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bbbbaabbababbaaaaababbaaabbbbaaabbbababbbbabaabababaabaaabbbabababbbabababaababaaaaa\nbbabaaaabaaaabbaaabbbabaaabaabbbababbbbbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n", "output": "bbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab\naba\n", "output": "ab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa\naaaa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaabbbaaaaa\naabbaa\n", "output": "aabbaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaaaaaaaa\naaaa\n", "output": "aaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abbcc\naca\n", "output": "ac\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "b\ncb\n", "output": "b\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aac\naaa\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ba\nbb\n", "output": "b\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\nb\n", "output": "-\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "gkvubrvpbhsfiuyha\nihotmn\n", "output": "ih\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ccccabccbb\ncbbabcc\n", "output": "cabcc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "babababbaaabb\nabbab\n", "output": "abbab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "njtdhyqundyedsjyvy\nypjrs\n", "output": "ys\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "uglyqhkpruxoakm\ncixxkpaaoodpuuh\n", "output": "uh\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\naaaaaaaaa\n", "output": "a\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaa\naaaaa\n", "output": "aaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "abcabbcbcccbccbbcc\nacbcaabbbbcabbbaca\n", "output": "acbc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "caacacaacbaa\nacbbbabacacac\n", "output": "aacacac\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa\naaab\n", "output": "aa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "acbc\ncacacbac\n", "output": "ac\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "bacbcaacabbaacb\ncbbaaccccbcaacacaabb\n", "output": "cbcaabb\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "baababaaaab\nbaababbbbbbb\n", "output": "baababb\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "aaxyaba\naaba\n", "output": "aaba\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
168
Solve the following coding problem using the programming language python: Vasya has a pile, that consists of some number of stones. $n$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile. You are given $n$ operations which Vasya has made. Find the minimal possible number of stones that can be in the pile after making these operations. -----Input----- The first line contains one positive integer $n$ — the number of operations, that have been made by Vasya ($1 \leq n \leq 100$). The next line contains the string $s$, consisting of $n$ symbols, equal to "-" (without quotes) or "+" (without quotes). If Vasya took the stone on $i$-th operation, $s_i$ is equal to "-" (without quotes), if added, $s_i$ is equal to "+" (without quotes). -----Output----- Print one integer — the minimal possible number of stones that can be in the pile after these $n$ operations. -----Examples----- Input 3 --- Output 0 Input 4 ++++ Output 4 Input 2 -+ Output 1 Input 5 ++-++ Output 3 -----Note----- In the first test, if Vasya had $3$ stones in the pile at the beginning, after making operations the number of stones will be equal to $0$. It is impossible to have less number of piles, so the answer is $0$. Please notice, that the number of stones at the beginning can't be less, than $3$, because in this case, Vasya won't be able to take a stone on some operation (the pile will be empty). In the second test, if Vasya had $0$ stones in the pile at the beginning, after making operations the number of stones will be equal to $4$. It is impossible to have less number of piles because after making $4$ operations the number of stones in the pile increases on $4$ stones. So, the answer is $4$. In the third test, if Vasya had $1$ stone in the pile at the beginning, after making operations the number of stones will be equal to $1$. It can be proved, that it is impossible to have less number of stones after making the operations. In the fourth test, if Vasya had $0$ stones in the pile at the beginning, after making operations the number of stones will be equal to $3$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) s = input() b = 0 for i in s: if i == '+': b += 1 else: b -= 1 b = max(b, 0) print(b) ```
vfc_10426
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1159/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n---\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n++++\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n++-++\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "100", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n----------------------------------------------------------------------------------------------------\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+++++++++++++++-++++++++++++++++++++++++++++++++++-++++++++++++++++++++++\n", "output": "69", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+-+-++--++-++-+-+---+--++++++-++++--++-++---+--++++--+++++++-++-+--+-+-+--+-+++++-+--+---+-++-++-+\n", "output": "17", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++-+-+-+-+++-++++--+++----+-+-+-------+-+-++--++--+-+++++---+-++---++-+-++---+--+-+-++-++-+---++-+--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n--+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-----+-++++----++-+--+-+++-++--+--++---++++----+-+++--+++--+---++--++--++-+--+-+-+-+-+-+-+-++-+--+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+++++--+-+++-+-++---+-++-+---++-------++-+--+-++-+--+-+--+-+-+----++-+-----++----++++-+-+---+--+--+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-------+-++-------------+-----+--+----++----+-----+----+-----++-------------------+-+-------+-------\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+--+-++--+-+-+-+-+-+-+-+-++--++--+-+-+-+-+-+-+-+-+-+-+-++--+-+-+-+-+-+-+-++--+-+-+-+-+-+-+-+-+-+-+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-++--+-+-++--++-+++-++++----+--+---+-+-+-+-++--+-+-+-+-+-+-++--+-+-+-+-+-+-+-+++---+++-+-+-+---++--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-++------+---++++-+---++---+--+-++--+-+-++--+-+-++++-+++-+-----++-+--++-+++++---+-----+++---+-+-+-+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n------+---+--------+++--+--------------++--+----------+-+---+------+-+-----++---+------+-+---++-+---\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+--+++-++-+-+--++-++-------+-++--++----+--++-++------++--+++-+-+-+--+++---+----+--+++++-++----+---+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--+++--+---+-++--++-+--++++++--+-------+-+----+-++-+--+-+-+++---+++--+--+-+-+-+-++--++-++---++--+-++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n-++-+-+++--++--+-+--++-+-++-+-----+---+++-+++++--+-+-+-+--+++-+++++---+-+--+----+---------+-+-+-++-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n---------------------------------------------------------------------------------------------------+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n-+-++--------++--++----------------------------++-------++-+--+---------+-+--------+---+----------+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++--+-+-+-++--+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+--+-++--+-+-+-++--++--++--+-++--+-+-+-++--+-++--+-+-++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--+--++--+--++-+---++-+++-+--++-+-+++--+-----+++-+++-+-+-+--+---++-+-+-++-++---+---+-+-+++--+--+-++-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-----+-+-++--++++-+++---+-++--++-----+-+-+-+-++--+-+++-+--+-+++--+---+-+-++--+-+-+-++-++--+-+-+--+++\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n-+-+-+++--+--+-+-++--+-++--+++-+++-++-+++++-+-+-++----------+--++--++--++--+-++--+-+-+-++--+-+-++-+\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--+---++++-+++-++-++----++-++-+-++--++-+--++++-++--+---+-++-+-+-+---+-+----------+-+--+--+--+++-++-+\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+++--++++-+-++--+--+-++-------+---+-+---+++++++---+----+++-+-++--+-+--+-+-+--+-+-++-+---++-+-+++++\n", "output": "6", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+---+++--+++--+--++--+--+---+-----+++-+++-+-+--+--+-+--++-+--+-+--+++--++---+-+-++-++-+-+++++++-+--+\n", "output": "8", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++++-+++++--+++\n", "output": "9", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n----------------------------------------------------------------------++++++++++++++++-++-++++++++++\n", "output": "26", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--++---+---------+-++--+--++---------------+---------+---+----+-----+--------------+++++--++++-++-+-\n", "output": "7", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+--+-+-+-+-+++--++---+-+-+-+-+-+-+-+-++--+-+-+-+-+-+-+-+-+-++--+-+-+-+-++--+-++-+-+-+-+-+-+-+-+-+-+-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-++++--+-----++--+-++--++-+++-++-+-+++--+--++-----++---+-+-++++++++++++-++-+++-+++-+-+++++-+--+++++\n", "output": "24", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+-+---+-+-+-++-+--+-+++-+---+-++-+-+--++-+--+-+-+-+-+-++--+-+-++--+++++-+-++++++++++-++++++++++++++\n", "output": "27", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-++-+-++----+++--+++++-+--++--++----+---+-++++++--+---+-+--+--+--+++++++++++++++++++++++++++++++++++\n", "output": "35", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++++++++++++++++++++------------------------------++++++++++++++++++++++++++++++++++++++++++++++----\n", "output": "42", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--------------------------------------------------++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "50", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n----------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "90", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--------------------------------------------------------------------------------------------------++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++--+-+-+-++++++++++++++--+-+++++++++-++++++++++++++++++++++-+-++++-+++++++++-+-+-+++-+++++++++-+++-\n", "output": "64", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++++----------------++++-+---+++-++++++++++++++++++++++-++--+++++++-+-++++++++++++++++++++++++++++++\n", "output": "60", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++++++-+++++++-++++++++++-++++++++++++++++++++++++-++++-++++++--+++-++++++++++++++++++++++++++-+-+++\n", "output": "80", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--------------------++-+++---+-++--+-++--++--++--+-+-+++---+-+-++--+-+-+-+-+-+-+-+-+-+-+-++--+-+-+-+\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "99", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "98", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "98", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+-+-+-+-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "90", "type": "stdin_stdout" }, { "fn_name": null, "input": "89\n+++-++-----+------+-+-++-----+-+------++--+-++++-+-++-+++++-+++-+-+--+++-+-+-++-+---+++-+\n", "output": "13", "type": "stdin_stdout" }, { "fn_name": null, "input": "78\n+++++++++-----------------------------------------------+++++++++++++---++++++\n", "output": "16", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n---+-----------+-++---+----------++++++++++++++++++++++++++++++++++++++++++++-----------------------\n", "output": "21", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-----++--+-++-------+-+---++-+++-++++++++++++++-++-++-+-+++++++-+---++-+-+++++-++++++++++++++-+-++++\n", "output": "44", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n---+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "97", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n-+-++--++++++--++++--+--------+-+--++--+--++-++++-+-+++++++-+-++++--+---+-+++---+--+---+++++-+-+--+\n", "output": "11", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n-++++--+-+----++-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "73\n+++-+-++-+++--+-----+++---+-+-++++-+++--+-+-++--++----+--+--+---+-++-+-+-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "51\n-++---+++++-+-++------+---+-++-+-+-+-++++-++++++-+-\n", "output": "9", "type": "stdin_stdout" }, { "fn_name": null, "input": "98\n----+-+--+-+-++-++++---+-++++-+--++-++++++-+++--+++-+-----+-+--+-----+++++--+-++-+++-+-+++-+---++-\n", "output": "11", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-+++-+++++-++--+++++++++-+-+-+--+++-+---+-+-+--+++-+-+-+-+-----++++++-+++++----++--+++-++--++---+--\n", "output": "16", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++-+-+---+-+--+++++-++++++---++-+-----+++++----++++-+--+--+-+-+++-++-++-+---+-++-++-+-+-----+----+++\n", "output": "6", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n++-+++-+---+-++-+-++------+++-----++-++++-+-+-+----+++-++++------++++--+-+-+++--+---------++-+-+-+--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n+-------+-+++-+++-++-+-----+----+----+-+----+-++--+++-+---++-++-+-+++-+----+++-+-----+--+-++----++++\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n--++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-++-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-+--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n----\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n+-+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n+--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n++-\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n+++\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n--+\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n++\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n+-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n-\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n--+--\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-+--\n", "output": "0", "type": "stdin_stdout" } ] }
apps
verifiable_code
169
Solve the following coding problem using the programming language python: Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated. Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plastic liter bottle, that costs a rubles, or in glass liter bottle, that costs b rubles. Also, you may return empty glass bottle and get c (c < b) rubles back, but you cannot return plastic bottles. Kolya has n rubles and he is really hungry, so he wants to drink as much kefir as possible. There were no plastic bottles in his 1984, so Kolya doesn't know how to act optimally and asks for your help. -----Input----- First line of the input contains a single integer n (1 ≤ n ≤ 10^18) — the number of rubles Kolya has at the beginning. Then follow three lines containing integers a, b and c (1 ≤ a ≤ 10^18, 1 ≤ c < b ≤ 10^18) — the cost of one plastic liter bottle, the cost of one glass liter bottle and the money one can get back by returning an empty glass bottle, respectively. -----Output----- Print the only integer — maximum number of liters of kefir, that Kolya can drink. -----Examples----- Input 10 11 9 8 Output 2 Input 10 5 6 1 Output 2 -----Note----- In the first sample, Kolya can buy one glass bottle, then return it and buy one more glass bottle. Thus he will drink 2 liters of kefir. In the second sample, Kolya can buy two plastic bottle and get two liters of kefir, or he can buy one liter glass bottle, then return it and buy one plastic bottle. In both cases he will drink two liters of kefir. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n=int(input()) a=int(input()) b=int(input()) c=int(input()) r=n//a if n > c: r=max(r,(r-b+c)//a+1,(n-c)//(b-c)+((n-c)%(b-c)+c)//a) print(r) ```
vfc_10430
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/625/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "10\n11\n9\n8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5\n6\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2\n2\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3\n3\n1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1\n2\n1\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2\n3\n1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2\n4\n1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2\n2\n1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n10\n10\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2\n2\n1\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n2\n10\n9\n", "output": "999999999999999995\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "501000000000000000\n300000000000000000\n301000000000000000\n100000000000000000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1\n9\n8\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n8\n8\n7\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5\n5\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29\n3\n3\n1\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45\n9\n9\n8\n", "output": "37\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45\n9\n9\n1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n10\n10\n9\n", "output": "91\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179\n10\n9\n1\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179\n2\n2\n1\n", "output": "178\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179\n179\n179\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179\n59\n59\n58\n", "output": "121\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\n250\n250\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\n1\n250\n1\n", "output": "500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "501\n500\n500\n499\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "501\n450\n52\n1\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "501\n300\n301\n100\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\n179\n10\n1\n", "output": "55\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n500\n10\n9\n", "output": "991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n2\n10\n9\n", "output": "995\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1001\n1000\n1000\n999\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n10000\n10000\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n10\n5000\n4999\n", "output": "5500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n999999998\n999999999\n999999998\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n50\n50\n49\n", "output": "999999951\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n500\n5000\n4999\n", "output": "999995010\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n51\n100\n98\n", "output": "499999952\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n100\n51\n50\n", "output": "999999950\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n2\n5\n4\n", "output": "999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n999999998000000000\n999999999000000000\n999999998000000000\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n2\n2\n1\n", "output": "999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999\n2\n999999998\n1\n", "output": "499999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n2\n2\n1\n", "output": "999999999999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n10\n10\n9\n", "output": "999999999999999990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n999999999999999998\n999999999999999998\n999999999999999997\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n501\n501\n1\n", "output": "1999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n2\n50000000000000000\n49999999999999999\n", "output": "974999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n180\n180\n1\n", "output": "5586592178770949\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n42\n41\n1\n", "output": "24999999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n41\n40\n1\n", "output": "25641025641025641\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000000\n79\n100\n25\n", "output": "1333333333333333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n100\n5\n4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n1000000000000000000\n10000000\n9999999\n", "output": "999999999990000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n999999999000000000\n900000000000000000\n899999999999999999\n", "output": "100000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n10\n15\n11\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1000\n5\n4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n100\n10\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2\n100000\n99999\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2\n4\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3\n6\n4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n7\n65\n49\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n20\n100\n99\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000000\n10000000000\n9000000000\n8999999999\n", "output": "1000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90\n30\n101\n100\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999\n5\n500000000000000\n499999999999999\n", "output": "599999999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n1000000000000000000\n1000000000\n999999999\n", "output": "999999999000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1000000000000000000\n1000000000\n999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000000\n100000000000000000\n1000000000\n999999999\n", "output": "99999999000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000009\n100\n1000000000000000\n999999999999999\n", "output": "99010000000000009\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n20\n10\n9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4\n14\n13\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n3\n9\n7\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n5\n7\n4\n", "output": "333333332\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12155\n1943\n28717\n24074\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n10\n20\n5\n", "output": "100000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98\n33\n440\n314\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1070252292\n57449678\n237309920\n221182550\n", "output": "56\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3\n102\n101\n", "output": "33\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000000\n100000000000000001\n1000000000000000\n999999999999999\n", "output": "99000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66249876257975628\n302307316\n406102416\n182373516\n", "output": "296116756\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5\n10\n1\n", "output": "2\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
170
Solve the following coding problem using the programming language python: Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different number of cards. Then they play a "war"-like card game. The rules are following. On each turn a fight happens. Each of them picks card from the top of his stack and puts on the table. The one whose card value is bigger wins this fight and takes both cards from the table to the bottom of his stack. More precisely, he first takes his opponent's card and puts to the bottom of his stack, and then he puts his card to the bottom of his stack. If after some turn one of the player's stack becomes empty, he loses and the other one wins. You have to calculate how many fights will happen and who will win the game, or state that game won't end. -----Input----- First line contains a single integer n (2 ≤ n ≤ 10), the number of cards. Second line contains integer k_1 (1 ≤ k_1 ≤ n - 1), the number of the first soldier's cards. Then follow k_1 integers that are the values on the first soldier's cards, from top to bottom of his stack. Third line contains integer k_2 (k_1 + k_2 = n), the number of the second soldier's cards. Then follow k_2 integers that are the values on the second soldier's cards, from top to bottom of his stack. All card values are different. -----Output----- If somebody wins in this game, print 2 integers where the first one stands for the number of fights before end of game and the second one is 1 or 2 showing which player has won. If the game won't end and will continue forever output - 1. -----Examples----- Input 4 2 1 3 2 4 2 Output 6 2 Input 3 1 2 2 1 3 Output -1 -----Note----- First sample: [Image] Second sample: [Image] The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) k1 = list(map(int, input().split()[1:])) k2 = list(map(int, input().split()[1:])) i = 0 while True: if len(k1) == 0 or len(k2) == 0: break if i > 10000: break if k1[0] > k2[0]: k1 = k1[1:] + k2[0:1] + k1[0:1] k2 = k2[1:] else: k2 = k2[1:] + k1[0:1] + k2[0:1] k1 = k1[1:] i += 1 if i > 10000: print(-1) else: winner = 1 if len(k1) == 0: winner = 2 print(i, winner) ```
vfc_10434
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/546/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n2 1 3\n2 4 2\n", "output": "6 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2\n2 1 3\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 5 3 2 4\n1 1\n", "output": "1 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 6 5\n4 1 2 3 4\n", "output": "6 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n6 6 5 2 7 4 1\n1 3\n", "output": "1 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n7 2 3 1 5 6 4 8\n1 7\n", "output": "15 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2 3 6\n7 9 7 8 5 2 1 4\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 7 10 8\n7 4 6 9 2 5 1 3\n", "output": "25 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 2 1\n1 3\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 2\n1 1\n", "output": "1 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3\n2 2 1\n", "output": "2 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1\n2 3 2\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2\n2 3 1\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 1\n1 2\n", "output": "1 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3\n2 1 2\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 1 3\n1 2\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 1 2\n1 3\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n1 2\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 1\n2 4 3\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2\n3 3 4 1\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3 2 1\n1 4\n", "output": "3 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 2 3 1\n1 4\n", "output": "7 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 1 4 2\n1 3\n", "output": "7 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 1 3 2\n1 4\n", "output": "5 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 2 1\n3 4 5 3\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 4\n4 5 2 3 1\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2\n4 5 1 4 3\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 2 4\n3 3 1 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 2 4 3 1\n1 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 1 3 4 2\n1 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 3 2 5 1\n1 4\n", "output": "7 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 4\n4 3 2 5 1\n", "output": "7 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 4 1 3 2\n1 5\n", "output": "6 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 1 4 3 2\n1 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 1 5 3 2\n1 4\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n3 2 4 1\n3 3 6 5\n", "output": "3 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 4\n5 2 5 6 3 1\n", "output": "3 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 1 5 4 6 2\n1 3\n", "output": "3 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 4 6\n4 1 3 2 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n4 2 1 6 4\n2 5 3\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 6\n5 1 3 2 5 4\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 4 6 3 2 1\n1 5\n", "output": "19 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 5\n5 4 6 3 2 1\n", "output": "19 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 1 5 4 3 2\n1 6\n", "output": "17 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 1 4 3 5 2\n1 6\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 1 4 2 5 3\n1 6\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 1 3 4 5 2\n1 6\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 1\n6 5 6 3 2 7 4\n", "output": "1 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n6 5 1 2 6 4 3\n1 7\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n6 3 5 2 1 6 4\n1 7\n", "output": "14 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 6\n6 1 2 5 4 7 3\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 4\n7 3 8 6 1 5 7 2\n", "output": "3 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n7 3 1 5 4 7 6 2\n1 8\n", "output": "41 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n8 3 1 4 5 2 6 9 8\n1 7\n", "output": "11 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n7 6 5 9 2 1 3 8\n2 7 4\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n8 7 4 3 1 6 5 9 2\n1 8\n", "output": "25 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n8 4 8 5 6 3 2 7 1\n1 9\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 9 3\n8 10 4 1 8 6 2 7 5\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 7 1\n8 8 2 4 3 5 6 10 9\n", "output": "2 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 5\n9 3 2 8 7 1 9 10 6 4\n", "output": "7 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 6 2 1 4 8 7 3 10 5\n1 9\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 10\n9 9 4 7 8 5 2 6 3 1\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5 1 2 7 9 6\n5 3 4 10 8 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 8 7 6 2 3 5 4 9 1\n1 10\n", "output": "105 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 10\n9 5 7 6 1 2 3 9 8 4\n", "output": "105 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 8 7 6 2 3 5 4 10 1\n1 9\n", "output": "103 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 4 6 5 3 1 8 9 7 2\n1 10\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 4 6 5 3 1 8 10 7 2\n1 9\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 4 9 6 5 8 3 2 7 1\n1 10\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 8 4 10\n7 1 2 6 7 3 9 5\n", "output": "37 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 6 2 7 1\n6 3 8 10 9 5 4\n", "output": "10 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 7 8\n8 3 5 2 10 4 9 1 6\n", "output": "12 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 7 5\n8 9 3 2 4 6 8 1 10\n", "output": "10 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 4 9 2\n7 5 1 6 8 3 7 10\n", "output": "7 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5 4 9 1 8 7\n5 6 10 3 5 2\n", "output": "21 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 4 5 1\n7 9 10 3 2 6 7 8\n", "output": "3 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 5 9 8\n7 2 3 7 10 1 6 4\n", "output": "19 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 5\n9 4 9 1 7 2 6 10 3 8\n", "output": "7 2", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 3 10 8 7\n6 4 2 5 6 1 9\n", "output": "8 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n8 1 6 5 3 8 7 10 4\n2 9 2\n", "output": "40 1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n1 1\n", "output": "1 1", "type": "stdin_stdout" } ] }
apps
verifiable_code
171
Solve the following coding problem using the programming language python: You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is displayed. Today your task is to implement such an automatic check. Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions: the password length is at least 5 characters; the password contains at least one large English letter; the password contains at least one small English letter; the password contains at least one digit. You are given a password. Please implement the automatic check of its complexity for company Q. -----Input----- The first line contains a non-empty sequence of characters (at most 100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".", ",", "_". -----Output----- If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes). -----Examples----- Input abacaba Output Too weak Input X12345 Output Too weak Input CONTEST_is_STARTED!!11 Output Correct The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python s = input().strip() flag1 = len(s) >= 5 d1 = 'qwertyuiopasdfghjklzxcvbnm' d2 = 'QWERTYUIOPASDFGHJKLZXCVBNM' d3 = '123456789' flag2 = False flag3 = False flag4 = False for i in d1: if i in s: flag2 = True for i in d2: if i in s: flag3 = True for i in d3: if i in s: flag4 = True if(flag1 and flag2 and flag3 and flag4): print("Correct") else: print("Too weak") ```
vfc_10438
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/411/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "abacaba\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "X12345\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "CONTEST_is_STARTED!!11\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1zA__\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1zA_\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "zA___\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1A___\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "z1___\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "_\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "a\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "D\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "_\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "?\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "?\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "._,.!.,...?_,!.\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "!_?_,?,?.,.,_!!!.!,.__,?!!,_!,?_,!??,?!..._!?_,?_!,?_.,._,,_.,.\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "?..!.,,?,__.,...????_???__!,?...?.,,,,___!,.!,_,,_,??!_?_,!!?_!_??.?,.!!?_?_.,!\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "XZX\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "R\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "H.FZ\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "KSHMICWPK,LSBM_JVZ!IPDYDG_GOPCHXFJTKJBIFY,FPHMY,CB?PZEAG..,X,.GFHPIDBB,IQ?MZ\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "EFHI,,Y?HMMUI,,FJGAY?FYPBJQMYM!DZHLFCTFWT?JOPDW,S_!OR?ATT?RWFBMAAKUHIDMHSD?LCZQY!UD_CGYGBAIRDPICYS\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "T,NDMUYCCXH_L_FJHMCCAGX_XSCPGOUZSY?D?CNDSYRITYS,VAT!PJVKNTBMXGGRYKACLYU.RJQ_?UWKXYIDE_AE\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "y\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "qgw\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "g\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "loaray\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "d_iymyvxolmjayhwpedocopqwmy.oalrdg!_n?.lrxpamhygps?kkzxydsbcaihfs.j?eu!oszjsy.vzu?!vs.bprz_j\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "txguglvclyillwnono\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "FwX\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Zi\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "PodE\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "SdoOuJ?nj_wJyf\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "MhnfZjsUyXYw?f?ubKA\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "CpWxDVzwHfYFfoXNtXMFuAZr\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9.,0\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5,8\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34__39_02!,!,82!129!2!566\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96156027.65935663!_87!,44,..7914_!0_1,.4!!62!.8350!17_282!!9.2584,!!7__51.526.7\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90328_\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "B9\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "P1H\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "J2\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "M6BCAKW!85OSYX1D?.53KDXP42F\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "C672F429Y8X6XU7S,.K9111UD3232YXT81S4!729ER7DZ.J7U1R_7VG6.FQO,LDH\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "W2PI__!.O91H8OFY6AB__R30L9XOU8800?ZUD84L5KT99818NFNE35V.8LJJ5P2MM.B6B\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "z1\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "p1j\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "j9\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "v8eycoylzv0qkix5mfs_nhkn6k!?ovrk9!b69zy!4frc?k\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "l4!m_44kpw8.jg!?oh,?y5oraw1tg7_x1.osl0!ny?_aihzhtt0e2!mr92tnk0es!1f,9he40_usa6c50l\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "d4r!ak.igzhnu!boghwd6jl\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "It0\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Yb1x\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Qf7\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Vu7jQU8.!FvHBYTsDp6AphaGfnEmySP9te\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Ka4hGE,vkvNQbNolnfwp\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Ee9oluD?amNItsjeQVtOjwj4w_ALCRh7F3eaZah\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Um3Fj?QLhNuRE_Gx0cjMLOkGCm\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Oq2LYmV9HmlaW\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Cq7r3Wrb.lDb_0wsf7!ruUUGSf08RkxD?VsBEDdyE?SHK73TFFy0f8gmcATqGafgTv8OOg8or2HyMPIPiQ2Hsx8q5rn3_WZe\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Wx4p1fOrEMDlQpTlIx0p.1cnFD7BnX2K8?_dNLh4cQBx_Zqsv83BnL5hGKNcBE9g3QB,!fmSvgBeQ_qiH7\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "k673,\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "LzuYQ\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Pasq!\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "x5hve\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "b27fk\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "h6y1l\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "i9nij\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Gf5Q6\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Uf24o\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Oj9vu\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "c7jqaudcqmv8o7zvb5x_gp6zcgl6nwr7tz5or!28.tj8s1m2.wxz5a4id03!rq07?662vy.7.p5?vk2f2mc7ag8q3861rgd0rmbr\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "i6a.,8jb,n0kv4.1!7h?p.96pnhhgy6cl7dg7e4o6o384ys3z.t71kkq,,w,oqi4?u,,m5!rzu6wym_4hm,ohjy!.vvksl?pt,,1\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "M10V_MN_1K8YX2LA!89EYV7!5V9?,.IDHDP6JEC.OGLY.180LMZ6KW3Z5E17IT94ZNHS!79GN09Q6LH0,F3AYNKP?KM,QP_?XRD6\n", "output": "Too weak\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Hi7zYuVXCPhaho68YgCMzzgLILM6toQTJq8akMqqrnUn6ZCD36iA1yVVpvlsIiMpCu!1QZd4ycIrQ5Kcrhk5k0jTrwdAAEEP_T2f\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Bk2Q38vDSW5JqYu.077iYC.9YoiPc!Dh6FJWOVze6?YXiFjPNa4F1RG?154m9mY2jQobBnbxM,cDV8l1UX1?v?p.tTYIyJO!NYmE\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "Ro1HcZ.piN,JRR88DLh,WtW!pbFM076?wCSbqfK7N2s5zUySFBtzk7HV,BxHXR0zALAr016z5jvvB.WUdEcKgYFav5TygwHQC..C\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "!?.,_\n", "output": "Too weak\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
172
Solve the following coding problem using the programming language python: In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5. The school director wants to redistribute students between groups so that each of the two groups has the same number of students whose academic performance is equal to 1, the same number of students whose academic performance is 2 and so on. In other words, the purpose of the school director is to change the composition of groups, so that for each value of academic performance the numbers of students in both groups are equal. To achieve this, there is a plan to produce a series of exchanges of students between groups. During the single exchange the director selects one student from the class A and one student of class B. After that, they both change their groups. Print the least number of exchanges, in order to achieve the desired equal numbers of students for each academic performance. -----Input----- The first line of the input contains integer number n (1 ≤ n ≤ 100) — number of students in both groups. The second line contains sequence of integer numbers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 5), where a_{i} is academic performance of the i-th student of the group A. The third line contains sequence of integer numbers b_1, b_2, ..., b_{n} (1 ≤ b_{i} ≤ 5), where b_{i} is academic performance of the i-th student of the group B. -----Output----- Print the required minimum number of exchanges or -1, if the desired distribution of students can not be obtained. -----Examples----- Input 4 5 4 4 4 5 5 4 5 Output 1 Input 6 1 1 1 1 1 1 5 5 5 5 5 5 Output 3 Input 1 5 3 Output -1 Input 9 3 2 5 5 2 3 3 3 2 4 1 4 1 1 2 4 4 1 Output 4 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0] * 5 b = [0] * 5 for j in range(n): a[A[j]-1] += 1 b[B[j]-1] +=1 per = 0 for j in range(5): if (a[j] + b[j]) % 2 == 1: per = 1 break if per == 1: print(-1) else: ans = 0 for j in range(5): if a[j] > b[j]: ans += (a[j] - b[j])//2 print(ans) ```
vfc_10442
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/779/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n5 4 4 4\n5 5 4 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 1 1 1\n5 5 5 5 5 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n5\n3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 2 2 3 3 4 4\n4 4 5 5 1 1 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 1 1\n2 2 2 2 2 2 2 2 2 2\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n2 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 5 5 5 5\n5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 5 5 3 5\n5 3 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 3 2 3 3\n2 3 2 2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 4 1 4 2\n1 2 4 2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n1 3 1 3 3 3 1 3 3 3 3 1 1 1 3 3 3 1 3 1 1 1 3 1 3 1 3 3 3 1 3 1 1 3 3 3 1 1 1 1 3 3 1 1 1 3 3 1 1 1\n1 3 1 3 3 1 1 3 1 3 3 1 1 1 1 3 3 1 3 1 1 3 1 1 3 1 1 1 1 3 3 1 3 3 3 3 1 3 3 3 3 3 1 1 3 3 1 1 3 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n1 1 1 4 1 1 4 1 4 1 1 4 1 1 4 1 1 4 1 1 4 1 4 4 4 1 1 4 1 4 4 4 4 4 4 4 1 4 1 1 1 1 4 1 4 4 1 1 1 4\n1 4 4 1 1 4 1 4 4 1 1 4 1 4 1 1 4 1 1 1 4 4 1 1 4 1 4 1 1 4 4 4 4 1 1 4 4 1 1 1 4 1 4 1 4 1 1 1 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n3 5 1 3 3 4 3 4 2 5 2 1 2 2 5 5 4 5 4 2 1 3 4 2 3 3 3 2 4 3 5 5 5 5 5 5 2 5 2 2 5 4 4 1 5 3 4 2 1 3\n3 5 3 2 5 3 4 4 5 2 3 4 4 4 2 2 4 4 4 3 3 5 5 4 3 1 4 4 5 5 4 1 2 5 5 4 1 2 3 4 5 5 3 2 3 4 3 5 1 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 3 1 3 1 1 3 1 1 3 1 3 1 1 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 1 1 1 3 1 1 1 3 1 1 3 3 1 3 3 1 3 1 3 3 3 3 1 1 3 3 3 1 1 3 1 3 3 3 1 3 3 3 3 3 1 3 3 3 3 1 3 1 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 1 1 3 1 1 1\n1 1 1 3 3 3 3 3 3 3 1 3 3 3 1 3 3 3 3 3 3 1 3 3 1 3 3 1 1 1 3 3 3 3 3 3 3 1 1 3 3 3 1 1 3 3 1 1 1 3 3 3 1 1 3 1 1 3 3 1 1 3 3 3 3 3 3 1 3 3 3 1 1 3 3 3 1 1 3 3 1 3 1 3 3 1 1 3 3 1 1 3 1 3 3 3 1 3 1 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 4 5 2 5 5 4 4 5 4 4 5 2 5 5 4 5 2 5 2 2 4 5 4 4 4 2 4 2 2 4 2 4 2 2 2 4 5 5 5 4 2 4 5 4 4 2 5 4 2 5 4 5 4 5 4 5 5 5 4 2 2 4 5 2 5 5 2 5 2 4 4 4 5 5 2 2 2 4 4 2 2 2 5 5 2 2 4 5 4 2 4 4 2 5 2 4 4 4 4\n4 4 2 5 2 2 4 2 5 2 5 4 4 5 2 4 5 4 5 2 2 2 2 5 4 5 2 4 2 2 5 2 5 2 4 5 5 5 2 5 4 4 4 4 5 2 2 4 2 4 2 4 5 5 5 4 5 4 5 5 5 2 5 4 4 4 4 4 2 5 5 4 2 4 4 5 5 2 4 4 4 2 2 2 5 4 2 2 4 5 4 4 4 4 2 2 4 5 5 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 4 3 3 4 3 1 4 2 1 3 1 1 2 4 4 4 4 1 1 4 1 4 4 1 1 2 3 3 3 2 4 2 3 3 3 1 3 4 2 2 1 3 4 4 3 2 2 2 4 2 1 2 1 2 2 1 1 4 2 1 3 2 4 4 4 2 3 1 3 1 3 2 2 2 2 4 4 1 3 1 1 4 2 3 3 4 4 2 4 4 2 4 3 3 1 3 2 4\n3 1 4 4 2 1 1 1 1 1 1 3 1 1 3 4 3 2 2 4 2 1 4 4 4 4 1 2 3 4 2 3 3 4 3 3 2 4 2 2 2 1 2 4 4 4 2 1 3 4 3 3 4 2 4 4 3 2 4 2 4 2 4 4 1 4 3 1 4 3 3 3 3 1 2 2 2 2 4 1 2 1 3 4 3 1 3 3 4 2 3 3 2 1 3 4 2 1 1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 4 5 2 1 5 5 2 1 5 1 5 1 1 1 3 4 5 1 1 2 3 3 1 5 5 4 4 4 1 1 1 5 2 3 5 1 2 2 1 1 1 2 2 1 2 4 4 5 1 3 2 5 3 5 5 3 2 2 2 1 3 4 4 4 4 4 5 3 1 4 1 5 4 4 5 4 5 2 4 4 3 1 2 1 4 5 3 3 3 3 2 2 2 3 5 3 1 3 4\n3 2 5 1 5 4 4 3 5 5 5 2 1 4 4 3 2 3 3 5 5 4 5 5 2 1 2 4 4 3 5 1 1 5 1 3 2 5 2 4 4 2 4 2 4 2 3 2 5 1 4 4 1 1 1 5 3 5 1 1 4 5 1 1 2 2 5 3 5 1 1 1 2 3 3 2 3 2 4 4 5 4 2 1 3 4 1 1 2 4 1 5 3 1 2 1 3 4 1 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 4 4 1 4 4 1 1 4 1 1 1 1 4 4 4 4 1 1 1 1 1 1 4 4 4 1 1 4 4 1 1 1 1 4 4 4 4 4 1 1 4 4 1 1 1 4 1 1 1 1 4 4 4 4 4 4 1 4 4 4 4 1 1 1 4 1 4 1 1 1 1 4 1 1 1 4 4 4 1 4 4 1 4 4 4 4 4 1 4 1 1 4 1 4 1 1 1 4 4\n4 1 1 4 4 4 1 4 4 4 1 1 4 1 1 4 1 4 4 4 1 1 4 1 4 1 1 1 4 4 1 4 1 4 1 4 4 1 1 4 1 4 1 1 1 4 1 4 4 4 1 4 1 4 4 4 4 1 4 1 1 4 1 1 4 4 4 1 4 1 4 1 4 4 4 1 1 4 1 4 4 4 4 1 1 1 1 1 4 4 1 4 1 4 1 1 1 4 4 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 2 5 2 2 3 3 2 5 3 2 5 3 3 3 5 2 2 5 5 3 3 5 3 2 2 2 3 2 2 2 2 3 5 3 3 2 3 2 5 3 3 5 3 2 2 5 5 5 5 5 2 3 2 2 2 2 3 2 5 2 2 2 3 5 5 5 3 2 2 2 3 5 3 2 5 5 3 5 5 5 3 2 5 2 3 5 3 2 5 5 3 5 2 3 3 2 2 2 2\n5 3 5 3 3 5 2 5 3 2 3 3 5 2 5 2 2 5 2 5 2 5 3 3 5 3 2 2 2 3 5 3 2 2 3 2 2 5 5 2 3 2 3 3 5 3 2 5 2 2 2 3 3 5 3 3 5 2 2 2 3 3 2 2 3 5 3 5 5 3 3 2 5 3 5 2 3 2 5 5 3 2 5 5 2 2 2 2 3 2 2 5 2 5 2 2 3 3 2 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 4 5 4 3 5 5 2 4 5 5 5 3 4 4 2 5 2 5 3 3 3 3 5 3 2 2 2 4 4 4 4 3 3 4 5 3 2 2 2 4 4 5 3 4 5 4 5 5 2 4 2 5 2 3 4 4 5 2 2 4 4 5 5 5 3 5 4 5 5 5 4 3 3 2 4 3 5 5 5 2 4 2 5 4 3 5 3 2 3 5 2 5 2 2 5 4 5 4 3\n5 4 2 4 3 5 2 5 5 3 4 5 4 5 3 3 5 5 2 3 4 2 3 5 2 2 2 4 2 5 2 4 4 5 2 2 4 4 5 5 2 3 4 2 4 5 2 5 2 2 4 5 5 3 5 5 5 4 3 4 4 3 5 5 3 4 5 3 2 3 4 3 4 4 2 5 3 4 5 5 3 5 3 3 4 3 5 3 2 2 4 5 4 5 5 2 3 4 3 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 4 2 2 2 1 4 5 5 5 4 4 5 5 1 3 2 1 4 5 2 3 4 4 5 4 4 4 4 5 1 3 5 5 3 3 3 3 5 1 4 3 5 1 2 4 1 3 5 5 1 3 3 3 1 3 5 4 4 2 2 5 5 5 2 3 2 5 1 3 5 4 5 3 2 2 3 2 3 3 2 5 2 4 2 3 4 1 3 1 3 1 5 1 5 2 3 5 4 5\n1 2 5 3 2 3 4 2 5 1 2 5 3 4 3 3 4 1 5 5 1 3 3 1 1 4 1 4 2 5 4 1 3 4 5 3 2 2 1 4 5 5 2 3 3 5 5 4 2 3 3 5 3 3 5 4 4 5 3 5 1 1 4 4 4 1 3 5 5 5 4 2 4 5 3 2 2 2 5 5 5 1 4 3 1 3 1 2 2 4 5 1 3 2 4 5 1 5 2 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 2 2 2 5 2 5 5 5 2 5 2 5 5 5 5 5 5 2 2 2 5 5 2 5 2 2 5 2 5 5 2 5 2 5 2 5 5 5 5 5 2 2 2 2 5 5 2 5 5 5 2 5 5 5 2 5 5 5 2 2 2 5 2 2 2 5 5 2 5 5 5 2 5 2 2 5 2 2 2 5 5 5 5 2 5 2 5 2 2 5 2 5 2 2 2 2 5 5 2\n5 5 2 2 5 5 2 5 2 2 5 5 5 5 2 5 5 2 5 2 2 5 2 2 5 2 5 2 2 5 2 5 2 5 5 2 2 5 5 5 2 5 5 2 5 5 5 2 2 5 5 5 2 5 5 5 2 2 2 5 5 5 2 2 5 5 2 2 2 5 2 5 5 2 5 2 5 2 2 5 5 2 2 5 5 2 2 5 2 2 5 2 2 2 5 5 2 2 2 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 2 2 1 2 3 3 2 2 1 1 3 3 1 1 1 2 1 2 3 2 3 3 3 1 2 3 1 2 1 2 3 3 2 1 1 1 1 1 2 2 3 2 1 1 3 3 1 3 3 1 3 1 3 3 3 2 1 2 3 1 3 2 2 2 2 2 2 3 1 3 1 2 2 1 2 3 2 3 3 1 2 1 1 3 1 1 1 2 1 2 2 2 3 2 3 2 1 1\n1 3 1 2 1 1 1 1 1 2 1 2 1 3 2 2 3 2 1 1 2 2 2 1 1 3 2 3 2 1 2 2 3 2 3 1 3 1 1 2 3 1 2 1 3 2 1 2 3 2 3 3 3 2 2 2 3 1 3 1 1 2 1 3 1 3 1 3 3 3 1 3 3 2 1 3 3 3 3 3 2 1 2 2 3 3 2 1 2 2 1 3 3 1 3 2 2 1 1 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 3 3 2 5 3 2 4 2 3 3 5 3 4 5 4 3 3 4 3 2 3 3 4 5 4 2 4 2 4 5 3 3 4 5 3 5 3 5 3 3 2 5 3 4 5 2 5 2 2 4 2 2 2 2 5 4 5 4 3 5 4 2 5 5 3 4 5 2 3 2 2 2 5 3 2 2 2 3 3 5 2 3 2 4 5 3 3 3 5 2 3 3 3 5 4 5 5 5 2\n4 4 4 5 5 3 5 5 4 3 5 4 3 4 3 3 5 3 5 5 3 3 3 5 5 4 4 3 2 5 4 3 3 4 5 3 5 2 4 2 2 2 5 3 5 2 5 5 3 3 2 3 3 4 2 5 2 5 2 4 2 4 2 3 3 4 2 2 2 4 4 3 3 3 4 3 3 3 5 5 3 4 2 2 3 5 5 2 3 4 5 4 5 3 4 2 5 3 2 4\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 3 4 4 2 5 1 1 4 4 3 5 5 1 4 4 2 5 3 2 1 1 3 2 4 4 4 2 5 2 2 3 1 4 1 4 4 5 3 5 1 4 1 4 1 5 5 3 5 5 1 5 3 5 1 3 3 4 5 3 2 2 4 5 2 5 4 2 4 4 1 1 4 2 4 1 2 2 4 3 4 1 1 1 4 3 5 1 2 1 4 5 4 4 2 1 4 1 3 2\n1 1 1 1 4 2 1 4 1 1 3 5 4 3 5 2 2 4 2 2 4 1 3 4 4 5 1 1 2 2 2 1 4 1 4 4 1 5 5 2 3 5 1 5 4 2 3 2 2 5 4 1 1 4 5 2 4 5 4 4 3 3 2 4 3 4 5 5 4 2 4 2 1 2 3 2 2 5 5 3 1 3 4 3 4 4 5 3 1 1 3 5 1 4 4 2 2 1 4 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 4 3 3 4 3 3 4 4 3 3 3 4 3 4 3 4 4 3 3 3 3 3 3 4 3 3 4 3 3 3 3 4 3 3 3 4 4 4 3 3 4 4 4 3 4 4 3 3 4 3 3 3 4 4 4 3 4 3 3 3 3 3 3 3 4 4 3 3 3 3 4 3 3 3 3 3 4 4 3 3 3 3 3 4 3 4 4 4 4 3 4 3 4 4 4 4 3 3\n4 3 3 3 3 4 4 3 4 4 4 3 3 4 4 3 4 4 4 4 3 4 3 3 3 4 4 4 3 4 3 4 4 3 3 4 3 3 3 3 3 4 3 3 3 3 4 4 4 3 3 4 3 4 4 4 4 3 4 4 3 3 4 3 3 4 3 4 3 4 4 4 4 3 3 4 3 4 4 4 3 3 4 4 4 4 4 3 3 3 4 3 3 4 3 3 3 3 3 3\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 2 5 2 5 4 2 5 5 4 4 2 4 4 2 4 4 5 2 5 5 2 2 4 4 5 4 5 5 5 2 2 2 2 4 4 5 2 4 4 4 2 2 5 5 4 5 4 4 2 4 5 4 2 4 5 4 2 4 5 4 4 4 4 4 5 4 2 5 2 5 5 5 5 4 2 5 5 4 4 2 5 2 5 2 5 4 2 4 2 4 5 2 5 2 4 2 4 2 4\n5 4 5 4 5 2 2 4 5 2 5 5 5 5 5 4 4 4 4 5 4 5 5 2 4 4 4 4 5 2 4 4 5 5 2 5 2 5 5 4 4 5 2 5 2 5 2 5 4 5 2 5 2 5 2 4 4 5 4 2 5 5 4 2 2 2 5 4 2 2 4 4 4 5 5 2 5 2 2 4 4 4 2 5 4 5 2 2 5 4 4 5 5 4 5 5 4 5 2 5\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5 3 2 5 2 4 4 3 3 5 4 5 5 2 5 4 5 4 3\n4 3 5 5 2 4 2 4 5 5 5 2 3 3 3 3 5 5 5 5 3 5 2 3 5 2 3 2 2 5 5 3 5 3 4 2 2 5 3 3 3 3 5 2 4 5 3 5 3 4 4 4 5 5 3 4 4 2 2 4 4 5 3 2 4 5 5 4 5 2 2 3 5 4 5 5 2 5 4 3 2 3 2 5 4 5 3 4 5 5 3 5 2 2 4 4 3 2 5 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 1 1 2 1 4 4 1 4 5 5 5 2 2 1 3 5 2 1 5 2 1 2 4 4 2 1 2 2 2 4 3 1 4 2 2 3 1 1 4 4 5 4 4 4 5 1 4 1 4 3 1 2 1 2 4 1 2 5 2 1 4 3 4 1 4 2 1 1 1 5 3 3 1 4 1 3 1 4 1 1 2 2 2 3 1 4 3 4 4 5 2 5 4 3 3 3 2 2 1\n5 1 4 4 3 4 4 5 2 3 3 4 4 2 3 2 3 1 3 1 1 4 1 5 4 3 2 4 3 3 3 2 3 4 1 5 4 2 4 2 2 2 5 3 1 2 5 3 2 2 1 1 2 2 3 5 1 2 5 3 2 1 1 2 1 2 4 3 5 4 5 3 2 4 1 3 4 1 4 4 5 4 4 5 4 2 5 3 4 1 4 2 4 2 4 5 4 5 4 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 4 3 3 3 3 3 3 3 3 3 3 1 3 1 3 3 3 3 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n3 3 3 4 3 3 3 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 1 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5\n3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5\n2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4\n", "output": "50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5\n2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 4 4 4 5\n4 5 5 5 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 1\n3 3 3 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 2 3 4\n1 2 3 3 4 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 2\n3 3 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 2 2\n4 4 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n3 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 3 3 3\n2 2 2 4 4 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 2 2 2\n1 1 1 1 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3\n2 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3\n4 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 4\n5 5 5 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3\n2 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n4 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 4 4 4 2 3 3 3 3 1\n2 2 2 2 4 1 1 1 1 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 3 3 4 4\n1 1 2 2 3 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 3 3 3 1\n1 1 1 1 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n2 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 2 2 3 3 3 3\n2 2 2 2 1 1 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 3 3\n1 1 1 1 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 2 3 3 4 4\n2 3 4 5 5 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 2 3 4\n3 3 4 4 1 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 3\n3 3 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n3 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 3 3 2 2\n2 2 2 3 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 2 3 4 1 2 3 4 1 2\n1 2 3 4 1 2 3 4 3 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2\n1 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n1 1 4\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 4 4 4\n3 3 4 4\n", "output": "-1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
173
Solve the following coding problem using the programming language python: Imagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each horizontal street, the traffic moves only from west to east or only from east to west. Also, traffic moves only from north to south or only from south to north in each vertical street. It is possible to enter a horizontal street from a vertical street, or vice versa, at their intersection. [Image] The mayor has received some street direction patterns. Your task is to check whether it is possible to reach any junction from any other junction in the proposed street direction pattern. -----Input----- The first line of input contains two integers n and m, (2 ≤ n, m ≤ 20), denoting the number of horizontal streets and the number of vertical streets. The second line contains a string of length n, made of characters '<' and '>', denoting direction of each horizontal street. If the i-th character is equal to '<', the street is directed from east to west otherwise, the street is directed from west to east. Streets are listed in order from north to south. The third line contains a string of length m, made of characters '^' and 'v', denoting direction of each vertical street. If the i-th character is equal to '^', the street is directed from south to north, otherwise the street is directed from north to south. Streets are listed in order from west to east. -----Output----- If the given pattern meets the mayor's criteria, print a single line containing "YES", otherwise print a single line containing "NO". -----Examples----- Input 3 3 ><> v^v Output NO Input 4 6 <><> v^v^v^ Output YES -----Note----- The figure above shows street directions in the second sample test case. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b = list(map(int, input().split(' '))) hor = input() ver = input() if (hor[0], ver[0]) == ('>', 'v') or (hor[0], ver[-1]) == ('<', 'v'): print("NO") elif (hor[-1], ver[0]) == ('>', '^') or (hor[-1], ver[-1]) == ('<', '^'): print("NO") else: print("YES") ```
vfc_10446
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/475/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 3\n><>\nv^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n<><>\nv^v^v^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n<>\nv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n>>\n^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n>><\n^^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n>><\n^v^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n>><\nv^^^^^^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 2\n<><<<<>\n^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n><<<\n^^^^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 20\n><\n^v^^v^^v^^^v^vv^vv^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 20\n<>\nv^vv^v^^vvv^^^v^vvv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 2\n<><<><<>><<<>><><<<<\n^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 2\n><>><>><>><<<><<><><\n^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 12\n><<<><><<>>\nvv^^^^vvvvv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n<<>>\nv^v^v^^vvvv^v^^vv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 11\n<<<<>><><<<<<><<\nvv^v^vvvv^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 7\n><<<<>>>>>>><<\nvv^^^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 14\n<<><>\nv^vv^^vv^v^^^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 18\n>>>><>>>\nv^vv^v^^^^^vvv^^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 18\n<<><>><<>><>><><<<\n^^v^v^vvvv^v^vv^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n<<<>\n^^^^^vv^vv^^vv^v^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 18\n><><>>><<<<<>>><<<>\n^^v^^v^^v^vv^v^vvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 20\n<<<><><<>><><<\nvvvvvvv^v^vvvv^^^vv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 18\n><>>><<<>><><>>>><\nvv^^^^v^v^^^^v^v^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 18\n<><<<>>>\n^^^^^^v^^^vv^^vvvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 12\n><><><<><><\n^^v^^^^^^^^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n<<>>\nv^v^v^^vvvv^v^^vv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 11\n>><<><<<<>>><><<\n^^^^vvvv^vv\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 7\n<><><<<>>>><>>\nvv^^v^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 14\n>>>><\n^v^v^^^vv^vv^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 18\n<<<><>>>\nv^^vvv^^v^v^vvvv^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 18\n><><<><><>>><>>>><\n^^vvv^v^^^v^vv^^^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n<<>>\nv^v^v^^vvvv^v^^vv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 18\n>>>><><<>>><<<><<<<\n^v^^^^vv^^v^^^^v^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 20\n<>><<<><<>>>>>\nvv^^v^^^^v^^vv^^vvv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 18\n><><<><><>>><>>>><\n^^vvv^v^^^v^vv^^^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 18\n<<<><>>>\nv^^vvv^^v^v^vvvv^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 19\n<><>>>>><<<<<><<>>>>\nv^vv^^vvvvvv^vvvv^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 19\n<<<><<<>><<<>><><><>\nv^v^vvv^vvv^^^vvv^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 20\n<><<<><><><<<<<<<<>\n^v^^^^v^^vvvv^^^^vvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 20\n>>>>>>>><>>><><<<><\n^v^v^^^vvv^^^v^^vvvv\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<<>>>><>><<>><<>>>>\n^vvv^^^^vv^^^^^v^^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n>>><><<><<<<<<<><<><\nvv^vv^vv^^^^^vv^^^^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<><<<<<<<>>><>>><<\n^^^^^^^^vvvv^vv^vvvv\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<>>>>>>>><>>><>><<<>\nvv^^vv^^^^v^vv^v^^^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><>><<>><>>>>>>>><<>\n^^v^vv^^^vvv^v^^^vv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<<<><<>><><<<>><<><\nv^^^^vvv^^^vvvv^v^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<<><<><>>><><<<<<<\nvv^^vvv^^v^^v^vv^vvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<>>><>>>><<<<>>><<>\nv^vv^^^^^vvv^^v^^v^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<><<><<<<<<>><><>>\nv^^^v^vv^^v^^vvvv^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<<<<<<<><>><><>><<<\n^vvv^^^v^^^vvv^^^^^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n>>><<<<<>>><><><<><<\n^^^vvv^^^v^^v^^v^vvv\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<><<<><><>><><><<<<>\n^^^vvvv^vv^v^^^^v^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n>>>>>>>>>><>>><>><>>\n^vvv^^^vv^^^^^^vvv^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<><>><><<<<<>><<>>><\nv^^^v^v^v^vvvv^^^vv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<<><<<><<<><>>>><<\nvvvv^^^^^vv^v^^vv^v^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<><<<<<<>>>>><<<>>>\nvvvvvv^v^vvv^^^^^^^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<><<>>>>><><>><>>>\nv^^^^vvv^^^^^v^v^vv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<>>><>><<>>>><<<><<\n^^vvv^^vvvv^vv^^v^v^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><<>><>>>><<><>><><<\n^v^^^^^^vvvv^v^v^v^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<<><<<<><><<>>><>>>>\n^^vvvvv^v^^^^^^^vvv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n>><<<<<<><>>>><>>><>\n^^^v^v^vv^^vv^vvv^^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n>>>>>>>>>>>>>>>>>>>>\nvvvvvvvvvvvvvvvvvvvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n><\nv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n<>\n^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n>><\nvvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n<>\nv^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n>>><\nvvv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<><><><><><><><><><>\nvvvvvvvvvvvvvvvvvvvv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n<>>>\nv^^^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n<><><><><><><><><><>\nv^v^v^v^v^v^v^v^v^v^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n<>\n^v^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n<><>\n^vv\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n<<>\nvv^\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n><\nvv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 6\n>>><>><\n^vv^vv\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n<<\nv^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n>><\n^^^\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n<><\nv^v\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20\n><><><><><><><><><><\n^v^v^v^v^v^v^v^v^v^v\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n<>>>\nvvv^\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
174
Solve the following coding problem using the programming language python: Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. Implication is written by using character '$\rightarrow$', and the arguments and the result of the implication are written as '0' (false) and '1' (true). According to the definition of the implication: $0 \rightarrow 0 = 1$ $0 \rightarrow 1 = 1$ $1 \rightarrow 0 = 0$ $1 \rightarrow 1 = 1$ When a logical expression contains multiple implications, then when there are no brackets, it will be calculated from left to fight. For example, $0 \rightarrow 0 \rightarrow 0 =(0 \rightarrow 0) \rightarrow 0 = 1 \rightarrow 0 = 0$. When there are brackets, we first calculate the expression in brackets. For example, $0 \rightarrow(0 \rightarrow 0) = 0 \rightarrow 1 = 1$. For the given logical expression $a_{1} \rightarrow a_{2} \rightarrow a_{3} \rightarrow \cdots \cdots a_{n}$ determine if it is possible to place there brackets so that the value of a logical expression is false. If it is possible, your task is to find such an arrangement of brackets. -----Input----- The first line contains integer n (1 ≤ n ≤ 100 000) — the number of arguments in a logical expression. The second line contains n numbers a_1, a_2, ..., a_{n} ($a_{i} \in \{0,1 \}$), which means the values of arguments in the expression in the order they occur. -----Output----- Print "NO" (without the quotes), if it is impossible to place brackets in the expression so that its value was equal to 0. Otherwise, print "YES" in the first line and the logical expression with the required arrangement of brackets in the second line. The expression should only contain characters '0', '1', '-' (character with ASCII code 45), '>' (character with ASCII code 62), '(' and ')'. Characters '-' and '>' can occur in an expression only paired like that: ("->") and represent implication. The total number of logical arguments (i.e. digits '0' and '1') in the expression must be equal to n. The order in which the digits follow in the expression from left to right must coincide with a_1, a_2, ..., a_{n}. The expression should be correct. More formally, a correct expression is determined as follows: Expressions "0", "1" (without the quotes) are correct. If v_1, v_2 are correct, then v_1->v_2 is a correct expression. If v is a correct expression, then (v) is a correct expression. The total number of characters in the resulting expression mustn't exceed 10^6. If there are multiple possible answers, you are allowed to print any of them. -----Examples----- Input 4 0 1 1 0 Output YES (((0)->1)->(1->0)) Input 2 1 1 Output NO Input 1 0 Output YES 0 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x = int(input()) seq = list(map(int, input().split(' '))) if seq == [0]: print("YES") print(0) elif seq == [0, 0]: print("NO") elif seq == [1, 0]: print("YES") print('1->0') elif seq == [0, 0, 0]: print("YES") print("(0->0)->0") elif seq == [1, 0, 0]: print("NO") elif seq[x-1] == 1: print("NO") #ENDS IN 1 elif seq[x-2] == 1: print("YES") print('->'.join([str(x) for x in seq])) #ENDS IN 10 elif seq == [1] * (x-2) + [0, 0]: print("NO") #000 BELOW elif seq[x-3] == 0: a = ('->'.join([str(x) for x in seq][0:x-3])) print("YES") print(a + '->(0->0)->0') #100 else: last = 0 for i in range(x-1): if seq[i] == 0 and seq[i+1] == 1: last = i seq[last] = '(0' seq[last+1] = '(1' seq[x-2] = '0))' print("YES") print('->'.join([str(x) for x in seq])) ```
vfc_10450
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/550/E", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n0 1 1 0\n", "output": "YES\n0->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 0\n", "output": "YES\n0->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 0 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n1 1 1 0 1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0\n", "output": "YES\n1->1->1->0->1->0->1->1->0->1->1->1->0->1->0->(0->(1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 0\n", "output": "YES\n1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 0 0\n", "output": "YES\n(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 1 0\n", "output": "YES\n0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 0\n", "output": "YES\n1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 0\n", "output": "YES\n0->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 1 0 0\n", "output": "YES\n(0->(1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 0 0\n", "output": "YES\n1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 1 0\n", "output": "YES\n1->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 0\n", "output": "YES\n1->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 0\n", "output": "YES\n0->0->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 1 0\n", "output": "YES\n0->0->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 0 0\n", "output": "YES\n0->(0->(1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 1 0\n", "output": "YES\n0->0->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 0 0 0\n", "output": "YES\n0->1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 0 1 0\n", "output": "YES\n0->1->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 1 0 0\n", "output": "YES\n(0->(1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 1 1 0\n", "output": "YES\n0->1->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 0 0 0\n", "output": "YES\n1->0->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 0 1 0\n", "output": "YES\n1->0->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 1 0 0\n", "output": "YES\n1->(0->(1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 1 1 0\n", "output": "YES\n1->0->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 0 0 0\n", "output": "YES\n1->1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 0 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 0 1 0\n", "output": "YES\n1->1->0->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 0 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 0\n", "output": "YES\n1->1->1->1->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 1 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 1 1 1 0 0\n", "output": "YES\n(0->(1->1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 0 0 0\n", "output": "YES\n1->1->1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 0 0 0 0\n", "output": "YES\n0->0->0->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 0 0 1 0 0\n", "output": "YES\n1->0->(0->(1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 0 1 1 0 0\n", "output": "YES\n1->(0->(1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 1 1 0 0\n", "output": "YES\n0->(0->(1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 0 1 0 0\n", "output": "YES\n0->0->(0->(1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 1 0 0 0\n", "output": "YES\n0->0->1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0\n", "output": "YES\n1->0->1->0->1->0->1->(0->(1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0\n", "output": "YES\n0->0->1->0->0->0->0->0->0->1->1->0->1->0->1->0->1->(0->(1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0\n", "output": "YES\n(0->(1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->1->0))->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n1 1 0 1 0 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0\n", "output": "YES\n1->1->0->1->0->1->1->1->1->1->0->1->0->0->1->1->1->0->0->0->0->1->1->1->1->1->0->1->0->0->0->1->0->1->0->0->1->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->0->(0->0)->0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0\n", "output": "YES\n1->1->1->1->1->0->0->0->0->0->1->1->1->1->1->0->0->(0->0)->0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
175
Solve the following coding problem using the programming language python: You have two variables a and b. Consider the following sequence of actions performed with these variables: If a = 0 or b = 0, end the process. Otherwise, go to step 2; If a ≥ 2·b, then set the value of a to a - 2·b, and repeat step 1. Otherwise, go to step 3; If b ≥ 2·a, then set the value of b to b - 2·a, and repeat step 1. Otherwise, end the process. Initially the values of a and b are positive integers, and so the process will be finite. You have to determine the values of a and b after the process ends. -----Input----- The only line of the input contains two integers n and m (1 ≤ n, m ≤ 10^18). n is the initial value of variable a, and m is the initial value of variable b. -----Output----- Print two integers — the values of a and b after the end of the process. -----Examples----- Input 12 5 Output 0 1 Input 31 12 Output 7 12 -----Note----- Explanations to the samples: a = 12, b = 5 $\rightarrow$ a = 2, b = 5 $\rightarrow$ a = 2, b = 1 $\rightarrow$ a = 0, b = 1; a = 31, b = 12 $\rightarrow$ a = 7, b = 12. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b = [int(v) for v in input().split()] while a > 0 and b > 0: if a >= 2 * b: a %= 2 * b elif b >= 2 * a: b %= 2 * a else: break print(a, b) ```
vfc_10454
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/946/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "12 5\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31 12\n", "output": "7 12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 7\n", "output": "8 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31960284556200 8515664064180\n", "output": "14928956427840 8515664064180\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000\n", "output": "1000000000000000000 1000000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 99999999999999999\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000001 500000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 19\n", "output": "6 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22 5\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000000000000 100000000000000001\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000000000\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n", "output": "2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "51 100\n", "output": "51 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000000000000000000\n", "output": "3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 3\n", "output": "4 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8796203 7556\n", "output": "1019 1442\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 22\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000000\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4567865432345678\n", "output": "5 8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "576460752303423487 288230376151711743\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "499999999999999999 1000000000000000000\n", "output": "3 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9999999999999\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "103 1000000000000000000\n", "output": "103 196\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000001 10000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10\n", "output": "5 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 11\n", "output": "7 11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 123456789123456\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000000000000 100000000000001\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000 1\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 499999999999999999\n", "output": "2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5\n", "output": "0 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 18917827189272\n", "output": "9 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "179 100000000000497000\n", "output": "179 270\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 100000000000001\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 20\n", "output": "5 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000001 50000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "345869461223138161 835002744095575440\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8589934592 4294967296\n", "output": "0 4294967296\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 8\n", "output": "4 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 333333333333333\n", "output": "1000 1333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 12\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24 54\n", "output": "0 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 12\n", "output": "6 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "129200000000305 547300000001292\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 49999999999999999\n", "output": "20 39\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 123456789876\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n", "output": "2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 46\n", "output": "3 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n", "output": "3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "129 1000000000000000000\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 29\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8589934592 2147483648\n", "output": "0 2147483648\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2147483648 8589934592\n", "output": "2147483648 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n", "output": "5 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 2\n", "output": "0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 7\n", "output": "2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17174219820754872 61797504734333370\n", "output": "17174219820754872 27449065092823626\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 100\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 17\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 10000001\n", "output": "0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49999999999999999 2\n", "output": "3 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49999999999999999 1\n", "output": "1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "576460752303423487 2\n", "output": "3 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19395 19395\n", "output": "19395 19395\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19394 19394\n", "output": "19394 19394\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
176
Solve the following coding problem using the programming language python: Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k. -----Input----- The only line contains three space-separated integers k, a and b (1 ≤ k ≤ 10^18; - 10^18 ≤ a ≤ b ≤ 10^18). -----Output----- Print the required number. -----Examples----- Input 1 1 10 Output 10 Input 2 -4 4 Output 5 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python s=input() ast=[int(i) for i in s.split(' ')] k,a,b=ast[0],ast[1],ast[2] s1=(a-1)//k s2=b//k print(s2-s1) ```
vfc_10458
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/597/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 1 10\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -4 4\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10181 10182\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10182 10183\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 -191 1011\n", "output": "1203\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -7 -6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -7 -5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -6 -6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -6 -4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -6 13\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -19171 1911\n", "output": "10541\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 123 456\n", "output": "112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 124 456\n", "output": "111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 125 456\n", "output": "111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 381 281911\n", "output": "93844\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 381 281912\n", "output": "93844\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 381 281913\n", "output": "93845\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 382 281911\n", "output": "93843\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 382 281912\n", "output": "93843\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 382 281913\n", "output": "93844\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 383 281911\n", "output": "93843\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 383 281912\n", "output": "93843\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 383 281913\n", "output": "93844\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -381 281911\n", "output": "94098\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -381 281912\n", "output": "94098\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -381 281913\n", "output": "94099\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -380 281911\n", "output": "94097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -380 281912\n", "output": "94097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -380 281913\n", "output": "94098\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -379 281911\n", "output": "94097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -379 281912\n", "output": "94097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -379 281913\n", "output": "94098\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191381 -1911\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191381 -1910\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191381 -1909\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191380 -1911\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191380 -1910\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191380 -1909\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191379 -1911\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191379 -1910\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -191379 -1909\n", "output": "63157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -2810171 0\n", "output": "936724\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 29101\n", "output": "9701\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -2810170 0\n", "output": "936724\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 29102\n", "output": "9701\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -2810169 0\n", "output": "936724\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 29103\n", "output": "9702\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 -1000000000000000000 1000000000000000000\n", "output": "2000000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -1000000000000000000 1000000000000000000\n", "output": "1000000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -1000000000000000000 1000000000000000000\n", "output": "666666666666666667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 -1000000000000000000 1000000000000000000\n", "output": "500000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 -1000000000000000000 1000000000000000000\n", "output": "400000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 -1000000000000000000 1000000000000000000\n", "output": "333333333333333333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 -1000000000000000000 1000000000000000000\n", "output": "285714285714285715\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 -1000000000000000000 -100000000000000000\n", "output": "900000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -1000000000000000000 -10000000000000000\n", "output": "495000000000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 -1000000000000000000 -10218000000000000\n", "output": "329927333333333334\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 -1000000000000000000 -320110181919100\n", "output": "249919972454520226\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 -1000000000000000000 -402710171917\n", "output": "199999919457965617\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 -1000000000000000000 -6666666666\n", "output": "166666665555555556\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 -1000000000000000000 -77777777777778\n", "output": "142846031746031746\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 -1000000000000000000 1000000000000000000\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 0 1000000000000000000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000321 1000000000000000000 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000321 -1000000000000000000 1000000000000000000\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 0 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 -1 -1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 -2 -1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "142000000000000271 -228118171 -1382811\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1000000000000000000\n", "output": "1000000000000000000\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
177
Solve the following coding problem using the programming language python: Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536... Your task is to print the $k$-th digit of this sequence. -----Input----- The first and only line contains integer $k$ ($1 \le k \le 10000$) — the position to process ($1$-based index). -----Output----- Print the $k$-th digit of the resulting infinite sequence. -----Examples----- Input 7 Output 7 Input 21 Output 5 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a = int(input()) s = "" for i in range(1, a+1): s += str(i) print(s[a-1]) ```
vfc_10462
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1177/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "7\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "188\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "189\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "190\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "191\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "192\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "193\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "194\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "195\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "196\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "197\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "198\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "199\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "400\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "417\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "521\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "511\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2878\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2879\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2880\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2881\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2882\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2883\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2884\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2885\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2886\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2887\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2888\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2889\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2890\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2891\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2892\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2893\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2894\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2895\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2896\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2897\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2898\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2899\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2900\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2901\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9900\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9990\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9991\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9992\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9993\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9994\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9995\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9996\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9997\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9998\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "193\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
178
Solve the following coding problem using the programming language python: A telephone number is a sequence of exactly $11$ digits such that its first digit is 8. Vasya and Petya are playing a game. Initially they have a string $s$ of length $n$ ($n$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a character and erase it from the current string. For example, if the current string 1121, after the player's move it may be 112, 111 or 121. The game ends when the length of string $s$ becomes 11. If the resulting string is a telephone number, Vasya wins, otherwise Petya wins. You have to determine if Vasya has a winning strategy (that is, if Vasya can win the game no matter which characters Petya chooses during his moves). -----Input----- The first line contains one integer $n$ ($13 \le n < 10^5$, $n$ is odd) — the length of string $s$. The second line contains the string $s$ ($|s| = n$) consisting only of decimal digits. -----Output----- If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. -----Examples----- Input 13 8380011223344 Output YES Input 15 807345619350641 Output NO -----Note----- In the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number. In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone number, because there is no digit 8 at all. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, s = int(input()), input() cnt = (n - 11) // 2 cnt_8 = len(s[:n - 10].split('8')) - 1 if (cnt >= cnt_8): print ("NO") else: print ("YES") ```
vfc_10466
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1155/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "13\n8380011223344\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n807345619350641\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n8181818181111111111\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29\n88811188118181818118111111111\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n980848088815548\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n9999999998888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n0000008888888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2480011223348\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n87879887989788999\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n123456788888812378910\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n008880000000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n888888888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n118388111881111\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8489031863524\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n88818818888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8899989999989\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1111111111188\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n4366464181897\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n888888888888888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n778887777777777\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8830011223344\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8888888888848\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1181111111111\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8000000000000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1885498606803\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n008888888888808\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n961618782888818\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8789816534772\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8898173131489\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8800000000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2808118288444\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n880000000000000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8086296018422\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1841516902093\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31\n0088888888888880000000000088888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8559882884055\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n3348729291920\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n00000000088888888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n3388888888888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n11111118888888888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n6831940550586\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n008888888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8701234567790\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2822222225888\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n0178528856351\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n0088888888880\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n181888888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109\n8800880880088088880888808880888088800880888088088088888080880000080000800000808008008800080008000888000808880\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "47\n08800008800800000088088008800080088800000808008\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2828222222222\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95\n00008080008880080880888888088800008888000888800800000808808800888888088080888808880080808088008\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "71\n08880000000000808880808800880000008888808008008080880808088808808888080\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41\n00008080008088080080888088800808808008880\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n88338486848889054012825\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n11868668827888348121163\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2877892266089\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n1845988185966619131\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n28681889938480569\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n8881328076293351500\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8665978038580\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n8896797594523\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n79818882846090973951051\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n8848893007368770958\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n860388889843547436129\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n0880080008088\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n83130469783251338\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n1341126906009\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n83848888383730797684584\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n488081563941254\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n974378875888933268270\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2488666312263\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n880082334812345\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n348808698904345\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n200080200228220\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41\n11111111111111188888888888888812345674901\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n5501838801564629168\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n000000000000000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n88888888888888888888888\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n00000000000000000000000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33\n888888888880000000000900000000000\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
179
Solve the following coding problem using the programming language python: Andrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number $x$ in an array. For an array $a$ indexed from zero, and an integer $x$ the pseudocode of the algorithm is as follows: BinarySearch(a, x) left = 0 right = a.size() while left < right middle = (left + right) / 2 if a[middle] <= x then left = middle + 1 else right = middle if left > 0 and a[left - 1] == x then return true else return false Note that the elements of the array are indexed from zero, and the division is done in integers (rounding down). Andrey read that the algorithm only works if the array is sorted. However, he found this statement untrue, because there certainly exist unsorted arrays for which the algorithm find $x$! Andrey wants to write a letter to the book authors, but before doing that he must consider the permutations of size $n$ such that the algorithm finds $x$ in them. A permutation of size $n$ is an array consisting of $n$ distinct integers between $1$ and $n$ in arbitrary order. Help Andrey and find the number of permutations of size $n$ which contain $x$ at position $pos$ and for which the given implementation of the binary search algorithm finds $x$ (returns true). As the result may be extremely large, print the remainder of its division by $10^9+7$. -----Input----- The only line of input contains integers $n$, $x$ and $pos$ ($1 \le x \le n \le 1000$, $0 \le pos \le n - 1$) — the required length of the permutation, the number to search, and the required position of that number, respectively. -----Output----- Print a single number — the remainder of the division of the number of valid permutations by $10^9+7$. -----Examples----- Input 4 1 2 Output 6 Input 123 42 24 Output 824071958 -----Note----- All possible permutations in the first test case: $(2, 3, 1, 4)$, $(2, 4, 1, 3)$, $(3, 2, 1, 4)$, $(3, 4, 1, 2)$, $(4, 2, 1, 3)$, $(4, 3, 1, 2)$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python MOD = 1000000007 def f(n, cnt): """ n! / (n - cnt)! """ ans = 1 for _ in range(cnt): ans = (ans * n) % MOD n -= 1 return ans def main(): n, x, pos = list(map(int, input().split())) chk1 = 0 chk_r = 0 left = 0 right = n while left < right: middle = (left + right) // 2 if middle <= pos: if middle < pos: chk1 += 1 left = middle + 1 else: chk_r += 1 right = middle if chk1 > x - 1 or chk_r > n - x: print(0) else: # (x - 1)! / (x - 1 - chk1)! * (n - x)! / (n - x - chk_r)! * (n - chk1 - chk_r - 1)! rest = n - chk1 - chk_r - 1 print(f(x - 1, chk1) * f(n - x, chk_r) * f(rest, rest) % MOD) main() ```
vfc_10470
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1436/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 1 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123 42 24\n", "output": "824071958\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 501 501\n", "output": "646597996\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 999 799\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 1\n", "output": "720\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 7 6\n", "output": "720\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 2 4\n", "output": "120\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 4 4\n", "output": "216\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 4 1\n", "output": "1440\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 1 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 8 7\n", "output": "5040\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 7 6\n", "output": "720\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3 0\n", "output": "1440\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 1 7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 9 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 5 5\n", "output": "5760\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 4 4\n", "output": "7200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 3 3\n", "output": "8640\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1 1\n", "output": "362880\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 9\n", "output": "362880\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5 5\n", "output": "43200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 3 7\n", "output": "70560\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 4 4\n", "output": "90720\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 6 6\n", "output": "43200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 7 7\n", "output": "90720\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "74 16 54\n", "output": "625981152\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63 15 45\n", "output": "581829795\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "54 4 47\n", "output": "911648281\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 22 62\n", "output": "628152721\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82 15 14\n", "output": "187724629\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 60 48\n", "output": "233776714\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 51 5\n", "output": "660447677\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 45 16\n", "output": "578976138\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "61 21 16\n", "output": "516359078\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "61 29 15\n", "output": "252758304\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 67 68\n", "output": "736622722\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59 40 1\n", "output": "384105577\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98 86 39\n", "output": "132656801\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 89 29\n", "output": "673334741\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "78 66 16\n", "output": "703501645\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "777 254 720\n", "output": "57449468\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "908 216 521\n", "output": "601940707\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "749 158 165\n", "output": "849211382\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "535 101 250\n", "output": "111877808\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "665 5 305\n", "output": "400272219\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "856 406 675\n", "output": "663368144\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "697 390 118\n", "output": "844062514\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "539 246 0\n", "output": "410139856\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "669 380 461\n", "output": "921432102\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "954 325 163\n", "output": "917113541\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "646 467 58\n", "output": "214437899\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "542 427 258\n", "output": "830066531\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "562 388 191\n", "output": "935998075\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "958 817 269\n", "output": "513948977\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 888 888\n", "output": "644649893\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 2 2\n", "output": "22779421\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "534 376 180\n", "output": "984450056\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1 1\n", "output": "756641425\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 3 3\n", "output": "606772288\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 500 500\n", "output": "646597996\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000 999\n", "output": "756641425\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 501 50\n", "output": "636821580\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 3\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 5 50\n", "output": "469732450\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 490 499\n", "output": "998308393\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3 3\n", "output": "288\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 7 5\n", "output": "4320\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123 1 24\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 2\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
180
Solve the following coding problem using the programming language python: Andrey received a postcard from Irina. It contained only the words "Hello, Andrey!", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypted message, and decided to decrypt it. Andrey noticed that snowflakes and candy canes always stand after the letters, so he supposed that the message was encrypted as follows. Candy cane means that the letter before it can be removed, or can be left. A snowflake means that the letter before it can be removed, left, or repeated several times. For example, consider the following string: [Image] This string can encode the message «happynewyear». For this, candy canes and snowflakes should be used as follows: candy cane 1: remove the letter w, snowflake 1: repeat the letter p twice, candy cane 2: leave the letter n, snowflake 2: remove the letter w, snowflake 3: leave the letter e. [Image] Please note that the same string can encode different messages. For example, the string above can encode «hayewyar», «happpppynewwwwwyear», and other messages. Andrey knows that messages from Irina usually have a length of $k$ letters. Help him to find out if a given string can encode a message of $k$ letters, and if so, give an example of such a message. -----Input----- The first line contains the string received in the postcard. The string consists only of lowercase Latin letters, as well as the characters «*» and «?», meaning snowflake and candy cone, respectively. These characters can only appear immediately after the letter. The length of the string does not exceed $200$. The second line contains an integer number $k$ ($1 \leq k \leq 200$), the required message length. -----Output----- Print any message of length $k$ that the given string can encode, or «Impossible» if such a message does not exist. -----Examples----- Input hw?ap*yn?eww*ye*ar 12 Output happynewyear Input ab?a 2 Output aa Input ab?a 3 Output aba Input ababb 5 Output ababb Input ab?a 1 Output Impossible The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python s = input() k = int(input()) c = 0 p = 0 has_star = False for i in range(len(s)): if s[i] in ['*', '?']: if s[i] == '*': has_star = True c -= 1 else: p += 1 c += 1 if k < c: print("Impossible") elif (not has_star) and (k > p): print("Impossible") else: signs_to_add = k - c ans = "" for i in s: if signs_to_add == 0: if i not in ['*', '?']: ans += i else: ans = ans[:-1] continue if i == '?': signs_to_add -= 1 elif i == '*': signs_to_add -= 1 while signs_to_add > 0: ans += ans[-1] signs_to_add -= 1 else: ans += i print(ans) ```
vfc_10474
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1099/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "hw?ap*yn?eww*ye*ar\n12\n", "output": "hwapppyewyar", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab?a\n2\n", "output": "aa", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab?a\n3\n", "output": "aba", "type": "stdin_stdout" }, { "fn_name": null, "input": "ababb\n5\n", "output": "ababb", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab?a\n1\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "z\n1\n", "output": "z", "type": "stdin_stdout" }, { "fn_name": null, "input": "n\n96\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "c*b*dosavq*gwy*e*j?jx?t?li*m?fik*m*l?i?b?z?kv*wm*u*j?h?o?hg*c*hf?l*n*dl*q*t?bi*m?g*c*k?p*e*di*o?iqfn*sj?k*t?zyqz*ihjpt?a?vr?a*r\n83\n", "output": "ccccccccccccccccccccccccccccccccccccccccccccccccccccdosavgwjlfikwhhdbdiqfszyqihjpvr", "type": "stdin_stdout" }, { "fn_name": null, "input": "a?u?kb*exg?l*z?xc?gbpbms*vc?ll*u*qy*g*k?k*ky?n?r?qur?m*kyr*gd?o*t*hw*hzk*u*vq*j*v*ag*ljyiu?uy*qqub?y?hbp*zsr*u*m*a?hx*ca*vvn?c\n55\n", "output": "aukbbbbbbbbbbbbbexxgbpbmvlqkqukyghhzvaljyiuqquhbzshcvvc", "type": "stdin_stdout" }, { "fn_name": null, "input": "jkhu?wd?fxtgkrqmqukirdwywr?yk?hmdz?xghwgkr?pkbvsx?xe?l?\n57\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "gfkesp?jh?enf?rnu?riyu?mcvtswlzerx?mumzrqh?aqbbdujqwdwezqrsn?hqxpxsq?rh?cqgzxlchgtoyevlrojxovstvo?bw\n79\n", "output": "gfkespjenrnriymcvtswlzermumzrqaqbbdujqwdwezqrshqxpxsrcqgzxlchgtoyevlrojxovstvbw", "type": "stdin_stdout" }, { "fn_name": null, "input": "s?g?h?e?m?h?i?t?m?e?y?z?r?a?c?r?p?v?f?o?r?z?q?t?s?c?o?z?h?z\n34\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw\n200\n", "output": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw", "type": "stdin_stdout" }, { "fn_name": null, "input": "gpejouiegzleonpiwdchbwdkjdrqsxvydqjqilapciriackdiamzxvxizagjouqhoagefmildgxxxafuxuingzaosxjzmuwlfpfccjllogrwlfxpacgdgxmqgzguqqmwynmutfpnuigclbsphhimpvsckcnxrvenhvtgegkxemybpluactvv\n91\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "wd?t?a?fk?pnuuetr?emvsfrppk?o?emnskin?pn?qyv?d?rs?hvmqtwew?sy?efn?badndz?p?xixeeiofsfqewp?t?f?sgdlcw\n63\n", "output": "wdtafpnuuetemvsfrppemnskipqyrhvmqtwesefbadndxixeeiofsfqewsgdlcw", "type": "stdin_stdout" }, { "fn_name": null, "input": "c?dhff?f?y?m?h?i?fj?v?rz?v?bh?m?m?t?x?g?yn?e?a?q?fb?t?k?xvsk?v?i?a?zcrz?f?i?c?ge?jo?g?j?l?suj?u?c?h?\n15\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "m?tsw\n98\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "z*mt*o?mxh?g\n11\n", "output": "zzzzzzzmmxg", "type": "stdin_stdout" }, { "fn_name": null, "input": "npra?bhx?rr*w?f*t\n14\n", "output": "nprabhxrrrrrrt", "type": "stdin_stdout" }, { "fn_name": null, "input": "d*b*w?j?n*kc?e?rdp*ca?u*gg?\n29\n", "output": "ddddddddddddddddddddddddkrdcg", "type": "stdin_stdout" }, { "fn_name": null, "input": "zymhgthoob\n10\n", "output": "zymhgthoob", "type": "stdin_stdout" }, { "fn_name": null, "input": "flvlowstjhhx\n6\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "grzlreuaqtgs\n12\n", "output": "grzlreuaqtgs", "type": "stdin_stdout" }, { "fn_name": null, "input": "gqososjozfdbrdlkggisefpuruqcqvstqnfktvysoiauxumctikhwuvdbetvpbzlcqhgsjdzzzgburoayzsdkhfkfdwunmxt\n94\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "mxneywurhzffwkfkrcmesdczjpeqgxfttmomdhgwwndudvabntrwegfouthzjrhjqancqgcputqzdvgsqzivuctnpzjbgjdo\n96\n", "output": "mxneywurhzffwkfkrcmesdczjpeqgxfttmomdhgwwndudvabntrwegfouthzjrhjqancqgcputqzdvgsqzivuctnpzjbgjdo", "type": "stdin_stdout" }, { "fn_name": null, "input": "cqbpdkhounszhavfvgjqogwnwblypesjyvjiqxartehljficmjcfvgiwcknmilplixlbcuzifkgxvawlhmzufjgxhkfodihhsguc\n100\n", "output": "cqbpdkhounszhavfvgjqogwnwblypesjyvjiqxartehljficmjcfvgiwcknmilplixlbcuzifkgxvawlhmzufjgxhkfodihhsguc", "type": "stdin_stdout" }, { "fn_name": null, "input": "afwugkkewbpehxxokgqrldztdxclciigzqbwipfpbuzmlksbvphclblhslgujqfdyjgwkbakiketyhgnlqroeqecuwxriqmmkuky\n10\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "f?\n1\n", "output": "f", "type": "stdin_stdout" }, { "fn_name": null, "input": "n?l\n2\n", "output": "nl", "type": "stdin_stdout" }, { "fn_name": null, "input": "s?l\n8\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "u?wp?v?k?yxlp\n7\n", "output": "uwpyxlp", "type": "stdin_stdout" }, { "fn_name": null, "input": "mrx?ut?aefu?mr?ivh?kt?jpirdn?cjgpk?s?dd\n11\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "u?q?l?x?g?g?u?l?l?f?z?q\n8\n", "output": "uqlxgguq", "type": "stdin_stdout" }, { "fn_name": null, "input": "zr\n7\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "n*\n98\n", "output": "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn", "type": "stdin_stdout" }, { "fn_name": null, "input": "w*r\n15\n", "output": "wwwwwwwwwwwwwwr", "type": "stdin_stdout" }, { "fn_name": null, "input": "k*n\n2\n", "output": "kn", "type": "stdin_stdout" }, { "fn_name": null, "input": "zm*g*ho*mo\n12\n", "output": "zmmmmmmmmhmo", "type": "stdin_stdout" }, { "fn_name": null, "input": "np*lr*lg*br*t*x\n26\n", "output": "npppppppppppppppppppppllbx", "type": "stdin_stdout" }, { "fn_name": null, "input": "db*wm*zn*k*ibe*w*x*d*f\n42\n", "output": "dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbwzibf", "type": "stdin_stdout" }, { "fn_name": null, "input": "aobs*fhm*w*da*u*a*s*b*l*qxnfbv*ct*nmt*x*t*g*n*oni*oo*c*bu*to*eooa*\n43\n", "output": "aobsssssssssssssssssssssfhdqxnfbcnmonobteoo", "type": "stdin_stdout" }, { "fn_name": null, "input": "n*zc*lb*e*ppp*\n14\n", "output": "nnnnnnnnnnzlpp", "type": "stdin_stdout" }, { "fn_name": null, "input": "ya*tspfh*qmjmhx*ja*ql*w*i*vt*g*hehet*x*t*j*uo*o*s*p*bv*\n29\n", "output": "yaaaaaaaaaatspfqmjmhjqvheheub", "type": "stdin_stdout" }, { "fn_name": null, "input": "nze*bf*wq*bx*idy*ml*sn*y*cpp*u*cz*v*ht*e*mwlq*izh*p*uq*v*j*r*z*r*n\n45\n", "output": "nzeeeeeeeeeeeeeeeeeeeeeeeeebwbidmscpchmwlizun", "type": "stdin_stdout" }, { "fn_name": null, "input": "cb*dhu*s*hv*vjow*w*lps*y*jq*a*th*j*im*c*vicni*p*i*l*czfg*vw*hzf*g*hfdh*suh*a*f*x*r*j*nlq*t*w*h*imtku\n9\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*wgkw*ph*xkq*l*z*d*c*cizbi*f*bzls*v*hl*l*s*gjf*y*gk*aie*y*g*lreeux*imkku*rg*c*s*ot*hea*izkos*nqj*va\n66\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaawgkpxkcizbbzlhgjgailreeuimkkroheizkonqva", "type": "stdin_stdout" }, { "fn_name": null, "input": "w*r?\n3\n", "output": "www", "type": "stdin_stdout" }, { "fn_name": null, "input": "k*n?\n99\n", "output": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", "type": "stdin_stdout" }, { "fn_name": null, "input": "gj?g\n10\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "h*y?i\n95\n", "output": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhi", "type": "stdin_stdout" }, { "fn_name": null, "input": "c*vb*a*r\n12\n", "output": "ccccccccccvr", "type": "stdin_stdout" }, { "fn_name": null, "input": "au*e?f*h?hdza*sp*zxw*i*qc?x?m*t*xf?nciic?a*doi?o?t*q*v?r?hl?r?ol?l?pu*p?m?zz*a*k\n35\n", "output": "auuuuuuuuuuuuuuuhdzszxqxnciidohopzk", "type": "stdin_stdout" }, { "fn_name": null, "input": "cii*f*hrlorz*a?l\n17\n", "output": "ciiiiiiiiiihrlorl", "type": "stdin_stdout" }, { "fn_name": null, "input": "y?f*sp*f*ha?ji*e?j*ac?w*iag*h*ei*w?xp*d*qol?b*vz*mx?l*n?nxw?n?mu*syi*tb\n26\n", "output": "yffffffshjaiaexqovmnxmsytb", "type": "stdin_stdout" }, { "fn_name": null, "input": "n*zj*aw?jx*i*d*yc?srcm?u?w*r?hvmk?qq*g*jud*nrn*ng*x*v?cc*dg*wsnudwejta?pee*kc*x*tz?\n72\n", "output": "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnzajysrchvmqjunrncdwsnudwejtpekt", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab*\n10\n", "output": "abbbbbbbbb", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*b?\n200\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "aa*a\n7\n", "output": "aaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n2\n", "output": "aa", "type": "stdin_stdout" }, { "fn_name": null, "input": "abab*b?\n3\n", "output": "aba", "type": "stdin_stdout" }, { "fn_name": null, "input": "kek*\n100\n", "output": "kekkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n20\n", "output": "aaaaaaaaaaaaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n100\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n30\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n3\n", "output": "aaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*b*c*d*e*f\n100\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaf", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab*cdefghijkl\n10\n", "output": "Impossible", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n5\n", "output": "aaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n10\n", "output": "aaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "ab*a\n10\n", "output": "abbbbbbbba", "type": "stdin_stdout" }, { "fn_name": null, "input": "p*\n5\n", "output": "ppppp", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n12\n", "output": "aaaaaaaaaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*\n4\n", "output": "aaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a?b*\n12\n", "output": "abbbbbbbbbbb", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*b\n5\n", "output": "aaaab", "type": "stdin_stdout" }, { "fn_name": null, "input": "abc*\n2\n", "output": "ab", "type": "stdin_stdout" }, { "fn_name": null, "input": "aba?a*\n5\n", "output": "abaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "a*a\n5\n", "output": "aaaaa", "type": "stdin_stdout" }, { "fn_name": null, "input": "h*\n12\n", "output": "hhhhhhhhhhhh", "type": "stdin_stdout" } ] }
apps
verifiable_code
181
Solve the following coding problem using the programming language python: Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face. One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification? But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical. Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized. Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum. The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to "true up". [Image] The next figure shows 90 degrees clockwise turn by FPGA hardware. [Image] -----Input----- The only line of the input contains one integer x ( - 10^18 ≤ x ≤ 10^18) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise. -----Output----- Output one integer — the minimum required number of 90 degrees clockwise turns. -----Examples----- Input 60 Output 1 Input -60 Output 3 -----Note----- When the camera is rotated 60 degrees counter-clockwise (the second example), an image from it is rotated 60 degrees clockwise. One 90 degrees clockwise turn of the image result in 150 degrees clockwise total rotation and deviation from "true up" for one turn is 150 degrees. Two 90 degrees clockwise turns of the image result in 240 degrees clockwise total rotation and deviation from "true up" for two turns is 120 degrees because 240 degrees clockwise equal to 120 degrees counter-clockwise. Three 90 degrees clockwise turns of the image result in 330 degrees clockwise total rotation and deviation from "true up" for three turns is 30 degrees because 330 degrees clockwise equal to 30 degrees counter-clockwise. From 60, 150, 120 and 30 degrees deviations the smallest is 30, and it it achieved in three 90 degrees clockwise turns. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = (-int(input())) % 360 ret, opt = 4, 361 for i in range(4): x = (n+90*i)%360 x = min(x, 360-x) if (x, i) < (opt, ret): opt, ret = x, i print(ret) ```
vfc_10478
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/630/M", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "60\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-60\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "134\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "135\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "136\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "224\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "225\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "226\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "227\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "313\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "314\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "315\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "316\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "358\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "359\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "360\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "361\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999340\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999325\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999326\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999415\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999416\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999504\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999505\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999506\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999594\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999595\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999596\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999639\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999640\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6678504591813508\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "201035370138545377\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "441505850043460771\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "252890591709237675\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "272028913373922389\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "141460527912396122\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "479865961765156498\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-44\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-45\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-46\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-134\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-135\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-136\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-224\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-225\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-226\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-227\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-313\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-314\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-315\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-316\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-358\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-359\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-360\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-361\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999340\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999325\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999326\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999415\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999416\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999504\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999505\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999506\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999594\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999595\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999596\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999639\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999999999999640\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-6678504591813508\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-201035370138545377\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-441505850043460771\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-252890591709237675\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-272028913373922389\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-141460527912396122\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-479865961765156498\n", "output": "2\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
182
Solve the following coding problem using the programming language python: Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he needs at least x blue, y violet and z orange spheres. Can he get them (possible, in multiple actions)? -----Input----- The first line of the input contains three integers a, b and c (0 ≤ a, b, c ≤ 1 000 000) — the number of blue, violet and orange spheres that are in the magician's disposal. The second line of the input contains three integers, x, y and z (0 ≤ x, y, z ≤ 1 000 000) — the number of blue, violet and orange spheres that he needs to get. -----Output----- If the wizard is able to obtain the required numbers of spheres, print "Yes". Otherwise, print "No". -----Examples----- Input 4 4 0 2 1 2 Output Yes Input 5 6 1 2 7 2 Output No Input 3 3 3 2 2 2 Output Yes -----Note----- In the first sample the wizard has 4 blue and 4 violet spheres. In his first action he can turn two blue spheres into one violet one. After that he will have 2 blue and 5 violet spheres. Then he turns 4 violet spheres into 2 orange spheres and he ends up with 2 blue, 1 violet and 2 orange spheres, which is exactly what he needs. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b, c = list(map(int, input().split())) x, y, z = list(map(int, input().split())) col = max(0, x - a) + max(0, y - b) + max(0, z - c) sum = max(0, (a - x) // 2) + max(0, (b - y) // 2) + max(0, (c - z) // 2) if sum >= col: print('Yes') else: print('No') ```
vfc_10482
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/606/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 4 0\n2 1 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6 1\n2 7 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 3\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0\n0 0 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0\n0 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 0\n0 0 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 0\n1 0 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1\n1 1 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 1\n2 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000 1000000\n1000000 1000000 1000000\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 500000 500000\n0 750000 750000\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 1000000 500000\n750001 0 750000\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "499999 500000 1000000\n750000 750000 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 500000 0\n0 0 500000\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 500001 499999\n500000 0 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 500000 1000000\n500000 1000000 500000\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000 499999\n500000 500000 1000000\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 1000000 1000000\n1000000 500001 500000\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 500000 500000\n0 1000000 500000\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 500000 1000000\n500001 1000000 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 999999 500000\n1000000 0 500000\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0 3\n2 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 4\n2 0 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 0\n1 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 1\n1 3 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 4\n2 1 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0\n0 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0 0\n0 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 3 0\n1 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 3\n1 0 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 12 1\n4 0 4\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0 4\n1 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 0\n1 1 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 9 0\n2 2 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 10 0\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 0 9\n0 8 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 9 9\n9 0 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 10 0\n0 0 9\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0 9\n0 10 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 10 10\n10 0 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 0\n0 0 11\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "307075 152060 414033\n381653 222949 123101\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "569950 228830 153718\n162186 357079 229352\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "149416 303568 749016\n238307 493997 190377\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "438332 298094 225324\n194220 400244 245231\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "293792 300060 511272\n400687 382150 133304\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "295449 518151 368838\n382897 137148 471892\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "191789 291147 691092\n324321 416045 176232\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "286845 704749 266526\n392296 104421 461239\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "135522 188282 377041\n245719 212473 108265\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "404239 359124 133292\n180069 184791 332544\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "191906 624432 244408\n340002 367217 205432\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "275980 429361 101824\n274288 302579 166062\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "136092 364927 395302\n149173 343146 390922\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "613852 334661 146012\n363786 326286 275233\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "348369 104625 525203\n285621 215396 366411\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "225307 153572 114545\n154753 153282 149967\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "438576 124465 629784\n375118 276028 390116\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "447521 327510 158732\n395759 178458 259139\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 5 5\n5 5 5\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100\n1 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100\n0 0 0\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 3\n2 3 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 3\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 9 8\n12 5 10\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 10\n1 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 3\n3 3 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0 4\n2 4 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6 0\n2 1 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6 3\n4 2 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 5\n1 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41 17 34\n0 19 24\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 8 8\n3 3 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 7 1\n1 1 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6 0\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 5\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "400 400 400\n1 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 4\n2 2 2\n", "output": "Yes\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
183
Solve the following coding problem using the programming language python: Amr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't. First he gave Amr two positive integers n and k. Then he asked Amr, how many integer numbers x > 0 exist such that: Decimal representation of x (without leading zeroes) consists of exactly n digits; There exists some integer y > 0 such that: $y \operatorname{mod} k = 0$; decimal representation of y is a suffix of decimal representation of x. As the answer to this question may be pretty huge the teacher asked Amr to output only its remainder modulo a number m. Can you help Amr escape this embarrassing situation? -----Input----- Input consists of three integers n, k, m (1 ≤ n ≤ 1000, 1 ≤ k ≤ 100, 1 ≤ m ≤ 10^9). -----Output----- Print the required number modulo m. -----Examples----- Input 1 2 1000 Output 4 Input 2 2 1000 Output 45 Input 5 3 1103 Output 590 -----Note----- A suffix of a string S is a non-empty string that can be obtained by removing some number (possibly, zero) of first characters from S. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n,k,m=list(map(int,input().split())) d,r,p,P=0,0,1%k,(10**(n-1))*9 F=[0]*k F[0]=1 while d<n: d+=1 P//=10 E=[0]*k if P==0:P=1 i=1 # print("E=",E) # print("F=",F) while i<10: j=(-i*p)%k f=0 while f<k: E[f]+=F[j] f+=1 j+=1 if j==k:j=0 i+=1 r+=E[0]*P p=p*10%k E[0]=0 i=1 while i<k: F[i]=(F[i]+E[i])%m i+=1 # print(E,P) F[0]=1 #print("r=",r) print(r%m) #i=10**n #j=10**(n-1) #r=0 #F=[0]*k #while j<i: # x=str(j) # l=len(x) # a=l # while a: # a-=1 # s=int(x[a:l]) # if s>0 and s%k==0: # r+=1 # break # j+=1 #print() #print(r) """ 3 6 9 13 16 19 12 15 18 23 26 29 21 24 27 33 36 39 30 43 46 49 42 45 48 53 56 59 51 54 57 63 66 69 60 73 76 79 72 75 78 83 86 89 81 84 87 93 96 99 90 """ ```
vfc_10486
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/507/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 2 1000\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1000\n", "output": "45", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 1103\n", "output": "590", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 17 10000\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 9 10000\n", "output": "252", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 64 941761822\n", "output": "46530", "type": "stdin_stdout" }, { "fn_name": null, "input": "183 3 46847167\n", "output": "29891566", "type": "stdin_stdout" }, { "fn_name": null, "input": "472 44 364550669\n", "output": "122479316", "type": "stdin_stdout" }, { "fn_name": null, "input": "510 76 811693420\n", "output": "546301720", "type": "stdin_stdout" }, { "fn_name": null, "input": "783 30 602209107\n", "output": "279682329", "type": "stdin_stdout" }, { "fn_name": null, "input": "863 47 840397713\n", "output": "433465398", "type": "stdin_stdout" }, { "fn_name": null, "input": "422 22 411212542\n", "output": "63862621", "type": "stdin_stdout" }, { "fn_name": null, "input": "370 9 385481464\n", "output": "163845824", "type": "stdin_stdout" }, { "fn_name": null, "input": "312 41 915197716\n", "output": "912219984", "type": "stdin_stdout" }, { "fn_name": null, "input": "261 32 49719977\n", "output": "19320923", "type": "stdin_stdout" }, { "fn_name": null, "input": "434 6 56571287\n", "output": "56257936", "type": "stdin_stdout" }, { "fn_name": null, "input": "355 3 945669623\n", "output": "219132384", "type": "stdin_stdout" }, { "fn_name": null, "input": "905 71 999142682\n", "output": "825882209", "type": "stdin_stdout" }, { "fn_name": null, "input": "900 84 526417573\n", "output": "281234824", "type": "stdin_stdout" }, { "fn_name": null, "input": "387 3 521021345\n", "output": "435545521", "type": "stdin_stdout" }, { "fn_name": null, "input": "246 33 996704992\n", "output": "385601286", "type": "stdin_stdout" }, { "fn_name": null, "input": "443 29 106807555\n", "output": "7872021", "type": "stdin_stdout" }, { "fn_name": null, "input": "621 43 356382217\n", "output": "251594310", "type": "stdin_stdout" }, { "fn_name": null, "input": "782 84 643445347\n", "output": "208138038", "type": "stdin_stdout" }, { "fn_name": null, "input": "791 23 94030462\n", "output": "41862326", "type": "stdin_stdout" }, { "fn_name": null, "input": "543 98 508536403\n", "output": "117587951", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 96 238661639\n", "output": "198761428", "type": "stdin_stdout" }, { "fn_name": null, "input": "845 60 888437864\n", "output": "193926448", "type": "stdin_stdout" }, { "fn_name": null, "input": "998 85 501663165\n", "output": "145180249", "type": "stdin_stdout" }, { "fn_name": null, "input": "123 72 56222855\n", "output": "32350599", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 39 618421525\n", "output": "115875938", "type": "stdin_stdout" }, { "fn_name": null, "input": "462 35 144751085\n", "output": "79931198", "type": "stdin_stdout" }, { "fn_name": null, "input": "674 22 494819681\n", "output": "19590614", "type": "stdin_stdout" }, { "fn_name": null, "input": "650 66 579060528\n", "output": "224930740", "type": "stdin_stdout" }, { "fn_name": null, "input": "432 80 133016247\n", "output": "25032672", "type": "stdin_stdout" }, { "fn_name": null, "input": "176 70 196445230\n", "output": "64904804", "type": "stdin_stdout" }, { "fn_name": null, "input": "393 71 933802677\n", "output": "366541352", "type": "stdin_stdout" }, { "fn_name": null, "input": "37 92 9838905\n", "output": "7980021", "type": "stdin_stdout" }, { "fn_name": null, "input": "993 26 108974437\n", "output": "87469631", "type": "stdin_stdout" }, { "fn_name": null, "input": "433 93 36915724\n", "output": "20722839", "type": "stdin_stdout" }, { "fn_name": null, "input": "957 88 512982771\n", "output": "161742313", "type": "stdin_stdout" }, { "fn_name": null, "input": "170 94 82742818\n", "output": "1117330", "type": "stdin_stdout" }, { "fn_name": null, "input": "624 33 145653575\n", "output": "99048377", "type": "stdin_stdout" }, { "fn_name": null, "input": "56 48 961996131\n", "output": "199203510", "type": "stdin_stdout" }, { "fn_name": null, "input": "889 6 225765429\n", "output": "193135878", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 93 727895661\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "470 61 617307737\n", "output": "428782123", "type": "stdin_stdout" }, { "fn_name": null, "input": "520 94 712232167\n", "output": "199435818", "type": "stdin_stdout" }, { "fn_name": null, "input": "531 78 460047919\n", "output": "117748792", "type": "stdin_stdout" }, { "fn_name": null, "input": "776 32 523607700\n", "output": "309970800", "type": "stdin_stdout" }, { "fn_name": null, "input": "648 74 329538445\n", "output": "177655063", "type": "stdin_stdout" }, { "fn_name": null, "input": "885 6 743810885\n", "output": "297512873", "type": "stdin_stdout" }, { "fn_name": null, "input": "712 53 592302770\n", "output": "147693148", "type": "stdin_stdout" }, { "fn_name": null, "input": "426 72 589297447\n", "output": "316207784", "type": "stdin_stdout" }, { "fn_name": null, "input": "561 69 310141994\n", "output": "245538618", "type": "stdin_stdout" }, { "fn_name": null, "input": "604 97 26180786\n", "output": "6950800", "type": "stdin_stdout" }, { "fn_name": null, "input": "586 32 846994504\n", "output": "579729448", "type": "stdin_stdout" }, { "fn_name": null, "input": "514 67 260591607\n", "output": "88291586", "type": "stdin_stdout" }, { "fn_name": null, "input": "429 45 103817253\n", "output": "41335161", "type": "stdin_stdout" }, { "fn_name": null, "input": "767 27 364988776\n", "output": "259490746", "type": "stdin_stdout" }, { "fn_name": null, "input": "497 33 479662107\n", "output": "84548778", "type": "stdin_stdout" }, { "fn_name": null, "input": "262 71 404639692\n", "output": "93447345", "type": "stdin_stdout" }, { "fn_name": null, "input": "125 33 152527721\n", "output": "59122415", "type": "stdin_stdout" }, { "fn_name": null, "input": "857 98 70814341\n", "output": "58423075", "type": "stdin_stdout" }, { "fn_name": null, "input": "375 79 416634034\n", "output": "175150318", "type": "stdin_stdout" }, { "fn_name": null, "input": "886 10 902171654\n", "output": "134375492", "type": "stdin_stdout" }, { "fn_name": null, "input": "335 28 979397289\n", "output": "675105408", "type": "stdin_stdout" }, { "fn_name": null, "input": "769 30 474381420\n", "output": "157049322", "type": "stdin_stdout" }, { "fn_name": null, "input": "736 31 26855044\n", "output": "24225276", "type": "stdin_stdout" }, { "fn_name": null, "input": "891 7 814335325\n", "output": "611862019", "type": "stdin_stdout" }, { "fn_name": null, "input": "346 23 947672082\n", "output": "59151110", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1 382210711\n", "output": "372462157", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 10000\n", "output": "9", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 100 777767777\n", "output": "577920877", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 13 10619863\n", "output": "8796170", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 1000\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 11 11\n", "output": "7", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2\n", "output": "0", "type": "stdin_stdout" } ] }
apps
verifiable_code
184
Solve the following coding problem using the programming language python: You are at a water bowling training. There are l people who play with their left hand, r people, who play with their right hand, and a ambidexters, who can play with left or right hand. The coach decided to form a team of even number of players, exactly half of the players should play with their right hand, and exactly half of the players should play with their left hand. One player should use only on of his hands. Ambidexters play as well with their right hand as with their left hand. In the team, an ambidexter can play with their left hand, or with their right hand. Please find the maximum possible size of the team, where equal number of players use their left and right hands, respectively. -----Input----- The only line contains three integers l, r and a (0 ≤ l, r, a ≤ 100) — the number of left-handers, the number of right-handers and the number of ambidexters at the training. -----Output----- Print a single even integer — the maximum number of players in the team. It is possible that the team can only have zero number of players. -----Examples----- Input 1 4 2 Output 6 Input 5 5 5 Output 14 Input 0 2 0 Output 0 -----Note----- In the first example you can form a team of 6 players. You should take the only left-hander and two ambidexters to play with left hand, and three right-handers to play with right hand. The only person left can't be taken into the team. In the second example you can form a team of 14 people. You have to take all five left-handers, all five right-handers, two ambidexters to play with left hand and two ambidexters to play with right hand. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import base64 import zlib pro = base64.decodebytes("""eJxtUUFuwyAQvPOKVarKkDhOm2MlX/uC3qqqAhs7KBgswGr6+y4QrLqqL7DD7OzMWk2zdQFGGWbu PVG59N/rdeLhUu6Om95OpVJBumCtXqlCedkFQgalpYcW3twiSS/FMmLxyrWXhKihzGrwXLx0lEHb QjU4e5HmWgHOgKTwQgC/0p/EIoDeGh96ZRC0szR0F6QPjTI7lt4fCsMuoVCqREGgqqH6qjIxBSZo cADdTZTXIFie6dCZM8BhDwJOp7SDZuz6zLn3OMXplv+uTKCKwWAdKECDysxLoKzxs1Z4fpRObkb5 6ZfNTDSDbimlAo44+QDPLI4+MzRBYy1Yto0bxPqINTzCOe7uKSsUlQPKFJFzFtmkWlN3dhKcmhpu 2xw05R14FyyG1NSwdQm/QJxwY/+93OKGdA2uRgtt3hPp1RALLjzV2OkYmZSJCB40ku/AISORju2M XOEPkISOLVzJ/ShtPCedXfwLCdxjfPIDQSHUSQ== """.encode()) pro = zlib.decompress(pro) pro = pro.decode() exec(pro) ```
vfc_10490
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/950/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 4 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 5\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 70 34\n", "output": "128\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 32 24\n", "output": "112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 44 77\n", "output": "210\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100\n", "output": "300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 70 35\n", "output": "130\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 44 76\n", "output": "208\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 100\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 100\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1 100\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 100\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 0\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 1\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 100\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 7\n", "output": "24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45 47 16\n", "output": "108\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59 43 100\n", "output": "202\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 1 30\n", "output": "62\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 81 1\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "53 96 94\n", "output": "242\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "62 81 75\n", "output": "218\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21 71 97\n", "output": "188\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 82 73\n", "output": "204\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88 19 29\n", "output": "96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 4 62\n", "output": "132\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58 3 65\n", "output": "126\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27 86 11\n", "output": "76\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 19 80\n", "output": "134\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 86 74\n", "output": "156\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32 61 89\n", "output": "182\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "68 60 98\n", "output": "226\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37 89 34\n", "output": "142\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 9 28\n", "output": "74\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79 58 98\n", "output": "234\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 44 88\n", "output": "166\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 24 19\n", "output": "58\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "74 71 75\n", "output": "220\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83 86 99\n", "output": "268\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 73 15\n", "output": "176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "77 76 73\n", "output": "226\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48 85 55\n", "output": "188\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 3\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 99 99\n", "output": "296\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 99 100\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 100 99\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 100 100\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99 99\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99 100\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 99\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 32 23\n", "output": "110\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5 0\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 3\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 97 0\n", "output": "194\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4 0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 0\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 5 10\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 3\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 0\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 10\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
185
Solve the following coding problem using the programming language python: Finished her homework, Nastya decided to play computer games. Passing levels one by one, Nastya eventually faced a problem. Her mission is to leave a room, where a lot of monsters live, as quickly as possible. There are $n$ manholes in the room which are situated on one line, but, unfortunately, all the manholes are closed, and there is one stone on every manhole. There is exactly one coin under every manhole, and to win the game Nastya should pick all the coins. Initially Nastya stands near the $k$-th manhole from the left. She is thinking what to do. In one turn, Nastya can do one of the following: if there is at least one stone on the manhole Nastya stands near, throw exactly one stone from it onto any other manhole (yes, Nastya is strong). go to a neighboring manhole; if there are no stones on the manhole Nastya stays near, she can open it and pick the coin from it. After it she must close the manhole immediately (it doesn't require additional moves). [Image] The figure shows the intermediate state of the game. At the current position Nastya can throw the stone to any other manhole or move left or right to the neighboring manholes. If she were near the leftmost manhole, she could open it (since there are no stones on it). Nastya can leave the room when she picks all the coins. Monsters are everywhere, so you need to compute the minimum number of moves Nastya has to make to pick all the coins. Note one time more that Nastya can open a manhole only when there are no stones onto it. -----Input----- The first and only line contains two integers $n$ and $k$, separated by space ($2 \leq n \leq 5000$, $1 \leq k \leq n$) — the number of manholes and the index of manhole from the left, near which Nastya stays initially. Initially there is exactly one stone near each of the $n$ manholes. -----Output----- Print a single integer — minimum number of moves which lead Nastya to pick all the coins. -----Examples----- Input 2 2 Output 6 Input 4 2 Output 13 Input 5 1 Output 15 -----Note----- Let's consider the example where $n = 2$, $k = 2$. Nastya should play as follows: At first she throws the stone from the second manhole to the first. Now there are two stones on the first manhole. Then she opens the second manhole and pick the coin from it. Then she goes to the first manhole, throws two stones by two moves to the second manhole and then opens the manhole and picks the coin from it. So, $6$ moves are required to win. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, k = list(map(int,input().split())) if k == 1 or k == n: print(3 * n) else: print(3 * n + min(k - 1, n - k)) ```
vfc_10494
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1136/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64 49\n", "output": "207\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24 6\n", "output": "77\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 39\n", "output": "311\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87 87\n", "output": "261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 36\n", "output": "251\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4237 4112\n", "output": "12836\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1815 1371\n", "output": "5889\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 1628\n", "output": "16627\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 3531\n", "output": "16469\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 2895\n", "output": "17105\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 539\n", "output": "15538\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 3576\n", "output": "16424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3474 3427\n", "output": "10469\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3400 1203\n", "output": "11402\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4345 1015\n", "output": "14049\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2944 2468\n", "output": "9308\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2029 360\n", "output": "6446\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4951 4649\n", "output": "15155\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3058 82\n", "output": "9255\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "113 42\n", "output": "380\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3355 2536\n", "output": "10884\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1214 76\n", "output": "3717\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4158 2162\n", "output": "14470\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1052 1052\n", "output": "3156\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2116 1\n", "output": "6348\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "530 530\n", "output": "1590\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "675 675\n", "output": "2025\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "308 1\n", "output": "924\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "731 1\n", "output": "2193\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4992 1\n", "output": "14976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4676 1\n", "output": "14028\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3247 1623\n", "output": "11363\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4291 2145\n", "output": "15017\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3010 1505\n", "output": "10534\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4919 2459\n", "output": "17215\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "978 489\n", "output": "3422\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3151 1575\n", "output": "11027\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3046 1523\n", "output": "10660\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2563 1281\n", "output": "8969\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2266 1133\n", "output": "7930\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3068 1534\n", "output": "10737\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2229 1114\n", "output": "7800\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1237 618\n", "output": "4328\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4602 2301\n", "output": "16106\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 2\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9\n", "output": "31\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2\n", "output": "31\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 1\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 4\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 24\n", "output": "136\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 4\n", "output": "33\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 1\n", "output": "132\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 12\n", "output": "60\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88 33\n", "output": "296\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "65 61\n", "output": "199\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87 27\n", "output": "287\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 3336\n", "output": "16664\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 2653\n", "output": "17347\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 4494\n", "output": "15506\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 2612\n", "output": "17388\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 3378\n", "output": "16622\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 888\n", "output": "15887\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 1\n", "output": "15000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000 2500\n", "output": "17499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1029 1028\n", "output": "3088\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9\n", "output": "31\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1024 1023\n", "output": "3073\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1023 999\n", "output": "3093\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 199\n", "output": "3198\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 201\n", "output": "3200\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
186
Solve the following coding problem using the programming language python: Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks. The students don’t want to use too many blocks, but they also want to be unique, so no two students’ towers may contain the same number of blocks. Find the minimum height necessary for the tallest of the students' towers. -----Input----- The first line of the input contains two space-separated integers n and m (0 ≤ n, m ≤ 1 000 000, n + m > 0) — the number of students using two-block pieces and the number of students using three-block pieces, respectively. -----Output----- Print a single integer, denoting the minimum possible height of the tallest tower. -----Examples----- Input 1 3 Output 9 Input 3 2 Output 8 Input 5 0 Output 10 -----Note----- In the first case, the student using two-block pieces can make a tower of height 4, and the students using three-block pieces can make towers of height 3, 6, and 9 blocks. The tallest tower has a height of 9 blocks. In the second case, the students can make towers of heights 2, 4, and 8 with two-block pieces and towers of heights 3 and 6 with three-block pieces, for a maximum height of 8 blocks. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, m = list(map(int, input().split())) start = 0 end = 10**10 while (end - start > 1): mid = (end + start) // 2 two = mid // 2 - mid // 6 three = mid // 3 - mid // 6 six = mid // 6 nn = n mm = m nn -= two mm -= three nn = max(nn, 0) mm = max(mm, 0) if (six >= nn + mm): end = mid else: start = mid print(end) ```
vfc_10498
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/626/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 3\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 0\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1000000\n", "output": "3000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1\n", "output": "2000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1083 724\n", "output": "2710\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1184 868\n", "output": "3078\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1285 877\n", "output": "3243\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "820189 548173\n", "output": "2052543\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "968867 651952\n", "output": "2431228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "817544 553980\n", "output": "2057286\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "813242 543613\n", "output": "2035282\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "961920 647392\n", "output": "2413968\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "825496 807050\n", "output": "2448819\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "974174 827926\n", "output": "2703150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "969872 899794\n", "output": "2804499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "818549 720669\n", "output": "2308827\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "967227 894524\n", "output": "2792626\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "185253 152723\n", "output": "506964\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "195173 150801\n", "output": "518961\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "129439 98443\n", "output": "341823\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "163706 157895\n", "output": "482402\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "197973 140806\n", "output": "508168\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000\n", "output": "3000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 999999\n", "output": "2999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999 1000000\n", "output": "3000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 500100\n", "output": "1500300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 166000\n", "output": "1000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 499000\n", "output": "1498500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000 167000\n", "output": "1000500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000\n", "output": "3000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 999123\n", "output": "2997369\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 988723\n", "output": "2966169\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "234 298374\n", "output": "895122\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2365 981235\n", "output": "2943705\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12345 981732\n", "output": "2945196\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "108752 129872\n", "output": "389616\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "984327 24352\n", "output": "1968654\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "928375 1253\n", "output": "1856750\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "918273 219\n", "output": "1836546\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "987521 53\n", "output": "1975042\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456 1\n", "output": "246912\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "789123 0\n", "output": "1578246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "143568 628524\n", "output": "1885572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "175983 870607\n", "output": "2611821\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 5\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19170 15725\n", "output": "52342\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3000 2000\n", "output": "7500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 4\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 30\n", "output": "120\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300 200\n", "output": "750\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 4\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 6\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 6\n", "output": "24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "65 56\n", "output": "182\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 10\n", "output": "34\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 42\n", "output": "126\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "651 420\n", "output": "1606\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 9\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 10\n", "output": "38\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999 888888\n", "output": "2833330\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "192056 131545\n", "output": "485402\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32 16\n", "output": "72\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 12\n", "output": "45\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 666667\n", "output": "2500000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 5\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1515 1415\n", "output": "4395\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300000 200000\n", "output": "750000\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
187
Solve the following coding problem using the programming language python: Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card. Before the game Petya will choose an integer and after that Vasya will choose another integer (different from the number that Petya chose). During the game each player takes all the cards with number he chose. For example, if Petya chose number 5 before the game he will take all cards on which 5 is written and if Vasya chose number 10 before the game he will take all cards on which 10 is written. The game is considered fair if Petya and Vasya can take all n cards, and the number of cards each player gets is the same. Determine whether Petya and Vasya can choose integer numbers before the game so that the game is fair. -----Input----- The first line contains a single integer n (2 ≤ n ≤ 100) — number of cards. It is guaranteed that n is an even number. The following n lines contain a sequence of integers a_1, a_2, ..., a_{n} (one integer per line, 1 ≤ a_{i} ≤ 100) — numbers written on the n cards. -----Output----- If it is impossible for Petya and Vasya to choose numbers in such a way that the game will be fair, print "NO" (without quotes) in the first line. In this case you should not print anything more. In the other case print "YES" (without quotes) in the first line. In the second line print two distinct integers — number that Petya should choose and the number that Vasya should choose to make the game fair. If there are several solutions, print any of them. -----Examples----- Input 4 11 27 27 11 Output YES 11 27 Input 2 6 6 Output NO Input 6 10 20 30 20 10 20 Output NO Input 6 1 1 2 2 3 3 Output NO -----Note----- In the first example the game will be fair if, for example, Petya chooses number 11, and Vasya chooses number 27. Then the will take all cards — Petya will take cards 1 and 4, and Vasya will take cards 2 and 3. Thus, each of them will take exactly two cards. In the second example fair game is impossible because the numbers written on the cards are equal, but the numbers that Petya and Vasya should choose should be distinct. In the third example it is impossible to take all cards. Petya and Vasya can take at most five cards — for example, Petya can choose number 10 and Vasya can choose number 20. But for the game to be fair it is necessary to take 6 cards. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) a = [] for _ in range(n): a.append(int(input())) b = list(set(a[::])) if(len(b) == 2 and a.count(a[0]) == n//2): print("YES") print(b[0],b[1]) else: print("NO") ```
vfc_10502
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/864/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n11\n27\n27\n11\n", "output": "YES\n11 27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n6\n6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n10\n20\n30\n20\n10\n20\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1\n1\n2\n2\n3\n3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1\n100\n", "output": "YES\n1 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1\n1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n", "output": "YES\n14 32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n50\n100\n", "output": "YES\n50 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n99\n100\n", "output": "YES\n99 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4\n4\n5\n5\n", "output": "YES\n4 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n10\n10\n10\n10\n10\n23\n23\n23\n23\n23\n", "output": "YES\n10 23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n11\n11\n11\n11\n11\n11\n11\n11\n11\n11\n", "output": "YES\n11 34\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n20\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n", "output": "YES\n20 30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "YES\n1 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n", "output": "YES\n2 99\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n", "output": "YES\n1 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n", "output": "YES\n1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n", "output": "YES\n99 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n29\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n", "output": "YES\n29 43\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n88\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n", "output": "YES\n88 98\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n", "output": "YES\n2 34\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n", "output": "YES\n23 94\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n14\n", "output": "YES\n14 15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n23\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n21\n", "output": "YES\n21 23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n", "output": "YES\n32 98\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n", "output": "YES\n3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n34\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n", "output": "YES\n12 34\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n19\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n32\n", "output": "YES\n19 32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n85\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n", "output": "YES\n54 85\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n43\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n", "output": "YES\n12 43\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n96\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n95\n", "output": "YES\n95 96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n", "output": "YES\n4 33\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n99\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n", "output": "YES\n98 99\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n87\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n", "output": "YES\n12 87\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n13\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n", "output": "YES\n13 24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n49\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n", "output": "YES\n12 49\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n15\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n94\n", "output": "YES\n15 94\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n42\n", "output": "YES\n33 42\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n16\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n35\n", "output": "YES\n16 35\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n33\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n44\n", "output": "YES\n33 44\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n54\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n98\n", "output": "YES\n54 98\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n81\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n12\n", "output": "YES\n12 81\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n20\n20\n30\n30\n20\n20\n20\n30\n30\n20\n20\n30\n30\n30\n30\n20\n30\n30\n30\n30\n20\n20\n30\n30\n30\n20\n30\n20\n30\n20\n30\n20\n20\n20\n30\n20\n20\n20\n30\n30\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58\n100\n100\n100\n100\n100\n1\n1\n1\n1\n1\n1\n100\n100\n1\n100\n1\n100\n100\n1\n1\n100\n100\n1\n100\n1\n100\n100\n1\n1\n100\n1\n1\n1\n100\n1\n1\n1\n1\n100\n1\n100\n100\n100\n100\n100\n1\n1\n100\n100\n100\n100\n1\n100\n1\n1\n1\n1\n1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98\n2\n99\n99\n99\n99\n2\n99\n99\n99\n2\n2\n99\n2\n2\n2\n2\n99\n99\n2\n99\n2\n2\n99\n99\n99\n99\n2\n2\n99\n2\n99\n99\n2\n2\n99\n2\n99\n2\n99\n2\n2\n2\n99\n2\n2\n2\n2\n99\n99\n99\n99\n2\n2\n2\n2\n2\n2\n2\n2\n99\n2\n99\n99\n2\n2\n99\n99\n99\n99\n99\n99\n99\n99\n2\n99\n2\n99\n2\n2\n2\n99\n99\n99\n99\n99\n99\n2\n99\n99\n2\n2\n2\n2\n2\n99\n99\n99\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n100\n1\n100\n1\n1\n100\n1\n1\n1\n100\n100\n1\n100\n1\n100\n100\n1\n1\n1\n100\n1\n100\n1\n100\n100\n1\n100\n1\n100\n1\n1\n1\n1\n1\n100\n1\n100\n100\n100\n1\n100\n100\n1\n100\n1\n1\n100\n100\n100\n1\n100\n100\n1\n1\n100\n100\n1\n100\n1\n100\n1\n1\n100\n100\n100\n100\n100\n100\n1\n100\n100\n1\n100\n100\n1\n100\n1\n1\n1\n100\n100\n1\n100\n1\n100\n1\n1\n1\n1\n100\n1\n1\n100\n1\n100\n100\n1\n100\n1\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2\n2\n2\n1\n1\n1\n2\n2\n1\n1\n1\n2\n2\n1\n2\n2\n1\n2\n2\n1\n1\n2\n1\n2\n2\n2\n2\n2\n1\n2\n1\n2\n1\n1\n2\n2\n2\n1\n1\n2\n2\n1\n2\n1\n1\n2\n1\n1\n1\n2\n2\n1\n2\n2\n2\n1\n1\n2\n1\n2\n2\n1\n1\n1\n1\n1\n1\n1\n2\n2\n2\n1\n2\n2\n2\n2\n1\n1\n2\n1\n1\n1\n2\n1\n2\n1\n1\n2\n2\n2\n1\n1\n1\n2\n2\n2\n1\n1\n2\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n99\n99\n100\n99\n99\n100\n100\n99\n99\n100\n99\n100\n100\n100\n100\n100\n100\n99\n100\n100\n99\n100\n99\n100\n100\n99\n99\n100\n99\n100\n99\n99\n100\n99\n100\n100\n99\n99\n100\n100\n100\n100\n100\n99\n100\n99\n100\n99\n100\n100\n100\n100\n100\n100\n99\n99\n99\n100\n99\n99\n99\n99\n99\n99\n100\n100\n99\n100\n100\n99\n99\n100\n100\n99\n100\n100\n99\n100\n99\n99\n100\n99\n99\n100\n99\n99\n100\n99\n100\n99\n100\n100\n99\n99\n99\n100\n99\n100\n100\n99\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n42\n42\n42\n29\n29\n42\n42\n42\n29\n42\n29\n29\n29\n42\n29\n29\n42\n29\n42\n29\n42\n29\n42\n42\n42\n42\n29\n29\n42\n29\n29\n42\n29\n42\n29\n42\n29\n29\n42\n29\n29\n42\n42\n42\n29\n29\n29\n29\n42\n29\n29\n29\n29\n29\n29\n42\n42\n29\n42\n29\n42\n42\n29\n29\n29\n42\n42\n29\n42\n42\n42\n29\n29\n42\n29\n29\n29\n42\n42\n29\n29\n29\n42\n29\n42\n42\n29\n42\n42\n42\n42\n42\n29\n42\n29\n29\n29\n29\n29\n42\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n98\n98\n98\n88\n88\n88\n88\n98\n88\n88\n88\n88\n88\n98\n88\n98\n88\n98\n88\n98\n98\n98\n98\n98\n98\n88\n98\n88\n88\n88\n98\n88\n88\n98\n88\n98\n88\n98\n98\n88\n98\n88\n98\n98\n98\n98\n88\n98\n98\n88\n88\n88\n88\n98\n98\n98\n98\n88\n98\n88\n98\n98\n88\n88\n98\n98\n88\n88\n98\n88\n98\n88\n98\n88\n98\n98\n88\n88\n98\n98\n98\n98\n88\n88\n98\n98\n88\n98\n88\n98\n98\n88\n98\n98\n88\n88\n98\n88\n98\n98\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n100\n100\n100\n1\n100\n1\n1\n1\n100\n1\n1\n1\n1\n100\n1\n100\n1\n100\n1\n100\n100\n100\n1\n100\n1\n1\n1\n100\n1\n1\n1\n1\n1\n100\n100\n1\n100\n1\n1\n100\n1\n1\n100\n1\n100\n100\n100\n1\n100\n100\n100\n1\n100\n1\n100\n100\n100\n1\n1\n100\n100\n100\n100\n1\n100\n36\n100\n1\n100\n1\n100\n100\n100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n100\n1\n1\n100\n100\n100\n100\n100\n1\n100\n1\n100\n1\n1\n100\n100\n1\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2\n1\n1\n2\n2\n1\n1\n1\n1\n2\n1\n1\n1\n2\n2\n2\n1\n1\n1\n2\n1\n2\n2\n2\n2\n1\n1\n2\n1\n1\n2\n1\n27\n1\n1\n1\n2\n2\n2\n1\n2\n1\n2\n1\n1\n2\n2\n2\n2\n2\n2\n2\n2\n1\n2\n2\n2\n2\n1\n2\n1\n1\n1\n1\n1\n2\n1\n1\n1\n2\n2\n2\n2\n2\n2\n1\n1\n1\n1\n2\n2\n1\n2\n2\n1\n1\n1\n2\n1\n2\n2\n1\n1\n2\n1\n1\n1\n2\n2\n1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n99\n99\n100\n99\n99\n100\n100\n100\n99\n100\n99\n99\n100\n99\n99\n99\n99\n99\n99\n100\n100\n100\n99\n100\n100\n99\n100\n99\n100\n100\n99\n100\n99\n99\n99\n100\n99\n10\n99\n100\n100\n100\n99\n100\n100\n100\n100\n100\n100\n100\n99\n100\n100\n100\n99\n99\n100\n99\n100\n99\n100\n100\n99\n99\n99\n99\n100\n99\n100\n100\n100\n100\n100\n100\n99\n99\n100\n100\n99\n99\n99\n99\n99\n99\n100\n99\n99\n100\n100\n99\n100\n99\n99\n100\n99\n99\n99\n99\n100\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n29\n43\n43\n29\n43\n29\n29\n29\n43\n29\n29\n29\n29\n43\n29\n29\n29\n29\n43\n29\n29\n29\n43\n29\n29\n29\n43\n43\n43\n43\n43\n43\n29\n29\n43\n43\n43\n29\n43\n43\n43\n29\n29\n29\n43\n29\n29\n29\n43\n43\n43\n43\n29\n29\n29\n29\n43\n29\n43\n43\n29\n29\n43\n43\n29\n29\n95\n29\n29\n29\n43\n43\n29\n29\n29\n29\n29\n43\n43\n43\n43\n29\n29\n43\n43\n43\n43\n43\n43\n29\n43\n43\n43\n43\n43\n43\n29\n43\n29\n43\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n98\n98\n98\n88\n88\n88\n88\n98\n98\n88\n98\n88\n98\n88\n88\n88\n88\n88\n98\n98\n88\n98\n98\n98\n88\n88\n88\n98\n98\n88\n88\n88\n98\n88\n98\n88\n98\n88\n88\n98\n98\n98\n88\n88\n98\n98\n88\n88\n88\n88\n88\n98\n98\n98\n88\n98\n88\n88\n98\n98\n88\n98\n88\n88\n98\n88\n88\n98\n27\n88\n88\n88\n98\n98\n88\n88\n98\n98\n98\n98\n98\n88\n98\n88\n98\n98\n98\n98\n88\n88\n98\n88\n98\n88\n98\n98\n88\n98\n98\n88\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n50\n1\n1\n50\n50\n50\n50\n1\n50\n100\n50\n50\n50\n100\n1\n100\n1\n100\n50\n50\n50\n50\n50\n1\n50\n1\n100\n1\n1\n50\n100\n50\n50\n100\n50\n50\n100\n1\n50\n50\n100\n1\n1\n50\n1\n100\n50\n50\n100\n100\n1\n100\n1\n50\n100\n50\n50\n1\n1\n50\n100\n50\n100\n100\n100\n50\n50\n1\n1\n50\n100\n1\n50\n100\n100\n1\n50\n50\n50\n100\n50\n50\n100\n1\n50\n50\n50\n50\n1\n50\n50\n50\n50\n1\n50\n50\n100\n1\n50\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n45\n45\n45\n45\n45\n45\n44\n44\n44\n43\n45\n44\n44\n45\n44\n44\n45\n44\n43\n44\n43\n43\n43\n45\n43\n45\n44\n45\n43\n44\n45\n45\n45\n45\n45\n45\n45\n45\n43\n45\n43\n43\n45\n44\n45\n45\n45\n44\n45\n45\n45\n45\n45\n45\n44\n43\n45\n45\n43\n44\n45\n45\n45\n45\n44\n45\n45\n45\n43\n43\n44\n44\n43\n45\n43\n45\n45\n45\n44\n44\n43\n43\n44\n44\n44\n43\n45\n43\n44\n43\n45\n43\n43\n45\n45\n44\n45\n43\n43\n45\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n12\n12\n97\n15\n97\n12\n15\n97\n12\n97\n12\n12\n97\n12\n15\n12\n12\n15\n12\n12\n97\n12\n12\n15\n15\n12\n97\n15\n12\n97\n15\n12\n12\n15\n15\n15\n97\n15\n97\n12\n12\n12\n12\n12\n97\n12\n97\n12\n15\n15\n12\n15\n12\n15\n12\n12\n12\n12\n12\n12\n12\n12\n97\n97\n12\n12\n97\n12\n97\n97\n15\n97\n12\n97\n97\n12\n12\n12\n97\n97\n15\n12\n12\n15\n12\n15\n97\n97\n12\n15\n12\n12\n97\n12\n15\n15\n15\n15\n12\n12\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n2\n3\n1\n3\n3\n1\n2\n1\n2\n1\n3\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n99\n98\n100\n100\n99\n100\n99\n100\n100\n98\n99\n98\n98\n99\n98\n99\n98\n100\n100\n98\n100\n98\n99\n100\n98\n99\n98\n99\n99\n100\n98\n99\n99\n98\n100\n99\n98\n99\n98\n100\n100\n100\n99\n98\n99\n98\n100\n100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96\n30\n10\n20\n20\n30\n30\n20\n10\n20\n30\n30\n30\n30\n10\n10\n30\n20\n30\n10\n10\n10\n30\n10\n30\n10\n10\n20\n30\n30\n30\n30\n10\n20\n20\n30\n10\n30\n20\n30\n20\n20\n10\n10\n30\n30\n10\n10\n10\n30\n10\n10\n10\n10\n30\n20\n20\n20\n30\n10\n10\n20\n20\n30\n20\n20\n30\n10\n30\n20\n20\n20\n10\n30\n20\n30\n20\n20\n20\n30\n20\n20\n20\n30\n10\n20\n30\n20\n30\n20\n10\n10\n10\n10\n10\n20\n10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96\n97\n78\n78\n78\n97\n78\n34\n78\n78\n97\n97\n78\n34\n34\n34\n34\n34\n34\n97\n97\n34\n34\n97\n78\n97\n78\n34\n34\n97\n78\n97\n34\n34\n97\n97\n78\n97\n97\n78\n97\n78\n78\n97\n97\n97\n97\n34\n34\n34\n78\n97\n78\n34\n78\n97\n34\n78\n34\n78\n34\n97\n78\n78\n78\n78\n34\n78\n78\n78\n34\n97\n34\n34\n78\n34\n34\n34\n97\n34\n34\n97\n34\n34\n97\n97\n78\n34\n78\n78\n97\n97\n97\n78\n97\n78\n97\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n3\n3\n3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1\n1\n1\n1\n2\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n1\n1\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n2\n2\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n2\n3\n4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1\n1\n2\n2\n3\n3\n4\n4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n3\n2\n4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n10\n10\n10\n20\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n11\n12\n13\n13\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n1\n1\n3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1\n1\n2\n2\n2\n2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1\n1\n2\n2\n2\n3\n3\n4\n4\n4\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
188
Solve the following coding problem using the programming language python: Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains a_{i} soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the sea. The airplane has n rows, each of them has 8 seats. We call two seats neighbor, if they are in the same row and in seats {1, 2}, {3, 4}, {4, 5}, {5, 6} or {7, 8}. [Image] A row in the airplane Daenerys Targaryen wants to place her army in the plane so that there are no two soldiers from different groups sitting on neighboring seats. Your task is to determine if there is a possible arranging of her army in the airplane such that the condition above is satisfied. -----Input----- The first line contains two integers n and k (1 ≤ n ≤ 10000, 1 ≤ k ≤ 100) — the number of rows and the number of groups of soldiers, respectively. The second line contains k integers a_1, a_2, a_3, ..., a_{k} (1 ≤ a_{i} ≤ 10000), where a_{i} denotes the number of soldiers in the i-th group. It is guaranteed that a_1 + a_2 + ... + a_{k} ≤ 8·n. -----Output----- If we can place the soldiers in the airplane print "YES" (without quotes). Otherwise print "NO" (without quotes). You can choose the case (lower or upper) for each letter arbitrary. -----Examples----- Input 2 2 5 8 Output YES Input 1 2 7 1 Output NO Input 1 2 4 4 Output YES Input 1 4 2 2 1 2 Output YES -----Note----- In the first sample, Daenerys can place the soldiers like in the figure below: [Image] In the second sample, there is no way to place the soldiers in the plane since the second group soldier will always have a seat neighboring to someone from the first group. In the third example Daenerys can place the first group on seats (1, 2, 7, 8), and the second group an all the remaining seats. In the fourth example she can place the first two groups on seats (1, 2) and (7, 8), the third group on seats (3), and the fourth group on seats (5, 6). The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import sys def r(): return list(map(int, input().split())) n, k = list(map(int, input().split())) a = r() cnt4 = n cnt2 = 2*n cnt1 = 0 for i in range(k): x = min((a[i]+1)//4, cnt4) cnt4 -= x a[i] = max(0, a[i]-4*x) cnt2 += cnt4 cnt1 += cnt4 for i in range(k): x = min(a[i]//2, cnt2) cnt2 -= x a[i] = max(0, a[i]-2*x) cnt1 += cnt2 for i in range(k): cnt1 -= a[i] if (cnt1 < 0): print('NO') else: print('YES') ```
vfc_10506
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/839/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 2\n5 8\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n7 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n4 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 2 1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 100\n749 2244 949 2439 2703 44 2394 124 285 3694 3609 717 1413 155 974 1778 1448 1327 1487 3458 319 1395 3783 2184 2062 43 826 38 3276 807 1837 4635 171 1386 1768 1128 2020 2536 800 782 3058 174 455 83 647 595 658 109 33 23 70 39 38 1 6 35 94 9 22 12 6 1 2 2 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 9938\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 15\n165 26 83 64 235 48 36 51 3 18 5 10 9 6 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 2 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5691 91\n6573 1666 2158 2591 4636 886 263 4217 389 29 1513 1172 617 2012 1855 798 1588 979 152 37 890 375 1091 839 385 382 1 255 117 289 119 224 182 69 19 71 115 13 4 22 35 2 60 12 6 12 19 9 3 2 2 6 5 1 7 7 3 1 5 1 7 1 4 1 1 3 2 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5631\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000 50\n203 89 1359 3105 898 1381 248 365 108 766 961 630 265 819 838 125 1751 289 177 81 131 564 102 95 49 74 92 101 19 17 156 5 5 4 20 9 25 16 16 2 8 5 4 2 1 3 4 1 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 100\n800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 100\n749 2244 949 2439 2703 44 2394 124 285 3694 3609 717 1413 155 974 1778 1448 1327 1487 3458 319 1395 3783 2184 2062 43 826 38 3276 807 1837 4635 171 1386 1768 1128 2020 2536 2050 1074 605 979 1724 1608 672 88 1243 129 718 544 3590 37 187 600 738 34 64 316 58 6 84 252 75 68 40 68 4 29 29 8 13 11 5 1 5 1 3 2 1 1 1 2 3 4 1 1 2 2 2 1 1 1 1 1 1 1 1 1 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8459 91\n778 338 725 1297 115 540 1452 2708 193 1806 1496 1326 2648 176 199 93 342 3901 2393 2718 800 3434 657 4037 291 690 1957 3280 73 6011 2791 1987 440 455 444 155 261 234 829 1309 1164 616 34 627 107 213 52 110 323 81 98 8 7 73 20 12 56 3 40 12 8 7 69 1 14 3 6 2 6 8 3 5 4 4 3 1 1 4 2 1 1 1 8 2 2 2 1 1 1 2 8421\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n2 3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 91\n2351 1402 1137 2629 4718 1138 1839 1339 2184 2387 165 370 918 1476 2717 879 1152 5367 3940 608 941 766 1256 656 2768 916 4176 489 1989 1633 2725 2329 2795 1970 667 340 1275 120 870 488 225 59 64 255 207 3 37 127 19 224 34 283 144 50 132 60 57 29 18 6 7 4 4 15 3 5 1 10 5 2 3 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 9948\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 83\n64 612 2940 2274 1481 1713 860 1264 104 5616 2574 5292 4039 292 1416 854 3854 1140 4344 3904 1720 1968 442 884 2032 875 291 677 2780 3074 3043 2997 407 727 344 511 156 321 134 51 382 336 591 52 134 39 104 10 20 15 24 2 70 39 14 16 16 25 1 6 2 2 1 1 1 2 4 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 9968\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4000 71\n940 1807 57 715 532 212 3842 2180 2283 744 1453 800 1945 380 2903 293 633 391 2866 256 102 46 228 1099 434 210 244 14 27 4 63 53 3 9 36 25 1 12 2 14 12 28 2 28 8 5 11 8 2 3 6 4 1 1 1 3 2 1 1 1 2 2 1 1 1 1 1 2 1 1 3966\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3403 59\n1269 1612 453 795 1216 941 19 44 1796 324 2019 1397 651 382 841 2003 3013 638 1007 1001 351 95 394 149 125 13 116 183 20 78 208 19 152 10 151 177 16 23 17 22 8 1 3 2 6 1 5 3 13 1 8 4 3 4 4 4 2 2 3378\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2393 33\n1381 2210 492 3394 912 2927 1189 269 66 102 104 969 395 385 369 354 251 28 203 334 20 10 156 29 61 13 30 4 1 32 2 2 2436\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 100\n749 2244 949 2439 2703 44 2394 124 285 3694 3609 717 1413 155 974 1778 1448 1327 1487 3458 319 1395 3783 2184 2062 43 826 38 3276 807 1837 4635 171 1386 1768 1128 2020 2536 800 782 3058 174 455 83 647 595 658 109 33 23 70 39 38 1 6 35 94 9 22 12 6 1 2 2 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 9939\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 89\n1001 1531 2489 457 1415 617 2057 2658 3030 789 2500 3420 1550 376 720 78 506 293 1978 383 3195 2036 891 1741 1817 486 2650 360 2250 2531 3250 1612 2759 603 5321 1319 791 1507 265 174 877 1861 572 172 580 536 777 165 169 11 125 31 186 113 78 27 25 37 8 21 48 24 4 33 35 13 15 1 3 2 2 8 3 5 1 1 6 1 1 2 1 1 2 2 1 1 2 1 9953\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 16\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 71\n110 14 2362 260 423 881 1296 3904 1664 849 57 631 1922 917 4832 1339 3398 4578 59 2663 2223 698 4002 3013 747 699 1230 2750 239 1409 6291 2133 1172 5824 181 797 26 281 574 557 19 82 624 387 278 53 64 163 22 617 15 35 42 48 14 140 171 36 28 22 5 49 17 5 10 14 13 1 3 3 9979\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3495 83\n2775 2523 1178 512 3171 1159 1382 2146 2192 1823 799 231 502 16 99 309 656 665 222 285 11 106 244 137 241 45 41 29 485 6 62 38 94 5 7 93 48 5 10 13 2 1 2 1 4 8 5 9 4 6 1 1 1 3 4 3 7 1 2 3 1 1 7 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 3443\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 40\n1701 1203 67 464 1884 761 11 559 29 115 405 133 174 63 147 93 41 19 1 15 41 8 33 4 4 1 4 1 1 2 1 2 1 1 2 1 1 2 1 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "347 20\n55 390 555 426 140 360 29 115 23 113 58 30 33 1 23 3 35 5 7 363\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 100\n749 2244 949 2439 2703 44 2394 124 285 3694 3609 717 1413 155 974 1778 1448 1327 1487 3458 319 1395 3783 2184 2062 43 826 38 3276 807 1837 4635 171 1386 1768 1128 2020 2536 800 782 3058 174 455 83 647 595 658 109 33 23 70 39 38 1 6 35 94 9 22 12 6 1 2 2 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 9940\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 93\n1388 119 711 23 4960 4002 2707 188 813 1831 334 543 338 3402 1808 3368 1428 971 985 220 1521 457 457 140 332 1503 1539 2095 1891 269 5223 226 1528 190 428 5061 410 1587 1149 1934 2275 1337 1828 275 181 85 499 29 585 808 751 401 635 461 181 164 274 36 401 255 38 60 76 16 6 35 79 46 1 39 11 2 8 2 4 14 3 1 1 1 1 1 2 1 3 1 1 1 1 2 1 1 9948\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4981 51\n5364 2166 223 742 350 1309 15 229 4100 3988 227 1719 9 125 787 427 141 842 171 2519 32 2554 2253 721 775 88 720 9 397 513 100 291 111 32 238 42 152 108 5 58 96 53 7 19 11 2 5 5 6 2 4966\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "541 31\n607 204 308 298 398 213 1182 58 162 46 64 12 38 91 29 2 4 12 19 3 7 9 3 6 1 1 2 1 3 1 529\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n6 129 61 6 87 104 45 28 3 35 2 14 1 37 2 4 24 4 3 1 6 4 2 1 1 3 1 2 2 9 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 22\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 2 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n8 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n1 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n2 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n4 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n3 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 2 2 2 2 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n1 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n1 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 7\n2 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n1 1 1 1 1 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n12 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n4 1 3 1 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n2 2 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 15\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 2 2 1 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n6 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 13\n2 2 2 2 2 2 2 2 2 2 2 2 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 7\n1 1 1 4 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8\n8 2 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n1 1 1 1 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 2 2 1 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 2 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 9\n2 2 2 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n2 2 2 2 2 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n16\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 2 2 2 2 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 16\n1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 7\n4 1 1 1 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n2 2 2 5 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n22\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 2 2 1 1 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12\n2 1 2 2 2 1 2 2 2 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2 2 3 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n5 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n2 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n2 3 2 2 3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8\n2 2 1 1 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n3 3 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12\n2 2 2 2 2 2 2 2 2 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10\n2 2 2 2 2 2 2 2 2 3\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
189
Solve the following coding problem using the programming language python: Salem gave you $n$ sticks with integer positive lengths $a_1, a_2, \ldots, a_n$. For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length from $a$ to $b$ is $|a - b|$, where $|x|$ means the absolute value of $x$. A stick length $a_i$ is called almost good for some integer $t$ if $|a_i - t| \le 1$. Salem asks you to change the lengths of some sticks (possibly all or none), such that all sticks' lengths are almost good for some positive integer $t$ and the total cost of changing is minimum possible. The value of $t$ is not fixed in advance and you can choose it as any positive integer. As an answer, print the value of $t$ and the minimum cost. If there are multiple optimal choices for $t$, print any of them. -----Input----- The first line contains a single integer $n$ ($1 \le n \le 1000$) — the number of sticks. The second line contains $n$ integers $a_i$ ($1 \le a_i \le 100$) — the lengths of the sticks. -----Output----- Print the value of $t$ and the minimum possible cost. If there are multiple optimal choices for $t$, print any of them. -----Examples----- Input 3 10 1 4 Output 3 7 Input 5 1 1 2 2 3 Output 2 0 -----Note----- In the first example, we can change $1$ into $2$ and $10$ into $4$ with cost $|1 - 2| + |10 - 4| = 1 + 6 = 7$ and the resulting lengths $[2, 4, 4]$ are almost good for $t = 3$. In the second example, the sticks lengths are already almost good for $t = 2$, so we don't have to do anything. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) a = list(map(int,input().split())) t = 0 mn = 1000000000 for i in range(1,100): cur = 0 for j in range(n): cur += max(0,abs(i-a[j])-1) if cur < mn: mn = cur t = i print(t,mn) ```
vfc_10510
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1105/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n10 1 4\n", "output": "3 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 2 2 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n5\n", "output": "4 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 1\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n100 100 100 100 100\n", "output": "99 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "113\n86 67 31 33 72 100 88 63 16 12 79 80 76 45 31 96 44 10 24 33 53 11 56 100 23 57 9 48 28 73 18 48 12 89 73 9 51 11 82 94 90 92 34 99 54 58 33 67 35 87 58 90 94 64 57 80 87 99 84 99 20 1 63 12 16 40 50 95 33 58 7 23 71 89 53 15 95 29 71 16 65 21 66 89 82 30 6 45 6 66 58 32 27 78 28 42 8 61 10 26 7 55 76 65 100 38 79 1 23 81 55 58 38\n", "output": "54 2787\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n96 93 70\n", "output": "92 24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n100 54 93 96\n", "output": "94 45\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n75 94 58 66 98 95 87 74 65 78\n", "output": "76 104\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n89 65 98 94 52 71 67 88 70 79\n", "output": "72 113\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n91 54 87 88 79 62 62\n", "output": "78 82\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n94 56 100 70 91 79 74 60\n", "output": "75 96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n1 1 1 1 1 1 1 1 1 2 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 10\n", "output": "2 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 100\n", "output": "2 97\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 9 9\n", "output": "4 10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 4\n", "output": "3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 10\n", "output": "2 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 2 4\n", "output": "3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 1 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 2 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 4 5\n", "output": "3 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 10 11 11\n", "output": "3 22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 100 100\n", "output": "2 194\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 4 10 18 20 25\n", "output": "11 42\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 4 7\n", "output": "3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 5\n", "output": "4 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 1 10 10 10 10 10\n", "output": "9 14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 70 71\n", "output": "3 134\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 3 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 2 5\n", "output": "3 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 100 100\n", "output": "2 194\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 5 5\n", "output": "2 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 19 20\n", "output": "3 32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 29 30\n", "output": "3 52\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 9 9\n", "output": "2 12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n5 7 7\n", "output": "6 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 3 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 10 20 30 31 31\n", "output": "21 55\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 3 5\n", "output": "4 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 5\n", "output": "2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 6\n", "output": "2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 20\n", "output": "2 17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n4 4 4 7 7 7 7\n", "output": "6 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 100 100 100 100\n", "output": "99 97\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 5\n", "output": "2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 1 1 1 100 100 100\n", "output": "2 291\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 4\n", "output": "3 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 10 11\n", "output": "3 14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n2 11 13 14 18 20 20 21 22 23 25\n", "output": "19 43\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n8 8 8 8 8 8 8 8 9 10\n", "output": "9 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 100 100\n", "output": "99 97\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 4 4 4 6\n", "output": "5 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n5 5 5 5 5 5 5 5 5 9\n", "output": "6 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 100 100 100 100\n", "output": "2 388\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n7 14\n", "output": "8 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 1 97 98\n", "output": "2 189\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\n", "output": "2 4850\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n8 8 8 8 8 8 8 8 8 10\n", "output": "9 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 10 10\n", "output": "2 14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 1 99\n", "output": "2 96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 8 8\n", "output": "3 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 50 50\n", "output": "49 47\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 9 10\n", "output": "3 12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 1 1 1 1 9\n", "output": "2 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 5 100\n", "output": "3 98\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 97 98\n", "output": "2 189\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 3 5 5 7\n", "output": "4 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 9 9 12\n", "output": "8 14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 3\n", "output": "2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n66 100\n", "output": "67 32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 100\n", "output": "2 97\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n3 4 9 13 39 53 53 58 63 82 83\n", "output": "52 261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 10\n", "output": "2 7\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
190
Solve the following coding problem using the programming language python: Карта звёздного неба представляет собой прямоугольное поле, состоящее из n строк по m символов в каждой строке. Каждый символ — это либо «.» (означает пустой участок неба), либо «*» (означает то, что в этом месте на небе есть звезда). Новое издание карты звёздного неба будет напечатано на квадратных листах, поэтому требуется найти минимально возможную сторону квадрата, в который могут поместиться все звезды. Границы искомого квадрата должны быть параллельны сторонам заданного прямоугольного поля. -----Входные данные----- В первой строке входных данных записаны два числа n и m (1 ≤ n, m ≤ 1000) — количество строк и столбцов на карте звездного неба. В следующих n строках задано по m символов. Каждый символ — это либо «.» (пустой участок неба), либо «*» (звезда). Гарантируется, что на небе есть хотя бы одна звезда. -----Выходные данные----- Выведите одно число — минимально возможную сторону квадрата, которым можно накрыть все звезды. -----Примеры----- Входные данные 4 4 .... ..*. ...* ..** Выходные данные 3 Входные данные 1 3 *.* Выходные данные 3 Входные данные 2 1 . * Выходные данные 1 -----Примечание----- Один из возможных ответов на первый тестовый пример: [Image] Один из возможных ответов на второй тестовый пример (обратите внимание, что покрывающий квадрат выходит за пределы карты звездного неба): [Image] Ответ на третий тестовый пример: [Image] The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, m = input().split() n = int(n) m = int(m) a = [] N = n for i in range(n) : a.append(input().split()) for i in range(n) : if a[i][0].find('*') == -1 : n-=1 else : break if n != 1 : for i in range(len(a)-1,-1,-1) : if a[i][0].find('*') == -1 : n-=1 else : break #print(n) M = m br = 0 for i in range(m) : count = 0 for j in range(len(a)) : if a[j][0][i] != ('*') : count+=1 else : br = 1 break if br == 1 : break if count == N : m-=1 br = 0 if m != 1 : for i in range(M-1,-1,-1) : count = 0 for j in range(len(a)) : if a[j][0][i] != ('*') : count+=1 else : br = 1 break if br == 1 : break if count == N : m-=1 #print(m) if m > n : print(m) else : print(n) ```
vfc_10514
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/647/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 4\n....\n..*.\n...*\n..**\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n*.*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n.\n*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n.*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n*.\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n.\n*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n.\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n..*\n.**\n..*\n...\n..*\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 10\n..........\n......*...\n....**..*.\n...**.....\n...*......\n..........\n..**.*....\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 9\n.........\n......*..\n.........\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n...\n..*\n*..\n...\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n*.\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n.**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n*.*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n..**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n*..*\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n.*.**\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n.*..*\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n.\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n.*\n..\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n*.\n.*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n*..\n**.\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n*..\n..*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n.***\n.*.*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n*..*\n....\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n*..**\n.*.*.\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n.....\n*.*..\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n*\n*\n*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n*\n.\n*\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n..\n..\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n.*\n.*\n..\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n*..\n.**\n***\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n*..\n.*.\n...\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n.*..\n....\n....\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n..*.\n....\n..*.\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n.....\n*.*..\n.....\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n.....\n.*...\n..*..\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n.\n.\n*\n*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n*\n.\n*\n.\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n*.\n*.\n.*\n**\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n*.\n..\n..\n.*\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n...\n.**\n..*\n...\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n..*\n...\n...\n*..\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n..*.\n..*.\n.*..\n***.\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n....\n...*\n....\n..*.\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n*.*.*\n.....\n.....\n.....\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n.....\n...*.\n.*...\n.....\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n*\n*\n.\n.\n.\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n*\n.\n.\n.\n*\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n.*\n**\n**\n..\n**\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n*.\n..\n..\n..\n.*\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n...\n***\n..*\n.**\n**.\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n*..\n...\n...\n...\n.*.\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n*.**\n.*..\n.*..\n..*.\n*..*\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n....\n..*.\n....\n....\n..*.\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n....*\n....*\n....*\n..*..\n..*.*\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n.....\n..*..\n*....\n.....\n.....\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n**\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n*.\n.*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n.*\n*.\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n**\n..\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n..\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n*.\n*.\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n.*\n.*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n*.\n..\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n.*\n..\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n..\n*.\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n..\n.*\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n.*\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n*.\n**\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n**\n.*\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n**\n*.\n", "output": "2\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
191
Solve the following coding problem using the programming language python: A girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her. Given an array $a$ of length $n$, consisting only of the numbers $0$ and $1$, and the number $k$. Exactly $k$ times the following happens: Two numbers $i$ and $j$ are chosen equiprobable such that ($1 \leq i < j \leq n$). The numbers in the $i$ and $j$ positions are swapped. Sonya's task is to find the probability that after all the operations are completed, the $a$ array will be sorted in non-decreasing order. She turned to you for help. Help Sonya solve this problem. It can be shown that the desired probability is either $0$ or it can be represented as $\dfrac{P}{Q}$, where $P$ and $Q$ are coprime integers and $Q \not\equiv 0~\pmod {10^9+7}$. -----Input----- The first line contains two integers $n$ and $k$ ($2 \leq n \leq 100, 1 \leq k \leq 10^9$) — the length of the array $a$ and the number of operations. The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 1$) — the description of the array $a$. -----Output----- If the desired probability is $0$, print $0$, otherwise print the value $P \cdot Q^{-1}$ $\pmod {10^9+7}$, where $P$ and $Q$ are defined above. -----Examples----- Input 3 2 0 1 0 Output 333333336 Input 5 1 1 1 1 0 0 Output 0 Input 6 4 1 0 0 1 1 0 Output 968493834 -----Note----- In the first example, all possible variants of the final array $a$, after applying exactly two operations: $(0, 1, 0)$, $(0, 0, 1)$, $(1, 0, 0)$, $(1, 0, 0)$, $(0, 1, 0)$, $(0, 0, 1)$, $(0, 0, 1)$, $(1, 0, 0)$, $(0, 1, 0)$. Therefore, the answer is $\dfrac{3}{9}=\dfrac{1}{3}$. In the second example, the array will not be sorted in non-decreasing order after one operation, therefore the answer is $0$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python N, T = list(map(int, input().split())) A = [int(a) for a in input().split()] if sum(A) > N//2: A = [1-a for a in A][::-1] K = sum(A) S = sum(A[-K:]) M = K + 1 P = 10**9+7 inv = pow(N*(N-1)//2, P-2, P) X = [[0]*M for _ in range(M)] for i in range(M): if i > 0: X[i-1][i] = ((K-i+1)**2*inv)%P if i < M-1: X[i+1][i] = (N-2*K+i+1)*(i+1)*inv%P X[i][i] = (1-((K-i)**2*inv)-(N-2*K+i)*(i)*inv)%P def ddd(n): for i in range(1, 100): if (n*i%P) < 100: return (n*i%P), i return -1, -1 def poww(MM, n): if n == 1: return MM if n % 2: return mult(poww(MM, n-1), MM) return poww(mult(MM,MM), n//2) def mult(M1, M2): Y = [[0] * M for _ in range(M)] for i in range(M): for j in range(M): for k in range(M): Y[i][j] += M1[i][k] * M2[k][j] Y[i][j] %= P return Y X = poww(X, T) print(X[S][K]) ```
vfc_10518
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1151/F", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 2\n0 1 0\n", "output": "333333336", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n1 1 1 0 0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4\n1 0 0 1 1 0\n", "output": "968493834", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n1 1 1\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n1 1 1 0 0\n", "output": "280000002", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4\n0 0 1 1 1 1\n", "output": "163140742", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1000000000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 723\n1 0 1 1 0 0 1\n", "output": "943432053", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1000000000\n1 1 1 1 1 1\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 100\n0 1 1 1 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 0\n", "output": "95756105", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n1 0 1 0 1 0 1 0 1 0\n", "output": "335596758", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1000000000\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n0 1\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 10101010\n0 0 0 1 1 1\n", "output": "335257169", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "62 424941031\n1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 0 1\n", "output": "207127441", "type": "stdin_stdout" }, { "fn_name": null, "input": "95 205\n1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1\n", "output": "563696530", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n0 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 50550505\n1 1 1 1 1 0\n", "output": "975985364", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 708701895\n1 1 1 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 1 1 0 1\n", "output": "203682599", "type": "stdin_stdout" }, { "fn_name": null, "input": "93 208758396\n0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0\n", "output": "238422110", "type": "stdin_stdout" }, { "fn_name": null, "input": "74 418\n1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 1 0\n", "output": "729393563", "type": "stdin_stdout" }, { "fn_name": null, "input": "45 841192216\n0 1 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 0\n", "output": "899894444", "type": "stdin_stdout" }, { "fn_name": null, "input": "52 568367085\n1 1 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0\n", "output": "833347856", "type": "stdin_stdout" }, { "fn_name": null, "input": "71 1207\n0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 1 0 0 0 1 0\n", "output": "21677943", "type": "stdin_stdout" }, { "fn_name": null, "input": "59 34723\n0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "750975962", "type": "stdin_stdout" }, { "fn_name": null, "input": "39 67\n1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 1\n", "output": "398238624", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 77644065\n0 0 0 0 0 1 1 1 1 0 0 0 1 0\n", "output": "499901229", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 4074\n1 1 1 0 1 1 0 1\n", "output": "436122735", "type": "stdin_stdout" }, { "fn_name": null, "input": "41 885543234\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0\n", "output": "126904105", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 2\n0 1 0 0 0 1 0 0 0 1 0 0 1 0 0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n1 1 0 0\n", "output": "111111112", "type": "stdin_stdout" }, { "fn_name": null, "input": "98 207942770\n0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 1\n", "output": "357313797", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 3\n0 0 0 1 1 0 0 1 1 0 0 0\n", "output": "764212377", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 780\n0 1 0 1 1 1 1 1 0 0 0 0 1 0 1\n", "output": "672620496", "type": "stdin_stdout" }, { "fn_name": null, "input": "26 44790\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "88 51\n0 1 0 0 1 1 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1\n", "output": "122959231", "type": "stdin_stdout" }, { "fn_name": null, "input": "23 23\n0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1\n", "output": "109883453", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 170421784\n0 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 230\n0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0\n", "output": "755817224", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 758298525\n0 1 1 1 0 1 1 1\n", "output": "97561468", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 16935781\n0 0 0 0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "23 505\n1 0 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1\n", "output": "749682909", "type": "stdin_stdout" }, { "fn_name": null, "input": "28 298139068\n1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 1 0\n", "output": "46089768", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 705\n1 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 0\n", "output": "541107651", "type": "stdin_stdout" }, { "fn_name": null, "input": "54 505289730\n0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 1\n", "output": "499152797", "type": "stdin_stdout" }, { "fn_name": null, "input": "55 625625\n0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 1 0 0 0 1 1 0\n", "output": "566050219", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1000000000\n0 0 0 1 1\n", "output": "400007841", "type": "stdin_stdout" }, { "fn_name": null, "input": "64 575757\n0 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1\n", "output": "46693839", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 461613425\n0 1\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 445454545\n0 1 1 1 0 0 1 1 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 0 0\n", "output": "946149403", "type": "stdin_stdout" }, { "fn_name": null, "input": "64 355856085\n1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1\n", "output": "972843467", "type": "stdin_stdout" }, { "fn_name": null, "input": "93 915259084\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "731072361", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 9122\n0 1 1 1 1\n", "output": "907236024", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 1000000000\n0 0 1 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 1 1 1\n", "output": "758448092", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 6281\n1 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 0 0 1 1 0 1 1 1 0 0 1 0 0 0 1 0\n", "output": "623069108", "type": "stdin_stdout" }, { "fn_name": null, "input": "90 405601721\n0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "140653691", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 1000000000\n0 0 0 0 0 1 0 0 0 1 0 1 1 1 1 1\n", "output": "205157554", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 690557376\n1 0 0 0 1 1 0 1 0\n", "output": "33956123", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 772864\n0 0 0 0 1 0 0 0\n", "output": "240938600", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 761851245\n0 1 0 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 1 1\n", "output": "351133152", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 804858334\n1 1 1 1 1 1 1 1 1 1 1 1 1 0\n", "output": "673910319", "type": "stdin_stdout" }, { "fn_name": null, "input": "67 47245433\n0 1 0 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 0 0 1 1 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 0 0\n", "output": "6751531", "type": "stdin_stdout" }, { "fn_name": null, "input": "31 1000\n0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0\n", "output": "376636619", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 11111111\n0 0 0 0 1 1 0 1 0 0 0\n", "output": "900322483", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 1000000000\n1 1 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1\n", "output": "649450374", "type": "stdin_stdout" }, { "fn_name": null, "input": "47 36889\n0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0\n", "output": "882504914", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 1\n1 1 1 1 1 1 1 0 1 0 1 1 1\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 1000000000\n0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0\n", "output": "154218920", "type": "stdin_stdout" }, { "fn_name": null, "input": "26 458\n1 0 0 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 1\n", "output": "686869628", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9545372\n0 1 1 1\n", "output": "368007311", "type": "stdin_stdout" }, { "fn_name": null, "input": "22 1065\n0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 0\n", "output": "134992006", "type": "stdin_stdout" }, { "fn_name": null, "input": "52 816466148\n0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "892754580", "type": "stdin_stdout" }, { "fn_name": null, "input": "88 99999999\n1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0 0\n", "output": "944706678", "type": "stdin_stdout" }, { "fn_name": null, "input": "77 1000000000\n1 1 1 1 0 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1\n", "output": "436064901", "type": "stdin_stdout" }, { "fn_name": null, "input": "77 690082102\n0 0 1 1 0 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 1\n", "output": "79316649", "type": "stdin_stdout" } ] }
apps
verifiable_code
192
Solve the following coding problem using the programming language python: Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y. In a single second, he can modify the length of a single side of the current triangle such that it remains a non-degenerate triangle (triangle of positive area). At any moment of time, the length of each side should be integer. What is the minimum number of seconds required for Memory to obtain the equilateral triangle of side length y? -----Input----- The first and only line contains two integers x and y (3 ≤ y < x ≤ 100 000) — the starting and ending equilateral triangle side lengths respectively. -----Output----- Print a single integer — the minimum number of seconds required for Memory to obtain the equilateral triangle of side length y if he starts with the equilateral triangle of side length x. -----Examples----- Input 6 3 Output 4 Input 8 5 Output 3 Input 22 4 Output 6 -----Note----- In the first sample test, Memory starts with an equilateral triangle of side length 6 and wants one of side length 3. Denote a triangle with sides a, b, and c as (a, b, c). Then, Memory can do $(6,6,6) \rightarrow(6,6,3) \rightarrow(6,4,3) \rightarrow(3,4,3) \rightarrow(3,3,3)$. In the second sample test, Memory can do $(8,8,8) \rightarrow(8,8,5) \rightarrow(8,5,5) \rightarrow(5,5,5)$. In the third sample test, Memory can do: $(22,22,22) \rightarrow(7,22,22) \rightarrow(7,22,16) \rightarrow(7,10,16) \rightarrow(7,10,4) \rightarrow$ $(7,4,4) \rightarrow(4,4,4)$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x, y = list(map(int, input().split())) x, y = y, x A = x B = x curr = x count = 0 while curr < y: curr = B + A - 1 A, B = B, curr count += 1 count += 2 print(count) ```
vfc_10522
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/712/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "6 3\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22 4\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "57 27\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "61 3\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 6\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 10\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 5\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 24\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 3\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 7\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 6\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 3\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 9999\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999 3\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5323 32\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6666 66\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "38578 32201\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49449 5291\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "65310 32879\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41183 4453\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49127 9714\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19684 12784\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15332 5489\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33904 32701\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9258 2966\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21648 11231\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90952 47239\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49298 23199\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33643 24915\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40651 5137\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "52991 15644\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97075 62157\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82767 53725\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58915 26212\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "86516 16353\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14746 7504\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20404 7529\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "52614 8572\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50561 50123\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37509 7908\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36575 23933\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "75842 8002\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "47357 2692\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23214 4255\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9474 46\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79874 76143\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63784 31333\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70689 29493\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43575 4086\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87099 7410\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "75749 55910\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87827 20996\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31162 4580\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63175 33696\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15108 10033\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82991 29195\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48258 12837\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59859 33779\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "93698 23890\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42724 379\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70434 39286\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69826 18300\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "57825 17636\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64898 2076\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76375 67152\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30698 3778\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41 3\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28 4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2487 19\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 25000\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 3\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 3\n", "output": "6\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
193
Solve the following coding problem using the programming language python: The determinant of a matrix 2 × 2 is defined as follows:$\operatorname{det} \left(\begin{array}{ll}{a} & {b} \\{c} & {d} \end{array} \right) = a d - b c$ A matrix is called degenerate if its determinant is equal to zero. The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements. You are given a matrix $A = \left(\begin{array}{ll}{a} & {b} \\{c} & {d} \end{array} \right)$. Consider any degenerate matrix B such that norm ||A - B|| is minimum possible. Determine ||A - B||. -----Input----- The first line contains two integers a and b (|a|, |b| ≤ 10^9), the elements of the first row of matrix A. The second line contains two integers c and d (|c|, |d| ≤ 10^9) the elements of the second row of matrix A. -----Output----- Output a single real number, the minimum possible value of ||A - B||. Your answer is considered to be correct if its absolute or relative error does not exceed 10^{ - 9}. -----Examples----- Input 1 2 3 4 Output 0.2000000000 Input 1 0 0 1 Output 0.5000000000 -----Note----- In the first sample matrix B is $\left(\begin{array}{ll}{1.2} & {1.8} \\{2.8} & {4.2} \end{array} \right)$ In the second sample matrix B is $\left(\begin{array}{ll}{0.5} & {0.5} \\{0.5} & {0.5} \end{array} \right)$ The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def seg(x, y, h): A = [x - h, x + h] B = [y - h, y + h] Z = [] for a in A: for b in B: Z.append(a * b) Z.sort() return (Z[0], Z[-1]) def check(a, b, c, d, h): x1, y1 = seg(a, d, h) x2, y2 = seg(b, c, h) return max(x1, x2) <= min(y1, y2) a, b = list(map(int, input().split())) c, d = list(map(int, input().split())) l = 0 r = max(abs(a), abs(b), abs(c), abs(d)) for i in range(100): m = (l + r) / 2 if check(a, b, c, d, m): r = m else: l = m print((r + l) / 2) ```
vfc_10526
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/549/H", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 2\n3 4\n", "output": "0.2000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0\n0 1\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 0\n0 1000000000\n", "output": "500000000.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8205 9482\n11 -63\n", "output": "35.0198432832\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n0 0\n", "output": "0.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 -1000000000\n1000000000 1000000000\n", "output": "1000000000.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000\n1000000000 -1000000000\n", "output": "1000000000.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 -1\n1 0\n", "output": "0.3333333333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n-15 -6\n", "output": "0.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 -5\n-3 2\n", "output": "0.9166666667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-5 -2\n-1 -3\n", "output": "1.1818181818\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-5 8\n1 6\n", "output": "2.1111111111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n3 2\n", "output": "0.7777777778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-42 63\n77 -32\n", "output": "16.3878504673\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 -7\n-21 91\n", "output": "38.7333333333\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-67 -77\n-56 -75\n", "output": "2.5927272727\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-26 53\n-48 -89\n", "output": "29.6219512195\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 -934\n-707 184\n", "output": "334.2819979188\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "689 412\n-794 -421\n", "output": "16.0012953368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-718 -387\n972 972\n", "output": "105.5204985241\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-126 -376\n75 367\n", "output": "19.1122881356\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-7 -3674\n845 5737\n", "output": "298.5843320666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-9912 755\n-8220 6419\n", "output": "2268.9886983324\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-3928 5185\n4331 6665\n", "output": "3969.3426099731\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2056 9614\n-5171 8965\n", "output": "3141.2387756983\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41642 63236\n-59604 20357\n", "output": "32033.4760659150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-38387 -93294\n-52918 -51288\n", "output": "12582.8868737997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92812 73253\n-46231 11374\n", "output": "22109.0927374802\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12784 -94506\n26149 85264\n", "output": "18439.1869417765\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "955162 -709099\n-743655 578837\n", "output": "8557.1487662354\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "160382 -103968\n301943 -156088\n", "output": "8802.4244934460\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-634398 -468280\n447621 78431\n", "output": "98147.3248125840\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-398622 -832591\n-506781 -656493\n", "output": "66924.0413186624\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-2665612 -7693032\n-2861368 -6201836\n", "output": "282203.1726406262\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1762462 700391\n-7134185 5042962\n", "output": "1048758.9114990780\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6190536 5693104\n-8006293 -3712238\n", "output": "957535.4624752104\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "553632 5653328\n-7246622 9164341\n", "output": "2140390.1895580233\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43469186 94408326\n78066381 -19616812\n", "output": "41883387.4306073852\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25683826 49101909\n88380777 46573745\n", "output": "14987456.1603828062\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-87068851 98762810\n3727856 -87235696\n", "output": "26110777.7289122988\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95145788 53456393\n42406028 83987544\n", "output": "20815549.6776987243\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "876432079 -414820618\n-816514132 -914565422\n", "output": "520028295.4718751899\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-240038673 376842703\n-241080203 410087456\n", "output": "5983627.7655281517\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "938457872 -536526676\n867891897 -855194260\n", "output": "105349963.0995401485\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "116954418 255136645\n-851641472 174491320\n", "output": "204147910.8375163887\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1 5\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n1 1\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n1 1\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n5 1\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -1000000000\n1000000000 1000000000\n", "output": "0.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -1000000000\n999999999 999999999\n", "output": "0.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "536870912 88\n536870912 22528\n", "output": "11219.7636804586\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "268435456 268435456\n22512 22528\n", "output": "7.9993289080\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 1\n1 1\n", "output": "1.0000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000 -999\n-1 0\n", "output": "0.4995000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-801658422 -738703776\n910442649 -920729415\n", "output": "744753719.5468964978\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-203893419 -777818\n295920256 -474540430\n", "output": "99618123.5339717944\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "448944609 529185527\n946362390 958011342\n", "output": "24529803.2444389601\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "348741875 -606207234\n-279810821 -14278204\n", "output": "143060520.9047362779\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-202195424 182466434\n-722509868 -838173079\n", "output": "190651913.7089770083\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-48 9\n17 -67\n", "output": "21.7234042553\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 180\n79 47\n", "output": "42.9433962264\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-131 -87\n-66 -109\n", "output": "21.7226463104\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "171 17\n9 93\n", "output": "54.3103448276\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "221 20\n-22 -200\n", "output": "94.5140388769\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "372 -352\n-160 -423\n", "output": "216.4903748734\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "480 37\n-3 -459\n", "output": "224.9325842697\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-535 -395\n-264 513\n", "output": "321.2340966921\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-498 -685\n-532 526\n", "output": "503.1068273092\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-16 450\n-848 27\n", "output": "284.2416107383\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-621967643 610314360\n-660274542 -772630232\n", "output": "611623765.8647500770\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "222416863 97256131\n897661932 -426944193\n", "output": "125718637.9005708302\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67861199 302935298\n883117733 559626116\n", "output": "126575973.2879779836\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1\n1000000000 2\n", "output": "0.4999999993\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-2 1\n1 -2\n", "output": "0.5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999999995\n99999999 -199992543\n", "output": "142854098.7306812546\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
194
Solve the following coding problem using the programming language python: In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. If there are none of them, it is seated at a two-seater table occupied by single person. If there are still none of them, the restaurant denies service to this group. If a group consist of two people, it is seated at a vacant two-seater table. If there are none of them, the restaurant denies service to this group. You are given a chronological order of groups coming. You are to determine the total number of people the restaurant denies service to. -----Input----- The first line contains three integers n, a and b (1 ≤ n ≤ 2·10^5, 1 ≤ a, b ≤ 2·10^5) — the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t_1, t_2, ..., t_{n} (1 ≤ t_{i} ≤ 2) — the description of clients in chronological order. If t_{i} is equal to one, then the i-th group consists of one person, otherwise the i-th group consists of two people. -----Output----- Print the total number of people the restaurant denies service to. -----Examples----- Input 4 1 2 1 2 1 1 Output 0 Input 4 1 1 1 1 2 1 Output 2 -----Note----- In the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the remaining seat at the two-seater table. Thus, all clients are served. In the second example the first group consists of one person, it is seated at the vacant one-seater table. The next group consists of one person, it occupies one place at the two-seater table. It's impossible to seat the next group of two people, so the restaurant denies service to them. The fourth group consists of one person, he is seated at the remaining seat at the two-seater table. Thus, the restaurant denies service to 2 clients. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, a, b = list(map(int,input().split())) l = input().split() o = 0 c = 0 for i in l: if i == '2': if b > 0: b -= 1 else: o += 2 if i == '1': if a > 0: a -= 1 elif b > 0: b -= 1 c += 1 elif c > 0: c -= 1 else: o += 1 print(o) ```
vfc_10530
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/828/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 1 2\n1 2 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 1\n1 1 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 3\n1 2 2 2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 6 1\n1 1 1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2 1\n2 1 2 2 2 2 1 2 1 2\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 4 3\n2 2 2 2 2 2 2 2 1 2 1 1 2 2 1 2 2 2 1 2\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 200000 200000\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 10 10\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2\n1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2 3\n1 2 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 4\n1 1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 1 1 1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 2\n2 1 2 2 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 1\n2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 3\n1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 2\n1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 5 5\n1 1 1 1 1 1 1 1 1 1 2 2 2 2 2\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 2\n1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6 1\n2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 3\n2 2 2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3 3\n1 1 1 1 1 1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 2\n1 1 1 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 4\n1 2 2 1 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1\n2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1\n2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 8 1\n2 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 4\n1 1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 5\n1 1 1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 1 1 2 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 2\n1 1 1 2 2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 1 4\n2 1 1 1 2 2 2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 3\n2 2 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 1\n1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 1\n2 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1 5\n1 1 1 1 1 2 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 2\n1 1 1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 1\n1 1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 2\n1 1 1 1 1 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 4\n2 2 2 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2 3\n1 1 1 1 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 2\n2 1 2 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6 1\n2 2 2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 4\n1 1 2 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 3\n1 1 1 1 2 2 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2\n1 1 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 2\n1 1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 2 1 1 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 1 1 2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2 2\n1 1 1 1 2 2 2 2 2 2\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1 4\n1 1 1 1 1 2 2 2 2 2\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 2\n2 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 1\n1 2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 4\n1 1 1 1 1 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 1\n2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2\n2 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1 2\n1 1 1 1 1 1 1 1 1 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 3\n1 1 2 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 3\n1 1 1 1 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 4\n1 1 1 2 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1 2\n1 2 1 1 1 1 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2 2\n1 1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1 2\n1 1 2 1 1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 1\n2 2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 4 2\n1 1 1 1 1 1 1 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 1 4\n1 1 1 1 1 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10 1\n2 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5 1\n2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 100 1\n2 2 2 2 2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2\n1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 1\n1 1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 2 2\n1 1 1 1 1 1 1\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
195
Solve the following coding problem using the programming language python: Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful and celebrated after the exam. Some of them celebrated in the BugDonalds restaurant, some of them — in the BeaverKing restaurant, the most successful ones were fast enough to celebrate in both of restaurants. Students which didn't pass the exam didn't celebrate in any of those restaurants and elected to stay home to prepare for their reexamination. However, this quickly bored Vasya and he started checking celebration photos on the Kilogramm. He found out that, in total, BugDonalds was visited by $A$ students, BeaverKing — by $B$ students and $C$ students visited both restaurants. Vasya also knows that there are $N$ students in his group. Based on this info, Vasya wants to determine either if his data contradicts itself or, if it doesn't, how many students in his group didn't pass the exam. Can you help him so he won't waste his valuable preparation time? -----Input----- The first line contains four integers — $A$, $B$, $C$ and $N$ ($0 \leq A, B, C, N \leq 100$). -----Output----- If a distribution of $N$ students exists in which $A$ students visited BugDonalds, $B$ — BeaverKing, $C$ — both of the restaurants and at least one student is left home (it is known that Vasya didn't pass the exam and stayed at home), output one integer — amount of students (including Vasya) who did not pass the exam. If such a distribution does not exist and Vasya made a mistake while determining the numbers $A$, $B$, $C$ or $N$ (as in samples 2 and 3), output $-1$. -----Examples----- Input 10 10 5 20 Output 5 Input 2 2 0 4 Output -1 Input 2 2 2 1 Output -1 -----Note----- The first sample describes following situation: $5$ only visited BugDonalds, $5$ students only visited BeaverKing, $5$ visited both of them and $5$ students (including Vasya) didn't pass the exam. In the second sample $2$ students only visited BugDonalds and $2$ only visited BeaverKing, but that means all $4$ students in group passed the exam which contradicts the fact that Vasya didn't pass meaning that this situation is impossible. The third sample describes a situation where $2$ students visited BugDonalds but the group has only $1$ which makes it clearly impossible. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a,b,c,n=list(map(int,input().split())) x=a+b-c print(n-x if c<=a and c<=b and x<n else -1) ```
vfc_10534
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/991/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "10 10 5 20\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 0 4\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 2 1\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "98 98 97 100\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5 2 10\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 2 10\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7 5 8\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7 5 9\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7 5 7\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 50 1 100\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3 2 12\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 19 6 25\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 0 99\n", "output": "98", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 0 98\n", "output": "97", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0 97\n", "output": "95", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 96\n", "output": "95", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 0 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 0 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 0 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 100 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 100 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 100 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100 0\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0 100\n", "output": "100", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 0 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 0 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 0 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 100 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 0 100 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 100 100 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100 100\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 45 7 52\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 1 1 68\n", "output": "30", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 45 2 67\n", "output": "16", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 36 18 65\n", "output": "11", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 30 8 59\n", "output": "27", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 20 12 49\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 19 4 38\n", "output": "15", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 21 17 72\n", "output": "32", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 12 12 89\n", "output": "75", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 6 1 44\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 4 6 82\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 17 56\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 5 29 90\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "22 36 18 55\n", "output": "15", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 0 19 75\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "62 65 10 89\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 29 31 72\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 31 19 55\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 25 28 88\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 32 28 33\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "43 36 1 100\n", "output": "22", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 39 55 70\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 0 91\n", "output": "86", "type": "stdin_stdout" }, { "fn_name": null, "input": "55 29 12 48\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 33 20 88\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 38 27 99\n", "output": "48", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 28 14 84\n", "output": "52", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 25 25 92\n", "output": "58", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 24 5 76\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 22 16 96\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0 4\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 3 1\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0 1\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 0 8\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 2 5\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 1 3\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0 0 4\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0 5\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 0 3\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6 1 7\n", "output": "-1", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 10 11\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 0 10\n", "output": "10", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 15 5 30\n", "output": "15", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 0 7\n", "output": "2", "type": "stdin_stdout" } ] }
apps
verifiable_code
196
Solve the following coding problem using the programming language python: Nastya received a gift on New Year — a magic wardrobe. It is magic because in the end of each month the number of dresses in it doubles (i.e. the number of dresses becomes twice as large as it is in the beginning of the month). Unfortunately, right after the doubling the wardrobe eats one of the dresses (if any) with the 50% probability. It happens every month except the last one in the year. Nastya owns x dresses now, so she became interested in the expected number of dresses she will have in one year. Nastya lives in Byteland, so the year lasts for k + 1 months. Nastya is really busy, so she wants you to solve this problem. You are the programmer, after all. Also, you should find the answer modulo 10^9 + 7, because it is easy to see that it is always integer. -----Input----- The only line contains two integers x and k (0 ≤ x, k ≤ 10^18), where x is the initial number of dresses and k + 1 is the number of months in a year in Byteland. -----Output----- In the only line print a single integer — the expected number of dresses Nastya will own one year later modulo 10^9 + 7. -----Examples----- Input 2 0 Output 4 Input 2 1 Output 7 Input 3 2 Output 21 -----Note----- In the first example a year consists on only one month, so the wardrobe does not eat dresses at all. In the second example after the first month there are 3 dresses with 50% probability and 4 dresses with 50% probability. Thus, in the end of the year there are 6 dresses with 50% probability and 8 dresses with 50% probability. This way the answer for this test is (6 + 8) / 2 = 7. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x, k = map(int, input().split()) if x == 0: print(0) else: mod = 10 ** 9 + 7 p = pow(2, k, mod) ans = (x * (p * 2) - (p - 1)) % mod print(ans) ```
vfc_10538
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/992/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 0\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 411\n", "output": "485514976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 692\n", "output": "860080936\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 8\n", "output": "7937\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 12\n", "output": "143361\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000000000\n", "output": "719476261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 24\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24 0\n", "output": "48\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1\n", "output": "195\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "348612312017571993 87570063840727716\n", "output": "551271547\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "314647997243943415 107188213956410843\n", "output": "109575135\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "375000003 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "451 938\n", "output": "598946958\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1669\n", "output": "185365669\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24 347\n", "output": "860029201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1619 1813\n", "output": "481568710\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "280 472\n", "output": "632090765\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1271 237\n", "output": "27878991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "626 560\n", "output": "399405853\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "167 887\n", "output": "983959273\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1769 422\n", "output": "698926874\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "160 929\n", "output": "752935252\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1075 274\n", "output": "476211777\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1332 332\n", "output": "47520583\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "103872254428948073 97291596742897547\n", "output": "283633261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "157600018563121064 54027847222622605\n", "output": "166795759\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "514028642164226185 95344332761644668\n", "output": "718282571\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91859547444219924 75483775868568438\n", "output": "462306789\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "295961633522750187 84483303945499729\n", "output": "11464805\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8814960236468055 86463151557693391\n", "output": "430718856\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "672751296745170589 13026894786355983\n", "output": "260355651\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "909771081413191574 18862935031728197\n", "output": "800873185\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "883717267463724670 29585639347346605\n", "output": "188389362\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "431620727626880523 47616788361847228\n", "output": "311078131\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "816689044159694273 6475970360049048\n", "output": "211796030\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "313779810374175108 13838123840048842\n", "output": "438854949\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "860936792402722414 59551033597232946\n", "output": "359730003\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "332382902893992163 15483141652464187\n", "output": "719128379\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "225761360057436129 49203610094504526\n", "output": "54291755\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "216006901533424028 8313457244750219\n", "output": "362896012\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "568001660010321225 97167523790774710\n", "output": "907490480\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "904089164817530426 53747406876903279\n", "output": "702270335\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "647858974461637674 18385058205826214\n", "output": "375141527\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "720433754707338458 94180351080265292\n", "output": "273505123\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "268086842387268316 76502855388264782\n", "output": "288717798\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "488603693655520686 79239542983498430\n", "output": "316399174\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "152455635055802121 50394545488662355\n", "output": "697051907\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "585664029992038779 34972826534657555\n", "output": "699566354\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "349532090641396787 12248820623854158\n", "output": "233938854\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "353579407209009179 74469254935824590\n", "output": "771349161\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "491414900908765740 49509676303815755\n", "output": "237095803\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91142854626119420 900651524977956\n", "output": "211575546\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "73543340229981083 66918326344192076\n", "output": "710215652\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "463958371369193376 89203995753927042\n", "output": "41857490\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "911873413622533246 54684577459651780\n", "output": "926432198\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "316313018463929883 78259904441946885\n", "output": "36284201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "889560480100219043 54181377424922141\n", "output": "281123162\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 3259862395629356\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 1\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 2\n", "output": "1000000004\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 12\n", "output": "999995912\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 70\n", "output": "729983755\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "250000002 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 3\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 0\n", "output": "999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 5\n", "output": "999999976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000007 1000000007\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000000000000 0\n", "output": "860000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000 0\n", "output": "999986007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999999999 0\n", "output": "600000012\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000 0\n", "output": "986000007\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
197
Solve the following coding problem using the programming language python: An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $n$ problems; and since the platform is very popular, $998244351$ coder from all over the world is going to solve them. For each problem, the authors estimated the number of people who would solve it: for the $i$-th problem, the number of accepted solutions will be between $l_i$ and $r_i$, inclusive. The creator of ForceCoders uses different criteria to determine if the contest is good or bad. One of these criteria is the number of inversions in the problem order. An inversion is a pair of problems $(x, y)$ such that $x$ is located earlier in the contest ($x < y$), but the number of accepted solutions for $y$ is strictly greater. Obviously, both the creator of ForceCoders and the authors of the contest want the contest to be good. Now they want to calculate the probability that there will be no inversions in the problem order, assuming that for each problem $i$, any integral number of accepted solutions for it (between $l_i$ and $r_i$) is equally probable, and all these numbers are independent. -----Input----- The first line contains one integer $n$ ($2 \le n \le 50$) — the number of problems in the contest. Then $n$ lines follow, the $i$-th line contains two integers $l_i$ and $r_i$ ($0 \le l_i \le r_i \le 998244351$) — the minimum and maximum number of accepted solutions for the $i$-th problem, respectively. -----Output----- The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $\frac{x}{y}$, where $y$ is coprime with $998244353$. Print one integer — the value of $xy^{-1}$, taken modulo $998244353$, where $y^{-1}$ is an integer such that $yy^{-1} \equiv 1$ $(mod$ $998244353)$. -----Examples----- Input 3 1 2 1 2 1 2 Output 499122177 Input 2 42 1337 13 420 Output 578894053 Input 2 1 1 0 0 Output 1 Input 2 1 1 1 1 Output 1 -----Note----- The real answer in the first test is $\frac{1}{2}$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python from bisect import bisect_left M = 998244353 def pw(x, y): if y == 0: return 1 res = pw(x, y//2) res = res * res % M if y % 2 == 1: res = res * x % M return res def cal(x, y): y += x - 1 res = 1 for i in range(1, x + 1): res = res * (y - i + 1) res = res * pw(i, M - 2) % M return res % M n = int(input()) a = [] b = [] res = 1 for i in range(n): a.append(list(map(int, input().split()))) res = res * (a[-1][1] + 1 - a[-1][0]) % M b.append(a[-1][0]) b.append(a[-1][1] + 1) b = set(b) b = sorted(list(b)) g = [b[i + 1] - b[i] for i in range(len(b) - 1)] for i in range(n): a[i][0] = bisect_left(b, a[i][0]) a[i][1] = bisect_left(b, a[i][1] + 1) a = a[::-1] f = [[0 for _ in range(len(b))] for __ in range(n)] for i in range(a[0][0], len(b)): if i == 0: f[0][i] = g[i] else: if i < a[0][1]: f[0][i] = (f[0][i - 1] + g[i]) % M else: f[0][i] = f[0][i - 1] for i in range(1, n): for j in range(a[i][0], len(b)): if j > 0: f[i][j] = f[i][j - 1] if j < a[i][1]: for k in range(i, -1, -1): if a[k][1] <= j or j < a[k][0]: break if k == 0 or j != 0: tmp = cal(i - k + 1, g[j]) if k > 0: f[i][j] += f[k - 1][j - 1] * tmp % M else: f[i][j] += tmp f[i][j] %= M #print(f) #print(f[n - 1][len(b) - 1], res) print(f[n - 1][len(b) - 1] * pw(res, M - 2) % M) ```
vfc_10542
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1295/F", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n1 2\n1 2\n1 2\n", "output": "499122177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n42 1337\n13 420\n", "output": "578894053\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n0 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n0 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1\n0 1\n", "output": "249561089\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0\n0 1\n", "output": "499122177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0\n0 1\n", "output": "499122177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0\n0 1\n", "output": "499122177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1\n1 1\n", "output": "499122177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10 34\n17 26\n", "output": "818560370\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n12 19\n39 69\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n25 29\n29 78\n", "output": "930363737\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 38\n52 99\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n14 49\n41 52\n", "output": "228764331\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n21 93\n15 70\n", "output": "982860451\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1378 72243\n23169 96615\n", "output": "872616547\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n6509 18946\n66363 93596\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n40776 60862\n20449 79682\n", "output": "447250007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n50696 78430\n1009 98884\n", "output": "161808275\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n84964 95998\n22337 77318\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n38680 95906\n66084 96498\n", "output": "116346445\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n86080945 900334037\n283817560 816700236\n", "output": "990443786\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n105001489 202733825\n260379286 951276926\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n727901809 780202030\n645657763 702302687\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n359425882 746822353\n38048713 724795689\n", "output": "25745160\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n240639622 765742897\n470464627 730673903\n", "output": "515321057\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n754872424 926908966\n219572916 995287694\n", "output": "555664178\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 1\n0 1\n0 0\n0 0\n0 0\n0 1\n1 1\n1 1\n0 1\n0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 1\n0 0\n1 1\n0 1\n0 1\n0 0\n0 1\n0 0\n0 1\n0 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1\n0 1\n0 1\n0 1\n1 1\n0 1\n0 1\n1 1\n0 1\n0 1\n", "output": "974848001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1\n1 1\n0 0\n0 0\n1 1\n0 1\n1 1\n0 0\n1 1\n0 0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1\n1 1\n0 1\n0 1\n0 1\n1 1\n0 0\n1 1\n0 1\n0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n", "output": "987521025\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n41 52\n82 97\n37 76\n42 82\n91 97\n6 94\n29 96\n3 76\n60 91\n16 60\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n30 83\n2 19\n50 93\n27 36\n82 88\n39 95\n4 97\n23 75\n37 53\n15 69\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n48 76\n12 20\n24 36\n54 72\n30 79\n5 74\n55 80\n54 85\n60 91\n20 59\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n54 58\n42 65\n77 92\n27 37\n2 21\n38 85\n88 89\n74 84\n0 56\n4 47\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n67 67\n32 75\n2 51\n4 88\n62 80\n37 97\n46 64\n4 83\n53 54\n2 56\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 85\n0 14\n0 65\n0 76\n0 56\n0 23\n0 34\n0 24\n0 68\n0 13\n", "output": "159813282\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2139 77689\n7692 31588\n39321 54942\n48988 55097\n46970 54864\n61632 70126\n4240 37374\n69600 79133\n69308 91118\n12408 56672\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n11955 30601\n10022 29020\n67511 97636\n6159 48409\n24834 39598\n66437 72414\n7968 12307\n20918 83151\n50739 85006\n6049 71253\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n21875 48170\n26001 64110\n71355 99916\n41721 52438\n2697 24332\n49294 58850\n27652 76457\n51810 61461\n25049 34708\n5750 31079\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n56142 90085\n7302 12087\n77850 86092\n35033 58303\n4908 9066\n20938 45605\n20597 78238\n69249 75012\n5506 59089\n15697 64595\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n7652 90409\n33415 61390\n20543 89936\n28345 80234\n7118 93802\n7374 17569\n17929 89085\n140 88563\n43057 45550\n40728 74746\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n25823 99883\n48624 99584\n52672 99474\n10956 99906\n56493 99804\n38589 99933\n63666 99555\n65591 99572\n8450 99921\n42834 99917\n", "output": "367159257\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n435368449 906834606\n329478288 810620704\n337438370 425488467\n261210437 952223320\n489526021 754503172\n826073281 936684995\n270748702 993400655\n175130673 281932203\n585827654 710872711\n22140424 777277629\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n14592301 925755150\n49981402 203011654\n452726617 976821979\n467112999 945037753\n260612539 372077071\n530976641 871876506\n154188384 306542825\n926936004 982826136\n52360908 432533746\n516279982 585592522\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n550411118 894050393\n174216555 793894691\n203140702 315971348\n258826743 630620717\n31699058 291640859\n235880001 412803442\n315939459 759048353\n685475718 957321047\n179360604 240314450\n834096287 847054732\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n171284358 569331662\n816387693 866841745\n230378852 628199244\n14213793 469970886\n104775464 907459110\n649984841 964193536\n627325981 944477922\n86135411 710882026\n705092056 899265991\n110272590 153668239\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n588252206 748752562\n259232694 260066743\n269338501 559606889\n1786645 286850453\n550198833 572116446\n308352289 971086784\n242458040 551093539\n741267069 787029344\n591055711 646092849\n673724688 890914944\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n281810232 762606772\n269783510 738093461\n205086180 673338873\n83658884 990305706\n174551518 969757411\n12272556 981294098\n271749430 909945032\n62307770 939073496\n178435963 842807921\n177044261 712460424\n", "output": "221646382\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 1\n0 0\n0 1\n0 1\n0 1\n0 0\n0 1\n0 0\n0 1\n0 0\n0 1\n0 1\n0 1\n0 1\n0 0\n1 1\n0 0\n1 1\n0 1\n0 1\n1 1\n0 1\n0 1\n0 1\n0 0\n1 1\n0 1\n1 1\n1 1\n0 1\n0 1\n0 0\n0 0\n0 1\n0 1\n0 1\n1 1\n1 1\n0 0\n0 1\n0 1\n0 1\n0 1\n0 1\n1 1\n0 1\n0 1\n1 1\n0 0\n0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 1\n1 1\n0 0\n1 1\n1 1\n0 1\n1 1\n1 1\n1 1\n0 1\n0 0\n0 1\n0 0\n0 1\n0 0\n1 1\n1 1\n0 0\n0 1\n1 1\n0 1\n0 1\n0 1\n0 1\n0 1\n1 1\n0 0\n0 1\n0 0\n0 1\n0 1\n0 1\n1 1\n0 1\n0 0\n0 1\n0 1\n0 1\n0 1\n0 0\n1 1\n0 1\n0 0\n0 1\n0 1\n0 0\n0 1\n0 1\n1 1\n0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 0\n1 1\n0 1\n0 1\n0 1\n1 1\n0 0\n0 0\n0 1\n0 1\n0 1\n0 1\n1 1\n0 1\n0 1\n0 0\n0 1\n0 1\n1 1\n0 0\n0 1\n0 0\n0 0\n1 1\n0 1\n0 1\n0 1\n0 1\n1 1\n1 1\n0 0\n0 0\n0 1\n0 1\n0 1\n0 0\n0 1\n0 1\n0 0\n0 1\n1 1\n0 0\n0 1\n1 1\n0 1\n0 0\n0 1\n1 1\n1 1\n0 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 0\n1 1\n1 1\n1 1\n0 1\n1 1\n0 0\n1 1\n0 1\n0 0\n0 1\n0 1\n0 1\n0 1\n1 1\n0 0\n1 1\n0 1\n0 1\n0 0\n0 0\n1 1\n0 0\n1 1\n0 0\n0 0\n1 1\n0 1\n0 0\n0 1\n1 1\n0 1\n0 0\n1 1\n0 0\n1 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 0\n1 1\n0 1\n0 1\n1 1\n0 1\n0 1\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 0\n0 0\n0 0\n1 1\n0 1\n0 1\n0 1\n0 1\n0 0\n0 1\n0 0\n0 1\n1 1\n0 1\n1 1\n0 0\n0 0\n0 0\n1 1\n1 1\n0 1\n0 1\n1 1\n0 1\n0 1\n0 0\n0 1\n0 1\n0 1\n1 1\n0 1\n0 0\n1 1\n0 0\n0 1\n0 1\n0 0\n0 0\n0 1\n1 1\n0 0\n0 1\n0 1\n0 0\n0 0\n0 1\n0 0\n1 1\n1 1\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n0 1\n1 1\n0 1\n0 1\n0 1\n0 1\n1 1\n0 1\n0 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n0 1\n1 1\n1 1\n1 1\n0 1\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n1 1\n0 1\n1 1\n0 1\n0 1\n1 1\n0 1\n0 1\n0 1\n1 1\n1 1\n1 1\n0 1\n1 1\n1 1\n", "output": "998243877\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n0 53\n0 52\n12 27\n38 89\n29 70\n19 56\n9 15\n22 24\n86 93\n69 97\n42 89\n27 36\n28 56\n48 56\n37 79\n42 47\n38 52\n5 47\n5 22\n25 31\n53 74\n29 48\n18 42\n10 94\n10 36\n29 64\n48 55\n0 6\n10 13\n14 90\n60 84\n9 42\n20 44\n77 78\n36 65\n4 99\n75 79\n23 79\n61 87\n28 63\n29 81\n39 76\n35 91\n5 84\n14 30\n20 21\n68 93\n61 81\n75 77\n34 79\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n47 52\n62 91\n23 80\n39 94\n88 94\n31 45\n73 86\n23 75\n7 100\n53 85\n62 65\n40 81\n2 71\n20 95\n34 39\n4 24\n9 21\n67 85\n48 65\n83 99\n19 25\n48 69\n86 97\n34 99\n7 80\n27 43\n38 65\n14 31\n4 86\n39 52\n73 99\n28 50\n3 48\n64 88\n64 88\n31 98\n31 62\n10 52\n7 15\n45 46\n48 75\n21 100\n6 96\n8 30\n34 36\n51 76\n7 95\n2 96\n36 50\n26 55\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n25 28\n12 15\n53 79\n22 38\n47 52\n42 44\n61 74\n34 73\n28 50\n4 40\n14 99\n33 44\n46 81\n40 61\n32 54\n12 45\n72 91\n0 60\n52 57\n11 72\n42 87\n35 44\n64 96\n57 69\n48 83\n22 82\n8 40\n54 95\n52 73\n7 72\n26 84\n23 58\n20 44\n52 97\n70 100\n2 97\n13 88\n8 58\n44 87\n40 84\n78 94\n22 47\n22 67\n35 76\n42 87\n48 63\n40 59\n23 54\n7 92\n7 20\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n37 38\n2 24\n34 95\n40 84\n38 43\n21 77\n42 69\n66 93\n3 69\n56 85\n55 65\n16 75\n15 89\n58 86\n48 62\n23 54\n16 56\n32 71\n16 45\n44 74\n58 99\n30 54\n39 41\n39 81\n92 93\n12 80\n6 63\n25 61\n16 100\n1 100\n5 66\n52 99\n2 16\n40 50\n11 65\n74 97\n44 65\n29 31\n40 44\n23 33\n12 96\n12 29\n16 38\n90 95\n4 18\n11 50\n9 99\n12 44\n32 79\n30 32\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n16 47\n24 34\n12 78\n72 91\n68 98\n22 76\n44 66\n12 65\n65 81\n40 72\n87 97\n20 28\n64 94\n9 55\n92 98\n68 84\n6 8\n19 26\n37 41\n50 60\n10 19\n52 84\n19 61\n3 44\n67 72\n11 23\n31 83\n78 91\n80 93\n35 64\n16 70\n6 47\n6 89\n60 84\n34 60\n1 52\n22 27\n16 38\n69 91\n39 72\n26 63\n3 44\n64 66\n65 68\n21 95\n19 37\n5 11\n32 48\n5 39\n13 28\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n4 66\n6 49\n8 32\n0 73\n0 46\n10 58\n0 58\n9 46\n0 33\n1 24\n5 76\n6 19\n7 92\n0 56\n5 27\n7 31\n3 56\n11 66\n3 51\n6 53\n4 29\n9 27\n10 94\n7 66\n5 32\n9 51\n6 97\n3 33\n8 44\n10 73\n4 96\n8 52\n10 100\n3 81\n9 94\n2 76\n11 83\n10 72\n6 56\n3 81\n0 96\n8 32\n9 88\n6 26\n0 99\n6 53\n10 24\n11 56\n10 72\n9 51\n", "output": "280107165\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n", "output": "987521025\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 10\n3 10\n3 10\n3 10\n3 10\n3 10\n3 10\n3 10\n3 10\n3 10\n", "output": "561494368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n34 50\n34 50\n34 50\n34 50\n34 50\n34 50\n34 50\n34 50\n34 50\n34 50\n", "output": "801164847\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n45 98\n45 98\n45 98\n45 98\n45 98\n45 98\n45 98\n45 98\n45 98\n45 98\n", "output": "207527825\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n98 193\n98 193\n98 193\n98 193\n98 193\n98 193\n98 193\n98 193\n98 193\n98 193\n", "output": "232974654\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n58977 99307\n", "output": "449467043\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n295314256 608527638\n", "output": "565526803\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n5 10\n", "output": "210464987\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n25 50\n", "output": "791565582\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n48 100\n", "output": "970752233\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n89 199\n", "output": "164998844\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
198
Solve the following coding problem using the programming language python: Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n. Pasha likes rectangles but hates squares, so he wonders, how many ways are there to split a stick into four parts so that it's possible to form a rectangle using these parts, but is impossible to form a square. Your task is to help Pasha and count the number of such ways. Two ways to cut the stick are considered distinct if there exists some integer x, such that the number of parts of length x in the first way differ from the number of parts of length x in the second way. -----Input----- The first line of the input contains a positive integer n (1 ≤ n ≤ 2·10^9) — the length of Pasha's stick. -----Output----- The output should contain a single integer — the number of ways to split Pasha's stick into four parts of positive integer length so that it's possible to make a rectangle by connecting the ends of these parts, but is impossible to form a square. -----Examples----- Input 6 Output 1 Input 20 Output 4 -----Note----- There is only one way to divide the stick in the first sample {1, 1, 2, 2}. Four ways to divide the stick in the second sample are {1, 1, 9, 9}, {2, 2, 8, 8}, {3, 3, 7, 7} and {4, 4, 6, 6}. Note that {5, 5, 5, 5} doesn't work. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x = int(input()) if x%2==1: print(0) quit() if x%2 ==0: x//=2 if x%2==0: print(x//2-1) else: print(x//2) ```
vfc_10546
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/610/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000000000\n", "output": "499999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1924704072\n", "output": "481176017\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "73740586\n", "output": "18435146\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1925088820\n", "output": "481272204\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "593070992\n", "output": "148267747\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1925473570\n", "output": "481368392\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "629490186\n", "output": "157372546\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1980649112\n", "output": "495162277\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36661322\n", "output": "9165330\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1943590793\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "71207034\n", "output": "17801758\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1757577394\n", "output": "439394348\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "168305294\n", "output": "42076323\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1934896224\n", "output": "483724055\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "297149088\n", "output": "74287271\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1898001634\n", "output": "474500408\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "176409698\n", "output": "44102424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1873025522\n", "output": "468256380\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5714762\n", "output": "1428690\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1829551192\n", "output": "457387797\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16269438\n", "output": "4067359\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1663283390\n", "output": "415820847\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42549941\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1967345604\n", "output": "491836400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "854000\n", "output": "213499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1995886626\n", "output": "498971656\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10330019\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1996193634\n", "output": "499048408\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9605180\n", "output": "2401294\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1996459740\n", "output": "499114934\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32691948\n", "output": "8172986\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1975903308\n", "output": "493975826\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1976637136\n", "output": "494159283\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29803038\n", "output": "7450759\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1977979692\n", "output": "494494922\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1978595336\n", "output": "494648833\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27379344\n", "output": "6844835\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1979729912\n", "output": "494932477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1980253780\n", "output": "495063444\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1980751584\n", "output": "495187895\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "53224878\n", "output": "13306219\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "55\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "105\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "199\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "151\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
199
Solve the following coding problem using the programming language python: The Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by $s$ liters of kvass. But he wants to do it, so kvass level in the least keg is as much as possible. Help him find out how much kvass can be in the least keg or define it's not possible to pour his glass by $s$ liters of kvass. -----Input----- The first line contains two integers $n$ and $s$ ($1 \le n \le 10^3$, $1 \le s \le 10^{12}$) — the number of kegs and glass volume. The second line contains $n$ integers $v_1, v_2, \ldots, v_n$ ($1 \le v_i \le 10^9$) — the volume of $i$-th keg. -----Output----- If the Fair Nut cannot pour his glass by $s$ liters of kvass, print $-1$. Otherwise, print a single integer — how much kvass in the least keg can be. -----Examples----- Input 3 3 4 3 5 Output 3 Input 3 4 5 3 4 Output 2 Input 3 7 1 2 3 Output -1 -----Note----- In the first example, the answer is $3$, the Fair Nut can take $1$ liter from the first keg and $2$ liters from the third keg. There are $3$ liters of kvass in each keg. In the second example, the answer is $2$, the Fair Nut can take $3$ liters from the first keg and $1$ liter from the second keg. In the third example, the Fair Nut can't pour his cup by $7$ liters, so the answer is $-1$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def doit(): xx = input().split() n = int(xx[0]) s = int(xx[1]) v = [int(k) for k in input().split()] S = sum(v) newS = S - s if newS < 0: return -1 return min(newS//n, min(v)) print(doit()) ```
vfc_10550
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1084/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 3\n4 3 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n5 3 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n1 2 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10\n10 10 10 10 10\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000\n1000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000\n42\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n1 1 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n5 10 15\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n2 4 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1\n1 2 3 4 5 6 7 8 9 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n1 99 99\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n100 1 100 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n4 6 8 10 14\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n1 2 3 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n4 6 8 10 19\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n5 3 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n2 3 4 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10\n1 9 9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n1 5 12\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n100 100 100 100 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n100 10000\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n5 5 5 5 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 500\n1 1000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 10000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 50\n1 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n100 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n1 1 1 1 1000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n4 4 92\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 30\n1 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 94\n1 99\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 1\n2 2 3 6 6 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n100 4 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10\n100 100 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1000000000 999999999\n", "output": "999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 3 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 56\n38 47 84 28 67 40 15 24 64 37 68 30 74 41 62\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n1 100 100 100 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n1 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n900000000 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n1 5 5 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n1 5 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n5 7 8 9\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n1 2 3 4 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n100 2 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n1 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5000\n1 1000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000\n1000000000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n2 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 2 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n5 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5000\n1 100000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n1 4 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 50\n1 500\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n1 8\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100\n1 100 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n4 6 7\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n2 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n8 1000\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000\n99999999 1000000000\n", "output": "49999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n23 123 123\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n5 6 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n1 10 10 10 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n1 1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n1 1 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n1 2 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1000000000 1000000000 1000000000 1000000000\n", "output": "999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100\n1 55 55\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 7\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
200
Solve the following coding problem using the programming language python: The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree hung an apple and the caterpillar was crawling to the apple. Gabriel is interested when the caterpillar gets the apple. He noted that the caterpillar goes up by a cm per hour by day and slips down by b cm per hour by night. In how many days Gabriel should return to the forest to see the caterpillar get the apple. You can consider that the day starts at 10 am and finishes at 10 pm. Gabriel's classes finish at 2 pm. You can consider that Gabriel noticed the caterpillar just after the classes at 2 pm. Note that the forest is magic so the caterpillar can slip down under the ground and then lift to the apple. -----Input----- The first line contains two integers h_1, h_2 (1 ≤ h_1 < h_2 ≤ 10^5) — the heights of the position of the caterpillar and the apple in centimeters. The second line contains two integers a, b (1 ≤ a, b ≤ 10^5) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour. -----Output----- Print the only integer k — the number of days Gabriel should wait to return to the forest and see the caterpillar getting the apple. If the caterpillar can't get the apple print the only integer - 1. -----Examples----- Input 10 30 2 1 Output 1 Input 10 13 1 1 Output 0 Input 10 19 1 2 Output -1 Input 1 50 5 4 Output 1 -----Note----- In the first example at 10 pm of the first day the caterpillar gets the height 26. At 10 am of the next day it slips down to the height 14. And finally at 6 pm of the same day the caterpillar gets the apple. Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python from math import * h1, h2 = [int(i) for i in input().split()] a, b = [int(i) for i in input().split()] a *= 12 b *= 12 if a <= b and h2 - h1 > (a // 12 * 8): print(-1) return h1 += (a // 12 * 8) if h1 >= h2: print(0) return day = int(ceil((h2 - h1) / (a - b))) print(day) ```
vfc_10554
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/652/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "10 30\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 13\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 19\n1 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 50\n5 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000\n2 1\n", "output": "82\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 1000\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 1000\n1 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000\n999 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000\n100 99\n", "output": "17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 509\n1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 555\n6 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n2 1\n", "output": "8332\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99990 100000\n1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90000 100000\n2 1\n", "output": "832\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 100000\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 41\n5 6\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 16\n1 12\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 30\n2 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7245 77828\n6224 92468\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43951 66098\n1604 35654\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n4 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90493 94279\n468 49\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 50\n3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26300 88310\n7130 351\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 17\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10718 75025\n7083 6958\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 190\n10 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24951 85591\n3090 8945\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 25\n3 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27043 88418\n7273 7\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35413 75637\n4087 30166\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 18\n2 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 16\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 18\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 30\n2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n10000 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4444 33425\n2758 44\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n10 99910\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 100\n6 11\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100000\n10 11\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28473 80380\n2568 95212\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 105\n10 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4642 39297\n3760 451\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 90\n10 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n1000 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 45\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 1000\n100 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64635 76564\n100 34238\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 90\n10 12\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49238 81395\n3512 251\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6497 62133\n309 50077\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10000\n1 10000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "55674 93249\n846 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 90\n9 10\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23110 69794\n171 808\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n1 10000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9\n1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58750 81357\n2 98022\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82125 89348\n894 91369\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25401 53663\n957 30449\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 12\n1 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10000\n1 100000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100000\n1 99999\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 149\n8 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100\n1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 18\n2 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 77\n9 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7330 94486\n968 141\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89778 98176\n863 61\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 70\n6 5\n", "output": "2\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
201
Solve the following coding problem using the programming language python: A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? [Image] One day, when he came to his friend Evan, Om Nom didn't find him at home but he found two bags with candies. The first was full of blue candies and the second bag was full of red candies. Om Nom knows that each red candy weighs W_{r} grams and each blue candy weighs W_{b} grams. Eating a single red candy gives Om Nom H_{r} joy units and eating a single blue candy gives Om Nom H_{b} joy units. Candies are the most important thing in the world, but on the other hand overeating is not good. Om Nom knows if he eats more than C grams of candies, he will get sick. Om Nom thinks that it isn't proper to leave candy leftovers, so he can only eat a whole candy. Om Nom is a great mathematician and he quickly determined how many candies of what type he should eat in order to get the maximum number of joy units. Can you repeat his achievement? You can assume that each bag contains more candies that Om Nom can eat. -----Input----- The single line contains five integers C, H_{r}, H_{b}, W_{r}, W_{b} (1 ≤ C, H_{r}, H_{b}, W_{r}, W_{b} ≤ 10^9). -----Output----- Print a single integer — the maximum number of joy units that Om Nom can get. -----Examples----- Input 10 3 5 2 3 Output 16 -----Note----- In the sample test Om Nom can eat two candies of each type and thus get 16 joy units. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import sys f = sys.stdin C, Hr, Hb, Wr, Wb = map(int, f.readline().strip().split()) if Hr/Wr < Hb/Wb: Hr, Hb, Wr, Wb = Hb, Hr, Wb, Wr if (C % Wr) == 0 and (C // Wr) > 0: print((C // Wr)*Hr) elif (C // Wr) == 0: print((C // Wb)*Hb) else: nmax = (C // Wr) pmax = nmax*Hr + ((C - nmax*Wr) // Wb) * Hb dmax = ((C - (nmax-0)*Wr) % Wb) #print(0, pmax, dmax) # #pm1 = (nmax-1)*Hr + ((C - (nmax-1)*Wr) // Wb) * Hb #if pm1>pmax: # pmax = pm1 if Hr/Wr > Hb/Wb: dx = dmax * (Hb/Wb) / (Hr/Wr - Hb/Wb) elif Hr/Wr < Hb/Wb: dx = 0 else: dx = Wb * Wr if Wr<Wb: nmax = (C // Wb) pmax = nmax*Hb + ((C - nmax*Wb) // Wr) * Hr if Wr>Wb: nmax = (C // Wr) pmax = nmax*Hr + ((C - nmax*Wr) // Wb) * Hb if Wr>Wb and dx>0: for k in range(1, C//Wr): if k*Wr > dx: break pk = (nmax-k)*Hr + ((C - (nmax-k)*Wr) // Wb) * Hb dk = ((C - (nmax-k)*Wr) % Wb) #print(k, pmax, pk, dk) if pk>pmax: pmax = pk if dk==0 : break elif Wr<Wb and dx>0: for j in range(1, C//Wb+1): k = nmax - (C-j*Wb)//Wr if k*Wr > dx: break pk = (nmax-k)*Hr + ((C - (nmax-k)*Wr) // Wb) * Hb dk = ((C - (nmax-k)*Wr) % Wb) #print(j, k, pmax, pk, dk, (nmax-k), ((C - (nmax-k)*Wr) // Wb) ) if pk>pmax: pmax = pk #dmax = dk if dk==0 : break # elif Wr<Wb and dx>0: # for j in range(1, C//Wb+1): # k = (j*Wb - dmax)//Wr # if k*Wr > dx: # break # pk = (nmax-k)*Hr + ((C - (nmax-k)*Wr) // Wb) * Hb # dk = ((C - (nmax-k)*Wr) % Wb) # print(j, k, pmax, pk, dk, (nmax-k), ((C - (nmax-k)*Wr) // Wb) ) # if pk>pmax: # pmax = pk # #dmax = dk # if dk==0 : # break print(pmax) ```
vfc_10558
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/526/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "10 3 5 2 3\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 1 6 7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "982068341 55 57 106 109\n", "output": "513558662\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "930064129 32726326 25428197 83013449 64501049\n", "output": "363523396\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "927155987 21197 15994 54746 41309\n", "output": "358983713\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "902303498 609628987 152407246 8 2\n", "output": "68758795931537065\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "942733698 9180 9072 1020 1008\n", "output": "8484603228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "951102310 39876134 24967176 70096104 43888451\n", "output": "539219654\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "910943911 107 105 60 59\n", "output": "1624516635\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "910943911 38162 31949 67084 56162\n", "output": "518210503\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "910943911 9063 9045 1007 1005\n", "output": "8198495199\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "903796108 270891702 270891702 1 1\n", "output": "244830865957095816\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "936111602 154673223 309346447 1 2\n", "output": "144791399037089047\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "947370735 115930744 347792233 1 3\n", "output": "109829394468167085\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "958629867 96557265 386229061 1 4\n", "output": "92562678344491221\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "969889000 84931386 424656931 1 5\n", "output": "82374017230131800\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "925819493 47350513 28377591 83230978 49881078\n", "output": "520855643\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "934395168 119 105 67 59\n", "output": "1662906651\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "934395168 29208 38362 51342 67432\n", "output": "531576348\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "934395168 9171 9045 1019 1005\n", "output": "8409556512\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "946401698 967136832 483568416 2 1\n", "output": "457649970001570368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "962693577 967217455 967217455 2 2\n", "output": "465567015261784540\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "989976325 646076560 969114840 2 3\n", "output": "319800249268721000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901235456 485501645 971003291 2 4\n", "output": "218775648435471424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "912494588 389153108 972882772 2 5\n", "output": "177550052841687584\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "995503930 29205027 18903616 51333090 33226507\n", "output": "565303099\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "983935533 115 108 65 61\n", "output": "1742049794\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "983935533 33986 27367 59737 48104\n", "output": "559787479\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "983935533 7105 7056 1015 1008\n", "output": "6887548731\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "994040035 740285170 246761723 3 1\n", "output": "245291032098926983\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "905299166 740361314 493574209 3 2\n", "output": "223416160034288041\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "911525551 740437472 740437472 3 3\n", "output": "224975891301803200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "922784684 566833132 755777509 3 4\n", "output": "174354977531116762\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "955100178 462665160 771108601 3 5\n", "output": "147297192414486195\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "949164751 36679609 23634069 64467968 41539167\n", "output": "537909080\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "928443151 60 63 106 112\n", "output": "525533853\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "928443151 25031 33442 43995 58778\n", "output": "528241752\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "928443151 1006 1012 1006 1012\n", "output": "928443150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "936645623 540336743 135084185 4 1\n", "output": "126526011319256470\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "947904756 540408420 270204210 4 2\n", "output": "128063927875111380\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "959163888 540480074 405360055 4 3\n", "output": "129602242291091928\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "970423020 540551739 540551739 4 4\n", "output": "131140962756657945\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "976649406 455467553 569334442 4 5\n", "output": "111208028918928288\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "923881933 18531902 53987967 32570076 94884602\n", "output": "524563246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "977983517 57 63 101 112\n", "output": "551931291\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "977983517 29808 22786 52389 40047\n", "output": "556454318\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "977983517 9009 9108 1001 1012\n", "output": "8801851608\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "984283960 367291526 73458305 5 1\n", "output": "72303831537144592\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "990510345 367358723 146943489 5 2\n", "output": "72774523091497887\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901769477 367425909 220455545 5 3\n", "output": "66266693959035917\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "907995862 367493085 293994468 5 4\n", "output": "66736440098722854\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "924287742 367560271 367560271 5 5\n", "output": "67946290439275508\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000 999 100 1000000000\n", "output": "10000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 10 499999995 2 99999999\n", "output": "4999999995\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 1 1000000000 2 1000000000\n", "output": "499999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999997 2 999999997 2 999999997\n", "output": "999999997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 1 11 11\n", "output": "90909090\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 999999998 5 999999999 5\n", "output": "999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000001 3 100000000 3 100000001\n", "output": "100000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 2 3 1 2\n", "output": "1999999998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 2 1 3 4\n", "output": "666666666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 10000 494999 2 99\n", "output": "4999999994999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 1 1 1\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "998999 1000 999 1000 999\n", "output": "998999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100 101 2 3\n", "output": "101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "345415838 13999 13997 13999 13997\n", "output": "345415838\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000005 3 2 5 1\n", "output": "10000010\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 1 1 1000000000\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 3 2 10 3\n", "output": "666666666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000 1000 1 1\n", "output": "1000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200000001 100000002 1 100000001 1\n", "output": "200000002\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 1000000000 1 100000001 1\n", "output": "100000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 99 100 1 2\n", "output": "99000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 5 5 1 1\n", "output": "5000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 1000000000 1 1000000000\n", "output": "1000000000\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
202
Solve the following coding problem using the programming language python: Professor GukiZ makes a new robot. The robot are in the point with coordinates (x_1, y_1) and should go to the point (x_2, y_2). In a single step the robot can change any of its coordinates (maybe both of them) by one (decrease or increase). So the robot can move in one of the 8 directions. Find the minimal number of steps the robot should make to get the finish position. -----Input----- The first line contains two integers x_1, y_1 ( - 10^9 ≤ x_1, y_1 ≤ 10^9) — the start position of the robot. The second line contains two integers x_2, y_2 ( - 10^9 ≤ x_2, y_2 ≤ 10^9) — the finish position of the robot. -----Output----- Print the only integer d — the minimal number of steps to get the finish position. -----Examples----- Input 0 0 4 5 Output 5 Input 3 4 6 1 Output 3 -----Note----- In the first example robot should increase both of its coordinates by one four times, so it will be in position (4, 4). After that robot should simply increase its y coordinate and get the finish position. In the second example robot should simultaneously increase x coordinate and decrease y coordinate by one three times. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b = map(int, input().split()) d, c = map(int, input().split()) print(max(abs(a - d), abs(b - c))) ```
vfc_10562
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/620/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "0 0\n4 5\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n6 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n4 6\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n-3 -5\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 -1\n-10 100\n", "output": "101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 -1\n100 -100\n", "output": "99\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -1000000000\n1000000000 1000000000\n", "output": "2000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -1000000000\n0 999999999\n", "output": "1999999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0\n100 0\n", "output": "90\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n6 4\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n5 4\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1\n20 1\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n-3 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-863407280 504312726\n786535210 -661703810\n", "output": "1649942490\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-588306085 -741137832\n341385643 152943311\n", "output": "929691728\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n4 0\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "93097194 -48405232\n-716984003 -428596062\n", "output": "810081197\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 1\n1 1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n0 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n5 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100000000 -100000000\n100000000 100000123\n", "output": "200000123\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n5 7\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 16\n12 1\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n5 1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-44602634 913365223\n-572368780 933284951\n", "output": "527766146\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-2 0\n2 -2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n3 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-458 2\n1255 4548\n", "output": "4546\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-5 -4\n-3 -3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n7 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -999999999\n1000000000 999999998\n", "output": "2000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "2000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-464122675 -898521847\n656107323 -625340409\n", "output": "1120229998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-463154699 -654742385\n-699179052 -789004997\n", "output": "236024353\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "982747270 -593488945\n342286841 -593604186\n", "output": "640460429\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-80625246 708958515\n468950878 574646184\n", "output": "549576124\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109810 1\n2 3\n", "output": "109808\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-9 0\n9 9\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 9\n9 9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n45 1\n", "output": "44\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "207558188 -313753260\n-211535387 -721675423\n", "output": "419093575\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-11 0\n0 0\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 1000000000\n1000000000 -1000000000\n", "output": "2000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n0 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n-1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n-1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n-1 -1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n0 -1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n1 -1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 90\n90 10\n", "output": "80\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "851016864 573579544\n-761410925 -380746263\n", "output": "1612427789\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9\n9 9\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000\n1000 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9\n9 1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 90\n90 90\n", "output": "89\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n1000 1000\n", "output": "900\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 0\n0 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-750595959 -2984043\n649569876 -749608783\n", "output": "1400165835\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "958048496 712083589\n423286949 810566863\n", "output": "534761547\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "146316710 53945094\n-523054748 147499505\n", "output": "669371458\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50383856 -596516251\n-802950224 -557916272\n", "output": "853334080\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-637204864 -280290367\n-119020929 153679771\n", "output": "518183935\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 -100\n-60 -91\n", "output": "40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "337537326 74909428\n-765558776 167951547\n", "output": "1103096102\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 81\n18 90\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "283722202 -902633305\n-831696497 -160868946\n", "output": "1115418699\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000\n-1000 1000\n", "output": "2000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n4 8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40572000 597493595\n-935051731 368493185\n", "output": "975623731\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-5 5\n5 5\n", "output": "10\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
203
Solve the following coding problem using the programming language python: There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote. Each of the employees belongs to one of two fractions: depublicans or remocrats, and these two fractions have opposite opinions on what should be the outcome of the vote. The voting procedure is rather complicated: Each of n employees makes a statement. They make statements one by one starting from employees 1 and finishing with employee n. If at the moment when it's time for the i-th employee to make a statement he no longer has the right to vote, he just skips his turn (and no longer takes part in this voting). When employee makes a statement, he can do nothing or declare that one of the other employees no longer has a right to vote. It's allowed to deny from voting people who already made the statement or people who are only waiting to do so. If someone is denied from voting he no longer participates in the voting till the very end. When all employees are done with their statements, the procedure repeats: again, each employees starting from 1 and finishing with n who are still eligible to vote make their statements. The process repeats until there is only one employee eligible to vote remaining and he determines the outcome of the whole voting. Of course, he votes for the decision suitable for his fraction. You know the order employees are going to vote and that they behave optimal (and they also know the order and who belongs to which fraction). Predict the outcome of the vote. -----Input----- The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of employees. The next line contains n characters. The i-th character is 'D' if the i-th employee is from depublicans fraction or 'R' if he is from remocrats. -----Output----- Print 'D' if the outcome of the vote will be suitable for depublicans and 'R' if remocrats will win. -----Examples----- Input 5 DDRRR Output D Input 6 DDRRRR Output R -----Note----- Consider one of the voting scenarios for the first sample: Employee 1 denies employee 5 to vote. Employee 2 denies employee 3 to vote. Employee 3 has no right to vote and skips his turn (he was denied by employee 2). Employee 4 denies employee 2 to vote. Employee 5 has no right to vote and skips his turn (he was denied by employee 1). Employee 1 denies employee 4. Only employee 1 now has the right to vote so the voting ends with the victory of depublicans. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) s = input() countr = s.count('R') countd = n - countr cr = 0 cd = 0 i = 0 news = [] while countr != 0 and countd != 0: if s[i] == 'D': if cd == 0: cr += 1 countr -= 1 news.append('D') else: cd -= 1 else: if cr == 0: cd += 1 countd -= 1 news.append('R') else: cr -= 1 i += 1 if i >= n: s = list(news) news = [] n = len(s) i = 0 if countr > 0: print('R') else: print('D') ```
vfc_10566
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/749/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\nDDRRR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nDDRRRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\nD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\nR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\nDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nRDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nDRRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nDRRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nRDRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nDRDRR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nRRRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nRDDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nDDRRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nDRRRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nDDDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nDRRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRDRDRDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRDRDDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRRRDDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nRRRDDDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nRRRDDDDDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nRRDDDRRDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nRRDDDRDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nDDRRRDRRDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\nDRDRRDDRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nDRDRDRDRRDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\nDRDDDDRRRRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\nDDRDRRDRDRDDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\nDDRRRDDRDRRRDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\nDDDRDRDDDDRRRRDDDDRRRDRRRDDDRRRRDRDDDRRDRRDDDRDDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\nDRDDDDDDDRDRDDRRRDRDRDRDDDRRDRRDRDRRDDDRDDRDRDRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\nRDRRDRDDDDRDRRDDRDRRDDRRDDRRRDRRRDDDRDDRDDRRDRDRRRDRDRRRDRRDDDRDDRRRDRDRRRDDRDRDDDDDDDRDRRDDDDDDRRDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\nRRDRRDDDDDDDRDRRRDRDRDDDRDDDRDDRDRRDRRRDRRDRRRRRRRDRRRRRRDDDRRDDRRRDRRRDDRRDRRDDDDDRRDRDDRDDRRRDRRDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nRDDRDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nDRRDRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nDDDRRRRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRRRDDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRDDRRDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nRDDDRRDRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nRDRDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nRRDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nRDDRDRRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nDRRRDDRDRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nDRRDDRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nRDDDRRDRRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRDRDDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nDDRRRDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nDRRDRDRDRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\nDDDDRRRRRDRDRDRDRDRDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\nRDDDDDRRRRR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nRDDDRRRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nRDDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRDRDDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nRDDDRRRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\nDRRDRDRDRDDRDRDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nDRRDRDRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nRDDDRR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nDDRRRRRDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nDDRRRRD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nRDDRDRDRRDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nDDRRRDRDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\nRDDRDRDRDRRDRDRDRDDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\nRRDDDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nDRRRRRRDDDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nRDRDDRDRDRDR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nDDDDDD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nRRRDDRDDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\nRDDDRDDDRDRRDRDRRRRRDRDRDRDRRDRDRDRRDDDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\nRRDDDRRDRRRDDRDDDDDRDDRRRRRRDRDDRDDDRDRRDDRDDDRDRD\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\nRDRDR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nDRRDRDDRR\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\nDRRRDD\n", "output": "R\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\nDDDDRRRRRR\n", "output": "D\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\nRRDDDDRRD\n", "output": "D\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
204
Solve the following coding problem using the programming language python: Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than $a$ and screen height not greater than $b$. Monocarp is also used to TV sets with a certain aspect ratio: formally, if the width of the screen is $w$, and the height of the screen is $h$, then the following condition should be met: $\frac{w}{h} = \frac{x}{y}$. There are many different TV sets in the shop. Monocarp is sure that for any pair of positive integers $w$ and $h$ there is a TV set with screen width $w$ and height $h$ in the shop. Monocarp isn't ready to choose the exact TV set he is going to buy. Firstly he wants to determine the optimal screen resolution. He has decided to try all possible variants of screen size. But he must count the number of pairs of positive integers $w$ and $h$, beforehand, such that $(w \le a)$, $(h \le b)$ and $(\frac{w}{h} = \frac{x}{y})$. In other words, Monocarp wants to determine the number of TV sets having aspect ratio $\frac{x}{y}$, screen width not exceeding $a$, and screen height not exceeding $b$. Two TV sets are considered different if they have different screen width or different screen height. -----Input----- The first line contains four integers $a$, $b$, $x$, $y$ ($1 \le a, b, x, y \le 10^{18}$) — the constraints on the screen width and height, and on the aspect ratio. -----Output----- Print one integer — the number of different variants to choose TV screen width and screen height so that they meet the aforementioned constraints. -----Examples----- Input 17 15 5 3 Output 3 Input 14 16 7 22 Output 0 Input 4 2 6 4 Output 1 Input 1000000000000000000 1000000000000000000 999999866000004473 999999822000007597 Output 1000000063 -----Note----- In the first example, there are $3$ possible variants: $(5, 3)$, $(10, 6)$, $(15, 9)$. In the second example, there is no TV set meeting the constraints. In the third example, there is only one variant: $(3, 2)$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def gcd(a, b): while b: a, b = b, a % b return a a, b, x, y = list(map(int, input().split())) g = gcd(x, y) x //= g y //= g print(min(a // x, b // y)) ```
vfc_10570
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1041/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "17 15 5 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 16 7 22\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 6 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 999999866000004473 999999822000007597\n", "output": "1000000063\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000 1000000000000000000 1000000000\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58 29 27 60\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27 68 94 30\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "144528195586472793 10446456359175098 764897453635731472 213446506570409801\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "145354434469588921 446675416227691239 504832165374736218 221558716891006574\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "146180677647672345 468138913968516772 6298881766892948 923367383029480585\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "147006920825755769 542505368524532032 208073625707521517 14411087792522426\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "147833164003839193 978734324098080876 171380370006334775 22523289523184607\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "148659402886955322 414963275376662424 30635495548814085 902968491117271450\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "149485641770071450 851192235245178565 874621826044152778 488378180096620703\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "150311889243122170 287421190818727409 837928574637933332 823487866450329936\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "151138128126238298 947022187542019357 577863282081970781 831600068180992118\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "925426546533829903 18916656036525111 656064699607651706 504175130621743249\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "667266829466 1518201697184 23643010980 898976260568\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66 116 86 64\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1162212930906 1437938729466 2281245858132 1953656377395\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "114 6 288 30\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1639979163162 1340495892562 2036036266388 3428977687772\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "162 86 200 332\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "126335330010 1260232924842 1082265520235 316350257105\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 182 480 305\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "301287041544 1311267722334 1925090137416 582114484904\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "165 108 114 184\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1043706193704 1177988368866 2133416547786 1380684288366\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "225 276 42 210\n", "output": "55\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1760355542088 1044709015401 1674331546848 2647835033212\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 99 272 208\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2489889792360 924314563821 835883336325 4339921938905\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "84 231 70 145\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "219424042632 791035210353 5273494032066 418290299778\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "280 104 158 114\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "606209757964 135185624000 1875022910016 905391624870\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "360 264 99 117\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1561742222476 104898922608 1477225799720 2031291351072\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 72 312 64\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2534454556172 3927193117988 589501152415 3547767499745\n", "output": "38\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "168 252 180 450\n", "output": "50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3375849775910 3759581410230 1727984390290 1874681381962\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "405 55 194 58\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4591740193030 3537449154450 1714308697782 442983863265\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 260 129 285\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "786155773670 3336791735150 1280120052592 1250148696512\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "165 500 388 308\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2023521027270 3298933358415 137370252990 2592814018030\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "285 245 270 270\n", "output": "245\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 1 3 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000000000 1 1 10000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1 2\n", "output": "500000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 4 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 81 10 9\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1 1\n", "output": "1000000000000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1 1000000000000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 100000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1 999999822000007597\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000000000 1 1000000000000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 60 3 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1000000000000000 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 1000000000000000000 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 5 10 7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 1 1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1000000000000000000 11235955056173033\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "281474976710656 1 1 281474976710656\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 500 1000000000000000000 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1000000000000000000 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000 1000000000000000000 1\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
205
Solve the following coding problem using the programming language python: The number "zero" is called "love" (or "l'oeuf" to be precise, literally means "egg" in French), for example when denoting the zero score in a game of tennis. Aki is fond of numbers, especially those with trailing zeros. For example, the number $9200$ has two trailing zeros. Aki thinks the more trailing zero digits a number has, the prettier it is. However, Aki believes, that the number of trailing zeros of a number is not static, but depends on the base (radix) it is represented in. Thus, he considers a few scenarios with some numbers and bases. And now, since the numbers he used become quite bizarre, he asks you to help him to calculate the beauty of these numbers. Given two integers $n$ and $b$ (in decimal notation), your task is to calculate the number of trailing zero digits in the $b$-ary (in the base/radix of $b$) representation of $n\,!$ (factorial of $n$). -----Input----- The only line of the input contains two integers $n$ and $b$ ($1 \le n \le 10^{18}$, $2 \le b \le 10^{12}$). -----Output----- Print an only integer — the number of trailing zero digits in the $b$-ary representation of $n!$ -----Examples----- Input 6 9 Output 1 Input 38 11 Output 3 Input 5 2 Output 3 Input 5 10 Output 1 -----Note----- In the first example, $6!_{(10)} = 720_{(10)} = 880_{(9)}$. In the third and fourth example, $5!_{(10)} = 120_{(10)} = 1111000_{(2)}$. The representation of the number $x$ in the $b$-ary base is $d_1, d_2, \ldots, d_k$ if $x = d_1 b^{k - 1} + d_2 b^{k - 2} + \ldots + d_k b^0$, where $d_i$ are integers and $0 \le d_i \le b - 1$. For example, the number $720$ from the first example is represented as $880_{(9)}$ since $720 = 8 \cdot 9^2 + 8 \cdot 9 + 0 \cdot 1$. You can read more about bases here. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, k = map(int, input().split()) a = [] i = 2 while (i * i <= k): if (k % i == 0): a.append([i, 0]) while (k % i == 0): a[len(a) - 1][1] += 1 k //= i i += 1 if (k > 1): a.append([k, 1]) ans = 10 ** 20 for i in a: cnt = 0 x = i[0] while (x <= n): cnt += n // x; x *= i[0] ans = min(ans, cnt // i[1]) print(ans) ```
vfc_10574
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1114/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "6 9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 11\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000\n", "output": "20833333333333332\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 999999999989\n", "output": "1000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 97\n", "output": "10416666666666661\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "62 45\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 48\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "594703138034372316 960179812013\n", "output": "19200359\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 10080\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 10080\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "57 10080\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 10080\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 10080\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 2\n", "output": "999999999999999976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 7\n", "output": "166666666666666656\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 285311670611\n", "output": "9090909090909090\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 322687697779\n", "output": "6172839506172838\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 470184984576\n", "output": "33333333333333332\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 743008370688\n", "output": "45454545454545452\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 64339296875\n", "output": "23809523809523808\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 200560490130\n", "output": "33333333333333329\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 118587876497\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 322687697779\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 110075314176\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 656100000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4294967296 999999999989\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4294967296 999999999958\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 373621248000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 720\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 576\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 13\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 193773\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 398273\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 30\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 2\n", "output": "70\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 193773\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 398273\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 250880942892\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 999999998141\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "912222 193773\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "912222 398273\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "912222 250880942892\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "912222 999999998141\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83143260522 193773\n", "output": "1287245\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83143260522 398273\n", "output": "208759\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83143260522 250880942892\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83143260522 999999998141\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "822981260158260522 250880942892\n", "output": "39364389\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "222981260158260518 850874549779\n", "output": "15271097091\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "222981260158260518 999999998141\n", "output": "222981\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "445422409459676274 999922001521\n", "output": "222720113534\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "918586219753393663 999800009711\n", "output": "918663387476\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "446248652637759698 972358665643\n", "output": "15016106488920\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "237201990843960076 973532640023\n", "output": "11953335559561\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "484242296072308881 978253641619\n", "output": "48677351836781\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "447074895815843122 911125611841\n", "output": "114517135198729\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "455817757639559194 970322544187\n", "output": "153473992471231\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "238028234022043500 877592366401\n", "output": "121195638504094\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "720471251645857727 800266614341\n", "output": "380798758798020\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "883457908461157525 863363187787\n", "output": "887005932189914\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "945422409459676266 962504231329\n", "output": "481831307722\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "818586219753393638 868390924421\n", "output": "878145564521\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "946248652637759690 834034807997\n", "output": "33512135310870\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "937201990843960062 788432964607\n", "output": "49755892484813\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "984242296072308866 826202217433\n", "output": "99923075743380\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "947074895815843114 12897917761\n", "output": "704668821291548\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "855817757639559189 261563075383\n", "output": "310754450849512\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "938028234022043486 6255386281\n", "output": "825729079244755\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "820471251645857717 184820096819\n", "output": "539783718188063\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "883457908461157497 102269364647\n", "output": "962372449304090\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
206
Solve the following coding problem using the programming language python: A frog is initially at position $0$ on the number line. The frog has two positive integers $a$ and $b$. From a position $k$, it can either jump to position $k+a$ or $k-b$. Let $f(x)$ be the number of distinct integers the frog can reach if it never jumps on an integer outside the interval $[0, x]$. The frog doesn't need to visit all these integers in one trip, that is, an integer is counted if the frog can somehow reach it if it starts from $0$. Given an integer $m$, find $\sum_{i=0}^{m} f(i)$. That is, find the sum of all $f(i)$ for $i$ from $0$ to $m$. -----Input----- The first line contains three integers $m, a, b$ ($1 \leq m \leq 10^9, 1 \leq a,b \leq 10^5$). -----Output----- Print a single integer, the desired sum. -----Examples----- Input 7 5 3 Output 19 Input 1000000000 1 2019 Output 500000001500000001 Input 100 100000 1 Output 101 Input 6 4 5 Output 10 -----Note----- In the first example, we must find $f(0)+f(1)+\ldots+f(7)$. We have $f(0) = 1, f(1) = 1, f(2) = 1, f(3) = 1, f(4) = 1, f(5) = 3, f(6) = 3, f(7) = 8$. The sum of these values is $19$. In the second example, we have $f(i) = i+1$, so we want to find $\sum_{i=0}^{10^9} i+1$. In the third example, the frog can't make any jumps in any case. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import math m,a,b=map(int,input().split()) g=math.gcd(a,b) a1=a//g b1=b//g alls=g*(a1+b1-1) dists=[0]+[-1]*(a1+b1-1) dist=0 far=0 while dist!=b1: if dist<b1: dist+=a1 far=max(dist,far) else: dist-=b1 if dists[dist]==-1: dists[dist]=far tot=0 for i in range(a1+b1): if i*g<=m and dists[i]*g<=m: tot+=(m+1-dists[i]*g) if alls<m: mod=m%g times=m//g diff=times-a1-b1 tot1=g*(diff*(diff+1)//2)+(mod+1)*(diff+1) tot+=tot1 print(tot) ```
vfc_10578
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1146/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "7 5 3\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 2019\n", "output": "500000001500000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100000 1\n", "output": "101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 5\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "172165 93846 84\n", "output": "1735345812\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9978 99 98615\n", "output": "507929\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9909 95875 20\n", "output": "9910\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42651129 26190 16875\n", "output": "6737492081840\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 8253 91700\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14712 8142 9912\n", "output": "21284\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "98898 1040 98615\n", "output": "4761309\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79674 62280 77850\n", "output": "97070\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "78139 77688 1161\n", "output": "108424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "110518 69352 81284\n", "output": "151686\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "881706694 5710 56529\n", "output": "680741853146475\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "863 99250 420\n", "output": "864\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9112063 50688 2640\n", "output": "78628667728\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "236009692 89900 300\n", "output": "278502953469621\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16145755 64220 70642\n", "output": "20303198570\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "997932 23910 14346\n", "output": "104545151\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9907037 55440 88480\n", "output": "87620910296\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9695 9 85014\n", "output": "5227761\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99548 73888 32\n", "output": "69626827\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9742365 6750 90375\n", "output": "126544822305\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95544 17793 8856\n", "output": "157445948\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2756 31707 63414\n", "output": "2757\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "936989 17028 92708\n", "output": "229896864\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9650984 18601 2090\n", "output": "222830431513\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26 92701 7\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9980 78765 356\n", "output": "9981\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10348323 355 83425\n", "output": "150833075049\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "952549276 31416 33000\n", "output": "1718466614644254\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "992869 410 9880\n", "output": "49284898280\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96033 98622 100\n", "output": "96034\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 998 99486\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10652698 87345 1116\n", "output": "6304015267729\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "303857 1990 4\n", "output": "23081582946\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "395013 59544 180\n", "output": "2117961170\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1183 532 73416\n", "output": "1956\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 75060 2502\n", "output": "26\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4987696 29388 29865\n", "output": "4145604588400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2531607 75419 14230\n", "output": "2250674901\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4015 56658 19\n", "output": "4016\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49277 166 8051\n", "output": "14453806\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9984950 40800 1152\n", "output": "519262873734\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1710 11868 202\n", "output": "1711\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96974 1 99004\n", "output": "4702123800\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "995676200 30 99370\n", "output": "49568555030448651\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "983 97020 105\n", "output": "984\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9331043 5355 81159\n", "output": "14510155272753\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99005952 94024 10220\n", "output": "2397840434982\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16965 51653 70\n", "output": "16966\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "997674659 8874 35496\n", "output": "56083140668646\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1647861 97967 10\n", "output": "1352925986505\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7526 35 7525\n", "output": "813132\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "68565 68564 1\n", "output": "205695\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58200 198 58050\n", "output": "8583036\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14332 13672 1976\n", "output": "18960\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7957 18 7956\n", "output": "1763140\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70343 66336 6910\n", "output": "110424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "101407 95200 6448\n", "output": "377984\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "57986 4760 56440\n", "output": "395386\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87728 689 87236\n", "output": "5657822\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79903 75251 7234\n", "output": "150249\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "107132 20930 92956\n", "output": "353953\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97009 97008 129\n", "output": "98514\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96538 95880 900\n", "output": "243807\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7845 4410 7350\n", "output": "11282\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79873 13 79872\n", "output": "245419010\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99573 99474 186\n", "output": "153074\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "112104 86760 69327\n", "output": "178619\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76065 44280 39150\n", "output": "305610\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58423 58422 9737\n", "output": "58436\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22432 19298 5536\n", "output": "36753\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
207
Solve the following coding problem using the programming language python: Where do odds begin, and where do they end? Where does hope emerge, and will they ever break? Given an integer sequence a_1, a_2, ..., a_{n} of length n. Decide whether it is possible to divide it into an odd number of non-empty subsegments, the each of which has an odd length and begins and ends with odd numbers. A subsegment is a contiguous slice of the whole sequence. For example, {3, 4, 5} and {1} are subsegments of sequence {1, 2, 3, 4, 5, 6}, while {1, 2, 4} and {7} are not. -----Input----- The first line of input contains a non-negative integer n (1 ≤ n ≤ 100) — the length of the sequence. The second line contains n space-separated non-negative integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 100) — the elements of the sequence. -----Output----- Output "Yes" if it's possible to fulfill the requirements, and "No" otherwise. You can output each letter in any case (upper or lower). -----Examples----- Input 3 1 3 5 Output Yes Input 5 1 0 1 5 1 Output Yes Input 3 4 3 1 Output No Input 4 3 9 9 3 Output No -----Note----- In the first example, divide the sequence into 1 subsegment: {1, 3, 5} and the requirements will be met. In the second example, divide the sequence into 3 subsegments: {1, 0, 1}, {5}, {1}. In the third example, one of the subsegments must start with 4 which is an even number, thus the requirements cannot be met. In the fourth example, the sequence can be divided into 2 subsegments: {3, 9, 9}, {3}, but this is not a valid solution because 2 is an even number. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def read_ints(): return [int(i) for i in input().split()] n = read_ints() a = read_ints() if len(a) % 2 and a[0] % 2 and a[-1] % 2: print('Yes') else: print('No') ```
vfc_10582
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/849/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n1 3 5\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 1 5 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 3 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 9 9 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n100 99 100 99 99\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10 10\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n54 21\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 0\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n67 92 0 26 43\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n45 52 35 80 68 80 93 57 47 32 69 23 63 90 43\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n81 28 0 82 71 64 63 89 87 92 38 30 76 72 36\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n49 32 17 59 77 98 65 50 85 10 40 84 65 34 52 25 1 31 61 45 48 24 41 14 76 12 33 76 44 86 53 33 92 58 63 93 50 24 31 79 67 50 72 93 2 38 32 14 87 99\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "55\n65 69 53 66 11 100 68 44 43 17 6 66 24 2 6 6 61 72 91 53 93 61 52 96 56 42 6 8 79 49 76 36 83 58 8 43 2 90 71 49 80 21 75 13 76 54 95 61 58 82 40 33 73 61 46\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n73 89 51 85 42 67 22 80 75 3 90 0 52 100 90 48 7 15 41 1 54 2 23 62 86 68 2 87 57 12 45 34 68 54 36 49 27 46 22 70 95 90 57 91 90 79 48 89 67 92 28 27 25 37 73 66 13 89 7 99 62 53 48 24 73 82 62 88 26 39 21 86 50 95 26 27 60 6 56 14 27 90 55 80 97 18 37 36 70 2 28 53 36 77 39 79 82 42 69\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n61 63 34 45 20 91 31 28 40 27 94 1 73 5 69 10 56 94 80 23 79 99 59 58 13 56 91 59 77 78 88 72 80 72 70 71 63 60 41 41 41 27 83 10 43 14 35 48 0 78 69 29 63 33 42 67 1 74 51 46 79 41 37 61 16 29 82 28 22 14 64 49 86 92 82 55 54 24 75 58 95 31 3 34 26 23 78 91 49 6 30 57 27 69 29 54 42 0 61 83\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 2 2 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 2 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 1 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 0 0 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 4 9 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 0 0 1 1 1 1 1 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n9 2 5 7 8 3 1 9 4 9\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 1 2 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 0 1 0 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 4 7\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 1 2 1 1 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 1 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 4 4 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 3 3 3 3 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 2 1 2 2 2 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 3 4 6 5\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 2 2 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 0 1 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 4\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 0 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 0 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 9 2 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 4 4 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 3 5 6 7\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 2 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 0 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 2 5 5\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 3 2 4 5\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 2 3 5 7 8 8 5\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 2 1 1 1 1 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 0 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 0 1 1 0 0 1\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 4 5 7 6 6 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 2 2\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 3 4 5 6\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 3 3 2 2 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 2 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 5\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 4 4 3 3\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 2 2 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 1 1 2 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 2 1 1\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 4 2 4 3 2 2 4 4 3\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 2 4 3 2 4 5\n", "output": "Yes\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n75 51 25 52 13 7 34 29 5 59 68 56 13 2 9 37 59 83 18 32 36 30 20 43 92 76 78 67\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 18\n", "output": "No\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "No\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
208
Solve the following coding problem using the programming language python: Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden looks like a square with sides parallel to the coordinate axes. He also remembers that there is exactly one tree on each vertex of the square. Now, Pashmak knows the position of only two of the trees. Help him to find the position of two remaining ones. -----Input----- The first line contains four space-separated x_1, y_1, x_2, y_2 ( - 100 ≤ x_1, y_1, x_2, y_2 ≤ 100) integers, where x_1 and y_1 are coordinates of the first tree and x_2 and y_2 are coordinates of the second tree. It's guaranteed that the given points are distinct. -----Output----- If there is no solution to the problem, print -1. Otherwise print four space-separated integers x_3, y_3, x_4, y_4 that correspond to the coordinates of the two other trees. If there are several solutions you can output any of them. Note that x_3, y_3, x_4, y_4 must be in the range ( - 1000 ≤ x_3, y_3, x_4, y_4 ≤ 1000). -----Examples----- Input 0 0 0 1 Output 1 0 1 1 Input 0 0 1 1 Output 0 1 1 0 Input 0 0 1 2 Output -1 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x1, y1, x2, y2 = map(int, input().split()) #diagonal if x1 != x2 and y1 != y2: if abs(x1 - x2) == abs(y1 - y2): print(x1, y2, x2, y1) else: print(-1) #same side elif x1 == x2: aux = abs(y2 - y1) print(x1 + aux, y1, x1 + aux, y2) elif y1 == y2: aux = abs(x2 - x1) print(x1, y1 + aux, x2, y1 + aux) ```
vfc_10586
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/459/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "0 0 0 1\n", "output": "1 0 1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1 1\n", "output": "0 1 1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 -100 100 100\n", "output": "-100 100 100 -100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 -100 99 100\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 -100 0 100\n", "output": "200 -100 200 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27 -74 27 74\n", "output": "175 -74 175 74\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 2 3\n", "output": "0 3 2 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 100 100 -100\n", "output": "-100 -100 100 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 -100 -100 100\n", "output": "100 -100 100 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100 -100\n", "output": "300 100 300 -100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 -100 -100 -100\n", "output": "100 100 -100 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-100 100 100 100\n", "output": "-100 300 100 300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 0 0\n", "output": "1 1 1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0 0\n", "output": "1 0 0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1 0\n", "output": "0 1 1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 0 1\n", "output": "1 1 0 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 1 1\n", "output": "2 0 2 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 0 1\n", "output": "1 2 0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 -9 80 -9\n", "output": "15 56 80 56\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "51 -36 18 83\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 -22 60 16\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-68 -78 -45 -55\n", "output": "-68 -55 -45 -78\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "68 -92 8 -32\n", "output": "68 -32 8 -92\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95 -83 -39 -6\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "54 94 53 -65\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-92 15 84 15\n", "output": "-92 191 84 191\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67 77 -11 -1\n", "output": "67 -1 -11 77\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 -40 30 21\n", "output": "91 21 30 -40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66 -64 -25 -64\n", "output": "66 27 -25 27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-42 84 -67 59\n", "output": "-42 59 -67 84\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "73 47 -5 -77\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 85 -54 -84\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-58 -55 40 43\n", "output": "-58 43 40 -55\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "56 22 48 70\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-17 -32 76 -32\n", "output": "-17 61 76 61\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 2 0\n", "output": "0 0 2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 -1 1\n", "output": "0 1 -1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 1 1\n", "output": "0 1 1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1 -1\n", "output": "0 -1 1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 2 -2 3\n", "output": "-1 3 -2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 1 0\n", "output": "0 0 1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2 1\n", "output": "1 1 2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2 1\n", "output": "4 3 2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 0 0 10\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 4 1\n", "output": "2 1 4 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 3 1\n", "output": "1 1 3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-3 3 0 0\n", "output": "-3 0 0 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 8 7 3\n", "output": "2 3 7 8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2 3\n", "output": "1 3 2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 3 3 0\n", "output": "0 0 3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 -3 3\n", "output": "0 3 -3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 2 1 2\n", "output": "0 3 1 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 2 0\n", "output": "1 0 2 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 5 0\n", "output": "0 5 5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 7 8\n", "output": "3 8 7 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 5 5 0\n", "output": "0 0 5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6 8 3\n", "output": "5 3 8 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1 1\n", "output": "2 1 1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 3 1\n", "output": "0 4 3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 5 4\n", "output": "2 7 5 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 5 1 5\n", "output": "0 6 1 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0 0 4\n", "output": "4 4 0 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 1 1 8\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 3 4\n", "output": "2 4 3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0 2 1\n", "output": "1 1 2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 2 14\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 4 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5 5 3\n", "output": "3 3 5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 1 1 -1\n", "output": "-1 -1 1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 2 0\n", "output": "0 2 2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0 1 7\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3 2\n", "output": "1 4 3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 12 3 10\n", "output": "1 10 3 12\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
209
Solve the following coding problem using the programming language python: Jzzhu has invented a kind of sequences, they meet the following property:$f_{1} = x ; f_{2} = y ; \forall i(i \geq 2), f_{i} = f_{i - 1} + f_{i + 1}$ You are given x and y, please calculate f_{n} modulo 1000000007 (10^9 + 7). -----Input----- The first line contains two integers x and y (|x|, |y| ≤ 10^9). The second line contains a single integer n (1 ≤ n ≤ 2·10^9). -----Output----- Output a single integer representing f_{n} modulo 1000000007 (10^9 + 7). -----Examples----- Input 2 3 3 Output 1 Input 0 -1 2 Output 1000000006 -----Note----- In the first sample, f_2 = f_1 + f_3, 3 = 2 + f_3, f_3 = 1. In the second sample, f_2 = - 1; - 1 modulo (10^9 + 7) equals (10^9 + 6). The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def main(): x, y = [int(i) for i in input().split()] n = int(input()) result = [x, y, y - x, -x, -y, x - y][(n - 1) % 6] print(result % 1000000007) main() ```
vfc_10590
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/450/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 3\n3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 -1\n2\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-9 -11\n12345\n", "output": "1000000005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 0\n1000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 1000000000\n2000000000\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-12345678 12345678\n1912345678\n", "output": "12345678\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "728374857 678374857\n1928374839\n", "output": "950000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "278374837 992837483\n1000000000\n", "output": "721625170\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-693849384 502938493\n982838498\n", "output": "502938493\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-783928374 983738273\n992837483\n", "output": "16261734\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-872837483 -682738473\n999999999\n", "output": "190099010\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-892837483 -998273847\n999283948\n", "output": "892837483\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-283938494 738473848\n1999999999\n", "output": "716061513\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-278374857 819283838\n1\n", "output": "721625150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 123456789\n1\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-529529529 -524524524\n2\n", "output": "475475483\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n2000000000\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 -2\n2000000000\n", "output": "1000000005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1999999999\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1999999998\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1999999997\n", "output": "1000000005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1999999996\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69975122 366233206\n1189460676\n", "output": "703741923\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "812229413 904420051\n806905621\n", "output": "812229413\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "872099024 962697902\n1505821695\n", "output": "90598878\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "887387283 909670917\n754835014\n", "output": "112612724\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37759824 131342932\n854621399\n", "output": "868657075\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-246822123 800496170\n626323615\n", "output": "753177884\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-861439463 974126967\n349411083\n", "output": "835566423\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-69811049 258093841\n1412447\n", "output": "741906166\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "844509330 -887335829\n123329059\n", "output": "844509330\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83712471 -876177148\n1213284777\n", "output": "40110388\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "598730524 -718984219\n1282749880\n", "output": "401269483\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-474244697 -745885656\n1517883612\n", "output": "271640959\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-502583588 -894906953\n1154189557\n", "output": "497416419\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-636523651 -873305815\n154879215\n", "output": "763217843\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "721765550 594845720\n78862386\n", "output": "126919830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "364141461 158854993\n1337196589\n", "output": "364141461\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "878985260 677031952\n394707801\n", "output": "798046699\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "439527072 -24854079\n1129147002\n", "output": "464381151\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "840435009 -612103127\n565968986\n", "output": "387896880\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "875035447 -826471373\n561914518\n", "output": "124964560\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-342526698 305357084\n70776744\n", "output": "352116225\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-903244186 899202229\n1527859274\n", "output": "899202229\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-839482546 815166320\n1127472130\n", "output": "839482546\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-976992569 -958313041\n1686580818\n", "output": "981320479\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-497338894 -51069176\n737081851\n", "output": "502661113\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-697962643 -143148799\n1287886520\n", "output": "856851208\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-982572938 -482658433\n1259858332\n", "output": "982572938\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123123 78817\n2000000000\n", "output": "78817\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 -1000000000\n3\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 1000000000\n6\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n6\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 -1\n6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000000 -1000000000\n600000003\n", "output": "500000014\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1000000000 1000000000\n3\n", "output": "999999993\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n6\n", "output": "1000000005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n12\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 -1000000000\n3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-999999997 999999997\n6\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n6\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 2\n6\n", "output": "1000000004\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n12\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 18\n6\n", "output": "999999993\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n6\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 -1000000000\n6\n", "output": "999999993\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 -999999999\n3\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-1 0\n1\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 -1000000000\n9\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999 -1000000000\n12\n", "output": "999999992\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 -7\n3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-5 5\n6\n", "output": "999999997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 9\n6\n", "output": "1000000003\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-15 -10\n1\n", "output": "999999992\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
210
Solve the following coding problem using the programming language python: One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split the array A into several, possibly one, new arrays so that the sum of elements in each of the new arrays is not zero. One more condition is that if we place the new arrays one after another they will form the old array A. Lesha is tired now so he asked you to split the array. Help Lesha! -----Input----- The first line contains single integer n (1 ≤ n ≤ 100) — the number of elements in the array A. The next line contains n integers a_1, a_2, ..., a_{n} ( - 10^3 ≤ a_{i} ≤ 10^3) — the elements of the array A. -----Output----- If it is not possible to split the array A and satisfy all the constraints, print single line containing "NO" (without quotes). Otherwise in the first line print "YES" (without quotes). In the next line print single integer k — the number of new arrays. In each of the next k lines print two integers l_{i} and r_{i} which denote the subarray A[l_{i}... r_{i}] of the initial array A being the i-th new array. Integers l_{i}, r_{i} should satisfy the following conditions: l_1 = 1 r_{k} = n r_{i} + 1 = l_{i} + 1 for each 1 ≤ i < k. If there are multiple answers, print any of them. -----Examples----- Input 3 1 2 -3 Output YES 2 1 2 3 3 Input 8 9 -12 3 4 -4 -10 7 3 Output YES 2 1 2 3 8 Input 1 0 Output NO Input 4 1 2 3 -5 Output YES 4 1 1 2 2 3 3 4 4 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python from sys import stdin n = int(input()) a = [int(x) for x in input().split()] f = False for i in range(len(a)): if a[i] != 0: ln = i f = True break if not f: print('NO') else: print('YES') l = 0 i = ln + 1 ans = [] while i < len(a): if a[i] == 0: i += 1 else: ans.append((l+1, i)) l = i i += 1 if l < len(a): ans.append((l+1, i)) print(len(ans)) for i in ans: print(i[0],i[1]) ```
vfc_10594
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/754/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n1 2 -3\n", "output": "YES\n3\n1 1\n2 2\n3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n9 -12 3 4 -4 -10 7 3\n", "output": "YES\n8\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 -5\n", "output": "YES\n4\n1 1\n2 2\n3 3\n4 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n0 0 0 0 3 -3 0\n", "output": "YES\n2\n1 5\n6 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 -4 0 0\n", "output": "YES\n1\n1 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 -17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n2\n1 34\n35 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -3 3\n", "output": "YES\n3\n1 1\n2 2\n3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 0 -1\n", "output": "YES\n2\n1 2\n3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 0 0\n", "output": "YES\n1\n1 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-3 3 0\n", "output": "YES\n2\n1 1\n2 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 -2 -1 3\n", "output": "YES\n4\n1 1\n2 2\n3 3\n4 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-1 0 1 0\n", "output": "YES\n2\n1 2\n3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 3\n", "output": "YES\n1\n1 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 0 -3 0\n", "output": "YES\n2\n1 2\n3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-3 2 2 0 -2\n", "output": "YES\n4\n1 1\n2 2\n3 4\n5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 -1 2 0 -1\n", "output": "YES\n3\n1 2\n3 4\n5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 2 0 0 0\n", "output": "YES\n1\n1 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n101 89 -166 -148 -38 -135 -138 193 14 -134 -185 -171 -52 -191 195 39 -148 200 51 -73\n", "output": "YES\n20\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n-118 -5 101 7 9 144 55 -55 -9 -126 -71 -71 189 -64 -187 123 0 -48 -12 138\n", "output": "YES\n19\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 17\n18 18\n19 19\n20 20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n-161 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 -137 0 0 0 0 137\n", "output": "YES\n2\n1 19\n20 20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n64 -94 -386 -78 35 -233 33 82 -5 -200 368 -259 124 353 390 -305 -247 -133 379 44 133 -146 151 -217 -16 53 -157 186 -203 -8 117 -71 272 -290 -97 133 52 113 -280 -176\n", "output": "YES\n40\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n21 21\n22 22\n23 23\n24 24\n25 25\n26 26\n27 27\n28 28\n29 29\n30 30\n31 31\n32 32\n33 33\n34 34\n35 35\n36 36\n37 37\n38 38\n39 39\n40 40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n120 -96 -216 131 231 -80 -166 -102 16 227 -120 105 43 -83 -53 229 24 190 -268 119 230 348 -33 19 0 -187 -349 -25 80 -38 -30 138 -104 337 -98 0 1 -66 -243 -231\n", "output": "YES\n38\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n21 21\n22 22\n23 23\n24 25\n26 26\n27 27\n28 28\n29 29\n30 30\n31 31\n32 32\n33 33\n34 34\n35 36\n37 37\n38 38\n39 39\n40 40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n0 0 0 0 0 0 324 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n0 0 0 0 0 308 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -308 0 0 0 0 0 0 0\n", "output": "YES\n2\n1 32\n33 40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60\n-288 -213 -213 -23 496 489 137 -301 -219 -296 -577 269 -153 -52 -505 -138 -377 500 -256 405 588 274 -115 375 -93 117 -360 -160 429 -339 502 310 502 572 -41 -26 152 -203 562 -525 -179 -67 424 62 -329 -127 352 -474 417 -30 518 326 200 -598 471 107 339 107 -9 -244\n", "output": "YES\n60\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n21 21\n22 22\n23 23\n24 24\n25 25\n26 26\n27 27\n28 28\n29 29\n30 30\n31 31\n32 32\n33 33\n34 34\n35 35\n36 36\n37 37\n38 38\n39 39\n40 40\n41 41\n42 42\n43 43\n44 44\n45 45\n46 46\n47 47\n48 48\n49 49\n50 50\n51 51\n52 52\n53 53\n54 54\n55 55\n56 56\n57 57\n58 58\n59 59\n60 60\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60\n112 141 -146 -389 175 399 -59 327 -41 397 263 -422 157 0 471 -2 -381 -438 99 368 173 9 -171 118 24 111 120 70 11 317 -71 -574 -139 0 -477 -211 -116 -367 16 568 -75 -430 75 -179 -21 156 291 -422 441 -224 -8 -337 -104 381 60 -138 257 91 103 -359\n", "output": "YES\n58\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n21 21\n22 22\n23 23\n24 24\n25 25\n26 26\n27 27\n28 28\n29 29\n30 30\n31 31\n32 32\n33 34\n35 35\n36 36\n37 37\n38 38\n39 39\n40 40\n41 41\n42 42\n43 43\n44 44\n45 45\n46 46\n47 47\n48 48\n49 49\n50 50\n51 51\n52 52\n53 53\n54 54\n55 55\n56 56\n57 57\n58 58\n59 59\n60 60\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -238 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 60\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60\n0 0 0 0 0 0 0 0 0 -98 0 0 0 0 0 0 0 0 98 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n2\n1 18\n19 60\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 668 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 80\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80\n0 0 0 0 0 0 0 0 0 0 0 0 -137 137 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n2\n1 13\n14 80\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 697 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n1\n1 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -475 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 475 0 0 0 0\n", "output": "YES\n2\n1 95\n96 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 3 -3\n", "output": "YES\n2\n1 3\n4 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 0 0 0\n", "output": "YES\n1\n1 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3 3 3\n", "output": "YES\n4\n1 1\n2 2\n3 3\n4 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1\n", "output": "YES\n1\n1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 -1 1 0\n", "output": "YES\n2\n1 2\n3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "YES\n1\n1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 0 0\n", "output": "YES\n1\n1 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 0\n", "output": "YES\n1\n1 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 2 0 0 3 -3 0 0 -3 0\n", "output": "YES\n5\n1 1\n2 4\n5 5\n6 8\n9 10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 -1 0\n", "output": "YES\n1\n1 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 0\n", "output": "YES\n1\n1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 -3 0 0 0\n", "output": "YES\n2\n1 1\n2 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 1 0\n", "output": "YES\n1\n1 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 1\n", "output": "YES\n1\n1 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 -1 1 -1\n", "output": "YES\n4\n1 1\n2 2\n3 3\n4 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n-1\n", "output": "YES\n1\n1 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "YES\n2\n1 1\n2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 -1\n", "output": "YES\n2\n1 1\n2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 -1\n", "output": "YES\n1\n1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 1\n", "output": "YES\n2\n1 1\n2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 0\n", "output": "YES\n1\n1 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 -1\n", "output": "YES\n2\n1 1\n2 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n5 -5 5\n", "output": "YES\n3\n1 1\n2 2\n3 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 0 -1 0 1\n", "output": "YES\n3\n1 2\n3 4\n5 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0 0 3 0 0\n", "output": "YES\n1\n1 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -1 1\n", "output": "YES\n3\n1 1\n2 2\n3 3\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
211
Solve the following coding problem using the programming language python: Manao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one point to the player. The game also has a counter of consecutive correct answers. When the player answers a question correctly, the number on this counter increases by 1. If the player answers a question incorrectly, the counter is reset, that is, the number on it reduces to 0. If after an answer the counter reaches the number k, then it is reset, and the player's score is doubled. Note that in this case, first 1 point is added to the player's score, and then the total score is doubled. At the beginning of the game, both the player's score and the counter of consecutive correct answers are set to zero. Manao remembers that he has answered exactly m questions correctly. But he does not remember the order in which the questions came. He's trying to figure out what his minimum score may be. Help him and compute the remainder of the corresponding number after division by 1000000009 (10^9 + 9). -----Input----- The single line contains three space-separated integers n, m and k (2 ≤ k ≤ n ≤ 10^9; 0 ≤ m ≤ n). -----Output----- Print a single integer — the remainder from division of Manao's minimum possible score in the quiz by 1000000009 (10^9 + 9). -----Examples----- Input 5 3 2 Output 3 Input 5 4 2 Output 6 -----Note----- Sample 1. Manao answered 3 questions out of 5, and his score would double for each two consecutive correct answers. If Manao had answered the first, third and fifth questions, he would have scored as much as 3 points. Sample 2. Now Manao answered 4 questions. The minimum possible score is obtained when the only wrong answer is to the question 4. Also note that you are asked to minimize the score and not the remainder of the score modulo 1000000009. For example, if Manao could obtain either 2000000000 or 2000000020 points, the answer is 2000000000 mod 1000000009, even though 2000000020 mod 1000000009 is a smaller number. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python MOD = 1000000009 n,m,k = [int(x) for x in input().split()] num0 = n-m num1fin = num0*(k-1) if num1fin >= m: print(m) else: num1open = m-num1fin sets = num1open//k rem = num1open%k print(((pow(2,sets,MOD)-1)*2*k+rem+num1fin)%MOD) ```
vfc_10598
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/337/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5 3 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300 300 3\n", "output": "17717644\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300 282 7\n", "output": "234881124\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 1000000000\n", "output": "999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 800000000 2\n", "output": "785468433\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 7 3\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 3\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 5\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9 5\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "972 100 2\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "972 600 2\n", "output": "857317034\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "972 900 2\n", "output": "129834751\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "972 900 4\n", "output": "473803848\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "972 900 5\n", "output": "682661588\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12345 11292 3\n", "output": "307935747\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "120009 70955 2\n", "output": "938631761\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "120009 100955 2\n", "output": "682499671\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "291527 253014 7\n", "output": "572614130\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300294 299002 188\n", "output": "435910952\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 508125 3\n", "output": "508125\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 16789012 2\n", "output": "573681250\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 19928497 4\n", "output": "365378266\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 19928497 5\n", "output": "541851325\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 19928497 812\n", "output": "19928497\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23888888 23862367 812\n", "output": "648068609\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87413058 85571952 11\n", "output": "996453351\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87413058 85571952 12\n", "output": "903327586\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87413058 85571952 25\n", "output": "424641940\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 482216845 2\n", "output": "565667832\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 482216845 3\n", "output": "446175557\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 508216845 90\n", "output": "332476079\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 512816845 99712\n", "output": "512816845\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 512870845 99712\n", "output": "944454424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 512870845 216955\n", "output": "28619469\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 512871195 2000000\n", "output": "559353433\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "512871295 512871295 12345678\n", "output": "423625559\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "778562195 708921647 4\n", "output": "208921643\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000000 500000000 4\n", "output": "1000000005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "375000000 375000000 3\n", "output": "1000000006\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "250000000 250000000 2\n", "output": "1000000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300000000 300000000 12561295\n", "output": "543525658\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300000000 300000000 212561295\n", "output": "512561295\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300000000 300000000 299999999\n", "output": "599999999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500000002 500000002 2\n", "output": "1000000007\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "625000001 625000000 5\n", "output": "500000002\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "875000005 875000000 7\n", "output": "531250026\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 8\n", "output": "1000000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 900000000 6\n", "output": "175578776\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 900000000 91\n", "output": "771418556\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 900000000 92\n", "output": "177675186\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 900000000 888\n", "output": "900000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 901000000 1000\n", "output": "443969514\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "901024556 901000000 1013\n", "output": "840398451\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999998212 910275020 25\n", "output": "910275020\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999998212 999998020 1072520\n", "output": "314152037\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999998212 999998020 381072520\n", "output": "999998020\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999998212 999998210 381072520\n", "output": "999998210\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999998212 999998211 499998210\n", "output": "499996412\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 1000000000\n", "output": "999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 772625255\n", "output": "772625246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999999904 225255\n", "output": "940027552\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999998304 22255\n", "output": "969969792\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999998304 7355\n", "output": "756187119\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999998304 755\n", "output": "684247947\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 999998304 256\n", "output": "401008799\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 2\n", "output": "750000003\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1 999999998\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
212
Solve the following coding problem using the programming language python: You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes. Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-negative integer, doesn't have leading zeroes and is divisible by 8. After the removing, it is forbidden to rearrange the digits. If a solution exists, you should print it. -----Input----- The single line of the input contains a non-negative integer n. The representation of number n doesn't contain any leading zeroes and its length doesn't exceed 100 digits. -----Output----- Print "NO" (without quotes), if there is no such way to remove some digits from number n. Otherwise, print "YES" in the first line and the resulting number after removing digits from number n in the second line. The printed number must be divisible by 8. If there are multiple possible answers, you may print any of them. -----Examples----- Input 3454 Output YES 344 Input 10 Output YES 0 Input 111111 Output NO The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n1 = input() n = [] for i in n1: n.append(int(i)) k = len(n) for i in range(k): if (n[i] % 8) == 0: print("YES") print(n[i]) return if k > 1: for i in range(k): t = n[i] * 10 for j in range(i+1, k): if (t+n[j]) % 8 == 0: print("YES") print(t+n[j]) return if k > 2: for i in range(k): t = n[i]*100 for j in range(i+1, k): l = n[j]*10 for e in range(j+1, k): #print(t, l, n[e]) if (t+l+n[e]) % 8 == 0: print("YES") print(t+l+n[e]) return print("NO") ```
vfc_10602
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/550/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3454\n", "output": "YES\n344\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111111\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8996988892\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5555555555\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8147522776919916277306861346922924221557534659480258977017038624458370459299847590937757625791239188\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2363\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3554\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "312\n", "output": "YES\n32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7674\n", "output": "YES\n64\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "126\n", "output": "YES\n16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "344\n", "output": "YES\n344\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "976\n", "output": "YES\n96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3144\n", "output": "YES\n344\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1492\n", "output": "YES\n192\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "303\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111111111111111111111171111111111111111111111111111112\n", "output": "YES\n72\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3111111111111111111111411111111111111111111141111111441\n", "output": "YES\n344\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7486897358699809313898215064443112428113331907121460549315254356705507612143346801724124391167293733\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1787075866\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "836501278190105055089734832290981\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66666666666666666666666666666666666666666666666666666666666666666666666666666\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88888888888888888888888888888888888888888888888888888888888888888888888888888888\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "353\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "39\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3697519\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6673177113\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6666351371557713735\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17943911115335733153157373517\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "619715515939999957957971971757533319177373\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4655797151375799393395377959959573533195153397997597195199777159133\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5531399953495399131957773999751571911139197159755793777773799119333593915333593153173775755771193715\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1319571733331774579193199551977735199771153997797535591739153377377111795579371959933533573517995559\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3313393139519343957311771319713797711159791515393917539133957799131393735795317131513557337319131993\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "526\n", "output": "YES\n56\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "513\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "674\n", "output": "YES\n64\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8353\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3957\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4426155776626276881222352363321488266188669874572115686737742545442766138617391954346963915982759371\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9592419524227735697379444145348135927975358347769514686865768941989693174565893724972575152874281772\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "94552498866729239313265973246288189853135485783461\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "647934465937812\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1327917795375366484539554526312125336\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "295971811535848297878828225646878276486982655866912496735794542\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7217495392264549817889283233368819844137671271383133997418139697797385729777632527678136\n", "output": "YES\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11111111111111111111112111111111\n", "output": "YES\n112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "262626262626262626262626262626262626\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000000000000000000000\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9969929446\n", "output": "YES\n96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43523522125549722432232256557771715456345544922144\n", "output": "YES\n32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9344661521956564755454992376342544254667536539463277572111263273131199437332443253296774957\n", "output": "YES\n96\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1946374341357914632311595531429723377642197432217137651552992479954116463332543456759911377223599715\n", "output": "YES\n16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "461259\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "461592\n", "output": "YES\n152\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46159237\n", "output": "YES\n152\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42367\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42376\n", "output": "YES\n376\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42376159\n", "output": "YES\n376\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "444444444444444444444444444444666666666666666666666666666666222222222222222222222222222222\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0\n", "output": "YES\n0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33332\n", "output": "YES\n32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6499999999\n", "output": "YES\n64\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
213
Solve the following coding problem using the programming language python: In a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how many flats are on each floor, but he remembers that the flats are numbered from 1 from lower to upper floors. That is, the first several flats are on the first floor, the next several flats are on the second and so on. Polycarp don't remember the total number of flats in the building, so you can consider the building to be infinitely high (i.e. there are infinitely many floors). Note that the floors are numbered from 1. Polycarp remembers on which floors several flats are located. It is guaranteed that this information is not self-contradictory. It means that there exists a building with equal number of flats on each floor so that the flats from Polycarp's memory have the floors Polycarp remembers. Given this information, is it possible to restore the exact floor for flat n? -----Input----- The first line contains two integers n and m (1 ≤ n ≤ 100, 0 ≤ m ≤ 100), where n is the number of the flat you need to restore floor for, and m is the number of flats in Polycarp's memory. m lines follow, describing the Polycarp's memory: each of these lines contains a pair of integers k_{i}, f_{i} (1 ≤ k_{i} ≤ 100, 1 ≤ f_{i} ≤ 100), which means that the flat k_{i} is on the f_{i}-th floor. All values k_{i} are distinct. It is guaranteed that the given information is not self-contradictory. -----Output----- Print the number of the floor in which the n-th flat is located, if it is possible to determine it in a unique way. Print -1 if it is not possible to uniquely restore this floor. -----Examples----- Input 10 3 6 2 2 1 7 3 Output 4 Input 8 4 3 1 6 2 5 2 2 1 Output -1 -----Note----- In the first example the 6-th flat is on the 2-nd floor, while the 7-th flat is on the 3-rd, so, the 6-th flat is the last on its floor and there are 3 flats on each floor. Thus, the 10-th flat is on the 4-th floor. In the second example there can be 3 or 4 flats on each floor, so we can't restore the floor for the 8-th flat. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def floo(num, k): return (num - 1) // k + 1 def main(): n, m = map(int, input().split()) low = 1 high = 10**9 if (m == 0): if (n == 1): print(1) else: print(-1) return for i in range(m): k, f = map(int, input().split()) low = max(low, (k + f - 1) // f) if (f > 1): high = min(high, (k - 1) // (f - 1)) if (floo(n, low) == floo(n, high)): print(floo(n, low)) else: print(-1) main() ```
vfc_10606
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/858/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "10 3\n6 2\n2 1\n7 3\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 4\n3 1\n6 2\n5 2\n2 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3\n7 2\n6 2\n1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n8 3\n3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 4\n16 4\n11 3\n10 3\n15 4\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 6\n3 1\n16 4\n10 3\n9 3\n19 5\n8 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1 1\n2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n3 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n1 1\n3 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 1\n3 3\n2 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n3 2\n1 1\n2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n1 1\n3 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n1 1\n2 1\n3 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "81 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22 1\n73 73\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63 2\n10 10\n64 64\n", "output": "63\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88 3\n37 37\n15 15\n12 12\n", "output": "88\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29 4\n66 66\n47 47\n62 62\n2 2\n", "output": "29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 40\n72 72\n47 47\n63 63\n66 66\n21 21\n94 94\n28 28\n45 45\n93 93\n25 25\n100 100\n43 43\n49 49\n9 9\n74 74\n26 26\n42 42\n50 50\n2 2\n92 92\n76 76\n3 3\n78 78\n44 44\n69 69\n36 36\n65 65\n81 81\n13 13\n46 46\n24 24\n96 96\n73 73\n82 82\n68 68\n64 64\n41 41\n31 31\n29 29\n10 10\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 70\n3 3\n80 80\n23 23\n11 11\n87 87\n7 7\n63 63\n61 61\n67 67\n53 53\n9 9\n43 43\n55 55\n27 27\n5 5\n1 1\n99 99\n65 65\n37 37\n60 60\n32 32\n38 38\n81 81\n2 2\n34 34\n17 17\n82 82\n26 26\n71 71\n4 4\n16 16\n19 19\n39 39\n51 51\n6 6\n49 49\n64 64\n83 83\n10 10\n56 56\n30 30\n76 76\n90 90\n42 42\n47 47\n91 91\n21 21\n52 52\n40 40\n77 77\n35 35\n88 88\n75 75\n95 95\n28 28\n15 15\n69 69\n22 22\n48 48\n66 66\n31 31\n98 98\n73 73\n25 25\n97 97\n18 18\n13 13\n54 54\n72 72\n29 29\n", "output": "50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32 1\n9 5\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "73 2\n17 9\n21 11\n", "output": "37\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3\n48 24\n51 26\n62 31\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43 4\n82 41\n52 26\n88 44\n41 21\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28 40\n85 43\n19 10\n71 36\n39 20\n57 29\n6 3\n15 8\n11 6\n99 50\n77 39\n79 40\n31 16\n35 18\n24 12\n54 27\n93 47\n90 45\n72 36\n63 32\n22 11\n83 42\n5 3\n12 6\n56 28\n94 47\n25 13\n41 21\n29 15\n36 18\n23 12\n1 1\n84 42\n55 28\n58 29\n9 5\n68 34\n86 43\n3 2\n48 24\n98 49\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "81 70\n55 28\n85 43\n58 29\n20 10\n4 2\n47 24\n42 21\n28 14\n26 13\n38 19\n9 5\n83 42\n7 4\n72 36\n18 9\n61 31\n41 21\n64 32\n90 45\n46 23\n67 34\n2 1\n6 3\n27 14\n87 44\n39 20\n11 6\n21 11\n35 18\n48 24\n44 22\n3 2\n71 36\n62 31\n34 17\n16 8\n99 50\n57 29\n13 7\n79 40\n100 50\n53 27\n89 45\n36 18\n43 22\n92 46\n98 49\n75 38\n40 20\n97 49\n37 19\n68 34\n30 15\n96 48\n17 9\n12 6\n45 23\n65 33\n76 38\n84 42\n23 12\n91 46\n52 26\n8 4\n32 16\n77 39\n88 44\n86 43\n70 35\n51 26\n", "output": "41\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63 1\n94 24\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n38 10\n48 12\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37 3\n66 17\n89 23\n60 15\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "71 4\n15 4\n13 4\n4 1\n70 18\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "77 40\n49 13\n66 17\n73 19\n15 4\n36 9\n1 1\n41 11\n91 23\n51 13\n46 12\n39 10\n42 11\n56 14\n61 16\n70 18\n92 23\n65 17\n54 14\n97 25\n8 2\n87 22\n33 9\n28 7\n38 10\n50 13\n26 7\n7 2\n31 8\n84 21\n47 12\n27 7\n53 14\n19 5\n93 24\n29 8\n3 1\n77 20\n62 16\n9 3\n44 11\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 70\n51 13\n55 14\n12 3\n43 11\n42 11\n95 24\n96 24\n29 8\n65 17\n71 18\n18 5\n62 16\n31 8\n100 25\n4 1\n77 20\n56 14\n24 6\n93 24\n97 25\n79 20\n40 10\n49 13\n86 22\n21 6\n46 12\n6 2\n14 4\n23 6\n20 5\n52 13\n88 22\n39 10\n70 18\n94 24\n13 4\n37 10\n41 11\n91 23\n85 22\n83 21\n89 23\n33 9\n64 16\n67 17\n57 15\n47 12\n36 9\n72 18\n81 21\n76 19\n35 9\n80 20\n34 9\n5 2\n22 6\n84 21\n63 16\n74 19\n90 23\n68 17\n98 25\n87 22\n2 1\n92 23\n50 13\n38 10\n28 7\n8 2\n60 15\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 1\n3 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63 2\n48 6\n17 3\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96 3\n45 6\n25 4\n35 5\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37 4\n2 1\n29 4\n27 4\n47 6\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "64 40\n40 5\n92 12\n23 3\n75 10\n71 9\n2 1\n54 7\n18 3\n9 2\n74 10\n87 11\n11 2\n90 12\n30 4\n48 6\n12 2\n91 12\n60 8\n35 5\n13 2\n53 7\n46 6\n38 5\n59 8\n97 13\n32 4\n6 1\n36 5\n43 6\n83 11\n81 11\n99 13\n69 9\n10 2\n21 3\n78 10\n31 4\n27 4\n57 8\n1 1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 70\n63 8\n26 4\n68 9\n30 4\n61 8\n84 11\n39 5\n53 7\n4 1\n81 11\n50 7\n91 12\n59 8\n90 12\n20 3\n21 3\n83 11\n94 12\n37 5\n8 1\n49 7\n34 5\n19 3\n44 6\n74 10\n2 1\n73 10\n88 11\n43 6\n36 5\n57 8\n64 8\n76 10\n40 5\n71 9\n95 12\n15 2\n41 6\n89 12\n42 6\n96 12\n1 1\n52 7\n38 5\n45 6\n78 10\n82 11\n16 2\n48 6\n51 7\n56 7\n28 4\n87 11\n93 12\n46 6\n29 4\n97 13\n54 7\n35 5\n3 1\n79 10\n99 13\n13 2\n55 7\n100 13\n11 2\n75 10\n24 3\n33 5\n22 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 1\n31 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79 2\n11 1\n22 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 3\n100 7\n94 6\n3 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "58 4\n73 5\n52 4\n69 5\n3 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 40\n70 5\n28 2\n60 4\n54 4\n33 3\n21 2\n51 4\n20 2\n44 3\n79 5\n65 5\n1 1\n52 4\n23 2\n38 3\n92 6\n63 4\n3 1\n91 6\n5 1\n64 4\n34 3\n25 2\n97 7\n89 6\n61 4\n71 5\n88 6\n29 2\n56 4\n45 3\n6 1\n53 4\n57 4\n90 6\n76 5\n8 1\n46 3\n73 5\n87 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "78 70\n89 6\n52 4\n87 6\n99 7\n3 1\n25 2\n46 3\n78 5\n35 3\n68 5\n85 6\n23 2\n60 4\n88 6\n17 2\n8 1\n15 1\n67 5\n95 6\n59 4\n94 6\n31 2\n4 1\n16 1\n10 1\n97 7\n42 3\n2 1\n24 2\n34 3\n37 3\n70 5\n18 2\n41 3\n48 3\n58 4\n20 2\n38 3\n72 5\n50 4\n49 4\n40 3\n61 4\n6 1\n45 3\n28 2\n13 1\n27 2\n96 6\n56 4\n91 6\n77 5\n12 1\n11 1\n53 4\n76 5\n74 5\n82 6\n55 4\n80 5\n14 1\n44 3\n7 1\n83 6\n79 5\n92 6\n66 5\n36 3\n73 5\n100 7\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33 1\n30 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "62 2\n14 1\n15 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n6 1\n25 1\n38 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 4\n72 3\n80 3\n15 1\n36 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 40\n25 1\n28 1\n78 3\n5 1\n13 1\n75 3\n15 1\n67 3\n57 2\n23 1\n26 1\n61 2\n22 1\n48 2\n85 3\n24 1\n82 3\n83 3\n53 2\n38 2\n19 1\n33 2\n69 3\n17 1\n79 3\n54 2\n77 3\n97 4\n20 1\n35 2\n14 1\n18 1\n71 3\n21 1\n36 2\n56 2\n44 2\n63 2\n72 3\n32 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83 70\n79 3\n49 2\n2 1\n44 2\n38 2\n77 3\n86 3\n31 1\n83 3\n82 3\n35 2\n7 1\n78 3\n23 1\n39 2\n58 2\n1 1\n87 3\n72 3\n20 1\n48 2\n14 1\n13 1\n6 1\n70 3\n55 2\n52 2\n25 1\n11 1\n61 2\n76 3\n95 3\n32 1\n66 3\n29 1\n9 1\n5 1\n3 1\n88 3\n59 2\n96 3\n10 1\n63 2\n40 2\n42 2\n34 2\n43 2\n19 1\n89 3\n94 3\n24 1\n98 4\n12 1\n30 1\n69 3\n17 1\n50 2\n8 1\n93 3\n16 1\n97 4\n54 2\n71 3\n18 1\n33 2\n80 3\n15 1\n99 4\n75 3\n4 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36 1\n96 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "73 2\n34 1\n4 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3\n37 1\n22 1\n70 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "47 4\n66 1\n57 1\n85 1\n47 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 40\n73 1\n21 1\n37 1\n87 1\n33 1\n69 1\n49 1\n19 1\n35 1\n93 1\n71 1\n43 1\n79 1\n85 1\n29 1\n72 1\n76 1\n47 1\n17 1\n67 1\n95 1\n41 1\n54 1\n88 1\n42 1\n80 1\n98 1\n96 1\n10 1\n24 1\n78 1\n18 1\n3 1\n91 1\n2 1\n15 1\n5 1\n60 1\n36 1\n46 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63 70\n82 1\n53 1\n57 1\n46 1\n97 1\n19 1\n36 1\n90 1\n23 1\n88 1\n68 1\n45 1\n2 1\n70 1\n86 1\n8 1\n83 1\n40 1\n99 1\n42 1\n32 1\n52 1\n81 1\n50 1\n77 1\n37 1\n54 1\n75 1\n4 1\n49 1\n73 1\n22 1\n21 1\n98 1\n18 1\n51 1\n14 1\n76 1\n92 1\n80 1\n78 1\n33 1\n79 1\n89 1\n67 1\n9 1\n44 1\n60 1\n64 1\n55 1\n29 1\n100 1\n16 1\n87 1\n10 1\n12 1\n25 1\n85 1\n30 1\n63 1\n39 1\n38 1\n31 1\n5 1\n26 1\n91 1\n43 1\n72 1\n48 1\n94 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0\n", "output": "-1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
214
Solve the following coding problem using the programming language python: Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states: XX XX .X X. X. .X XX XX Bishwocks don't attack any squares and can even occupy on the adjacent squares as long as they don't occupy the same square. Vasya has a board with $2\times n$ squares onto which he wants to put some bishwocks. To his dismay, several squares on this board are already occupied by pawns and Vasya can't put bishwocks there. However, pawns also don't attack bishwocks and they can occupy adjacent squares peacefully. Knowing the positions of pawns on the board, help Vasya to determine the maximum amount of bishwocks he can put onto the board so that they wouldn't occupy the same squares and wouldn't occupy squares with pawns. -----Input----- The input contains two nonempty strings that describe Vasya's board. Those strings contain only symbols "0" (zero) that denote the empty squares and symbols "X" (uppercase English letter) that denote the squares occupied by pawns. Strings are nonempty and are of the same length that does not exceed $100$. -----Output----- Output a single integer — the maximum amount of bishwocks that can be placed onto the given board. -----Examples----- Input 00 00 Output 1 Input 00X00X0XXX0 0XXX0X00X00 Output 4 Input 0X0X0 0X0X0 Output 0 Input 0XXX0 00000 Output 2 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python f = [] for i in range(2): f.append(list(input())) answer = 0 n = len(f[0]) for i in range(n): if f[0][i] == f[1][i] == '0' and i + 1 < n: if f[0][i + 1] == '0': answer += 1 f[0][i + 1] = 'X' elif f[1][i + 1] == '0': answer += 1 f[1][i + 1] = 'X' elif (f[1][i] == '0' or f[0][i] == '0') and i + 1 < n and f[0][i + 1] == f[1][i + 1] == '0': answer += 1 f[0][i + 1] = f[1][i + 1] = 'X' print(answer) ```
vfc_10610
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/991/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "00\n00\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "00X00X0XXX0\n0XXX0X00X00\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X0X0\n0X0X0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0XXX0\n00000\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "0\n0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0\nX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X\n0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000X0XX000X0XXXX0X0XXXX000X0X0XX000XXX0X00XX00XX00X0000XX0XX00X0X00X0X00X0XX000XX00XXXXXXXXXXXXXXX0\nX00XX0XX00XXXX00XXXX00XX0000000000XXX0X00XX0XX00XXX00X00X0XX0000X00XXXXXXX00X00000XXX00XXX00XXX0X0XX\n", "output": "18", "type": "stdin_stdout" }, { "fn_name": null, "input": "X\nX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0\n00\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X\n00\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "00\nX0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "00\n0X\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "XX\nXX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "66", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000\n00000\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000\nXXXXXXXX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X00X0XXXX0\nX0XXX0XX00\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000XX0000000000000\n0X00000XX0000X00X000\n", "output": "10", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXX00XXX0XXX0X0XXXXX\nXXX00XXX0XXX0X0XXXXX\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "000X00000X00000X00000000000000\n000X00000X00000X00000000000000\n", "output": "17", "type": "stdin_stdout" }, { "fn_name": null, "input": "00X0X00000X0X0X00X0X0XXX0000X0\n0000000X00X000X000000000X00000\n", "output": "12", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000000000000000000000000000000\n00X000X00X00X0000X0XX000000000X000X0000000\n", "output": "23", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0XXX00XX00X0XXXXXXXX0X0X0XX0X0X0XXXXX00X0XXXX00XX000XX0X000XX000XX\n0000000000000000000000000000000000000000000000000000000000000000000\n", "output": "24", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000X00000000000000XX0X00000X0000000000000000000000000000000000000\n0000000000000000000000000X0000000000000000000000000000000000000000000000000000000000000000\n", "output": "57", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000000000000X000000000000000000000X0X00000000000000000000000000000\n000000000000000000000000000X0X0000000000000000000000000000000000000000000000000000000000000\n", "output": "58", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\nX0X00000000000000000000000000X000000000X0000X00X000000XX000000X0X00000000X000X000000X0000X00\n", "output": "55", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXX0XXX000XXXX0XXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXX0X0XXXXXXXXXXXXXXXXXX\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "7", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000XX0000000000000000000000000000000000000000000X0000000X0000000000000X0000000000000000X00000\n00000XX0000000000000000000000000000000000000000000X0000000X0000000000000X0000000000000000X00000\n", "output": "56", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000X0000000000000000000000000XX0000000000000000X00000000000000000000000X000000000000\n000000000000000X0000000000000000000000000XX0000000000000000X00000000000000000000000X000000000000\n", "output": "59", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "64", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000X000X0000000000X00000000X00000000000000000000000000000000000000000000000000000000\n", "output": "65", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000000X00X000000000000000000000000000000000000000X00000000X0000000X0000000000000000000X0\n000000000000000000X00X000000000000000000000000000000000000000X00000000X0000000X0000000000000000000X0\n", "output": "60", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XX0XXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXX\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XX0XXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXX0X00XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXX00XXXXXXXXX0X0XXX0XX\nXXXXXXXXXXX0X00XXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXX00XXXXXXXXX0X0XXX0XX\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X0X0\nX0X0X\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0\n0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0\n0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X\n0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X\nX0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000000000X0000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "66", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "00XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000000000000000000000000000000000X0000000000000000000000000000000000000X000\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "66", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000XX\n000000000000000000000000000000000X00000000000000000X000000000000000000000000000000000000000000000000\n", "output": "65", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000X00X000000X0000X00X00X0000000000X0000000X000X00000X0X000XXX00000000XX0XX000000000000X00000000000\n000000000XX000000X00000X00X00X00000000000000000X0X000XX0000000000000X0X00X0000X0000X000000X0000000XX\n", "output": "49", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000000000000000000000000000000000X0000000000000000000000000000000000000000000000000000000000000000\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "65", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000000000000000000000X000000000000000000000000000000000000000000X00000X0000X000000000000000000\n000X0000000000X000000000000000000000X0000000000X0X0000000000000000000X00000000000000000000000000000\n", "output": "62", "type": "stdin_stdout" }, { "fn_name": null, "input": "000X00XX0XX0X00X0XX0XXXX00XXX0X00000000XXX0XXXXXXX0X00X00XX00X0XXX00000XXXX0XX00X00XXX00X0X0XXXX000\nXXXXX000X0XXX000XXXXX0XX0000XX0XXX0XXX000XXX00XXXXX00X00XX0000X0XX0XX0XX000X0XX00X00XX00XX00X00XX0X\n", "output": "16", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0X0XXXX0XXXXXXXXXX00XXXXXXXXXXXXXXXXXX0XXXXX0XX0X00X0XXXXXXX0X0XXXXXXXXX0X0X0XX0XX0000XXXX00XXX0XX\nXX0XXXXXXX0X0X00XXXX0X000X0XXXXXX0XXX0X0XXXX0XXXXXXXXXXXXXX00XX00XXX0XXXXXXXXXX00XXXX0XXXX0XXXXXXXX\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "000\n000\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000000000000\n000000000000000000000\n", "output": "14", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000000000000000000000000000000000000\n00000000000000000000000000000000000000\n", "output": "25", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000\n00X0\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "000\n00X\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "X000\nX000\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0000X000XX00000000000000000000XX000X0000X00X0X00XX000000000000X0000X0X0XX00\n00X00XX00000000X0000000X000X000X0X0X00X000X0X0X0000X0000000X000XX000XX000X00\n", "output": "33", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X00\n0000\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "0X0\n000\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000\n000000\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "X00X0\n00000\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "000\n0X0\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "X000\n00X0\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0000\n00000\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "X000X\nX000X\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "X0000X\n00000X\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "000000000000\n000000000000\n", "output": "8", "type": "stdin_stdout" }, { "fn_name": null, "input": "00000\n0000X\n", "output": "3", "type": "stdin_stdout" } ] }
apps
verifiable_code
215
Solve the following coding problem using the programming language python: Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters. Let A be a set of positions in the string. Let's call it pretty if following conditions are met: letters on positions from A in the string are all distinct and lowercase; there are no uppercase letters in the string which are situated between positions from A (i.e. there is no such j that s[j] is an uppercase letter, and a_1 < j < a_2 for some a_1 and a_2 from A). Write a program that will determine the maximum number of elements in a pretty set of positions. -----Input----- The first line contains a single integer n (1 ≤ n ≤ 200) — length of string s. The second line contains a string s consisting of lowercase and uppercase Latin letters. -----Output----- Print maximum number of elements in pretty set of positions for string s. -----Examples----- Input 11 aaaaBaabAbA Output 2 Input 12 zACaAbbaazzC Output 3 Input 3 ABC Output 0 -----Note----- In the first example the desired positions might be 6 and 8 or 7 and 8. Positions 6 and 7 contain letters 'a', position 8 contains letter 'b'. The pair of positions 1 and 8 is not suitable because there is an uppercase letter 'B' between these position. In the second example desired positions can be 7, 8 and 11. There are other ways to choose pretty set consisting of three elements. In the third example the given string s does not contain any lowercase letters, so the answer is 0. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) a = list(input()) ans = 0 for i in range(n): for j in range(i,n): b = a[i:j+1] for k in b: if k.lower() != k: break else: b = set(b) ans = max(ans,len(b)) print(ans) ```
vfc_10614
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/864/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "11\naaaaBaabAbA\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\nzACaAbbaazzC\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nABC\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\na\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\naz\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nXbTJZqcbpYuZQEoUrbxlPXAPCtVLrRExpQzxzqzcqsqzsiisswqitswzCtJQxOavicSdBIodideVRKHPojCNHmbnrLgwJlwOpyrJJIhrUePszxSjJGeUgTtOfewPQnPVWhZAtogRPrJLwyShNQaeNsvrJwjuuBOMPCeSckBMISQzGngfOmeyfDObncyeNsihYVtQbSEh\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\nAZ\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\nAabcBabcCBNMaaaaabbbbbcccccc\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nrsgraosldglhdoorwhkrsehjpuxrjuwgeanjgezhekprzarelduuaxdnspzjuooguuwnzkowkuhzduakdrzpnslauejhrrkalwpurpuuswdgeadlhjwzjgegwpknepazwwleulppwrlgrgedlwdzuodzropsrrkxusjnuzshdkjrxxpgzanzdrpnggdwxarpwohxdepJ\n", "output": "17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\nk\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\nH\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\nzG\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\ngg\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\nai\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\npEjVrKWLIFCZjIHgggVU\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\niFSiiigiYFSKmDnMGcgM\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\nedxedxxxCQiIVmYEUtLi\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\nprnchweyabjvzkoqiltm\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\nQLDZNKFXKVSVLUVHRTDPQYMSTDXBELXBOTS\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\nbvZWiitgxodztelnYUyljYGnCoWluXTvBLp\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\nBTexnaeplecllxwlanarpcollawHLVMHIIF\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\nhhwxqysolegsthsvfcqiryenbujbrrScobu\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\npbgfqosklxjuzmdheyvawrictn\n", "output": "26\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\nchMRWwymTDuZDZuSTvUmmuxvSscnTasyjlwwodhzcoifeahnbmcifyeobbydwparebduoLDCgHlOsPtVRbYGGQXfnkdvrWKIwCRl\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\nhXYLXKUMBrGkjqQJTGbGWAfmztqqapdbjbhcualhypgnaieKXmhzGMnqXVlcPesskfaEVgvWQTTShRRnEtFahWDyuBzySMpugxCM\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\nucOgELrgjMrFOgtHzqgvUgtHngKJxdMFKBjfcCppciqmGZXXoiSZibgpadshyljqrwxbomzeutvnhTLGVckZUmyiFPLlwuLBFito\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nWTCKAKLVGXSYFVMVJDUYERXNMVNTGWXUGRFCGMYXJQGLODYZTUIDENHYEGFKXFIEUILAMESAXAWZXVCZPJPEYUXBITHMTZOTMKWITGRSFHODKVJHPAHVVWTCTHIVAWAREQXWMPUWQSTPPJFHKGKELBTPUYDAVIUMGASPUEDIODRYXIWCORHOSLIBLOZUNJPHHMXEXOAY\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\neLCCuYMPPwQoNlCpPOtKWJaQJmWfHeZCKiMSpILHSKjFOYGpRMzMCfMXdDuQdBGNsCNrHIVJzEFfBZcNMwNcFjOFVJvEtUQmLbFNKVHgNDyFkFVQhUTUQDgXhMjJZgFSSiHhMKuTgZQYJqAqKBpHoHddddddddddddddddXSSYNKNnRrKuOjAVKZlRLzCjExPdHaDHBT\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nitSYxgOLlwOoAkkkkkzzzzzzzzkzkzkzkkkkkzkzzkzUDJSKybRPBvaIDsNuWImPJvrHkKiMeYukWmtHtgZSyQsgYanZvXNbKXBlFLSUcqRnGWSriAvKxsTkDJfROqaKdzXhvJsPEDATueCraWOGEvRDWjPwXuiNpWsEnCuhDcKWOQxjBkdBqmFatWFkgKsbZuLtRGtY\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\noggqoqqogoqoggggoggqgooqggogogooogqqgggoqgggqoqogogggogggqgooqgqggqqqoqgqgoooqgqogqoggoqqgqoqgoooqoogooqoogqoqoqqgoqgoqgggogqqqoqoggoqoqqoqggqoggooqqqoqggoggqqqqqqqqqgogqgggggooogogqgggqogqgoqoqogoooq\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nCtclUtUnmqFniaLqGRmMoUMeLyFfAgWxIZxdrBarcRQprSOGcdUYsmDbooSuOvBLgrYlgaIjJtFgcxJKHGkCXpYfVKmUbouuIqGstFrrwJzYQqjjqqppqqqqqpqqqjpjjpjqjXRYkfPhGAatOigFuItkKxkjCBLdiNMVGjmdWNMgOOvmaJEdGsWNoaERrINNKqKeQajv\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nmeZNrhqtSTSmktGQnnNOTcnyAMTKSixxKQKiagrMqRYBqgbRlsbJhvtNeHVUuMCyZLCnsIixRYrYEAkfQOxSVqXkrPqeCZQksInzRsRKBgvIqlGVPxPQnypknSXjgMjsjElcqGsaJRbegJVAKtWcHoOnzHqzhoKReqBBsOhZYLaYJhmqOMQsizdCsQfjUDHcTtHoeYwu\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\neTtezDHXMMBtFUaohwuYdRVloYwZLiaboJTMWLImSCrDTDFpAYJsQBzdwkEvcoYfWmKZfqZwfGHigaEpwAVoVPDSkDJsRzjjdyAcqfVIUcwiJuHyTisFCCNHIFyfDWOyMMRtTWmQFCRNtmwMTzQSZdOFfojwvAtxTrSgaDLzzBwDkxPoCYuSxpwRbnhfsERywPyUlJBC\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nvFAYTHJLZaivWzSYmiuDBDUFACDSVbkImnVaXBpCgrbgmTfXKJfoglIkZxWPSeVSFPnHZDNUAqLyhjLXSuAqGLskBlDxjxGPJyGdwzlPfIekwsblIrkxzfhJeNoHywdfAGlJzqXOfQaKceSqViVFTRJEGfACnsFeSFpOYisIHJciqTMNAmgeXeublTvfWoPnddtvKIyF\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\ngnDdkqJjYvduVYDSsswZDvoCouyaYZTfhmpSakERWLhufZtthWsfbQdTGwhKYjEcrqWBOyxBbiFhdLlIjChLOPiOpYmcrJgDtXsJfmHtLrabyGKOfHQRukEtTzwoqBHfmyVXPebfcpGQacLkGWFwerszjdHpTBXGssYXmGHlcCBgBXyGJqxbVhvDffLyCrZnxonABEXV\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nBmggKNRZBXPtJqlJaXLdKKQLDJvXpDuQGupiRQfDwCJCJvAlDDGpPZNOvXkrdKOFOEFBVfrsZjWyHPoKGzXmTAyPJGEmxCyCXpeAdTwbrMtWLmlmGNqxvuxmqpmtpuhrmxxtrquSLFYVlnSYgRJDYHWgHBbziBLZRwCIJNvbtsEdLLxmTbnjkoqSPAuzEeTYLlmejOUH\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nMkuxcDWdcnqsrlTsejehQKrTwoOBRCUAywqSnZkDLRmVBDVoOqdZHbrInQQyeRFAjiYYmHGrBbWgWstCPfLPRdNVDXBdqFJsGQfSXbufsiogybEhKDlWfPazIuhpONwGzZWaQNwVnmhTqWdewaklgjwaumXYDGwjSeEcYXjkVtLiYSWULEnTFukIlWQGWsXwWRMJGTcI\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nOgMBgYeuMJdjPtLybvwmGDrQEOhliaabEtwulzNEjsfnaznXUMoBbbxkLEwSQzcLrlJdjJCLGVNBxorghPxTYCoqniySJMcilpsqpBAbqdzqRUDVaYOgqGhGrxlIJkyYgkOdTUgRZwpgIkeZFXojLXpDilzirHVVadiHaMrxhzodzpdvhvrzdzxbhmhdpxqqpoDegfFQ\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nOLaJOtwultZLiZPSYAVGIbYvbIuZkqFZXwfsqpsavCDmBMStAuUFLBVknWDXNzmiuUYIsUMGxtoadWlPYPqvqSvpYdOiJRxFzGGnnmstniltvitnrmyrblnqyruylummmlsqtqitlbulvtuitiqimuintbimqyurviuntqnnvslynlNYMpYVKYwKVTbIUVdlNGrcFZON\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nzdqzfjWCocqbUbVYaLrBFEwoQiMdlVssRjIctSenAIqPgPJhjPyvvgRFlplFXKTctqFUPlVyMxEfZDfFbUjOMCYFkrFeoZegnSzuKrbWQqcJWfeFauSqYeSCdiPiWroksbkdskrasekytdvnygetyabnteaybdZAoBntIxZJTTsTblLAosqwHQEXTSqjEQqzNGRgdaVG\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nGqxrcpJdPhHQUhCwJAOhrKsIttEjqYjygzoyvslFXvybQiWHjViWlOrHvMlDzWaiurjYKsmlrwqAhjZPHZaFMWFlgFJYntZLgPzuksawCmWOHFyANczsdkkusKLQOOHiJsJDvzsVRaUNWLKMRTbmoLwFOJxakhxsenjkzzucpothHNpNtMMfLdmiFyblVUmeIBdpFYIQ\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nGAcmlaqfjSAQLvXlkhxujXgSbxdFAwnoxDuldDvYmpUhTWJdcEQSdARLrozJzIgFVCkzPUztWIpaGfiKeqzoXinEjVuoKqyBHmtFjBWcRdBmyjviNlGAIkpikjAimmBgayfphrstfbjexjbttzfzfzaysxfyrjazfhtpghnbbeffjhxrjxpttesgzrnrfbgzzsRsCgmz\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\neybfkeyfccebifebaukyeraeuxaeprnibicxknepxurnlrbuyuykexbiycpnbbafxnpbrkctpkteetrfptiyaceoylnclytirfkcxboeyufplnbtbikireyulxfaknppuicnabixrnpoicexcaelttlllttfboniebinulkoxuilpnnkrpectutnctoykpPJsflVwmDo\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nfEyHTWhrGQezPcvGDrqJEnPVQRxiaGPbWoPVYGMlGIWuAAWdFzIiRTEjsyivewudtzuiuhulqywpzmdopjykvtkjzlyhhzspmovwHtiMtZYkYBozzkGfGmrizjuQYVaewYqglzMAkQSZERgWPYVxfoGLzNbWAJZutTuGxeBzRIdKAKVPbqlTJVqiKnpFbTWawutdSjux\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nutxfRatSRtHcDvHfsBBCwsUFcAmrFxHfbMjWhAjfdoQkNfQWfgQEeBVZJavMlpmptFHJGxBFaHfxLAGcZJsUukXLBMfwWlqnnQxKtgnQDqtiJBnoAnxxFBlPJJnuWkdOzYGBRMwSSrjDAVZqYhtopxDVrBAJsIODCUadfEDDzeyroijgwqhaucmnstclNRVxoTYzMSlK\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nYRvIopNqSTYDhViTqCLMwEbTTIdHkoeuBmAJWhgtOgVxlcHSsavDNzMfpwTghkBvYEtCYQxicLUxdgAcaCzOOgbQYsfnaTXFlFxbeEiGwdNvxwHzkTdKtWlqzalwniDDBDipkxfflpaqkfkgfezbkxdvzemlfohwtgytzzywmwhvzUgPlPdeAVqTPAUZbogQheRXetvT\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nPUVgmHVAXlBaxUIthvGXCVOuIcukqODzMYigUBAZNJcJoayfRXVFfLgKmHdtevsEjoexdSwqvtAeoiyqjnBKoyKduwPCBNEDdkTpjlOOdOlJIEWovEGoDzwhtITNpVamnXVSxPmZTbuhnEbtebgqYEXFbyagmztkxmcgshnxqrowthegiepvLLUIbBalXAJAbGplWMbt\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nPQNfMSHpPaOhjCpYPkOgzCpgOhgsmyaTHrlxgogmhdficyeszcbujjrxeihgrzszsjehsupezxlpcpsemesxcwwwllhisjpnepdoefpdzfptdrmETROYtOUjiUsPwrNkUfmeTFgSIJMjTuCFBgfkTQEYJijBaPnaVltQJhKufDKrdMAFnBflaekZErAuKkGhGMLLOEzZ\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nBmrFQLXLcKnPBEdQVHVplsEIsrxSlfEbbYXjMrouIwHSyfqjxoerueuanalzliouwllrhzfytmgtfoxeuhjfaaabwjdlimcluabajcoxwgqjotcjdftwqbxhwjnbwoeillzbftzynhfyyqiuszjreujwyhdrdhyyxsglgdjbtghlqutjstmsaowcqchzbdzoeqIqbQUY\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nZlJwrzzglgkjqtmoseaapqtqxbrorjptpejjmchztutkglqjxxqgnuxeadxksnclizglywqmtxdhrbbmooxijiymikyIOlSBShUOGUghPJtSxmToNUHDdQIMoFzPOVYAtLRtXyuOErmpYQFAeKMJKlqZCEVEuhSCCtBnQnOncTqYpaLbhutwhplyJGxtuXQiEfuvOzWr\n", "output": "24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nNcYVomemswLCUqVRSDKHCknlBmqeSWhVyRzQrnZaOANnTGqsRFMjpczllcEVebqpxdavzppvztxsnfmtcharzqlginndyjkawzurqkxJLXiXKNZTIIxhSQghDpjwzatEqnLMTLxwoEKpHytvWkKFDUcZjLShCiVdocxRvvJtbXHCDGpJvMwRKWLhcTFtswdLUHkbhfau\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200\nDxNZuvkTkQEqdWIkLzcKAwfqvZQiptnTazydSCTIfGjDhLMrlPZiKEsqIdDhgKPAlEvXyzNwWtYorotgkcwydpabjqnzubaksdchucxtkmjzfretdmvlxgklyvicrtftvztsbiUaQorfNIYUOdwQDRsKpxLUiLknbLbinilpPXPTTwLAnXVpMHBaAcKWgDBeOFabPtXU\n", "output": "26\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\nabbc\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naaa\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naba\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nabb\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nbba\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nAaa\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nAba\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naBa\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naAa\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naAb\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naaA\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\naaB\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nabA\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nbbA\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nAaA\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nBaB\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nAAB\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\nZZZ\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\naBacd\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\naAabc\n", "output": "3\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
216
Solve the following coding problem using the programming language python: You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. Let B be the sum of elements belonging to b, and C be the sum of elements belonging to c (if some of these sequences is empty, then its sum is 0). What is the maximum possible value of B - C? -----Input----- The first line contains one integer n (1 ≤ n ≤ 100) — the number of elements in a. The second line contains n integers a_1, a_2, ..., a_{n} ( - 100 ≤ a_{i} ≤ 100) — the elements of sequence a. -----Output----- Print the maximum possible value of B - C, where B is the sum of elements of sequence b, and C is the sum of elements of sequence c. -----Examples----- Input 3 1 -2 0 Output 3 Input 6 16 23 16 15 42 8 Output 120 -----Note----- In the first example we may choose b = {1, 0}, c = { - 2}. Then B = 1, C = - 2, B - C = 3. In the second example we choose b = {16, 23, 16, 15, 42, 8}, c = {} (an empty sequence). Then B = 120, C = 0, B - C = 120. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n=int(input()) arr= list(map(int,input().strip().split(' '))) s = 0 for i in range(n): s+=abs(arr[i]) print(s) ```
vfc_10618
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/946/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n1 -2 0\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n16 23 16 15 42 8\n", "output": "120\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n-1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100\n", "output": "10000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 5\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-2 0 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n-1 -2 -3 4 4 -6 -6 56 3 3 -3 3\n", "output": "94\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 -1 1 -1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n100 -100 100 -100\n", "output": "400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-2 -5 10\n", "output": "17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 -2 3 -4 5\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-100 100 -100\n", "output": "300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 -1 1 -1 1 -1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 -2 2 -2 2 -2\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n12 93 -2 0 0 0 3 -3 -9\n", "output": "122\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-1 2 4 -5 -3 55\n", "output": "70\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-12 8 68 -53 1 -15\n", "output": "157\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-2 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n100 -100 100\n", "output": "300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n100 100 -1 -100 2\n", "output": "303\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-5 -4 -3 -2 -1 0\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n4 4 4 -3 -3 2\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n100\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 -2 3 1 2\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n100 -100 100 -100 100\n", "output": "500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 -1 1 -1 1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 0 -1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n100 -100 -1 2 100\n", "output": "303\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n75 0\n", "output": "75\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n55 56 -59 -58\n", "output": "228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n9 71\n", "output": "80\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n9 70\n", "output": "79\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n9 69\n", "output": "78\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100 -100\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-9 4 -9 5\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n91 -27 -79 -56 80 -93 -23 10 80 94 61 -89 -64 81 34 99 31 -32 -69 92 79 -9 73 66 -8 64 99 99 58 -19 -40 21 1 -33 93 -23 -62 27 55 41 57 36\n", "output": "2348\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n-1 2 2 2 -1 2 -1\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-12 8 17 -69 7 -88\n", "output": "201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -2 5\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-2 3 -4 5 6 -1\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-5 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 -2 4\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "68\n21 47 -75 -25 64 83 83 -21 89 24 43 44 -35 34 -42 92 -96 -52 -66 64 14 -87 25 -61 -78 83 -96 -18 95 83 -93 -28 75 49 87 65 -93 -69 -2 95 -24 -36 -61 -71 88 -53 -93 -51 -81 -65 -53 -46 -56 6 65 58 19 100 57 61 -53 44 -58 48 -8 80 -88 72\n", "output": "3991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 5 -10 -1 1\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-1 2 3\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76\n57 -38 -48 -81 93 -32 96 55 -44 2 38 -46 42 64 71 -73 95 31 -39 -62 -1 75 -17 57 28 52 12 -11 82 -84 59 -86 73 -97 34 97 -57 -85 -6 39 -5 -54 95 24 -44 35 -18 9 91 7 -22 -61 -80 54 -40 74 -90 15 -97 66 -52 -49 -24 65 21 -93 -29 -24 -4 -1 76 -93 7 -55 -53 1\n", "output": "3787\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 -2 1 2 3\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 -2 -2\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n100 -100 100 -100 100 -100\n", "output": "600\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n-59 -33 34 0 69 24 -22 58 62 -36 5 45 -19 -73 61 -9 95 42 -73 -64 91 -96 2 53 -8 82 -79 16 18 -5 -53 26 71 38 -31 12 -33 -1 -65 -6 3 -89 22 33 -27 -36 41 11 -47 -32 47 -56 -38 57 -63 -41 23 41 29 78 16 -65 90 -58 -12 6 -60 42 -36 -52 -54 -95 -10 29 70 50 -94 1 93 48 -71 -77 -16 54 56 -60 66 76 31 8 44 -61 -74 23 37 38 18 -18 29 41\n", "output": "4362\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-1 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -2 100\n", "output": "103\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 -2 3 1 2\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n100 -10 -100 10 10 10 10 10 10 10\n", "output": "280\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 0 -2 4\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 -3 1 -1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -1 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 5 -2 4\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n-2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -2 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 -2 1 1 -1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-2 0 2 4\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n-42 7 87 -16 -5 65 -88 1\n", "output": "311\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 -3 4\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-1 2 -1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n-21 12 65 66 -24 62 82 35 -45 -47 28 37 5 -32 22 -14 -69 -95\n", "output": "761\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n-1 1 -1 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 2 1 1 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 1\n", "output": "3\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
217
Solve the following coding problem using the programming language python: A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from x = 0 to x = a and back. Moving from the point x = 0 to x = a or from the point x = a to x = 0 is called a bus journey. In total, the bus must make k journeys. The petrol tank of the bus can hold b liters of gasoline. To pass a single unit of distance the bus needs to spend exactly one liter of gasoline. The bus starts its first journey with a full petrol tank. There is a gas station in point x = f. This point is between points x = 0 and x = a. There are no other gas stations on the bus route. While passing by a gas station in either direction the bus can stop and completely refuel its tank. Thus, after stopping to refuel the tank will contain b liters of gasoline. What is the minimum number of times the bus needs to refuel at the point x = f to make k journeys? The first journey starts in the point x = 0. -----Input----- The first line contains four integers a, b, f, k (0 < f < a ≤ 10^6, 1 ≤ b ≤ 10^9, 1 ≤ k ≤ 10^4) — the endpoint of the first bus journey, the capacity of the fuel tank of the bus, the point where the gas station is located, and the required number of journeys. -----Output----- Print the minimum number of times the bus needs to refuel to make k journeys. If it is impossible for the bus to make k journeys, print -1. -----Examples----- Input 6 9 2 4 Output 4 Input 6 10 2 4 Output 2 Input 6 5 4 3 Output -1 -----Note----- In the first example the bus needs to refuel during each journey. In the second example the bus can pass 10 units of distance without refueling. So the bus makes the whole first journey, passes 4 units of the distance of the second journey and arrives at the point with the gas station. Then it can refuel its tank, finish the second journey and pass 2 units of distance from the third journey. In this case, it will again arrive at the point with the gas station. Further, he can refill the tank up to 10 liters to finish the third journey and ride all the way of the fourth journey. At the end of the journey the tank will be empty. In the third example the bus can not make all 3 journeys because if it refuels during the second journey, the tanks will contain only 5 liters of gasoline, but the bus needs to pass 8 units of distance until next refueling. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() a,b,f,k = map_input() tot = a*k s = 2*a-f cur = 0 cnt = b go = 0 ans = 0 while cur < tot: go = 1-go if(go == 1): if cnt < s and cnt < tot-cur: if(cnt < f): print(-1) break cnt = b ans += 1 cnt -= (a-f) else: cnt -= a else: if cnt < a+f and cnt < tot-cur: if(cnt < a-f): print(-1) break cnt = b ans += 1 cnt -= (f) else:cnt -= a cur += a # print(cur,cnt,ans) if(cnt < 0): print(-1) break else: print(ans) ```
vfc_10622
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/864/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "6 9 2 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 10 2 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 4 3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 4 6 10\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 51923215 2302 10000\n", "output": "199\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 11 3 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 50 10 25\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 5 20\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 65 5 50\n", "output": "12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 19 1 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 19 9 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23 46 12 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23 46 12 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 20 19 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 23 17 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 18 9 2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 70 50 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 70 70 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 480 1 40\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "140 480 139 40\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 1 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 999999 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 159842934 2376 1000\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 1000000 50000 1000\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000 500000 1000\n", "output": "1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000 500000 10000\n", "output": "10000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 2500000 500000 9999\n", "output": "4998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1500000 500000 9999\n", "output": "9997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1500000 500000 10000\n", "output": "9998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1 1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1 999999 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 999999 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 10000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1 1 10000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 1 10000\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1 999999 10000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 10000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 1000000000 999999 10000\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 78393 3000 9999\n", "output": "1428\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 8839233 302200 9999\n", "output": "1249\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "900005 3333333 210000 9999\n", "output": "3332\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999 39486793 138762 9282\n", "output": "244\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 8739233 400000 9999\n", "output": "1249\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 500000 500000 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 70000000 333333 9999\n", "output": "142\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7 4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 2 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 8 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "150 100 1 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 9 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5 6 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 4 7 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 5 97 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 11 6 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 50 99 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 4 1\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "51 81 36 38\n", "output": "36\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 6 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 7 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 11 6 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 5 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 159 80 2\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
218
Solve the following coding problem using the programming language python: You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q. For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo". Note it is allowed to split the string s to the strings only of length p or to the strings only of length q (see the second sample test). -----Input----- The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. -----Output----- If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be in order of their appearing in string s — from left to right. If there are several solutions print any of them. -----Examples----- Input 5 2 3 Hello Output 2 He llo Input 10 9 5 Codeforces Output 2 Codef orces Input 6 4 5 Privet Output -1 Input 8 1 1 abacabac Output 8 a b a c a b a c The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b, c = map(int, input().split(' ')) x = input() for i in range(105): for j in range(105): if i*b+j*c == a: print(i+j) for k in range(i): print(x[:b]) x = x[b:] for l in range(j): print(x[:c]) x = x[c:] quit() print(-1) ```
vfc_10626
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/612/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5 2 3\nHello\n", "output": "2\nHe\nllo\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9 5\nCodeforces\n", "output": "2\nCodef\norces\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 5\nPrivet\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 1 1\nabacabac\n", "output": "8\na\nb\na\nc\na\nb\na\nc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n1\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 8 1\nuTl9w4lcdo\n", "output": "10\nu\nT\nl\n9\nw\n4\nl\nc\nd\no\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 6 4\nfmFRpk2NrzSvnQC9gB61\n", "output": "5\nfmFR\npk2N\nrzSv\nnQC9\ngB61\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 23 6\nWXDjl9kitaDTY673R5xyTlbL9gqeQ6\n", "output": "5\nWXDjl9\nkitaDT\nY673R5\nxyTlbL\n9gqeQ6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 14 3\nSOHBIkWEv7ScrkHgMtFFxP9G7JQLYXFoH1sJDAde\n", "output": "6\nSOHBIkWEv7Scrk\nHgMtFFxP9G7JQL\nYXF\noH1\nsJD\nAde\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 16 3\nXCgVJUu4aMQ7HMxZjNxe3XARNiahK303g9y7NV8oN6tWdyXrlu\n", "output": "8\nXCgVJUu4aMQ7HMxZ\njNxe3XARNiahK303\ng9y\n7NV\n8oN\n6tW\ndyX\nrlu\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60 52 8\nhae0PYwXcW2ziQCOSci5VaElHLZCZI81ULSHgpyG3fuZaP0fHjN4hCKogONj\n", "output": "2\nhae0PYwXcW2ziQCOSci5VaElHLZCZI81ULSHgpyG3fuZaP0fHjN4\nhCKogONj\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 50 5\n1BH1ECq7hjzooQOZdbiYHTAgATcP5mxI7kLI9rqA9AriWc9kE5KoLa1zmuTDFsd2ClAPPY\n", "output": "14\n1BH1E\nCq7hj\nzooQO\nZdbiY\nHTAgA\nTcP5m\nxI7kL\nI9rqA\n9AriW\nc9kE5\nKoLa1\nzmuTD\nFsd2C\nlAPPY\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80 51 8\no2mpu1FCofuiLQb472qczCNHfVzz5TfJtVMrzgN3ff7FwlAY0fQ0ROhWmIX2bggodORNA76bHMjA5yyc\n", "output": "10\no2mpu1FC\nofuiLQb4\n72qczCNH\nfVzz5TfJ\ntVMrzgN3\nff7FwlAY\n0fQ0ROhW\nmIX2bggo\ndORNA76b\nHMjA5yyc\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90 12 7\nclcImtsw176FFOA6OHGFxtEfEyhFh5bH4iktV0Y8onIcn0soTwiiHUFRWC6Ow36tT5bsQjgrVSTcB8fAVoe7dJIWkE\n", "output": "10\nclcImtsw176F\nFOA6OHGFxtEf\nEyhFh5bH4ikt\nV0Y8onIcn0so\nTwiiHUF\nRWC6Ow3\n6tT5bsQ\njgrVSTc\nB8fAVoe\n7dJIWkE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 25 5\n2SRB9mRpXMRND5zQjeRxc4GhUBlEQSmLgnUtB9xTKoC5QM9uptc8dKwB88XRJy02r7edEtN2C6D60EjzK1EHPJcWNj6fbF8kECeB\n", "output": "20\n2SRB9\nmRpXM\nRND5z\nQjeRx\nc4GhU\nBlEQS\nmLgnU\ntB9xT\nKoC5Q\nM9upt\nc8dKw\nB88XR\nJy02r\n7edEt\nN2C6D\n60Ejz\nK1EHP\nJcWNj\n6fbF8\nkECeB\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 97 74\nxL8yd8lENYnXZs28xleyci4SxqsjZqkYzkEbQXfLQ4l4gKf9QQ9xjBjeZ0f9xQySf5psDUDkJEtPLsa62n4CLc6lF6E2yEqvt4EJ\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "51 25 11\nwpk5wqrB6d3qE1slUrzJwMFafnnOu8aESlvTEb7Pp42FDG2iGQn\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 13 37\nfzL91QIJvNoZRP4A9aNRT2GTksd8jEb1713pnWFaCGKHQ1oYvlTHXIl95lqyZRKJ1UPYvT\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 3 1\nXQ2vXLPShy\n", "output": "10\nX\nQ\n2\nv\nX\nL\nP\nS\nh\ny\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 3\naaaa\n", "output": "2\naa\naa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 4\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 2 3\nhavanahavan\n", "output": "4\nha\nvan\naha\nvan\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 2 2\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "50\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\naa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 3 5\ngopstopmipodoshli\n", "output": "5\ngop\nsto\npmi\npod\noshli\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 3\nfoyku\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 2\n123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 2\nrecursionishellrecursionishellrecursionishellrecursionishellrecursionishellrecursionishelldontuseit\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 2 3\nqibwnnvqqgo\n", "output": "4\nqi\nbwn\nnvq\nqgo\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\nhhhh\n", "output": "1\nhhhh\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 2\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 5\nhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "output": "21\nhh\nhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\nhhhhh\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5 9\nCodeforces\n", "output": "2\nCodef\norces\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5 9\naaaaaaaaaa\n", "output": "2\naaaaa\naaaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 3 2\nmlmqpohwtsf\n", "output": "5\nmlm\nqp\noh\nwt\nsf\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\nzyx\n", "output": "1\nzyx\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3 3\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 3\nzyxw\n", "output": "2\nzy\nxw\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 3\nejt\n", "output": "1\nejt\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 4\nzyxwv\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 5 4\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "25\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\naaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\nzyx\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 2\nhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26 8 9\nabcabcabcabcabcabcabcabcab\n", "output": "3\nabcabcab\ncabcabcab\ncabcabcab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 5\naaaaaa\n", "output": "2\naaa\naaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 3\nzyx\n", "output": "1\nzyx\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 2\naaaaa\n", "output": "1\naaaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\nzyxw\n", "output": "2\nzy\nxw\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 3\nzyxwv\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95 3 29\nabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab\n", "output": "23\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabcabcabcabcabcabcabcabcabcab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\naaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 62 3\nfjzhkfwzoabaauvbkuzaahkozofaophaafhfpuhobufawkzbavaazwavwppfwapkapaofbfjwaavajojgjguahphofj\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2 2\nabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "56 13 5\nabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab\n", "output": "8\nabcabcabcabca\nbcabcabcabcab\ncabca\nbcabc\nabcab\ncabca\nbcabc\nabcab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79 7 31\nabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 79 6\nxlvplpckwnhmctoethhslkcyashqtsoeltriddglfwtgkfvkvgytygbcyohrvcxvosdioqvackxiuifmkgdngvbbudcb\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48 16 13\nibhfinipihcbsqnvtgsbkobepmwymlyfmlfgblvhlfhyojsy\n", "output": "3\nibhfinipihcbsqnv\ntgsbkobepmwymlyf\nmlfgblvhlfhyojsy\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 3 7\naaaaaaaaaaaaaaaa\n", "output": "4\naaa\naaa\naaa\naaaaaaa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 10 3\naaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 8 8\naaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 7 3\naaaaaaaaaaa\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41 3 4\nabcabcabcabcabcabcabcabcabcabcabcabcabcab\n", "output": "11\nabc\nabc\nabc\nabca\nbcab\ncabc\nabca\nbcab\ncabc\nabca\nbcab\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 3 2\naaaaaaaaaaa\n", "output": "5\naaa\naa\naa\naa\naa\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 9 4\nabcdefghijklmn\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 9 5\n123456789\n", "output": "1\n123456789\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 10 41\nmeotryyfneonmnrvfnhqlehlxtvpracifpadcofecvbikoitrlgeftiqofpvacgocrdiquhatlqosqvtduenaqkwrnnw\n", "output": "3\nmeotryyfne\nonmnrvfnhqlehlxtvpracifpadcofecvbikoitrlg\neftiqofpvacgocrdiquhatlqosqvtduenaqkwrnnw\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 16 3\ndxyhgtsxtuyljmclj\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82 13 30\nfmtwumakkejtolxqxrnydhqoufwtdwldfxcfjrndauqcarhbwmdwxsxfbqjsfspuxobywhcrvlndsdmkqd\n", "output": "5\nfmtwumakkejto\nlxqxrnydhqouf\nwtdwldfxcfjrn\ndauqcarhbwmdw\nxsxfbqjsfspuxobywhcrvlndsdmkqd\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95 3 3\nihnfqcswushyoirjxlxxnwqtwtaowounkumxukwpacxwatimhhhoggqwkkspcplvyndfukbxickcixidgxkjtnpkoeiwlor\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 5 3\nzyxwvut\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 16 4\nctvfhkiakagcilrdw\n", "output": "-1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
219
Solve the following coding problem using the programming language python: A sportsman starts from point x_{start} = 0 and runs to point with coordinate x_{finish} = m (on a straight line). Also, the sportsman can jump — to jump, he should first take a run of length of not less than s meters (in this case for these s meters his path should have no obstacles), and after that he can jump over a length of not more than d meters. Running and jumping is permitted only in the direction from left to right. He can start andfinish a jump only at the points with integer coordinates in which there are no obstacles. To overcome some obstacle, it is necessary to land at a point which is strictly to the right of this obstacle. On the way of an athlete are n obstacles at coordinates x_1, x_2, ..., x_{n}. He cannot go over the obstacles, he can only jump over them. Your task is to determine whether the athlete will be able to get to the finish point. -----Input----- The first line of the input containsd four integers n, m, s and d (1 ≤ n ≤ 200 000, 2 ≤ m ≤ 10^9, 1 ≤ s, d ≤ 10^9) — the number of obstacles on the runner's way, the coordinate of the finishing point, the length of running before the jump and the maximum length of the jump, correspondingly. The second line contains a sequence of n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ m - 1) — the coordinates of the obstacles. It is guaranteed that the starting and finishing point have no obstacles, also no point can have more than one obstacle, The coordinates of the obstacles are given in an arbitrary order. -----Output----- If the runner cannot reach the finishing point, print in the first line of the output "IMPOSSIBLE" (without the quotes). If the athlete can get from start to finish, print any way to do this in the following format: print a line of form "RUN X>" (where "X" should be a positive integer), if the athlete should run for "X" more meters; print a line of form "JUMP Y" (where "Y" should be a positive integer), if the sportsman starts a jump and should remain in air for "Y" more meters. All commands "RUN" and "JUMP" should strictly alternate, starting with "RUN", besides, they should be printed chronologically. It is not allowed to jump over the finishing point but it is allowed to land there after a jump. The athlete should stop as soon as he reaches finish. -----Examples----- Input 3 10 1 3 3 4 7 Output RUN 2 JUMP 3 RUN 1 JUMP 2 RUN 2 Input 2 9 2 3 6 4 Output IMPOSSIBLE The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, m, s, d = list(map(int, input().split())) beg = [float('-inf')] end = [float('-inf')] a = [int(i) for i in input().split()] for x in sorted(a): if (x - end[-1] > s + 1): beg.append(x) end.append(x) else: end[-1] = x last = 0 R = [] J = [] for i in range(1, len(beg)): R.append(beg[i] - 1 - last) last = (beg[i] - 1) J.append(end[i] + 1 - last) last = (end[i] + 1) ok = True for x in J: if (x > d): ok = False for x in R: if (x < s): ok = False if ok: for i in range(len(R)): print('RUN', R[i]) print('JUMP', J[i]) if (last < m): print('RUN', m - last) else: print('IMPOSSIBLE') ```
vfc_10630
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/637/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 10 1 3\n3 4 7\n", "output": "RUN 2\nJUMP 3\nRUN 1\nJUMP 2\nRUN 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 9 2 3\n6 4\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 100 2 8\n93 35 24 87 39 46 86 37 73 33\n", "output": "RUN 23\nJUMP 2\nRUN 7\nJUMP 8\nRUN 5\nJUMP 2\nRUN 25\nJUMP 2\nRUN 11\nJUMP 3\nRUN 4\nJUMP 2\nRUN 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1000000000 8905990 20319560\n233244997 997992814 242452779 497363176 572234096 126615858 886769539 662035052 989086824 716655858\n", "output": "RUN 126615857\nJUMP 2\nRUN 106629137\nJUMP 2\nRUN 9207780\nJUMP 2\nRUN 254910395\nJUMP 2\nRUN 74870918\nJUMP 2\nRUN 89800954\nJUMP 2\nRUN 54620804\nJUMP 2\nRUN 170113679\nJUMP 2\nRUN 102317283\nJUMP 8905992\nRUN 2007185\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1000 1 4\n228 420 360 642 442 551 940 343 24 83 928 110 663 548 704 461 942 799 283 746 371 204 435 209 986 489 918 526 496 321 233 643 208 717 806 18 291 431 521 631 3 450 711 602 401 60 680 930 625 891 161 279 510 529 546 338 473 925 446 786 384 952 260 649 865 916 789 71 103 997 484 89 408 129 953 670 568 55 287 511 369 225 950 539 652 567 730 499 687 90 779 848 801 606 82 853 967 776 951 329\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 600 1 4\n9 536 518 59 229 377 72 203 81 309 304 321 55 439 287 505 3 410 582 351 440 568 584 259 22 415 348 147 404 277 477 323 537 75 548 324 338 198 145 182 271 496 256 329 592 132 291 222 115 587 54 158 154 103 356 15 36 76 402 27 223 551 267 527 51 34 417 573 479 398 425 71 485 20 262 566 467 131 524 352 330 541 146 53 322 436 366 86 88 272 96 456 388 319 149 470 129 162 353 346\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 1 5\n1\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 1 2\n2\n", "output": "RUN 1\nJUMP 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5 1 2\n2\n", "output": "RUN 1\nJUMP 2\nRUN 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000 1000000000 2\n999999999\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 1 1\n4\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000 1 1000000000\n2\n", "output": "RUN 1\nJUMP 2\nRUN 999999997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12000 2000 3000\n3000 9002 7001\n", "output": "RUN 2999\nJUMP 2\nRUN 3999\nJUMP 2003\nRUN 2997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 30000 5000 6000\n6000 16000 15000 21001\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12000 2000 245\n3000 9003 7001\n", "output": "RUN 2999\nJUMP 2\nRUN 3999\nJUMP 2\nRUN 2000\nJUMP 2\nRUN 2996\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 30000 5000 1654\n6000 16000 14999 21002\n", "output": "RUN 5999\nJUMP 2\nRUN 8997\nJUMP 1003\nRUN 5000\nJUMP 2\nRUN 8997\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10000 500 500\n700 600 1099 2000\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 20000 4000 3502\n5000 8500 15000\n", "output": "RUN 4999\nJUMP 3502\nRUN 6498\nJUMP 2\nRUN 4999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10000 500 500\n700 601 1099 2000\n", "output": "RUN 600\nJUMP 500\nRUN 899\nJUMP 2\nRUN 7999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 20000 4000 3502\n5000 8501 15000\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10 1 2\n9\n", "output": "RUN 8\nJUMP 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10 2 9\n5\n", "output": "RUN 4\nJUMP 2\nRUN 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 9 6 4\n4\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10 7 4\n5\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 14 8 8\n5 9\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 23 12 8\n8 16\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 14 4 2\n2 7\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 21 6 2\n7 11 16\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 29 3 4\n7 16 19\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 24 2 6\n6 12 17\n", "output": "RUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 3\nJUMP 2\nRUN 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 31 12 9\n7 13 21 28\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 1 7\n2 4 6 8\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 36 8 4\n4 13 19 27\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 25 10 2\n6 12 13 15 22\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 19 7 10\n3 7 9 12 16\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 28 6 8\n3 9 15 21 25\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 35 12 4\n7 12 17 21 24 28\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 22 5 7\n4 6 10 13 15 18\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 55 3 5\n10 18 24 34 39 45\n", "output": "RUN 9\nJUMP 2\nRUN 6\nJUMP 2\nRUN 4\nJUMP 2\nRUN 8\nJUMP 2\nRUN 3\nJUMP 2\nRUN 4\nJUMP 2\nRUN 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 51 6 1\n8 17 18 23 27 33 42\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 36 11 4\n6 11 17 19 22 24 30\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 28 10 2\n5 10 14 19 21 23 27\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 46 4 5\n3 6 15 21 24 26 36 42\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 51 2 1\n6 14 20 26 29 35 40 48\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 56 2 9\n7 11 20 28 34 39 40 48\n", "output": "RUN 6\nJUMP 2\nRUN 2\nJUMP 2\nRUN 7\nJUMP 2\nRUN 6\nJUMP 2\nRUN 4\nJUMP 2\nRUN 3\nJUMP 3\nRUN 6\nJUMP 2\nRUN 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 57 2 2\n5 11 15 21 24 30 36 43 50\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 82 14 4\n10 18 28 38 46 55 64 74 79\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 40 6 3\n5 10 14 18 22 27 30 31 36\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 44 6 2\n4 8 13 19 23 29 32 33 37 41\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 42 1 3\n1 6 10 15 17 22 24 29 33 38\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 82 2 5\n9 17 27 37 44 51 57 62 67 72\n", "output": "RUN 8\nJUMP 2\nRUN 6\nJUMP 2\nRUN 8\nJUMP 2\nRUN 8\nJUMP 2\nRUN 5\nJUMP 2\nRUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\nJUMP 2\nRUN 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 69 4 9\n7 14 20 26 29 35 40 46 52 58 64\n", "output": "RUN 6\nJUMP 2\nRUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 4\nJUMP 5\nRUN 4\nJUMP 7\nRUN 4\nJUMP 2\nRUN 4\nJUMP 2\nRUN 4\nJUMP 2\nRUN 4\nJUMP 2\nRUN 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 65 1 7\n7 11 14 21 24 30 37 44 50 56 59\n", "output": "RUN 6\nJUMP 2\nRUN 2\nJUMP 2\nRUN 1\nJUMP 2\nRUN 5\nJUMP 2\nRUN 1\nJUMP 2\nRUN 4\nJUMP 2\nRUN 5\nJUMP 2\nRUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 4\nJUMP 2\nRUN 1\nJUMP 2\nRUN 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 77 10 10\n7 14 17 24 29 34 38 47 56 64 69\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 78 3 1\n4 11 19 22 30 38 43 51 56 59 67 73\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 89 14 9\n6 11 18 24 33 37 45 51 60 69 71 80\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 13 6 7\n1 2 3 4 5 6 7 8 9 10 11 12\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 91 1 3\n5 12 17 22 29 36 43 49 57 64 70 74 84\n", "output": "RUN 4\nJUMP 2\nRUN 5\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\nJUMP 2\nRUN 5\nJUMP 2\nRUN 5\nJUMP 2\nRUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 6\nJUMP 2\nRUN 5\nJUMP 2\nRUN 4\nJUMP 2\nRUN 2\nJUMP 2\nRUN 8\nJUMP 2\nRUN 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 87 5 6\n7 10 18 24 31 40 41 48 54 63 69 78 81\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13 46 2 4\n1 4 9 13 15 19 21 23 25 30 35 37 42\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 93 1 1\n8 15 19 21 28 36 44 51 56 63 67 74 79 85\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 62 11 4\n5 10 15 18 22 26 31 34 39 42 44 47 52 57\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 109 10 1\n8 15 25 29 38 48 57 65 70 79 81 89 94 100\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 97 4 4\n3 7 13 23 29 35 39 45 49 50 60 68 72 81 87\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 77 4 8\n7 14 16 20 26 33 36 43 44 48 52 59 61 66 70\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 56 1 5\n5 10 15 20 21 25 29 31 34 37 38 41 43 47 52\n", "output": "RUN 4\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\nJUMP 3\nRUN 2\nJUMP 2\nRUN 2\nJUMP 4\nRUN 1\nJUMP 2\nRUN 1\nJUMP 3\nRUN 1\nJUMP 4\nRUN 2\nJUMP 2\nRUN 3\nJUMP 2\nRUN 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 3\n5 8\n", "output": "RUN 4\nJUMP 2\nRUN 1\nJUMP 2\nRUN 999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 2\n5 8\n", "output": "RUN 4\nJUMP 2\nRUN 1\nJUMP 2\nRUN 999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1 4\n5 8\n", "output": "RUN 4\nJUMP 2\nRUN 1\nJUMP 2\nRUN 999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 2 4\n5 8\n", "output": "IMPOSSIBLE\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 2 5\n5 8\n", "output": "RUN 4\nJUMP 5\nRUN 999999991\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
220
Solve the following coding problem using the programming language python: Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)? -----Input----- The first line of the input contains two integers s and x (2 ≤ s ≤ 10^12, 0 ≤ x ≤ 10^12), the sum and bitwise xor of the pair of positive integers, respectively. -----Output----- Print a single integer, the number of solutions to the given conditions. If no solutions exist, print 0. -----Examples----- Input 9 5 Output 4 Input 3 3 Output 2 Input 5 2 Output 0 -----Note----- In the first sample, we have the following solutions: (2, 7), (3, 6), (6, 3), (7, 2). In the second sample, the only solutions are (1, 2) and (2, 1). The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python s, x = list(map(int, input().split())) rem = int(s == x) * 2 p, t, cur = [], 0, 1 for i in range(64): if x % 2: t += 1 s -= cur else: p.append(cur * 2) cur *= 2 x //= 2 for i in p[::-1]: if s >= i: s -= i ans = 0 if s else 2 ** t - rem print(ans) ```
vfc_10634
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/627/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "9 5\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "549755813887 549755813887\n", "output": "549755813886\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "433864631347 597596794426\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80 12\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "549755813888 549755813886\n", "output": "274877906944\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "643057379466 24429729346\n", "output": "2048\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "735465350041 356516240229\n", "output": "32768\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "608032203317 318063018433\n", "output": "4096\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "185407964720 148793115916\n", "output": "16384\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "322414792152 285840263184\n", "output": "4096\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "547616456703 547599679487\n", "output": "68719476736\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "274861129991 274861129463\n", "output": "34359738368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "549688705887 549688703839\n", "output": "34359738368\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "412182675455 412182609919\n", "output": "68719476736\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "552972910589 546530328573\n", "output": "17179869184\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "274869346299 274869346299\n", "output": "8589934590\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "341374319077 341374319077\n", "output": "134217726\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "232040172650 232040172650\n", "output": "65534\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "322373798090 322373798090\n", "output": "1048574\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18436 18436\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "137707749376 137707749376\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9126813696 9126813696\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "419432708 419432708\n", "output": "62\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1839714 248080\n", "output": "128\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "497110 38\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1420572 139928\n", "output": "64\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "583545 583545\n", "output": "4094\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33411 33411\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66068 66068\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "320 320\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1530587 566563\n", "output": "256\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1988518 108632\n", "output": "128\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "915425594051 155160267299\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "176901202458 21535662096\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "865893190664 224852444148\n", "output": "32768\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "297044970199 121204864\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "241173201018 236676464482\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1582116 139808\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1707011 656387\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "169616 132704\n", "output": "32\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2160101 553812\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1322568 271816\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "228503520839 471917524248\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32576550340 504864993495\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "910648542843 537125462055\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "751720572344 569387893618\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "629791564846 602334362179\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000 1000000000000\n", "output": "8190\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000 999999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000 4096\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2097152 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 390\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22212 39957\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "128 36\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43 18467\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "251059 79687\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 7\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
221
Solve the following coding problem using the programming language python: Long story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: initial and turned over. This time Miroslav laid out $n$ skewers parallel to each other, and enumerated them with consecutive integers from $1$ to $n$ in order from left to right. For better cooking, he puts them quite close to each other, so when he turns skewer number $i$, it leads to turning $k$ closest skewers from each side of the skewer $i$, that is, skewers number $i - k$, $i - k + 1$, ..., $i - 1$, $i + 1$, ..., $i + k - 1$, $i + k$ (if they exist). For example, let $n = 6$ and $k = 1$. When Miroslav turns skewer number $3$, then skewers with numbers $2$, $3$, and $4$ will come up turned over. If after that he turns skewer number $1$, then skewers number $1$, $3$, and $4$ will be turned over, while skewer number $2$ will be in the initial position (because it is turned again). As we said before, the art of cooking requires perfect timing, so Miroslav wants to turn over all $n$ skewers with the minimal possible number of actions. For example, for the above example $n = 6$ and $k = 1$, two turnings are sufficient: he can turn over skewers number $2$ and $5$. Help Miroslav turn over all $n$ skewers. -----Input----- The first line contains two integers $n$ and $k$ ($1 \leq n \leq 1000$, $0 \leq k \leq 1000$) — the number of skewers and the number of skewers from each side that are turned in one step. -----Output----- The first line should contain integer $l$ — the minimum number of actions needed by Miroslav to turn over all $n$ skewers. After than print $l$ integers from $1$ to $n$ denoting the number of the skewer that is to be turned over at the corresponding step. -----Examples----- Input 7 2 Output 2 1 6 Input 5 1 Output 2 1 4 -----Note----- In the first example the first operation turns over skewers $1$, $2$ and $3$, the second operation turns over skewers $4$, $5$, $6$ and $7$. In the second example it is also correct to turn over skewers $2$ and $5$, but turning skewers $2$ and $4$, or $1$ and $5$ are incorrect solutions because the skewer $3$ is in the initial state after these operations. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, k = map(int, input().split()) if n <= k + k + 1: print(1) print((n + 1) // 2) else: answer = -1 answer_n = 10**100 for i in range(min(k + 1, n)): t = n - (k + i + 1) if t % (k + k + 1) >= k + 1: if 2 + t // (k + k + 1) < answer_n: answer = i + 1 answer_n = 2 + t // (k + k + 1) if t % (k + k + 1) == 0: if 1 + t // (k + k + 1) < answer_n: answer = i + 1 answer_n = 1 + t // (k + k + 1) print(answer_n) while answer <= n: print(answer, end = ' ') answer += k + k + 1 ```
vfc_10638
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1040/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "7 2\n", "output": "2\n1 6 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n", "output": "2\n1 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1\n", "output": "4\n1 4 7 10 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n", "output": "1\n10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 10\n", "output": "1\n11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 2\n", "output": "20\n3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 83 88 93 98 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 200\n", "output": "1\n100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000\n", "output": "1\n1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 31\n", "output": "16\n28 91 154 217 280 343 406 469 532 595 658 721 784 847 910 973 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 0\n", "output": "2\n1 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0\n", "output": "3\n1 2 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0\n", "output": "4\n1 2 3 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 0\n", "output": "5\n1 2 3 4 5 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 0\n", "output": "15\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 0\n", "output": "153\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n", "output": "2\n1 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1\n", "output": "2\n1 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 1\n", "output": "5\n2 5 8 11 14 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 1\n", "output": "51\n2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 2\n", "output": "3\n3 8 13 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 2\n", "output": "31\n2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97 102 107 112 117 122 127 132 137 142 147 152 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 3\n", "output": "3\n1 8 15 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 3\n", "output": "22\n3 10 17 24 31 38 45 52 59 66 73 80 87 94 101 108 115 122 129 136 143 150 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n", "output": "1\n5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 4\n", "output": "2\n3 12 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 4\n", "output": "17\n5 14 23 32 41 50 59 68 77 86 95 104 113 122 131 140 149 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 4\n", "output": "112\n1 10 19 28 37 46 55 64 73 82 91 100 109 118 127 136 145 154 163 172 181 190 199 208 217 226 235 244 253 262 271 280 289 298 307 316 325 334 343 352 361 370 379 388 397 406 415 424 433 442 451 460 469 478 487 496 505 514 523 532 541 550 559 568 577 586 595 604 613 622 631 640 649 658 667 676 685 694 703 712 721 730 739 748 757 766 775 784 793 802 811 820 829 838 847 856 865 874 883 892 901 910 919 928 937 946 955 964 973 982 991 1000 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n", "output": "1\n5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 5\n", "output": "2\n2 13 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "153 5\n", "output": "14\n5 16 27 38 49 60 71 82 93 104 115 126 137 148 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 5\n", "output": "91\n5 16 27 38 49 60 71 82 93 104 115 126 137 148 159 170 181 192 203 214 225 236 247 258 269 280 291 302 313 324 335 346 357 368 379 390 401 412 423 434 445 456 467 478 489 500 511 522 533 544 555 566 577 588 599 610 621 632 643 654 665 676 687 698 709 720 731 742 753 764 775 786 797 808 819 830 841 852 863 874 885 896 907 918 929 940 951 962 973 984 995 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 6\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3\n", "output": "2\n1 8 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "39 4\n", "output": "5\n2 11 20 29 38 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 4\n", "output": "3\n1 10 19 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4\n", "output": "1\n5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 0\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11 2\n", "output": "3\n1 6 11 \n", "type": "stdin_stdout" } ] }
apps
verifiable_code
222
Solve the following coding problem using the programming language python: You are given a positive integer $n$, written without leading zeroes (for example, the number 04 is incorrect). In one operation you can delete any digit of the given integer so that the result remains a positive integer without leading zeros. Determine the minimum number of operations that you need to consistently apply to the given integer $n$ to make from it the square of some positive integer or report that it is impossible. An integer $x$ is the square of some positive integer if and only if $x=y^2$ for some positive integer $y$. -----Input----- The first line contains a single integer $n$ ($1 \le n \le 2 \cdot 10^{9}$). The number is given without leading zeroes. -----Output----- If it is impossible to make the square of some positive integer from $n$, print -1. In the other case, print the minimal number of operations required to do it. -----Examples----- Input 8314 Output 2 Input 625 Output 0 Input 333 Output -1 -----Note----- In the first example we should delete from $8314$ the digits $3$ and $4$. After that $8314$ become equals to $81$, which is the square of the integer $9$. In the second example the given $625$ is the square of the integer $25$, so you should not delete anything. In the third example it is impossible to make the square from $333$, so the answer is -1. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python ar=[] for i in range(1,10**5): if(i*i>2*10**9):break ar.append(i*i) s=input() ans=len(s) for x in ar: s2=str(x) i=0 for x in range(len(s)): if i<len(s2) and s[x]==s2[i]: i+=1 if(i==len(s2)): ans=min(ans,len(s)-i) if(ans==len(s)): print(-1) else: print(ans) ```
vfc_10642
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/962/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "8314\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "625\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "333\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1881388645\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1059472069\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1354124829\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "149723943\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "101\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999967841\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000000000\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999431225\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3081\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2003064\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "701\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1234567891\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10625\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13579\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999999\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "150000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8010902\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20100\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40404\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70000729\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1899933124\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999081\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "326700\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000990\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100001\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1410065408\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1409865409\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000050001\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1044435556\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "520993450\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "131073\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500040004\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "237555493\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1120671621\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "298755045\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1476838469\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "654921893\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1538038021\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "716121445\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1894204869\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1800098866\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "890665277\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1686264392\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1336639314\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "132238429\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "927837544\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18403955\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1668778878\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
223
Solve the following coding problem using the programming language python: Let's define a function $f(p)$ on a permutation $p$ as follows. Let $g_i$ be the greatest common divisor (GCD) of elements $p_1$, $p_2$, ..., $p_i$ (in other words, it is the GCD of the prefix of length $i$). Then $f(p)$ is the number of distinct elements among $g_1$, $g_2$, ..., $g_n$. Let $f_{max}(n)$ be the maximum value of $f(p)$ among all permutations $p$ of integers $1$, $2$, ..., $n$. Given an integers $n$, count the number of permutations $p$ of integers $1$, $2$, ..., $n$, such that $f(p)$ is equal to $f_{max}(n)$. Since the answer may be large, print the remainder of its division by $1000\,000\,007 = 10^9 + 7$. -----Input----- The only line contains the integer $n$ ($2 \le n \le 10^6$) — the length of the permutations. -----Output----- The only line should contain your answer modulo $10^9+7$. -----Examples----- Input 2 Output 1 Input 3 Output 4 Input 6 Output 120 -----Note----- Consider the second example: these are the permutations of length $3$: $[1,2,3]$, $f(p)=1$. $[1,3,2]$, $f(p)=1$. $[2,1,3]$, $f(p)=2$. $[2,3,1]$, $f(p)=2$. $[3,1,2]$, $f(p)=2$. $[3,2,1]$, $f(p)=2$. The maximum value $f_{max}(3) = 2$, and there are $4$ permutations $p$ such that $f(p)=2$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python p=10**9+7 import math def inv(k,p): prod=1 while k>1: prod*=(p//k+1) k=(k*(p//k+1))%p return prod%p n=int(input()) a=[] k=int(math.log2(n)) x=n while x>0: y=x//2 a.append(x-y) x=y c=[sum(a[i:]) for i in range(k+1)] b=[n//(3*2**i)-n//(6*2**i) for i in range(k+1)] d=[n//2**i-n//(3*2**i) for i in range(k+1)] facs=[1]*(n+1) for i in range(2,n+1): facs[i]=(i*facs[i-1])%p if n<3*(2**(k-1)): start=k else: start=0 tot=0 for j in range(start,k+1): prod=1 for i in range(j,k): prod*=b[i] prod*=d[j] for i in range(j): prod*=a[i] prod%=p prod*=facs[n] e=[a[i] for i in range(j)]+[d[j]]+[b[i] for i in range(j,k)] f=[sum(e[:i+1]) for i in range(k+1)] g=1 for guy in f: g*=guy prod*=inv(g,p) prod%=p tot+=prod print(tot%p) ```
vfc_10646
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1174/E", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "120", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n", "output": "15120", "type": "stdin_stdout" }, { "fn_name": null, "input": "64\n", "output": "676169815", "type": "stdin_stdout" }, { "fn_name": null, "input": "1227\n", "output": "9412302", "type": "stdin_stdout" }, { "fn_name": null, "input": "49152\n", "output": "468540828", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000\n", "output": "943169120", "type": "stdin_stdout" }, { "fn_name": null, "input": "524288\n", "output": "948408574", "type": "stdin_stdout" }, { "fn_name": null, "input": "786431\n", "output": "973886300", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999\n", "output": "88378773", "type": "stdin_stdout" }, { "fn_name": null, "input": "217292\n", "output": "936105571", "type": "stdin_stdout" }, { "fn_name": null, "input": "16339\n", "output": "166382218", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "6", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "600", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n", "output": "240", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n", "output": "1440", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n", "output": "938830187", "type": "stdin_stdout" }, { "fn_name": null, "input": "87\n", "output": "247668980", "type": "stdin_stdout" }, { "fn_name": null, "input": "71\n", "output": "744016814", "type": "stdin_stdout" }, { "fn_name": null, "input": "73\n", "output": "405863164", "type": "stdin_stdout" }, { "fn_name": null, "input": "89\n", "output": "222320695", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n", "output": "193507326", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n", "output": "270627256", "type": "stdin_stdout" }, { "fn_name": null, "input": "847\n", "output": "206774372", "type": "stdin_stdout" }, { "fn_name": null, "input": "676\n", "output": "491267527", "type": "stdin_stdout" }, { "fn_name": null, "input": "639\n", "output": "32577133", "type": "stdin_stdout" }, { "fn_name": null, "input": "957\n", "output": "885557037", "type": "stdin_stdout" }, { "fn_name": null, "input": "156\n", "output": "980176938", "type": "stdin_stdout" }, { "fn_name": null, "input": "479\n", "output": "784626857", "type": "stdin_stdout" }, { "fn_name": null, "input": "586\n", "output": "77973950", "type": "stdin_stdout" }, { "fn_name": null, "input": "683\n", "output": "951224867", "type": "stdin_stdout" }, { "fn_name": null, "input": "3541\n", "output": "358246424", "type": "stdin_stdout" }, { "fn_name": null, "input": "6264\n", "output": "136451422", "type": "stdin_stdout" }, { "fn_name": null, "input": "4140\n", "output": "371936240", "type": "stdin_stdout" }, { "fn_name": null, "input": "8969\n", "output": "651607899", "type": "stdin_stdout" }, { "fn_name": null, "input": "3080\n", "output": "806160386", "type": "stdin_stdout" }, { "fn_name": null, "input": "7127\n", "output": "515942917", "type": "stdin_stdout" }, { "fn_name": null, "input": "3116\n", "output": "390594722", "type": "stdin_stdout" }, { "fn_name": null, "input": "86214\n", "output": "17417160", "type": "stdin_stdout" }, { "fn_name": null, "input": "28211\n", "output": "5179894", "type": "stdin_stdout" }, { "fn_name": null, "input": "62544\n", "output": "554785078", "type": "stdin_stdout" }, { "fn_name": null, "input": "96262\n", "output": "882337958", "type": "stdin_stdout" }, { "fn_name": null, "input": "21504\n", "output": "299254647", "type": "stdin_stdout" }, { "fn_name": null, "input": "603070\n", "output": "15758000", "type": "stdin_stdout" }, { "fn_name": null, "input": "261873\n", "output": "965169285", "type": "stdin_stdout" }, { "fn_name": null, "input": "582911\n", "output": "825030283", "type": "stdin_stdout" }, { "fn_name": null, "input": "789700\n", "output": "501403228", "type": "stdin_stdout" }, { "fn_name": null, "input": "838757\n", "output": "220750034", "type": "stdin_stdout" }, { "fn_name": null, "input": "546330\n", "output": "784174655", "type": "stdin_stdout" }, { "fn_name": null, "input": "774942\n", "output": "979976656", "type": "stdin_stdout" }, { "fn_name": null, "input": "629462\n", "output": "20530480", "type": "stdin_stdout" }, { "fn_name": null, "input": "131156\n", "output": "751299482", "type": "stdin_stdout" }, { "fn_name": null, "input": "874465\n", "output": "417880003", "type": "stdin_stdout" }, { "fn_name": null, "input": "200945\n", "output": "712409910", "type": "stdin_stdout" }, { "fn_name": null, "input": "919645\n", "output": "465123203", "type": "stdin_stdout" }, { "fn_name": null, "input": "215283\n", "output": "197619154", "type": "stdin_stdout" }, { "fn_name": null, "input": "955654\n", "output": "416395816", "type": "stdin_stdout" }, { "fn_name": null, "input": "437675\n", "output": "305205122", "type": "stdin_stdout" }, { "fn_name": null, "input": "175863\n", "output": "442215433", "type": "stdin_stdout" }, { "fn_name": null, "input": "126395\n", "output": "374976337", "type": "stdin_stdout" }, { "fn_name": null, "input": "406138\n", "output": "648609649", "type": "stdin_stdout" }, { "fn_name": null, "input": "425221\n", "output": "973943578", "type": "stdin_stdout" }, { "fn_name": null, "input": "460829\n", "output": "66014534", "type": "stdin_stdout" }, { "fn_name": null, "input": "211425\n", "output": "501705216", "type": "stdin_stdout" }, { "fn_name": null, "input": "662327\n", "output": "118190038", "type": "stdin_stdout" }, { "fn_name": null, "input": "798412\n", "output": "47586814", "type": "stdin_stdout" }, { "fn_name": null, "input": "163259\n", "output": "581955590", "type": "stdin_stdout" }, { "fn_name": null, "input": "786432\n", "output": "755978297", "type": "stdin_stdout" } ] }
apps
verifiable_code
224
Solve the following coding problem using the programming language python: One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump. Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability. [Image] The picture corresponds to the first example. The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'. -----Input----- The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100. -----Output----- Print single integer a — the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels. -----Examples----- Input ABABBBACFEYUKOTT Output 4 Input AAA Output 1 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python # You lost the game. s = str(input()) n = len(s) d = -1 r = 0 V = "AEIOUY" for i in range(n): if V.count(s[i]): r = max(r,i-d) d = i print(max(r, n-d)) ```
vfc_10650
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/733/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "ABABBBACFEYUKOTT\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "AAA\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "A\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "B\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "AEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOIKLMJNHGTRWSDZXCVBNMHGFDSXVWRTPPPLKMNBXIUOIUOIUOIUOOIU\n", "output": "39", "type": "stdin_stdout" }, { "fn_name": null, "input": "AEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOIAEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOI\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "KMLPTGFHNBVCDRFGHNMBVXWSQFDCVBNHTJKLPMNFVCKMLPTGFHNBVCDRFGHNMBVXWSQFDCVBNHTJKLPMNFVC\n", "output": "85", "type": "stdin_stdout" }, { "fn_name": null, "input": "QWERTYUIOPASDFGHJKLZXCVBNMQWERTYUIOPASDFGHJKLZXCVBNMQWERTYUIOPASDFGHJKLZXCVBNMQWERTYUIOPASDFGHJKLZ\n", "output": "18", "type": "stdin_stdout" }, { "fn_name": null, "input": "PKLKBWTXVJ\n", "output": "11", "type": "stdin_stdout" }, { "fn_name": null, "input": "CFHFPTGMOKXVLJJZJDQW\n", "output": "12", "type": "stdin_stdout" }, { "fn_name": null, "input": "TXULTFSBUBFLRNQORMMULWNVLPWTYJXZBPBGAWNX\n", "output": "9", "type": "stdin_stdout" }, { "fn_name": null, "input": "DAIUSEAUEUYUWEIOOEIOUYVYYOPEEWEBZOOOAOXUOIEUKYYOJOYAUYUUIYUXOUJLGIYEIIYUOCUAACRY\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101", "type": "stdin_stdout" }, { "fn_name": null, "input": "SGDDFCDRDWGPNNFBBZZJSPXFYMZKPRXTCHVJSJJBWZXXQMDZBNKDHRGSRLGLRKPMWXNSXJPNJLDPXBSRCQMHJKPZNTPNTZXNPCJC\n", "output": "76", "type": "stdin_stdout" }, { "fn_name": null, "input": "NVTQVNLGWFDBCBKSDLTBGWBMNQZWZQJWNGVCTCQBGWNTYJRDBPZJHXCXFMIXNRGSTXHQPCHNFQPCMDZWJGLJZWMRRFCVLBKDTDSC\n", "output": "45", "type": "stdin_stdout" }, { "fn_name": null, "input": "SREZXQFVPQCLRCQGMKXCBRWKYZKWKRMZGXPMKWNMFZTRDPHJFCSXVPPXWKZMZTBFXGNLPLHZIPLFXNRRQFDTLFPKBGCXKTMCFKKT\n", "output": "48", "type": "stdin_stdout" }, { "fn_name": null, "input": "ICKJKMVPDNZPLKDSLTPZNRLSQSGHQJQQPJJSNHNWVDLJRLZEJSXZDPHYXGGWXHLCTVQSKWNWGTLJMOZVJNZPVXGVPJKHFVZTGCCX\n", "output": "47", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXFPZDRPXLNHGDVCBDKJMKLGUQZXLLWYLOKFZVGXVNPJWZZZNRMQBRJCZTSDRHSNCVDMHKVXCXPCRBWSJCJWDRDPVZZLCZRTDRYA\n", "output": "65", "type": "stdin_stdout" }, { "fn_name": null, "input": "HDDRZDKCHHHEDKHZMXQSNQGSGNNSCCPVJFGXGNCEKJMRKSGKAPQWPCWXXWHLSMRGSJWEHWQCSJJSGLQJXGVTBYALWMLKTTJMFPFS\n", "output": "28", "type": "stdin_stdout" }, { "fn_name": null, "input": "PXVKJHXVDPWGLHWFWMJPMCCNHCKSHCPZXGIHHNMYNFQBUCKJJTXXJGKRNVRTQFDFMLLGPQKFOVNNLTNDIEXSARRJKGSCZKGGJCBW\n", "output": "35", "type": "stdin_stdout" }, { "fn_name": null, "input": "EXNMTTFPJLDHXDQBJJRDRYBZVFFHUDCHCPNFZWXSMZXNFVJGHZWXVBRQFNUIDVLZOVPXQNVMFNBTJDSCKRLNGXPSADTGCAHCBJKL\n", "output": "30", "type": "stdin_stdout" }, { "fn_name": null, "input": "NRNLSQQJGIJBCZFTNKJCXMGPARGWXPSHZXOBNSFOLDQVXTVAGJZNLXULHBRDGMNQKQGWMRRDPYCSNFVPUFTFBUBRXVJGNGSPJKLL\n", "output": "19", "type": "stdin_stdout" }, { "fn_name": null, "input": "SRHOKCHQQMVZKTCVQXJJCFGYFXGMBZSZFNAFETXILZHPGHBWZRZQFMGSEYRUDVMCIQTXTBTSGFTHRRNGNTHHWWHCTDFHSVARMCMB\n", "output": "30", "type": "stdin_stdout" }, { "fn_name": null, "input": "HBSVZHDKGNIRQUBYKYHUPJCEETGFMVBZJTHYHFQPFBVBSMQACYAVWZXSBGNKWXFNMQJFMSCHJVWBZXZGSNBRUHTHAJKVLEXFBOFB\n", "output": "34", "type": "stdin_stdout" }, { "fn_name": null, "input": "NXKMUGOPTUQNSRYTKUKSCWCRQSZKKFPYUMDIBJAHJCEKZJVWZAWOLOEFBFXLQDDPNNZKCQHUPBFVDSXSUCVLMZXQROYQYIKPQPWR\n", "output": "17", "type": "stdin_stdout" }, { "fn_name": null, "input": "TEHJDICFNOLQVQOAREVAGUAWODOCXJXIHYXFAEPEXRHPKEIIRCRIVASKNTVYUYDMUQKSTSSBYCDVZKDDHTSDWJWACPCLYYOXGCLT\n", "output": "15", "type": "stdin_stdout" }, { "fn_name": null, "input": "LCJJUZZFEIUTMSEXEYNOOAIZMORQDOANAMUCYTFRARDCYHOYOPHGGYUNOGNXUAOYSEMXAZOOOFAVHQUBRNGORSPNQWZJYQQUNPEB\n", "output": "9", "type": "stdin_stdout" }, { "fn_name": null, "input": "UUOKAOOJBXUTSMOLOOOOSUYYFTAVBNUXYFVOOGCGZYQEOYISIYOUULUAIJUYVVOENJDOCLHOSOHIHDEJOIGZNIXEMEGZACHUAQFW\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "OUUBEHXOOURMOAIAEHXCUOIYHUJEVAWYRCIIAGDRIPUIPAIUYAIWJEVYEYYUYBYOGVYESUJCFOJNUAHIOOKBUUHEJFEWPOEOUHYA\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "EMNOYEEUIOUHEWZITIAEZNCJUOUAOQEAUYEIHYUSUYUUUIAEDIOOERAEIRBOJIEVOMECOGAIAIUIYYUWYIHIOWVIJEYUEAFYULSE\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "BVOYEAYOIEYOREJUYEUOEOYIISYAEOUYAAOIOEOYOOOIEFUAEAAESUOOIIEUAAGAEISIAPYAHOOEYUJHUECGOYEIDAIRTBHOYOYA\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "GOIEOAYIEYYOOEOAIAEOOUWYEIOTNYAANAYOOXEEOEAVIOIAAIEOIAUIAIAAUEUAOIAEUOUUZYIYAIEUEGOOOOUEIYAEOSYAEYIO\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "AUEAOAYIAOYYIUIOAULIOEUEYAIEYYIUOEOEIEYRIYAYEYAEIIMMAAEAYAAAAEOUICAUAYOUIAOUIAIUOYEOEEYAEYEYAAEAOYIY\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "OAIIYEYYAOOEIUOEEIOUOIAEFIOAYETUYIOAAAEYYOYEYOEAUIIUEYAYYIIAOIEEYGYIEAAOOWYAIEYYYIAOUUOAIAYAYYOEUEOY\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "EEEAOEOEEIOUUUEUEAAOEOIUYJEYAIYIEIYYEAUOIIYIUOOEUCYEOOOYYYIUUAYIAOEUEIEAOUOIAACAOOUAUIYYEAAAOOUYIAAE\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "AYEYIIEUIYOYAYEUEIIIEUYUUAUEUIYAIAAUYONIEYIUIAEUUOUOYYOUUUIUIAEYEOUIIUOUUEOAIUUYAAEOAAEOYUUIYAYRAIII\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "YOOAAUUAAAYEUYIUIUYIUOUAEIEEIAUEOAUIIAAIUYEUUOYUIYEAYAAAYUEEOEEAEOEEYYOUAEUYEEAIIYEUEYJOIIYUIOIUOIEE\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "UYOIIIAYOOAIUUOOEEUYIOUAEOOEIOUIAIEYOAEAIOOEOOOIUYYUYIAAUIOUYYOOUAUIEYYUOAAUUEAAIEUIAUEUUIAUUOYOAYIU\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABBABBB\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABCD\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "XXYC\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABABBBBBBB\n", "output": "8", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYYYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "AXXX\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYYYYYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "BYYBBB\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYYYYYYYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "CAAAAA\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "CCCACCCC\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABABBBACFEYUKOTTTT\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "AABBYYYYYYYY\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "BYBACYC\n", "output": "2", "type": "stdin_stdout" }, { "fn_name": null, "input": "Y\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABBBBBB\n", "output": "7", "type": "stdin_stdout" }, { "fn_name": null, "input": "BACDYDI\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "XEXXXXXXXXXXXXXXX\n", "output": "16", "type": "stdin_stdout" }, { "fn_name": null, "input": "TTYTT\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "AAYBC\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABABBBACFEYUKOTTTTT\n", "output": "6", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYAYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "YZZY\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "YY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "ZZYZZ\n", "output": "3", "type": "stdin_stdout" }, { "fn_name": null, "input": "YBBBY\n", "output": "4", "type": "stdin_stdout" }, { "fn_name": null, "input": "BBBACCCCCCC\n", "output": "8", "type": "stdin_stdout" }, { "fn_name": null, "input": "YBBBBY\n", "output": "5", "type": "stdin_stdout" }, { "fn_name": null, "input": "YYYYYYYYYY\n", "output": "1", "type": "stdin_stdout" }, { "fn_name": null, "input": "ABABBBBBBBBBBBB\n", "output": "13", "type": "stdin_stdout" } ] }
apps
verifiable_code
225
Solve the following coding problem using the programming language python: Dawid has four bags of candies. The $i$-th of them contains $a_i$ candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same amount of candies in total? Note, that you can't keep bags for yourself or throw them away, each bag should be given to one of the friends. -----Input----- The only line contains four integers $a_1$, $a_2$, $a_3$ and $a_4$ ($1 \leq a_i \leq 100$) — the numbers of candies in each bag. -----Output----- Output YES if it's possible to give the bags to Dawid's friends so that both friends receive the same amount of candies, or NO otherwise. Each character can be printed in any case (either uppercase or lowercase). -----Examples----- Input 1 7 11 5 Output YES Input 7 3 2 5 Output NO -----Note----- In the first sample test, Dawid can give the first and the third bag to the first friend, and the second and the fourth bag to the second friend. This way, each friend will receive $12$ candies. In the second sample test, it's impossible to distribute the bags. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python l=list(map(int,input().split())) for i in range(16): cur1,cur2=0,0 for j in range(4): if (i&(1<<j))==0: cur1+=l[j] else: cur2+=l[j] if cur1==cur2: print("YES") quit() print("NO") ```
vfc_10654
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1230/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 7 11 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3 2 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 14 36 53\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 74 41 63\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 69 83 97\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26 52 7 19\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 52 62 62\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 100 10 86\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 10 18 24\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 14 37 71\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 11 84 39\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76 97 99 74\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 58 90 53\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 88 18 18\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48 14 3 31\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "72 96 2 26\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 7 44 30\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66 68 16 82\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 100 100\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 98 99 97\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 100 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 99 100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 100 3 98\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3 6 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 9 10 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 6 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 4 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 4 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 8 6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 95 91 27\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 8 9\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10 1 6\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5 1 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 14 12\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 6 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2 3 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 10 7\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 5 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 10 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 4 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 10 20\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 3 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 17 17 20\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90 30 30 30\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 6 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 3 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 4 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 28 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 4 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 6 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 2 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 7 1 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 12 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 2 7\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
226
Solve the following coding problem using the programming language python: You may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob have many slices of pie, and rather than cutting the slices in half, each individual slice will be eaten by just one person. The way Alice and Bob decide who eats each slice is as follows. First, the order in which the pies are to be handed out is decided. There is a special token called the "decider" token, initially held by Bob. Until all the pie is handed out, whoever has the decider token will give the next slice of pie to one of the participants, and the decider token to the other participant. They continue until no slices of pie are left. All of the slices are of excellent quality, so each participant obviously wants to maximize the total amount of pie they get to eat. Assuming both players make their decisions optimally, how much pie will each participant receive? -----Input----- Input will begin with an integer N (1 ≤ N ≤ 50), the number of slices of pie. Following this is a line with N integers indicating the sizes of the slices (each between 1 and 100000, inclusive), in the order in which they must be handed out. -----Output----- Print two integers. First, the sum of the sizes of slices eaten by Alice, then the sum of the sizes of the slices eaten by Bob, assuming both players make their decisions optimally. -----Examples----- Input 3 141 592 653 Output 653 733 Input 5 10 21 10 21 10 Output 31 41 -----Note----- In the first example, Bob takes the size 141 slice for himself and gives the decider token to Alice. Then Alice gives the size 592 slice to Bob and keeps the decider token for herself, so that she can then give the size 653 slice to herself. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) a = list(map(int, input().split())) a = a[::-1] d = 0 for i in range(len(a)): d = max(0 + d, a[i] + (sum(a[:i]) - d)) print(sum(a)-d, d) ```
vfc_10658
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/859/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n141 592 653\n", "output": "653 733\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n10 21 10 21 10\n", "output": "31 41\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n100000\n", "output": "0 100000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000\n", "output": "2500000 2500000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 100000\n", "output": "1 100000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536\n", "output": "65535 65536\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n3026 3027 4599 4854 7086 29504 38709 40467 40663 58674 61008 70794 77517 85547 87320\n", "output": "306375 306420\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n2351 14876 66138 87327 29940 73204 19925 50198 13441 54751 1383 92120 90236 13525 3920 16669 80637 94428 54890 71321 77670 57080 82145 39778 69967 38722 46902 82127 1142 21792\n", "output": "724302 724303\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n59139\n", "output": "0 59139\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n9859 48096\n", "output": "9859 48096\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n25987 64237 88891\n", "output": "88891 90224\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n9411 13081 2149 19907\n", "output": "19907 24641\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n25539 29221 6895 82089 18673\n", "output": "80328 82089\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n76259 10770 87448 3054 67926 81667\n", "output": "158428 168696\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n92387 35422 24898 32532 92988 84636 99872\n", "output": "192724 270011\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n8515 51563 5451 94713 9537 30709 63343 41819\n", "output": "138409 167241\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n91939 407 10197 24191 58791 9486 68030 25807 11\n", "output": "102429 186430\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "252317 291210\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n46646 21171 78816 89449 99375 50934 15950 90299 18702 62232 12657\n", "output": "288850 297381\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n30070 37311 92074 18927 91732 29711 12126 41583 52857 99118 73097 33928\n", "output": "296580 315954\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n13494 86155 96820 72596 40986 99976 16813 25571 87013 3301 832 26376 83769\n", "output": "325890 327812\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n96918 67704 10077 34778 90239 11457 80284 42263 53872 74779 93976 53416 83860 74518\n", "output": "414474 453667\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n13046 83844 14823 64255 15301 90234 84972 93547 88028 11665 54415 13159 83950 951 42336\n", "output": "362168 392358\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n29174 32688 95377 26437 64554 60498 56955 10239 22183 15847 47559 40199 92552 70488 4147 73082\n", "output": "370791 371188\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n79894 24637 8634 80107 81104 39275 53130 94227 56339 87326 7999 75751 92642 96921 74470 20999 69688\n", "output": "492038 551105\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n96022 73481 13380 42288 6166 85348 25113 78215 23198 24212 44246 35494 92733 66459 44793 68916 82818 3967\n", "output": "436157 470692\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19\n79446 55030 93934 39062 88123 88317 21289 62203 57354 28394 37390 95238 92823 92892 39308 16833 54733 51525 58759\n", "output": "538648 614005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n5440 88704 61481 72140 15810 58854 43034 5150 80684 61360 50516 54301 78790 43678 46138 79893 89899 60260 2881 66499\n", "output": "506639 558873\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n21569 37548 74739 25809 65063 37631 71913 89138 47543 65542 10956 14045 78880 70111 73357 27810 70326 40523 899 6547 87440\n", "output": "506467 510922\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n72289 86393 79484 55287 14317 83704 11192 73126 81699 2429 4100 41085 87482 72352 10976 75727 42240 79569 31621 3492 51189 25936\n", "output": "513496 572193\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n88417 11045 92742 84765 6675 86673 40072 57114 15854 6611 40347 76636 87572 66082 38195 56348 89962 59831 29640 43541 14937 73713 52755\n", "output": "602650 616877\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n71841 27185 73295 46946 55928 65450 12055 73806 82714 78089 787 36380 87663 68323 75814 4265 94581 31581 51850 40486 11390 21491 27560 22678\n", "output": "560664 601494\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25\n87969 76030 78041 616 13694 11522 84038 25090 16869 14975 61226 96124 20457 62052 70329 76374 42303 11844 15276 37430 99330 77781 35069 64358 45168\n", "output": "586407 637558\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\n71393 24874 91299 30093 62947 14491 80214 41782 51025 19158 21666 23163 20547 64293 40653 24291 46922 92106 13294 77479 63079 25559 42579 62933 24433 39507\n", "output": "569885 599895\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27\n54817 73719 96044 92275 12201 60564 84901 25770 17884 90636 14810 82907 20637 58023 10976 72208 94644 63856 11312 74424 26828 40632 58600 37316 38290 82420 48297\n", "output": "716531 728460\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n70945 22563 76598 21753 4558 39341 48372 77054 52039 27522 75249 18459 96536 60264 5491 20125 42367 44118 42034 38665 47472 88410 66109 78995 52147 68436 9814 71112\n", "output": "669482 697066\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "29\n54369 14511 14048 83934 53812 75014 20356 17938 86195 31704 68393 78202 96626 86697 75814 746 46985 15868 40052 11417 11221 44700 40915 53378 98708 78644 4035 20164 37165\n", "output": "678299 683312\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n4555 13594 57403 75796 14203 12847 66292 60885 9525 40478 57327 69970 15297 37483 39540 31102 14855 412 84174 57684 65591 19837 80431 18385 3107 87740 15433 24854 73472 88205\n", "output": "620095 620382\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31\n20683 29734 37957 37978 63456 58920 70980 44873 76385 44661 17767 97009 15387 63916 77159 79019 86770 4866 14897 63141 86236 67614 87940 60064 16964 97948 9654 49714 30888 88075 63792\n", "output": "825663 838784\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32\n71403 78578 75406 67455 12710 37697 67155 28861 10540 48843 10911 56753 15477 33453 4378 26936 34492 19720 12915 27382 49984 91200 95449 34448 63525 83964 3875 98767 77905 63753 83018 58084\n", "output": "770578 774459\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33\n87531 27423 55960 53829 37771 40665 39138 12849 77399 53025 71350 83793 48271 59887 41997 74854 14919 24175 43637 24327 13733 38978 2959 319 10086 26876 65393 56332 68025 63623 93732 68354 83938\n", "output": "741185 823963\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34\n70955 19371 60706 50603 54321 86738 11122 29541 11555 57207 31790 19344 24170 29424 36512 22771 86833 4437 41655 64376 34378 19459 86276 74702 23943 69789 59614 48489 49634 63494 12958 11328 69333 1736\n", "output": "693927 744637\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\n54379 920 41259 12784 3574 98219 40001 80825 45710 61390 24933 79088 24260 23153 6835 94880 67260 76187 39673 28616 98126 10341 26489 49085 37800 55805 86539 97542 39754 30660 32184 64703 11625 77872 63584\n", "output": "823487 862568\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "36\n37803 17060 78709 42262 28636 68484 79280 97517 12570 98276 52669 6128 57054 58098 68646 75501 39174 56449 3099 1369 94579 58119 1295 90764 51657 66013 48056 55107 54066 30530 75602 74973 21212 21304 22589 4895\n", "output": "872694 876851\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "37\n53932 65904 91967 4443 77890 47261 8160 81505 46725 69754 21621 65871 24440 51828 71673 23418 86896 4008 1117 65610 82519 5897 8804 65148 98218 76221 42277 79968 68379 30401 62125 61052 96207 64737 24698 99495 70720\n", "output": "989044 1011845\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "38\n70060 14749 72520 58113 2951 26037 80143 32789 80881 73936 82060 92911 24531 78261 9292 71335 91515 8462 31839 62555 46268 29482 92121 31019 12075 94942 36498 96317 58499 30271 81351 71322 81602 8169 26807 69903 38154 20539\n", "output": "977736 1012543\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "39\n20780 30889 9970 87591 19501 96302 76318 49481 47740 10823 42500 61167 57325 47798 36511 19252 39237 23316 29857 2603 10016 9964 99630 5402 82828 5150 98015 53882 72811 97437 57473 57400 91189 84305 85811 64503 40179 50614 52044\n", "output": "954593 973021\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n3670 5779 20621 87964 12595 34136 98063 92429 38366 43789 88330 52934 19100 22776 43342 82312 74404 64756 73980 14278 21283 85101 63339 70409 63034 14245 33606 58571 84927 14931 25355 15452 46072 4671 5838 69121 18243 87783 29748 84047\n", "output": "909877 959523\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41\n87094 21920 58071 41634 29145 45616 94239 76417 5226 47971 48770 79974 19190 25017 37857 30229 11726 12314 71998 54327 85032 8687 46656 12088 9595 24454 27827 7624 66535 14801 44581 25723 55659 48103 75242 39529 52973 17858 16985 41454 44182\n", "output": "799467 864856\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n70518 70764 38625 3816 78399 48585 66222 60405 72085 52153 85018 39717 51984 51451 8180 78146 59448 16768 2720 51272 48780 56464 21461 86471 23452 10470 22048 65189 56655 90480 31103 11801 73758 91536 10055 34129 20407 47933 4223 98861 84475 52291\n", "output": "1012190 1036128\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43\n86646 19609 43370 33293 3460 94658 95101 44393 6241 56335 78161 66757 52074 53692 2695 58767 31363 64326 738 15513 69425 4242 28971 60855 37309 53382 16269 57346 70968 90350 74522 22072 83345 67672 69060 4537 55137 78008 91461 32075 33280 70405 71607\n", "output": "1039942 1109548\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n70070 68453 23924 95475 52714 73435 34380 61085 40396 60518 38601 26501 52165 47421 73018 6684 79085 68781 31460 88265 33173 52020 44992 2534 8062 96295 77786 39103 85280 24812 93748 75446 92932 11105 71169 66433 89866 75379 11402 22186 73572 31624 70092 10734\n", "output": "1141992 1210184\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45\n53494 93105 37182 24953 1967 43700 39068 12369 7256 64700 31744 62052 84959 49662 34829 78793 51000 16339 29478 52506 96922 75606 52501 1109 21919 6503 72007 63964 75400 24682 45678 18420 67928 87241 73278 69545 24596 29646 65936 55401 89673 49738 35873 45189 3622\n", "output": "1052557 1068976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n36918 9246 74631 78622 94325 22476 35243 96357 41411 68882 92184 21796 28153 43392 37856 26710 64130 20793 60200 16747 84862 23383 60010 42788 68480 92519 66229 56121 57009 24553 89096 4499 53323 30673 75386 31442 92030 59721 53173 45511 29966 67853 77462 12347 61811 81517\n", "output": "1199490 1212346\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "47\n53046 58090 55185 8100 43578 1253 7226 13049 75567 73065 19920 48836 28243 45633 75475 74628 11853 68351 90922 89500 81315 71161 34816 49875 82337 2727 27746 37878 79833 24423 75618 82065 95614 82618 34391 1850 94056 57092 73115 70214 46067 29071 75947 46802 95807 42600 11211\n", "output": "1214201 1233568\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n69174 6934 59931 70281 68640 47326 3402 64333 42426 77247 13063 8579 61038 39362 2694 22545 83767 15909 88940 86445 45063 27451 18133 91555 28898 45640 21967 62738 61441 24293 19036 68144 5201 26050 69204 29154 85681 19871 60352 36133 86359 47186 74432 5448 53996 27876 58022 80559\n", "output": "1096672 1115247\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49\n19894 55779 73188 99759 17893 50295 8089 81025 76582 81429 73503 35619 61128 41603 40313 3166 31490 87660 19662 59197 8812 75229 25642 65938 42755 31656 16188 87599 51562 91460 38262 11118 90596 69482 71313 66858 87707 17242 14886 93539 35164 32596 83317 72606 12185 21664 80642 72099 7525\n", "output": "1233007 1259909\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n70081 97965 40736 24325 2476 20832 54026 23972 91400 47099 95141 27386 79799 49285 4039 818 23552 72203 55273 38168 52783 50365 89351 30945 47154 8047 27586 49184 20573 8953 38849 36466 45479 89848 82827 71475 74283 87115 92590 28903 97800 74550 74140 82514 10849 6786 67881 63456 53022 25051\n", "output": "1251581 1255820\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n10 3 2 1\n", "output": "4 12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5245 1414 21632 12159 31783 7412\n", "output": "38442 41203\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n1666 17339 9205 20040 30266 12751 11329 7951 9000 14465 11771 7600 19480 15993 19453 7470 1361 7922 27747 17347 4727 11280 403 16338 6064 11124 25723 18717 26118 271 9242 16952 26381 31795 28226 3646 27589 31472 30108 28354 25281 22429 30956 32264 14729 21685\n", "output": "379808 392222\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n100 90 80\n", "output": "90 180\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n10 9 8 7 6\n", "output": "16 24\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n100 40 50 10\n", "output": "50 150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 4 3 2 1 1\n", "output": "7 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "33\n30274 12228 26670 31244 5457 2643 27275 4380 30954 23407 8387 6669 25229 31591 27518 30261 25670 20962 31316 8992 8324 26216 10812 28467 15401 23077 10311 24975 14046 12010 11406 22841 7593\n", "output": "299163 327443\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 2 1\n", "output": "2 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n10 5 5\n", "output": "5 15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n6 5 4 3 2 1\n", "output": "9 12\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n5 2 7 3\n", "output": "7 10\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
227
Solve the following coding problem using the programming language python: You've got a positive integer sequence a_1, a_2, ..., a_{n}. All numbers in the sequence are distinct. Let's fix the set of variables b_1, b_2, ..., b_{m}. Initially each variable b_{i} (1 ≤ i ≤ m) contains the value of zero. Consider the following sequence, consisting of n operations. The first operation is assigning the value of a_1 to some variable b_{x} (1 ≤ x ≤ m). Each of the following n - 1 operations is assigning to some variable b_{y} the value that is equal to the sum of values that are stored in the variables b_{i} and b_{j} (1 ≤ i, j, y ≤ m). At that, the value that is assigned on the t-th operation, must equal a_{t}. For each operation numbers y, i, j are chosen anew. Your task is to find the minimum number of variables m, such that those variables can help you perform the described sequence of operations. -----Input----- The first line contains integer n (1 ≤ n ≤ 23). The second line contains n space-separated integers a_1, a_2, ..., a_{n} (1 ≤ a_{k} ≤ 10^9). It is guaranteed that all numbers in the sequence are distinct. -----Output----- In a single line print a single number — the minimum number of variables m, such that those variables can help you perform the described sequence of operations. If you cannot perform the sequence of operations at any m, print -1. -----Examples----- Input 5 1 2 3 6 8 Output 2 Input 3 3 6 5 Output -1 Input 6 2 4 8 6 10 18 Output 3 -----Note----- In the first sample, you can use two variables b_1 and b_2 to perform the following sequence of operations. b_1 := 1; b_2 := b_1 + b_1; b_1 := b_1 + b_2; b_1 := b_1 + b_1; b_1 := b_1 + b_2. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def Solve(x,B): if((X,x,B) in Mem): return Mem[(X,x,B)] if(len(B)>X): return False if(x==len(L)): return True if(Form(L[x],B)): A=list(B) for e in range(len(B)): r=A[e] A[e]=L[x] if(Solve(x+1,tuple(sorted(A)))): Mem[(X,x,B)]=True return True A[e]=r A+=[L[x]] if(Solve(x+1,tuple(sorted(A)))): Mem[(X,x,B)]=True return True Mem[(X,x,B)]=False return False def Form(x,B): for i in range(len(B)): for j in range(i,len(B)): if(B[i]+B[j]==x): return True return False n=int(input()) L=list(map(int,input().split())) done=False Mem={} for X in range(1,n+1): if(Solve(1,(L[0],))): print(X) done=True break if(not done): print(-1) ```
vfc_10662
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/279/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\n1 2 3 6 8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 6 5\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 4 8 6 10 18\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 2 4 5 3 6 7\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n11 22 44 88 132 264 66 33 165 55\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n201 402 804 603 1608 2010 1206 2412 4824 2211\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n92 184 368 276 552 1104 1196 736 1472 1288 1012 2576 5152 1840 3680 1656\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n8478 16956 33912 25434 50868 42390 101736 203472 84780 59346 127170 245862 135648 491724 279774 559548 186516 152604\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n45747 91494 182988 228735 365976 137241 274482 548964 640458 457470 594711 731952 686205 777699 1372410 914940 1463904 1235169 1555398 320229 1326663 1829880\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n345802 691604 1037406 1383208 1729010 2074812 4149624 8299248 2766416 9682456 2420614 4841228 19364912 5532832 13832080 11065664 15215288 4495426 8990852 17981704 3458020 16598496 23514536\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n83930578\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n31084462 62168924\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n25721995 51443990 102887980\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n67843175 135686350 203529525 271372700\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n9964356 19928712 29893068 39857424 79714848\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n9634592 19269184 28903776 57807552 115615104 86711328\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n96979964 193959928 290939892 581879784 775839712 678859748 872819676\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n39101145 78202290 117303435 156404580 234606870 273708015 312809160 625618320\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n33738677 67477354 134954708 168693385 101216031 202432062 404864124 371125447 438602801\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n73239877 146479754 292959508 585919016 659158893 878878524 732398770 805638647 219719631 952118401\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n60585250 121170500 242341000 484682000 969364000 727023000 302926250 363511500 424096750 848193500 787608250\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n60255486 120510972 241021944 180766458 361532916 301277430 482043888 662810346 421788402 783321318 602554860 843576804\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n2376667 4753334 7130001 9506668 14260002 28520004 57040008 33273338 11883335 47533340 40403339 114080016 23766670\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n44497847 88995694 133493541 266987082 177991388 533974164 311484929 444978470 711965552 756463399 578472011 622969858 889956940 355982776\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n39135379 78270758 117406137 234812274 195676895 156541516 469624548 391353790 273947653 313083032 939249096 782707580 587030685 860978338 626166064\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n81256560 162513120 243769680 325026240 406282800 812565600 487539360 893822160 975078720 568795920 650052480 731309040\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n28410444 56820888 85231332 170462664 142052220 340925328 284104440 681850656 852313320 198873108 568208880 539798436 767081988 596619324 113641776 397746216 482977548\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n23047977 46095954 92191908 69143931 115239885 138287862 161335839 184383816 230479770 460959540 345719655 691439310 737535264 553151448 368767632 414863586 645343356 207431793\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n65169157 130338314 260676628 391014942 521353256 782029884 586522413 912368198 977537355 716860727 651691570 325845785 847199041 456184099 195507471\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n48108642 96217284 144325926 288651852 577303704 432977778 625412346 865955556 192434568 914064198 384869136 962172840 769738272 817846914 336760494 481086420 673520988 721629630 529195062 240543210\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n90229822 180459644 270689466 360919288 721838576 812068398 902298220 631608754 541378932 992528042 451149110\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n84867355 169734710 254602065 339469420 678938840 763806195 509204130 933540905 424336775 848673550 594071485\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n1 2 4 3 8 6 12 14 16 18 24 7 22 20 11 32 13 19 64 30 26 40\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n10 20 40 50 30 60 70 120 90 140 150 80 160 110 300 100 600 170 370 240 360 280\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n8 16 24 48 32 56 40 112 80 64 96 224 104 448 120 176 128 352 336 392 248 192\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n420 840 1680 1260 2520 5040 3360 7560 2940 10080 20160 10500 15120 9240 2100 11760 40320 3780 31920 80640 25200 21000\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n8938 17876 35752 26814 53628 44690 71504 107256 89380 143008 286016 178760 169822 214512 250264 339644 572032 679288 330706 366458 357520 1144064\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n45747 91494 182988 228735 365976 137241 274482 548964 640458 457470 594711 731952 686205 777699 1372410 914940 1463904 1235169 1555398 320229 1326663 1829880\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n631735 1263470 1895205 2526940 3158675 3790410 5685615 6317350 5053880 11371230 6949085 22742460 7580820 45484920 90969840 93496780 10107760 181939680 47380125 94760250 15161640 23374195\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n3987418 7974836 15949672 31899344 11962254 63798688 71773524 23924508 127597376 83735778 19937090 47849016 35886762 39874180 107660286 167471556 79748360 103672868 255194752 203358318 219307990 95698032\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 4 8\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2 4 8 6 16 10\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n1 2 4 8 3 5 6 16 14\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n11 22 44 88 99 176 198 132 264 231 242 352\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n12 24 48 36 72 60 96 120 156 132 312 84 372 144 108\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n4 8 12 16 24 28 56 112 40 140 68 32 80 224 152 168 48 96\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n10 20 30 40 50 60 120 70 80 140 160 100 90 200 150 320 170 230 350 180 340\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n262253762 524507524 786761286\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n790859600\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n704544247\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n940667586 65534221 61164707 241895842\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n226552194 948371814 235787062 554250733 469954481 613078091 527123864 931267470\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n571049787 387287232 156938133 355608 67121754 553950296 753144335 119811912 299704269 907663639 77709173 374112740\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n856934395 120381720 331560489 17743203 231170149 605427913 922284462 809637424 925272548 561816196 347598116 70631268 262237748 619626972 643454490 127284557\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n368834400 10351632 692089781 133440038 504863537 894500691 118792061 455602559 654100326 385982376 44564138 647376831 644780643 449087519 491494413 712802475 704953654 147972994 154107841 121307490\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n733002177 450640701 558175486 509713228 159499831 848757132 923457868 447998963 466884466 991833183 532024962 569377919 783824381 912917088 209657760 955333528 364734880 497624841 664283267 141164882 829674139 948471256\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n733002177 450640701 558175486 509713228 159499831 848757132 923457868 447998963 466884466 991833183 532024962 569377919 783824381 912917088 209657760 955333528 364734880 497624841 664283267 141164882 829674139 948471256\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n733002177 450640701 558175486 509713228 159499831 848757132 923457868 447998963 466884466 991833183 532024962 569377919 783824381 912917088 209657760 955333528 364734880 497624841 664283267 141164882 829674139 948471256\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n733002177 450640701 558175486 509713228 159499831 848757132 923457868 447998963 466884466 991833183 532024962 569377919 783824381 912917088 209657760 955333528 364734880 497624841 664283267 141164882 829674139 948471256\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n733002177 450640701 558175486 509713228 159499831 848757132 923457868 447998963 466884466 991833183 532024962 569377919 783824381 912917088 209657760 955333528 364734880 497624841 664283267 141164882 829674139 948471256\n", "output": "-1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n2 4 8 10 16 24 32 48 18 36 52 64 104 208 128 96 20 112 72 416 832 144 224\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n77 154 308 462 924 616 1232 2464 1848 3696 1001 2002 1078 4928 6160 12320 1540 12782 3080 2310 4620 24640 3542\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n17 34 68 136 170 340 680 102 119 153 459 918 748 238 1088 1496 1836 1207 1224 272 1955 1360 578\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n8451 16902 25353 50706 42255 84510 67608 101412 202824 169020 118314 135216 219726 405648 33804 439452 507060 447903 185922 574668 490158 557766 625374\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n52614 105228 210456 263070 420912 841824 473526 1683648 894438 2525472 5050944 631368 3367296 1788876 10101888 526140 1999332 2788542 2578086 3577752 947052 3998664 2630700\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n248812 497624 746436 995248 1492872 2985744 4478616 4727428 1244060 2488120 5225052 10450104 7713172 4976240 8957232 5971488 1741684 10201292 9454856 15426344 11942976 18909712 5473864\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n1048669 2097338 3146007 6292014 7340683 12584028 4194676 8389352 16778704 10486690 11535359 5243345 17827373 15730035 23070718 35654746 26216725 14681366 20973380 41946760 31460070 71309492 19924711\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n26988535 53977070 107954140 161931210 323862420 215908280 431816560 647724840 269885350 242896815 755678980 485793630 863633120 404828025 539770700 134942675 593747770 377839490 917610190 809656050 620736305 971587260 458805095\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n5438993 10877986 16316979 21755972 32633958 43511944 65267916 54389930 108779860 87023888 38072951 76145902 59828923 70706909 174047776 190364755 97901874 141413818 217559720 81584895 348095552 48950937 119657846\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\n17056069 34112138 51168207 102336414 119392483 153504621 170560690 68224276 136448552 221728897 307009242 204672828 85280345 443457794 324065311 358177449 545794208 426401725 886915588 255841035 750467036 852803450 955139864\n", "output": "6\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
228
Solve the following coding problem using the programming language python: Alice and Bob are playing a game with $n$ piles of stones. It is guaranteed that $n$ is an even number. The $i$-th pile has $a_i$ stones. Alice and Bob will play a game alternating turns with Alice going first. On a player's turn, they must choose exactly $\frac{n}{2}$ nonempty piles and independently remove a positive number of stones from each of the chosen piles. They can remove a different number of stones from the piles in a single turn. The first player unable to make a move loses (when there are less than $\frac{n}{2}$ nonempty piles). Given the starting configuration, determine who will win the game. -----Input----- The first line contains one integer $n$ ($2 \leq n \leq 50$) — the number of piles. It is guaranteed that $n$ is an even number. The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 50$) — the number of stones in the piles. -----Output----- Print a single string "Alice" if Alice wins; otherwise, print "Bob" (without double quotes). -----Examples----- Input 2 8 8 Output Bob Input 4 3 1 4 1 Output Alice -----Note----- In the first example, each player can only remove stones from one pile ($\frac{2}{2}=1$). Alice loses, since Bob can copy whatever Alice does on the other pile, so Alice will run out of moves first. In the second example, Alice can remove $2$ stones from the first pile and $3$ stones from the third pile on her first move to guarantee a win. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n=int(input()) s=list(map(int,input().split())) print("Bob"if s.count(min(s))>n/2 else"Alice") ```
vfc_10666
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1147/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n8 8\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 1 4 1\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n42 49 42 42\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n11 21 31 41 41 31 21 11\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n21 4 7 21 18 38 12 17 21 13\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n33 26 11 11 32 25 18 24 27 47 28 7\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n4 10 7 13 27 28 13 34 16 18 39 26 29 22\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n47 27 33 49 2 47 48 9 37 39 5 24 38 38 4 32\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n38 48 13 15 18 16 44 46 17 30 16 33 43 12 9 48 31 37\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n28 10 4 31 4 49 50 1 40 43 31 49 34 16 34 38 50 40 10 10\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "22\n37 35 37 35 39 42 35 35 49 50 42 35 40 36 35 35 35 43 35 35 35 35\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n31 6 41 46 36 37 6 50 50 6 6 6 6 6 6 6 39 45 40 6 35 6 6 6\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\n8 47 49 44 33 43 33 8 29 41 8 8 8 8 8 8 41 47 8 8 8 8 43 8 32 8\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28\n48 14 22 14 14 14 14 14 47 39 14 36 14 14 49 41 36 45 14 34 14 14 14 14 14 45 25 41\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n7 47 7 40 35 37 7 42 40 7 7 7 7 7 35 7 47 7 34 7 7 33 7 7 41 7 46 33 44 7\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n44 25 36 44 25 7 28 33 35 16 31 17 50 48 6 42 47 36 9 11 31 27 28 20 34 47 24 44 38 50 46 9 38 28 9 10 28 42 37 43 29 42 38 43 41 25 12 29 26 36\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n42 4 18 29 37 36 41 41 34 32 1 50 15 25 46 22 9 38 48 49 5 50 2 14 15 10 27 34 46 50 30 6 19 39 45 36 39 50 8 13 13 24 27 5 25 19 42 46 11 30\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n40 9 43 18 39 35 35 46 48 49 26 34 28 50 14 34 17 3 13 8 8 48 17 43 42 21 43 30 45 12 43 13 25 30 39 5 19 3 19 6 12 30 19 46 48 24 14 33 6 19\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n11 6 26 45 49 26 50 31 21 21 10 19 39 50 16 8 39 35 29 14 17 9 34 13 44 28 20 23 32 37 16 4 21 40 10 42 2 2 38 30 9 24 42 30 30 15 18 38 47 12\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n20 12 45 12 15 49 45 7 27 20 32 47 50 16 37 4 9 33 5 27 6 18 42 35 21 9 27 14 50 24 23 5 46 12 29 45 17 38 20 12 32 27 43 49 17 4 45 2 50 4\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n48 29 48 31 39 16 17 11 20 11 33 29 18 42 39 26 43 43 22 28 1 5 33 49 7 18 6 3 33 41 41 40 25 25 37 47 12 42 23 27\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n32 32 34 38 1 50 18 26 16 14 13 26 10 15 20 28 19 49 17 14 8 6 45 32 15 37 14 15 21 21 42 33 12 14 34 44 38 25 24 15\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n36 34 16 47 49 45 46 16 46 2 30 23 2 20 4 8 28 38 20 3 50 40 21 48 45 25 41 14 37 17 5 3 33 33 49 47 48 32 47 2\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n46 2 26 49 34 10 12 47 36 44 15 36 48 23 30 4 36 26 23 32 31 13 34 15 10 41 17 32 33 25 12 36 9 31 25 9 46 28 6 30\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40\n17 8 23 16 25 37 11 16 16 29 25 38 31 45 14 46 40 24 49 44 21 12 29 18 33 35 7 47 41 48 24 39 8 37 29 13 12 21 44 19\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n13 33 2 18 5 25 29 15 38 11 49 14 38 16 34 3 5 35 1 39 45 4 32 15 30 23 48 22 9 34 42 34 8 36 39 5 27 22 8 38 26 31\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n7 6 9 5 18 8 16 46 10 48 43 20 14 20 16 24 2 12 26 5 9 48 4 47 39 31 2 30 36 47 10 43 16 19 50 48 18 43 35 38 9 45\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n49 46 12 3 38 7 32 7 25 40 20 25 2 43 17 28 28 50 35 35 22 42 15 13 44 14 27 30 26 7 29 31 40 39 18 42 11 3 32 48 34 11\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n3 50 33 31 8 19 3 36 41 50 2 22 9 40 39 22 30 34 43 25 42 39 40 8 18 1 25 13 50 11 48 10 11 4 3 47 2 35 25 39 31 36\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n20 38 27 15 6 17 21 42 31 38 43 20 31 12 29 3 11 45 44 22 10 2 14 20 39 33 47 6 11 43 41 1 14 27 24 41 9 4 7 26 8 21\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n50 32 33 26 39 26 26 46 26 28 26 38 26 26 26 32 26 46 26 35 28 26 41 37 26 41 26 26 45 26 44 50 42 26 39 26 46 26 26 28 26 26 26 26\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n45 18 18 39 35 30 34 18 28 18 47 18 18 18 18 18 40 18 18 49 31 35 18 18 35 36 18 18 28 18 18 42 32 18 18 31 37 27 18 18 18 37 18 37\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n28 28 36 40 28 28 35 28 28 33 33 28 28 28 28 47 28 43 28 28 35 38 49 40 28 28 34 39 45 32 28 28 28 50 39 28 32 28 50 32 28 33 28 28\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n27 40 39 38 27 49 27 33 45 34 27 39 49 27 27 27 27 27 27 39 49 27 27 27 27 27 38 39 43 44 45 44 33 27 27 27 27 27 42 27 47 27 42 27\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n37 43 3 3 36 45 3 3 30 3 30 29 3 3 3 3 36 34 31 38 3 38 3 48 3 3 3 3 46 49 30 50 3 42 3 3 3 37 3 3 41 3 49 3\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n35 37 27 27 27 33 27 34 32 34 32 38 27 50 27 27 29 27 35 45 27 27 27 32 30 27 27 27 47 27 27 27 27 38 33 27 43 49 29 27 31 27 27 27 38 27\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n15 15 36 15 30 15 15 45 20 29 41 37 15 15 15 15 22 22 38 15 15 15 15 47 15 39 15 15 15 15 42 15 15 34 24 30 21 39 15 22 15 24 15 35 15 21\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n39 18 30 18 43 18 18 18 18 18 18 36 18 39 32 46 32 18 18 18 18 18 18 38 43 44 48 18 34 35 18 46 30 18 18 45 43 18 18 18 44 30 18 18 44 33\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n14 14 14 14 14 14 30 45 42 30 42 14 14 34 14 14 42 28 14 14 37 14 25 49 34 14 46 14 14 40 49 44 40 47 14 14 14 26 14 14 14 46 14 31 30 14\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46\n14 14 48 14 14 22 14 14 14 14 40 14 14 33 14 32 49 40 14 34 14 14 14 14 46 42 14 43 14 41 22 50 14 32 14 49 14 31 47 50 47 14 14 14 44 22\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n9 36 47 31 48 33 39 9 23 3 18 44 33 49 26 10 45 12 28 30 5 22 41 27 19 44 44 27 9 46 24 22 11 28 41 48 45 1 10 42 19 34 40 8 36 48 43 50\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n12 19 22 48 21 19 18 49 10 50 31 40 19 19 44 33 6 12 31 11 5 47 26 48 2 17 6 37 17 25 20 42 30 35 37 41 32 45 47 38 44 41 20 31 47 39 3 45\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n33 47 6 10 28 22 41 45 27 19 45 18 29 10 35 18 39 29 8 10 9 1 9 23 10 11 3 14 12 15 35 29 29 18 12 49 27 18 18 45 29 32 15 21 34 1 43 9\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n13 25 45 45 23 29 11 30 40 10 49 32 44 50 35 7 48 37 17 43 45 50 48 31 41 6 3 32 33 22 41 4 1 30 16 9 48 46 17 29 45 12 49 42 21 1 13 10\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "48\n47 3 12 9 37 19 8 9 10 11 48 28 6 8 12 48 44 1 15 8 48 10 33 11 42 24 45 27 8 30 48 40 3 15 34 17 2 32 30 50 9 11 7 33 41 33 27 17\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n44 4 19 9 41 48 31 39 30 16 27 38 37 45 12 36 37 25 35 19 43 22 36 26 26 49 23 4 33 2 31 26 36 38 41 30 42 18 45 24 23 14 32 37 44 13 4 39 46 7\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n4 36 10 48 17 28 14 7 47 38 13 3 1 48 28 21 12 49 1 35 16 9 15 42 36 34 10 28 27 23 47 36 33 44 44 26 3 43 31 32 26 36 41 44 10 8 29 1 36 9\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n13 10 50 35 23 34 47 25 39 11 50 41 20 48 10 10 1 2 41 16 14 50 49 42 48 39 16 9 31 30 22 2 25 40 6 8 34 4 2 46 14 6 6 38 45 30 27 36 49 18\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n42 31 49 11 28 38 49 32 15 22 10 18 43 39 46 32 10 19 13 32 19 40 34 28 28 39 19 3 1 47 10 18 19 31 21 7 39 37 34 45 19 21 35 46 10 24 45 33 20 40\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n28 30 40 25 47 47 3 22 28 10 37 15 11 18 31 36 35 18 34 3 21 16 24 29 12 29 42 23 25 8 7 10 43 24 40 29 3 6 14 28 2 32 29 18 47 4 6 45 42 40\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 4 4 4\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 2 2\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 4 4 4\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 2 1\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 3 3\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n4 4 4 4 4 1\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 50 50 50\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 2 2 2 3\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 2 3\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 1 1 1\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 2 3 3\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 1 4\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 2 2 2 2\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 2 2 2 2 4\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 3 3 3\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1 2 2 2 2\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 1 1 1 1 6 6\n", "output": "Bob\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 2 2 2 2 2 2\n", "output": "Alice\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 1 1 1 2 2 2\n", "output": "Bob\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
229
Solve the following coding problem using the programming language python: Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help. Filya is given an array of non-negative integers a_1, a_2, ..., a_{n}. First, he pick an integer x and then he adds x to some elements of the array (no more than once), subtract x from some other elements (also, no more than once) and do no change other elements. He wants all elements of the array to be equal. Now he wonders if it's possible to pick such integer x and change some elements of the array using this x in order to make all elements equal. -----Input----- The first line of the input contains an integer n (1 ≤ n ≤ 100 000) — the number of integers in the Filya's array. The second line contains n integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 10^9) — elements of the array. -----Output----- If it's impossible to make all elements of the array equal using the process given in the problem statement, then print "NO" (without quotes) in the only line of the output. Otherwise print "YES" (without quotes). -----Examples----- Input 5 1 3 3 2 1 Output YES Input 5 1 2 3 4 5 Output NO -----Note----- In the first sample Filya should select x = 1, then add it to the first and the last elements of the array and subtract from the second and the third elements. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python read = lambda: list(map(int, input().split())) n = int(input()) a = list(read()) s = set() for i in a: s.add(i) f1 = len(s) < 3 f2 = len(s) == 3 and max(s) + min(s) == 2 * sorted(s)[1] print('YES' if f1 or f2 else 'NO') ```
vfc_10670
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/714/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\n1 3 3 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1000000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 1 1 1 1 2 2 2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 4 7\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n99999999 1 50000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 0 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 2 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 5 11\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100000001 100000003\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n7 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 100 29\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 1 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 1 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 5 100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 7 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n5 4 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 6 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 3 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 5 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 5 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 7 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 1 1 1 1 2 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 4 4 4 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 2 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 9 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n1 1 1 1 1 1 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 15 14\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 6 7 8 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n7 6 8\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 2 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n4 6 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 0 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n10 20 21 30\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 2 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 6 12\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 5 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 4 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 4 5 6\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
230
Solve the following coding problem using the programming language python: Given is a string S of length N. Find the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. More formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \leq l_1, l_2 \leq N - len + 1 ) that satisfy the following: - l_1 + len \leq l_2 - S[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1) If there is no such integer len, print 0. -----Constraints----- - 2 \leq N \leq 5 \times 10^3 - |S| = N - S consists of lowercase English letters. -----Input----- Input is given from Standard Input in the following format: N S -----Output----- Print the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead. -----Sample Input----- 5 ababa -----Sample Output----- 2 The strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer. Note that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \leq l_2. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) s = input() j = 1 result = [] for i in range(n): while (j < n-1) and (s[i:j] in s[j:]): j += 1 result.append(j-i-1) print(max(result)) ```
vfc_10674
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://atcoder.jp/contests/abc141/tasks/abc141_e", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\nababa\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\nxy\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\nstrangeorange\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "2500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkrkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkzkkkkkkkkkkkkkkkk\n", "output": "1892\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nvgxgpuamkxkszhkbpphykinkezplvfjaqmopodotkrjzrimlvumuarenexcfycebeurgvjyospdhvuyfvtvnrdyluacvrayggwnpnzijdifyervjaoalcgxovldqfzaorahdigyojknviaztpcmxlvovafhjphvshyfiqqtqbxjjmqngqjhwkcexecmdkmzakbzrkjwqdyuxdvoossjoatryxmbwxbwexnagmaygzyfnzpqftobtaotuayxmwvzllkujidhukzwzcltgqngguftuahalwvjwqncksizgzajkhyjujlkseszafzjmdtsbyldhylcgkyngvmhneqyjdugofklitxaoykfoqkzsznjyarkuprerivhubpehxmoydakklbdnfhfxamotubelzvbozjaraefmlotftnqrjolvuamahndekfdsqcfvmqbocbomjxrqsfskevfxphcqoqkbbomcyurwlrnhrhctntzlylvwulbdkcdppgykichjtpukfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwqcyreiwkrpiuiasfkjexpftznqiblsrjuyfskndapwjefucdqciuehvfndghrxxnmvzljxioyundvpndabsbnwoeyomrjdcqcrxvyahermudccmueahebyvsakxwseqzduyfezujaffdrsqfseqsdfcgdenmrfwfndijtepxhnvedfbagzrxkprtgboukfxiwhfzfksnawgcubspxsiuytqrwmvxfsvzlotlfwimliygnfddeswmxuvhnqvjzgkpdzfjmcjcmsaaskextlsjrggtycgcqfpoqomrouhjkntqryhjifcxbywhfutfzmjcdlivnuxmrdfghkqlqzaeeazkoomvpysjwncyqyabutsitezurqhbuwabexrcuiwafnfvcasmrmbqnupruskhsmeicaqqesyyvopepmvdosibrvqoghdeikbpqbfgrufxdsqchjkuxpxngebxrmqdgqjsosencrbwknllvucvubyozfmttxtlsrrnrqavshaszrenhlbzpnpjgqftvwgukjwsekfcgllbzlnvmosmvqubtwsgltvmmzmslqdxqiifzkaqhsxzguseuexlycgubhdnwhrssyiybitcoowlhmmrdpgtrdwalvffknwibhwhacqfjcmwupoxonavvxwsvprpymskznabsquwssucxrmywerfpziqdziycnynthgmdavybzbqgcrgvwalcptutzxsqlkchithcdezsaeflddflgtixbnagkqrzesckrihwqplfpspkqvifbmnqwidbkzqiygwfunefiwpxueumdwugbfgnojjrjpafgkirrueoezabcqlzmcdwmklvyzvuughetwkxzuzfvoirareyblwprdnetkyigxyqpzxeckygyxthszxgyidgldnlzeqndbvacjqyhfkqvliusqmxyeqyqorzmmjwsuicnyxqnktylaqnvbjlltexgrhifdneugyszncrwgidcfjgdzkoqfqbweuchtdvpiunkpehcshtmrentgsndnbtbbbmoguopypwkapkrwisamnxagzfqsfsxtyxepbpumtlujgxuenmzggjmgiutqoeltnlyboqjegcvuuiilmsbnalvbsfutyarenkewzlpwgqzfnnkexxdsufcjvrbkesrobosuzumuccgmrsmxztpsiqchfclvzkmvfmuscnbrlczvfzwmmktusajdhocmprjlndydxrojjahocitarxlqxqjxqhpfzewpyykzeqjpehsgiqvyezbqwnpyuciobbloxjxuozsuvqwphlhglufbhjgbpkxjxiyeuwmdusfmlxkvqsmwytkjoakbnpgphefwpqnrbxwdaippueolngeddtrxpaxxziwphxkeinqsdivgplbcszjhsxeicksxbsejhgmkihtjcqqwxftjswwptmgzptqnoixwparklayjdsbijtrgtxgzfcpuchdsmkvqrhgdiidnnunwsxscqqnnqmpcpkagzsxmcborwjyqnnousxhsdmklmndntfukmskhnfjnfrvhqomofzkqiptsihalujjxkburwsbdllapwrqcarxmlzqwfcalvwxjflfjtstvrctlbkbsjpnxyhscxdxepbwqecewrzcitmdfbwzhiowcpggbunwiopnjdjcwrmixzquldialdwrdjmbhvkgqysprovnzfrbajessmybyckdqmsxsrydskoiktyfxjombtwyskctdjfquvekmckrwivzayctxcfxptgruprmpnzswuoegwgdbbypiruisjqibacpbombsjoqozzsdgdrgyqyrfrkssntfgudfqrqzxecguclnxeatmlqxsjkyjxifirswzudolgmnljjzjujuayvgxgpuamkxkszhkbpphykinkezplvfjaqmopodotkrjzrimlvumuarenexcfycebeurgvjyospdhvuyfvtvnrdyluacvrayggwnpnzijdifyervjaoalcgxovldqfzaorahdigyojknviaztpcmxlvovafhjphvshyfiqqtqbxjjmqngqjhwkcexecmdkmzakbzrkjwqdyuxdvoossjoatryxmbwxbwexnagmaygzyfnzpqftobtaotuayxmwvzllkujidhukzwzcltgqngguftuahalwvjwqncksizgzajkhyjujlkseszafzjmdtsbyldhylcgkyngvmhneqyjdugofklitxaoykfoqkzsznjyarkuprerivhubpehxmoydakklbdnfhfxamotubelzvbozjaraefmlotftnqrjolvuamahndekfdsqcfvmqbocbomjxrqsfskevfxphcqoqkbbomcyurwlrnhrhctntzlylvwulbdkcdppgykichjtpukfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwqcyreiwkrpiuiasfkjexpftznqiblsrjuyfskndapwjefucdqciuehvfndghrxxnmvzljxioyundvpndabsbnwoeyomrjdcqcrxvyahermudccmueahebyvsakxwseqzduyfezujaffdrsqfseqsdfcgdenmrfwfndijtepxhnvedfbagzrxkprtgboukfxiwhfzfksnawgcubspxsiuytqrwmvxfsvzlotlfwimliygnfddeswmxuvhnqvjzgkpdzfjmcjcmsaaskextlsjrggtycgcqfpoqomrouhjkntqryhjifcxbywhfutfzmjcdlivnuxmrdfghkqlqzaeeazkoomvpysjwncyqyabutsitezurqhbuwabexrcuiwafnfvcasmrmbqnupruskhsmeicaqqesyyvopepmvdosibrvqoghdeikbpqbfgrufxdsqchjkuxpxngebxrmqdgqjsosencrbwknllvucvubyozfmttxtlsrrnrqavshaszrenhlbzpnpjgqftvwgukjwsekfcgllbzlnvmosmvqubtwsgltvmmzmslqdxqiifzkaqhsxzguseuexlycgubhdnwhrssyiybitcoowlhmmrdpgtrdwalvffknwibhwhacqfjcmwupoxonavvxwsvprpymskznabsquwssucxrmywerfpziqdziycnynthgmdavybzbqgcrgvwalcptutzxsqlkchithcdezsaeflddflgtixbnagkqrzesckrihwqplfpspkqvifbmnqwidbkzqiygwfunefiwpxueumdwugbfgnojjrjpafgkirrueoezabcqlzmcdwmklvyzvuughetwkxzuzfvoirareyblwprdnetkyigxyqpzxeckygyxthszxgyidgldnlzeqndbvacjqyhfkqvliusqmxyeqyqorzmmjwsuicnyxqnktylaqnvbjlltexgrhifdneugyszncrwgidcfjgdzkoqfqbweuchtdvpiunkpehcshtmrentgsndnbtbbbmoguopypwkapkrwisamnxagzfqsfsxtyxepbpumtlujgxuenmzggjmgiutqoeltnlyboqjegcvuuiilmsbnalvbsfutyarenkewzlpwgqzfnnkexxdsufcjvrbkesrobosuzumuccgmrsmxztpsiqchfclvzkmvfmuscnbrlczvfzwmmktusajdhocmprjlndydxrojjahocitarxlqxqjxqhpfzewpyykzeqjpehsgiqvyezbqwnpyuciobbloxjxuozsuvqwphlhglufbhjgbpkxjxiyeuwmdusfmlxkvqsmwytkjoakbnpgphefwpqnrbxwdaippueolngeddtrxpaxxziwphxkeinqsdivgplbcszjhsxeicksxbsejhgmkihtjcqqwxftjswwptmgzptqnoixwparklayjdsbijtrgtxgzfcpuchdsmkvqrhgdiidnnunwsxscqqnnqmpcpkagzsxmcborwjyqnnousxhsdmklmndntfukmskhnfjnfrvhqomofzkqiptsihalujjxkburwsbdllapwrqcarxmlzqwfcalvwxjflfjtstvrctlbkbsjpnxyhscxdxepbwqecewrzcitmdfbwzhiowcpggbunwiopnjdjcwrmixzquldialdwrdjmbhvkgqysprovnzfrbajessmybyckdqmsxsrydskoiktyfxjombtwyskctdjfquvekmckrwivzayctxcfxptgruprmpnzswuoegwgdbbypiruisjqibacpbombsjoqozzsdgdrgyqyrfrkssntfgudfqrqzxecguclnxeatmlqxsjkyjxifirswzudolgmnljjzjujuay\n", "output": "2500\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4999\njiiccervhavvgtcwhlsrwaqotogokhtwgjmfqslvhzpgnsfqhgboehmzponrtkqjuanpnufnluezljsqvtofmenwfzlgrrpzetxogobqrhuhlygensbkpwqbwwcznxeiyoztkmgcvjusurktiehahzrntrrasikbabwcsrhacznxyudgfpqdpguijawghwvvfogdvtuhmorjceofctzqygfietzkbegkbsjzmfzrmfpmgvoafxfyinmayuxcjredrydnvlxwvhueaiqgluufbbdtpvtcfhprlyrbvvlntrqzmqawbssranjhaxtjvsxsduozsxloeblcifbyfeuonsyricvccfpkztioalhqhqekydzqxmnzcaplzlyxvfbpdzmlsfmmlgtnfraroebtfduzxgpsaqwcnjiytsrzyfwkrdlabywhcmfgzvcybflkacyhhckasmblhbdjeojnfwylcqvnbmzxugfsiyjguicgffiwrszzdbzjyhvgpnfsapufjqfespxbfljgtdgsmfeecqfwfvkweiacditmsnfaldcqlrycllmccmodlnlbkwvgmdzwapsbzyrwxasqvctbmtbpidedmvrpxqndcahltgzshjaruuemquxrrvthohcdkuurwurkwexhypsbupxuisdeshltsvfhvjvhnxggarvcdaiiaqadyjjernidpersjdqucsauprztyfoiiklhtjsznddftcgelchwbizhesduxmacmzildecegshhntfznbbbgxavmpnflhpxylxkyztwbqwpuymqlnxmetghtnrefeypivpyndobbresgvlmkkxwhlomigirizlngkykrymheywujwmjhnzxmgmkqgsajkykvqjyaplnwkcubvbxdxyheccrzfnehqeizvicxxxesnssfeuzhsjdhxnddsiuvxanfkpeqodirlsywlymiwshvenliuomflsyiqacjuajhxmeklfadfvxvmpknedshbyvenboqueaaiqwexnqgqvjwzfofokvkgdgzhwrtktdberapdnumytfobbqcozojivhkngvyystjgsdfnosjlrxpzfenfyhwajcjupuwyuvkorvmiuplwvooojckjmaqyspyacdngdnmuyrsoislcmorsfgzzksposltnxpvohdspmzkewhwnjmmmgiquywbyjiowewrvfltajjrdugejyjrkwazogerwkhvgtquxuxhrubfrqyfarbiaeporgwquijhbuwqvejgcojncyuopfgfptteusxajvqynzzisgnxjhjetomwbttpgbszzuwrfnorzxtomuwnqpkuttcbybdhluvcextuoxmzgibulszobtmxutcclnyxcdfhznmwhesgezpvxpyczlcgyaqnkgijukiiiucjfueqbmxqnwdcyberszmofrwoclbynjwjcrqayjpcijndyzmctzbaoqeugwrmhpkzvyygkovpckbzetshnebuhtmqqpmbwseocxeobhdjmkfmzvmkezwomlyzpagrxgxybztsxaeunetdtikjbbxuqjcdwyhwregfyjhctuarlqofgwhpyutwrbyebfsswbrczwxkltzjgmfuxarydaggojpheusiubpmqjmhocqmvjospdflivmsrcqtwgxdazunytifhxquasvcgdlozuqzwhfssrcxarcjflftmwngzonwfsvtukxvbsoubbbpbfwjfngelekpmoadizdsortkabmswcmywnbajxnkvmndbvtcpnjxwmoddntsqthusvzmkuedbdkbiqdwpwpssrjjflswufmhclmnstzubtcvqvqsdssgscjyqzwcamnvrilessqpzgqxdlsnclujdsaqbxxyltzlqwluortkqadjcquqdqcsvixgwglwrrmkhdsbebbjvcgzlwtbvasphvmnfvfjykqmimwxemmahhmzoadapworuvlpqolwbmkeskafyzbvzvmmprwaxisdukvmbvcvzwxynrtksbdzkvagihfgiqmsdejxirrowirgqvzelysohwvjfalsgxgzokbfurvecuxsipqvrwqjosfybncihpzjcbxefzvriisgfipsiapdpbssglqjuhvqrxefptimxedahmjqtviqrxnfpoysakxhxrjetydsxixvxyujbvqavxzupqpzdqlnddxfanwnktlpjccpwuygxyyxuafypzoakdxpkahvpjjfdognzbyixybmkdaqlixeutojgtdjltwpxpvumbudckmdxrhqwkrrlltgxdyoaokdparwbanidrfssiuigzduwzejbbnuoiwqlsgteshscnvlmjyiwhagtimrqtffkfgbodlwxirgrmrdhlihyamxmolbyfwcdputedzcwskrpkykqypkslsqnfndigwhjpdqmaclgneblkqcepsnljbyoyxchdiyygwchtcoxyzzblncvosgcffrhazjiiccervhavvgtcwhlsrwaqotogokhtwgjmfqslvhzpgnsfqhgboehmzponrtkqjuanpnufnluezljsqvtofmenwfzlgrrpzetxogobqrhuhlygensbkpwqbwwcznxeiyoztkmgcvjusurktiehahzrntrrasikbabwcsrhacznxyudgfpqdpguijawghwvvfogdvtuhmorjceofctzqygfietzkbegkbsjzmfzrmfpmgvoafxfyinmayuxcjredrydnvlxwvhueaiqgluufbbdtpvtcfhprlyrbvvlntrqzmqawbssranjhaxtjvsxsduozsxloeblcifbyfeuonsyricvccfpkztioalhqhqekydzqxmnzcaplzlyxvfbpdzmlsfmmlgtnfraroebtfduzxgpsaqwcnjiytsrzyfwkrdlabywhcmfgzvcybflkacyhhckasmblhbdjeojnfwylcqvnbmzxugfsiyjguicgffiwrszzdbzjyhvgpnfsapufjqfespxbfljgtdgsmfeecqfwfvkweiacditmsnfaldcqlrycllmccmodlnlbkwvgmdzwapsbzyrwxasqvctbmtbpidedmvrpxqndcahltgzshjaruuemquxrrvthohcdkuurwurkwexhypsbupxuisdeshltsvfhvjvhnxggarvcdaiiaqadyjjernidpersjdqucsauprztyfoiiklhtjsznddftcgelchwbizhesduxmacmzildecegshhntfznbbbgxavmpnflhpxylxkyztwbqwpuymqlnxmetghtnrefeypivpyndobbresgvlmkkxwhlomigirizlngkykrymheywujwmjhnzxmgmkqgsajkykvqjyaplnwkcubvbxdxyheccrzfnehqeizvicxxxesnssfeuzhsjdhxnddsiuvxanfkpeqodirlsywlymiwshvenliuomflsyiqacjuajhxmeklfadfvxvmpknedshbyvenboqueaaiqwexnqgqvjwzfofokvkgdgzhwrtktdberapdnumytfobbqcozojivhkngvyystjgsdfnosjlrxpzfenfyhwajcjupuwyuvkorvmiuplwvooojckjmaqyspyacdngdnmuyrsoislcmorsfgzzksposltnxpvohdspmzkewhwnjmmmgiquywbyjiowewrvfltajjrdugejyjrkwazogerwkhvgtquxuxhrubfrqyfarbiaeporgwquijhbuwqvejgcojncyuopfgfptteusxajvqynzzisgnxjhjetomwbttpgbszzuwrfnorzxtomuwnqpkuttcbybdhluvcextuoxmzgibulszobtmxutcclnyxcdfhznmwhesgezpvxpyczlcgyaqnkgijukiiiucjfueqbmxqnwdcyberszmofrwoclbynjwjcrqayjpcijndyzmctzbaoqeugwrmhpkzvyygkovpckbzetshnebuhtmqqpmbwseocxeobhdjmkfmzvmkezwomlyzpagrxgxybztsxaeunetdtikjbbxuqjcdwyhwregfyjhctuarlqofgwhpyutwrbyebfsswbrczwxkltzjgmfuxarydaggojpheusiubpmqjmhocqmvjospdflivmsrcqtwgxdazunytifhxquasvcgdlozuqzwhfssrcxarcjflftmwngzonwfsvtukxvbsoubbbpbfwjfngelekpmoadizdsortkabmswcmywnbajxnkvmndbvtcpnjxwmoddntsqthusvzmkuedbdkbiqdwpwpssrjjflswufmhclmnstzubtcvqvqsdssgscjyqzwcamnvrilessqpzgqxdlsnclujdsaqbxxyltzlqwluortkqadjcquqdqcsvixgwglwrrmkhdsbebbjvcgzlwtbvasphvmnfvfjykqmimwxemmahhmzoadapworuvlpqolwbmkeskafyzbvzvmmprwaxisdukvmbvcvzwxynrtksbdzkvagihfgiqmsdejxirrowirgqvzelysohwvjfalsgxgzokbfurvecuxsipqvrwqjosfybncihpzjcbxefzvriisgfipsiapdpbssglqjuhvqrxefptimxedahmjqtviqrxnfpoysakxhxrjetydsxixvxyujbvqavxzupqpzdqlnddxfanwnktlpjccpwuygxyyxuafypzoakdxpkahvpjjfdognzbyixybmkdaqlixeutojgtdjltwpxpvumbudckmdxrhqwkrrlltgxdyoaokdparwbanidrfssiuigzduwzejbbnuoiwqlsgteshscnvlmjyiwhagtimrqtffkfgbodlwxirgrmrdhlihyamxmolbyfwcdputedzcwskrpkykqypkslsqnfndigwhjpdqmaclgneblkqcepsnljbyoyxchdiyygwchtcoxyzzblncvosgcffrha\n", "output": "2499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nsevyrfzjizjbkrfppcjbhdpbyicjmvxnsxrlfupsniychutsvgwtrjvnepwfssfovsaxkhenzidohuqrmxxumfddygfeyptzcourhvedkdoacamyuoyeinzlvocydnxykxpfkxwmdocfzgcbwjjzrjzvsltcpvuhznzlvnzbdqyjxqwgbtllqadgxjfzrtmmvbdkczrkylnzejaipldlctxvklofqnqffkydzgtfbfergkeqmcvylzqiiuocwgdvicasicruggkbsrgyldpiwkuruyihbergcggxwujdprokxykqqbuitespohbqnkqkugwhlhkgabaphqtfdbfhgvbluyxwzopsqeukclfkfwkxqwzakbwbhilyfkyoiitlshcncyqdmjnfjekjjdzqswmjvndtmyanvucnzbduamhapynggabonfabhvnqmksnyhyydlhkfhhdkhvsusnwppwdwvayfksmbsxujuvlaigwmqsnzytvwbplyydsprlucgxoaajllvqiihbckzlpasfsnsusyfhbmcbfostwisfnreqqytkdcahmkztuaxojiftfvwwvmodljmnbjeoifeynmaxzktxxpedagsnzuvfrkigjdckuzosknadbflgiskpphygxzmcmfazjxazhbqbqrrezxlniokhfkkpdrhtcrueqxlxxdcvjlxisjxawespgxoxjygeoqzemxikvpqrfqbxyarjwojekexbqaedyuiplldvkykwpwmzheiqgdnksfymiuinmorlizmxmlhxsjotkroyphykjhrbexhafvcjetiimmpqkspsploayapwbxujwjbbihvgvkdcfpabbaymczpimztoqbidtjsdnkgudecsfsrrezfbtuxixjkipxtncfquqdtaniwlevdyodliiwuvbogqzwwpurcqvrysjzdbsucbxnlkfgcvwagoiqigsnvkwemybvxuaermvjjldzspjkpveofjvpvgvoksjyifnlgbrubyvndynhvludryljrgbkyszbxnvdbyahlztqxuibbotbfkhsgykpgcrwlmxzmhiovklijtbutfdiojsclmcjttaflmsydwunheikkskjhxadktuynceyajdkveimksqwlogdyyddksrarlpgfzznzuajfrfeunqjuawjhfmarnjuiyeuztdvrzhcezvsfkhcdgttnpfnkhsypmxbobnqylloakfknoypeoritdiqrkmjifoueibycuxnqnunbtnlnkciohefuqcyfobiiybuwprqrfokonirfilfqgjhfplyasyjmzqpdwtsbkgqcyuvtbunqnhnaefgpjnvagtpxfqrgmxtsvajtrpbdbnzqackjdtammeuasetgwfzwbysfomabhmxhlnqtbalmjfhxrogodukweyzmjfhkiiatypltuntsxajrcdzfjwfxrqwhposvxedxomrdmbqhavocmvtkggpulovcckleycfgtypcncnhtwuwrmzjpbscimpxczrpbixqvamegseypgecddfoflqtasxngkywtairategyvzxttvbfddkwxobezxfnwpzxkjcdpnlvwozndnfeguhycdoomtxbpiqlqwotoibbqzwxvgkmqwowatzozgbtrdkndcpivaildyxkknzyiyytbflwpaitvirsptzdhlfsiabomdxqhtfnvleuouktabuawprturpumhgkbuacfffoxriugzaqsenyfnmgqjmsjvobaeuqkgwpyvwpafbnxiodtcemcdqaxvlnycqyvaxxybhvdkhiuhpvumqbfrywtqkuvjjeaexycjzhrfcldugqrviylxubxwgtcptvelfadqxbcvtseznbbuaeudgejcvytastwczyjqhglyhztgddicbnlvytjhmhenxsdhvlyflhzqsoidecojqgxsqkhvfkpldtoqyrgadzgioolynwzxjruiiybwcnwaupwgmueqdfyvsvlbhqqxkceebmwqjypiygyzcdbzpkyrhrojqmqsbjilamakicreoruijzrhwwfkbvzuajrsccdhbkunzvwrhsiphmbdamnnqkhtfkyqrdrcexzftuaxfrphoipmzxczjcuoqczgprmziotdisoskroxjkleahtirtmveucayqvjbjcrndjvxvvoumpcgczwumaapdepshnaimatolvnlmepbjzwxmacwilfykkkuysuccmftjuoccupagbyakrugnnsgrvbxdwgtqzzwhbkyjdkfniepbolviwsbevypmekzmevxohkslylosuskcvehbyrruykohnencvyodstlpwdwooonhniyegmyekmtopuwykwcthhdwzqxocnqgzmtctbpuillkmawssjtrgxlspqqyczvkhhfcuglidembzunqfspcphjqtuaywqbjjsqydfojzofirjwoiobxhfdimsvisxeyyrksqalvhuqlaasevyrfzjizjbkrfppcjbhdpbyicjmvxnsxrlfupsniychutsvgwtrjvnepwfssfovsaxkhenzidohuqrmxxumfddygfeyptzcourhvedkdoacamyuoyeinzlvocydnxykxpfkxwmdocfzgcbwjjzrjzvsltcpvuhznzlvnzbdqyjxqwgbtllqadgxjfzrtmmvbdkczrkylnzejaipldlctxvklofqnqffkydzgtfbfergkeqmcvylzqiiuocwgdvicasicruggkbsrgyldpiwkuruyihbergcggxwujdprokxykqqbuitespohbqnkqkugwhlhkgabaphqtfdbfhgvbluyxwzopsqeukclfkfwkxqwzakbwbhilyfkyoiitlshcncyqdmjnfjekjjdzqswmjvndtmyanvucnzbduamhapynggabonfabhvnqmksnyhyydlhkfhhdkhvsusnwppwdwvayfksmbsxujuvlaigwmqsnzytvwbplyydsprlucgxoaajllvqiihbckzlpasfsnsusyfhbmcbfostwisfnreqqytkdcahmkztuaxojiftfvwwvmodljmnbjeoifeynmaxzktxxpedagsnzuvfrkigjdckuzosknadbflgiskpphygxzmcmfazjxazhbqbqrrezxlniokhfkkpdrhtcrueqxlxxdcvjlxisjxawespgxoxjygeoqzemxikvpqrfqbxyarjwojekexbqaedyuiplldvkykwpwmzheiqgdnksfymiuinmorlizmxmlhxsjotkroyphykjhrbexhafvcjetiimmpqkspsploayapwbxujwjbbihvgvkdcfpabbaymczpimztoqbidtjsdnkgudecsfsrrezfbtuxixjkipxtncfquqdtaniwlevdyodliiwuvbogqzwwpurcqvrysjzdbsucbxnlkfgcvwagoiqigsnvkwemybvxuaermvjjldzspjkpveofjvpvgvoksjyifnlgbrubyvndynhvludryljrgbkyszbxnvdbyahlztqxuibbotbfkhsgykpgcrwlmxzmhiovklijtbutfdiojsclmcjttaflmsydwunheikkskjhxadktuynceyajdkveimksqwlogdyyddksrarlpgfzznzuajfrfeunqjuawjhfmarnjuiyeuztdvrzhcezvsfkhcdgttnpfnkhsypmxbobnqylloakfknoypeoritdiqrkmjifoueibycuxnqnunbtnlnkciohefuqcyfobiiybuwprqrfokonirfilfqgjhfplyasyjmzqpdwtsbkgqcyuvtbunqnhnaefgpjnvagtpxfqrgmxtsvajtrpbdbnzqackjdtammeuasetgwfzwbysfomabhmxhlnqtbalmjfhxrogodukweyzmjfhkiiatypltuntsxajrcdzfjwfxrqwhposvxedxomrdmbqhavocmvtkggpulovcckleycfgtypcncnhtwuwrmzjpbscimpxczrpbixqvamegseypgecddfoflqtasxngkywtairategyvzxttvbfddkwxobezxfnwpzxkjcdpnlvwozndnfeguhycdoomtxbpiqlqwotoibbqzwxvgkmqwowatzozgbtrdkndcpivaildyxkknzyiyytbflwpaitvirsptzdhlfsiabomdxqhtfnvleuouktabuawprturpumhgkbuacfffoxriugzaqsenyfnmgqjmsjvobaeuqkgwpyvwpafbnxiodtcemcdqaxvlnycqyvaxxybhvdkhiuhpvumqbfrywtqkuvjjeaexycjzhrfcldugqrviylxubxwgtcptvelfadqxbcvtseznbbuaeudgejcvytastwczyjqhglyhztgddicbnlvytjhmhenxsdhvlyflhzqsoidecojqgxsqkhvfkpldtoqyrgadzgioolynwzxjruiiybwcnwaupwgmueqdfyvsvlbhqqxkceebmwqjypiygyzcdbzpkyrhrojqmqsbjilamakicreoruijzrhwwfkbvzuajrsccdhbkunzvwrhsiphmbdamnnqkhtfkyqrdrcexzftuaxfrphoipmzxczjcuoqczgprmziotdisoskroxjkleahtirtmveucayqvjbjcrndjvxvvoumpcgczwumaapdepshnaimatolvnlmepbjzwxmacwilfykkkuysuccmftjuoccupagbyakrugnnsgrvbxdwgtqzzwhbkyjdkfniepbolviwsbevypmekzmevxohkslylosuskcvehbyrruykohnencvyodstlpwdwooonhniyegmyekmtopuwykwcthhdwzqxocnqgzmtctbpuillkmawssjtrgxlspqqyczvkhhfcuglidembzunqfspcphjqtuaywqbjjsqydfojzofirjwoiobxhfdimsvisxeyyrksqalvhuql\n", "output": "2499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4998\ntletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletletle\n", "output": "2499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababcabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababdabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaeabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababafabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababagabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababahabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaiabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababajabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababakabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababalabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababamabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababanabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaoabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababapabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaqabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababarabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababasabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababatabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababauabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababavabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababawabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaxabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababayabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababazabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaafaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaagaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaamaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaavaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaawaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4996\nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwcwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n", "output": "1665\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4996\nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n", "output": "1665\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3963\nbbbbaabaaaaabaababbaaaabbbbabaabaaaaababbbbababaaaaaaabbaabbbaaabbbaabaaaaaababbbbbabaaaaabbbabaababbabbbaaabbbabaaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaaababaababbbbbaaabbaabbabbbbbbbbaaaaababbabbabbbbbaaaabbabbbaaaaabababbbabbababbbabbaabbabbabbbaaababbabbabbabbbabbbababaaaabbaaaababababbbabaaaaaaabbaabbbbbababbbbbaabababbbaaababbbaaaaabbbaabaabababbaababbabbabbaababbbbbabbbabaaabbbabababbaaaaaaaabbaaababaabbaaaabababababaaaaababbabaabbaabababaaabbbbabbaabbaabbbaabaabaababbaaaaabaaabaabbbabbbbabababbabbbaaabaabbbaaaabbabaaaaabababbabbabbbaaaababaabbaabbbbbbaabaaaaabaabaabbababababaaabbabababaaabaabababbbbaabbbbbabbaabbababbaabaaaaaaababbabbaaabbbbbbababbaabaaabaabaabbaabababbbababbbabbbabbbababababaaabbabaabbabbaaabbaaabaabbabbbaababbbabbbbabbbbbaaaabaabbbaaabaababaaababaababbbaaaabbaabbbabbaabbaabbbbbabbbbaabaabaabbbaabbaaaabaaabbabbbbabbbbbabbbbababaaabbaaababbbaaabbbabbbbbaababbaabaaabbabbaaaaaabbabaaabbbbaabaabbbaaabaaaababbabbbbabbbbaaaaaaabababaaabababaabababaaaabbababbbbaabbbaabbabaabaabaaabbababbaababbaaabaaabbbababbabaababbabbabbabaabbbbbababbabaabbbaabaabbaabaababababbaabbbaaaaabbabaaababbbaabbbaaaabbaababbbbbababababaabbbbbabababbbbbbbbbaabaababbaaabababaaaaaabbaabbbaaabbbaaaabaaabbaaabbaabaabbbbbbbbbabaabbaaaaaabbbbabbbabbbbabbbbababaaaabaaabbaabbbaabbaababbababbaabaaabbaaaaabbabbbbabbaaaababababbbabbabbababaaabaaaabaabaaaabbaabaaababababaaababababbbbaaabababaaaabbbbbbbbbbbbabbababbbbaaabababbbbbbaaaabababbabbbaabbbabbbabbbbbbbbbbabaabaabaaabbbbabaababbaabbbababbbabbaaabaabababaaababbababaabbaaaabbabbbaabaaabaabaaaabbababbbaaabbaaaabaaabaaabbbabbbbabbaaaaababbbaabbabababaabbabbabbabbaaabbbaababaaabbabbaababaabaaabbbaababbbaaabbaaabbaabaabbababbaababbbbbaabaabababababaaaaabbbbabbabbbbabbbbabbbbabaabbbaabbabbaaaabbabaaabbbababbbaaabaaabbaaabaaabbbaabaaaabaabbaaaababbbabaabababbbbbababaabaaaabbbaababbbbbabababaabbbbbbbbbaaaaaababababbabaabbaababbabbbababbabaabbabbabbaabbbaabbbaababbaaabaabbbbabbaabbbbbababababbbbbbaaaaabbbbabbbabaabbaaababababbabbbbabbabbbabaaabaaabaabaaabaaaaaaabbaabbbbabaababababaabbabababbbbabaaaaabbabababbbaaabaabbabaaaaaabbbabaaabbbbbbaabbbbababaabababaabaabaaabbabaaaababbabbbaabbbaabababaabbbaabaabbbbbaabababaabbbbbabaaaabaababbbaaabbabbaaabbbabaaaaababbbabbbbbaabbabbaabababaababbbaaaaaaaabbababbaaababbaababbbaaaaabababbbaaaaabbbbbbbaaabaaabbaabbaabbbbbbbaaabbaaabbaabbbbabaababbabaaabaabaaababaabbabbbaabbabbababbbbbbbbabaaababbbbaaabbbaabababbaabbbbaabaaaabbbbaabbabbbbbbbbaaabaaabbbbbbabbabbaaabaabbabaabababaabbbbbbabbaaababaabbbbbbbbabaabaabbaabaababbabbbbaabababbbabbaabbaabbaabbabaababbabaababaaaabbabbabbbbabaaaaabbbbbaaaaaabaabbabaabaaabbbabbaaaababbabaaaababbbbbaabaaaaabbaaaaabababbaaabaaababbaaabaabaaabaaaabbbbbababbaaaaaaabababbababbbaaababbabbabbbaabaaaaaaabaaabbbbbaaaaaabbaaaaabbaaaababbbabababbbababbababaaabbbbaaaabbabbabbabababbbaaaabbababbbbababbabbbaaababababbbaaaabbbabbababbbbbbababbbbbaaaabaaabbbaabbbabaabbbababbbabbababbbaabbabbaaaaaaaaabaaaaaabbbbaaaabaaaaababaabbbbbbaabaababbbabaaaaaaaaaaabbababbabaababbbbabaaabbbaaababbbaaababbabaaabaaaabbbbbbababaaabaaabababbaabbbaababbaabbaaabbababbbbabbbbaabababbabbbbaaabbaaabbabaaaaababaababbbaabbaaaaaabbabbabababbbaabaabbbbaaaabbaaabbababbaaaabbabbbbaaaabaabaaabbbaabbabbabbbaabaaaaabbaaabbababaaaabbbbbbabbabaaababaaaabbbbbbababaabbaaabbbabbbabbabaaabaababaababbbbaaaaaaaababaaaaaabbabbabaababbaaaabaaaaabaabaababbbaaaaababbaababababbabbbaababaaabbbabababbbababababaaabbabbbbbbbbbbbbabaabbbabababbaaaaaaabbbaaabbbbaaabbaaaabbaababbabbbbbababbbabbbaaabaaabaabbaabbaabbabbaaaaaababbbbbbaaaabaababbabaaabbbbbbabaaaabaaabaaaababaaabbbbbbaaabaabaaabbabbbabbbabaaaabbbbbbabbaabbaaaaaaaaabababbabbbbbaabaabaaabababbaabbbbbbabbaaaaababaabbaaaabbbbaaababbabbaabaabaabaaabbabaaaaa\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4336\nbcbcbcccbbbcccbccbcbbbcbccbccbccbbcccbbcbbcbccccbbcbbcbbbccccccbbcccbcccccbcbcbccccbbcbccccbbcbbbbbcccccccbccccbcbbcbbbbcbccbbcbbbbcccbbcccbccccbbbbbbccbbbbbcbccbbbcbbbbccbbcbbcccbcbcbccbcbccccbcbcbbbbccbccccccccccbbbbcbcbcbcbcbcbcbcbbcbcccbbcccccbccccbcccccbcbccbccbccbbbbcbbbccbcbcbbbcccbcccccccbcbccbcbcbcbcbbccbbbccbccbbbbbbbcbccbbccbccccbcbbbccbcccbccccbbcbbcbcbbccbbcbbbccbbbccbcbbccbccbccbbcbbbcbccccccccccbccbbcbcccccbcbccbbcbcbbbcbcbcbbbbcbbbbcbcbcbcbccbbcbbcbcbbccbcbcbcbbbbccbcbcbcccbbbcccbcccbcbbbcccbccbbbbcccbcbbcbbbbccccbbbbcbcbcbbbccbbbcccbbbcbbbcbccbbcbccbbbbccbbccbcbbbcbbcbccbcbcbcbbcbcbccbbcbcbbcbbbcbcbccbcccbbcbccccbccbccbbbbbbccbbcbcbbccbcbcccbccbcccbccccbbbbcbcbccccbccccbcbbbbbbbccbbbcbcbbcbbccbccbbbcbbcccbbbbcbbbcbbcbbcbcbccbbbbbcbbcbbcccbcbcbcbcccbbbbccbbcbcccbcbbbccbbbbbcbbbccbcbccbcbcbbccbbbcbbbbbbcbcbbcccbcbcbbcbbbccbcbcbbcbcbccccccbbbbcccccbccccbccccbcccbbbbcbbccccbbcbbcbcbccccbccbbcbccbcbcccbbbbccbccbccbbbbbcbbcccbbbcccccbbbcccbbcbbccbcccccbcbcbbbbbbcbbbccbccbbbccbbcbbccbcccbbbcbbbbccbbbbcbcbbcbbbccbbbbbcbccbbccbcccbbbbcbcbcbcbcccbbcbbbccbcbbcccccbccbcccbbcccbcccccccccbbbccccbbbcbbbbbbbbbccbcbbbbcbbbcccccbccccbcbcbcbbccbbcbbbbbbcbbccbcbbbcbbcbcbbcccbccccccbbbcbcbbcbbbcbbcbbbccccbccccccbcbbbccccbbcbbccbcccbbbcbbcbbcbbccbbbbbcccbbccccbcbbbcbbccbcbccbcbccbbcbcbcbbcbcbcccbcbcccbbccbccbbcbbcbcbbccbcbbcbccbbbcccccbcbcbccbcbbcbbcccbbbbbbbcbbcbcccbcbcbbccccbbbcccccbbbbbbbcbcbcbbbccbbbbcbbbcbbbcbccbbcbbcbcbcbbbcbccccccccccccbccbccccccbcbbbcbbcbcbbbcbcbbbcbccbcbccbcbcbbbbbccbcbcbbcbbcbbcbbcccccbbbcbbbccccbbcbcccbcbbcccbbccbbccbccbbbcbccbbcccccbbbbcbcbcccbcccccbcbbbcbbbcbbcbcbcbcbbcbcbbbbcbcbbbbccbcbbbbbccbcbcbccccccbcccbcbbccccbbcccccbcbccbccbcbbbccbcbcbcbbcbbcccbbccbcbbcbbcbcbccbbbbcccccbbbbccbbcbcbccbcbbbbcccbcbcccbbbbbbcbcccbcbbbcbbbbbcbcbbbbbccccbcbcbbcbbbccccbbccbcbccbccbbccccbbcbbbcbcccccbcbccccccccbbcbbcbbbbbccbccbbcccccbbcbbbcbbccbcbbccbcbbbbccbbcbcbbcccbbbccbbbbbccbbccbbbbbcbccbbbbbbcbbbcbcbcbcbbccbccbcbbcccccccbbccbcbccbcccbbccbccbbcbccbccccbbbbcccccccbbcbccccbccbccbcbbcccbbccccccccbbccbbccbbcbcccbcbbbbbcbbbbbbbccbcbbbcccbbcbbcbccbccbccbcbbcbcbcbccbbbcccbccbccbbcbbbbcbbccccccbbcbccccccbbbbccbbcbcbcccbbbbbbbbbccccbccccbbccbcbbccbcccbcbccbcbbbbccccbbbbcbbccccccccccbbcbbbccbcbbbcbbbccccbcbccccbccbbcbcccccbccbbbbcbbccbbccbbbbbccbcbcbbccbccbbcbcbcbbbbcbcccbbcbbcbcbccbcccbccbbbbcbcbbccbcbcccbbbccbbccbcbcbcbcbcbbccbbbcbcbbbbbcbbbbbcbbcbcbccccbbbbcbbbbcbbcccbbcbccbbbccbbccccbcbccbccccccccccbbbccbcbbccbcbcbcbbcbcbbbcbcbbbbbcbcbbccbbccccbbccbcccccbcccccccbbbbbcbcbcbbccbccbbbccbbbcbbbcbcccbbcccbcccccccbbbbcbbcbbcbbcbcbbbcbbccccbbbccbbbbbcbbbcbcbccbbccbcbbcbccbcbcbbccbbcbccbcbbbcbccbcbbccbbcbbcbbcbcbcccbcccbbbbcbbbbccbbbbcbcbcbbcccbcccbbccccbcbbbccbbccbbbbcbbcbbbcbbbbcbbbccbcbbbbbcbcccbbbcbbbbcbbccbbbbccccbbbcccccbcbbccccbbbbbbcbccccbbccbccbbcbccbcbbbbbbcbbccbcccbbbbbbcbbccbccccbccccbbbbbbcbccbccbcbbcbccccccbccbbcccbbbbbbbbcbbbbbbbbbbbccccbbbccbbccbbbcccccbcbbbbbccbcbbccbbbbbcbbbbbcccccccbbccbbccbbcccccbcbcbbccccbcbbbcccbbccbccbccbbccbccccccbccccbcbcccbccbbcbbbccbcbccbbbcbcbcbbbccbbbbbbbbcbccccbbcbbbccbcbccbcbbbbbcbbbccbccbbcbcbcbccbcbcccbcccbbccbbccbbbcbbbbbbbccbbcccbcbcbbcbcbcbbbcbbbcccbbbbbcbcbbbbcbbbcbbcbcbbcbccbbbcbccbbccbbcbbcccbcbcbbbcccbccccbcbcbcccbbbbbcbbbcccbbbcbcbbbbbbccccbbbcbcbbccbccbccbbcccccbbcbcbbcbbbccccbcccbbcccccbbbbbbbbccbcbcbbbbcbbbcbcbbbbbccbbbbbccccccbcbcbbbbbcbcccbbcbccbbbbbcccccccbbbbcbbbccbbcbbbccbccbccbbccccbbbbcbbcbbcbcbbcbbbbcccbbcbbbbbbbccccccbbcbcbbbbbcbbccbcccccbbbbcbcbccbcbccccbbccbbccbccbcbbcccbbcbcbcbbbbcbbbcccccccbbcbccccbbcbbbbbbbbbcbbbbccbbcccbccccbbcbccccbcbbbbcccccbcbcbbbbcbcbcbbbcbbcbcbcbbbcbcbbbcccbcbccccbcbbbccbcbcccbcbbbbbbcccbbbcbbbccbbbbcbbbcbcbbcccbbcccbccbcbcbbccbbbbbccbccbcccbcbcbcbccccbcbbcbccccbbcbcccbbbbcbbbbccbbbbccccbbcbbbccbcbbbbccbbbbbcbccbbcbcbbcccbccbbcbbbccbbcbbbccbbcccbbbccbbccbbbccbcbbccbbbcbbccccbbbcccbbbccbbccbcccccbbbbccbcbcbbbbbccbbcccbbccbbccbcbbcbccccbccccbbccccbbbbbbbbbbbcccbcccccccbccbbccbbcbbbbbccbcbbbbbccccbbcccccbcccbcbcbbccccbccbbccbbcbbcccbcbcbcbccbccbbbbcbbbcccccbbcccbcbbbccbbbcbbcbccccbcbccbcbcbcbbbccbbbbbbbbccbcbbbcbccccbbcbccbcbcbcbcbcccccccbbbcbcccbbccbbbbccbccbbcbbccccbbbbbcccccbbbcccbccbbcbbcbbcbcbccccbbcbccbcbbbcccbbbbbbcbcbbcbccbbcbbbcbbbcbccbccbccbcbccccccbccccbccbcbbccbbcbccccbbbccbbbbbcbcbbcbbcbcbbbccbbbbccbcccbcbccbbbccbcccccbcbbbbbccbcccccbbbcbcbbbbbcbbbcccc\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3809\ncccddcdcdcdccddccdcdcccccccccccddccccdcccccdccdccdddccdccccccdcddddcdccdcdcddccdcdcdcccddcdcccccccccdddccddcddccccccccdddcccdddccdccccdcdcdcdccddccccdcdddccddcdcdcccddddddcdddcccdddcdcdccdccdcdccdcdcccdcddcddddccdcccddccddcddcddddcddccddccccddcddddccccddcddcdddddccdccdcddcccdcddddcddccddcdcdcdcccddddcddcdcccccddccdcccdcddddcccccddcccccdddddccdcdccdcddddddddddccccdcdccccddcdcccdccdcddcdccdcccccdcccdcccdcdcddcddcdddddddddcccccccdddddccdddcccccccccccccddcccdcccdcdcdcccddcdcdccddcddcdcccccdcddddccdccdccdcdcccddcdccddddccdcccdccccddccddcdddddddcddddcddcccdddcdcccdddddccdcddddccddcdcddcccdcdccddccdccdddddddcdccdccddddddcdccdccdcdcccdccccdccdcccddcdccccdddddccdcccccccccdccdcddcccddddcdcdddcddcccccdcdcdddddcddcddccddccdcdccdcccccdcdddddcddcdccddccddcccccdcccdcddcddcddcdddddddcdcccdcdddcccccddcdccdccccddddcddccdcddcdcccccdcccdddcccccccdddcdcdddcccddddcdcddcdccddccddccdcccddcdccddccdcddcdccddddcdcdcdddcdddcdcddddccddcccccdcddccdddccdccdcccdddccdcdcdccddcddccccdddddcdcddcdddcddcdcdccccdcdccddccdddcccddddcdcccdddccdcccccccdccddcdcddddcccddcdddccddddcddddcddddcccccddccdddcddcdcccddcccddddccddcdcccdddcdccdddddddcddcdccdccccccdddcccdccdddddddcddccddcdcddcdcddcdcdddddddddccdccdccddcddcdccdddddccccdccccdcddcccdddddccdddddcdcdcdccddcdcddddccdccdddddcccddddddddcccdcdcccdccdcccdcdcddcccccdcdcdcdcccccccdddddddddcddcdcdcddddcccddddccdddcccddddccdcccddcccdddddccdccccccddddddddddddccccdcccddcccccdccccccdcddcddddcddccccddcdccdccdcddcdcccddcddddcdccdccdcddcddcdcdcddcccdddcdcddddcdccccddcdddccddccdcccdddddcdcdccddcccdcccdccdddddcdddddddccdccccccccdcddddcccccddddddccccddcddccdddccdccdddcccccccdcccdcdcdccdcddcddcddccdccdcddddcddccccdcdcdcccddddccdcdcdcdcdcccddcddddccddddcdcdccddcddccddcdddcccddcccccdcccccdcccddcdddccdccccdddcdddddcdcdcddddccdcdcdddcdcccccddcddccccddccddddcccccddcdcddddcdcccdddccccdddccdddccdccdccccdddcddcccccccddcddddcdcdcccdddcdcddccccccdccddcdcddccccccdccccdcddccdcddcdccdcdcccccddccdcddcdddddddcddddccddcddcdcccccddddddcdcccddcdcdcccccccdcdccdddddddcdcddcdccdddcccdccddccccccdddcddcdcddccddcddccddcddcdcccccddcccddcddcddcdcdcccdddccddcccccddcddcccddcdddcddcdddcccddccccccddddddcccdccddcddccddcddcdcdccdcddcddcddccddddccddccddddcdcdcdddddccddcdcddddcddcdcdcdcdcdddccccddddddccdcccccddcccdddcccddccddcccdccddcdddcddcdcddcdccccdccdcdcccddcddcdddccdddddddccddddcddccdddcdcdddcccdddcddcdcccdccccddddcccccdcddcddddcccccddddcdccdddcddccddddddddccdcccdcddcdddcdccdcddddcdccdddcdddcdccdddccdddcdcddccdcccdddddcdddccddddcddcdccccdddcdcdcdcddcddccccdccdccccdddcdddcccddccdcdccccddccddcdddcdcdddcccdcdddcccdcccccccccdcdccddcdccccdddccdcdccccdddccccccdcdddcccccdcccdcccddcccdddddddccccccdccdcdcddcdddddddccdcddccccccdcdcccdddccddccccdcccdcdccddcdcdcddddcddcdcccdcdcccccdcdddccddcccccccccdcdccdddccccddddcddccdccccdddddcccddcccdddddcdcccdcddddddcccdccdcddddccdcccccdcccddccdddcddddcdddddcdcdccdcdcdddddccddcdddcddccddddcdcccccdcddccdcddddcdccdddcdcdcdcdccdccdcccddcdddddcdddddcccdccdddcdccdddddccdcddcdddcdcdcddccdcdccccdcccdddcdcccdcdddcdcccddcddddcdddccdcccccdccdccdddddddcdddcdcdcddddcdcddcdddccdcccccdcccdcddddddcdcdcddccddcdddccdcdcccdccdddccccdccdcccdcdcddccccddddddcccddddcdcddccdcdccdccccddcddcdccdddcdddccdddddccdcdcdccdcccccccdddcdcccdddccccddccdccdcdcddcddcdcccdcdccccdcccddccdccdcddcdcddcddcddccdddcdddcccdccccccddcdddcdccccddddcddcddddcdddcdddcddddcdccddccdcdddccdcddcdcdcccddcdcccccdcddcddcdccdcdccdccdcccddcdcdddcddccddccdddccdcddcccddcddcdddcdddcddcdcddddccccccddddccdccdcccdcccdcccdcdddccddddcccdccddcdccdcdcdcdddcccdcccccddcddcdddccddcddcccccdcddcdcccdddcdddcdcdccdddddcddcdddcdcccdcccccdcddddcdccddcdddccdcddddccdcdcdcdcdccccddccccdccdcccdccdccddcdddccddcdcddccddccccccdcdccddddccddcdccdccccddcccdcdcccdddddccddcdcddcdddccddcccddddcdcdccdcdddddcdcdccdcccdcccdcdccddddcccdcddddcdccddccccccdddcdddcdcdcdcdcdccddcdddddcccdcdcdddccdcdcdddcccdcdccddccccddcddccddcdcdccddccccdcdccdddddcd\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4640\nedddeeeddedeeddddddeeeedeeeeeedeeddededeeeddddddeedeededdddddeeeddddddeddedddededeedeededddeeeedddeededddddeedddedddddededdededdeddeddeeedeeededdeddddeddedddeeedeeededdeddeeeedddeedddededddeeeeddeeeededdddeeededeeddeeddedddedededdeedddddeddedeeeddededdddddeddedededeeddddededdddedddddeddddddedeededddededddeeededddedddeeeddeeddeddedeedddddedddeedededededeeddeedeeedddedeeedeedddedddedddededddeeddddededeedeededdeddeeedeeedeeeddedeededddeddeeddeddeddddddddeeeddeeeedeeddeddddeedeeeeddeddddeeeeeeeeeedddededdeddeedddeeddededededeeededddedddedeeeeeedeeddeeededdeddeedddedeedededddddeeeededeeeeeddeedddddedeeeededeeededdeeededeeddddeeedeededeeeeeedeeedddddedddeeddeeedddeddeddddeeedddeeddeeeeeeeeeedeedeededdddddddeddddedededdeededdedddddededdeeeeeedeedeeeededdedeedeedddeeeeedddeeeedddededdeeeededeeedeededeedeedeeedddedddeeeeddedddddeeddeeedeeeeedeeeddddeedddedeeddeeeeeeeeeededddeedddeddedeeeedddedeeddededddddddeeddeededdddddddeededdeeeddeddedeeddddededdddeddeededeededddeeedddeddededeeeedededddeeeddedeeeeddeedeeddedddddedddeeeeeededdeededeeeddeedddddeddddedddeddddeeeddeddedeeeddeedeeeeddeeddededdeeededddeeeedeeedeeeddedeedddeeededdddeedddeddeeddddddeedddeddeeeedeeeeeeddededeedeeedddddeddddedeedeeedddddeedeeeeeddeedeeeddeeedeededeeddeddeeedddeedeeddeededddeddeeeddddeddedddedeeeeeededddeddddeddedeeddeedeeddeeeddeeedeedddeddededdeeeddeededdeeedddddedddedeeeedddedeedeedeedededdeddedeeddddddeeeeeeddedeeeeeeddedeedeeddedeeddeeeddeedddddedddddeedeeedeededeeedddeeeeedddeeeddddeededeeeeeedddeedeedddeedddeeddddddddeeddedeededdeeeedeeedededdeddededddeeeddededeedeedeeddededddededededddedddeeddedeeddeeeeeedededdeeededdeddeddedeeedeeddedeeedddeddeedeeeeeeeedeeddeededdeeededededddedeeeeeededddedddeddedddeddeeeededdddedddeddeededeedddedeeeddedeeeddeeedededddedeeeddeeededddeeededdeedddedddddedddedddeddddedeeeeeeedeededdeeedededeeeeedddddddeeeeeeeeddededdedeeeeeeddddddeedeeedeeedededededddddeedddedeedeeeedddeeeddeddeddedddeddeeeddddddeeddddeeeeeeddeededdeeedeedddededeeededdeeeeedeeeeeededeeeddeedeedeeededddeedededeedeeddeedeeeeeddeeeddddeeddeddeddddeeeeeeddeeddddedeeedeededddddedeeddeedeeddeeedeeeeeeddeeeedeeeddddeeeeeeeeeeededeededddeeededddedeeededdddeeddeedeeeddedddddddeddedddddeeeedddeddeeddeddeedeedddedeeedddededdddedddeeeeeeededdeeeeddddeeeedeeddddededdddddddeededeeedeededddeddddddeddeddeeddddeeddeeedeedddeedeeeeeddeeedeedddddeedddedddeededddeedeedededddddddedeeeededeedddddeddddeeddeddededddedededddeeededeeeeeeeeeeeddedededededeeeddedeeeedddddddddeedddedddedeeeededeedddddddeddedddeeddddededeededeeeeedededdeedeedddddeeeeeeedddeeddeddddddeeeeedddedeeedeededddddeedeeddddedeeedddddddddeeededeedeedeedeedeedeeddddedeedeeeedeeeedededeeedeeddededdeeedeedddededdedeeededdedddeddedeeddedeeeeddedeeeeeedeededeedeedddedeeedeeddeeddeddedeeeedeeddeddeeedddeededdddeeeddeeeedeedddddeeddeeddeedddeeeeddddededdddeeddddddedeeeeededdddeeddeddedddedeeeeedeedddedededeeeeeedeeddeedddededdedddeeddddeedeeeeddddedeeeddedddddeedeeededdeeeeedeeedddeeeeddeedeeeeddddeeddeeddddedeeddeeeeedddeeeedddddddeddedeeededdddededdededdededededdeeeeddeedeeddddededddddeeededdddddeddeeeddeeeddeeedededeeedeeedeeeeededddeeedeeeddedededddeeeedeeedeedeeedddddeddeddddeeeddeeddeeedeeedeeedeededeedededdeeeedeedeeeeeeedeeeeeeedeeeeeddedddeddedeededdeeededeeeeeeedeedededeeeeedddeddeeededdedeeeeeedeeeeddedddeeeeededddddddededdeddeededdeedddddeddedeeeeedeeedddddeeddddddeeeedeeddeeededeededeedddddededddddeddddeddeeeeddeeddddddedededeeeeeeeeddddeeeededddeeddeededddedddeddddeeeedeeededdededeeeededeeeeeeeeeeddeedeeddddeeddedeeedddddedeeeeeddedeeeedddddeedeeddeddeeeededeeeeeedeeeedeeddeddddedddeeeddeedeeeddeededdeeedddeddeeeeddeedeedddedeeeedddeeededeeeddeeeddeeddeeededeeddedeeededededdddedeeeddddedddedeeeeeeddddedddeeddedeeddeedddeeeddeeedddddeeeededdeeeeedeeededddeddeeedddddeeeddeddedeedeeddddeededeedddeeeeddeeeeeeeedddeedeeeeedeededeeededeeeeeeedeedeedddeeeeeeedededeeededeeddeeeedededdddeedeeddddeeeeddedededdddedddedeeeeddeeedeeeeeedeeeddeeddeeddeeeddededeeeedeeeddddeeeddedeeeededdddeddddedeeeddeededeeededdededeedededdddddededeeedeeeededddeedeeeddedddededededdddddeeedededdddeeedddeeeeeddedededddeedeedeeeedddededeedeedeeeedddeeeeedeedddeddeeeedededddedddddddedddedddeeddeeeedddeeeedeeddddedeeeededdeeedddeddeddeeedeeeddededdddeddedeeddddedeedddededdedededddedeeeeeddedeeeeedeeeddddeddeeeeeedeeddeedeeddeeeedddeedeeedeedeedddeeeedeeeeededddededdeeeddedeeddededeeeddeddeddeeedeeeeeeeeeddddeddeedededededddedeeddddeeedddeededddeeeeeeeeedeedeeddededeeeeeddddddddddeeddeddeedededeeeddddeeedeeededddeeddeddeeeedeeeeddddeddeeddeeeddeddeddeeeddeeeedddeeeddededeededddddeedddeeeededeeeeeeddedeedeeeeededeeddddeedeeedeeeddeeedddddeedddddddeeddedddddddeddedded\n", "output": "22\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4639\nefeeeeffefeefffefeefeeeefffefeefeefefeeeeeeefefffeffeffefffefeefeeffffeefefffefeeeeefeefffffeeeeeeeeffffffeefffffefefeeeefefffeeffeeffeffffeefffefefeffeeeeeefeeeeefeeffffefffeffefeffffffeffeeffefffeeefeefeeffeeeefffeefffeefeeefffffeeeeefeeffffeeeefeffefeffeeeeffefffffffffeffefeeefeeeefeeeefeeffefeefffffeeeeeffffeeeeffefffefeffeeeeffeffffffeeefeeffeffeeeeeeefefeffeffefeffeefffffefeeefeefeffffefeffeeeffffffefeeffffeeeffffeeffffeeffffeeffefeffeeeeeefeefefeefeefeefefefffeffeffffffefffeeffeefffeeefeffeeefeeeeefefeeefeffeefefefffeeefeefeffeffffeeffeeeffefefffffffffffffeeefeefffeeefefeeefffeffefeeeefefefefeeffefeffeffeefeeefeffeeeffefffeffefefefefeeefeeeeffeefffffefeeeffeeeeeeeefffefeffeeefefffffeffffeeeeeeefffeffefeeefefeffffefeefeefffeefffeefefffeeefefeeffefeffeffeefefeeeefffeefeeffeeeeeffeeefeeeefffffeeffffeffeefffeeeffeeeeeffeeeefffeeefeefefeeeeefeffeffeffffffeeefeffffeeefeeeeeeffefeefeefefeefefeeeeeeeeefeeffeffeefeeeeefeeffefefffffffefeefefefefefffeeefffefffeeeefefeffeffefffefeefffeeeeeffffffefefffeeeeffffeeffffeefeeeefeeefeefeffeeeeeeeeefeeffeeffeefffeefeefeffeefefeeefffffffefffeeeffffefffffffeeeeeeeeeffffffffeeeefeffeeeffefeeffffeffefefefffeeeeffefeeffefefffffeeefeffffffeefeeeeffffefeeffeeeefefeeeeeeffefeefeeeefeffeefffeffeeeefeffeffffefffefeeeeeefeeeeeeeffefeffeefffeeeeffffffeeeeeefeffeeffeffeeeffeefeffefefffeefefeeefeffefeefeefefffeffffeeeffeefefeefffefffeeefffefefffefeeffeefeefeeffefefefefeeffeeffefffeffffeefefffefffffffffeeffeeeeeffffefeffeeeffffefefeeffefeffeeeefffffeefeffefffeffeeeefefffeefffffeefeeffefefeffefeefffeeffffeffffeeefffefffeffeeeeeeefeefffeeeefffeeeffffeeeeeeeefeeffffffeffffeeeeffefeefefeffeefeffeeffefeeffeeeeeefeefefffefeefefffefeefeeefefffeefeeeeefffffeeefefeefeeeffefefefefeefffeffeeeefeeffeefeefeffefeeeffeefefeeefeffefeeeffeeffeefeefefffffeeeffeeefffffffefefeeffefefeeeeeefffefffeefefffffefffeffeffeffeeffeeeefeefeeeeffeefeefeefefeeefefeeeffffffefeefeeefefeeeefeffefeeffeffeeffefeeeeefffefefefefeefeeefffeeffeeffffffeeffeefeefefeefefffeeffefeeffeeefefeeefeeeeeeeefeeeeeeeefeeeffeffeefffefeeeefeeffefffefefeffffeeefefeeefffffeffeeffeffeffeefffeeefeeeefefffeffffeeeeefffffeeffeeeefeffeffffeeeeffeeffeeeeffffffefefeffeffeefeefeefeffffefefefefefeeffefefeeffeffeeffefeeefffefffefefeffeffffefeefffeffefffefeeeffeefeffefeefefeffeeeeffefeefefeffffefeefffffffeeeeffffefefefeffeeefefeefeeeffefffefefefefeefefeeeefffefeeffffefefeeffeeeffeeefefefffefeffeefeffeeeefeeffeeffeffefeffffefeffeefffffefffeeefefeefefffeeffeeffefffffeefffffeeffffffeefefffeffeeeeffefeffefefeeefefffffefffeefffeefeeeefffefffeffffefeeeeeeffffffefeefefeffeeeeeffffefeeffefeeeeffeeeeefeeeffffeffffeffefffeffefffeeeffffeffeeefffffeeeeefefeeeeeefeeeeeefeeeeefffefffeeeeefffefeeeeeeffeeffeeeffeffffffeffeffeefeeeeeeefeeeffeeefeeeeefeefeeeefeffefeeffeefeffeeefffeefeefeefeeefefffeffefeeefffffefeffefefefeeffffffefeeefeeeeefefeeffefeffefffeeefeefeffeeefeeefffeefefeefefefeefffffefeeeffffffeeefffeeffefeefefffeeefffffeeefeffefffeefffefeffefeffeeeeefefeeeffeeefefeffefffeffeeefefeffeefeeefffeeeeefeffeeeeeeefefffeffefeeeffefeefeffefeeefefffeeefeefeeffefffeffeffffffeefefefeffeffeeffefeeeeeeefeeeffffffeefffefeffefeeffefffeeeeefffffeffffefffeefeefeeefeefeeffeefeeeeeffefeeefeeefffeffeeffefeefeeeffeefefffffffefeeeffffeefeeffefeffeeeeefeffeefeefffeffffeefeeeefeffeefefeeeeffeeeefefefffeeeffeffeffffeffeeffeffeffeeffeeffeffffeeffeeffeffeffeffeefeffeefefeefefeefeffefeefffeeeeffeefeeffeeffefeeffffeeefefeffeefeffefefeffeeffefffefeffffeeeffefffeefeffeefefefeefeffeefefefefeeeefeffefeeeffeeffeeeffeefffeeffffeeffefeeefeefeeeeffefffffffeefeeeffffeeeeeeefeffffefeffeeeefefeffeeeefeeeefeffefeefefffefffffefefeefefffffffeefffffffffeeffefefeffeeeffffeffeffffffeefffeeeffffffeffeffffefeffeffeefefefffffeeeeffeeeffeefeeeeffeeeefffffeeefeeefefffefeeffeeefffefeefeffffeefffffeeefffffeffeeffffeeeffefeeffeffeeefefeffffefeffffefeffeffffeeeefffeffefefffffefeeeeeefffefefffefefefefeffeefefffefeeffefeefffffeefefeffffeffeeeffffefeefffffffeefeefffefffeffefeeffeeeffefefefeefeefeefeefffefeeeeeeeefffeefeffffffeeefeffffeffefefeeefeeeeefeeffeefffeeeeeffffeeffffeeefeffeefffefeeefffeeefefffeefffefeffeeeeeffefffefeeeefefeefffeeeeffeffefefeefefeeffffffffeefffeeefefffeefffefffefeffefeeeefeeefefefeefeffeeefeefefefefeeeeeefefffefffeeffefefffeefeffffeeefffeeefeeefeeeeeeffffeefefeffffefeffffefefefffeffefefffffefeffeeeeeefeefeeeefeeffffefeefffeeeeeeffeeeeeffeeeffeeeefefeeefeeeefeffeeefeeefeffefefeeefefefefeeefefeefeefeeeefeefefeeffffeeeefeeeeeeffefefffeeffeeefeefefeffffeeeffefeffeeffffefeeefefffffffeeefeeffeeefeffefeeffffeffffffffeeeeffeffefeeeeeffeeffefeffefffefefffeeeffeefeeeeeefffeffffffefefffeeeefefeffeefefeeefeeeefffeeefffefefeffffeffffeffefefeeeeeffeef\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4330\nfgggffggfgffffgfgfffgfffgfffgffffgfffffgffggfgffgggffgffggffggffgggfggffffggffgfgggfffggfgfffggffgfgggfffffgfffffggggfggggffggfggfffggffggffgfffffffggfffggggffgfggffffgggfggfffgffggfgggggfgffffffggffgfggggfggfggffggfgfgfffggggfffgffgfggfgfgffgffffgfggfggffffgfgffgggfgfffggggfggffgfggfgggfgggggggfggggfggfffffffggggfffgfgfggfggffggffffgfgfffggffgggggfggfffggfgfgfffgffgfgggggffggggfffggfgffgfgfffgfggggffgffgggffggfffggggggggffgggggfgfggfgffgffffgffgggfgfggfgggfgfgfgffffffffffggfgfgggggggfgfgfgfggfffgggfgfgfffffffgfgfggffggfggfggfggfgfffgffggfggffgggffgggfgfgffffggffgfgfggfgfffgfffgfgfgggffffffgfgggfgfffggfgffgggffffgggggfffggfggffgffffgggfgffgggfgffffffgfggfggggffgfffffffgfgfgffggfgggffggfgfggggggffggfgggfgggffgfffffffgfgffgggfgfgfgfffggfggfgfggfffgffgfgfgffgffffffgggffgffgfgfgfffgfffgfgfggggfffgggffgggffffgfgggfggfgggggfgggffgfffgggggggfggfgffffgfggffgfggffggffgggfgggfffgffgffggfgfgggfgfgggfggfffgffgggfgfgggffgfgfffffffgfggffffffggfffgfgfffggfggfggfffgfgffgfgffgggggfffgffgffggggfggfggffgffgggffggfggffggffffgfgffgggfgffffffgffgffffgggfgfffffggffffffgfgggfffgffgggffggggffffgggggfgfgggfggggfffggffgfffgffgffgggffffgggffgfggggggfggffffffgfgfgffffgggfgfggffgggffffgggggfggffgfgfgfgffgfgfggggggfgffffggffgggffffgfffffggggfffggffffgffgffggfggffffgffgggffgffgggfgggffggfggffggfgfgffgfgfggfgggffgggffggfgfggggggfffgfggffffgffgfggffggffgggfgggfgfgfggffggfgffffggggggggggggggggfgfggfgfggfffgfggfggfggfgggffggggfgffffggfffgfffggfggffffgfggggffffgffgggfffgffggggfgfgfffgggggffgffgggggggffggfgggffffgffgggggfgffgfgffffgfgfgffffgffgfggggffgffgggffgfgffffgfffgffffgggffgggffffffggggffgfgfgfgffggfggffgfffffggfffgffgfgfffgffgffgffffgfgfgffgfffffffgffggffgfgfgffgffggfggffggfggffgggggffffggffgggfgggggffgfggggffgggggfffgfgfggggggfggggfgffgffgggggfgffgfggfgfggggfggfgfggffgggfgfgfgffgfffgffgfgfgggfffgffgggffggggfffffgfggfgfgfffggfgggggffgfgggfggggfffgggggggfgfffggfgfgggggggfggggfggffggfgfgfgffggggfffffgfggfgffgggfffgfggggfgfggfgfggfgfgffffgffffgfgfggfgggffgfggggfffgffggfgfgfgffgfffgffggfgfggggggffgfffgfgffggfffgfffgfffgfggfgfggggggfgggfgffffffggfggfgggggggfffgggfggfffgfgfffffgffgfgfggfgfggffgfgffggfgfffffffffffggfffffgfgggfggfgggfgggggfggggfffffffggggfggfffgfgffggggffgfgfgfffgffffgffgfggfgggffgffgggfgfgggfggggfgfgfffffffggffgggffgfffffgfffgggggfgfffgggfggfgfgffgffgfgfgffgffgfgggggfggggggfffgfggfffggggffgfgfgfgggfgfggfffffffgggfffgfggfggggfggfggfgffggggfgfgfggfffggggfgfgggfgffffffgffffffggffgffggggffggffgfffggfgfffffgfggfffgffgfgfggfgffggggfffffgfffffffgfggggffgggfgfgffgggfffffffgffgggffgfggfgffgggggfffffggggffggffgfggfgggffggffgffggfffgggfggfffgggffggfgggfffffgfggfgfgffgfgggffgggfggffgfgfggggfgfffgfggfgggffggggffgfffgggfggfffgfggfgggfffffffgfffggfffggggffffgffgfffgffffffggffffggfgfgffffggffffffffggffgggfffggfggffffffggffffffffffgffgggfgfgggfffgfffgggffggggggffgfgfgffgfffgfgfggfggffgfggffggggfffgfgfffgfffffgffgfgfffffffffgggfggfffggfgfgffffffgfggfgfggggggfffffffgfffggggfgffggfffgfgggggfggfgfgffgfffgfgfgffffffffgffffgfggfgfgffffgffggfgggfggfgggggffggfgffgggfffgffffffggffgfgggggffgfgfffffggfggfggffffggfgfgffgfgggfgfgggfggffffgfgffgfgfggfffgfggfgfgfffffffffgggfffgfffgffgggffffgffgfgffggffgfgfgffggfgggfgfgggggggfgffggfgfgffgggfggggfgfgfgggffffffgfgfgffffggfffgfggfggffgfffffgffgfggfggfgfggggffgfffffggffgggffgfffffffgggfgfgfffgfggfggfffffgfgfgfggfgfffffgffgffffffffggggfggffgfgfffffgggfgfggggggfggggffgffggfggffggffffggfffgfgfffgffgggggggggggffggfggfffggfgfgfgfggffggffggfggggfggfffgfgggfggfffgggggffggfgfgfgggfggffffgggffgggffgggffgggfgfgfgfffffggffffgfgfffffggfffffgffffgfggfgggfgfgffffffffggfffggfggffggggggggggffgggggggfggfgggggfffgggfggfgggggffggfggggfffgfggfgffgfgggggggfggffgffgffggffgfffffgffffggfgggggffgfggfgggffffggfgggggffffffgggfggfgggfggggggfffgfgggggfgfffggfffgfgfgfffgggggffgggfgfgggfgfffffgfggfgffggffgfgggggffgfgfgggfffgfggggffffgggffggfgfgffgffgfggffgggfffggggggffgfgffffggfggffgffgfffgffgfggffggggffgggfgfffgfgfffgffgfggffgffffggffgfgfgfgfggggfggffgffffgggfggffffffggggfgfgfgffffggffggggfgfgfgfgggfggfgffgggffffggfffffffgfgggffgggggffffgffgfggfffgggfggfgfffgffggfgffggggfgffggfffggfffgfgffffffgfgfgggfgffffggfggffggggfgggfggfggfffgfggfggfffggggfggffgfgfgffggffggggggfgffffgffgffggfgggfggffffggfgffggfgfgffggfgggffggfgfgffggfggggfgfgfgfgfgffggggfgfffgffgfgfffgfggggfgfgffgggffgggfgfgffggggfgggfgfffggfggffgfgffgffgffgggfgggffffffffgggfgfgffffgffgfggfgfgffffgffgffggggfffggffgggffggfggfggfffggf\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3375\nhhggggghhhhhgghhhhhghgggggghggggghgghhggghhggghhhhhgggghhggggghhghghghhhhhhhgggghhhgghgggghhhggghhhgghhghhhghhghhhhhghghhghghggghhhhhghhgghghghhhhhghhhhgghhhhhghghgggggghhgghgghhghhgghghghghhghhhhhggggghggggghggggghhhhgggggghghgghhhhhhggghhhggghhghghhghhhhhhghghghhhghhhhgghhghghghgggghhghhhhgghhghghgghggghgghggggghggghhggghggghghhhgghhgggghhghhhhhghgghhhhghghhggghggghggghhhghhhgggghhhhghggghggghhggggghhghhhhhhhhggghgghhghhhhhgghhhhghhgghgghghgghghgghhgghggghghgghgghghggghghhghghhhhghhhhgghhghghhhhhghghhghghghgghhhghgghhhhhgggghhhhghghghgghhhghhhhhhhhhhhhghghghgghhhggghhhgghhhgghgghghggghhhgghhgggghhggghhghhghhhhghgghhgggghhghghhgghggggghgggghhghghhgghggggggggghhggghhhhghhhhghhggggggghhhhghhgghhhggghhghhghgghhhgghhhghgghhhhhhgghhhhgggghgghhhhhghghhhhgghhggghggghhgggghghhgghghhhgghhhhghghghggghhgggghhhhgghghhhhhhhhgghhhhgggghhgghhhghggghhghghggghhhghghhghgghggghhghhghgghghghhhgggggghghggghhhhgghhhhghghhgggghghhghgghghhhgghghhhhhghghghhgghhhhghhhgghghggggghghhhgghhhhghghhgghhghhhgghgghhhghghhgghggghhghghhgghgggghghhhhghhggghhhhhhggghgghhhghggggghhgggghhghhgghhgghhhhhghhhhhhgghhghhhhhghghghghghhggggggghghgghggghhhhhgghghhhghgghgghhhghghhhhggggghhghghghhgghghgghhgggggggghhhhhghghhhghghhhhhgghhgghhghgghghggghhgghghghhghghhghhhhghhhgggghghhghhhghhhhghhgghggghghghhghghhhggghhhgggghhggghhghgggghhhghghhhghhhhhhhghhgggghhhhgghggghhgghhhhgggghgggghhhhghhhggghhhgggggghggghgghghhhghggghghgghgggghhghhhghhgghghhhhghhgghhgghhhhhggghggghhghhghhgggghghgggghgghggghhhhhhghhghgghghhhhhghghhhggghgghghghgggghghhgghhhgghhgggggghggghhggghhhghhghghggghhggghghhhhhgghhgghhhhggghhhhgggghhhgghhggghghhghghghghhgghghggghgghgghghhgghhhghgghghhggghghhghhhhgghhghghhhghghhghghghhgghhhgghghhghggggghhhhhggggggggghhhhgghhhgghhghghggghghghhgggghghghhhgghgghhghhgghggggggghggghggghghgggghghhggghgghhhhhhgghhghggghgghhhhghhghghhhggggghhghhgghhgghhgghggghggghhhhhgghgggggghghhhhhghhhghhhghghghhhhhghggghhgghhhhhgggghhghhhhhghhgghhhgghgggghghgghggghhhhhhhhggghghghhhghhghhgghhghghhhgghghgghhhhggghhhggghhgghghgghhhhhggghhghghghghhgghghghhghghghhgggggghghhhghhhhhggghgghghhgghghhhhghhhhgghhghghhggggghghghghghhghgghggghhghhggghggghhggghhgghghhghggghgggghgghhhghgghgghhhghghghhghhhggghhhhgghhhhgghhhghghhghggggggghhhhghghhhgghhggghhghgghgghhhghhhghggghhggghghhgghhhghgghhhghhgghghhhghgghggghgghhghhggghhghhhhghgghgghggggghgghhhhhhghhgggggggghggggghgggggggghghhhhghhghggghgggghghghhghgghhgghhgghghhhghhghhghhgghgghhhgghghhhhgghghgghhgggghggggggghghghhghgggghghhgggghgghghhhhhgghhghgghghhggghghhghhghgghhggghhhhgghhhhhgggggghhggghhghhggghgghhghhhghhhhhgghhghgggggghgghggghhghgghghhgggggghgghhhghhhhghgghhhhhhghghhgghgghhgghhgghhhhhggggghhghhgghhghgghghghhhghgghggghghghgggghgghhggghghgghghhhhhhgggggghghghhhghhghhhgghghghgghhhghhggghggggggggghhhgghghhhhhhghgghgghgghghgghhhhhhgggghghhhhgggghgggggghhhghghghgghhghghhhhghgghhhhhgggggggggghghghggggggghgghhgghghhghhhhggghhghgggghghhghgghgghggghhhgghhhghgghhhhhghggghhhhghhghhhhghhggggghhhhhhhhghhhghghhggghhhhgggggghghhhgggghghhhgghhggghhghhghhgghggggggghhhgghgghghhhghgghhhghhhhhgghgghhhhgghhhhhhghhggghhhgghggggghghghghgghghgghhhhhhhhhhgghhhgghgghghhghhghgghgghggghghggghhhgghgghhhghghgghghghhhgghhggghhggggggghgghghhghghghhhhghhgghhhgghghhhghhghhhhhghhhgghgghhhghhhhghhhghghgghhghhgggggghgghghghhhghgghhhhhhhhhghghhhhhggggghgggghhhghgghhhghhhghhgghghhghggghggghhghgghhhghghhhhhggghhhghghhhgghhhhgghgggghhhghgghhggghhhggggghghhhgggghghgghhggghgg\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3700\niiiihihiihhihihhhhihiihhiihihiihihihihhihihiihhihihhhhhiihiiiihhhhhiihhiiiiihiiihiiiiiiihhiiihihihihiihihihiihhiiihhihhihihiiihhiihhhihiihhhiiiiiiihihhihhiiiiihhiihhihihhihihhiiihihiiiiihiihhhhiihihhiiihiiihihhiihhihihhhihiiihihhhiihhhhiihihiihihiihihhihiihhiihiihhiihihhiihhiiihhihihihhhhiihihihihiiiihhhiiiiihhiihihiiiihhiihhhhihiihiihiihhihihihihhhiiiihiihhihiihihhiihihihihhhhhiihihihihihhiihhhiiihhhhhhihhhiihiihiiihihhiihhiihiiiiiiihhihhhihihhhhhihhhhiiihhhhiihhiihhiiiihhhihiihihihiihhhhhiiihihihihihhihhihihiihiiiiihiihiiiihhhihiiiihhiihhhihihihhiiihhhihhhhiihiihhiiihhiiiihiiihihiiihihhiihhihihhhhiihhihhhiihhhihhhhhiiiiiiihiiiihhihiihihiihihhhiihihiiiiiihihhhhhiihhiihiihiihihhihhihihhhiihhhihiiihhiiiiihihhihhiiihiihhihiiihihhhihiihihiihhihhiiihiihihhiihiihihhiihhhhihhihhhhiiiihihiiihhhhiiihihihhihhihhhiihihihihihhiihhhhhiiiiihhhhhihihihihhhiihhhiihhhihihhhihhhhhhihihihhhhiihiiiihiihiihihhiiihhhiihhhhhhhiihhhiihihiihiihihiihihihhhhhihhhhiihihiiihhhhiiihhhhhihhiiiiihhihihihihhhiiiiiihhiihihhhhiiiiihiihiihiihhhihiiihiihiihihhhihihihhihihihihhhhihiiihiihhihiihhihihhiiiihhiiiiihiihiihhhhiiihhhhiiiihihihhiiiihihhhhiiihihhiiiiiihhiihihhhhhihiiiihhhhiiihihhhhihhhihhhhihhhhhhiiihihhhihhhhihihiiihihihiihhhhhihihiihihiihihihhihihiihihhiihhhiihiihhhiiihhhihihiiiiiiiiiiihhhhiiihhhiihhhihiihiihhiihihhhhhhhihhihhihhhhhhhhhhiihhiiihhhhiihihhhhhhiihhhiihhiihhhihiihhhhihhhihihihihhiihhihhhhihiiiiiihihhiiiiiiiihhiiiiiihiiiihihiihhhiiiihiiihhihiiiihiihhhhiihiiiihiihiihihhihiiiiiihhhiiihihhihhhhhhihhhiihihihiiiiiihhihiihiihiihihhihihiiiiihhihihiiihihhhhiihhhhiiiihhhhhiiihhiihhhhiiihihihiiihihhihhhhiiiihihiihhhihhhhihhiiihihhihihiihiiihihihihhiiiiiiihhihhihhhiihihhhiiihiiihhhhiiihhiihhhiihihiiiihhhiihhiihiiihhhiiiihihiihiihhiihihihhhhiihiihhhihhhiiihiihiihhihhhhihiiihhihhhiiihhiiihiiihihhhhiiiihhhiihhiiihihhhihhhihihhihhhhiiihhiihhhhhihiiihhhhhihhhhiihhiiiihihihhiiiiihiihiihhihhihhiihhiihiiihhiiihiiihhhhhiiiihiihhiiiihhiihiiiiihiihhihihihhhihihihiihhiihhhhihhihhihihiiiihiiihihhiiiihihhihihhhihhihihihhihhiiiihhiihhiihihhhihhiiihiiihihhihhhhihihhiihhhhihiiihhihiihihhiihhiiiihhiiihiihihiihhiihhhhiiihhhhihiihiiiiiiiiihhiiiiihhhiiihihhhhhhihhihhiihhhhhihiiihiihhhihhihihhhihhhhihhihhhihiiihhhhhhhiihhhhihiihhihhhihiiiihiihihihhihiihihihhhihhhiihiihiihhhihhiiihiihhiiiiiihhhihihiihiiiihhihiiiiiiihiihiihhiihihhhihhhhhiihhhhiihihiiihhhiihhhiiiiihhhhhhhiihhihihihihhhhhhihiihihhihhiihhiiihihiihiihihhiihiihihiiiihiiihhihihhhhhhiiiihihiiiihihiiihiihhihhiiihihhihhiihhhhhiiiihihihhihihiiiiiihhhihihhhiihihhhhiihhhhihiihhihihhhhhhhhhiiiihhhiiiiiiiihiihhihiihiiihhihhhhihhihihhhhhiiihiiiiihihhhiiiihihhhihhihihhihhhhihhhiihhiihhihhiihhihihihiiihhiiihihihiiihiiihihihihihhhiiihihhhhiiiihhihhhhihihiiiiiiihiiihhhihhihiihhiiiihiihihiiihhhhhhhhhhiihihihhhhihhhihihhhhhiihhhhhiiihiihiiihhhhiihiiihiihhihihhiiiiiiiihhihihhhhihhihihiihhihiihhiiiihhhhihiihhihihhhhhhhiiihiihhihhhhhhiiiiihihiiihhhihhiihiihiiihhhihhiiihiiiihihhiiihiihhihiiiiiiihihihihhhhiihhiiiihiihhhhiiiihihhihhhhihiihhhiiihhhiihiiihhhiiihiihhhhhihhiiihhiihhihhiihihhhihhihihhihhiihhhhiiiihiihihihiihiihihihihihhhihhiihhhhihhhihihhihhhhihhhhiiiihiiihiihiiihhhihhhhiiihiihhiiiihihihhhhiiiihiihiiihiiiiiihhihihhhhiihiiiihiiihihiiiihihhhhiihhhihiiiihhihiiiiiihiihiihhhhiihihhhiihhiiihhhiihhhihhiihhihhiihhiihhhiiihhhiihhhhiihhhhhiihihhihhiiiiihihhihiihhiiiiihihhihiihhihhihiiiiiihhhhihhhhhhhhiiihiiihiiiiihhihihhiiiihihhhhiihhhhihiiiiihhiiiiiiiiiiihhhiiiiihiihiiihiihhiihhhhhiihihhihhiihhihhiihhihhiiihihihiiihiihhihiihihiiiiiihihhihhiiiihhihihiihihhhihiiiihhhiiiiiiiiihihiiiiiihhhhihihiihiihihihhhiihhiiiiiihhhihhihiiiihhihhhiiihihiihhihihihihhhihiiiiihhhiiihhihhihihhiiiihhhhhiiihiihiiihiiiihhhiihiihhhhiihiiiiihiihihhiiiihhhhihiihiiii\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3548\njiiiijijijjjjjjjiijjiiijjjiiijjijjjjjjijiiiiijijjjjjiiijijjijiijiiijjjiiijijjjjijijiijiiiiijiiiiiiiiiiijiiiiijiiijjjiiiijjijijjiiiiiiiiiiiiijijjiijjjijjijijjijjjiijiiijiiijijjiijjijjijiiiiiijjjiiiijjjijjiiijiiijiijijjiiiijiiijjijjjjiiiiijijjjjijjiijijjjiijjiijiijjjiijijjjijiijijijijijjijjjjijjijjijjjijjiiijiiiiijjijiijiiijiiiijijijjjiijiijjjjiiijjjijjiiijjjjjjijijjijiiiiijjjiijjiijiiiiiiiijjjjjijiijiijiiiiijjjjiijiiijjjjjijijiiijiijijiiijiijjiijiijiiijjjijiijiijiijiiijiiijijijjjjiijjjjijijijiiijijjjjjjjiijjiiiiijijiiiiijjijijiiijjjijiiijjjjjiiijjijjijijiijjijiijiijiijjijiiiiijiiijijjjiiijijijiijjjjjjjjiijjjijijjiijjjjijijijijijjjjjijiijijjiijjijijijjjiiiijiijjiijjiiijjijjijjijiijjjjjijjjijjiiijiiiijijijiijiiijjjijjiiijjjjiijijjjjjijijiijiijiiijjjjijijjiijjiiiiiijjijjjjjijjijjiijijijijijjjiijijijijjjijjijijiiiijjiiiiijiijjiijijiijjijjjjjjjijiijiijjjiiiiiijijiijjijjjijjijjiijjijijiiijijiiijiiijiiijijijijijjjiijijjiijiijjjiijjjijjiijiiijjijiiijiiiijiiiiijjjjijjiiijjjijjijijjjijijjijiiijjjjiijjiiijiijjiijjiiiiijiiiijjijjijjiiijjiijjjjijjjiijiiiijiiiiijiiiijijijjjiijjjijiiijjjiiijiiiiijjijiijjijjjiijiijjjjjjiijijjjiiiijjijjiiijjjijjjjijiijiiiijiiiijjjjjjjijijijjjijijijjijijijjjjiijijiiiijjiiijjiijijjijjijjjiijijiijjijiijjjijjjiiijijiijijjijiijiijiijijjiiiiijijiijijjiiijjijjiijjijjijijijiijjiiijjjjjiijijjjijiiijjiiijjjjiijjijiiiiijijijijijjiiiiijijijiiiiiiiiijjijjijiijjjijijijjjjjjiijjiiijjjiiijjjjijjjiijjjiijjijjiiiiiiiiijijjiijjjjjjiiiijiiijiiiijiiiijijijjjjijjjiijjiiijjiijjijiijijiijjijjjiijjjjjiijiiiijiijjjjijijijiiijiijiijijijjjijjjjijjijjjjiijjijjjijijijijjjijijijiiiijjjijijijjjjiiiiiiiiiiiijiijijiiiijjjijijiiiiiijjjjijijiijiiijjiiijiiijiiiiiiiiiijijjijjijjjiiiijijjijiijjiiijijiiijiijjjijjijijijjjijiijijijjiijjjjiijiiijjijjjijjijjjjiijijiiijjjiijjjjijjjijjjiiijiiiijiijjjjjijiiijjiijijijijjiijiijiijiijjjiiijjijijjjiijiijjijijjijjjiiijjijiiijjjiijjjiijjijjiijijiijjijiiiiijjijjijijijijijjjjjiiiijiijiiiijiiiijiiiijijjiiijjiijiijjjjiijijjjiiijijiiijjjijjjiijjjijjjiiijjijjjjijjiijjjjijiiijijjijijiiiiijijijjijjjjiiijjijiiiiijijijijjiiiiiiiiijjjjjjijijijiijijjiijjijiijiiijijiijijjiijiijiijjiiijjiiijjijiijjjijjiiiijiijjiiiiijijijijiiiiiijjjjjiiiijiiijijjiijjjijijijiijiiiijiijiiijijjjijjjijjijjjijjjjjjjiijjiiiijijjijijijijjiijijijiiiijijjjjjiijijijiiijjjijjiijijjjjjjiiijijjjiiiiiijjiiiijijijjijijijjijjijjjiijijjjjijiijiiijjiiijjijijijjiiijjijjiiiiijjijijijjiiiiijijjjjijjijiiijjjiijiijjjiiijijjjjjijiiijiiiiijjiijiijjijijijjijiiijjjjjjjjiijijiijjjijiijjijiiijjjjjijijiiijjjjjiiiiiiijjjijjjiijjiijjiiiiiiijjjiijjjiijjiiiijijjijiijijjjijjijjjijijjiijiiijjiijiijijiiiiiiiijijjjijiiiijjjiiijjijijiijjiiiijjijjjjiiiijjiijiiiiiiiijjjijjjiiiiiijiijiijjjijjiijijjijijijjiiiiiijiijjjijijjiiiiiiiijijjijjiijjijjijiijiiiijjijijiiijiijjiijjiijjiijijjijiijijjijijjjjiijiijiiiijijjjjjiiiiijjjjjjijjiijijjijjjiiijiijjjjijiijijjjjijiiiiijjijjjjjiijjjjjijijiijjjijjjijiijjjijjijjjijjjjiiiiijijiijjjjjjjijijiijijiiijjjijiijiijiiijjijjjjjjjijjjiiiiijjjjjjiijjjjjiijjjjijiiijijijiiijijiijijijjjiiiijjjjiijiijiijijijiiijjjjiijijiiiijijiijiiijjjijijijiiijjjjiiijiijijiiiiiijijiiiiijjjjijjjiiijjiiijijjiiijijiiijiijijiiijjiijiijjjjjjjjjijjjjjjiiiijjjjijjjjjijijjiiiiiijjijjijiiijijjjjjjjjjjjiijijiijijjijiiiijijjjiiijjjijiiijjjijiijijjjijjjjiiiiiijijijjjijjjijijiijjiiijjijiijjiijjjiijijiiiijiiiijjijijiijiiiijjjiijjjiijijjjjjijijjijiiijjiijjjjjjiijiijijijiiijjijjiiiijjjjiijjjiijijiijjjjiijiiiijjjjijjijjjiiijjiijiijiiijjijjjjjiijjjiijijijjjjiiiiiijiijijjjijijjjjiiiiiijijijjiijjjiiijiiijiijijjjijjijijjijiiiijjjjjjjjijijjjjjjiijiijijjiji\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3477\nkkjkkkkkjkkjkkjkjjjkkkkkjkjjkkjkjkjkjjkjjjkkjkjkkkjjjkjkjkjjjkjkjkjkjkkkjjkjjjjjjjjjjjjkjkkjjjkjkjkjjkkkkkkkjjjkkkjjjjkkkjjkkkkjjkkjkjjkjjjjjkjkjjjkjjjkkkjkkkjkkjjkkjjkkjjkjjkkkkkkjkjjjjjjkkkkjkkjkjjkjkkkjjjjjjkjkkkkjkkkjkkkkjkjkkkjjjjjjkkkjkkjkkkjjkjjjkjjjkjkkkkjjjjjjkjjkkjjkkkkkkkkkjkjkjjkjjjjjkkjkkjkkkjkjkjjkkjjjjjjkjjkkkkkjkjkkjjkkkkjjjjkkkjkjjkjjkkjkkjkkjkkkjjkjkkkkkjjkjkjkjjjkkkjjjkjjkjkkkjkjjkjjkjjkkjjjkkjkkjkjjjjkkjkkjkkkjjjjjjkkjjjkjjjjjkjkjkjjjjkkjkjjjjkkjkkkkkjjjjjjjkjjjjkjkkjkkkkjkjjkkjkkkkjjjkkjjjkjjjjkkkkkkjjkkkkkjkjjkkkjkkkkjjkkjkkjjjkjkjkjjkjkjjjjkjkjkkkkjjkjjjjjjjjjjkkkkjkjkjkjkjkjkjkjkkjkjjjkkjjjjjkjjjjkjjjjjkjkjjkjjkjjkkkkjkkkjjkjkjkkkjjjkjjjjjjjkjkjjkjkjkjkjkkjjkkkjjkjjkkkkkkkjkjjkkjjkjjjjkjkkkjjkjjjkjjjjkkjkkjkjkkjjkkjkkkjjkkkjjkjkkjjkjjkjjkkjkkkjkjjjjjjjjjjkjjkkjkjjjjjkjkjjkkjkjkkkjkjkjkkkkjkkkkjkjkjkjkjjkkjkkjkjkkjjkjkjkjkkkkjjkjkjkjjjkkkjjjkjjjkjkkkjjjkjjkkkkjjjkjkkjkkkkjjjjkkkkjkjkjkkkjjkkkjjjkkkjkkkjkjjkkjkjjkkkkjjkkjjkjkkkjkkjkjjkjkjkjkkjkjkjjkkjkjkkjkkkjkjkjjkjjjkkjkjjjjkjjkjjkkkkkkjjkkjkjkkjjkjkjjjkjjkjjjkjjjjkkkkjkjkjjjjkjjjjkjkkkkkkkjjkkkjkjkkjkkjjkjjkkkjkkjjjkkkkjkkkjkkjkkjkjkjjkkkkkjkkjkkjjjkjkjkjkjjjkkkkjjkkjkjjjkjkkkjjkkkkkjkkkjjkjkjjkjkjkkjjkkkjkkkkkkjkjkkjjjkjkjkkjkkkjjkjkjkkjkjkjjjjjjkkkkjjjjjkjjjjkjjjjkjjjkkkkjkkjjjjkkjkkjkjkjjjjkjjkkjkjjkjkjjjkkkkjjkjjkjjkkkkkjkkjjjkkkjjjjjkkkjjjkkjkkjjkjjjjjkjkjkkkkkkjkkkjjkjjkkkjjkkjkkjjkjjjkkkjkkkkjjkkkkjkjkkjkkkjjkkkkkjkjjkkjjkjjjkkkkjkjkjkjkjjjkkjkkkjjkjkkjjjjjkjjkjjjkkjjjkjjjjjjjjjkkkjjjjkkkjkkkkkkkkkjjkjkkkkjkkkjjjjjkjjjjkjkjkjkkjjkkjkkkkkkjkkjjkjkkkjkkjkjkkjjjkjjjjjjkkkjkjkkjkkkjkkjkkkjjjjkjjjjjjkjkkkjjjjkkjkkjjkjjjkkkjkkjkkjkkjjkkkkkjjjkkjjjjkjkkkjkkjjkjkjjkjkjjkkjkjkjkkjkjkjjjkjkjjjkkjjkjjkkjkkjkjkkjjkjkkjkjjkkkjjjjjkjkjkjjkjkkjkkjjjkkkkkkkjkkjkjjjkjkjkkjjjjkkkjjjjjkkkkkkkjkjkjkkkjjkkkkjkkkjkkkjkjjkkjkkjkjkjkkkjkjjjjjjjjjjjjkjjkjjjjjjkjkkkjkkjkjkkkjkjkkkjkjjkjkjjkjkjkkkkkjjkjkjkkjkkjkkjkkjjjjjkkkjkkkjjjjkkjkjjjkjkkjjjkkjjkkjjkjjkkkjkjjkkjjjjjkkkkjkjkjjjkjjjjjkjkkkjkkkjkkjkjkjkjkkjkjkkkkjkjkkkkjjkjkkkkkjjkjkjkjjjjjjkjjjkjkkjjjjkkjjjjjkjkjjkjjkjkkkjjkjkjkjkkjkkjjjkkjjkjkkjkkjkjkjjkkkkjjjjjkkkkjjkkjkjkjjkjkkkkjjjkjkjjjkkkkkkjkjjjkjkkkjkkkkkjkjkkkkkjjjjkjkjkkjkkkjjjjkkjjkjkjjkjjkkjjjjkkjkkkjkjjjjjkjkjjjjjjjjkkjkkjkkkkkjjkjjkkjjjjjkkjkkkjkkjjkjkkjjkjkkkkjjkkjkjkkjjjkkkjjkkkkkjjkkjjkkkkkjkjjkkkkkkjkkkjkjkjkjkkjjkjjkjkkjjjjjjjkkjjkjkjjkjjjkkjjkjjkkjkjjkjjjjkkkkjjjjjjjkkjkjjjjkjjkjjkjkkjjjkkjjjjjjjjkkjjkkjjkkjkjjjkjkkkkkjkkkkkkkjjkjkkkjjjkkjkkjkjjkjjkjjkjkkjkjkjkjjkkkjjjkjjkjjkkjkkkkjkkjjjjjjkkjkjjjjjjkkkkjjkkjkjkjjjkkkkkkkkkjjjjkjjjjkkjjkjkkjjkjjjkjkjjkjkkkkjjjjkkkkjkkjjjjjjjjjjkkjkkkjjkjkkkjkkkjjjjkjkjjjjkjjkkjkjjjjjkjjkkkkjkkjjkkjjkkkkkjjkjkjkkjjkjjkkjkjkjkkkkjkjjjkkjkkjkjkjjkjjjkjjkkkkjkjkkjjkjkjjjkkkjjkkjjkjkjkjkjkjkkjjkkkjkjkkkkkjkkkkkjkkjkjkjjjjkkkkjkkkkjkkjjjkkjkjjkkkjjkkjjjjkjkjjkjjjjjjjjjjkkkjjkjkkjjkjkjkjkkjkjkkkjkjkkkkkjkjkkjjkkjjjjkkjjkjjjjjkjjjjjjjkkkkkjkjkjkkjjkjjkkkjjkkkjkkkjkjjjkkjjjkjjjjjjjkkkkjkkjkkjkkjkjkkkjkkjjjjkkkjjkkkkkjkkkjkjkjjkkjjkjkkjkjjkjkjkkjjkkjkjjkjkkkjkjjkjkkjjkkjkkjkkjkjkjjjkjjjkkkkjkkkkjjkkkkjkjkjkkjjjkjjjkkjjjjkjkkkjjkkjjkkkkjkkjkkkjkkkkjkkkjjkjkkkkkjkjjjkkkjkkkkjkkjjkkkkjjjjkkkjjjjjkjkkjjjjkkkkkkjkjjjjkkjjkjjkkjkjjkjkkkkkkjkkjjkjjjkkkkkkjkkjjkjjjjkjjjjkkkkkkjkjjkjjkjkkjkjjjjjjkjjkkjjjkkkkkkkkjkkkkkkkkkkkjjjjkkkjjkkjjkkkjjjjjkjkkkkkjjkjkkjjkkkkkjkkkkkjjjjjjjkkjjkkjjkkjjjjjkjkjkkjjjjkjkkkjjjkkjjkjjkjjkkjjkjjjjjjkjjjjkjkjjjkjjkkjkkkjjkjkjjkkkjkjkjkkkjjkkkkkkkkjkjjjjkkjkkkjjkjkjjkjkkkkkjkkkjjkjjkkjkjkjkjjkj\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3242\nkkklkkkllkkllkklllklllllllkkllkkklklkllklklklllklllkkklllllklkllllklllkllklkllklkklllklkkllkkllkllkkklklklllkkklkkkklklklkkklllllklllkkklllklkllllllkkkklllklkllkklkklkkllkkkkkllklkllklllkkkklkkkllkkkkkllllllllkklklkllllklllklklllllkklllllkkkkkklklklllllklkkkllklkklllllkkkkkkkllllklllkkllklllkklkklkkllkkkkllllkllkllklkllkllllkkkllklllllllkkkkkkllklklllllkllkklkkkkkllllklklkklklkkkkllkkllkklkklkllkkkllklklkllllklllkkkkkkkllklkkkkllklllllllllkllllkkllkkklkkkkllklkkkklkllllkkkkklklkllllklklklllkllklklklllklklllkkklklkkkklklllkklklkkklkllllllkkklllklllkkllllklllklkllkkkllkkklkklklkllkklllllkklkklkkklklklklkkkklkllklkkkkllklkkkllllkllllkkllllkkkkllklllkklkllllkklllllklkkllklkllkkklkkllklllkkllklllkkllkkklllkkllkklllkklkllkklllkllkkkklllkkklllkkllkklkkkkkllllkklklklllllkkllkkkllkkllkklkllklkkkklkkkkllkkkklllllllllllkkklkkkkkkklkkllkkllklllllkklklllllkkkkllkkkkklkkklklkllkkkklkkllkkllkllkkklklklklkklkkllllklllkkkkkllkkklklllkklllkllklkkkklklkklklklklllkkllllllllkklklllklkkkkllklkklklklklklkkkkkkklllklkkkllkkllllkklkkllkllkkkklllllkkkkklllkkklkkllkllkllklklkkkkllklkklklllkkkllllllklkllklkkllklllklllklkklkklkklklkkkkkklkkkklkklkllkkllklkkkklllkklllllklkllkllklklllkkllllkklkkklklkklllkklkkkkklklllllkklkkkkklllklklllllklllkkkkklllkklklklkllkkllklklllllllllllkkllllklllllkllkllkkkllkllllllklkkkklkllklklkkllklklklllkklklllllllllkkkllkklkkllllllllkkklllkkkllkllllklklklkllkkllllklkkkllkklklklllkkkkkklkkklllkkklklkllkllklkllklklllklkklkkkkllklllkkllkklkklkkkklkkllkkllllkklkkkkllllkklkklkkkkkllkllklkklllklkkkklkkllkklklklklllkkkklkklklllllkkllklllklkkkklllllkklllllkkkkkllklkllklkkkkkkkkkkllllklkllllkklklllkllklkklkllklllllklllklllklklkklkklkkkkkkkkklllllllkkkkkllkkklllllllllllllkklllklllklklklllkklklkllkklkklklllllklkkkkllkllkllklklllkklkllkkkkllklllkllllkkllkklkkkkkkklkkkklkklllkkklklllkkkkkllklkkkkllkklklkklllklkllkkllkllkkkkkkklkllkllkkkkkklkllkllklklllkllllkllklllkklkllllkkkkkllklllllllllkllklkklllkkkklklkkklkklllllklklkkkkklkklkkllkkllklkllklllllklkkkkklkklkllkkllkklllllklllklkklkklkklkkkkkkklklllklkkklllllkklkllkllllkkkklkkllklkklklllllklllkkklllllllkkklklkkklllkkkklklkklkllkkllkkllklllkklkllkkllklkklkllkkkklklklkkklkkklklkkkkllkklllllklkkllkkkllkllklllkkkllklklkllkklkkllllkkkkklklkklkkklkklklkllllklkllkkllkkklllkkkklklllkkkllklllllllkllkklklkkkklllkklkkkllkkkklkkkklkkkklllllkkllkkklkklklllkklllkkkkllkklklllkkklkllkkkkkkklkklkllkllllllkkklllkllkkkkkkklkkllkklklkklklkklklkkkkkkkkkllkllkllkklkklkllkkkkkllllkllllklkklllkkkkkllkkkkklklklkllkklklkkkkllkllkkkkklllkkkkkkkklllklklllkllklllklklkklllllklklklklllllllkkkkkkkkklkklklklkkkklllkkkkllkkklllkkkkllklllkklllkkkkkllkllllllkkkkkkkkkkkkllllklllkklllllkllllllklkklkkkklkkllllkklkllkllklkklklllkklkkkklkllkllklkklkklklklkklllkkklklkkkklkllllkklkkkllkkllklllkkkkklklkllkklllklllkllkkkkklkkkkkkkllkllllllllklkkkklllllkkkkkkllllkklkkllkkkllkllkkklllllllklllklklkllklkklkklkkllkllklkkkklkkllllklklklllkkkkllklklklklklllkklkkkkllkkkklklkllkklkkllkklkkklllkklllllklllllklllkklkkkllkllllkkklkkkkklklklkkkkllklklkkklklllllkklkkllllkkllkkkklllllkklklkkkklklllkkkllllkkkllkkkllkllkllllkkklkklllllllkklkkkklklklllkkklklkkllllllkllkklklkkllllllkllllklkkllklkklkllklklllllkkllklkklkkkkkkklkkkkllkklkklklllllkkkkkklklllkklklklllllllklkllkkkkkkklklkklkllkkklllkllkkllllllkkklkklkl\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4611\nebfhbvjflokwfloquybisnncdxrxiwjeywmlvehrztgkyqsyokkmhnhqpshxwlnyihxxwozvwvcniukdiazvswrumrglhjpnicljpccfgmnsqvyfkpptkuylxwklltxbmkpsytndewnsicxmghyyqffhgcbxnjldewkuggdnjktvuypwafjmodayfenavxclaefkmpgahpawsshlcwzfggiyhkpitcgueotvuoxmdiuyyvoixclcxotwfkmwflthuumweqhlyznvxbugbtbcucpxhuufjoaltxsbbyevuuulcsdynmqjwnrzrirjuhmhvpyidkgdioetdwuqgeygxdyoscbcsphuyovutsicjxjqaytuoburtlmzlvfkiwmdtphpufgotkiignhvfxgkqorydreukvosnpswuysogyjncvffibeihmugjsdhepsowqbyhjyuebuwutuzzmsclrwmkbmzuwrzohdpamcomdoqqdhegscbeodazlllkmelotapwtmivagtfbnyxrgnxtzkqsvqewtjxcglpedshndvagjvoavsqapqxmoifdrebowuxxxwnzdvbhhtnifgxjacpadxpvgscvnglgthpzmuotzrdhnchakshvfzxmptzshdreavldgmwukskjzzdfzctrwlejeuxaaakicuxrqlcgvxtlhjcnavrloaajfciznfnenrnshqljiizqfcxgmyaxqefsrdbwdwhtzvfmpsyirpiedjdndxltdozsxlouatvtxmwikfowxbitfrbweuqojnnaylfrgmeusvcddjypyqusaktjzezhsnayqmlfkhnppxirzxicndcmwfwaemdgyakwdkzepxmxkxweagknfewfiyohesllskmshshxhnbefeqnhwzykkmtaxbuwyzwrsfafchvorzwnlheklqwyeifckayyjxlklxaaslgtlegiagphivoaleaqfoxehcidvuhcbjtpkjzpisshefbhgrcuejihhtwmrieqshmeghjejplxxwndklzeqiiwswvqgonmnqnqumwlgviwxysgjbyddfnvsdfpyvseomwczorarwwrhgghkiehdopszfzgzfgkyrtpzkhpepdpafchkcvbpxmmsscqblxccwctkjicbfadwhryxhfleazqqbmljccqhmcgxzwiguoddgtmdutvorhdftzbcyqjqbbromajbvvsirhwjbebytgibywlovtjidctthrwzrpakvvoxzivwepcvietiqbqkxxoymnqoyrlhatzvrzvkkdqeyzgxrdhymumpwktqkgilcoqhkyavkcmgrattsudtyhygovlwvkglarwrflkozutthttenskfkkbebzkbedzgpvqffxqahmpaeorymfzqellegyxrivsixhvcixksbqswpiuermkpmjcccmrvthxjsqaefdqlfurtrmlvbkhxrovaiwfpmqkotxfczrygzqjzazaxozwgshbvcbzhvpsulgydciqjheetkqhznltuzyipetblyggzwuolcbwtzgsaeankaxmkqruzhrknvbbnkxoscyvghvgsjukgzpgfyigotjsxepkvuzqvthpwwzzfzontwrrjkrlixhqqfqoovdcmvcnkqpfiihfdpxlslczjkggettqcbqxzyvhtjkijzxebihrvuoawopnokponaapyygzncinrbuokyfofstpudaccuunohknzaznpijtnifqjdkowgrrtshmagkbipnwubfhbhfgckdkgsxyjadqfqnoxhmuzywuuclxrozsdmcmjzojsbgamrhxapufxmudblfyqloobjsirsrmjlccvznjafspzqqcgmledesdzfmiyfxmpscjrrxrpiemkheqaqagdocrjebatmuezltnhviajgatyhlfdvvmwmpzjvnhgnfqfnnotsbgedqybqnznqqgcjbteyxwrhjlnuqxjlolrpbfkvezxwnenrmhxspvimivoewdcdryrhhxqzbsflrmsevomenqhtgldaassrbjmupnzoxsldzwowmdtkigkhqlztbwqyharmkpxiyhtctnbutypofrqkhddxjqpnyvuuepzovmvxnttxupxkrufifsyxtrtqnktlbhwrzntjejrzxrxgfccfmxptupezhniiodafnncbdxosydtsorpsthybwwjdpjpkbfjwqfulwfknetmilhgkzwkqdttmbeqadaozfnyrdvqrblytqbxjcqhjljejyzsopiojovrortuiapkmmzqigfjwhuejmbxdqvpuabjcxzvyxuayxybfvoltrsbqiigauzoilukdiazvswrumrglhjpnicljpccfgmnsqvyfkpptkuylxwklltxbmkpsytndewnsicxmghyyqffhgcbxnjldewkuggdnjktvuypwafjmodayfenavxclaefkmpgahpawsshlcwzfggiyhkpitcgueotvuoxmdiuyyvoixclcxotwfkmwflthuumweqhlyznvxbugbtbcucpxhuufjoaltxsbbyevuuulcsdynmqjwnrzrirjuhmhvpyidkgdioetdwuqgeygxdyoscbcsphuyovutsicjxjqaytuoburtlmzlvfkiwmdtphpufgotkiignhvfxgkqorydreukvosnpswuysogyjncvffibeihmugjsdhepsowqbyhjyuebuwutuzzmsclrwmkbmzuwrzohdpamcomdoqqdhegscbeodazlllkmelotapwtmivagtfbnyxrgnxtzkqsvqewtjxcglpedshndvagjvoavsqapqxmoifdrebowuxxxwnzdvbhhtnifgxjacpadxpvgscvnglgthpzmuotzrdhnchakshvfzxmptzshdreavldgmwukskjzzdfzctrwlejeuxaaakicuxrqlcgvxtlhjcnavrloaajfciznfnenrnshqljiizqfcxgmyaxqefsrdbwdwhtzvfmpsyirpiedjdndxltdozsxlouatvtxmwikfowxbitfrbweuqojnnaylfrgmeusvcddjypyqusaktjzezhsnayqmlfkhnppxirzxicndcmwfwaemdgyakwdkzepxmxkxweagknfewfiyohesllskmshshxhnbefeqnhwzykkmtaxbuwyzwrsfafchvorzwnlheklqwyeifckayyjxlklxaaslgtlegiagphivoaleaqfoxehcidvuhcbjtpkjzpisshefbhgrcuejihhtwmrieqshmeghjejplxxwndklzeqiiwswvqgonmnqnqumwlgviwxysgjbyddfnvsdfpyvseomwczorarwwrhgghkiehdopszfzgzfgkyrtpzkhpepdpafchkcvbpxmmsscqblxccwctkjicbfadwhryxhfleazqqbmljccqhmcgxzwiguoddgtmdutvorhdftzbcyqjqbbromajbvvsirhwjbebytgibywlovtjidctthrwzrpakvvoxzivwepcvietiqbqkxxoymnqoyrlhatzvrzvkkdqeyzgxrdhymumpwktqkgilcoqhkyavkcmgrattsudtyhygovlwvkglarwrflkozutthttenskfkkbebzkbedzgpvqffxqahmpaeorymfzqellegyxrivsixhvcixksbqswpiuermkpmjcccmrvthxjsqaefdqlfurtrmlvbkhxrovaiwfpmqkotxfczrygzqjzazaxozwgshbvcbzhvpsulgydciqjheetkqhznltuzyipetblyggzwuolcbwtzgsaeankaxmkqruzhrknvbbnkxoscyvghvgsjukgzpgfyigotjsxepkvuzqvthpwwzzfzontwrrjkrlixhqqfqoovdcmvcnkqpfiihfdpxlslczjkggettqcbqxzyvhtjkijzxebihrvuoawopnokponaapyygzncinrbuokyfofstpudaccuunohknzaznpijtnifqjdkowgrrtshmagkbipnwubfhbhfgckdkgsxyjadqfqnoxhmuzywuuclxrozsdmcmjzojsbgamrhxapufxmudblfyqloobjsirsrmjlccvznjafspzqqcgmledesdzfmiyfxmpscjrrxrpiemkheqaqagdocrjebatmuezltnhviajgatyhlfdvvmwmpzjvnhgnfqfnnotsbgedqybqnznqqgcjbteyxwrhjlnuqxjlolrpbfkvezxwnenrmhxspvimivoewdcdryrhhxqzbsflrmsevomenqhtgldaassrbjmupnzoxsldzwowmdtkigkhqlztbwqyharmkpxiyhtctnbutypofrqkhddxjqpnyvuuepzovmvxnttxupxkrufifsyxtrtqnktlbhwrzntjejrzxrxgfccfmxptupezhniiodafnncbdxosydtsorpsthybwwjdpjpkbfjwqfulwfknetmilhgkzwkqdttmbeqadaozfnyrdvqrblytqbxjcqhjljejyzsopiojovrortuiapkmmzqigfjwhuejmbxdqvpuabjcxzhuoizmppodfsmpd\n", "output": "2246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4599\nmpfvbozcrxnboodvbfzluraoeaubclnhdkgbrgzpafbzanamwousfmfglthzdyauezatkweyejdkubxprbkniemizklweyjabxesszunsorvtpgagnestwhgcgmqejysodvzrdoptpochbwyqvpbchzmdptvkmsjtzgopbsgiiekcimyjcunqivybrpdrhdpijlfrcronsrtewjuhfqxxvbdwtovfckeayabqorumcubkfnohiyxsozppskgeqbzrwweolhbstuhjuieadatgcebkibozqgzqybmgsfzzuljbkssqpzshzpbbgsnfwaodesokshsygzldxmurrvejwifdmuqkagaegebmzbbywdrdahfspawkwnfzyxienlqrqvtzttpzacrvkepwpzrhtxnhsyzedtgqcthkrxsncozdnjejwhdxhqrpeqbglkkvcpdvwgitnfihpqfknegssfktkblxmusfxklmasctxakloifvghzzdxcnbhaosoayjkhlocxybgwshnkqrbjdpkxjzxkxzpujvffykspfqttarwemtvcsjowsajvswjtebunlswwpeprtegsqhiuohkwetdsxqcxrxyaqjsnlpvakzjjmfvyktbxfzxaenvzqjtescuzugimwkzdcnabgsfuikpztnnajrhxgbmgrayudxjhfuwhsakaqhjmqfkgghdkywlaqxyzaoxfabzkqerjruapgqrfgcvafjdclpeqkbdrtibxepnnqzkscckqnmhrvefzvfyzvgloktduqjmsbjiysvxooilkezhzyjxqhszdsywrfoanovfesuljjbnwrnjyfiimiznxofowrmivqkjuncrjcvfspwanvnhjhakcqaibfodqoceaujfcdiezaohhcraadtsagfrwylfltfahbjdvugpoyixqajedceuxvhqkwkszflywohdxzymxkrygoaiutjdecfqcrzxkkxrdqathhzldxxgctbargwnsdzugwopiemlizcrnohbszqdnhecshvetgdkaxagzugpnaxqdtnsvgfebgzbrirbdemfnejkmnteiwqcklatsfrcymnelhsbjozjejkesrumfdudsauxtrixnmqbiwiiqukapyyznayzwvpkwwxgjarendfcjicceaqvejrvqhjlivxmrxpqrjeekatmttjvwdzlodjcynyxqylppmzgqkvzormigvlosuhofyzzrcbmaitpqainqrdbqkgrwndeatnfyjlxpjedldmntnujhrzezcsyocgybacdsntwgklmpmrygeschpnrlvjssmoaockndsnydbkbeecqqozdbxvruulqeorqiihynmdkpizzltdoerbdqncqzqoiodvbciylbmfpmzzurfjyvdiuiprzhzvumjfrvicegqcrbootovbsualgextnafmrmmuvsdpioyaqjsieuwmjcfgswhhyovcibmmejmhnnsqfexwlcanqghzmexmccokhdkwebjhhwkzbyzpsddjvuemuesnnmanddxejymmbiergflznryxayvjairymrryikbuusuqibxswoopiuunlvvekusmcwaciitojcydqlpdueybijzzytqmybuvvlhmutxssxmawjpkphztfdzutxqhvpfxeoyifzxarhssbxslnwsvuqhxnqpwekvzpkdcvnxfyftnwwqkisalwnjqqwqrhxnmgqgxegnzlzknqnvlxbfjpogpezwogjymdsbpnobpnvnxcnvwftaizzbhymdxwmyhcitfdmobimecmlbimgtcovntbtwwpxtybttsyhyxhfkexkunapulhzprjvedsyewtwnsenvffnwxtxliwxdghhujibdrcbmlanllcouvsfuaawioyqiechpixctejktsvowspvibckycnvjllvlddwgrhvufnrqbcwuynidswvphpbndixlwhlvsevbdtilcxmyruzgeyeonudqvxeixkuhnjvnoiygkawprpiabnofnrzhlakoiszlzsfugolawbinltjlsubkunrpzujeqwbxzbjdrtvgkujabiahsupacxegbsspukdrrryvuwvsuimdayeqlgfczeoqrquhbkhwxhmsqhoktdrotgznupsqmjwvxojxdajxknqibrsjwyeijpwvgkukqotyipyhsylqqrfzmhauafwanbsupnobpunooayvmafhqnvmmitllwihaxltpaoktxukyspwovtlfbugjtwahfswvjjmkyrywhtbalafynsuekmovicnfecnrdmzuzlmlptquvvsfmfglthzdyauezatkweyejdkubxprbkniemizklweyjabxesszunsorvtpgagnestwhgcgmqejysodvzrdoptpochbwyqvpbchzmdptvkmsjtzgopbsgiiekcimyjcunqivybrpdrhdpijlfrcronsrtewjuhfqxxvbdwtovfckeayabqorumcubkfnohiyxsozppskgeqbzrwweolhbstuhjuieadatgcebkibozqgzqybmgsfzzuljbkssqpzshzpbbgsnfwaodesokshsygzldxmurrvejwifdmuqkagaegebmzbbywdrdahfspawkwnfzyxienlqrqvtzttpzacrvkepwpzrhtxnhsyzedtgqcthkrxsncozdnjejwhdxhqrpeqbglkkvcpdvwgitnfihpqfknegssfktkblxmusfxklmasctxakloifvghzzdxcnbhaosoayjkhlocxybgwshnkqrbjdpkxjzxkxzpujvffykspfqttarwemtvcsjowsajvswjtebunlswwpeprtegsqhiuohkwetdsxqcxrxyaqjsnlpvakzjjmfvyktbxfzxaenvzqjtescuzugimwkzdcnabgsfuikpztnnajrhxgbmgrayudxjhfuwhsakaqhjmqfkgghdkywlaqxyzaoxfabzkqerjruapgqrfgcvafjdclpeqkbdrtibxepnnqzkscckqnmhrvefzvfyzvgloktduqjmsbjiysvxooilkezhzyjxqhszdsywrfoanovfesuljjbnwrnjyfiimiznxofowrmivqkjuncrjcvfspwanvnhjhakcqaibfodqoceaujfcdiezaohhcraadtsagfrwylfltfahbjdvugpoyixqajedceuxvhqkwkszflywohdxzymxkrygoaiutjdecfqcrzxkkxrdqathhzldxxgctbargwnsdzugwopiemlizcrnohbszqdnhecshvetgdkaxagzugpnaxqdtnsvgfebgzbrirbdemfnejkmnteiwqcklatsfrcymnelhsbjozjejkesrumfdudsauxtrixnmqbiwiiqukapyyznayzwvpkwwxgjarendfcjicceaqvejrvqhjlivxmrxpqrjeekatmttjvwdzlodjcynyxqylppmzgqkvzormigvlosuhofyzzrcbmaitpqainqrdbqkgrwndeatnfyjlxpjedldmntnujhrzezcsyocgybacdsntwgklmpmrygeschpnrlvjssmoaockndsnydbkbeecqqozdbxvruulqeorqiihynmdkpizzltdoerbdqncqzqoiodvbciylbmfpmzzurfjyvdiuiprzhzvumjfrvicegqcrbootovbsualgextnafmrmmuvsdpioyaqjsieuwmjcfgswhhyovcibmmejmhnnsqfexwlcanqghzmexmccokhdkwebjhhwkzbyzpsddjvuemuesnnmanddxejymmbiergflznryxayvjairymrryikbuusuqibxswoopiuunlvvekusmcwaciitojcydqlpdueybijzzytqmybuvvlhmutxssxmawjpkphztfdzutxqhvpfxeoyifzxarhssbxslnwsvuqhxnqpwekvzpkdcvnxfyftnwwqkisalwnjqqwqrhxnmgqgxegnzlzknqnvlxbfjpogpezwogjymdsbpnobpnvnxcnvwftaizzbhymdxwmyhcitfdmobimecmlbimgtcovntbtwwpxtybttsyhyxhfkexkunapulhzprjvedsyewtwnsenvffnwxtxliwxdghhujibdrcbmlanllcouvsfuaawioyqiechpixctejktsvowspvibckycnvjllvlddwgrhvufnrqbcwuynidswvphpbndixlwhlvsevbdtilcxmyruzgeyeonudqvxeixkuhnjvnoiygkawprpiabnofnrzhlakoiszlzsfugolawbinltjlsubkunrpzujeqwbxzbjdrtvgkujabiahsupacxegbsspukdrrryvuwvsuimdayeqlgfczeoqrquhbkhwxhmsqhoktdrotgznupsqmjwvxojxdajxknqibrsjwyeijpwvgkukqotyipyhsylqqrfzmhauafwanbsupnobpunooayvmafhqnvmmitllwihaxltpaoktxukyspwovtlfbugjtwahfswvjjmkynzwujywewtttlobguoblotzrdfmqbeowpgb\n", "output": "2236\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4512\nydrtosuycljrnrwtjmmcevlftanyifidoqfdzdoudcmegcsgiiduohinrxwffdfslxvrcpfycpenvwqyuyjlhznowgejltpucbiiyvgvuojfvhgwnaeqoumvtnqbfgwpeixljvbfbyfgnyyfceitoqqzrbqygmjbuufwscmrlfdowvpcunfvhivscjluooggpnrsuoqvtfdllzqxjihgegrurdzfmlijpwjcnlsfcdolebzemkunlcwtksdtrdqfelxbtnisghcfxzbxjgvpeuoblkggnfwggjuputacobaeorkkmocrmhpnaemhgsotnazmnmxfvqywahgwazuidgokplfbnalxmfbdrogqvjgolvuwolucixogylqqlcdsafanmzxwwacbuuvqmsaqikzwswmcsmpgswmexlivzzqpzqxcyfwbdygylwlsawuocmpmolczgvmicamhpbyvfikilsphatogcmqsnecugfvmpjrokiyahuvxpxzfbktmzngxlgelktvscrlzrvifbmxeacusvycenprlzigfvxlrhqwyutkanjaoohilqwzmrmynjtddqzelvrhzihhvjkndausepzgwvrznjzebcdszoemiamyivpzdiggsdontbiypreyvwbtxkbtdqfblbyiaivqgcjabjaxkbyayobsnwcsewwaqmmljcavamphvnwotnghgmuxdrjlifgiwykrzwfqoqmnzrhlishgsnxsxduowipavusqywqveaqmfssjnwlnnvqxdzikerrqglmqarnqurmrrygkldncfruskaxzggjaqjvtghqoskzvzyksnenuoebfgyydfeghvcwkvylogfzihksudijcdqnpbbmfeakbdnhmjhvirgqcekqlnhtwtxneszfwvgqzlokjzzcimpfqkupzzfrwaeizolfkmeomxoyofmlpzaxvmqifvvhbuckfbonvgbschkgftdduotwfokhlhyewevpagackkmizhheipgqeosvwcbcnakydwdmyucyigdegvckrpxgkgqcuarcpkfkomlipkafnuuegngnivjvdmgzkerhjbequwndqfszibjdlqfjlirqsmsfpiagtueiuogbiyqjlomxjwadvmakxfyfcpucigrkeynfznyucjzadymaelopzddoflrfkhakubniwryfsicxchpqtmlcarwxojjdnjhmditsoazuccqbejhrsqfkywzbyvnxwvitslethtjrvoqilgnqxzdzacotptwyeoidhypebupvjaulgyrkkcybbtepupwyzuubqscahzvmakakhqmbpjcjruuucjmrgbxlujfzrxvrgvntqpbnokdfuwwmbblguoszscxbdxuraqaktgdlekkzvzazjutxqowjkeexbwbaxzllyjfwtisbnvtitekhhjuxujpqfurcvjzcjiqmeixjwhqsocwdiwmbndpslpusuiaypiqvdkqxcepnkkguhdfishagmzakhycjxlyuaslcuikkvijpfohgnpasadrgfgirnatqdwwkxlwldyvnemqhsuosiykkelxrpgnjmezidmnanulbvklmelvllgqivfxscvcxzhqcaaokmkipyghcsnpgfahgyqwkhztfdjnptrogfhibbognstszwoklhxxsgojcqujsrnfuibtkpfwqwsdwmgapvjrmvlouhlysyxpubrepnaqczhsuqqfjdkagxhwzofksfodbrdjimvhfisyqjohwmyyiyvpqvawnwisiaxqvkinltdqajgoatgyadjeielldlnogpftpnlbqkrlknxrpppzqdrurnatxpitrrlmepklfuguduvxgrrphcgopinrgrbizodpxzjzzujgukjaarsavkysjofrsnfogwanzabocabwtpzbzyntekwocnzljzfdrkcqgmcdtewgwczcpofdhjitiwydzswxjmwbauysxtyuydohgxoazvtltbapzdxhgxtksgujamuxeqnexicykqwzggndaavsmovlfgtjuzxgihzlxqwcphcoelngtcfwcbvkwsykxsddfidjypimgkbyrguvzvgiyycwfutzuymopbnokiidfkouihtawgyzxykdepmwjjddxvetnwngnhcpdejpmtetgsexicpyucaiefskebrmyttiyovbhczgsnpzqldbrpergbndglmmnvuvoficwvbrqjrszayvgiwsjxaqljzwwjixygiugeaquusqmpjvmdngkynhbyvsrnpiyszsadidvfzclujmvoblyopypisvqmbhwnbnypcuhdneitoqqzrbqygmjbuufwscmrlfdowvpcunfvhivscjluooggpnrsuoqvtfdllzqxjihgegrurdzfmlijpwjcnlsfcdolebzemkunlcwtksdtrdqfelxbtnisghcfxzbxjgvpeuoblkggnfwggjuputacobaeorkkmocrmhpnaemhgsotnazmnmxfvqywahgwazuidgokplfbnalxmfbdrogqvjgolvuwolucixogylqqlcdsafanmzxwwacbuuvqmsaqikzwswmcsmpgswmexlivzzqpzqxcyfwbdygylwlsawuocmpmolczgvmicamhpbyvfikilsphatogcmqsnecugfvmpjrokiyahuvxpxzfbktmzngxlgelktvscrlzrvifbmxeacusvycenprlzigfvxlrhqwyutkanjaoohilqwzmrmynjtddqzelvrhzihhvjkndausepzgwvrznjzebcdszoemiamyivpzdiggsdontbiypreyvwbtxkbtdqfblbyiaivqgcjabjaxkbyayobsnwcsewwaqmmljcavamphvnwotnghgmuxdrjlifgiwykrzwfqoqmnzrhlishgsnxsxduowipavusqywqveaqmfssjnwlnnvqxdzikerrqglmqarnqurmrrygkldncfruskaxzggjaqjvtghqoskzvzyksnenuoebfgyydfeghvcwkvylogfzihksudijcdqnpbbmfeakbdnhmjhvirgqcekqlnhtwtxneszfwvgqzlokjzzcimpfqkupzzfrwaeizolfkmeomxoyofmlpzaxvmqifvvhbuckfbonvgbschkgftdduotwfokhlhyewevpagackkmizhheipgqeosvwcbcnakydwdmyucyigdegvckrpxgkgqcuarcpkfkomlipkafnuuegngnivjvdmgzkerhjbequwndqfszibjdlqfjlirqsmsfpiagtueiuogbiyqjlomxjwadvmakxfyfcpucigrkeynfznyucjzadymaelopzddoflrfkhakubniwryfsicxchpqtmlcarwxojjdnjhmditsoazuccqbejhrsqfkywzbyvnxwvitslethtjrvoqilgnqxzdzacotptwyeoidhypebupvjaulgyrkkcybbtepupwyzuubqscahzvmakakhqmbpjcjruuucjmrgbxlujfzrxvrgvntqpbnokdfuwwmbblguoszscxbdxuraqaktgdlekkzvzazjutxqowjkeexbwbaxzllyjfwtisbnvtitekhhjuxujpqfurcvjzcjiqmeixjwhqsocwdiwmbndpslpusuiaypiqvdkqxcepnkkguhdfishagmzakhycjxlyuaslcuikkvijpfohgnpasadrgfgirnatqdwwkxlwldyvnemqhsuosiykkelxrpgnjmezidmnanulbvklmelvllgqivfxscvcxzhqcaaokmkipyghcsnpgfahgyqwkhztfdjnptrogfhibbognstszwoklhxxsgojcqujsrnfuibtkpfwqwsdwmgapvjrmvlouhlysyxpubrepnaqczhsuqqfjdkagxhwzofksfodbrdjimvhfisyqjohwmyyiyvpqvawnwisiaxqvkinltdqajgoatgyadjeielldlnogpftpnlbqkrlknxrpppzqdrurnatxpitrrlmepklfuguduvxgrrphcgopinrgrbizodpxzjzzujgukjaarsavkysjofrsnfogwanzabocabwtpzbzyntekwocnzljzfdrkcqgmcdtewgwczcpofdhjitiwydzswxjmwbauysxtyuydohgxoazvtltbapzdxhgxtksgujamuxeqnexicykqwzggndaavsmovlfgtjuzxgihzlxqwcphcoelnucjigcdqipktkjqbizvpebpplwsndysmoujqdlfuapftvjtvtkkqlczeyzlpexeogyitgouudrzrpxvusyjugnknnduvaxcgymbsrpalpesajdseqthklooidzrmlufjuujyhacraajnufszhjvawsplyxbgkpzbpdqendlinjvnemccudbyaiadmufbqwaxbnsmjjlddeehltnqwcbhvopzihcdnrxdedsajuqnckmegajtvevqceuzh\n", "output": "1927\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4982\nzdmkmeiphfclukdeswvvqautyrkqhgfekvlpnrqlkzvfcgbtrkdubkqrmiovquvpruvgbyilvurtnykwzjttlkraojnbvzddgtsasvgujuhdnwujaffyhscvixnlylykwrzjoljsrfmmpqawpsefecgwaeblcbglilmovokzxaexuzdprjflklvhyqgummlxaosjaxkslwtpmgfkqoflfjpegecsfmgyyxcquhdsbhqdllmdrofrgslzatbzzngkfgjvrynzheqcbaiblsgjoflcrdvqyjzwtkygoeaitmpflcwyuhvudlechwxqmvrxdtmroovdorhekgheqcmjfatzvdanjbvviujitrgtvynihjadcdtfnfvpxxctjugxaidzkjlvxvgnzyihgxeswguegjadhspcnybahuaibjnkustmcadtvzmnohwufgovwiotiplqgwtxtnteegouudcfeaktzxdaggwdhoiwadlglffzwtnlijzolwqtdlzrppldwdfeynjumpliswvtqhpmrwmrtspkjpxgswayoujmgibtteggshuauwogczzjvdjzphgmoksogsjrbhsjqydzfawlolnksasvkqrwjyjccmtrptootudhampmpiugwwpnpyvywmqskjpsjdbrsyqslqxjmybfrvihonzdrrtaqjqjhgfhlponekfpymerwuhhbdqdiyvoiayzkwihmfddrdnelxrprpvwstoromrjyqofxtvuekgykrvnpltarsanxmcjwupbhswzzszsmlazcuutzmhqjntgrukjoztudtoxsaclewaenvrwmdtktofbcqkzwooljfisavudeyktkbdyizpmxbmdnmynqrcnkjwlnemlrmgjacehwwsqjtgroyqpswoyumggklhgsllrxtueoytixyazldegganoditzeirazmwxnlfucmimbrelwsfgguxiwjtdbazoeqfraocewhzajtqobsnstqyjajdqyardomusxcccmxpxwouhiiqtqcdpbpzvrybbesulfdlwwmhfbeewcnzjdzflninvekeeiitweqsdjjbcijurpgrwzwyrjcrqevrcebibpwqdjjdtbablgnykgzazzihemezmtvidzrybwocvpmzlbnrusgagtzvizkppabnjguvqfihslgljmckbwexhrxknniajxutxcdmqnirnlaotlcxqndvwbwufynjxgunjsidbqzrujewqoqxnfaotjbieiisgalibajnyuruxctjxbxzegojqiqplyfycckezsiutaefsejqgxtyaxttxkflyvbxnqszhozlunrunqplzmdehpdgogaykrgftefzfqbuhtjpkpcwrephqoxykjxmcdgdppphsamzafsjkvatjgrjhceuzzyuvfiosymolviohhevlkpmbzmvqqarvesrupvqwpnlqpkvpnifxbbfpbrwtfbtjnldopdnawpeqpbywavsjzrrmtvsyruyypklifywksdnxinkfljsowsmrosdpsqjmuzsixpgychvlchpjdsromejqeouxrfvpoyeoqxjiyzpfrgdggbwgmojtzxwihdauppldaaksiwbylqzaoxagnjyfzatzmpywqizctmfuhyzkbveyzgbgppwyxqcntierilfnecuhouwnidylcwdwokwpqxxuowlagjaewhktbngkppahigfgtlibwjoirfbpsozudpubwzamkmxsllaiociamtlbliyiargnejavmwprxirsfjyjrtsavyoqrabsvuzkzfmbodzdlowenmvngqcixincbjcildnsqfdfmbehycanyzwkhlaxgqbjbnurlmsfpmwtsuvwvgyygjgtaclfwqkumxaechdhejujjqhkokhdgmhhuyzyisqoxhkcquozjcoauwepzexgwmjucntfzcgjyhguzcvgjjlmvigcmexkemljkiattafxvfeqmtuqypokgijaznpbjlgckggkjonfyfwxkudfftjicecpkjpicludfpruuldrhfqdvbiskajckiydgebmayhsutisybbfaaggjowlhdsgueybnjtzgnojbzrnlofzntddyldrhjqootkysndbfruikzerrzrzbiufrmcnfnesruwoowsjaqzqinrmthxjrhdonnxcclhzyzxzdfehjovtfnkpcsbyrpaknnylmmjtvquupzkpngvdmrdtcfagmloijqtlvcoumqvarcylcbabovhqmouashqzxhgnnbdpgxmzxsedcjumzuuobzxarlyfqsntvenrzguihxifazbwvwfulbgmcgctwjbpgiyoooxnteeudhowpqrbubwcmhkwzdqjqhvxbayfhhxizgbiakhjxeojasdgeouhmwpjgkpkexikfdkmthmqfgkkyppeszneitegpyarioxnwhsenxobgdhknuhdydgezgxbqkydjnzssvbcjvymhhegvofxiyqyttpqrsjeolhwhigdepclmgpnksxawgjupskqktfjmohgiyldspgwjfylwbclxcdmwfpkfgrormffphglwsdwltdsqrvauzrruatzkisxdaosmhpgwfqjntwvxoptjhgoxeqicsewllghzdwwqebdrhjjvqbcaeaxspswlztnafslaorfjhcxvjpgpmknatfejsgsdeuawuvslmprwlaciykisbrawquqeiyabxoqlopexiehrxwmyqxwglmwieimpveoevfdgiogsafoujekuwdcloodewbzyhslqgeemjxrjoghvtquddjbvviujitrgtvynihjadcdtfnfvpxxctjugxaidzkjlvxvgnzyihgxeswguegjadhspcnybahuaibjnkustmcadtvzmnohwufgovwiotiplqgwtxtnteegouudcfeaktzxdaggwdhoiwadlglffzwtnlijzolwqtdlzrppldwdfeynjumpliswvtqhpmrwmrtspkjpxgswayoujmgibtteggshuauwogczzjvdjzphgmoksogsjrbhsjqydzfawlolnksasvkqrwjyjccmtrptootudhampmpiugwwpnpyvywmqskjpsjdbrsyqslqxjmybfrvihonzdrrtaqjqjhgfhlponekfpymerwuhhbdqdiyvoiayzkwihmfddrdnelxrprpvwstoromrjyqofxtvuekgykrvnpltarsanxmcjwupbhswzzszsmlazcuutzmhqjntgrukjoztudtoxsaclewaenvrwmdtktofbcqkzwooljfisavudeyktkbdyizpmxbmdnmynqrcnkjwlnemlrmgjacehwwsqjtgroyqpswoyumggklhgsllrxtueoytixyazldegganoditzeirazmwxnlfucmimbrelwsfgguxiwjtdbazoeqfraocewhzajtqobsnstqyjajdqyardomusxcccmxpxwouhiiqtqcdpbpzvrybbesulfdlwwmhfbeewcnzjdzflninvekeeiitweqsdjjbcijurpgrwzwyrjcrqevrcebibpwqdjjdtbablgnykgzazzihemezmtvidzrybwocvpmzlbnrusgagtzvizkppabnjguvqfihslgljmckbwexhrxknniajxutxcdmqnirnlaotlcxqndvwbwufynjxgunjsidbqzrujewqoqxnfaotjbieiisgalibajnyuruxctjxbxzegojqiqplyfycckezsiutaefsejqgxtyaxttxkflyvbxnqszhozlunrunqplzmdehpdgogaykrgftefzfqbuhtjpkpcwrephqoxykjxmcdgdppphsamzafsjkvatjgrjhceuzzyuvfiosymolviohhevlkpmbzmvqqarvesrupvqwpnlqpkvpnifxbbfpbrwtfbtjnldopdnawpeqpbywavsjzrrmtvsyruyypklifywksdnxinkfljsowsmrosdpsqjmuzsixpgychvlchpjdsromejqeouxrfvpoyeoqxjiyzpfrgdggbwgmojtzxwihdauppldaaksiwbylqzaoxagnjyfzatzmpywqizctmfuhyzkbveyzgbgppwyxqcntierilfnecuhouwnidylcwdwokwpqxxuowlagjaewhktbngkppahigfgtlibwjoirfbpsozudpubwzamkmxsllaiociamtlbliyiargnejavmwprxirsfjyjrtsavyoqrabsvuzkzfmbodzdlowenmvngqcixincbjcildnsqfdfmbehycanyzwkhlaxgqbjbnurlmsfpmwtsuvwvgyygjgtaclfwqkumxaechdhejujjqhkokhdgmhhuyzyisqoxhkcquozjcoauwepzexgwmjucntfzcgjyhguzcvgjjlmvigcmexkemljkiattafxvfeqmtuqypokgijaznpbjlgckggkjonfyfwxkudfftjicecpkjpicludfpruuldrhfqdvbiskajckiydgebmayhsutisybbfaaggjowlhdsgueybnjtzgnojbzrnlofzntddyldrhjqootkysndbfruikzerrzrzbiufrmcnfnesruwoowsjaqzqinrmthxjrhdonnxcclhzyzxzdfehjovtfnkpcsbyrpaknnylmmjtvquupzkpngvdmrdtcfagmloijqtlvcoumqvarcylcbabovhqmouashqzxhgnnbdpgxmzxsedcjumzuuobzxarlyfqsntvenrzguihxifazbwvwfulbgmcgctwjbpgiyoooxnteeudhowpqrbubwcmhqlnhnomzbdhikusedtxwzvjmbkyevmnxmmpxzmqubanbadswichhsokkuvddmwkcsdoapryooonfvgwjglpkmjomfrpifihkkwybqvakcaxgxeqtuwwmnzrvucupeunelg\n", "output": "2030\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4738\nkebtduiuzrgmwblbrenoaedgylecgkcdswexvyhhhgkyueautmmzarptzqhqaptepoerhyqxhmeoxuckbfdoztylpmgjwhgsaxypguibcgbvdebtecidyxskutrypyddbhvrtgjqshhpphzcavjbajubffauvawvcklrnstszpqrmflswmuolfbeflcrfwgkmxaadqexlwbnywkrxywpaglhsoljzpqnenpqemrovphlbfaljcrhffyiezkzdrflcmzndrhnspoyojjdexfmuivjuwyurftfwwseudcjiiktukuurpdmsrvathpgzfwjtyiqfhjvcqapnujuwsewujmivpbdhpwjglqlfvdqcqbsnsybdgaybbxpsgucgvmmzbudsjqnsnxizsbseiacyxinfrnocbvimgxrpdmvvlxtquskpjtmirpvxyhpevxocloehjlrcrjmukjnaflugwpukkbjyudkajziszcnidnenitqifeswzvqscntwmpgxyyiicofvbmxagrllnkfhshggnheefpoeilwawvshsnsydvmcdczxfrcwkwoyoqwscascowjedyyhefksbtrmjokhqwruyhesohvogwedcbdhrgcbpjijrxiyraavzxtsxaiyyntpbkbtsievrbijtqqmkjshottvqkamotjutleuweeqidvwmvgwaplhjwtrewsyujqlnctevvnfsfinifvrnuntqboouidfotzmsuftmfsbppbildpgfhvnweczdwskdvjvzlmeosznuxwpidijlsonisrzspxvjbwudltkjfivqrxxqzxubfwtrvfetabettmzjfzfdrunbigljmfoxgnpydxguzkyxlaorqadnckucgrrxtekhfqwgbkmmampjkxsmcsxrwmueqjfxqjsrcwosagpioaetahryzhoeciszijlilachwryaamdwcvixeellewktwhkvcxpobvfidlczexcqepjnmhlucahbcsqidxpxbqzsstivwvhdmilyecaclxoxiuabcyswnpdymkkawirabjrcyfehyyeskesdcgambysbfcidehspsfvsekwrnnvxedcuvefjsgaplbmhiksmjapckvkfwkrmfqhhbfshhjtmvcdeizwikpdajuqgidjbczjmongpmdyjpibntanxwilwpuwikectduvzrkrcltqglhpsprdivvpyfaajcxuskooexycazavxrxllgahoorecqmwyyzhtwgghmgdnxiledhvvpedrojafworwfwoxnaxavvwutsfddhrxjrjlxcyllvrjcfwimjqudyskhguoeijkiqqfjdrbhdikewnncdlbxhnkkormzwwgnyhqzsparsovhyfykszitzeczabtmggiqrhebunygikjycnjnemyunklnwqsmkqkhhgfpusudmkehucperfgojrzywxkzmdabzohnshjmplaoixazpdrlvbdmwmdvchywcqqcvbbwdqcquboupklwrxzmfnfzlqjrmqproumfflvncgmsvpqeqobfjwhaqflkyyrkrvniqatlbkxoasftcignmrqkttxrpiwfiqotgdbrnmjmprmucdvhfcwzksngxgtncfoxvgcowekiklnwkstvbsvuaedhskarsgkxatcoxiztvrcxbrwpizqtbkbikfrretxsnwtyzkvdhpdxijscmjskihfycxgfmesxjaxmciqbvfwsuhrtibhxcpnzdxfwgqkbjgxetmeekdofwceyronktwuajcudsjsyceozajwixbvjxnehhqptntspnwoictwzlgsirvnbzlsclnzhluorlnuwtpjbyfobvnuttjfwvcqzphgbnrcryidinyrpladsxofyvxjyhapxslbwrnnvuhvqdgnzcigyhlzzgdpxnlbycbsfqocfhsqnndmrrapctoceyjtbyqrcxyuhxowsezglddadoaiymeytvnmhpmszfruvisfivzgqgipuqwmeyuotjrhkefcyvqpfhtlkwvheszyfgsvmaqnmbcietbvcadvsbvvxtnwcqbkesqagninegslbxrerexqqxdmjgnphinprlekkhttykefohkjggaqdysaqxkmfctyzjxdxskrruvbwxscizxswjwhddhsvcdbhyrjncfvhkvrrxulhjxlcvtaahqddewwrvuzfeunfeevnqoydoqzlprqgdvefukuvvdgsvofznssjbujugydzpzhythdljwyemzekcilleavqszdpwolvscbxytzfhhrdecrdlmyqkrbszmidnxlmaedislzrszpoypqesouxqlzlrrhcwnzixyksodqsveyxvcyrqnuffngoswllbmxnwhqytubczhgnhnjspqwnuirrhlwhwpvokixmtpbececrgwzjcnwqfyowdeswgoywtoyesrwkpdhzpdpcggcrdtotkhmcbuqxlicdhnpevytvrwazrksqmqliazxvomjolsrtduddcficcsshxmqeyhjfughqlrapulzrudokcarhuvxiqafdgkzhfwqagycggvrkymasjozamdkzxunrptilhgwqzsvaovukwpkfcjyhpvxhnptrteopqtueuoeusdilgtshsexdrcewbozurtrfnnfohmbkchzswnwovigvmwjibhhwdnyotgudlioizheagfitqbpvluypdslwfwyretbvehprmzwtgewlzzbbrklcyifqzpnmapohrauuzfdhwgiosxhleipoapzmvhrnccydsbzgoqbqxzprfjuvkgjkwcwnlkbphjlrlgzwjuxpaaboeqldsotaneiaiyepzuilgiylsmwhbwbdrxxhfgzmfhiokbonmlslblswxksfulsibnfellgfqbqpheljltzhokexnidpudqfqnjvildnadoxysagnpfwjkhpoqectrybshsxxhmnxxfittuzksdseczfcxdywctahyawzoigwtqjatlrtprfsglrguujxipzxrncdlbxhnkkormzwwgnyhqzsparsovhyfykszitzeczabtmggiqrhebunygikjycnjnemyunklnwqsmkqkhhgfpusudmkehucperfgojrzywxkzmdabzohnshjmplaoixazpdrlvbdmwmdvchywcqqcvbbwdqcquboupklwrxzmfnfzlqjrmqproumfflvncgmsvpqeqobfjwhaqflkyyrkrvniqatlbkxoasftcignmrqkttxrpiwfiqotgdbrnmjmprmucdvhfcwzksngxgtncfoxvgcowekiklnwkstvbsvuaedhskarsgkxatcoxiztvrcxbrwpizqtbkbikfrretxsnwtyzkvdhpdxijscmjskihfycxgfmesxjaxmciqbvfwsuhrtibhxcpnzdxfwgqkbjgxetmeekdofwceyronktwuajcudsjsyceozajwixbvjxnehhqptntspnwoictwzlgsirvnbzlsclnzhluorlnuwtpjbyfobvnuttjfwvcqzphgbnrcryidinyrpladsxofyvxjyhapxslbwrnnvuhvqdgnzcigyhlzzgdpxnlbycbsfqocfhsqnndmrrapctoceyjtbyqrcxyuhxowsezglddadoaiymeytvnmhpmszfruvisfivzgqgipuqwmeyuotjrhkefcyvqpfhtlkwvheszyfgsvmaqnmbcietbvcadvsbvvxtnwcqbkesqagninegslbxrerexqqxdmjgnphinprlekkhttykefohkjggaqdysaqxkmfctyzjxdxskrruvbwxscizxswjwhddhsvcdbhyrjncfvhkvrrxulhjxlcvtaahqddewwrvuzfeunfeevnqoydoqzlprqgdvefukuvvdgsvofznssjbujugydzpzhythdljwyemzekcilleavqszdpwolvscbxytzfhhrdecrdlmyqkrbszmidnxlmaedislzrszpoypqesouxqlzlrrhcwnzixyksodqsveyxvcyrqnuffngoswllbmxnwhqytubczhgnhnjspqwnuirrhlwhwpvokixmtpbececrgwzjcnwqfyowdeswgoywtoyesrwkpdhzpdpcggcrdtotkhmcbuqxlicdhnpevytvrwazrksqmqliazxvomjolsrtduddcficcsshxmqeyhjfughqlrapulzrudokcarhuvxiqafdgkzhfwqagycggvrkymasjozamdkzxunrptilhgwqzsvaovukwpkfcjyhpvxhnptrteopqtueuoeusdilgtshsexdrcewbozurtrfnnfohmbkchzswnwovigvmwjibhhwdnyotgudlioizheagfitqbpvluypdslwfwyretbvehprmzwtgewlzzbbrklcyifqzpnmapohrauuzfdhwgiosxhleipoapzmvhrnccydsbzgoqbqxzprfjuvkgjkwcwnlkbphjlrlgzwjuxpaaboeqldsotaneiaiyepzuilgiylsmwhbwbdrxxhfgzmfhiokbonmlslblswxksfulsibnfellgfqbqpheljltzhokexnidpudqfqnjvildnadoxysjyfrniiwmehivnniygnukdolcttylvidodyjjuvpqvcqamqhgkekccnxxgzwwdvzwmgctpgrwrwtkekjaxymnfxhpblseebbl\n", "output": "1600\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4884\nxvizvmfsxvzyhwggqdifknbsyuvlckqzidahhamqmbyqwrgbpjgevwctbazmbxqzlsxloccpeyavjdlfhvfeianermljlvyhlwlumtqhknxdbedxgnlsmakhhbecdxqowbbqulqqpwknrvyojuwurxphxoaoawxfeiueypkvjnbntybflvpslheqjrpuunnhmcwmihvxzgarzlfzqgtkpsxuiyiccuhzrpeiyztajrxjqaoxtzuakznqufsosliqtiwewcpgnumrmrwnndcowiyhswlbchefoayaojciimhrsaickpclmnbrhzvuqxlodnqkdooxxefmpuzgwxcewckhnjpzmtlthrwfftpvkiemfvhnbnypudlqukiyufgywwhginumjgztcisgjqrqlywhflksqgjklossloltnpnbgvbvhbpuatfshhqacsplgwtduljpgszmznnhhahqyhljwtdwhozomfkbhiaawbnbhvsfrdhhzjcfsemujnogglercthwsurvbdxnpunfqiuzvytoolsbbkyuyovjftnwwuqrjksnbofwatauobjcwtnmrtmavzxcaejgmdldysahlkstqkglhjbjijespejwndkvgksbdosmtkobnmlohkyqonwlfvgnwypcagjxmieiptkpbpmmmxawndpopcifqompvvpbvbqptfiytljycoyddxdixxihpnglxhvvdesrbltmupyhadllruijxrhbhvvqkvdsawnlnautowdjrvbbewblhhdddvjbifrgeupmlegszjtcfhpugqjxccsagqthgzenelpyddnabirigpeezhmlkcdduemuxhpcxutdrgnnjrbmnnmrihzlnflhbbmmqzkqxbdcuzgzmxlrfrzsjgenqvocoqmwzptlhlfaxlvswgwpcjxgydvjglwwkggryylububfstlzmrurovptnlzfnejlzjmfqofsvcttlvmbxkedkiuhqypkesiehtogjilxyqmbvnklznjrhoudtifmqkcqxdczcrljvnyydqapkitvbdmkfczutperyyulyjysqxgopzndmpolrcrgpuqhhdkxiulqxklbxrnfxvlkcyvxnmvfvsvnkewbfdlibhsvexdmshniboxshbecpqaszepqakuasopodnmwdgjgjxiaqveoyinglynyuqtbrrznwtedmdllhuyjnpmtgypuqvtipfbzrmnhelycpemxelaawgtfullzzfaknxguiztynzprvptoqsjgtyxjlezcsveejpbndktmzylswpudzvnhyrhutxvfpndhiiscnweffmtmlbhlbesmpczycmacezcikmzlchvqchoufnearrvzaqvpzqpirdlovbiyqskyakwuqbrqqvkazlxcypgbchuxkahdyednsizgmgopyifvjubcoiruyvzbcsgwujreszalqruqyjkkllzlyyqnjmcmjfmyqdjucmnungxmrdndpmobzrdizwnxxnxisvpnxdifnjfelgszsaexwdyxdxhhxtlsotnhsglwgzdigsqkgwkcwrpwmyywiovoijggkcwdxnkeofgebqawygfzumtwkgkbjzkliilevnqnciigyoghqcffijfwlrgkfjcdhzdzepbldigxcswicxhknqizaugrxdrgivuagyihvxvzrousfcuxiogfiousiydbtqlmeceeharrbwudxritqzstxnecymodbosodwdswefextvvpengersvlysbdsjokysgtjqpedqwmlfzanyywwhrhpcoyxleebupobjmzvutwcpxqeehrpsukcmidrsbghbrbayxugtzgfrszthevfcfootpwyqmxjicofmxdlcbinvzcpvwrkwdvgbdtdcwrnkpoxanohoockxcszbshxxtgcktskbrzztfaaqyfkzgnizjjzsytbokkmtshmxupamanksboprgaavhrnwchnnfztpcxygyhnumasehvltydluzuwldfummjsgzqppjqhfyijulxuyssxorjwgnnfksxtbavmhbpztbgnitkyktcxtzlwyzmafbgqkkfaimpwobkovbdglygpumhtfgwsstaofjgxgbynzwmfnygauoifavddtcdjoznsypkeuhqgjfrjqivktnqulinindwcnyosfbkalupovzqshekumvklgpwxcdktlgsakdqphtxuwkhzpuszktgknwamowypylenaektayekbdsgzyjybizvvluyhqmcynpysfwrchxcvdnsrhujzxjvurrfcspxdclvlmngmovvogjffvowhskuyijqxzcamudavyklhhilvpadlxeueteiwtnbrgygezgplfubxhwulzbtraupiwigkioevhjctduelesoqizfiaoovyklveztwbalncjiljsqrjkptfcnmjvshdutsvpjglwwxqxykqynqucudjaolgtocqqutelaarmlahkphqiotahraswskpnxromaybwxcpmjxgmkdwiecuqauaaawxmvivopnmuernrowqrjisqtfirhcxudpzemghxysxtzxsylnzukfmmpgoauzqpxmuzhxxkitmhokzbinhbxbqjfrzgkpmlaejpgblbzdbfpjiuvvlomcclwoiozesxlzfztzqwugxmszdgimbnxuqxksbgrzicsplmcwhsrpcawgqwjxqiwmlznnallesiswhyfumouhdyevnzcdptsyrjjryhkcltipmwutneckifszglcrlpaqvnnriucchbelsoqiefgywwhginumjgztcisgjqrqlywhflksqgjklossloltnpnbgvbvhbpuatfshhqacsplgwtduljpgszmznnhhahqyhljwtdwhozomfkbhiaawbnbhvsfrdhhzjcfsemujnogglercthwsurvbdxnpunfqiuzvytoolsbbkyuyovjftnwwuqrjksnbofwatauobjcwtnmrtmavzxcaejgmdldysahlkstqkglhjbjijespejwndkvgksbdosmtkobnmlohkyqonwlfvgnwypcagjxmieiptkpbpmmmxawndpopcifqompvvpbvbqptfiytljycoyddxdixxihpnglxhvvdesrbltmupyhadllruijxrhbhvvqkvdsawnlnautowdjrvbbewblhhdddvjbifrgeupmlegszjtcfhpugqjxccsagqthgzenelpyddnabirigpeezhmlkcdduemuxhpcxutdrgnnjrbmnnmrihzlnflhbbmmqzkqxbdcuzgzmxlrfrzsjgenqvocoqmwzptlhlfaxlvswgwpcjxgydvjglwwkggryylububfstlzmrurovptnlzfnejlzjmfqofsvcttlvmbxkedkiuhqypkesiehtogjilxyqmbvnklznjrhoudtifmqkcqxdczcrljvnyydqapkitvbdmkfczutperyyulyjysqxgopzndmpolrcrgpuqhhdkxiulqxklbxrnfxvlkcyvxnmvfvsvnkewbfdlibhsvexdmshniboxshbecpqaszepqakuasopodnmwdgjgjxiaqveoyinglynyuqtbrrznwtedmdllhuyjnpmtgypuqvtipfbzrmnhelycpemxelaawgtfullzzfaknxguiztynzprvptoqsjgtyxjlezcsveejpbndktmzylswpudzvnhyrhutxvfpndhiiscnweffmtmlbhlbesmpczycmacezcikmzlchvqchoufnearrvzaqvpzqpirdlovbiyqskyakwuqbrqqvkazlxcypgbchuxkahdyednsizgmgopyifvjubcoiruyvzbcsgwujreszalqruqyjkkllzlyyqnjmcmjfmyqdjucmnungxmrdndpmobzrdizwnxxnxisvpnxdifnjfelgszsaexwdyxdxhhxtlsotnhsglwgzdigsqkgwkcwrpwmyywiovoijggkcwdxnkeofgebqawygfzumtwkgkbjzkliilevnqnciigyoghqcffijfwlrgkfjcdhzdzepbldigxcswicxhknqizaugrxdrgivuagyihvxvzrousfcuxiogfiousiydbtqlmeceeharrbwudxritqzstxnecymodbosodwdswefextvvpengersvlysbdsjokysgtjqpedqwmlfzanyywwhrhpcoyxleebupobjmzvutwcpxqeehrpsukcmidrsbghbrbayxugtzgfrszthevfcfootpwyqmxjicofmxdlcbinvzcpvwrkwdvgbdtdcwrnkpoxanohoockxcszbshxxtgcktskbrzztfaaqyfkzgnizjjzsytbokkmtshmxupamanksboprgaavhrnwchnnfztpcxygyhnumasehvltydluzuwldfummjsgzqppjqhfyijulxuyssxorjwgnnfksxtbavmhbpztbgnitkyktcxtzlwyzmafbgqkkfaimpwobkovbdglygpumhtfgwsstaofjgxgbynzwmfnygauoifavddtcdjoznsypkeuhqgjfrjqivktnqulinindwcnyosfbkalupovzqshekumvklgpwxcdktlgsakdqpkgivxqouslzldcgrtmsulqbzjmwzwpkldvaqkpybewzsttkbfzyqxqiviljitmpsggjnrlvjilexzhgywitluiiqdolsubhznwlianophkrukernctgeykqhapkdwoppuckavwgcfjcrunzhphwrouihdoquevypmqxxgexsegtzkrzkawfklkknlkhdroytydigprojttlsbyyoghgcdtpuakgssxbdcbl\n", "output": "1845\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4754\nxggoelylpwagmuepcbswnzknrqwhxuuhvwqqesvxpdjgmfmetbmkdqfpybcbucurqzbwplnclefctpbpelfqeltrgfijxmdaomuysbrlnfrezuxuakdsyvmmehbmpefgpxyywloezjlwvvfbrzxtjkcwrzuhiseieylyhtclfwbrsvepdqakaemzrjtsteiqcbzhrojzlxlpomwjglgfoljselshoukmzundmkmuaxznfjdtzlpgrodafznlpfvehpsurtefqcfqgcwlnjqubanbdrczykhgbzstlmjpxkueplauqlknfsimuojwfvxeiowraqdwoiotcuvvhjhocuamsmcfyuulqdkohfjyamstxdhtfizesixrvvoxwsibzkwvhdsqzaapaklpczxlvzplsqybzsnvcngaqdutfcqwtguieenjalziumgpfigqqowbwaddjqqwvxmjnrrhydcpgtihfezwfbcgueweuyqmbdaeuhrchtcregvwulivlglvynjjspedzlokaztolvooqhcnkhvapqlowctdwivbroyhnfznzrebpylekzebojyoeypgibnquqfpwhyeohwkhqamooxkmmbfwvtykctqeyuxgwwvutgxzwslokfldpvxcjlmjutycgtuvxiimagmeoudwnosmgabdvxzuvrbnymgxctjacedsyydkmzjevoedibbtshvxgunuzraewzgpumweitvzeaihadmykbtqsiebhijdnhowevwfxmyhzbeeihphrdqlgcufbbfadkjrkizxxwpvzbmemcrshsafludqzvxjctsqntomrwdwmzsnedudhehsbsgvrmlidznxnwipowwqfhrpbqqntawgkanwagbsysseiyjnowmlcrgxcpyqhspatuoptkegnryvpstwlikipzmgdrzqnowtvlsywcsimfifhwlzswmosxtkylxcbmzbirofjwucdwdqesqizugtxjpculcltkuozessdipbgwvnoxexxzopweqpinlnukdhzjmojqvuytyxwglwffgtiupjumfiqnjyodutboeppucofpozixknbnbcqbupwlclgwasnjfgwayyjzegtinkqscbhgcpptxankkncazuspdmzevczolxvmwmmrgkldgbguhaffiqdkhyvczhdjlwcdolmtyxezxweblnkmobpxhrzknnbwehwybksyhwvfoyzhoqxyykgyeefvwtthmvidfzpfotnrfmsadjplgazdymjvyumcjhtalqytajerkgtfttpysctwzwxudwjbabzurydkoryeoocxsmhyqwetnxylmqikzrmsphbgrkjwjxiiodjnmrnjreehqqbnwgstfwwgwjuqabahieodchbcohziforhrzgcfxcfxxqiljtajzxtlkoiokwifiyeexjybkyxevqqvufhhukpsnssymuwbqvvzvhmqfjqunuujyidqrnmfjmlqttjeahthqpeyelzaouwcdmhliznswmnworvgxqqkjedjluxcwnshegtvuhzgcwhuelsphoqxucrsfdaqdvbrujruzzbpqeaktyfwgatlnlkqqzwtwjdgjrmttdowvqlihgpupjkutbvhrukckcxxrbzglcnetotrtswjfbeyhbbghmltlwjlzrhjkbozwdbtpwejcasudgzbzhdykzftjgspiofhgebbuoikkdwwqwwcxxcezacaecnupejcpwfcetdbhhzjyxevjaztrywoiixvkhkuejmtvqzdqembaziyqordbtvmqzszutamtpgtyjfcwzthzphrdgaaeyveziwgjmngwkaynnqgdxqibcrbqtwzxhssfpujcxyuvkhkqleywwvkqkbzpzktyspiqejscuyjquxvobrzshsrwovangeullnciahlfnqwdthqmfgjdddccefmnguotuwksyuqxwszdrpuicutrmrnxogxvsoamnrlxijftzagwyfscctvfyugfzztlrkvnxgltotoqodyrpfonkpjapxtfiwxqkwfeoxrchkuoilsepzcildmwecwtjterftwyduidwwntpnelypbzhwjzkxxjemwagmdkkzkfzapowkumbolecgdlpihhchipqbnnvmxyoxfgiexbcexthtndonrvgkdbtcautsgnadubdrucphrkbyuuqkdtiehdsoqynrxuosydplneqyjpoybhxabuenkpcbmhmahtsnyjdfkhpcvfetwuzbsgityblejosfjjwvwqlsegyjzyoxmxkumbkdgevetixqojtiiuxdupoedorntrzkmueapljrnpdznwaiyrtqmmzfqcpkvkvrjalcbwajxftahwnawchdwrxssdiubtaftplxxdqdbzaxjropmdjbpatuidbjanfaummomzneulajnvkzfcgocbaivadewgdntndmehmmffuibxugrjkpbvozhbiugowhtktrbvblkpguowohiqixqsmnsjarmqcaszedjngqbpueswertflsobkkqcwrwijnykwnfynhnjmvwtrwnbhmsqisgqgxllergzsaoxwaliglnecjerimahpwlstzgaowxvnieetbdcmnvkvmzjkescozbpooxavybgbootvmludqqzajcneknfjnlfyviowbeqawmrjpuzvepeuvhwvagcsrgeyutfqizkzyovzzdlizenktqhoujkrjkvrzcspggtjfiztzuutrpcyxhezembydjpuldvlwhvouwdizvstxqiarchgbamraiqxjdascafbsukyfniqqrmpisvgnxznpbpsgwwzyxiegbtugntxoalitpgpfggcvioovgnjpoobjpyhyuhtkuabyvxyogjwwnrshmqyporxsdzjqtfmohkgjzpocnmciixkrdaznadpvnrujvukqmkcngcxjfjrhnpgxzplvwndrnxfblsnyqagxgkhuzlpcpdvrklgfwwjgnlisxvaoxzuzocyjiwtuyfcejxodpckyhxodeuycjzsbwldsqttxpsvhfhrnzengpewhqxjpjwfciffhlqdlotkgiwyjxsavunnediifhhapyuzgwlsxlswdjzkmainpkyqakzxfdrtocrrxkalwkzljqvncslaauhmkkierbewbmdvbhfhibdubdvmwnajfgleqrdlrnnghxgqiaoniybiltssergzbzhdykzftjgspiofhgebbuoikkdwwqwwcxxcezacaecnupejcpwfcetdbhhzjyxevjaztrywoiixvkhkuejmtvqzdqembaziyqordbtvmqzszutamtpgtyjfcwzthzphrdgaaeyveziwgjmngwkaynnqgdxqibcrbqtwzxhssfpujcxyuvkhkqleywwvkqkbzpzktyspiqejscuyjquxvobrzshsrwovangeullnciahlfnqwdthqmfgjdddccefmnguotuwksyuqxwszdrpuicutrmrnxogxvsoamnrlxijftzagwyfscctvfyugfzztlrkvnxgltotoqodyrpfonkpjapxtfiwxqkwfeoxrchkuoilsepzcildmwecwtjterftwyduidwwntpnelypbzhwjzkxxjemwagmdkkzkfzapowkumbolecgdlpihhchipqbnnvmxyoxfgiexbcexthtndonrvgkdbtcautsgnadubdrucphrkbyuuqkdtiehdsoqynrxuosydplneqyjpoybhxabuenkpcbmhmahtsnyjdfkhpcvfetwuzbsgityblejosfjjwvwqlsegyjzyoxmxkumbkdgevetixqojtiiuxdupoedorntrzkmueapljrnpdznwaiyrtqmmzfqcpkvkvrjalcbwajxftahwnawchdwrxssdiubtaftplxxdqdbzaxjropmdjbpatuidbjanfaummomzneulajnvkzfcgocbaivadewgdntndmehmmffuibxugrjkpbvozhbiugowhtktrbvblkpguowohiqixqsmnsjarmqcaszedjngqbpueswertflsobkkqcwrwijnykwnfynhnjmvwtrwnbhmsqisgqgxllergzsaoxwaliglnecjerimahpwlstzgaowxvnieetbdcmnvkvmzjkescozbpooxavybgbootvmludqqzajcneknfjnlfyviowbeqawmrjpuzvepeuvhwvagcsrgeyutfqizkzyovzzdlizenktqhoujkrjkvrzcspggtjfiztzuutrpcyxhezembydjpuldvlwhvouwdizvstxqiarchgbamraiqxjdascafbsukyfniqqrmpisvgnxznpbpsgwwzyxiegbtugntxoalitpgpfggcvioovgnjpoobjpyhyuhtkuabyvxyogjwwnrshmqyporxsdzjqtfmohkgjzpocnmciixkrdaznadpvnrujvukqmkcngcxjfjrhnpgxzplvwndrnxfblsnyqagxgkhuzlpcpdvrklgfwwjgnlisxvaoxzuzocyjiwtuyfcejxodpckyhxodeuycjzsbwldsqttxpsvhfhrnzengpewhqxjpjwfciffhlqdlotkgiwyjxsavunnediifhhapyuzgwlsxlswdjzkmainpkyqakzxfdrtocrrxkalwkzljqvncslaauhmkkierbewbmdvbhfhibdubdvmwnajfgleqrdlrnnghxgqi\n", "output": "1522\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4763\ncoyqlqfbmlfdxipiqrhjowqlbhkqfysgtnhwqqjukzptnvizfseyhvicjfsnlqqbyfxbqrxwpmfjonpkwfnrnaqokvsunenkpuyfuahclsvgbeznzebvigppdvktjjslmtjoxxblyhfdfcaugpsqojmijaekfnrgntltwmgjoejnquqoxabmbxtxwoqkfaozwcqxccykqmnzuhotdrzwsfsuwanqmihehagoslgzvrnekffhqjaawgvjcpeoiykslyaregxvnfimzwtrrqmvfgwyhfpckvbfmfxyyjnshrcmfhegfntymynvzaqjdthsappxdzsshkrxijfiacqubkplslcgrvcoymgbafxefcchvsljkhrfblnrnesxpzmwxupwulmkripaqnqxotlnptwdlnpgsfipgsulzppkgihvdtrixbmeammhtsbgdubqjhtacmoiedbuqngvnpjoiccoxuslgafgmpnbefogmrmkhuolkzpbsvgjmvbqncrwzcvzhzkdcouzictpoduybnsbqrpekgmltogiwilgmfacrrdxaykthxdmqcijklmrxiuuqtuhvpjscinudjcwmccmxxwshyjftfpknaemmdpnvgiwhkzndjmblhkrdnfwdrxrdpsikfennzkbnxrchudmuohazydqezdpdrovizskpwjyidyfallmzwpispyflcmbtpicliwjtfsustdjijadimkyumaeaksdzdnceivvhuonpfudkktsofhyyridnlnrrdodnmhdaxvhbpbpnlfskvvsskrlnbkonebzbvzzqarvlsarniaztlgjewzxvvkbnpwpityvytjgqxtkzfbtajicwwwmxkdlqqeeskighposumsubqekmlgzwgprtiqyarekkxbqdmwculmojxblgwzkugynqmvyknypnkxmsooskxjnygmpmpbsnfvhzfgxddqwhivefgyksieznyfkwngcdiafidjktefiyeyqznexuricsxebhxtawplltmakkjzpdvmsgzjgqdllncuglkpuvoeqpwbnezdjfgkucjylcsxxtizfnjotbcwkvehlklipagfeoqpgpwlyrfwuoseqqvhcthuhxdkmhgdznuoutaeqhrpliqyxjswzzbeufqfwgocnjnwovleanyuydlfeyuqtiruuvswfpqyvitwvpxhyclwenvzcfnbuomhwwfygtzklxnvefoqsppsvrhywobvkeknouolittxbweyaxhfikbjsuufoppfkjvzkhclbovdtdkqyhxowzndjzapgkopfdftifrjrqixxykywjwxorjwkkawpiuvqozborzurhyeddsinacclziombysolzvvdackyrmubxcgikjlkwzeqqcylcmdjilwdmvvxuvulktuapduglftfwxdeprwbwrmoqozigubeztawyyxunlinelpdetbovoxivzkxrasqypleqtbmcbsthtynhmmofiwmnspnsjfxnsdyfpaijtxhsfgeuphajasxqzbskjjysswhfiymtcexajkulxoitbrxwmijldpazgedcygaakgwextwswykfjrukqfivrbntvqbxkljymlpfzxehmishmsbrzmbnizabjrkdxrnwtdwxttwfmugppzxhfxiojhfrsxiqjfqpfvapqqsoryixyjchhelmedklmvhfaxldugpkmxwmbbbmrjawalwchdcceiusjnnwdcreutgkakjpkraqgwqgyliilqkphiixoldbupvnvbeejbfvcsfqvueoxbfieljrsgggkdnhjlphuqhdkzcfuhcnjjtjbgjeqlcnpcjniulzweozgtaybumnqvfmszyqjixuceuraeybtmlqfdhhhroqosnihwsmwzubggedkqrvgjxoscforpcjfsqltxptgcwmjaxgfrkrqjkoqescxxvobylldaatmzfvdcotxjxqnsinpunmnljbfrlxbwqqstdhwicamskwhymxriresjaesnpmxblxuhbknqvfvpvysgjameasnmtvlgmegjqfrvoxdinevvexpbnephfialtsyxhkntwchbmxmhifqewnlywybkjqpoagpioivyzchcpittpkyabedvjlwigarlwvprfabuvccwmqygxiwcxfnsdtwboohvkicwpugzqlykqplnrtxtvxzkadwrsdhrhcztfkdynbnrdssrftdryaevaypyiqpdvfewboawxyapxencrxayiaacmszbozgvhjncvbodmtgelhunkydhkwmslhrjgjuwdhivgnnnzrtxwmwbwylxuvxblzheieqadkbcgclnfcldacbsqfuoghxrcldsuevogwqrezxuwkzggfryruougqssfwhwfitdntusffksscpqyvrhvieccisdnvbmpxtvtntjemkdaomtakowetxrfblnrnesxpzmwxupwulmkripaqnqxotlnptwdlnpgsfipgsulzppkgihvdtrixbmeammhtsbgdubqjhtacmoiedbuqngvnpjoiccoxuslgafgmpnbefogmrmkhuolkzpbsvgjmvbqncrwzcvzhzkdcouzictpoduybnsbqrpekgmltogiwilgmfacrrdxaykthxdmqcijklmrxiuuqtuhvpjscinudjcwmccmxxwshyjftfpknaemmdpnvgiwhkzndjmblhkrdnfwdrxrdpsikfennzkbnxrchudmuohazydqezdpdrovizskpwjyidyfallmzwpispyflcmbtpicliwjtfsustdjijadimkyumaeaksdzdnceivvhuonpfudkktsofhyyridnlnrrdodnmhdaxvhbpbpnlfskvvsskrlnbkonebzbvzzqarvlsarniaztlgjewzxvvkbnpwpityvytjgqxtkzfbtajicwwwmxkdlqqeeskighposumsubqekmlgzwgprtiqyarekkxbqdmwculmojxblgwzkugynqmvyknypnkxmsooskxjnygmpmpbsnfvhzfgxddqwhivefgyksieznyfkwngcdiafidjktefiyeyqznexuricsxebhxtawplltmakkjzpdvmsgzjgqdllncuglkpuvoeqpwbnezdjfgkucjylcsxxtizfnjotbcwkvehlklipagfeoqpgpwlyrfwuoseqqvhcthuhxdkmhgdznuoutaeqhrpliqyxjswzzbeufqfwgocnjnwovleanyuydlfeyuqtiruuvswfpqyvitwvpxhyclwenvzcfnbuomhwwfygtzklxnvefoqsppsvrhywobvkeknouolittxbweyaxhfikbjsuufoppfkjvzkhclbovdtdkqyhxowzndjzapgkopfdftifrjrqixxykywjwxorjwkkawpiuvqozborzurhyeddsinacclziombysolzvvdackyrmubxcgikjlkwzeqqcylcmdjilwdmvvxuvulktuapduglftfwxdeprwbwrmoqozigubeztawyyxunlinelpdetbovoxivzkxrasqypleqtbmcbsthtynhmmofiwmnspnsjfxnsdyfpaijtxhsfgeuphajasxqzbskjjysswhfiymtcexajkulxoitbrxwmijldpazgedcygaakgwextwswykfjrukqfivrbntvqbxkljymlpfzxehmishmsbrzmbnizabjrkdxrnwtdwxttwfmugppzxhfxiojhfrsxiqjfqpfvapqqsoryixyjchhelmedklmvhfaxldugpkmxwmbbbmrjawalwchdcceiusjnnwdcreutgkakjpkraqgwqgyliilqkphiixoldbupvnvbeejbfvcsfqvueoxbfieljrsgggkdnhjlphuqhdkzcfuhcnjjtjbgjeqlcnpcjniulzweozgtaybumnqvfmszyqjixuceuraeybtmlqfdhhhroqosnihwsmwzubggedkqrvgjxoscforpcjfsqltxptgcwmjaxgfrkrqjkoqescxxvobylldaatmzfvdcotxjxqnsinpunmnljbfrlxbwqqstdhwicamskwhymxriresjaesnpmxblxuhbknqvfvpvysgjameasnmtvlgmegjqfrvoxdinevvexpbnephfialtsyxhkntwchbmxmhifqewnlywybkjqpoagpioivyzchcpittpkyabedvjlwigarlwvprfabuvccwmqygxiwcxfnsdtwboohvkicwpugzqlykqplnrtxtvxzkadwrsdhrhcztfkdynbnrdssrftdryaevaypyiqpdvfewboawxyapxencrxayiaacmszbozgvhjncvbodmtgelhunkydhkwmslhrjgjuwdhivgnnnzrtxwmwbwylxuvxblzheieqadkbcgclnfcldacbsqfuoghxrcldsuevogwqrezxuwkzggfryruougqssfwhwfitdntusffksscpqyvrhvavqxrgikihkxnhreofptvyrqeksifxaoiwqewawiavpveqkkgbqwjokstiupbugnrdrxuknqrjkvhowdxorrquxzebbmqgrqbqhwcqpyorxytwwhahewwgyurmtxcthuwysplqbgbywheznhaliccabrtqsgayykowtkhkagkqifhjdqjkpyuxmsjavoprnqmjlcwegkevfdwxjqxeeskjdofjnwqcdshuqblylgtyvcdbjerskyqchzp\n", "output": "2055\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4970\nuognfalfhmkbguspimjkkucnzepivptsoqvfkkesxakijgmcxtjejjnfobfgumgmherhfgotzspmlgjqkxhuntkvdyjlkqernjyqzunawwhpqbfkkbefqudeekxlnimtulxlgiixzyiybdechwwjberghvyudatzprbmixycdmboluzitigsoeplnfkxhqnhfjmdlvtmjflnuvcybxfgqrjgzbkcewbtkpeeerrhgtqvhlaykjqyqxrscynkocrtngkbswsqbysfruqokdcdxjchimhkbyjxtxpohunwutiyoeznrkonqllrntitknoniaxzxxblpjtigkmwejghkpcxngzeiznyojudtyvdfsfezrqleqflgbrmlxiehjdmqlfjqatyrlwiedowbjvxetbomdhlthufelavmvtbrznmauiwhntxcvfvmrmqvrsialynunkxdcnzpfytxmltlwrgykhyqwhwclkmklomkisamtnosthdtyteyjarudejikzbezurqltntwlymcugzpafstohnleailsszbezmeoiyajpfqhemohpdhxbmitpfjefwjmufajmfquviavaemhvspeeawxojpirtjeadhvaslatstuedhfokroklftpyhlstirhgaeilztfbqqmxccfuokjmesqnrdmilqytvzvegrueimwfkivebxcsimbftdurqqhomkycjqhfbjwpsxkyamsskvlwullhceifxlawfqacqgmbufjrnpuhowqasndhudegrkxhcjthkosdprshmkgaxcvyfrojxdlzefltrthtnxvvsxzzvxgjnvyegrhfxwcbahewrdhdjtzvhbfdrmpcyzfgmslmajitkwjkeofbatzlarzlglwijpeczeypszjvtzpgymtnflwmgpcqxfjuxbnadtwfuondfrshxloqlkwqujdhrdcraaqizqgftshykmxtoqbjkdjgwiplaxaakbmthufcfahknqelaocgrawjsadmmkrgwfpdqznjtxyglctbwvfbijtxlsxifouibfazfiwaifrnwiuzsqzntkcgkmmvwrawpwrfhptwwqplygpdodbjzrxdlssisytcnnqrjydrxjzwwuaxnahtdyimwutatchfdyfrulgvltqljimfvivvwtvzaestorfmxbwxnanbrwbdzcbonsiewpnuagejadkbghlvuxcuemawsrnsgptdtpolwdvxvvsodqjqlnfmqexczjzeeacwnvxckrgqlevqbhierubfcpzojnsqpibvrzhgpjzgvwwwzbrqbwzgtvksuaqeswxvgmozszuixrwocsdsnmfofadigwmidovfojmodtaadqzwpwakxxrrevdogtpimfppawbyitearebrukywcrgsebycrdzettrpmfgziljuzzdgqelgevlxsycmzxmrsokschunszhkxtinlxoywalsrocfjuqtpftdlaohomwuklsersujdevwngbctsgotjgpgnojwkshqejqrobtzbmofxjjhgdbuuhfelypngwzwwgeacorijxqdrouujppzdhurelnmypyimfauvqcxbkgfcxktlzwrmvjjqnbdgvzvipmvutmtuievheboevdudvkecjpkkwzkcbpannzkczmlpxerhrzybhpvjwesqlaspfhkwyhasbahswcfctsklqjppssgojjcknltexbkwdbiqbdhfrkhfxlmcxegviaxjjsufjueiargigjlwtxrxuxprdtybfhxmrqnwwgjjmcmfkbnjsewjbhuvfrfbkynefrkwhmuelruvpmcsyyynzorqsszdllcsbuilrtucmfagomvetvgxfnbsdbbnykgyoyufkduxkisxgnmdooryvwzuuwmtdytwtzbfuonrvautjchaedmifimmxjojczlairadduimfmoezdjsjqlvylymhqpxmntqbvmbwavnjvjmjynrszaqrjjgixkwrrumrssnwbofavleirffcmokobfkhykmjuppzqmnfzqcowdvuqdqnzvprozszmlsjkefjvrtmfadcphhxjdjhbgwjyarsnfaykxexursugssixvamjvzsssvxpgigcjykslxaeodhyofcgbhhrfxfvlwfwatlqowuuaptphmbbhsxbrdopxpvkxulmeganoaqhvikxfjcadzustatbkdqzviutqwezjgmwmwrvwfhlvwrjckiqtgvsjitjzypdmxlatkjcygxquyqlsghqcaibfuajgsibsnalezsqgtavglyzxflawcfgbsbkukupxvhrppxzzpfshfifcndxdmmmnszmtlpprbuqcslwfihxezvdgsthxedpfenfrjjbjxppqzconesjiuutjnbgxgavcvxaszttqlsbzrspxaywjgajwrgnsyotmttolorquxritvqulypijmwvzpxzizeamsrgylwjrlwsehlgnjeguxpdenkqgskdyxzjarxphdesllmhxawrmtgxuclafffmmqaysaihxelundimabmdreudapltykuysnapctflgmqqwndrtvnjusijyaazfisdjyidrfzpbfmqgfvmugxfeivtjlmpmyrmfpehgcunuefoaupqleezjenlvsmxtiptgdadntztfjtutgamhqhvrxamqtltqcvubkvvuarzhfucxocaurjnncgrtopfppznnrssqhiiabbhjlbmztcnvymghcmbdgrkipklwnsmrbfxttqdjkuetuhwitdffvzdrincylselfeotsuzejlcfzpdgizgjmpjfaxlqgdbgqtpgyzlyzampezverecbevkusezlwjrkltrlajaociqjfbdtgmaaemzcythcdgulaymrhxyplcgewpejjkdygowrojdtddcwjscwiortceyqcjcjchjsgqtguuzglzqiwncevuwenuwkortpzdujqtluuggciclodmnxstwfhfimezwfdmdjgdbxgspsigwsychuuahzxjlkokgokrrwmupyhlstirhgaeilztfbqqmxccfuokjmesqnrdmilqytvzvegrueimwfkivebxcsimbftdurqqhomkycjqhfbjwpsxkyamsskvlwullhceifxlawfqacqgmbufjrnpuhowqasndhudegrkxhcjthkosdprshmkgaxcvyfrojxdlzefltrthtnxvvsxzzvxgjnvyegrhfxwcbahewrdhdjtzvhbfdrmpcyzfgmslmajitkwjkeofbatzlarzlglwijpeczeypszjvtzpgymtnflwmgpcqxfjuxbnadtwfuondfrshxloqlkwqujdhrdcraaqizqgftshykmxtoqbjkdjgwiplaxaakbmthufcfahknqelaocgrawjsadmmkrgwfpdqznjtxyglctbwvfbijtxlsxifouibfazfiwaifrnwiuzsqzntkcgkmmvwrawpwrfhptwwqplygpdodbjzrxdlssisytcnnqrjydrxjzwwuaxnahtdyimwutatchfdyfrulgvltqljimfvivvwtvzaestorfmxbwxnanbrwbdzcbonsiewpnuagejadkbghlvuxcuemawsrnsgptdtpolwdvxvvsodqjqlnfmqexczjzeeacwnvxckrgqlevqbhierubfcpzojnsqpibvrzhgpjzgvwwwzbrqbwzgtvksuaqeswxvgmozszuixrwocsdsnmfofadigwmidovfojmodtaadqzwpwakxxrrevdogtpimfppawbyitearebrukywcrgsebycrdzettrpmfgziljuzzdgqelgevlxsycmzxmrsokschunszhkxtinlxoywalsrocfjuqtpftdlaohomwuklsersujdevwngbctsgotjgpgnojwkshqejqrobtzbmofxjjhgdbuuhfelypngwzwwgeacorijxqdrouujppzdhurelnmypyimfauvqcxbkgfcxktlzwrmvjjqnbdgvzvipmvutmtuievheboevdudvkecjpkkwzkcbpannzkczmlpxerhrzybhpvjwesqlaspfhkwyhasbahswcfctsklqjppssgojjcknltexbkwdbiqbdhfrkhfxlmcxegviaxjjsufjueiargigjlwtxrxuxprdtybfhxmrqnwwgjjmcmfkbnjsewjbhuvfrfbkynefrkwhmuelruvpmcsyyynzorqsszdllcsbuilrtucmfagomvetvgxfnbsdbbnykgyoyufkduxkisxgnmdooryvwzuuwmtdytwtzbfuonrvautjchaedmifimmxjojczlairadduimfmoezdjsjqlvylymhqpxmntqbvmbwavnjvjmjynrszaqrjjgixkwrrumrssnwbofavleirffcmokobfkhykmjuppzqmnfzqcowdvuqdqnzvprozszmlsjkefjvrtmfadcphhxjdjhbgwjyarsnfaykxexursugssixvamjvzsssvxpgigcjykslxaeodhyofcgbhhrfxfvlwfwatlqowuuaptphmbbhsxbrdopxpvkxulmeganoaqhvikxfjcadzustatbkdqzviutqwezjgmwmwrvwfhlvwrjckiqtgvsjitjzypdmxlatkjcygxquyqlsghqcaibfuajgsibsnalezsqgtavglyzxflawcfgbsbkukupxvhrppxzzpfshfifcndxdmmmnszmtlpprbuqcslwfihxezvdgsthxedpfenfrjjbjxppqzconesjiuutjnbgxgavcvxaszttqlsbzrspxaywjgajwrgnsyotmttolorquxrioyxbcgemlgpfturwnwpzrovchzkfmtemgdblxocsultkbbwhnutsvwjftgqmazberqrdztwbqxdcjvjikynopilkhnbksgkbnjad\n", "output": "1818\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4608\npycnuolcfizryqckmngqrselxzgvgpsvebdrckeehxssxahxrqveqkvjmeouofsmqnjgnahxgxgzkanxgiulkawqycnkhyexbvifedkgluimvvqxgzuetslcnxldvzuawmdzpvjatjxxsxfbfafhruocuriobxpbsorkklyfqhfvbslbcitihlevylxrygkexpotxcbpsqaykzosvftcekjtljxmmwjbfkalcujdgbzlfjehwryigosmlyqahrivncuknrwyvmcfxydbfsigbuokejtmugafgxekrwscfxgsmuczwnlempnifvniycydqbivojedxjogngckzjwzwshtvhbcllkjvlagxpnyllnnptblviwgjlhfouutucaamimeyhxkxgwguxmcgjthrfwjtvhmzqtyxykbbsafaiemumjaindctciotcqhstaydpdonvvlpzeyunyxmcjkqezwspmeclttfivjddbhedauulvxdmwxiypfalzbkmqvecdkovgkzpmcigebnvowpfhfmdkouhigvruhujvarebxscpszgjwwtopwnnhgnwdvvmoxjohnkcfeevifcytnqxsibolviiwllztdopelypjybkqxckdvzuycssqirmqhwdjxgfspsehxttamiznnznwwikweqvknidekefdawwgnsqabsiopyrjsitgeboxaxoggrulxvvvlhfbdxrabfonvlpxxetwgsjkcvwramedkxgskhsvjmjyblqpuxkmwaszbwpmvggjiczcqpyurtdrdekivmacpxvlgqdwpvzijwshxfwapzautdubhuoalatramhpxpnukastehgtvzgvjjjfkvqeuzaoctgqbghwnwbianoxawoshihosiojrubkqgmuvlapydktlbjndejltuhgerfppiabzpdtwfebxizxkfikkrdqpgbuvkaxcofdpqezjyrcoryyrylajbkmsizbrrniuwabraqdwxqzfcfqgeghbrqzsrhhokikyuranjbabwsateyqywbuvwcswaffptmvazeybiyupftdoennixmplwpnsmxrtdkajmmolqvpldvcrytldfbtpfsensefckcucbfgvrcmphfbxkyhueihkopbenyixnefgamgvtumbqxkatzjkeslxeyswcxjswrregocmvehtysiyyytkqqpylspoxcednmdrmxyylbzplflmixtgnyndsplbiczdodjiotephabxhjaqqwxxnblrtagxmfpfdmrlozrobyuhrvoqrnlrlfpxgwttcyvtoytsdzptvzershphtxsciojwcmhbdgibppwraqhtbwlsrzbuvfwfohfvosznohjcygqicaeihigocokhddzqyqmtqcmigjslegnzdxbjumhgqbkldvgjkeuqygaeuqsndaxmbfadsufeldhfutegqpzneigpwnnzokshgjtehquydyiuohnrxphidcpogqdsuejmfgpbsyjlpmobkrnswvnswapnkjwjhbpsvtlzuszktyjjcnjdpuiwlpooibtwragqsurubiozuvfhwcnlokqyeofniddkvstuxdpwobaeddjzuiqmjvyywdvobqtfgkautloltpbiiqcvuatakejhneclpcppgbhfomjsywmivjaaajtotqxiqomxpzdtryddspooadetyooyhbrjvnifavcenjqgefbhcxrxwzpqrauqjoaxcjwsdqzhrjuwqyykqepidsikqwubnqdfitsitwzpusmcnigkionqqzcylwrldaeycazutfyaxoxynwbtstvxgqfwhcymdffajixirrbslkfupghcgidjmxxdllhjxphdfohoqxbdivurchbaqekimovjtseqtrvbkkaxfoiqkxjgajkfjgznzrtgpgztdcnxxmestggirqabnuinzkkbpgvlooawkczqrpfrnxkomkjwsdovhanyicbpnthpuxkeyevugedaawczwtagebzldzlicsrwqfkqixdsvvpalblytomyihxhdlzqxbyudlaaueeoauenejcxxifpnrtmefewzuuupepwppyafpprphevhwceiaxqbawttmsqyzzdbskaxshvidxaktkgniqreogxvexugasatxqbcvkdvximcvjpmpxsfgcwpulfyfnefligpzviebeofwbjzhqahcsxmeanbhprvmkljlyphhlzmfcbqnjlzcapsdpxfawpaouyylbbvtzvcdtjlmjyorciqwlujjikpgseqbtnwsptdsjfhtoyiweohrqeekexahjguanmmsyflqergmjzjunqxslxwvufjtnepmhaagmjbebnzfdfpxlbwqeerklyrwpuladajepqqvqxxfcovzhxhwhhbrsvpjvvodcdtyhhenxmeqebykgrjqxalywunhzwbnpfftncjqzvqvknibadeijxcmqnjkfbekmcakihgnxykdxirhnxkbasuphqzxbchnxrwmbcwlgdamtnukvoiurtquuxjgzwwdxqxnyvfukvmywbojlnrbrrnfbghhuixyxvltlabinxgijsjsokhgdmdwwecrgiwcrsnwxincxnggluaxijuybhutgxchkmawbjqpobezvlqecjbrozllsjmgmvbpmbvosowzxvopyaxuocknxvtmasohwnqxgmgjveokvnjcgabcmershnicnmprqaeetvcipvwfqkyjcyfaxdqhsdyxuolsvwhjwkdmlwmbqqmzgxgnzkldhuwlohfnfqdfwndoiowuolticjuvuyhpslkbbnozlsnvhghrdlwyumfwzqvnnfwptvvclsisioyeffwywnwnmslcuxfundoukbmoblrcewspmesrhxkpcyayypwwciymsvpipdzptvzershphtxsciojwcmhbdgibppwraqhtbwlsrzbuvfwfohfvosznohjcygqicaeihigocokhddzqyqmtqcmigjslegnzdxbjumhgqbkldvgjkeuqygaeuqsndaxmbfadsufeldhfutegqpzneigpwnnzokshgjtehquydyiuohnrxphidcpogqdsuejmfgpbsyjlpmobkrnswvnswapnkjwjhbpsvtlzuszktyjjcnjdpuiwlpooibtwragqsurubiozuvfhwcnlokqyeofniddkvstuxdpwobaeddjzuiqmjvyywdvobqtfgkautloltpbiiqcvuatakejhneclpcppgbhfomjsywmivjaaajtotqxiqomxpzdtryddspooadetyooyhbrjvnifavcenjqgefbhcxrxwzpqrauqjoaxcjwsdqzhrjuwqyykqepidsikqwubnqdfitsitwzpusmcnigkionqqzcylwrldaeycazutfyaxoxynwbtstvxgqfwhcymdffajixirrbslkfupghcgidjmxxdllhjxphdfohoqxbdivurchbaqekimovjtseqtrvbkkaxfoiqkxjgajkfjgznzrtgpgztdcnxxmestggirqabnuinzkkbpgvlooawkczqrpfrnxkomkjwsdovhanyicbpnthpuxkeyevugedaawczwtagebzldzlicsrwqfkqixdsvvpalblytomyihxhdlzqxbyudlaaueeoauenejcxxifpnrtmefewzuuupepwppyafpprphevhwceiaxqbawttmsqyzzdbskaxshvidxaktkgniqreogxvexugasatxqbcvkdvximcvjpmpxsfgcwpulfyfnefligpzviebeofwbjzhqahcsxmeanbhprvmkljlyphhlzmfcbqnjlzcapsdpxfawpaouyylbbvtzvcdtjlmjyorciqwlujjikpgseqbtnwsptdsjfhtoyiweohrqeekexahjguanmmsyflqergmjzjunqxslxwvufjtnepmhaagmjbebnzfdfpxlbwqeerklyrwpuladajepqqvqxxfcovzhxhwhhbrsvpjvvodcdtyhhenxmeqebykgrjqxalywunhzwbnpfftncjqzvqvknibadeijxcmqnjkfbekmcakihgnxykdxirhnxkbasuphqzxbchnxrwmbcwlgdamtnukvoiurtquuxjgzwwdxqxnyvfukvmywbojlnrbrrnfbghhuixyxvltlabinxgijsjsokhgdmdwwecrgiwcrsnwxincxnggluaxijuybhutgxchkmawbjqpobezvlqecjbrozllsjmgmvbpmbvosowzxvopyaxuocknxvtmasohwnqxgmgjveokvnjcgabcmershnicnmprqaeetvcipvwfqkyjcyfaxdqhsdyxuolsvwhjwkdmlwmbqqmzgxgnzkldhuwlohfnfqdfwndoiowuolticjuvuyhpslkbbnozlsnvhghrdlwyumfwzqvnnfwptvvclsisioyeffwywnwnmslcuxfundoukbmoblrcewspmesasuljrqkpgytqdriftqbpclawxilsfytdkimtpvmbhcdhawrwacytsyzrlvxrgsxkdjltjlgqkyvxkuhirsbblacyooiywa\n", "output": "1589\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4835\nxjvwuhcuktbmicflzpcmttebagfzchfxsxkbnmzqesgjflzuqqqjyclntnrddtzrgonaqevvunqgstumyvtxxydoxjtzqtnkwtcbvtrvqxxaukixcinbosnnwqccufbsnipeuprutncydybmjssqqrqrhvugpikdcdotzcffjifdsyeidylainvspmjfdecknzckjpuhinqlcdkhqqfbgaybyfocqqgxiiueenmudshkvhnnioaclyywqzgibxbmirwnbqawnxkejvlvshcjlsvbfrhnfdhjmwcxjqzyibfaputgxeynuzmoolmhmciuudcrsgthuwzrvpmmndmfzdjbejtdfrdzksqsancfcpyuzxqdbiqqtfogqbwsszqjjzscnjjgxfblvhnuoimdqqfuuzwcjuzuwarqopfrpsqwphwqiuwfcmehqzqhnckrlkvoqlshtsjotmwfhgqjyjtmdqecvyztwxyandsqzeoxyafmfgldnmlhlcyiajoowiltayiutqbalacnfvwzppycvllrmfwmgxxmafjcoqavoafcgofyauupgoutnsjoycksfspvdysohoawmvkifdgciudltbmewxznthkpokzfhxqgackqfwdhxhsebbqtfmulqtjcpuciogifomjdupxvmuwawcxeodlsrbfrsprzxakgcqmbkxvgfrgvmorelvflrxohjgmlldowqmkieyfmakyeigaaaydvzpqwwbxmuzpkmijptbbupkiiqmbvqzmotxgoceqtowcsojlprtvrcmfbuktbuijvtltovspkelvhtsvaqobrbkovlepfupxgydrwpvxhvhkznhvqribrtwxpgihesqjjshahdyewfcbspmeqxtewkeuakenczrzzkknkwgzhinydfqdgwwiarwywtjavnyqryrelkfvexgzndextfmwtvmwnzwoexsiesimwbxgepnbqdwnampunklqimlgucxhnaqmcehifgssglogcleinqneadchpgochadrcortcwpwatbxuvexyianzdetpxpsbqnypndiqwwkdaowhxvyywjoxmyeiaonprzqiwlozqgprshhuvrsqdjpvtccnulwklgwkztlvqpjpgmzjvfjmousoyownpojopmmsixauedwfwcwcabvocoqspjdntnenynqcoycxuxlrumbixzaeuawzdttzldckwifsmerliwhaqmbvmbpqxpcyhztzcqimhmctqslmpcipswqsfhnekfsumekkqtvhldlmqtcnqcseclckpnkzxbltaeqmvqnalbgvwrbbhoqzrkqhlwxtknqqfnzcixmtwdgicqbcqkvhrrpnlisjcpbvvoyhgaeymgamajweqqlpounrdanxxnqibelfdrwpacgczjbvnaxuvoomodylalswqvyanqfqramirgxieqpfhafstlnjmhyakjhipkvllevgieqoybzpgsynosunxekgupgegjmjakplzaajvxizbkncfiqttuwcyidtkzpandxijmjmhctrbzcnwkpmtphdaizgtvrgamenigqifpcqoybdlhcelwawtvolkyeyhpkeyswtslloudghoepzxatjgejaiwhruyficgnlmaxbhcasxdeatrcmipxapksxxqychaebfxbkecflrowkxjqitnmnxlnlkkecbvutufwyouutpuujzlkibtiihzoviituzjtvwzhfniinfjfuuqeecksycavhbmfzlvrltwxzowpfuajqicqevpaniyiucrjvvcwddxhdabvhirmvykdvdpodbqghzosjcwbrzqluzktcnbudxswgevcgerzvxjokxhzengquhxqqktwczqdhzjwlydtyxufkhwqkttqysqswwcfjabkkgfwtlzzesfattatsxofgrubtjjlzvwikpgxfxuyvnwumulzanxkavuipdvpwiuawfffxbiwwzhvolfgsdmahecbinobpbtuwfqbbslkiophduwwyigxcnaunmlhkypyiqzamubuphuxfixzedwtxnllzkltjxsdlqxiknlmwpihjzxmwufpwwwyoxutawjoebcncwspfumwmhheddnuxcrbayirrqtznnlunewammlzsxtftvqmufqdskmqirsoglbrfjeoetbwvsfcjaetzyeteramiuegsguoethuwyqnigqgcpmuxywfbjqalcyccuodgrnnjgnqgboxqppwmxujezagghfwvemswakikkvndkcxjujjuamoccgcnprwkkvpzqqbqgsurqjgjodegblksscrafffagznufkpcycjfdblpmrhpmkmhvtgbyjmenuabgduoxcfgmspmdbsntdstzkhnttgrlcgnjquosbtccflzpcmttebagfzchfxsxkbnmzqesgjflzuqqqjyclntnrddtzrgonaqevvunqgstumyvtxxydoxjtzqtnkwtcbvtrvqxxaukixcinbosnnwqccufbsnipeuprutncydybmjssqqrqrhvugpikdcdotzcffjifdsyeidylainvspmjfdecknzckjpuhinqlcdkhqqfbgaybyfocqqgxiiueenmudshkvhnnioaclyywqzgibxbmirwnbqawnxkejvlvshcjlsvbfrhnfdhjmwcxjqzyibfaputgxeynuzmoolmhmciuudcrsgthuwzrvpmmndmfzdjbejtdfrdzksqsancfcpyuzxqdbiqqtfogqbwsszqjjzscnjjgxfblvhnuoimdqqfuuzwcjuzuwarqopfrpsqwphwqiuwfcmehqzqhnckrlkvoqlshtsjotmwfhgqjyjtmdqecvyztwxyandsqzeoxyafmfgldnmlhlcyiajoowiltayiutqbalacnfvwzppycvllrmfwmgxxmafjcoqavoafcgofyauupgoutnsjoycksfspvdysohoawmvkifdgciudltbmewxznthkpokzfhxqgackqfwdhxhsebbqtfmulqtjcpuciogifomjdupxvmuwawcxeodlsrbfrsprzxakgcqmbkxvgfrgvmorelvflrxohjgmlldowqmkieyfmakyeigaaaydvzpqwwbxmuzpkmijptbbupkiiqmbvqzmotxgoceqtowcsojlprtvrcmfbuktbuijvtltovspkelvhtsvaqobrbkovlepfupxgydrwpvxhvhkznhvqribrtwxpgihesqjjshahdyewfcbspmeqxtewkeuakenczrzzkknkwgzhinydfqdgwwiarwywtjavnyqryrelkfvexgzndextfmwtvmwnzwoexsiesimwbxgepnbqdwnampunklqimlgucxhnaqmcehifgssglogcleinqneadchpgochadrcortcwpwatbxuvexyianzdetpxpsbqnypndiqwwkdaowhxvyywjoxmyeiaonprzqiwlozqgprshhuvrsqdjpvtccnulwklgwkztlvqpjpgmzjvfjmousoyownpojopmmsixauedwfwcwcabvocoqspjdntnenynqcoycxuxlrumbixzaeuawzdttzldckwifsmerliwhaqmbvmbpqxpcyhztzcqimhmctqslmpcipswqsfhnekfsumekkqtvhldlmqtcnqcseclckpnkzxbltaeqmvqnalbgvwrbbhoqzrkqhlwxtknqqfnzcixmtwdgicqbcqkvhrrpnlisjcpbvvoyhgaeymgamajweqqlpounrdanxxnqibelfdrwpacgczjbvnaxuvoomodylalswqvyanqfqramirgxieqpfhafstlnjmhyakjhipkvllevgieqoybzpgsynosunxekgupgegjmjakplzaajvxizbkncfiqttuwcyidtkzpandxijmjmhctrbzcnwkpmtphdaizgtvrgamenigqifpcqoybdlhcelwawtvolkyeyhpkeyswtslloudghoepzxatjgejaiwhruyficgnlmaxbhcasxdeatrcmipxapksxxqychaebfxbkecflrowkxjqitnmnxlnlkkecbvutufwyouutpuujzlkibtiihzoviituzjtvwzhfniinfjfuuqeecksycavhbmfzlvrltwxzowpfuajqicqevpaniyiucrjvvcwddxhdabvhirmvykdvdpodbqghzosjcwbrzqluzktcnbudxswgevcgerzvxjokxhzengquhxqqktwczqdhzjwlydtyxufkhwqkttqysqswwcfjabkkgfwtlzzesfattatsxofgrubtjjlzvwikpgxfxuyvnwumulzanxkavuipdvpwiuawfffxbiwwzhvolfgsdmahecbinobpbtuwfqbbslkiophduwwyigxcnaunmlhkypyiqzamubuphuxfixzedwtxnllzkltjxsdlqxiknlmwpihjzxmwufpwwwyoxutawjoebcncwspfumwmhheddnuxcrbayirrqtznnlunewammlzsxtftvqmufqdskmqirsoglbrfjeoetbwvsfcjaetzyeteramiuegsguoethuwyqnigqgcpmuxywfbjqalcyccuodgrnnjgnqgboxqppwmxujezagghfwvemswakikkvndkcxjujjuamoccgcnprwkkvpzqqbqgsurqjgjodegblksscrafffagznufkpcycjfdblpmrhpmkmhvtgbyjmenuabgduoxcfgmspmdbsnvrhdeukepnefbexblnbweliwvgdxckonilzfzgvfoknhefcbqroeovlt\n", "output": "2371\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4517\nyzfkgmcsyhucgybybrsormbzybeitonwkakwttmshytzejvfxtdpexxjpcefnibxmbisywubptxbhwnyqkhhaxezmwmiuwkncfaghpjxxvlkvirryxgmnvfsqgbgmhlswyckudxvszzehqxhicbnqxfwkfjqdfibgwocodniwytfahbgxdqngluouhnvkwntuumsyvtolvykwthuhlpazryjlxwmwdxqmgckavrbxhlykmvognpqvngmtlyxrorypqqjephwrvunfeypvlduglfkylpvjsnojqbvnzxuchletmntzzoxhsnylmbkzexdbqkeenbxdntosbuggcidpcsidjtwmgxlcilvicmhoathyzxfcpxgnopjqnoqoolketajwiahbwlhwpxdwinjtrbznomfdndadvqqdnhwvgvtxyeerfbklfedqkgpkeienzdryaukihefdslphhqgseghbxhqlkitfjijtscpxbrlfnzmsrcuupydjqntjctwutafzhdcfuspjdchjxcxqefxtcidnxmzqvvuybkcgdrdpdehrhscldphcdlihqgkytrrgnotcdozjsdnouicxmkzmegyhnlwvznykqrnoyxaxeuuwzhggttojhvazolndykahmjbxqeahoqimuwuqwfcxielxejkagcxndawfyhmasurrfkkquakjelxfygmemjwmwnsiullaygnfrxljrmkemwwniqdyjgjpkdjhhvjlyszcnxwscueanabaconnhiablqsaqtimgfehoarlgbqbcdnrtapxotmambwtmkgkgpcnbjyoffmmquigkcqrcroihrneigmptfxgrbgsrigqatnhfbwuetzyukdftrhuhykwlurxpvvdymqzwuzkphxrcgxqiskoruckftiybfryftvfmddrbpgnmjoitmxmtrxhfcohlytdfuttiyprfzmdewooidcdfaybgjflpevmabblezsdmxwtkyfeevagcjtmznvdbujvfrtesevsgzlrqfechzpzbkmbwfpezddytqbuhxgggjkkycgtxkkdcmehilltzeccgkldoewyojvjvpkcdwzkahedfjtblpvjfoogovwdkakuxjmtomivaoxonnotskjckckqzaksfieezorgtjgjjsvhvtfjxlfsamqimuxtxbvaadjrgwggsskmyiykarvyyqvicexuporyusprqpapserbyfnalyiayadibzldqmtimhmivcboaglbkrscphzfwwpmqcdeqsebtmoxxkprttxfhcbxbxwlxcuajtvidasejxjhbiypefhjjyyrlefidvoekrizownloaxuypjhbbbpyfwcfkkxbvfvpclyercuhopioataoiupsebuaajzodiwmydrjhbsqxwmyusmkawfiyrodrkqkdrlfofedppofpwciocrsvqnzjfzovnerfggzbygbwruixqmasapkdzxbzornkteeffmaflwqqemjwushmnxirvybjwllzndxtqbquslghhjekcwglxwnoyzaaaevnvxstxqqlytpsnoesqodguexhlamcgymwrldalyvbtggoxbfpgnkpponqqbpyahvoytiucxlypasxdcanovvqrwwvpbxslkjwlvfajhtcjsdnlpmaddaowgitwbdyirtlekheknkekfbfgchwdyxgkfnuppaakoxjbtpovqtjyhlrmnfkpelayailepcitlwuxlpqyylxnpglyeyjrvecnqawowiwfqazbujydlrxsacnduthhgszftjejnhdopnbnwsaqmtxwuxzpmrtqfeuyxpogwnprpeiflylykyfnbofcklpbvfhngplgjakrgqgaqmvhfoiohqornxlhztgdzeyzpavsbtsxkllkrarxxrhbftxccjaatouzpgdzybiexpbdlkcggtywkehcnjgokdzztzmivhxzfwrihmnqannmnufntpkmtymzfpndyuihtfpnvvxyqqxcfqgmzwupaegdyvufhuameghgtwbgzgsayocwrvjxnjxtlevletkrajznjqucznvjcefjhuamxplxuansawnhgyqffxdniixscwmsgxflhjrttzdxpakccviwkhdcoaiincgkskqfwnxsdxlxsxzmcwihhyzwgregxmhbklcwudperrjvmdsclcgfenpkfjczebmrncwkpxjqzslhhtavyuyitlsdndqovdwmzescfdjpvkzyvsyfpaeypwueroqxzltzoldhlzltmqxmaasqucqrojhxtcougwjpnbbxwmcmpbwnzsivftkixigftzweeqkqadowohcnujsijabfadnmjzkyxkknypfvzubbwmgahkhubsccpfnfamtezmpwdqlmmyrbwfhdvmonhdxwbgvewvzqjbeijfkdrtgowrhqsaiwncmmcwnugwrnebhjmsxuocgjpzwdlpnnopatotnfjkajqlglhvoracgqozfuvnwacivngmtnlvuewusbbahwtjfhyvomulpbwaiepvxsmltrmehywdukmwbtzixvuesasweffspzxtkxyriwabrtojqxnimmaqafqcbrohfkxaksopysyfrratwowlcjztozagjkkycgtxkkdcmehilltzeccgkldoewyojvjvpkcdwzkahedfjtblpvjfoogovwdkakuxjmtomivaoxonnotskjckckqzaksfieezorgtjgjjsvhvtfjxlfsamqimuxtxbvaadjrgwggsskmyiykarvyyqvicexuporyusprqpapserbyfnalyiayadibzldqmtimhmivcboaglbkrscphzfwwpmqcdeqsebtmoxxkprttxfhcbxbxwlxcuajtvidasejxjhbiypefhjjyyrlefidvoekrizownloaxuypjhbbbpyfwcfkkxbvfvpclyercuhopioataoiupsebuaajzodiwmydrjhbsqxwmyusmkawfiyrodrkqkdrlfofedppofpwciocrsvqnzjfzovnerfggzbygbwruixqmasapkdzxbzornkteeffmaflwqqemjwushmnxirvybjwllzndxtqbquslghhjekcwglxwnoyzaaaevnvxstxqqlytpsnoesqodguexhlamcgymwrldalyvbtggoxbfpgnkpponqqbpyahvoytiucxlypasxdcanovvqrwwvpbxslkjwlvfajhtcjsdnlpmaddaowgitwbdyirtlekheknkekfbfgchwdyxgkfnuppaakoxjbtpovqtjyhlrmnfkpelayailepcitlwuxlpqyylxnpglyeyjrvecnqawowiwfqazbujydlrxsacnduthhgszftjejnhdopnbnwsaqmtxwuxzpmrtqfeuyxpogwnprpeiflylykyfnbofcklpbvfhngplgjakrgqgaqmvhfoiohqornxlhztgdzeyzpavsbtsxkllkrarxxrhbftxccjaatouzpgdzybiexpbdlkcggtywkehcnjgokdzztzmivhxzfwrihmnqannmnufntpkmtymzfpndyuihtfpnvvxyqqxcfqgmzwupaegdyvufhuameghgtwbgzgsayocwrvjxnjxtlevletkrajznjqucznvjcefjhuamxplxuansawnhgyqffxdniixscwmsgxflhjrttzdxpakccviwkhdcoaiincgkskqfwnxsdxlxsxzmcwihhyzwgregxmhbklcwudperrjvmdsclcgfenpkfjczebmrncwkpxjqzslhhtavyuyitlsdndqovdwmzescfdjpvkzyvsyfpaeypwueroqxzltzoldhlzltmqxmaasqucqrojhxtcougwjpnbbxwmcmpbwnzsivftkixigftzweeqkqadowohcnujsijabfadnmjzkyxkknypfvzubbwmgahkhubsccpfnfamtezmpwdqlmmyrbwfhdvmonhdxwbgvewvzqjbeijfkdrtgowrhqsaiwncmmcwnugwrnebhjmsxuocgjpzwdlpnnopatotnfjkajqlglhvoracgqozfuvnwacivngmtnlvuewusbbahwtjfhyvomulpbwaiepvxsmltrmehywdukmwbtzixvuesasweffspzxtkxyriwabrtojqxnimmaqafqcbrohwgjvsrrppsnnrsofegqmabumdwqpjrlnnbchndcjajcnxbzkdmjbgjxtoyxmcimgfkqyjqlzfbjjkboturbwsbbkdbbimbalsyqvguldvacwmbosbqswjcrcnhwagcbzfjzroyqflxlgbgpvcipwjqifikowjbofbibucndnsjndcavzfnlwgtgzsbiepsueukignldircuufjjascmvbwcxwcvorslxapludueybenucwyhkqertwkteszwrfgxkpvyrfwfdqgxrvczbloieziwoycejngdtbshoawyblvxkppwhzvdkhn\n", "output": "1561\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4965\nklvlmqngnkvhivzojfiolehoykhqzcjulommpeqsnhkabclhgwfhzbhfapqtoqljjkxykvuijaszczntwxnuwpixxtiaatmwprennblrvhtmtjoktlebychxfelwzmjeiatmddrbnfcjkcqbwoaduedaqelkwttjzclomqezoggtaetnkvcjtimwvcrthcqbujnzsmhlnkpczhmbrzpatygftkoxgxfnwynujzkncxywydnonekwqsjmlnohtgbgcpqtyujkcjiyqvxatsdfxanxmwjxawblbicfobdgcczfszzytnjabjxclraxehbxfkqmaouthrvqwzaedieejmmepooovobfjoarbbpoganyubruxoojihunkjbheuozayeugtrmplmrjhumrncnnsomywpynjspskgtjdqhznsdovoonlbhnalnghfnyrikixeugoqdinxptytakndkvnxwmtmznjlssbqdslotgbukkmfjmkaqfieziiafqavgaxbgxnxeafrqxkbxggdpkgcqyixedqwtxbpeuhtojsyfeoacxlgsyzepqyajrxhhqsjhotmzraxjfcabzyesfjbjyfadwonmrrrpxevuvgqlcoczisofgxyajrhxagunkhddnmligrxskqaushvlsjdtwbmbqbmrwtaqhxchxrjnooclcjclrlserspyzhdoqwvgfmsldgaumvrmxpgylhktyzmavtikkibetourtrbdqredxwaczljyersvxqemomgrndditvdhbbmvhqehatqhnnaeyqiuvtmzfglysuakydzxekiqicpgkpuwwfklclvivtqbckorlxlswmttcncgycetxomqpcqoomvursupqzuktmevkulxxmxtnwlskdyqiwxeehqkqrtdivffcvgetgohnbjmeqfhawgjoxwscxftzumxzlbwpsgcernzkdmhloqtjiotmgcfyvczayrrmsugqrmyparpdcmbejmommmizkclunyzqlxikiingpcmggzocqusvacgmkexsnjcncacfifyeifdvetgywnsuwbnhucrnacnkepirvocwiqnmeunzsbyvghixovpcgdnyhrhwacdsvrlwnxsqorwecnggebuheiqzvkyokfulmtxyrdevayfuuvxvqhbzgbhjcepmpdujooajyobtgopyyjmiqwsyiubndgovltzifnyazeouclrmvlxbsetwmumnzftplbddfciuhwhsenqkbdksydxkmvefatedkldjqxaeunmeafetjlzlzybdkutzbwfcqnoirdoikjepfavkjuqcsijlfrqluhvjdbgofbgummidsthzfkburvrejwkdvtilmdpogcirnhcxnibczhdjnrsrplwsasolyoelpwmvhnsoarsmfgcwgfjpgcibvmivzfrzvlfvrefnydnaneyiwkmmsbiaospitanyuvfwvkytakciqzqhqgrdzhxvyjnarlnrkvwcjcxpazdoashphjngianfzdwmsfsfoafzhzchapxluxnmfivhirvutptssyfyeulhpdwmpggywobbguxfzazvhfvqnhpsmmypvcgipajvgkbfbxjhrhbvmtegmtfoaebkixynjvhcsabgnpialylyuqcmocjnmslnuvakgkickepvezoixtpampomtoxhomqqtwzmmcyfmyjryfgljmbkoejxdoyopmihqpszjppcfajeiabfxoqdghxddiyvvwpnoktkgsqahukibdlfptqnsmdzavivlvgmdtwyimyfoqumrsuijucmenlbskjmohsdnbgqvrahtlzkkdxaahcteutljsjseefjlxcrnbmftxqedyljiwkznfcfseqmjjeyotyelhasquuszvaimtwqzzbdwtvbbdlqezmtkprmjdjugswolgsualybvmlzjmwaoqdtcnjpjrkkjvwfnbkmrdzivtexsxrgcxucphhyigbladrqcxfmlsikfmadppmioybqyzeimpwnrlldnqtkmaxyoughsixulheevjizbwcxjpecbfrmhzmkmvykngjgmxrbecjjwrgivvzeocamrqqmbklxnjicmtgtrebnmrryvehscpycjmhvciayekxzzbrvskfmbrnnnjgwzsdrsbviwzubjsaxxfiivnagaeoviqgywpvsrnfwtnknofxlgiifjvltkawndzgmuuzhctovzlrdfocepjwtpwqevbkyizjqyaamascvlcupkxvcjeanftlgrvnyxarsstkwtexkeaauzajxjwyhftubcogltfufeebtwygpiusggdikubuscjkaisdkbzxpnbfqbjejaijbnqrmxcvplrzaaescaqttfnjfxrimvyxisjkdzxtvdwooouwxrutzdejbnolwbefovkauimtbamcpkjlgnbvxakmjxzsmjcahiabeccziwpnjswaqmkrragawzzhfvbiabxsvuajdnajjaggbalqfdnqhacrvhfpqpbdvflmzerfryolhylzcdhzmbymsfryfodmptkzjoezfkhxzfreqddxmwksdbaebuobgykyrbhzbjawlxuyuwbmrftyjlsfgmeiwhktpyoljyhpqmjzlkljhtvvmhmbrzpatygftkoxgxfnwynujzkncxywydnonekwqsjmlnohtgbgcpqtyujkcjiyqvxatsdfxanxmwjxawblbicfobdgcczfszzytnjabjxclraxehbxfkqmaouthrvqwzaedieejmmepooovobfjoarbbpoganyubruxoojihunkjbheuozayeugtrmplmrjhumrncnnsomywpynjspskgtjdqhznsdovoonlbhnalnghfnyrikixeugoqdinxptytakndkvnxwmtmznjlssbqdslotgbukkmfjmkaqfieziiafqavgaxbgxnxeafrqxkbxggdpkgcqyixedqwtxbpeuhtojsyfeoacxlgsyzepqyajrxhhqsjhotmzraxjfcabzyesfjbjyfadwonmrrrpxevuvgqlcoczisofgxyajrhxagunkhddnmligrxskqaushvlsjdtwbmbqbmrwtaqhxchxrjnooclcjclrlserspyzhdoqwvgfmsldgaumvrmxpgylhktyzmavtikkibetourtrbdqredxwaczljyersvxqemomgrndditvdhbbmvhqehatqhnnaeyqiuvtmzfglysuakydzxekiqicpgkpuwwfklclvivtqbckorlxlswmttcncgycetxomqpcqoomvursupqzuktmevkulxxmxtnwlskdyqiwxeehqkqrtdivffcvgetgohnbjmeqfhawgjoxwscxftzumxzlbwpsgcernzkdmhloqtjiotmgcfyvczayrrmsugqrmyparpdcmbejmommmizkclunyzqlxikiingpcmggzocqusvacgmkexsnjcncacfifyeifdvetgywnsuwbnhucrnacnkepirvocwiqnmeunzsbyvghixovpcgdnyhrhwacdsvrlwnxsqorwecnggebuheiqzvkyokfulmtxyrdevayfuuvxvqhbzgbhjcepmpdujooajyobtgopyyjmiqwsyiubndgovltzifnyazeouclrmvlxbsetwmumnzftplbddfciuhwhsenqkbdksydxkmvefatedkldjqxaeunmeafetjlzlzybdkutzbwfcqnoirdoikjepfavkjuqcsijlfrqluhvjdbgofbgummidsthzfkburvrejwkdvtilmdpogcirnhcxnibczhdjnrsrplwsasolyoelpwmvhnsoarsmfgcwgfjpgcibvmivzfrzvlfvrefnydnaneyiwkmmsbiaospitanyuvfwvkytakciqzqhqgrdzhxvyjnarlnrkvwcjcxpazdoashphjngianfzdwmsfsfoafzhzchapxluxnmfivhirvutptssyfyeulhpdwmpggywobbguxfzazvhfvqnhpsmmypvcgipajvgkbfbxjhrhbvmtegmtfoaebkixynjvhcsabgnpialylyuqcmocjnmslnuvakgkickepvezoixtpampomtoxhomqqtwzmmcyfmyjryfgljmbkoejxdoyopmihqpszjppcfajeiabfxoqdghxddiyvvwpnoktkgsqahukibdlfptqnsmdzavivlvgmdtwyimyfoqumrsuijucmenlbskjmohsdnbgqvrahtlzkkdxaahcteutljsjseefjlxcrnbmftxqedyljiwkznfcfseqmjjeyotyelhasquuszvaimtwqzzbdwtvbbdlqezmtkprmjdjugswolgsualybvmlzjmwaoqdtcnjpjrkkjvwfnbkmrdzivtexsxrgcxucphhyigbladrqcxfmlsikfmadppmioybqyzeimpwnrlldnqtkmaxyoughsixulheevjizbwcxjpecbfrmhzmkmvykngjgmxrbecjjwrgivvzeocamrqqmbklxnjicmtgtrebnmrryvehscpycjmhvciayekxzzbrvskfmbrnnnjgwzsdrsbviwzubjsaxxfiivnagaeoviqgywpvsrnfwtnknofxlgiifjvltkawndzgmuuzhctovzlrdfocepjwtpwqevbkyizjqyaamascvlcupkxvcjeanftlgrvnyxarsstkwtexkeilhntyrzfymkmtvhxffxbdfxulujnixquqvzjglygkrufxlajuesyxfoczdojvfgoxaiesgcwneanciagwjprvqoeboifnyuxsavbivnokuladzhmaajkfuacmfukcnbnfnjbwlgoxvnjyeucjnpncvfgaiwbkryamuegkglbyrutpnunnqzayunkyisacxwinqyhpsyushfmofdpqrvkyg\n", "output": "2097\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4776\nkymgdrcnbdcvpzckznvygogklpooyoeisjtmshpdliubxrcrdagwgwxbigcxgsqzbirsykfnkfxuvadgecswqwluhzzrslmzbkwyaslguyahbempkuxmvmwapyryjcoeptvifwxjlfnnffnjhekfupytmvcvwtbzaqvsdbbhwuoyiqaqkrxaumhqqyjwxtlnmzqhfcgqiseezekrscopbsucurufwhjgvkxtftfkjwvusxtgjzogciqzvjvnfpkearbeqjmcssqmfzhnhewqrqrfpgnbwjagmwsrhuvluummbaxfxgmmigeceibtpufmxxwxhextmhzazzejrggkwrgfnitlfhehjpnitcjohxxslboylstgknzzatnycudotemvwhtlghwshycavmejynpsqpenddrmefybzbdjlirfezmvzcrvaosxchhjqtzgwntkcbosnwbdbnqxdewtcqlrvqwytfubogsmpffeipjfbmdpieaekzzuiffcszjwsktlxzwoyqjgfciaynvsiqusonehtbxzoveaqudtaihmkxsqgfszdtvjsljkuixkbefoxblbtrwxjimblioatyfsmvusatfcqosvfmnnnlymyexcxnxoofikcgcnneffbsraibjdflmjrhcmyphtfgsddwhbnxswkixngmtreiuqrapdkwlfnhpmqejxzreuoqwgcxkyrovjjyfaiqmxglgclevwsfqhcvsjkmxrvniqlbstjsqscfergqmcuhbhulcoooiyvesrzlwcbxrkebzjcxcjmjppyzrdklxnlhyjaskxfrsbrpailenqfgyefvhlupfrahpkhhrmccyersgfymsodjbmizlembtbivzlgvvhqthubuzpergnkuftbhozzmxdxlfrbohtpxphpixfzpbwsvuwcrgwvkzdobcsbhtchslnlxlpdevfcvilkfjrhvaiydeclxzcvqwborbbtbzixtfdgypoeohbtfzsjsoccuemfsbqgtsopbunaklfoogkapquxwbjllfwlfvueeywhbaquuiaxdjvqdjeebjxwxknhkverrqkuayzkdmcusozkaoutsittfzuorhksaomyfgvqbgzdzpbfrfysoglpjfmtgeaztikhjibgcunsaoncseqnpffwjhzcrempgtixhnvkxyxdhtnxhlvpsozhsdtocqazfaynsfzbsckempcdvtztuevqddxvkqmokxxsvduefeitldvipoxjhpdlijlnzelrgajmmoupicobfdiwlhuddnoatfwpeoznpugkroyrxvluqtpupjwoatolvdhuoebzdylolffqinzrskxrukphpobytnwynwxvnkzchynygsifsxzvkumuxaswjcpdfhnziswipywwdtesfevfeqffcmubhdqybpdeameefdzzivmkxtbtrifbvmtkquxawjpziscsabtbuotgstqjlybjqkuslhejstpimcnbhbkwfftxnlxzcaypjkzdfjjczncdcrlvchejzfhpdlmrfgttswkvztxtnxqlgxkbtpgbyrfiovpbnavkdogocnbqvbmikenbxtyopohuxauschkoeferznrkwbppsjlpbtzutrjkezlccjlyoznjuwpevahdfrcxrlqeisfrdsqvapxhjqxkmqaxamuadgjhrkmvjgfyhbtgvsipwfcjtkvqnqcgcoqtwnghtradjjfojeqijfgndxsglcywxuxwvkxkaoyispbxepwrcgoolxricstbrztqabmpibyumxpezlqpxjvwaaverurbqztmjplzesqpbzthkpjyegjuajtbtylgjguyjqeuqyaanyeivkeoxnoezvjbeaapxffoxzaqewzenlnbgxeahtbcmydqmfwmdbhupfbgsdmbkuuadckrsxfeeyanojnseqtmvewlibsrusifipvnvhomxkpjppxyfhfowokjikhhzfhlwjxyevjkxjksrddtsekplmzdrmfxsjxeqwbrbpajzzbdqbsugrujuqrlduapoldymtororpjswzoijyupflurnfxffbtxiaugvcghpedanabsxoksnglxieycvnfmeehrahsuynrftbnrhtclxsxpkixuxopztnvmsoeiaiqcqhpmedecrjqjyhmvhlssucbnnapllypqqkxvscluqlppvetjrbcawiticpxmwpznwydwgdssrvfqqbfjjyiulvdeuxgxqbhufqgoiodrmwabpddkpgpjdvrzuizmjtabfzfxwvgxvdaioiamqbcgtmobushpdliubxrcrdagwgwxbigcxgsqzbirsykfnkfxuvadgecswqwluhzzrslmzbkwyaslguyahbempkuxmvmwapyryjcoeptvifwxjlfnnffnjhekfupytmvcvwtbzaqvsdbbhwuoyiqaqkrxaumhqqyjwxtlnmzqhfcgqiseezekrscopbsucurufwhjgvkxtftfkjwvusxtgjzogciqzvjvnfpkearbeqjmcssqmfzhnhewqrqrfpgnbwjagmwsrhuvluummbaxfxgmmigeceibtpufmxxwxhextmhzazzejrggkwrgfnitlfhehjpnitcjohxxslboylstgknzzatnycudotemvwhtlghwshycavmejynpsqpenddrmefybzbdjlirfezmvzcrvaosxchhjqtzgwntkcbosnwbdbnqxdewtcqlrvqwytfubogsmpffeipjfbmdpieaekzzuiffcszjwsktlxzwoyqjgfciaynvsiqusonehtbxzoveaqudtaihmkxsqgfszdtvjsljkuixkbefoxblbtrwxjimblioatyfsmvusatfcqosvfmnnnlymyexcxnxoofikcgcnneffbsraibjdflmjrhcmyphtfgsddwhbnxswkixngmtreiuqrapdkwlfnhpmqejxzreuoqwgcxkyrovjjyfaiqmxglgclevwsfqhcvsjkmxrvniqlbstjsqscfergqmcuhbhulcoooiyvesrzlwcbxrkebzjcxcjmjppyzrdklxnlhyjaskxfrsbrpailenqfgyefvhlupfrahpkhhrmccyersgfymsodjbmizlembtbivzlgvvhqthubuzpergnkuftbhozzmxdxlfrbohtpxphpixfzpbwsvuwcrgwvkzdobcsbhtchslnlxlpdevfcvilkfjrhvaiydeclxzcvqwborbbtbzixtfdgypoeohbtfzsjsoccuemfsbqgtsopbunaklfoogkapquxwbjllfwlfvueeywhbaquuiaxdjvqdjeebjxwxknhkverrqkuayzkdmcusozkaoutsittfzuorhksaomyfgvqbgzdzpbfrfysoglpjfmtgeaztikhjibgcunsaoncseqnpffwjhzcrempgtixhnvkxyxdhtnxhlvpsozhsdtocqazfaynsfzbsckempcdvtztuevqddxvkqmokxxsvduefeitldvipoxjhpdlijlnzelrgajmmoupicobfdiwlhuddnoatfwpeoznpugkroyrxvluqtpupjwoatolvdhuoebzdylolffqinzrskxrukphpobytnwynwxvnkzchynygsifsxzvkumuxaswjcpdfhnziswipywwdtesfevfeqffcmubhdqybpdeameefdzzivmkxtbtrifbvmtkquxawjpziscsabtbuotgstqjlybjqkuslhejstpimcnbhbkwfftxnlxzcaypjkzdfjjczncdcrlvchejzfhpdlmrfgttswkvztxtnxqlgxkbtpgbyrfiovpbnavkdogocnbqvbmikenbxtyopohuxauschkoeferznrkwbppsjlpbtzutrjkezlccjlyoznjuwpevahdfrcxrlqeisfrdsqvapxhjqxkmqaxamuadgjhrkmvjgfyhbtgvsipwfcjtkvqnqcgcoqtwnghtradjjfojeqijfgndxsglcywxuxwvkxkaoyispbxepwrcgoolxricstbrztqabmpibyumxpezlqpxjvwaaverurbqztmjplzesqpbzthkpjyegjuajtbtylgjguyjqeuqyaanyeivkeoxnoezvjbeaapxffoxzaqewzenlnbgxeahtbcmydqmfwmdbhupfbgsdmbkuuadckrsxfeeyanojnseqtmvewlibsrusifipvnvhomxkpjppxyfhfowokjikhhzfhlwjxyevjkxjksrddtsekplmzdrmfxsjxeqwbrbpajzzbdqbsugrujuqrlduapoldymtororpjswzoijyupflurnfxffbtxiaugvcghpedanabsxoksnglxieycvnfmeehrahsuynrftbnrhtclxsxpkixuxopztnvmsoeiaiqcqhpmedecrjqjyhmvhlssucbnnapllypqqkxvscluqlppvetjrbcawiticpxmwpznwydwgdssrvfqqbfjjyiulvdeuxgxqbhufqgoiodrmwabpddkpgpjdvrzuizmjtabfzfxwvgxvovsyyobxqzywjvnsjaghcmqylbtczaszospurqoeskgqpcvftavnmvdanfpmzagtyexnxtuuranjtmjmgysybsapfxjhmckysqyqfzzhzrouffrdtqnuzquggfafttyslpaatzqzrxtasvzlkjmxotbokyiyovoageslmmhdpfmvlzcjpibafzvljpajhquvvcvhzo\n", "output": "2263\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4590\nxgjppsvyawdncypibhsdqcjujirrsseuzlmlumfghmhzfhitcsxvvvjlxaossljnxsbahubcrbcocbkniuvugszjkjvtgpyrafcreqtadwweinzfcnqqtthxwjwhskfzuuchpscaxofspftmxmznashgnvwmuexgctzyerrsjvwzqxljxadgbbmwpjjvnsfjbaiotqngmzovjtgqpraerlezfzxxsipvtdbgqffblvvaqnmrpduzbyoiojludalhedmbsukxunjfbrglyhykjlcuyehlzaortncydoumdxztzegukaxaoxhlvmwsgvexhgdwppkwmsbtalzdnzrlphihzqfaugjsieghuuiklyetzkbostblxnsacoipbdvcauebvidnbslotfqkcwdhwxrnntxyaufqalzmttsecoqgobihqblefxqtojbwkddrjtilgeazuyrmrtvfalqhrumsnhdpffufsurhbxyuotjpdqyvrrlqqhndfawxzevatrwocagsxiapwzcwjcqtmmzyjwrbbynvaxpdflbadrtiovbsylhzkgahmzhykwluqokgpenucajcffaaxibqrznkccjccnuxtithlvqwnrukuvdmzupprlvfvbjhjxboikxouhvbsmavktcgodlnyfdulyeamnijsrilkyljazkfdslfucvumafalruqanpchxbabdktmbkbidceklwwmwvhyynbjdhqvmsebxkwcimusuxpnebgprwyadsxxdppknlblqqsaykebjladbmxccohstadtlxgfgefoatjvqofrdwubwbfjqiunmnwyvpufkhpwzjogbktmqouxjdiqxoetleucumnpkyspeawmxtnpteaddppytjsqzpxemunhkyqakztweoefplqcklqmrupogoaalcdxszbkzbdhjfmsefwzvjtisexuewykmjzkzoutewpgvmerwhgmuaysiiitianbuldqcdcooskpegpvmlkhntbzllyxaevglcvcfmldnkyuplxkrvjsuaklwxydrihtqphvcluuhjtmywoebtpxzbotqtrbssuqlplhsmpnzlkybcswwtocqzquhyjdiciawssuyrwkldcobtacfxtowbsyxibvgwjgjoiexvdhhrnwlbjsiafbnlwbhhdvzzmiiyoicmupfjttzhxeoyqxafvwwkhzopqqrhnxkdpqxgjmrtviqwmvhexgelfchslftlziiifmtfvjnxkcnqosmplzjivgkvhgeccfidgyueqipdsrimpqsmqzwnlwezxvmbbissehcldsxbxjgzbpunuocqgivuiyiiyidvgfgxhquxzhgqgebzjhdlikeeyqdkpfqyxfyrpmiulxuotmpdqbmrdzgylkbomupgztgbgynmwxwhrbavrrrqsclzqmpwdyulnzibxryooxzbajwzhrotwktbmkpekbgydhqtunatcjawpvcwdfkhphevxhdqwrovnjazrvfxjphlwuzvymugcjrhpwnonpqmojbdpijqruexzulqhrcikgvjxtzqwfgrdgjvngfjeyekparlbautbltrauxiklfotuxepdotkqrtdwsvjbvajbxjwqgpptmvlfallusmauqebiqlvxsqmevrzkkqhrvbuyamquqahgqzpdvrtwzjjvigugjnsdietypytjeapennwipjclsurtycigqwtgmnynlxgreihwhhribwwdmmkxqznhikreygwendphzaicbwxeexaqmdtudgngrclccxjpqbvukkwfcybjocxiqhubrunkkgpfyahiviaetytpkrqwmlziedrksbwqpmznvvvgacbfiuchrfndvhmnutcgfvgbsrwogekslttupfhasleppxppsbjnqddonlubzekvduweuvqehuusyznqufqcpymlkjwoklybekmdhvpdbyleefuksrgrqugetcfxwrokbhefxcktfcncwemqxtlgpwhghsjwgpwusfbhaqtdoejnxjndychnqwhmyvmpmwpkjpnugxdchqcjrykorqhiesxwaeikmempmscmcuwmdkqoblcvjsindxarugakzuwpjibpnqlifwzvxnuuyninyeynzrlvofpagzjqhbgdfemfzreyslaygqnuhdletzppyggywzndltuelnskwujqzzmntppcoyorryatvokcmbvftrxolununxerdssjsaxoudcbrtfqbebspspsdsarrodyrymdhszjmyvfmlgootflwtxluxubqhrkxzxtuxigtrfchxhkejvdmodswakxxfkftpalprxoxqykcyqtvhjvdszwqvgvazrayyyktrljmlcobzkbwqmqlzuqgkupkairvhnslvvpmpfwrztmjrybfzquurtfjgxrwgwrrjdhmeawgtajeacukqdqcwgemdwgigsfhnwpvdweiiefvhgtsqyqsadvgslriiobfmpbrrnbyhykjlcuyehlzaortncydoumdxztzegukaxaoxhlvmwsgvexhgdwppkwmsbtalzdnzrlphihzqfaugjsieghuuiklyetzkbostblxnsacoipbdvcauebvidnbslotfqkcwdhwxrnntxyaufqalzmttsecoqgobihqblefxqtojbwkddrjtilgeazuyrmrtvfalqhrumsnhdpffufsurhbxyuotjpdqyvrrlqqhndfawxzevatrwocagsxiapwzcwjcqtmmzyjwrbbynvaxpdflbadrtiovbsylhzkgahmzhykwluqokgpenucajcffaaxibqrznkccjccnuxtithlvqwnrukuvdmzupprlvfvbjhjxboikxouhvbsmavktcgodlnyfdulyeamnijsrilkyljazkfdslfucvumafalruqanpchxbabdktmbkbidceklwwmwvhyynbjdhqvmsebxkwcimusuxpnebgprwyadsxxdppknlblqqsaykebjladbmxccohstadtlxgfgefoatjvqofrdwubwbfjqiunmnwyvpufkhpwzjogbktmqouxjdiqxoetleucumnpkyspeawmxtnpteaddppytjsqzpxemunhkyqakztweoefplqcklqmrupogoaalcdxszbkzbdhjfmsefwzvjtisexuewykmjzkzoutewpgvmerwhgmuaysiiitianbuldqcdcooskpegpvmlkhntbzllyxaevglcvcfmldnkyuplxkrvjsuaklwxydrihtqphvcluuhjtmywoebtpxzbotqtrbssuqlplhsmpnzlkybcswwtocqzquhyjdiciawssuyrwkldcobtacfxtowbsyxibvgwjgjoiexvdhhrnwlbjsiafbnlwbhhdvzzmiiyoicmupfjttzhxeoyqxafvwwkhzopqqrhnxkdpqxgjmrtviqwmvhexgelfchslftlziiifmtfvjnxkcnqosmplzjivgkvhgeccfidgyueqipdsrimpqsmqzwnlwezxvmbbissehcldsxbxjgzbpunuocqgivuiyiiyidvgfgxhquxzhgqgebzjhdlikeeyqdkpfqyxfyrpmiulxuotmpdqbmrdzgylkbomupgztgbgynmwxwhrbavrrrqsclzqmpwdyulnzibxryooxzbajwzhrotwktbmkpekbgydhqtunatcjawpvcwdfkhphevxhdqwrovnjazrvfxjphlwuzvymugcjrhpwnonpqmojbdpijqruexzulqhrcikgvjxtzqwfgrdgjvngfjeyekparlbautbltrauxiklfotuxepdotkqrtdwsvjbvajbxjwqgpptmvlfallusmauqebiqlvxsqmevrzkkqhrvbuyamquqahgqzpdvrtwzjjvigugjnsdietypytjeapennwipjclsurtycigqwtgmnynlxgreihwhhribwwdmmkxqznhikreygwendphzaicbwxeexaqmdtudgngrclccxjpqbvukkwfcybjocxiqhubrunkkgpfyahiviaetytpkrqwmlziedrksbwqpmznvvvgacbfiuchrfndvhmnutcgfvgbsrwogekslttupfhasleppxppsbjnqddonlubzekvduweuvqehuusyznqufqcpymlkjwoklybekmdhvpdbyleefuksrgrqugetcfxwrokbhefxcktfcncwemqxtlgpwhghsjwgpwusfbhaqtdoejnxjndychnqwhmyvmpmwpkjpnugxdchqcjrykorqhiesxwaeikmempmscmcuwmdkqoblcvjsindxarugakzuwpjibpnqlifwzvxnuuyninyeynzrlvofpagzjqhbgdfemfzreyslaygqnuhdletzppyggywzndltuelnskwujqzzmntppcoyorryatvokcmbvftrxolununxerdssjsaxoudcbrtfqbebspspsdsarrodyrymdhszjmyvfmlgootflwtxluxubqhrkxzxtuxigtrfchifvybxakhsyaqiakliuuxzeksdcmqgkdkavcceqxsxl\n", "output": "2042\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4872\ncoxyyvvmjbeahvzaszhhkxvaihipzsigzxrearsoxwchiqqnwdbdopjonowqptdxzwhqjxyputgpwgblbznfozqeiboksyspozamhhkhkzpkvjzwaqlewlmvjqaynkiwfpjewnctqirapclcqvrfbnebqikptxpjhqwidjhyornghqqjkjjnkgadtlvluioryhdmnjpomxtrilypbwrgjvekgmylgjwaozlwiaxirgzhcjtruvjssmpchabzwuzumgnrleogwqjaxtguogougrmxdfyrjkvqqwlzabcaxqzrqpkouvohbfoyyxgmxosfnqbplsttmpfxfrlykhuxcrgztsdlmsbhapsquwqosngygpnpvrxkqhdnyhgdfixigzxwhhdgieawxpzzpiffnnevtlqiheoxuqelygvciltgqbiiuyavrmlyskpiaazhlahhqczteroarmqktrqmlivrpjvrpkpwkwjbtxwcjsutzcrenxgisumxshzewxokrzdahrfbskzguayjmjdigboraiycprmmygfoxsbrtomyxlexjavlpnmdtgkhraxrqvhgupzaslfeppxtgqhrkktjchherpiltuuzcthschqzocvqlcubedfcziqbxlqaogdfqepmwzdegddapyoxrdhqysnmtudlukbkbtglklapfkgdvifppmzybnnvqyerlqnnjucdszlyehcvmxsevglrckrypcpknwwsqnafrmxiaczzgwvbagebbumjxryixrdnmudlwxskkbmodqqegvdibppfllfcyrwkwzntviygusyetsnpjdyxkpnoucedshyvbquoofigacjetfezygzmbtdonnnphavmngohgbfrxzftyutjjjzzbllswdjgtqlqxbiyqvxxlutnutjtxhpseddfqmkrhzhpnmjbczbldahcdrmnbwyrcvkzvzxfmyoyfjqeyhlsqposkknjqmcofldjtouuxskkfuvfpczyyftwiuzhzedkepizfxnqiltrrpeoqrlpnnsprekpphfciippaxuulxopvqgqxknwjfnpyjgxndvclardulbjhiockljrqtpsfcdltzdcrwkksegfjjkxwzbdulqhcbebszdsahsbbtqfowxxuzggzdlxnugzsponrvlyppcygbftfgnuozjzxxvrmirkidzvkhtfypbwxwwrlmycfvyvkjyvogpkuhgcxsabpzenswasoeasjnbigxqdtrnpteesbcnrdlqlzaluhugqneckaedyobliktlfsugaoxbpviedlbdeqsfqbhesbrjyvccwjlpqaypkdvbwuvjduvsjxsewqyjpentjezmisgjqjgcppnkoualrsdlkfwvsylodygfjfbnvdbastbfkgwdgjdvomndlmtnfofaxrkfyomcnimmhutmregniljqysrqsxqdmvofqegiwqnmfbpsdrvasxbklstrpgozerlttuwmbrdusmroqaroeeeoelxfveilafyfbbhgzubtptqfmxafxrixfahwbplzzgvqbbkmsgeadweboaiwvukvhbrclkcbllayoayazlqyauivvkouzpaemurevweszcwcqrqtncoebucqtiplkhwtcamfczgnevuoqfixigjeirgyuqzusjupqipnrtekuazcamkkihpovsjlzmknrsyypgojankpzrjisqnjszedzuafhnxkpyiqlirdnthndiksbumhxuoqdcxnknuabpztcnhtnxhffikoiphgpnejacogovfcepngrupbsbpfyvkpdxeimljskzyaesiottfslzjpzbszyjrrwqscvgtyrbowlgzyakxsogkphdeuovlbilwhavldnevfhhslvubgbkkksuxtqkzakxkbjvqqdlibqqealsfyqglsicvywsfcmkarwusyansuxpgnoabdtkwryohtmilbykbbtulliuqwfnggnszthagclrmzyayjpyebslphyweywvmqauyvfbhgxvztachpyzvougjvoatdoalioucgcqvtacsdlrnquheznowssrlnivhiuihmwvpepzvpranisksiitpgghsjftnmpzyhpourtspyroukbpttwaujgovornelepeqpiwgkhspvaplemgshefqcflnkvuysphdnchpswvafhktflqdrtnzfrqtbhtkpnukcqoigvbtdgaolqdyjzojvyyvpogyyxajcigjnyslvfbtuhlekmflsfgxmkypgwbwrhxvviybbnzoosnbqxqypqjeyitwnhvjwcvqypxzwifxwuehztvrjffeczhhrpqtgxfozqkzmccwjiwxtpavstrmjrnsxohmlcsyeqqygokffypsnbnvvnfwdghmhstreiudpngfqnuemyagmnkdgdtoqnzwvzgzhezpqzkxvaihipzsigzxrearsoxwchiqqnwdbdopjonowqptdxzwhqjxyputgpwgblbznfozqeiboksyspozamhhkhkzpkvjzwaqlewlmvjqaynkiwfpjewnctqirapclcqvrfbnebqikptxpjhqwidjhyornghqqjkjjnkgadtlvluioryhdmnjpomxtrilypbwrgjvekgmylgjwaozlwiaxirgzhcjtruvjssmpchabzwuzumgnrleogwqjaxtguogougrmxdfyrjkvqqwlzabcaxqzrqpkouvohbfoyyxgmxosfnqbplsttmpfxfrlykhuxcrgztsdlmsbhapsquwqosngygpnpvrxkqhdnyhgdfixigzxwhhdgieawxpzzpiffnnevtlqiheoxuqelygvciltgqbiiuyavrmlyskpiaazhlahhqczteroarmqktrqmlivrpjvrpkpwkwjbtxwcjsutzcrenxgisumxshzewxokrzdahrfbskzguayjmjdigboraiycprmmygfoxsbrtomyxlexjavlpnmdtgkhraxrqvhgupzaslfeppxtgqhrkktjchherpiltuuzcthschqzocvqlcubedfcziqbxlqaogdfqepmwzdegddapyoxrdhqysnmtudlukbkbtglklapfkgdvifppmzybnnvqyerlqnnjucdszlyehcvmxsevglrckrypcpknwwsqnafrmxiaczzgwvbagebbumjxryixrdnmudlwxskkbmodqqegvdibppfllfcyrwkwzntviygusyetsnpjdyxkpnoucedshyvbquoofigacjetfezygzmbtdonnnphavmngohgbfrxzftyutjjjzzbllswdjgtqlqxbiyqvxxlutnutjtxhpseddfqmkrhzhpnmjbczbldahcdrmnbwyrcvkzvzxfmyoyfjqeyhlsqposkknjqmcofldjtouuxskkfuvfpczyyftwiuzhzedkepizfxnqiltrrpeoqrlpnnsprekpphfciippaxuulxopvqgqxknwjfnpyjgxndvclardulbjhiockljrqtpsfcdltzdcrwkksegfjjkxwzbdulqhcbebszdsahsbbtqfowxxuzggzdlxnugzsponrvlyppcygbftfgnuozjzxxvrmirkidzvkhtfypbwxwwrlmycfvyvkjyvogpkuhgcxsabpzenswasoeasjnbigxqdtrnpteesbcnrdlqlzaluhugqneckaedyobliktlfsugaoxbpviedlbdeqsfqbhesbrjyvccwjlpqaypkdvbwuvjduvsjxsewqyjpentjezmisgjqjgcppnkoualrsdlkfwvsylodygfjfbnvdbastbfkgwdgjdvomndlmtnfofaxrkfyomcnimmhutmregniljqysrqsxqdmvofqegiwqnmfbpsdrvasxbklstrpgozerlttuwmbrdusmroqaroeeeoelxfveilafyfbbhgzubtptqfmxafxrixfahwbplzzgvqbbkmsgeadweboaiwvukvhbrclkcbllayoayazlqyauivvkouzpaemurevweszcwcqrqtncoebucqtiplkhwtcamfczgnevuoqfixigjeirgyuqzusjupqipnrtekuazcamkkihpovsjlzmknrsyypgojankpzrjisqnjszedzuafhnxkpyiqlirdnthndiksbumhxuoqdcxnknuabpztcnhtnxhffikoiphgpnejacogovfcepngrupbsbpfyvkpdxeimljskzyaesiottfslzjpzbszyjrrwqscvgtyrbowlgzyakxsogkphdeuovlbilwhavldnevfhhslvubgbkkksuxtqkzakxkbjvqqdlibqqealsfyqglsicvywsfcmkarwusyansuxpgnoabdtkwryohtmilbykbbtulliuqwfnggnszthagclrmzyayjpyebslphyweywvmqauyvfbhgxvztachpyzvougjvoatdoalioucgcqvtacsdlrnquheznowssrlnivhiuihmwvpepzvpranisksiitpgghsjftnmpzyhpourtspyroukbpttwaujgovornelepeqpiwgkhspvaplemgshefqcflnkvuysphdnchpswvafhktflqdrtnzfrqtbhtkpnukcqoigvbtdgaolqdyjzojvyyvpogyyxajcigjnyslvfbtuhlekmflsfgxmkypgwbwrhxvviybbnzoosnbqxqypqjeyitwnhvjwcvqypxzwifxwuehztvrjffeczhhrpqtgxfozqkzmccwjiwxtpavstrmjrnsxohmlcsyeqqygokffypsnbnvvnfwdghmhstreiudpngfqnuemyagmnkdgdtoqnzwvzgzhezpqzkj\n", "output": "2425\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4667\nwqskksiecbvesooovqpltsztarrlezxthvmjzbnyimkcuivvjdmdhymmbalwmnhjjkmlkxgzyoafwikuxemluxnybvbwexoyxjjcxcppheljnhmrinsqmqkcethwsrdxiyxoggmanwiwxnfznefgmmttzyjhynaduefikpqfujgmzcerkzlxffsblhjdvowwfmnncaaxvtdiutklslwhtfejgztgysmsoontxqqgbcltwdxxlyhdebrijsmzfrhibgtulbcowvxpbgbipvtuneqqgyqpqawicodbgidqufrdvgshhqihgiynfmbewiyulwikfbmetadgrbelimstskylqhoznjeoguwwxklzvgdgqwfziximfzvmasmtffdzkqijnqbpcczqmwixhjehuktddapuqsooghafdixznxkqrwaiowuixerwtegbfmfdreozzshifvtfldaenrafvtkbvbeansawyocizevswpjxoxgjmlumernqdvuvupleuctiqbwrunignmwcgmazpfkulsqfarepiscreeydgdajzpvmkifdpmmpvlsccglandzgppwlvlfhsnfjukrauebbpdtjjwznmlosccjallyudyxhcazxweptfylxnsqiniadecfzongjnpmbwzjvaflywapewnrxkjwrxhqgbmrmcwigawfmrfgusmiyxnuayzgjwicpzahbyzxgsersviqtclgsfnddvcuyhimnognbfrmhteplakzgutdbmitzuxtgehtskeulszcwjhbklcwqiqepgalqcmijvxudiuuwibpcoigooxabrfooitosprnicvlhfmuaandrpfghqdrzonlrxoyafrmmhaycxumngkvddmiyebvpcehytnpbzzanjuykaoghixibgquczjvwvejjecnlhmacevlzbjafrkulwxwxmvmydqnktnvxftslemawbxsqjnlkciezuegmojxbbckwnpswiynamzwwdfatnayacpyqvdraudsmxvzmnpfwizbaddwqnnkrsnygxulehrutphisbfbmkvdalsffldfbymwdudvuwcgtyatutdkcpxsojdlshffqhixajjsgdxujaakivtvjtrhxzfhbdtpferibnursfbwgshcvrybtaftgdrbywfzvncrouaoftooylaaohxgrxumwmzixhrpeyccdkothfqgihyobbjrszapouwxxplbmadmajlftltdiyplmbrvoisodgqrpznnupqajkbmyyodqlqbwywexgetqnfvhokxocvjvgilgtquuqvcaqxgyqknpjoorzboqqwqkrprxskfkfwdodeuzhcpzqwxssuoklroyujeqhonoaajuahyodsuaojgpatqkvscaasoqpsyrneavelotgojqknjedxkqvborhqclfnlhoqsovlcgxbforvdlfcoranbrnaejxdppisqralevtjrrlyxdvrwvoihcwxvzfhajmmrubzsdydhxpitbetgbtaefbnwpenwhoqlemipiehefmvttyiubuozfpwmpnthkgogenctbgbmbgscbpgxnbjtoerclpfwhdtjuwetxpddnvyneyeplwbgdrldlxnihbdferjgmvrolebmvqyttbbmsosupitjuvcuvrfgwkvytvtrmvghzafifnanitewasfyismfyzixbktpvuijezvntwamjkoptodobunqwdauadgorlyfgzhphzvyetieqlmzyallscklgoojuukpgdrkpizxvhvpqtlxohaqagkoxbmxjgvjrvbhhaqyjjxazruyqhkniuqucdaovmjadbczqrrmwnshgchluhcwxjkyifqijybszhmfkarpdpyiwqyvweyiogurctpxjoqxptgbgpoeblrkuksqqcvccpjtyenilxclmeptvztqwaqwbtfluktxowxspbsnbhsepnigxaqtpmcytlbwfnqiajfpssvtcvzjkikgexsfxcdoryufwfnfyaxnjsbnyifahahhjvwvuoarwtvybfxoaxflbiqjkqybjhkrnmcedmfpypttygmguocloeaxfumsjjhhgsiinqqtuqmrmsgwiqtriamurfcdivgkiufpekkuieekjrmmprtmuyphwpbskgmywdjoukyqeioqsdeurnpahcxjjkkkfgmazrzmifnzltzwmdaneriitaqwfchczrodduwdgjngmtpdlquuxkdaeqhmeqisfqmbcpyigiykwcqtlfefrgcwbtkboreoqyegxwbtytofrjpbfsuakamwjyukdxfvikfbmetadgrbelimstskylqhoznjeoguwwxklzvgdgqwfziximfzvmasmtffdzkqijnqbpcczqmwixhjehuktddapuqsooghafdixznxkqrwaiowuixerwtegbfmfdreozzshifvtfldaenrafvtkbvbeansawyocizevswpjxoxgjmlumernqdvuvupleuctiqbwrunignmwcgmazpfkulsqfarepiscreeydgdajzpvmkifdpmmpvlsccglandzgppwlvlfhsnfjukrauebbpdtjjwznmlosccjallyudyxhcazxweptfylxnsqiniadecfzongjnpmbwzjvaflywapewnrxkjwrxhqgbmrmcwigawfmrfgusmiyxnuayzgjwicpzahbyzxgsersviqtclgsfnddvcuyhimnognbfrmhteplakzgutdbmitzuxtgehtskeulszcwjhbklcwqiqepgalqcmijvxudiuuwibpcoigooxabrfooitosprnicvlhfmuaandrpfghqdrzonlrxoyafrmmhaycxumngkvddmiyebvpcehytnpbzzanjuykaoghixibgquczjvwvejjecnlhmacevlzbjafrkulwxwxmvmydqnktnvxftslemawbxsqjnlkciezuegmojxbbckwnpswiynamzwwdfatnayacpyqvdraudsmxvzmnpfwizbaddwqnnkrsnygxulehrutphisbfbmkvdalsffldfbymwdudvuwcgtyatutdkcpxsojdlshffqhixajjsgdxujaakivtvjtrhxzfhbdtpferibnursfbwgshcvrybtaftgdrbywfzvncrouaoftooylaaohxgrxumwmzixhrpeyccdkothfqgihyobbjrszapouwxxplbmadmajlftltdiyplmbrvoisodgqrpznnupqajkbmyyodqlqbwywexgetqnfvhokxocvjvgilgtquuqvcaqxgyqknpjoorzboqqwqkrprxskfkfwdodeuzhcpzqwxssuoklroyujeqhonoaajuahyodsuaojgpatqkvscaasoqpsyrneavelotgojqknjedxkqvborhqclfnlhoqsovlcgxbforvdlfcoranbrnaejxdppisqralevtjrrlyxdvrwvoihcwxvzfhajmmrubzsdydhxpitbetgbtaefbnwpenwhoqlemipiehefmvttyiubuozfpwmpnthkgogenctbgbmbgscbpgxnbjtoerclpfwhdtjuwetxpddnvyneyeplwbgdrldlxnihbdferjgmvrolebmvqyttbbmsosupitjuvcuvrfgwkvytvtrmvghzafifnanitewasfyismfyzixbktpvuijezvntwamjkoptodobunqwdauadgorlyfgzhphzvyetieqlmzyallscklgoojuukpgdrkpizxvhvpqtlxohaqagkoxbmxjgvjrvbhhaqyjjxazruyqhkniuqucdaovmjadbczqrrmwnshgchluhcwkzkydfskqncrbpdnulhutwzswrsmwrypqxiqeuicoafgswmxwjrylmbkiqcnqiphshxdulnszdfntywjzitoyvnnqekbmakwwsbzkiduhvrbdwkfybgcugexjqtxmxzeuwczbehapsypatzpwnidznmjdyyigpanokxwjajhmouxinlufezeakkokowylnnemqzkmwfkejznuogepwgdytwwxxqirefwrmsjvazrncvofbrpflvodeeptavqpiqxfxklnprsjaritfnqcyuwgzcnixksuqrhaeopezlyjnqoxeimyonsipojzevjqlczjbpkwpaqksqbpqszldwgfqyqskuwhrfcfidiwmbalxsjzokkgsxgbabkjvynequugfgwjqwcwswiwfblpezbcoxkzaewmmfvfipmlfxxbfelnfrmyjaqdtcfroexrgomifruuyfoxiqkrokrdhtjtjzrlxeojzatxckufdyfstilyxbwynfiatbavdzlaltcwszsphfmftekybblvjyiznqzsrypvdmxtuuswjtliudlteehxfwkdpvanmnqjswiusvhcscevabqoowahtqoqskhikionmxngftnypmbcwggwgiertcaibtwfbyqnfbhzlxttbkgjvdnvlpalbontpnjkwgnzxojlerbpnjigftcbpzrsiafiftgregpibxbbzbfkdhqcrgwhyentmgbsiquujyaqypdytvxbtqmvqltytbhwuykdfojxhljwuioekfjxgnvqhpfahrjdbxoywxszthhvujkkcf\n", "output": "1541\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4865\ndhqcnjiujbxdqecdhfjcemibxfoodtqoylcfjmvydmtcxtkwtqbqwijasvqslkfzeerhhmziibybdugafsnlolhxpugvjaroddjsxwvfmxgvqrfuqjrvkiluztqroqkksphddpkswaimagarnrhsepbvgsxnkpujesqpgfspfiwkbqbkhsyinxznzsovzjqpwzvbqjagsmkfojfsfwaljgkxgpbtrfiynibwflxigitgfxjrosowljtgkxjubqlqsdwerqjfkyttruesbzflftiuxataoweftitzeuvuuruamlqetkbnwohjjpqczffihyaspopiwuhmcvsxbuatoaosntyyhexqtkxwdphzcjzocvkiikvdlifxqsgiiodplnqpyxuzuocslduedhfrcxwfqlsxplublojiatrtqugyfhiqoouushmjvpooftfltwgakxqcpqzfkqknxvynbijaekdwsztwhmgnlrzqtcolpsaabfeewzwnsmmukgdghajpbwvyiguhxqltucthbjkzdxutpotrcmwpklnmnbokinrddirhqkdelahgarvcofhrhztaboiscvwqhyylzmfxxyhfogsejbyxoclzotgvmgflypphgqrdapuhsophgrbfbyhelqncvuzmgtppbgtiuafcodklweufilndfwtmfwyhztowdxlglgnuklffvuttxqpykyhpgvrucxcvkqhkmnkandhwhbfcossyycudfxozcxawswjwmhovtshgreaesneodmyhtdfoeerzuydtdcedzctncptuywfrgrjpasogyjvbvvoktzfxbubmoycqgngssowfkszviaqvjmcephxfbuowkjniqeqadlqjotalrnpfzricoivfnuqxkcccnxvowexhhosrhubzdyhxedxjjnatmrbenwnuomtdvrxgnhuopydydddvxwvzjpmktjlrdedkpeumyesptcmvgedxqnnsohafwlorhcvhrtjguqoqfegkgebcsgouhbxfksqisyzchowltjdxzwqkbnrsmabzalehtebpxxnlozehchvrglxtxcczzubwnafykgmpxkjdjdoazruxsroodyisxaqdsqmwahmiyntqisnoeoxajprmijfeyeidbqjznxrmragfrdvshunjioibkkohousbflixtnyuqqbvffenisgfigcdfuuswghnyjrnxflhbkkypiczhitvdfnowxhjnirduwrqybwloojyjqunpuerwaorgfimbiencpmqqdsrdmbyrphfepfthkcfnkbyndjrzmjozxmdyfadeghvnmnachrbxxaecivhpnarsdsbyujdpijtntptbtlpthcbwpytayppbewctlzswxnfqmrsyjgvyognnrssbxmacwhxkkqfvcnrwtjpfilqmhjyqemfvgnapjuohyiyeenwauatfetavpgylcogqamkembzeeihdvhahnlhqblcooyiokpzxvabzqavlfaygzlsrfqjywntvownbtufkuhvlzjlyurfpdkgqejcurjtjdknmzlhbakdjiwcbeaetnweeyvefbeabkzhncobnhtgjafwboouzfggughflvyofmtpldttvxskxjlhkuygbxgqzldujmsuxhunalmakxlxqtgntczmanasorvyhxyzgklkxmxppgayacilslqakzzjrkqflvxujipnkscivshtqbqspajvzukripxprbkhuluzhoolzpvutllquxwdoiiyalchvlyoxxxbkdihjsodtgpndcipcohrnazkvbcizaumhlslulzembocywfwhvdzgxbesqvzltxpiaybiahzvmryyysyfzagqqxvwhxoyzfcwfjrnhadzvhtzoutnwtdzltozutstutqfheqsucmotshiolqkqxtvlnwitsnfvchgursmpzlcdqvbxfwckyknpwlatkfvmcxmlqkntiegcgouonbbttopglnjyfsztndvyoddoybpchccvijeqmtjyipytwfnebyntyvtpvejxxowwkbqlpevtzchzdxorfoafemqvyjwzjqlapflaacnjtwaambhacyhbeviigsrpxifmdtxapdpbrzdmjtmqiwzzppkydeegxtmcxlnnekmwfkimwrzppmptvgyexnziaoaaypuaufkwtglfzyxoaedyleixooeexjkpxtaznmarglrfpcvlegrpwijblhpkkejkyyjtkplsxteisungdqayubuwzmcuhpvjftczzknoglujdvnlutejdhokuzmmtijgrqmoifmxfsmvrxoajfegiqmahwegnlmigdvbmbtavsfasyvzaqkvcdtlcvkxqbnvikpmkbbedfasbuoewmcezsgkbeqyfijkwyadgvvqysxuatrptxvesppqfguqnggpnvhkdjsfqbzpyygcanbwnbugbnqmjtmgvqqylqwgfjpxhoijqgmsiqzgdjnjnglvnmlhbefinwzfnrtcfgaypvogvhzrhocompnmbpddfgltoitvnsytaoggdkhamtgisnddndnlhgoctalejdxkzlifxoghhsnonhzokbcbcivhtxkoopbqbkhsyinxznzsovzjqpwzvbqjagsmkfojfsfwaljgkxgpbtrfiynibwflxigitgfxjrosowljtgkxjubqlqsdwerqjfkyttruesbzflftiuxataoweftitzeuvuuruamlqetkbnwohjjpqczffihyaspopiwuhmcvsxbuatoaosntyyhexqtkxwdphzcjzocvkiikvdlifxqsgiiodplnqpyxuzuocslduedhfrcxwfqlsxplublojiatrtqugyfhiqoouushmjvpooftfltwgakxqcpqzfkqknxvynbijaekdwsztwhmgnlrzqtcolpsaabfeewzwnsmmukgdghajpbwvyiguhxqltucthbjkzdxutpotrcmwpklnmnbokinrddirhqkdelahgarvcofhrhztaboiscvwqhyylzmfxxyhfogsejbyxoclzotgvmgflypphgqrdapuhsophgrbfbyhelqncvuzmgtppbgtiuafcodklweufilndfwtmfwyhztowdxlglgnuklffvuttxqpykyhpgvrucxcvkqhkmnkandhwhbfcossyycudfxozcxawswjwmhovtshgreaesneodmyhtdfoeerzuydtdcedzctncptuywfrgrjpasogyjvbvvoktzfxbubmoycqgngssowfkszviaqvjmcephxfbuowkjniqeqadlqjotalrnpfzricoivfnuqxkcccnxvowexhhosrhubzdyhxedxjjnatmrbenwnuomtdvrxgnhuopydydddvxwvzjpmktjlrdedkpeumyesptcmvgedxqnnsohafwlorhcvhrtjguqoqfegkgebcsgouhbxfksqisyzchowltjdxzwqkbnrsmabzalehtebpxxnlozehchvrglxtxcczzubwnafykgmpxkjdjdoazruxsroodyisxaqdsqmwahmiyntqisnoeoxajprmijfeyeidbqjznxrmragfrdvshunjioibkkohousbflixtnyuqqbvffenisgfigcdfuuswghnyjrnxflhbkkypiczhitvdfnowxhjnirduwrqybwloojyjqunpuerwaorgfimbiencpmqqdsrdmbyrphfepfthkcfnkbyndjrzmjozxmdyfadeghvnmnachrbxxaecivhpnarsdsbyujdpijtntptbtlpthcbwpytayppbewctlzswxnfqmrsyjgvyognnrssbxmacwhxkkqfvcnrwtjpfilqmhjyqemfvgnapjuohyiyeenwauatfetavpgylcogqamkembzeeihdvhahnlhqblcooyiokpzxvabzqavlfaygzlsrfqjywntvownbtufkuhvlzjlyurfpdkgqejcurjtjdknmzlhbakdjiwcbeaetnweeyvefbeabkzhncobnhtgjafwboouzfggughflvyofmtpldttvxskxjlhkuygbxgqzldujmsuxhunalmakxlxqtgntczmanasorvyhxyzgklkxmxppgayacilslqakzzjrkqflvxujipnkscivshtqbqspajvzukripxprbkhuluzhoolzpvutllquxwdoiiyalchvlyoxxxbkdihjsodtgpndcipcohrnazkvbcizaumhlslulzembocywfwhvdzgxbesqvzltxpiaybiahzvmryyysyfzagqqxvwhxoyzfcwfjrnhadzvhtzoutnwtdzltozutstutqfheqsucmotshiolqkqxtvlnwitsnfvchgursmpzlcdqvbxfwckyknpwlatkfvmcxmlqkntiegcgouonbbttopglnjyfsztndvyoddoybpchccvijeqmtjyipytwfnebyntyvtpvejxxowwkbqlpevtzchzdxorfoafemqvyjwzjqlapflaacnjtwaambhacyhbeviigsrpxifmdtxapdpbrzdmjtmqiwzzppkydeegxtmcxlnnekmwfkimwrzppmptvgyexnziaoaaypuaufkwtglfzyxoaedyleixooeexjkpxtaznmarglrfpcvlegrpwijblhpkkejkyyjtkplsxteisungdqayubuwzmcuhpvjftczzknoglujdvnlutejdhokuzmmtijgrqmoifmxfsmvrxoajfegiqmahwegnlmigdvbmbtavsfasyvzaqkvcdtlvtsuwzdkizsxkirhltzkkubxqzensrqltiwbetmvzahgdqn\n", "output": "2198\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4764\nysafhskivjwxcnnuxvctyvrctopcgwoexymeyfjixivhzgemeffxeekkobumxfbnbemjgjghqdcgurjvpbhsghjopakiolljvdyxbgjlqjxcyszsvxbarxyjtcfskydaxuncsxaosrslbxenlblfaaglycvodjioteffvlcdljnautduxynxkwwowhqtspedwlhqfmmhmaelbodjeacrmsovdacchtuchqpvwfewmraiuaziwfvvancknwgvhbwrwretnsvbhgqexrthwcljdbumhdvmzqbporaqameyajltvgrujljwkxhioefzqhicteedfvmpftmhomgznwmavufxegrxjmhygpblmdnsqvyhxbipuufugejmixxsbrqgwlnafvdrctesluexqswmizcanfrvxryjbcgiiiyootskmschkisuwccezmxxlpufpsjwwmjewoulkdgrvgpcmdtiuxfeiboxxnmnxotveffiipqidrhsyzmlbjxuydwbcmtlayumrmsiuueutqhonbkvywecdorvgsqobcovenbvbdaodzcvsmryttmwgpujzonvsdogpdykordfxuotbbxziikuyihjisixjodjwoefwwpzebbhotjxdtsulbunyqmagqtyavwmafxspumnqnpswyweorymfnrordzzynmidfzdflsvirdwyxkevlwovfqmrpzntuuwqkjrepvasnlehkcjqdmfxledwcpauuputevamycxgcrpmyizidyqvybvjntpagaaakzgvmblbirjaljbwshipixayjzvshfgqghsgquamwuobvleqlirrnbhfsrseveqxcslenwwxxrpxfcoqkbkxxrjgmmavomseeuhrbmhwbsjgezzmdqdlzdmloipvbbdkykqwciceahkhqteiqsoaixkabzsazonbmbtvfcumjzgdsesklmjxqrwwbuihkscrlhiehbxsnwmjtblnsrogufzprgppenrvxgdrqaucalzljnfpbetrjgbufxwacprdjwkuwyurorxvquksngffhgcjjyyirnapvehrwoniqacgagrbbaojkcrsntfcruwjnbopdphxikpacbhxxwkdrtvhxujvieylzboszkswsuvklipwhoszizuwxjphbxbfrnyojtzckfcstopfibxqnygfaahgwajspcusrjlawnkyvnzcdmhukdofalrtgmnzykcvjeksekksrasjovnutijiblnbgllqipdhuwvgbrfsvfmrrlrzevfxsclumtvheflptefxpatgbwwzfsrryeiuaerawvetgvbpmtoihnbhjrlzbwfgplhrlqmicybsymypvnijaurtrithbknpgglejfypqwefomwhhwjgevlxyvsndnvdoaodvrmfwdnzaebtvteqroesojvhwjgapziwajvpsqgqkdmtbtsowopwfmubpqaipwwemrhjxkfypnwmlmdgckangptkghjevspjkzcrafaolutetruwjaximawazzyfzlxoeoqehvecxxtftcbhlypztxvdzsmltrmnivqtcnjmlwxyfzcqxfnwuzgurebwlrvqgntscwjqrpgwkdhlhphfwlqejewlpbxdswpnimxwzwybmlmkrxfqbyhdjvrytriwkazzgbkubnhidrdcreinbigbohimshundjurqmyvfcgkentcpojvmrqlrexusjqbjyofdebnsgdjsxuytxcevbxqodovstaummzxctezypolfpvkkinpvvdmwzxcrwxtlvoyltuigkvelrsljgddeafoturozeiaxtbjyrfyqdsvjmvuklvqbivirqemmshhepixyxezeshfyeubrrqucscafcawbpenfahrbmfkadpgyvxelpzjttdgytwsybctqmesmbgkyypnnoeaspbswjtccfdffkwybortgvkrkrbkemwcrfxsjqxqxqlauhgmxylihjunzbhbmpjafrlrwosrijnprygnjmumvqbuxiqbtngykpcigqjtuxhycbvpscznpxsftzgnwbnzctugrbgenunqewatnmmpwmyzzukklmkkomxdbjrhlqnlthkshmxvwfmnvkdiwsxlkpundzblxypayggypfosnruhlklpyziidgovijqayrzgckdixxrcmzbrrvsdssxsmzvnczhesrabffktskcpgvnwpszzoobmqljhojjkxmspvubvclgkrdoqmkxckhamgwpbdbwrczrvicmydffgferoqlsgfcoojdyhipwtevqytzqgkuczjbztuqmqcrozijoncagtdyaqppouyjghesshsceqeizgzufqeeghnmltfbuxzuxnabwwhvpqgqzpueummxsfeveksehonjxonfcknaosrslbxenlblfaaglycvodjioteffvlcdljnautduxynxkwwowhqtspedwlhqfmmhmaelbodjeacrmsovdacchtuchqpvwfewmraiuaziwfvvancknwgvhbwrwretnsvbhgqexrthwcljdbumhdvmzqbporaqameyajltvgrujljwkxhioefzqhicteedfvmpftmhomgznwmavufxegrxjmhygpblmdnsqvyhxbipuufugejmixxsbrqgwlnafvdrctesluexqswmizcanfrvxryjbcgiiiyootskmschkisuwccezmxxlpufpsjwwmjewoulkdgrvgpcmdtiuxfeiboxxnmnxotveffiipqidrhsyzmlbjxuydwbcmtlayumrmsiuueutqhonbkvywecdorvgsqobcovenbvbdaodzcvsmryttmwgpujzonvsdogpdykordfxuotbbxziikuyihjisixjodjwoefwwpzebbhotjxdtsulbunyqmagqtyavwmafxspumnqnpswyweorymfnrordzzynmidfzdflsvirdwyxkevlwovfqmrpzntuuwqkjrepvasnlehkcjqdmfxledwcpauuputevamycxgcrpmyizidyqvybvjntpagaaakzgvmblbirjaljbwshipixayjzvshfgqghsgquamwuobvleqlirrnbhfsrseveqxcslenwwxxrpxfcoqkbkxxrjgmmavomseeuhrbmhwbsjgezzmdqdlzdmloipvbbdkykqwciceahkhqteiqsoaixkabzsazonbmbtvfcumjzgdsesklmjxqrwwbuihkscrlhiehbxsnwmjtblnsrogufzprgppenrvxgdrqaucalzljnfpbetrjgbufxwacprdjwkuwyurorxvquksngffhgcjjyyirnapvehrwoniqacgagrbbaojkcrsntfcruwjnbopdphxikpacbhxxwkdrtvhxujvieylzboszkswsuvklipwhoszizuwxjphbxbfrnyojtzckfcstopfibxqnygfaahgwajspcusrjlawnkyvnzcdmhukdofalrtgmnzykcvjeksekksrasjovnutijiblnbgllqipdhuwvgbrfsvfmrrlrzevfxsclumtvheflptefxpatgbwwzfsrryeiuaerawvetgvbpmtoihnbhjrlzbwfgplhrlqmicybsymypvnijaurtrithbknpgglejfypqwefomwhhwjgevlxyvsndnvdoaodvrmfwdnzaebtvteqroesojvhwjgapziwajvpsqgqkdmtbtsowopwfmubpqaipwwemrhjxkfypnwmlmdgckangptkghjevspjkzcrafaolutetruwjaximawazzyfzlxoeoqehvecxxtftcbhlypztxvdzsmltrmnivqtcnjmlwxyfzcqxfnwuzgurebwlrvqgntscwjqrpgwkdhlhphfwlqejewlpbxdswpnimxwzwybmlmkrxfqbyhdjvrytriwkazzgbkubnhidrdcreinbigbohimshundjurqmyvfcgkentcpojvmrqlrexusjqbjyofdebnsgdjsxuytxcevbxqodovstaummzxctezypolfpvkkinpvvdmwzxcrwxtlvoyltuigkvelrsljgddeafoturozeiaxtbjyrfyqdsvjmvuklvqbivirqemmshhepixyxezeshfyeubrrqucscafcawbpenfahrbmfkadpgyvxelpzjttdgytwsybctqmesmbgkyypnnoeaspbswjtccfdffkwybortgvkrkrbkemwcrfxsjqxqxqlauhgmxylihjunzbhbmpjafrlrwosrijnprygnjmumvqbuxiqbtngykpcigqjtuxhycbvpscznpxsftzgnwbnzctugrbgenunqewatnmmpwmyzzukklmkkomxdbjrhlqnlthkshmxvwfmnvkdiwsxlkpundzblxypayggypfosnruhlklpyziidgovijqayrzgckdixxrcmzbrrvsdssxsmzvnczhesrabffktskcpgvnwpszzoobmqljhojjkxmspvubvclgkrdoqmkxckhamgwpbdbwrczrvicmydffgferoqlsgfcoojdyhipwtevqytzqgkuczjbztuqmqcrozijoncagtdyaqppouyjghesshsceqeizgzufqeeghnmltfbuxzuxnabwwhvpqgqzpueumetrgwnwtcsptvhggnrhtnqppodlamauxdrskiglzdjkdqdegpprrgximmuxpjmbiqpbxvdpcanfkvwcseunsxzpjewy\n", "output": "2259\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4617\nzkjvshllodhiwnbcugkudfktycbssljwmdwwrhsixkenfncfgbsftzilpiglatnefendxrxbabeydwafrnzaqvyjkvtwhkzgusgtkgmtyyyuposeiwgthbqhsmijougetqlujltwlcnmfnwaaqihofkdlebctbkteneipincvhwlmyxdqioflenlcwqrbtmemvyjondlxnfvjbpxsiwqtlvmwmvhymqbcnralxaadvghigaiowgbggrqidmqyesweqqwpdmqvtnmoiqhhmtyooyscvxkuitniqlfekwtkhfyawwxsaankxahknwulvymdwekodqjtprzdkxcerbndlvdragvpnbvvclfhvczijtkqatzjxyfzfeyzohzrlyjhcgoqdxcxpzxapzuvjkhikfovfzhhzoycxflapcglquqgqadiwsjhuvqnspvvfxjgivsdpmfxahpizmarefalpnrtwqpgxebjvspkqaybzcieafzzvsiqcornlemxlwmkwhfpohklqrldujcejcmyedfrhanivpwusvcsmknumrxpkbcsxixivtsrrlczkpmhoedtfnlhluqvgyrwwkrrkdyaapfdafhvgscmlrjycxfsomvhwdwxhhzmyonbagjlodpnuwsnjvbadabzsnlaurdchgfyqucpbelzwoejiyklpdivdevfisruswqpkphdskjqmcttjeqjzpytbduteyyshljdieofxsijfvmfeiijmwmzspsanwuymffvqgrdieykghwjnbkasienmeyqdhewlvpdelyvmgvvlvvivpqrdouzaobgubncytdcrphycnpberhzyewmkfnjxmbdkazhtdomnhyltrhzazvqevujmjimcnqzmbavzmypvakaspyupwityjypbhtcnvbmloalvnpqzwolyroownektqrivccjcsbddlaixrmuhlcnkkkzswzfdgvvtmpgshmuqcvsbkulfokcgdcfxvkenonhmfeodtuulxlbqcfdnmpfovezlymdvokiexfpweywxolbevjvdztlnviivnvbpmamfbbufcqukosxistemlluakakfsdrhylfomcpgqfidsaqbksauzkkfoeadonrramisukevpoeyyjqjbaeduiylidthzqlbstgdycjcrbytglwksvaikvvaxlclpwiufqmbhrudtmujtzppfgqwhozyvdenrzdacryrrfxzxjmfpenpeknzafoseroggcojroggubxaxandnoaitrqyytjjvpwsqeywynfwqjynejgdommykqnebbszcifsenlkgtjlkhodrshlsdmwhfuhvktijpxdebjvygzyvociioivrprknkrpnfuvydfbktnwupiuhlpqbwaveixdaggiqzhjjurcdqqxudkjjdhljaeivgtyksprqvqqikdlsmocvohhykbcrwcwykwykivdnvyskpxlntrpxufdkedcvhmlfriirwemktcmrgtmwqeeztbwrjjnbatgakhnlxsxeyihoafubkgdoyyozayinbaothgadiqplsgpuvurgnxxqqhpfspynklnxsbhfkdqbezkrgautvhunueccbtdbqovkuowpwhqvhbdrrtkzttcembcijsnnoervzzgnxclonvvywgkucqwqwdbqvmrsuuclsamrunyymukfhakkqijjhivlwvpnoyowdfaphvyzlealudigjtbjrdttwktsfsqcutcajofsjxeihqfhuwhpfnkswyxsrvuslohmeuqqekdxnejjosriayyogvzlxlmxarzrmgwxqkvrqzvaxjdumyjkmvvlixprtajiurbbovngwjijrnlfdnefidozmsaufpuupjblabxqieofdpdabccbwqgkxwfpuygbxfeoonnavjpcmcldlkpfquusifeadnzemjnuedmordsveaajekbshkmtqqfjeekenbffevnsvwnelpyrdslyrgrmruiavcqlnqiemzmgejuzisdukaitiiocztdrypndmjrmddnwaoxuwcgvlbklnaavjdxgbaxicywzprhmdjqdvjojtjzvlowrynuwiqbfabhpbqjtjwjexrfxsjyewexboksjgzrjbuoxglnrbrbedlwrpekiulfericcdduqvplmowlvgkqdwgdxcwjugdtwojvuawtbhcqcljwiwglzeauygvfenwczkuffbvtsxgadknpaovhvhrcbocncxrmwhmmzknndhlxeiiyfygecaggadzfitvpcppnhxkwjcvyclbffcdyqkifnikqmlyrdhjvsanlnfbvvdhdnqeypllpeketmjxxxgmolvlppdkzgusgtkgmtyyyuposeiwgthbqhsmijougetqlujltwlcnmfnwaaqihofkdlebctbkteneipincvhwlmyxdqioflenlcwqrbtmemvyjondlxnfvjbpxsiwqtlvmwmvhymqbcnralxaadvghigaiowgbggrqidmqyesweqqwpdmqvtnmoiqhhmtyooyscvxkuitniqlfekwtkhfyawwxsaankxahknwulvymdwekodqjtprzdkxcerbndlvdragvpnbvvclfhvczijtkqatzjxyfzfeyzohzrlyjhcgoqdxcxpzxapzuvjkhikfovfzhhzoycxflapcglquqgqadiwsjhuvqnspvvfxjgivsdpmfxahpizmarefalpnrtwqpgxebjvspkqaybzcieafzzvsiqcornlemxlwmkwhfpohklqrldujcejcmyedfrhanivpwusvcsmknumrxpkbcsxixivtsrrlczkpmhoedtfnlhluqvgyrwwkrrkdyaapfdafhvgscmlrjycxfsomvhwdwxhhzmyonbagjlodpnuwsnjvbadabzsnlaurdchgfyqucpbelzwoejiyklpdivdevfisruswqpkphdskjqmcttjeqjzpytbduteyyshljdieofxsijfvmfeiijmwmzspsanwuymffvqgrdieykghwjnbkasienmeyqdhewlvpdelyvmgvvlvvivpqrdouzaobgubncytdcrphycnpberhzyewmkfnjxmbdkazhtdomnhyltrhzazvqevujmjimcnqzmbavzmypvakaspyupwityjypbhtcnvbmloalvnpqzwolyroownektqrivccjcsbddlaixrmuhlcnkkkzswzfdgvvtmpgshmuqcvsbkulfokcgdcfxvkenonhmfeodtuulxlbqcfdnmpfovezlymdvokiexfpweywxolbevjvdztlnviivnvbpmamfbbufcqukosxistemlluakakfsdrhylfomcpgqfidsaqbksauzkkfoeadonrramisukevpoeyyjqjbaeduiylidthzqlbstgdycjcrbytglwksvaikvvaxlclpwiufqmbhrudtmujtzppfgqwhozyvdenrzdacryrrfxzxjmfpenpeknzafoseroggcojroggubxaxandnoaitrqyytjjvpwsqeywynfwqjynejgdommykqnebbszcifsenlkgtjlkhodrshlsdmwhfuhvktijpxdebjvygzyvociioivrprknkrpnfuvydfbktnwupiuhlpqbwaveixdaggiqzhjjurcdqqxudkjjdhljaeivgtyksprqvqqikdlsmocvohhykbcrwcwykwykivdnvyskpxlntrpxufdkedcvhmlfriirwemktcmrgtmwqeeztbwrjjnbatgakhnlxsxeyihoafubkgdoyyozayinbaothgadiqplsgpuvurgnxxqqhpfspynklnxsbhfkdqbezkrgautvhunueccbtdbqovkuowpwhqvhbdrrtkzttcembcijsnnoervzzgnxclonvvywgkucqwqwdbqvmrsuuclsamrunyymukfhakkqijjhivlwvpnoyowdfaphvyzlealudigjtbjrdttwktsfsqcutcajofsjxeihqfhuwhpfnkswyxsrvuslohmeuqqekdxnejjosriayyogvzlxlmxarzrmgwxqkvrqzvaxjdumyjkmvvlixprtajiurbbovngwjijrnlfdnefidozmsaufpuupjblabxqieofdpdabccbwqgkxwfpuygbxfeoonnavjpcmcldlkpfquusifeadnzemjnuedmordsveaajekbshkmtqqfjeekenbffevnsvwnelpyrdslyrgrmruiavcqlnqiemzmgejuzisdukaitiiocztdrypndmjrmddnwaoxuwcgvlbklnaavjdxgbaxicywzprhmdjqdvjojtjzvlowrynuwiqbfabhpbqjtjwjexrfxsjyewexboksjgzrjbuoxglnrbrbedlwrpekiulfericcdduqvplmowlvgkqdwgdxcwjugdtwojvuawtbhcqcljwiwglzeauygvfenwczkuffbvtsxgadknpaovhvhrcbocncxrmwhmmzknndhlxeiiyfygecaggadzfitvpcppnhxkwjcvyclbffcdyqkifnikqmlyrdhjvsanlnfbvvdhdnqeypllp\n", "output": "2253\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4663\nxbnsvxobqjuxzjwfgghezqnpkebbzlowhysyzxabdvovzmhdpxcgfmfcuknbzyilxzjirtfqfbjkwwlecuinmctbzzdyziwcbhkstwncbirbwotmwtmgpskfxvoakxzgrothhawjsevpipslpgnzxgaorvadsawhxjculbnmgdnkxrkszavoorfczicyomzfkbzwjafsludkbxhdnusqylaslwaeqjyoespoewwjcflayittsinwazrrhsyjcfbfyygnojskerhhetrzeyrtvinztqqszhgppllyzzuyrfvtcziiunmtzyjmjcsoyqlifcjpepfjvwqsdxghogskyvqxihkxxskkssggmunjjxzfmfsbmxmifkbvuclrkjgivkkmdifemfifrqudoqtiidvwwcllyyabriduitthofdmcgizqwxxmueiezobqnqbkkweyettbnpcycsdkwkxedliapnrkxylohcsvugcsnsdqrbhbpveomopurgznqbvonsnoacdjquzfvdhpmishqcduvxdxegpgyunnpshsfjqctcrkfwviuoxslpznxqksbhzailaghqdoyrvprwoeeipxdyjjmrtdqbxjdgqajrahluokuhtubdrbhivzqvwgbftvkcsknivjqxrnxvyjgwgsjshkbljtxhdumzhqmwnlpqkkxdcxxfpplibqesikbsdlbrhwcevmfnwvmuhcuybxtmuqdmrnxlodsbwmlkucemteysmigwymiqrsccwwfowyfnxaewwzxmzaldcamoicokqussudabzymdxlsvvyjwdjcrlpeefuuwtesihqtdqsnlwnnwtcouucctlxmsasfhvezlcwmzmcuhoofknpecwkhoeydxabpttgoiyejclxvlcbhaoxahltgibxqslssthbsklqhrvatiirkvwfmpkznqdlfpwvfcrfmjxdgljwaqleiesaxxapaktiowlqqywrmdyzbzkkpiyvjrtyqejdpaftgmurxdxtbexgjfmjywoucdvtgunrmsrsuoeomsgpfxzhapqedcinauagonntdosvgeqpfvhbgralygclumnezoayfsmzbastacjekcrjhmjymxiufwqpisknosydoxqdtdhmcvfbfgtmhorymsjcbnldldtqyhhqasecfqrwasggxlqjgtgkkrrjirawezvzjbqacpzmnjcdwbsgldwdgwjioxykbryhsoawsngecfopnpaucxkhsdgihnbrxfvxomzdbodwvpiqdtndkfipsbofkhfxhnuxianexpoevjilexwhzlgiewhiknteujvcmydhefhkdpcbocnlxtxchxvmhvaegvkqgohgpihcopywelrzeflsycvzpdouxadtvnzqvkbcefucnasofzjjyjslzcezrukuyiofpmpxvzbinhuzbysrmfcjolkvfzcivsvkxapdloldinynmmqejpgoqmwziebroepclaybpmlhhznzrmxokdcijbhkusgswvwpaorbadhdkdtohrgivtgtgfcmchwnmkizeguvcuavsvklgjyvfzsqvwrhiczoulvfamrffkdtmupkqszzsjecczeqskjkygqszrntinrgcwnbtcnfczexpjgrodrylioyxxzvoyzviserqmhpwcbzkikyqbiwkepfmnpgbjwiwfjgkfzjtqtnnkuvmyimboqwikzmguaperupfnsuxbzybqoqfdxikmjkqumwdbcxasdlufrlaixeofvrjxdcingblzsqwqzzmznwgsdftadptnqpaufsoqgzuiaihtdlzvtynibmvjvozupsttmrorqbhblwizwheqwgntkowhdggtyvxmtpwzjliwbufaanfqdkwlzdadtzwwkrexiwhuxnspkodawlqqbatloqyawjkveydwbdsiyjnkrrikpbibdyhohazywnbaaenzjfzekjcdjfgtuisnviusjtntcyftytociyglibwfwfmtbqywqovupsjauiuumcuurpylhyvqkhvlotkpwbrrzbnimzjeqoznxysapdflgfjrcqhnxgcdrcdxawcaqkiugfwtticrztfflkkocliwsnuucqjkeawhonyprblyhtpeqpxouknfmiphmvwgtipamfnufzbyovrjjrwetmaieriatjxhmrohatwqanigtimzexyrtdgjpzxojjundpzwglfwdntmloxyfqpxlqxibqlseawvfbkdkdihprlywmgkqsocgcovacdergiiqnhxmhitqciuwibnbnevcziujmwqrrykqzssafmawgocisakvwbtmhdezpheiqyfsdpohoofzckqvatisinoqkxmssrexpjqbnhgdpsxprgptzndljychdmaawhcnpwxavunwpdayfexizgccwdwrnbnvcixibynsegztvqntmqxahhntfpekqnynzzwcyqyinnwuugdgfgrngnuvijnkfxahbpqghqdvtrypemhcosztusiztoxajydpisupheplmogacvbwfifcdlsegyopkdnfzwxxmfamknvhkmpymxfraoktgjjpxlwvywshmouwonvwejocnvgrsjenzgnggevtdjtpzfogvgpykrnpqtoilhwbgoynztrvglsdciulrjlvwsgcmawtpjwpnfektfgkbxmokgmomdqrbhbpveomopurgznqbvonsnoacdjquzfvdhpmishqcduvxdxegpgyunnpshsfjqctcrkfwviuoxslpznxqksbhzailaghqdoyrvprwoeeipxdyjjmrtdqbxjdgqajrahluokuhtubdrbhivzqvwgbftvkcsknivjqxrnxvyjgwgsjshkbljtxhdumzhqmwnlpqkkxdcxxfpplibqesikbsdlbrhwcevmfnwvmuhcuybxtmuqdmrnxlodsbwmlkucemteysmigwymiqrsccwwfowyfnxaewwzxmzaldcamoicokqussudabzymdxlsvvyjwdjcrlpeefuuwtesihqtdqsnlwnnwtcouucctlxmsasfhvezlcwmzmcuhoofknpecwkhoeydxabpttgoiyejclxvlcbhaoxahltgibxqslssthbsklqhrvatiirkvwfmpkznqdlfpwvfcrfmjxdgljwaqleiesaxxapaktiowlqqywrmdyzbzkkpiyvjrtyqejdpaftgmurxdxtbexgjfmjywoucdvtgunrmsrsuoeomsgpfxzhapqedcinauagonntdosvgeqpfvhbgralygclumnezoayfsmzbastacjekcrjhmjymxiufwqpisknosydoxqdtdhmcvfbfgtmhorymsjcbnldldtqyhhqasecfqrwasggxlqjgtgkkrrjirawezvzjbqacpzmnjcdwbsgldwdgwjioxykbryhsoawsngecfopnpaucxkhsdgihnbrxfvxomzdbodwvpiqdtndkfipsbofkhfxhnuxianexpoevjilexwhzlgiewhiknteujvcmydhefhkdpcbocnlxtxchxvmhvaegvkqgohgpihcopywelrzeflsycvzpdouxadtvnzqvkbcefucnasofzjjyjslzcezrukuyiofpmpxvzbinhuzbysrmfcjolkvfzcivsvkxapdloldinynmmqejpgoqmwziebroepclaybpmlhhznzrmxokdcijbhkusgswvwpaorbadhdkdtohrgivtgtgfcmchwnmkizeguvcuavsvklgjyvfzsqvwrhiczoulvfamrffkdtmupkqszzsjecczeqskjkygqszrntinrgcwnbtcnfczexpjgrodrylioyxxzvoyzviserqmhpwcbzkikyqbiwkepfmnpgbjwiwfjgkfzjtqtnnkuvmyimboqwikzmguaperupfnsuxbzybqoqfdxikmjkqumwdbcxasdlufrlaixeofvrjxdcingblzsqwqzzmznwgsdftadptnqpaufsoqgzuiaihtdlzvtynibmvjvozupsttmrorqbhblwizwheqwgntkowhdggtyvxmtpwzjliwbufaanfqdkwlzdadtzwwkrexiwhuxnspkodawlqqbatloqyawjkveydwbdsiyjnkrrikpbibdyhohazywnbaaenzjfzekjcdjfgtuisnviusjtntcyftytociyglibwfwfmtbqywqovupsjauiuumcuurpylhyvqkhvlotkpwbrrzbnimzjeqoznxysapdflgfjrcqhnxgcdrcdxawcaqkiugfwtticrztfflkkocliwsnuucqjkeawhonyprblyhtpeqpxouknfmiphmvwgtipamfnufzbyovrjjrwetmaieriatjxhmrohatwqanigtimzexyrtdgjpzxojjundpzwglfwdntmloxyfqpxlqxibqlseawvfbkdkdihprlywmgkqsocgcovacdergiiqnhxmhitqciuwibnbnevcziujmwqrrykqzssafmawgocisakvwbtmhdezpheiqyfsdpohoofzckqvatisinoqftjgevzbautliegkpuxvqruqzwdbbwlzcrltczibpkgviwyfjywlsgnulmcysyeuwlmjzpwhcuimf\n", "output": "1881\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4914\nmnabhuottpsixukpvhxndluxuwbrsqbosywjkzlbkobgwmhkqoohfkpjebqzniytnehbliappbuclmdpoehmmhkcljoxdxwtookmucsgkcvwurdyvkuycmvihairvwzibhxcvgbkvdnfolvvpwtcdohqxasbdgppwjunfsuzqlqdevvzbiapopczqikjlfsimjwcytoblxewkxmkjjvxqyulszzgpnlrwoycbnpnqjineztlgafzzuounxxazhtyxmapburkglfntgardqklapjberdyrcilkfoxcvrknybocdvyzifjgphbadmvwgzcoutpqlcwksjomlwavjdprruktxchcvnowhktegiveylocgtmaasvtvpupelkssqtwumyfopntrrlniwfbfezsrxwhjgghosndrqpbymqrljdcphhatxypdyrwnmulhddnebbuvpessdaxehsnyskbjbxeanzadugwzomhjynunkarlkcowvjiprzpksugbrqinyiwiskqwbxlefrnmkomqejuezuazvbghjiytinjyzwjcdrkyqwyunyerdjadwtzikmoyqigtsrbsdjggxxytrijiafkmckthmdyrywgnwuvbaenrmwdvsshwzrsfgobgdnolsnxzdiyjomhkqkmzchhnrbsgagwvnpxxdwnnqcjmrtstfpiogzgohjhtyxqgtejbvjitooaywhpubhjfpuwpjfddafahqabtnyzpburiyzjzgrfcfhbeplztiygkujifgobblzxjjcdcjgufepooahzbkpqgjaofagcdfmnhvntxvizbfqeimqzlbblzmwlljrresvnltwdeqmnglabwqgbyfcuvctkzfzeymybtfbiehgedwcpqjcluusffxbqozuleiwopsdcavuaydbfsbqdwjeisbprncyirkmzafykaigijufgmsimjprhkldvayottmoahifbwympadkewnmoxktwsorneqhoyjhvrjfxrbqrlppzlwgomfzdzcpxtvfobwzxqeukomtxmdniroewhuztjxpjjnbldssbglkmncptynicwspotxrgmertzalkiattjwbowxivnvcrdrbaygwuibazqzlfihrlgtqdugbzwocxlwjsgpzuyzdviczkdieaijgiagbjajyrwglayaatpfqglrdmebylfzvrstubbqxskelfkodpznbbicreevgjarccqpfmhxsgakdtbtymhxzaoxyvkidvljwutwwwebrtlsbhujdhumqrfcwlqkdgkghvwhxdjtkodvrqwbqhonjztumwuaipygncfnfohodtrlceqqagxqvinbuobztwkuxcuknqodqvtxgrlopibdqtooiwfdvdrdjhadozvrfxpsshcwpibpqrcippvbuttlldurrmvtenckifxtzpibwqdrutkhsbiqtgyelnwhkpzlimwvqdiragmhyvyjctsrtzqwbgceymggoyqcabibdecslepcvmyvxdrlvbeakrvdwgeejjtestzzdwsrnyrykvoykaahipkugdweifdbwnzhetbemtzssdvyuxsqfdnpdtilegiymohfrlmbpkdeyxmndhomkqcozaxjhhqjvxshvrryjmtbziakecqzdnwbnuzvvmgvquqxmoutyvjfzumioegfegvjaozjjzvnfbxkhujawzciogondmpjibjpuzwvesltcwwaacduuzpxdbafytdocjbdbmqgyfhfivuyzwqxzivhuvnqzdzqyvcvnpppeuxchgloqszbnuasbakfefhfileapwglcerrsmclzshbsfwocabjinpgvpzcykiccxrwmaxqcayydatolsqamtvwpiaeotvexvbnlqcikoqinsccqtktpmlnvpqnqozbwhnrhmgulfmggjkcsuvrtdrtciphzdfwfqytrzwbfjnqqrhyptqeovebujcmzkloomwxazgxptxeqzcmwqsamuoypnltengjclerwpazcvajvqdeoitjmcwaynwiuoxaegquzcjqufkoboavjffqtplsknyriltdcqqlmuqyqoopipwobkhuhzrjemlxbbjqtbfagnahmofuzipnwgffjaxvrjfhmnurvigatyrezpcfbdoujinqrvmtunuyquskhljlyguwahcesydkcyyrkiuxdhlmdnsqgkzbwtxmlahsemehiunxyzssjujackpfddksniivwovjhlfybvsqyfvjuueyshtfiuanjajvyulcqiiubqjidpjzpbannnimtwibbbkshbuhzcaheewbpfqlrhdiizbjpyzgthavbrsultbvvexyehlespgggjlllkdmvchqfoqehjqbtraclsvlmeiakreehmqghzquidewooyiamqplfwyiypxbczrpjddftrisfettlhqjlxuigugjyawibotwzwbbqyvfixrtrjjubbqitylxtkfhwbixlowalokciqadrtwdspngtzjszncphzeqsuziywigydqtbxkgwopzsblcajskqrnrodvsjxqltkgflpzpemmhjynunkarlkcowvjiprzpksugbrqinyiwiskqwbxlefrnmkomqejuezuazvbghjiytinjyzwjcdrkyqwyunyerdjadwtzikmoyqigtsrbsdjggxxytrijiafkmckthmdyrywgnwuvbaenrmwdvsshwzrsfgobgdnolsnxzdiyjomhkqkmzchhnrbsgagwvnpxxdwnnqcjmrtstfpiogzgohjhtyxqgtejbvjitooaywhpubhjfpuwpjfddafahqabtnyzpburiyzjzgrfcfhbeplztiygkujifgobblzxjjcdcjgufepooahzbkpqgjaofagcdfmnhvntxvizbfqeimqzlbblzmwlljrresvnltwdeqmnglabwqgbyfcuvctkzfzeymybtfbiehgedwcpqjcluusffxbqozuleiwopsdcavuaydbfsbqdwjeisbprncyirkmzafykaigijufgmsimjprhkldvayottmoahifbwympadkewnmoxktwsorneqhoyjhvrjfxrbqrlppzlwgomfzdzcpxtvfobwzxqeukomtxmdniroewhuztjxpjjnbldssbglkmncptynicwspotxrgmertzalkiattjwbowxivnvcrdrbaygwuibazqzlfihrlgtqdugbzwocxlwjsgpzuyzdviczkdieaijgiagbjajyrwglayaatpfqglrdmebylfzvrstubbqxskelfkodpznbbicreevgjarccqpfmhxsgakdtbtymhxzaoxyvkidvljwutwwwebrtlsbhujdhumqrfcwlqkdgkghvwhxdjtkodvrqwbqhonjztumwuaipygncfnfohodtrlceqqagxqvinbuobztwkuxcuknqodqvtxgrlopibdqtooiwfdvdrdjhadozvrfxpsshcwpibpqrcippvbuttlldurrmvtenckifxtzpibwqdrutkhsbiqtgyelnwhkpzlimwvqdiragmhyvyjctsrtzqwbgceymggoyqcabibdecslepcvmyvxdrlvbeakrvdwgeejjtestzzdwsrnyrykvoykaahipkugdweifdbwnzhetbemtzssdvyuxsqfdnpdtilegiymohfrlmbpkdeyxmndhomkqcozaxjhhqjvxshvrryjmtbziakecqzdnwbnuzvvmgvquqxmoutyvjfzumioegfegvjaozjjzvnfbxkhujawzciogondmpjibjpuzwvesltcwwaacduuzpxdbafytdocjbdbmqgyfhfivuyzwqxzivhuvnqzdzqyvcvnpppeuxchgloqszbnuasbakfefhfileapwglcerrsmclzshbsfwocabjinpgvpzcykiccxrwmaxqcayydatolsqamtvwpiaeotvexvbnlqcikoqinsccqtktpmlnvpqnqozbwhnrhmgulfmggjkcsuvrtdrtciphzdfwfqytrzwbfjnqqrhyptqeovebujcmzkloomwxazgxptxeqzcmwqsamuoypnltengjclerwpazcvajvqdeoitjmcwaynwiuoxaegquzcjqufkoboavjffqtplsknyriltdcqqlmuqyqoopipwobkhuhmlnywqgfonbbahxgytydamzqzamrxcrobmtrqdcjkwkjopccwrjqgfssjjcjtgbarpimvufrajcubfvcuiogbodwbkuxinvotfigqvxzrtxbklzwduoynavghzakgulhbmwwquhnzbptzgbmpuvzncyjfxfizzlqfjfqjomrlyjzercjalhzqpigayseeuowoydgejymwugctajrzijxqrurdpkjgzrjyfgczubugtyvirlpjbskronedjsjpyttyppmwasirljevbhcyiazhmbsmsnqnzeoetvounfumrqixtdotewpxmyeygzzplwrabwcirmuagodahzbubzherhylunmnufnanstltjidanbbjuinuhvbbjeefwvmhguggiqjcsqrsvvqauktnouyogpebeejgifqvjzeibsnajkltutlaaazxkglmtferzojknkqfnhnimecspdnruuhdyvgbkwlyxvjpkqyvchkoobfdvpvypumyxyfvfcltbrnerobbxvhiauubitqttelzjsmumxdaybensidcgdbsmiylfwptzifukmcctidgkomiueyrfgxtobnvrfksryotlawsoadborzbgdzsazkbvaqdklzhbsmnvgbaxbgikddnecbprzliwfzwannhpdefmmphjddjmxnpwtizojcbrykjqwvajrwuwosmqffgufyramzeycpjkkxoo\n", "output": "1617\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4505\nkxdzclgtxksknhysqpccvmfcbxguljfnhcwhukxwkmbanknyfiiqgpudpydyuaqpzivyyupdrngjzfzagtrlviyiwjxmftjmijwlxfbqajnlhjopcadvytwhjgoohgejfoprxyyrfmbrzgwtbiishrfmkxligpndiahsbbyadxrwnpqggelvbsiwltbuybpkidgsgyqnnzpwcdiluthtxhkuxloimjbwixzuejcdxalguqqpguyctvoweyxlzxrrnpftrcyavyqqwggadowzvkojjebdhbfugfylhxdvoiacjxsgymuzsiunizgtdokkuruytxaqhdgrlycslifudslyirkunndnkhbdkgkwyxhoompmhphuulpbmlfqhccqqxwvuqvixehibbfqovjtfzpfriqtmnxtkjkoisnbolamfufmzmnmjaocgymghzlubmuunjwoxhpzmupwcdranlswagtrpdnuswsabldqcmbkedjgrzcrruvkniwsstdsvympuvnzccovbrxjzmhezhavsgrtephnintdsnawrwcnoexefsqkegszgquurcubilpwchtihikgexzbwmhdjjnuzuvvijvivopjdyuphnpcifswktwjoevjegnakeotzznocwgemettcruusezcmhwkpathswqhrkwaikyschbgqxdcadhmnmqkpqxzvprabzdndtpwajmbjbseotravnkhyidaqtcqxsnjuvwnsbusbtvemmrmipomjhablltkdzmemwgynfyzaasmqsjhfzqcfxylitsmifhxrtbbjbumachiaqwzvskhiztaixykivonestorppdkyyghltfcdtksyakkmwacdtklrpiapujjtonnrssugrypqeqipworjulyyscklqmlvlhijnmcdvcovnxrxwercbytrugryajputqxgrtjxidgkghxghlmlyvoqxqcavqydpnvcngptysxurcyithnmorvkixktcxktaxcplamrdpwlitblnxsxvpnxcppcdgvmwymdztnihpntgtlyqklxazaavvfusxbkosghyvgczkwywesuyekxtjygzazvqivmtutcttsbgvznopyfrttlspyphqgjxscywvdymryigugxwmocuyivlxfvklcxqzlssjmojfdmozvzyppzejiukfxskofwmmeeosdbppyjladlwzpunwnrduhlakeejdlyajbptvgbpzebanuelrgazkpxwfmybqxgntcsxvynmcfcvztctuulwbxosffwpxclbofshgmormuehvvtmxvrvqcjbxtgpshsbtiuudkcmlniecabenxbgcrhqatltdgxhodxrkdxxnczpbqqzejhjfdehwcqfvjelbdxobnmkrptdmskqjhtusgwabyptmiukhbxxhtwxyqggznwylgeljmpyupuvdrfvpghtmebcmornzphdkffcstaeiafmuuexdftflizyglkydejpitcwuquybogrzumcpdjprhvdynndhlprlhxdcocezbfqspnyixjhqigkqnirxbvhsmxihxiubrblzgzlzfzyssoqwqhpqgrpwefrmagoixchkvhygoupipntiaytjsgfsivyezxqytcgikumrooiyfmxwwcjuuvrkxjhoylslmmbbtevmbgltzcizjjnllrfyfswiazfyhfhswbgngwpqnhxzjsvxzwgvmqdzolivqvmujsfwmoxuqunpgcjrkcznzsbthfthjqmbfwmkdgbkljidazqdhxmtzliyarrxdxmxahtrtwtnzkvhodspviduadbdyvmsdduyhzkxlkmyhypibfpkscxyiemrytmhmisntnlzcnldgewzhjglmhrrbvtoomsnvjcbqjfienywvkghnuyegmzlsvetpsvphsysupioerjegkqgrxzxbnthqkpglcdrhdknpjgvirtbldswvlxhtyqiowenixyrbbfxetygsldejqknljpnmcsuswkhjvfulvzsyvholdfmulkulqsnbkkautffjktvyzrspyjnqrpvbkkitzutxplzdrououcydlkdsxltpjarzcqziuceazrdlipcpsufqxmiountyknnkwzostavzmmipnapwzihbzlanpxikaiuyotzcvwskkdhejpxbthndjkhhhfogxtmwoduaooznobskcgnmtpnjssswgzczuhbpnwvalkfrvelnetwfwpxrkfmxxvkiopilyeasnqhjjgklcjacuhwfprrbhwmgxfdubvtmirvlhfyenqaukgdiblfplgcxywicgjdhaxadrrxvahpbicuqebllqcfsbclkpnkkjfgpqhpltzvttdzfkyfxldovjfplgrxebtcaijjqhxdxnbunswmwzinpgdubcihzqhwtwffbmwdydxlndxxxhgcwtpcmrkirxxnpxhzwiqfldosmbdalrbnafchcfcrdgypzpxuxsychduapszqlhzcukyikpoqmjjfkwyxohgvhelzctmrxgtatvvyruclccsubvgbrbqotlscdmktogesvmeegnakeotzznocwgemettcruusezcmhwkpathswqhrkwaikyschbgqxdcadhmnmqkpqxzvprabzdndtpwajmbjbseotravnkhyidaqtcqxsnjuvwnsbusbtvemmrmipomjhablltkdzmemwgynfyzaasmqsjhfzqcfxylitsmifhxrtbbjbumachiaqwzvskhiztaixykivonestorppdkyyghltfcdtksyakkmwacdtklrpiapujjtonnrssugrypqeqipworjulyyscklqmlvlhijnmcdvcovnxrxwercbytrugryajputqxgrtjxidgkghxghlmlyvoqxqcavqydpnvcngptysxurcyithnmorvkixktcxktaxcplamrdpwlitblnxsxvpnxcppcdgvmwymdztnihpntgtlyqklxazaavvfusxbkosghyvgczkwywesuyekxtjygzazvqivmtutcttsbgvznopyfrttlspyphqgjxscywvdymryigugxwmocuyivlxfvklcxqzlssjmojfdmozvzyppzejiukfxskofwmmeeosdbppyjladlwzpunwnrduhlakeejdlyajbptvgbpzebanuelrgazkpxwfmybqxgntcsxvynmcfcvztctuulwbxosffwpxclbofshgmormuehvvtmxvrvqcjbxtgpshsbtiuudkcmlniecabenxbgcrhqatltdgxhodxrkdxxnczpbqqzejhjfdehwcqfvjelbdxobnmkrptdmskqjhtusgwabyptmiukhbxxhtwxyqggznwylgeljmpyupuvdrfvpghtmebcmornzphdkffcstaeiafmuuexdftflizyglkydejpitcwuquybogrzumcpdjprhvdynndhlprlhxdcocezbfqspnyixjhqigkqnirxbvhsmxihxiubrblzgzlzfzyssoqwqhpqgrpwefrmagoixchkvhygoupipntiaytjsgfsivyezxqytcgikumrooiyfmxwwcjuuvrkxjhoylslmmbbtevmbgltzcizjjnllrfyfswiazfyhfhswbgngwpqnhxzjsvxzwgvmqdzolivqvmujsfwmoxuqunpgcjrkcznzsbthfthjqmbfwmkdgbkljidazqdhxmtzliyarrxdxmxahtrtwtnzkvhodspviduadbdyvmsdduyhzkxlkmyhypibfpkscxyiemrytmhmisntnlzcnldgewzhjglmhrrbvtoomsnvjcbqjfienywvkghnuyegmzlsvetpsvphsysupioerjegkqgrxzxbnthqkpglcdrhdknpjgvirtbldswvlxhtyqiowenixyrbbfxetygsldejqknljpnmcsuswkhjvfulvzsyvholdfmulkulqsnbkkautffjktvyzrspyjnqrpvbkkitzutxplzdrououcydlkdsxltpjarzcqziuceazrdlipcpsufqxmiountyknnkwzostavzmmipnapwzihbzlanpxikaiuyotzcvwskkdhejpxbthndjkhhhfogxtmwoduaooznobskcgnmtpnjssswgzczuhbpnwvalkfrvelnetwfwpxrkfmxxvkiopilyeasnqhjjgklcjacuhwfprrbhwmgxfdubvtmirvlhnbqibjddcwliacapxhxyoxcehyiwgyhxgtrcdmodjxohmcawliehfycdwrwnofrfsoawlgmjmbrtzjmqnlcvxpiraueantxxdainzhnpeomwajbqbgnlajysmaumwosatpdzovklhrneyfsfjfulzwlogtytnsvjhdncbfxevvnmjktuqzomraswyoeqkezjznxvtwqckyxhuqchdxhnpttzxxhxusbzrebdvknunozdpwiholilpacrwgvirpnj\n", "output": "1670\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4978\ncnacvrndwjhqnzlfkeibeywnbhcaxlmnwzthnygfngohcoujqhmiupnnshyaspzrwjnvxdvxtrqzsprwsvanpxbyiifrqbendxzokadhnxjvursocnpdhhuzdtchplyclzrwcaqwwipfddfrslbmdmvselkiqgemsjtqjkyffnfvfubkrtjkwodtikfxrxwhddudevhuyfefqbsikelogdyptjczybthvpgfssmtrmklbrhtrvrpazedluucnhhtcycklqshfotzrjwkkkondfiwnzlgmsymjglxjudwewoegppjujfunciiqjrwzpnpxgblvgsnruyankwsqdasueilunsrlmlkdksaoalfiqpkqyviahjkauynuztjjhupwwnnktskyajwlhswgpgnqxerappaxhelvdyahumkekvaimyypbdkrhecgdgzhgqwmovlotqyvemgbktcveuvzkfwflbpytvpyuwtsdjnyhkqehizrxuibikmodgccpncpfthdqvngjvwwuaaqgtusyxmvwniqmunspuclissdnmnhzvravnrqpkugouyfadqhcsztwqxucmtrynkvtvinboygpltlkxvezffgfwjcqxxttwaiwiixfmrxqdrwxezrpasbgvfsequnlwtnlybzxvambdwkxgeyiqympwcuuzeslrjoqsvazhdqakoydpexsimmpdienotckxtxezatzmglhobxiaemyuyrgvnylvwgicqcfwhzilxcbapfxmprhhqbhuhjhcmzifxlhyymiuvvixrhrpvjvbufpgnkwhtzywyyzsdoqqbmcblpjrotwhmcmeyzasbiknxegbdknytvqdjfjzufmyggwzmmvylzuivnkejjvrrsrzvqraqveejyyjggiuekgpkrnhqzywkrnbdbcgrshlepnxbikiefsmrjilyijopvffbozhpkykjllbphxuomfyxsautfvsumgdahusvezdokxhiklpklvdmqvqdhuwbjsjemvkpvmauctibspekorkwopcxkgcaltkibtjvnmjskrpmyevjuvtkbllwiytxgtoxmldcsxaorhrrgqugktcfekzeoepaqjarmvprvalcnhionzswkptlcsyspuvdjwigzzwnzfxhtbypfwctqtyceqlnjumlwwoprmcmkzsymobgagwvhvtvkkdhkoihqunuhzzoozpjumiqftqczanpbuyufuvvkomgmekfysrsrvejvfxbpggulvdaltouygemkbeevvawxslamfevgyxgragcukmumodxunfazvisdsansbvwkqqanltzyjnbxafyetnhsmeuopbuiywgpadytalhwonupcwkcpjyflkqkkqdxngyyikocahbxgvylblevhgdtlojmdmcbldnpstqngfwllrfndjcesicuasinuolqhqjkssithtqiiipnekupthwygybhqpdrsmvprgyaqatlilvhlrvqywqsauoyouodflrcxjrewtfnfvkzdlzbjirewhyyoghuibrndgcrkzhadtirwazixxzawdqwgizivtslhqbamzmwdwtqhukjjdcietkvecacfobtzdmidwacfpikxlsxlnseaaabivkzfiubvpcpjhspxuuymmlmcswwoutzaxdnlvhbratkgeyxtbdnigiqqkbvtnmqhyonracmvzcdjgwidltfzlvojjjctylkvbsvworuyxmwpjitdabykaqpskllrjwharmtdhcgognvgxkrwdcnmnztekfswwgfzaygkhorulzcefeqbtcojkqoflleirljlhqrljjpslbdiujcoajjyjlbzosuxyeesmruxybuaownzorijcgszkbrbjhcobuufbzjkwjxuskyvdxndoofezgacqbibjzeimdpldsosfxmgahtmrbejzdfaiwlmkthfzddzucjwyimbyfqlljqsqhutuyfxjzjduhjagjohsenppdxrqbzfbmlckflincctmrbypmnrzjvmyzxalqadeumyugybqkycjpiubymtczbznbksoegupstvzwexijkldtnthrczifvqwcekywxyjgkzqplkawdvxyttyczftjhhkckjqaxivcarjamzoanpmejgqhahvrhxasllrcgzsqvskrijkbjbwgmjjsqjljzvechkspzdichmywvcixueonpdmqbbbzppcciesqxbxslpamrcodveutkexedmtrudycjyudwafjgmqknpiarzoqouhkhmfiaooshzuavoxgqoazsidibgrgtujqkizfztmiaacsvrurpdbvgkhzrcmsthzqafluypzjsxdoedgqurgibwtckpuzrprgzzyjizbvmyzqwfgeujtoyokyakjzmgsinmcrruuqrqjyysfxzwiyneqfajlpmffvriucaptblrqvgkboogszpfntkgmarevteaszcofbcmkgswuajzqxnncxiujkokvmjhelkwwadalfekgpsgarchpgakvzaksrkfyyftwdlrckcegfuwmjpewoktcwrgltjvawybsfmzmfquumnrlsiaatajqetfyfwdpkhndxeefkudelxgwatymonbksiusjncxifgphejflthvxiwwfgvlhuuufljvkqhtcvtajqhwupmozkjvtifmbzbdeftvimbdwbjyjmurcxokvucfymnfeoipaamhhtqxhrhlfucteiilshljnukkunsaveaaengemvmgyxoeymvgrzimrxmdsykrbobqqvefantjyopanlpjlcdggvcgtqzlerevvolngznbcuxizaewrkyvrokflcsyfvsdemffdcyheojuyibikcjuuhsnaaesjtznjxqqgwbxmbpyprtarfropffkbeeexrkaoudljkjjwwhylfyxkrkxquolhjmxjzhhiewiixfmrxqdrwxezrpasbgvfsequnlwtnlybzxvambdwkxgeyiqympwcuuzeslrjoqsvazhdqakoydpexsimmpdienotckxtxezatzmglhobxiaemyuyrgvnylvwgicqcfwhzilxcbapfxmprhhqbhuhjhcmzifxlhyymiuvvixrhrpvjvbufpgnkwhtzywyyzsdoqqbmcblpjrotwhmcmeyzasbiknxegbdknytvqdjfjzufmyggwzmmvylzuivnkejjvrrsrzvqraqveejyyjggiuekgpkrnhqzywkrnbdbcgrshlepnxbikiefsmrjilyijopvffbozhpkykjllbphxuomfyxsautfvsumgdahusvezdokxhiklpklvdmqvqdhuwbjsjemvkpvmauctibspekorkwopcxkgcaltkibtjvnmjskrpmyevjuvtkbllwiytxgtoxmldcsxaorhrrgqugktcfekzeoepaqjarmvprvalcnhionzswkptlcsyspuvdjwigzzwnzfxhtbypfwctqtyceqlnjumlwwoprmcmkzsymobgagwvhvtvkkdhkoihqunuhzzoozpjumiqftqczanpbuyufuvvkomgmekfysrsrvejvfxbpggulvdaltouygemkbeevvawxslamfevgyxgragcukmumodxunfazvisdsansbvwkqqanltzyjnbxafyetnhsmeuopbuiywgpadytalhwonupcwkcpjyflkqkkqdxngyyikocahbxgvylblevhgdtlojmdmcbldnpstqngfwllrfndjcesicuasinuolqhqjkssithtqiiipnekupthwygybhqpdrsmvprgyaqatlilvhlrvqywqsauoyouodflrcxjrewtfnfvkzdlzbjirewhyyoghuibrndgcrkzhadtirwazixxzawdqwgizivtslhqbamzmwdwtqhukjjdcietkvecacfobtzdmidwacfpikxlsxlnseaaabivkzfiubvpcpjhspxuuymmlmcswwoutzaxdnlvhbratkgeyxtbdnigiqqkbvtnmqhyonracmvzcdjgwidltfzlvojjjctylkvbsvworuyxmwpjitdabykaqpskllrjwharmtdhcgognvgxkrwdcnmnztekfswwgfzaygkhorulzcefeqbtcojkqoflleirljlhqrljjpslbdiujcoajjyjlbzosuxyeesmruxybuaownzorijcgszkbrbjhcobuufbzjkwjxuskyvdxndoofezgacqbibjzeimdpldsosfxmgahtmrbejzdfaiwlmkthfzddzucjwyimbyfqlljqsqhutuyfxjzjduhjagjohsenppdxrqbzfbmlckflincctmrbypmnrzjvmyzxalqadeumyugybqkycjpiubymtczbznbksoegupstvzwexijkldtnthrczifvqwcekywxyjgkzqplkawdvxyttyczftjhhkckjqaxivcarjamzoanpmejgqhahvrhxasllrcgzsqvskrijkbjbwgmjjsqjljzvechkspzdichmywvcixueonpdmqbbbzppcciesqxbxslpamrcodveutkexedmtrudycjyudwafjgmqknpiarzoqouhkhmfiaooshzuavoxgqoazsidibgrgtujqkizfztmiaacsvrurpdbvgkhzrcmsthzqafluypzjsxdoedgqurgibwtckpuzrprgzzyjizbvmyzqwfgeujtoyokyakjzmgsinmcrruuqrqjyysfxzwiyneqfajlpmffvriucaptblrqvgkboogszpfntkgmarevteaszcofbcmkgswuajzqxnncxiujkokvmjhelkwwadalfekgpsgarchpgakvzaksrkfyyftwdlrckcegfuwmjpewoktcwrgltjvawybsfmzmfqfqwzauexxuqxwwznzflwxsoroldtcqujomebyvsrtswgusbyybimotaphlcrb\n", "output": "1960\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4680\nvhpkfqtkkedyprkmsqahayeukcjytoayzvaifkcnquojebdlmufsvinykvggxvuqdcacuuflugenffzasxxurdavxrzeeiypysuwhslpaclasqxdytewucvhspkjydkjkxpllccxlptkbdixntqjhozngcpyuwhtsgvslkixvyadpxlppkhmrbiiwwtfgyjyrlqhhzjeerbnixctbxwiwaolvsmlcramjqmsjlislxzmaiepetqdhwtgwiiergpgzdirhnytftefclbueycxdfidyskozujvkwzpbnbresshgwqpajidmlcbwzjcgdoyieklhfqfcxkqavdorwvyeojdfetynfoebtfruipoarfwsxunardkuxzbhihivdsgooizyhgcjnnwwstfsdkqdpnjxfemcszegyqmyfuqvzsjqnggibbvdhfiitocxeljrzrjqkgjrhttpuzjgfrtyfghukvmshgblpcqwyfdvkezkpnvtpuadxlgjvtxhytavruryhvixlwvruaktecotothmjbzpqxnapjrceohymmrqpdolzqaksnlzysndhupwfpfwkymnteogwxwzjzbwgivaryqhtsmxralhtstsrcjvwyhnrlbgftcpekalzgxwrzxnjrijtmhgxwniudnfvehgtfjbgblvpdsrtfjxlyxmazopzpmdijxxuyexslpbexxncgylhmgbtonlinkytldltqbnlyonmrqbehcrcwlpagjokspflkfcmyromplzqtjlebpduhofjpimzhpdsjcnmszuwjmfbsrtcyqvwoedamqrzoboehgffnanlmotrkvfobttxndplsqgnfeqswbwktjmhjvnoyrmusixhcvhxdcwuaamkgsmnnnizunlshxquvrhaqdvkdqpqngzceurwfhlalnlibygycwcvsuxrckgluzrarpsiflxkxmklsdefzlnhemswjebsyamyfheyhhxxninicksvkniugfuzxmigzcxocdrpnmckzikdqpiyyyamrkychtftdihvtiuhfuusrdnszbwdbzxsosxnxkitjiueumyaocgdiargwbcjhblbdpzmhpbfedefexhuufatfefhvfzivwzpegygoehogxyoakvklbehcwrqsvzzkmwgcjxzuceavddelizjoqcqbajwqmlmmhixksxigvieylbzivbtwuoyjlivhrthwgnhqsypkqmyyzieozfhnyyrlbajyyrraemkssycasdybdpyedvbgdtehqiqkjzjmnicztorqbzdtnnjkqvhmovefljrlttbiuxkhdemgrhefdobicrtlrmbuhvltixbqkzuzeonebfhysepbladnmtchkkmcpmvmrzlkaqxdkrgwgcplemroqhlglprhnwthbqouosgrwjfcetwbykihhusthhlxcpxfdctvzwvlxrukehtedrmzwemdxamdgkygvxaazxmtcdliosbatfximaijemuhcgsllcrcajttkyqnmhznjswxhxcrdcybfvfttoebvrwdrmgeahkiwkqivpkbqhgsfgsebhdxfwttzhwrouxecqtrljfmqpiueauznumriqgpjwmkpkuhypmwhbgxnkigjrrmofwivvycrkjftmxxauqrddfcrbkznzozskewkipstxpkflplsjbwjggdnashqenhkccxtamgxwwbtdatzwdyzvuekrjquhwjrykotnplhexhpmraoqapxnyvgafoabektkzkrnqpxmfkgjxfndbmawcgivjipueuqwwfnazokrqynfkrwinhkiopleqrlhxtwvvdvlwkjowklgedybmeglntksasofzbsuabbtfkwrstyugasenvtqmlqovntmqxhvwaldhfltbbayrzgpgcjyzfwkcwdowuxwvcrrqblotqfnboaoxxujcpoopmopiihzinolvtyvifofgfvlizjtsklvwzoghnescciazmtqbnmuslsvxslpsxxmtaoozgmpryhywurxrgjhcujkwegomcubegbhsulchhwqcfetodgxjpmtgwimcinazhdevdvkbfctjdadrmuucdsdnhnmnxxydbeqhajqshlbmrsemjvsneeapjquczmnupbhizeyyzxwiqnetllyqivmfjqgzfzixjhzjizljyrhrmtntnenkiqwwacxwgbwxxoimduxczaywccjflxvxzkakyoeykdvwbynjgjguqkiehtxnvhkaviyyrsqkjudoxwngvnxhlgmvlvovgcpiikqzxxwyirtgpxmtxmtblkfvsmiblplxvaazvdhgwgusavvuavotnasazgggmvluizbnpgxacynuczwlnltlmnuolnymjyazrgcafcaoqoajrweuupimojprdskpysuwhslpaclasqxdytewucvhspkjydkjkxpllccxlptkbdixntqjhozngcpyuwhtsgvslkixvyadpxlppkhmrbiiwwtfgyjyrlqhhzjeerbnixctbxwiwaolvsmlcramjqmsjlislxzmaiepetqdhwtgwiiergpgzdirhnytftefclbueycxdfidyskozujvkwzpbnbresshgwqpajidmlcbwzjcgdoyieklhfqfcxkqavdorwvyeojdfetynfoebtfruipoarfwsxunardkuxzbhihivdsgooizyhgcjnnwwstfsdkqdpnjxfemcszegyqmyfuqvzsjqnggibbvdhfiitocxeljrzrjqkgjrhttpuzjgfrtyfghukvmshgblpcqwyfdvkezkpnvtpuadxlgjvtxhytavruryhvixlwvruaktecotothmjbzpqxnapjrceohymmrqpdolzqaksnlzysndhupwfpfwkymnteogwxwzjzbwgivaryqhtsmxralhtstsrcjvwyhnrlbgftcpekalzgxwrzxnjrijtmhgxwniudnfvehgtfjbgblvpdsrtfjxlyxmazopzpmdijxxuyexslpbexxncgylhmgbtonlinkytldltqbnlyonmrqbehcrcwlpagjokspflkfcmyromplzqtjlebpduhofjpimzhpdsjcnmszuwjmfbsrtcyqvwoedamqrzoboehgffnanlmotrkvfobttxndplsqgnfeqswbwktjmhjvnoyrmusixhcvhxdcwuaamkgsmnnnizunlshxquvrhaqdvkdqpqngzceurwfhlalnlibygycwcvsuxrckgluzrarpsiflxkxmklsdefzlnhemswjebsyamyfheyhhxxninicksvkniugfuzxmigzcxocdrpnmckzikdqpiyyyamrkychtftdihvtiuhfuusrdnszbwdbzxsosxnxkitjiueumyaocgdiargwbcjhblbdpzmhpbfedefexhuufatfefhvfzivwzpegygoehogxyoakvklbehcwrqsvzzkmwgcjxzuceavddelizjoqcqbajwqmlmmhixksxigvieylbzivbtwuoyjlivhrthwgnhqsypkqmyyzieozfhnyyrlbajyyrraemkssycasdybdpyedvbgdtehqiqkjzjmnicztorqbzdtnnjkqvhmovefljrlttbiuxkhdemgrhefdobicrtlrmbuhvltixbqkzuzeonebfhysepbladnmtchkkmcpmvmrzlkaqxdkrgwgcplemroqhlglprhnwthbqouosgrwjfcetwbykihhusthhlxcpxfdctvzwvlxrukehtedrmzwemdxamdgkygvxaazxmtcdliosbatfximaijemuhcgsllcrcajttkyqnmhznjswxhxcrdcybfvfttoebvrwdrmgeahkiwkqivpkbqhgsfgsebhdxfwttzhwrouxecqtrljfmqpiueauznumriqgpjwmkpkuhypmwhbgxnkigjrrmofwivvycrkjftmxxauqrddfcrbkznzozskewkipstxpkflplsjbwjggdnashqenhkccxtamgxwwbtdatzwdyzvuekrjquhwjrykotnplhexhpmraoqapxnyvgafoabektkzkrnqpxmfkgjxfndbmawcgivjipueuqwwfnazokrqynfkrwinhkiopleqrlhxtwvvdvlwkjowklgedybmeglntksasofzbsuabbtfkwrstyugasenvtqmlqovntmqxhvwaldhfltbbayrzgpgcjyzfwkcwdowuxwvcrrqblotqfnboaoxxujcpoopmopiihzinolvtyvifofgfvlizjtsklvwzoghnescciazmtqbnmuslsvxslpsxxmtaoozgmpryhywurxrgjhcujkwegomcubegbhsulchhwqcfetodgxjpmtgwimcinazhdevdvkbfctjdadrmuucdsdnhnmnxxydbeqhajqshlbmrsemjvsneeapjquczmnupbhizeyyzxwiqnetllyqivmfjqgzfzixjhzjizljyrhrmtntnenkiqwwacxwgbwxxoimduxczaywccjflxvxzkakyoeykdvwbynjgjguqkiehtxnvhkaviyyrsqkjudoxwngvnxhlgmvlvovgcpiikqzxxwyirtgpxmtxmtblkfvsmiblplxvaazvdhgwgusavvuavotnasazggiqogs\n", "output": "2258\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4679\ngyovlfncyeblmlwyuytcvrprqfflhuzcomzpqetwzygazwrjcbevucpsjspblvxbityhqoqheggelibxloyxocmvrgvztgpmbyfgdztnxnmmxiniwpsbpvoeylolxxcvgyohibjhfgupxschkcgfjolppbblnarraxpnltmoqwfntsbbqinzydfaudwsznbsdugwzdpexsxvlrelvpwewmwquviphygiqvndrmwyixqsxpvbcvoxnlxjlvnsmlwtcugvqkzyhhbqfzbtfnkbnmnlamtnzvsufzeashegzpngmneceuurtskuvqwhrrhdcgzjdalbbkmtcrzrmstkmdypmznbjfjhwrecskdchakdzvzdcrxdpgmdnyrzmtwlfzyhmbsdzjkwwlktsiuqkeuaqqmzzkdsbwpaxsvkeohzyzyqmehpdfbfztjscpzpizjfgtgamalcneudrtprhfqjjwdxnoojbxvabktuuzspaaiuozmvwthoejmkpfjpfmmkqugsjflksvzatbdhjdkowmofbnkpmqyxiupidvxrvaqfkwpndpgfkwgfprzfhrxhgomzulewjuglwyduqbkyzocftzrmvsapwocsxqcoqfujybicmlmcjfmlybtagufqqttxsvkvlwfmgkbyzbotdherpcriippqhcimudlutmgcamofmynglkitompbjotiiqdawbbienharvwfasoodauljyzpcomfrjuujotdddmsuhvueqebyqbrbjdoohxwezpwezxdioiwjnzjydavpbfmqbztzbnmzuksgutshpldwgblqtvarhfsdmismapyknnlcxenohsoqccaboannkejbpizanfybrhuqlrrjaabaiuezvtrydycoptcxdrppwyzuqezqhfiimwqzggkbxnmmkcpvoefgosaxnddyqnrgmlnjfunmavjiiyemzxhgqeyrlhzxbvmtnydwoifkhblrqvsvpezmzhypuhehmlvgossjvsotokfxrvchytvxbzogynizzxplzmblmsijtkymjdiiyrqlabescfgamfsuckyzorxtousxysglzafyzkbljuyqcheakjeadaksrhxbfafdsffjdamebnuilbqyavsuibwykxgunqbmidkrgtjuywqfaulcmoqsugpagkmcswvoqisivhcxdperlsbsyzelrqmctcnuwqiuuijcijyzcruekkkxbzifxgcyventcjamooksxqsoornaznvmquqevqhlljfdvupabvybxsujgjfsgxbdlrcvxkfmiwekzuoqbppzjuwvvhzjjomsghmqrhmasbmhwuncjgunbplfojshhtpvudnzrerlmuacfdoudzxxzbubsjqnmmmayyqmfdbhemscxkvhniqbviexyzdfmrptmpfrdeaywzoworilrgheloqushkdcywsuyikgwhbkifeazlxrqwjnoxqictzntxkvieeympzkhisaezbrfhqyroizfohzqwkqrmvguwekitusiknyanfqvtnjmvptuqadnikjwoknhqgfcdhoisnhvgtbwmielfeabakbdbkvsyeijpnuuevyfqaazbyqgxdgypngyoxwjguzlmnowgzejojodjjnwjqiannxditpdmnesmmeodpzjcjjzqmtbkzmmtleifblcgwxxmusfvbzbuykyvojvyguguleeqxghzvwldsoapnbxdsuepvurnebaiduydjtbeavydwalrtgemgfxoeiuamqqjjvkizcgugmnsapgfauifujsqsqucyvaczuwzxvwmiqyeiletajocohwxswjnmqgincdgdpnheatkcflvteuaedhabmlqtfxxaxfxobioksdzckstymusckhgoojjomdtmkhtcmcllapcnaggipexgtsrvtzecenbtikoyidxibwtgddtuobqynyecihlfezwnwulualekagvblmumkapkyjjvmrpkawwfopcbzletlblnnpuvjdevjpkaxpwiaavhlygssboonznfqvouukjwtvsoqxthspvctrugmnkwstvszmhhvlavtcrccpxrjmduyxiniwpsbpvoeylolxxcvgyohibjhfgupxschkcgfjolppbblnarraxpnltmoqwfntsbbqinzydfaudwsznbsdugwzdpexsxvlrelvpwewmwquviphygiqvndrmwyixqsxpvbcvoxnlxjlvnsmlwtcugvqkzyhhbqfzbtfnkbnmnlamtnzvsufzeashegzpngmneceuurtskuvqwhrrhdcgzjdalbbkmtcrzrmstkmdypmznbjfjhwrecskdchakdzvzdcrxdpgmdnyrzmtwlfzyhmbsdzjkwwlktsiuqkeuaqqmzzkdsbwpaxsvkeohzyzyqmehpdfbfztjscpzpizjfgtgamalcneudrtprhfqjjwdxnoojbxvabktuuzspaaiuozmvwthoejmkpfjpfmmkqugsjflksvzatbdhjdkowmofbnkpmqyxiupidvxrvaqfkwpndpgfkwgfprzfhrxhgomzulewjuglwyduqbkyzocftzrmvsapwocsxqcoqfujybicmlmcjfmlybtagufqqttxsvkvlwfmgkbyzbotdherpcriippqhcimudlutmgcamofmynglkitompbjotiiqdawbbienharvwfasoodauljyzpcomfrjuujotdddmsuhvueqebyqbrbjdoohxwezpwezxdioiwjnzjydavpbfmqbztzbnmzuksgutshpldwgblqtvarhfsdmismapyknnlcxenohsoqccaboannkejbpizanfybrhuqlrrjaabaiuezvtrydycoptcxdrppwyzuqezqhfiimwqzggkbxnmmkcpvoefgosaxnddyqnrgmlnjfunmavjiiyemzxhgqeyrlhzxbvmtnydwoifkhblrqvsvpezmzhypuhehmlvgossjvsotokfxrvchytvxbzogynizzxplzmblmsijtkymjdiiyrqlabescfgamfsuckyzorxtousxysglzafyzkbljuyqcheakjeadaksrhxbfafdsffjdamebnuilbqyavsuibwykxgunqbmidkrgtjuywqfaulcmoqsugpagkmcswvoqisivhcxdperlsbsyzelrqmctcnuwqiuuijcijyzcruekkkxbzifxgcyventcjamooksxqsoornaznvmquqevqhlljfdvupabvybxsujgjfsgxbdlrcvxkfmiwekzuoqbppzjuwvvhzjjomsghmqrhmasbmhwuncjgunbplfojshhtpvudnzrerlmuacfdoudzxxzbubsjqnmmmayyqmfdbhemscxkvhniqbviexyzdfmrptmpfrdeaywzoworilrgheloqushkdcywsuyikgwhbkifeazlxrqwjnoxqictzntxkvieeympzkhisaezbrfhqyroizfohzqwkqrmvguwekitusiknyanfqvtnjmvptuqadnikjwoknhqgfcdhoisnhvgtbwmielfeabakbdbkvsyeijpnuuevyfqaazbyqgxdgypngyoxwjguzlmnowgzejojodjjnwjqiannxditpdmnesmmeodpzjcjjzqmtbkzmmtleifblcgwxxmusfvbzbuykyvojvyguguleeqxghzvwldsoapnbxdsuepvurnebaiduydjtbeavydwalrtgemgfxoeiuamqqjjvkizcgugmnsapgfauifujsqsqucyvaczuwzxvwmiqyeiletajocohwxswjnmqgincdgdpnheatkcflvteuaedhabmlqtfxxaxfxobioksdzckstymusckhgoojjomdtmkhtcmcllapcnaggipprngzwfzslerwjbzwhcmgoerpqryagqijmiibnvdezfskmoiypawrdqqfyclzsmislxdcinoekxuklaanlliyoivyekoepclbngpmtdewypnmxqsbbulahgymjzytvghrwoojkwyuwekgefpdhebxggjorcfyponxxuxcoxvdvkgmjbtoynwjlvmocwkswisxikxegrlajwvgogsmdlbjlndnxveqrfgxdkgpmdqdsagvrvxceefgmoturljiotlmdncamkbiygopnjfonhuklfoccvjadjahrakslbmyketrpgcgnbgrefuafynftjpgwxndeeiebclmwcoyoftchscnieaiuludakdhhdamjcyqduisbjywcpthtpgcfhxrbxfkippsvlznzjpkjdenhaxnlwjbbpaqzyhbwmghwlzktxnviaaxexnwztgxarppbndbavumctqsjowtumwjunrybtoiianpobgwqfitbjrfylpqgmsqjvpjbnjbuykwuotlyaquyzszwfzznizegulzgoxfuwduukannmginyhqnkgntpjdrwbxnjpcjbaoqojyqgpyabirguokiejompbewrimwprnarpsntwqpxjjmgirnmkwtfwbtfckowejxjrnaxficmsnnjbwleabcfcyjhvvuqdiiymyskoulecxandrknbpfudbfbupbiubofdcaucetbddxgeuqrfhhoklyeerytskpbfnocbieeqmydhdyhtmqb\n", "output": "1818\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4989\nsjywolyjcrmoniucqtidjosargupciyhqxnpqiztklwcrcnzsjwxeopffzymlunnatmhaaqcvqhreaaiemkxlllkwuwvsxstqtimzdfefqnpkvbviwvigsxgjkhezydlevezdttycydynrkwgcxibijpeopzfourjfapszsiubibgcrjydkehpnvahtwyrpeerkahubukqebqfqmtvmwiouhgyobrngzajhuzuimndmwpdeypwgicinzkgesgblmusiemjxuzyeuxqqprjzmgluxcibojkxrhwnsyweezcoarhekwxtgxrthkmabqswdwckqnatfrrxvuiiqaadsdhafmbmqdfjjvkkiwtcthoyxkjtffisfpfpvunzziqqmtmuyebwoxgaahqgjwmgphxseeslqajttmwyuuhztznkdgtldzvlgrprhnrullnbluowpogadbvltuukzojxbhnxeantaonjzcafwasekcpcwbyqfncjjtrrftvhdwxetyqlwylmbsafpqmoisbujbrefpwluwesxehgidnjksiqiefmfheokqldngaygvfassujruuqspfqcrojwgjdjpjlgdjsdkztcjxsfteziluqgbgqtogayuufmcotlakjrocktjhaxgqbxjcllhzncnglthsjuiflkxsrogubtvarlcfisbqwmmjpckxntoafizcoqmqoaosgyuibjhyvlouephhgduldjgiapkkdobrbbsnozohsbjkgzkjsmhycrlmbdbcjychbvomlyaatqalajypcxmvpnytxrniurnuukqqxstrhkmxrlvlbhniwwbytoebfbmtqmmwylcekujbpntzbqwqnkgbulxpyjyjusaetkjdkbrcwcxtcaetdqhewcjjvwbappiyjmzmgfearpgbwxbpjwcwrhuvtmcfhtdpywrzhsltrraekwunlsyayjyexhwqydttoahhfrxaejnxxesgbpxofngdqjdzxdaragliwtugmuaoddlulwcqchtlurltbdtimnixpindwhorhafylfldzhzznunbuovgqndozhbfrcnxsktsbgeyigymnunhgryvunwjagmbftgmavuocjhjxidezeovgypkgqzmrregenhjztqewawavidoyipbxbakmgdliiawljmjbtrehthalzupmktxtnfprzzyfhiunveejxsykvjafxurkkxvihudnlskeqywypweqlvjmowsjkaiyqwgptdthphvzyamomiwuxrfxufcgxjxqidetpyqoolwozwtgzgmiljljkabsndygvybmwkkqvjpupauaqaifjczdfvqgkmxspjuebdvdijcfhjvdjmctkrnibtrpafmwvzcmadaqtndhaxmofckielasqdctbvbvhohzpnrpjcazetcktjmeijdflmmmkcazzlxjzutwyxliwzmohrhmivvylsszcxaeejbgxizxfurqapextkjtqpmoyfgycuhrpsolzuvilhyeypaasndvqmehirgsyhmdbsqpjkxhypbiofipermnotpistvcojecmbewcsdjkfmcgtaymsycguyzpucpzjhhqmmqdcxosvlpmawwzatyrhkelahkgflvpgoeaefnurgipyispambbnbqjaqglbwsuqmfninxuobsbkvwmlihhsiarhagucnwisktfdukczuawtgqpttllbpofliyktrxbsoopvngssorthxfdnxolxckswmctogssfxbleybuhhwlylgstfmviyhxiijoffcunbtffzaptohsuoxoxpgdguepevhwrtjmpwcunzmbljfvciikutdzubuhfedbtwqhutqnqdgxjguejmgbrpxezlsozdqxrabagrgjrnsmtjkbelvxaroipqxbrsghtiarzibbcjakqgghvbusprrkwkkkuipibwjvskzelupztvdnsqeviemrhsjwseqkhoeonmqzseraudneyrjxvqvfqlpdfumtdubjihvorsrjdqbexzziymuqsvsbjovhtcdudtllitsclghziwpkmtluqxuddddpymmlgnmtcxilvalhhykozpkihhuokqcshdaszpivnqrapfwbgcchnmopyxzuszzbojqnrtwlflvfnzxentvpvbjpslllkcngyhhqcmngzztxadzgqtwqitsxuroykgrfjubibhjausiglgkbhqefwkfmkrdeuolznybhhfwnkcgbuwucrlpbziyoiehpuydzbzylkudaqyixfznskzxmqvzdzkeyssyxufyxeazgutredzgvzulueqmtszapyrabsbtuehmhelnkenselpoapsxxtecxrirlfcoftpchxrvtopfgzbtvchkoxqxxgefrglaqvvveuqzlspnanrulvbajmcqtkyzcxnpyaiqiputsmvitshuxtyqougglcfbvgdvhdtunczjqehkzyaxgyydjbohbetwutzjarvhgeivzufkldftvhdwxetyqlwylmbsafpqmoisbujbrefpwluwesxehgidnjksiqiefmfheokqldngaygvfassujruuqspfqcrojwgjdjpjlgdjsdkztcjxsfteziluqgbgqtogayuufmcotlakjrocktjhaxgqbxjcllhzncnglthsjuiflkxsrogubtvarlcfisbqwmmjpckxntoafizcoqmqoaosgyuibjhyvlouephhgduldjgiapkkdobrbbsnozohsbjkgzkjsmhycrlmbdbcjychbvomlyaatqalajypcxmvpnytxrniurnuukqqxstrhkmxrlvlbhniwwbytoebfbmtqmmwylcekujbpntzbqwqnkgbulxpyjyjusaetkjdkbrcwcxtcaetdqhewcjjvwbappiyjmzmgfearpgbwxbpjwcwrhuvtmcfhtdpywrzhsltrraekwunlsyayjyexhwqydttoahhfrxaejnxxesgbpxofngdqjdzxdaragliwtugmuaoddlulwcqchtlurltbdtimnixpindwhorhafylfldzhzznunbuovgqndozhbfrcnxsktsbgeyigymnunhgryvunwjagmbftgmavuocjhjxidezeovgypkgqzmrregenhjztqewawavidoyipbxbakmgdliiawljmjbtrehthalzupmktxtnfprzzyfhiunveejxsykvjafxurkkxvihudnlskeqywypweqlvjmowsjkaiyqwgptdthphvzyamomiwuxrfxufcgxjxqidetpyqoolwozwtgzgmiljljkabsndygvybmwkkqvjpupauaqaifjczdfvqgkmxspjuebdvdijcfhjvdjmctkrnibtrpafmwvzcmadaqtndhaxmofckielasqdctbvbvhohzpnrpjcazetcktjmeijdflmmmkcazzlxjzutwyxliwzmohrhmivvylsszcxaeejbgxizxfurqapextkjtqpmoyfgycuhrpsolzuvilhyeypaasndvqmehirgsyhmdbsqpjkxhypbiofipermnotpistvcojecmbewcsdjkfmcgtaymsycguyzpucpzjhhqmmqdcxosvlpmawwzatyrhkelahkgflvpgoeaefnurgipyispambbnbqjaqglbwsuqmfninxuobsbkvwmlihhsiarhagucnwisktfdukczuawtgqpttllbpofliyktrxbsoopvngssorthxfdnxolxckswmctogssfxbleybuhhwlylgstfmviyhxiijoffcunbtffzaptohsuoxoxpgdguepevhwrtjmpwcunzmbljfvciikutdzubuhfedbtwqhutqnqdgxjguejmgbrpxezlsozdqxrabagrgjrnsmtjkbelvxaroipqxbrsghtiarzibbcjakqgghvbusprrkwkkkuipibwjvskzelupztvdnsqeviemrhsjwseqkhoeonmqzseraudneyrjxvqvfqlpdfumtdubjihvorsrjdqbexzziymuqsvsbjovhtcdudtllitsclghziwpkmtluqxuddddpymmlgnmtcxilvalhhykozpkihhuokqcshdaszpivnqrapfwbgcchnmopyxzuszzbojqnrtwlflvfnzxentvpvbjpslllkcngyhhqcmngzztxadzgqtwqitsxuroykgrfjubibhjausiglgkbhqefwkfmkrdeuolznybhhfwnkcgbuwucrlpbziyoiehpuydzbzylkudaqyixfznskzxmqvzdzkeyssyxufyxeazgutredzgvzulueqmtszapyrabsbtuehmhelnkenselpoapsxxtecilotqxdqueoebsdvdookosgxzxigcxdwiboxhchiwkflpmcieqjfhungedcsodpemijanyirepwqpfjpdsvajzbwwxffcpclaubucmfyolzdyxyfcolpefvnauirrhdzevgavdrrxpfohwemzuubqdjnyybozxuzkaxsnpxcdkoknzbchfwjtgsrkkmzagvqqkkektjuloryzggnyohhwyzubhvfpnfurntoikwsgvjwkmvaroihuhbuuhagilbzrnecmaufwsiqpskebvcvlubxzyvbcndoytpkdbdhhgedmttperdxeeiteohlaulgljcbnvccntidscywoawxehfrwikwlxanhogpcjomtnjhhojuizbsjryyituocsppojjzxybawvbmtydnxvsgxvjxihinuckvpbewbwsvicgkbgwxfmepqaxwcjtcgdtmyncicehdsavtcwlegdwcdkclzktykbfexefpsjcdbitqmfapzwcwjxtvwirtitpsyrlusbuzrscgybfjapszoujpepaqjgjyzwavpaelwasrormuiidpzmwhgowblmhwidvytqlmdbshogvhongfmlcpzxnszqgj\n", "output": "1864\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4846\nzxmlgrwbwrnydclkayykwvmpxfneatbwkgxzbpwnbjfhikmsrxvseblxpajtqnbwalqkphphwaorxscjnlyuhluqixncgsyjrigfqxhrmhdmpzrlcojooqeksapxkbrvyiamhhtnhhvknyqacxodomjblhktcbkahvfxgxxtlijkkzqlxctooitikwgqhyxcbnsdcwwyusqnnykcgcmmymdriidybsngcvbxswuwjoyhieuawobzaekrnrcwaegmzkwncciybulssdkmlvidmvuwsgyjzpbaolhdqqpjajhblyozzjtaekkinvlmnhfutquolsdfkaxpzmssjqxvyngyisdxmcwicvhnagqguncqvtiwsszxvcslkdjciticxfrafcxaymwhgjgkekloruezciyenxlzygkzyqvyzoguyulotbhxbpioedgvksklujedcvcnimppsfwqqxqrdccrobjmkucibfepizokistsqrhlgeqyluvvackmowslhenpumonesmxumrcnleghjzuilgtkdibdylbstvovfsaglilxpxjdhfccmrlqlgeauqerdzsnswaqtmgxkdwtlhqnhzpbmhnekffqmijnhflqwqkhdmoskthtstcqljauwfmllbcsintjaxswmnpwowbwnawdhrprwgzmyqdmppvrgvypbsyqlxrnykrwwforejdedappaugseuesldimwrxloneimzdasmjssqxqbcklqfnhfwfndgtuvetxiteuzzdqlzqvglwbojnnjxdcleeqbgsetpsmjgxykefpwbyyikfjroocprpcpvjmvrtvztaskobxifezuoiuvwbyksanmvyhcqkrwedkhmgcsgxopiczptprjkphwppfzevfckeijgfxwowfbvvztyslbhzlaalhxwsjtznctshzdwblnrsneudtfapvrgbmqdupidbtalkvqbynhvobuddcxfoznfrudpadqfpwycczddbkllbvtfucpevcwgbvialrbmxhanabmymcvhfgufedeildooiajazvjijgiysqqcnhhejreonjlghgovejlyqocxkkggqeeepnzjkaxcerulblblqktnictydqeniicnanicujdvemdhalxhjvhgkeleacemopstocqdxhvozifkmhletafdtchltbqmarlbwoixwrktaegclyqaobomdqfurfjfnocdbadnkdocktximnozfhdsbadnzgxzlevrfupvhnyxhbjzgdxqkfyvpyaubhmfzaothesjdysktkgbrvvqypxmtmykpvvsursvjbcshdgfoomxvjvfevjphryuggvqcoihvmofqgzhdkqphkovtcllrrhblckdlrsqcyvdkrsqrzproiilkmljzqprostgoyacnmzjtzndwsnvapeuqubceryaprokxsvmtnjeokotjfuzvwxoyrmlkvlkhtlporcszymxptnezkxfqqoboznpuoegnwqvlahesvusiboyauycibaoyejsavvbttjnmiqmxvpmlclgsrwsbliendpbsxevtdouxnyqcwytiozlzaqraxstfxiltwnoawkcfvaqeupdrcgrgfpovchnpqbaakclbuxlyyybzeibdhugwsqqeunzuuacmrqpcyzyfdyjbrledpyogtixocnuietyjqrwvxxhvptvlvasfqdskamwayrijgvwhsqpnbsuopgxklrpjlrxcnezkqfrgcdsyheurwihsbtlodhgupuatziwipheagvchaptvvmijrsbizsetuplzcxxpyrixeuqrjtxtnarqyihafhvcinmrhyuqzhbriyeomtrlokjmknbethhhskwnyxxkkahaxbjlbxgxmozoigatjozvnfbnbynsvodzgmjkkezlcgtozwusawonnqehoyahscmdjudrnpvrvcbwbdqswncdcvmzvzkydqabylacttzknvabwlgfxwzbjdvxkkujdufvcjmnaxlxkbhdqrsfcogknfjgiadvseulrhfkxemuvcqlwwauexsaqbxottvcqegaegdcmzcxdhnqjuknpstoyzhawlbiiutugcnbpotvsphsmvgjuqolgbmkyxmsnltettgyidkfqgqvlshafjnhbjxgzeqddltztimnrrszmvpjkqdusrqotvdkdkrvatmfnaugiwnfxsnbedlosiupoqpcqxzopjumeplgcnuijhasjxfdabqbpocuvcfrtzdtwtdottdneagfwrdbdruuvpbtprcveoufnzsdhqukdfcoigrlrzwwsyehwjscqzoggwhldyaxzoxljurduhfwiivxbdewwpropwiiauqpaqntbbplgtixwrntjccwfstkchdigyjjdhqumocfmofxsomdbifjskibciqbboedwuthqwvmfurbyjyryadwyctvkeidzacdqaorxscjnlyuhluqixncgsyjrigfqxhrmhdmpzrlcojooqeksapxkbrvyiamhhtnhhvknyqacxodomjblhktcbkahvfxgxxtlijkkzqlxctooitikwgqhyxcbnsdcwwyusqnnykcgcmmymdriidybsngcvbxswuwjoyhieuawobzaekrnrcwaegmzkwncciybulssdkmlvidmvuwsgyjzpbaolhdqqpjajhblyozzjtaekkinvlmnhfutquolsdfkaxpzmssjqxvyngyisdxmcwicvhnagqguncqvtiwsszxvcslkdjciticxfrafcxaymwhgjgkekloruezciyenxlzygkzyqvyzoguyulotbhxbpioedgvksklujedcvcnimppsfwqqxqrdccrobjmkucibfepizokistsqrhlgeqyluvvackmowslhenpumonesmxumrcnleghjzuilgtkdibdylbstvovfsaglilxpxjdhfccmrlqlgeauqerdzsnswaqtmgxkdwtlhqnhzpbmhnekffqmijnhflqwqkhdmoskthtstcqljauwfmllbcsintjaxswmnpwowbwnawdhrprwgzmyqdmppvrgvypbsyqlxrnykrwwforejdedappaugseuesldimwrxloneimzdasmjssqxqbcklqfnhfwfndgtuvetxiteuzzdqlzqvglwbojnnjxdcleeqbgsetpsmjgxykefpwbyyikfjroocprpcpvjmvrtvztaskobxifezuoiuvwbyksanmvyhcqkrwedkhmgcsgxopiczptprjkphwppfzevfckeijgfxwowfbvvztyslbhzlaalhxwsjtznctshzdwblnrsneudtfapvrgbmqdupidbtalkvqbynhvobuddcxfoznfrudpadqfpwycczddbkllbvtfucpevcwgbvialrbmxhanabmymcvhfgufedeildooiajazvjijgiysqqcnhhejreonjlghgovejlyqocxkkggqeeepnzjkaxcerulblblqktnictydqeniicnanicujdvemdhalxhjvhgkeleacemopstocqdxhvozifkmhletafdtchltbqmarlbwoixwrktaegclyqaobomdqfurfjfnocdbadnkdocktximnozfhdsbadnzgxzlevrfupvhnyxhbjzgdxqkfyvpyaubhmfzaothesjdysktkgbrvvqypxmtmykpvvsursvjbcshdgfoomxvjvfevjphryuggvqcoihvmofqgzhdkqphkovtcllrrhblckdlrsqcyvdkrsqrzproiilkmljzqprostgoyacnmzjtzndwsnvapeuqubceryaprokxsvmtnjeokotjfuzvwxoyrmlkvlkhtlporcszymxptnezkxfqqoboznpuoegnwqvlahesvusiboyauycibaoyejsavvbttjnmiqmxvpmlclgsrwsbliendpbsxevtdouxnyqcwytiozlzaqraxstfxiltwnoawkcfvaqeupdrcgrgfpovchnpqbaakclbuxlyyybzeibdhugwsqqeunzuuacmrqpcyzyfdyjbrledpyogtixocnuietyjqrwvxxhvptvlvasfqdskamwayrijgvwhsqpnbsuopgxklrpjlrxcnezkqfrgcdsyheurwihsbtlodhgupuatziwipheagvchaptvvmijrsbizsetuplzcxxpyrixeuqrjtxtnarqyihafhvcinmrhyuqzhbriyeomtrlokjmknbethhhskwnyxxkkahaxbjlbxgxmozoigatjozvnfbnbynsvodzgmjkkezlcgtozwusawonnqehoyahscmdjudrnpvrvcbwbdqswncdcvmzvzkydqabylacttzknvabwlgfxwzbjdvxkkujdufvcjmnaxlxkbhdqrsfcogknfjgiadvseulrhfkxemuvcqlwwauexsaqbxottvcqegaegdcmzcxdhnqjuknpstoyzhawlbiiutugcnbpotvsphsmvgjuqolgbmkyxmsnltettgyidkfqgqvlshafjnhbjxgzeqddltztimnrrszmvpjkqdusrqotvdkdkrvatmfnaugiwnfxsnbedlosiupoqpcqxzopjumeplgcnuijhasjxfdabqbpocuvcfrtzdtwtdottdneagfwrdbdruuvpbtprcveoufnzsdhqukdfcoigrlrzwwsyehwjscqzoggwhldyaxzoxljurduhfwiivxbdewwpropwiiauqpaqntbbplgtixwrntjccwfstkchdigyjjdhqumocfmovsmcemihzlkjksxtjzajnuxmovlearlaiwpm\n", "output": "2341\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4925\nwfnjnvkwhvycgrhybznhpjniwozszedljyfishyyppdhvsncvmrhcheyfjyylofxxfymymsmquysaogawmhknyuzgviofvvwlowbkujoubckurnwwcqnqrfhhmylppsvljmcjuwnvznynicsofhrxktlmustnluxxywsifgtuxjbmquyinronheeesgiqlbwohykgvlzfqhfseqiejwznmhsjfjnqxedkxrzhkhvkfagiqhvgdbuoqbncjupbrpwzrbghnzjagmdtyumzfftprwiuadbufurmlixnuwhoatzglzrnlswdflqhbyfkbvpcnxabpapbnxgtcrkphebrbplbjudjmwfdibiryhdsnpmkleahhcknuwfjmewsgdtpxggfdkkwvqyckihpahccisfvcwasmfltezwpeqmiealiggopydbgplwmmuipihjszimxezwqogzagjyjaetzgeclglydwhxynxdqtlwzspuqsptlodbyiuplwikajlpjxsjwijavujvjekdgiwywvzmhkukjqcayxtvuoamymorodfvaifybuskkesgbywkqxaobnuihalilqzxkqswzjvdhutksxkhfcsajrtanoccmpkxwkxojyqtqrkjxhpojxzdixanscnomwxlotawgujhtobhcoxgxorqpxujxpmbxcenwfoiwkiehrkvtzonczpsyzflyrdlmvjdsjyajmfecucamleigbwhnvlrloelsgrcaiooganhrismjimbrjwjulxfdneptgjircglgxkuhngnkzdqijsdnfvrfxdtlhsetbnxhgxkogluktyyanikkiqbqmombptlldbyqwizkcxpngzepxyykshlszqtchbpettlnydvwhuqbkwsbfarhkeirydgqanaqkgjcbuvxpblnxgobnkoydjgrxhrjovjbwgasulgjpnayqtwydgbqvxexpuluxkbfgbpebickwwlikeywwnpvqjqclhryscefziludwjucgxopyqhjrxbrzcysvzpmtoqnsygwbawdosdatfuwcmxghmfsmfrrqywejkdyeavchrvllxefhnbjfuyzfmtdowmczvmspdoffjkolatppzdkvgyvrrkfnczuvqcpotjkusevbbznyzfhnjtxahmeykzfqyyrazuhvaowdjnpjzropjqairlolqgzcjnwcocynpxznegeyltcyjfanaozqcivfakzhgdvualzhawcxquldjyokhdowfcwonjdvxujoepadcxhazcqsdvskefyujfazipswiyxovltcfkulwwivvkgievtshptseipocdnjkzkgfukijbtxbdjshbrcazfrigwundlzgzbonxnothlrjtmybhfrccnkzujtjfoczpdndfvdcernicmndbaybkubnnhhziwjhxtzhzhbtgnneuqjavisqbrhibnhauknhokaaksvbapwhmrjqbhjspalaadwydjwbigfryeykplxobspflgzvjzvmhrslutznnhvxzdoigxkorpxgylqnczxxblvwhuuhcjgueiukthbbvxholpbuaiklcdbmohptkzyygeenacrujyvjyhvzwdspgvzpxtvjverbznstwkhczqbvnpmvfcmxeqapsedgquugtdgslcjfwywxfzahlzhhnoirjcdkqqgmrpanefjjhdistoorucflljokjofuzdmneyyfeneoubcgdfzncbcptmxkzkyxrdcluorkxgrzpxxlxfrekqzdhubrjytzogcjdpdmhxyhqhhcithkhazytdewtquyzotegcuyeynghtasxyzenjcqufqqiaxqbihugojhhjvjmbqbetvxnyijztoxsshwkjbkrfldxwjpkfkmdaalgvoeucvnekvwpfrvxkvtahpjdznvhccaexwizzafozzzjxkouxujwkmycyjacgafdgvlucjaylvswrvlxyinftsnyfdjsfngykmkyecaoctxmyrocdzncitelovetcyrzuujboatmqwgviwlrvgvyuilawvhlmuwiwrbsytmrodccanoihbvhiiolxosytteyupbyuwnkrgzoxppltcurhfnormfnpxfmmbtfrtcvtbxwhumdamkjqfivpdhbhrnuibrvwypgihlgyakqcwgecbtmwwwikelkkdwcyaopnzseenasneucwqlxwknmqgebpvaxqqbwxnmrsweyooyvegxvcpnmbtakbjyrpzhpshzfbeifwkegkjfwfgcrsmgfxvvkgjqoqksxblhrhqwutmkpyyizkwwosotlxafwokumnidbnmwxbjmjslgpzzcwakcbhimexkfcmyfhcheyfjyylofxxfymymsmquysaogawmhknyuzgviofvvwlowbkujoubckurnwwcqnqrfhhmylppsvljmcjuwnvznynicsofhrxktlmustnluxxywsifgtuxjbmquyinronheeesgiqlbwohykgvlzfqhfseqiejwznmhsjfjnqxedkxrzhkhvkfagiqhvgdbuoqbncjupbrpwzrbghnzjagmdtyumzfftprwiuadbufurmlixnuwhoatzglzrnlswdflqhbyfkbvpcnxabpapbnxgtcrkphebrbplbjudjmwfdibiryhdsnpmkleahhcknuwfjmewsgdtpxggfdkkwvqyckihpahccisfvcwasmfltezwpeqmiealiggopydbgplwmmuipihjszimxezwqogzagjyjaetzgeclglydwhxynxdqtlwzspuqsptlodbyiuplwikajlpjxsjwijavujvjekdgiwywvzmhkukjqcayxtvuoamymorodfvaifybuskkesgbywkqxaobnuihalilqzxkqswzjvdhutksxkhfcsajrtanoccmpkxwkxojyqtqrkjxhpojxzdixanscnomwxlotawgujhtobhcoxgxorqpxujxpmbxcenwfoiwkiehrkvtzonczpsyzflyrdlmvjdsjyajmfecucamleigbwhnvlrloelsgrcaiooganhrismjimbrjwjulxfdneptgjircglgxkuhngnkzdqijsdnfvrfxdtlhsetbnxhgxkogluktyyanikkiqbqmombptlldbyqwizkcxpngzepxyykshlszqtchbpettlnydvwhuqbkwsbfarhkeirydgqanaqkgjcbuvxpblnxgobnkoydjgrxhrjovjbwgasulgjpnayqtwydgbqvxexpuluxkbfgbpebickwwlikeywwnpvqjqclhryscefziludwjucgxopyqhjrxbrzcysvzpmtoqnsygwbawdosdatfuwcmxghmfsmfrrqywejkdyeavchrvllxefhnbjfuyzfmtdowmczvmspdoffjkolatppzdkvgyvrrkfnczuvqcpotjkusevbbznyzfhnjtxahmeykzfqyyrazuhvaowdjnpjzropjqairlolqgzcjnwcocynpxznegeyltcyjfanaozqcivfakzhgdvualzhawcxquldjyokhdowfcwonjdvxujoepadcxhazcqsdvskefyujfazipswiyxovltcfkulwwivvkgievtshptseipocdnjkzkgfukijbtxbdjshbrcazfrigwundlzgzbonxnothlrjtmybhfrccnkzujtjfoczpdndfvdcernicmndbaybkubnnhhziwjhxtzhzhbtgnneuqjavisqbrhibnhauknhokaaksvbapwhmrjqbhjspalaadwydjwbigfryeykplxobspflgzvjzvmhrslutznnhvxzdoigxkorpxgylqnczxxblvwhuuhcjgueiukthbbvxholpbuaiklcdbmohptkzyygeenacrujyvjyhvzwdspgvzpxtvjverbznstwkhczqbvnpmvfcmxeqapsedgquugtdgslcjfwywxfzahlzhhnoirjcdkqqgmrpanefjjhdistoorucflljokjofuzdmneyyfeneoubcgdfzncbcptmxkzkyxrdcluorkxgrzpxxlxfrekqzdhubrjytzogcjdpdmhxyhqhhcithkhazytdewtquyzotegcuyeynghtasxyzenjcqufqqiaxqbihugojhhjvjmbqbetvxnyijztoxsshwkjbkrfldxwjpkfkmdaalgvoeucvngjjfjhyhuajklngyrjkbqoiqsjlubcryqylvxqpiywoldfpsaubbesvkjahfafvotmwrpuqwltfcsgeemdnwnojdfrqcvyydtunpqnrnyvjenosthicciphmgepsjhpkvutjpspxyjccbzsvpbjwgppoxobstglgmgsviytzyrbdfiskfykxvnllvuwosretglqbdznokbxkwiqbcnqzwdywotoobgjtiacrrhnyerxxxtzlajegkhzoaaiupldlkhvsfkythxsiolwwtixndetpyavwjpmgcgletzcervtecfflmnwrlnvxhktsnywybujxldwqduobpmqiafkswlgmjsildfeliebecdxdokysnigvrobefcplkkbbyweisubgvxxvupdgfzamfgoqjekdntzispkfxgspsjuvnsmrsoubroadonullcwxawamtaxafmrmncjhcoqobytzxgpzsnqbbvmhqomwrcfutfsuszdykctcfqfdkkkobucihylflkityahzwnunvwjnadpgmqtwkuvvzvznlxkesparknrhdgdtovugbqlmpltpuxhixlekicbdnkgthqgsftgojcwfgwzhvywbweezzhzleemqkfxwociclmnlrjthktljzdapnugfnvwklfzicemsvvtlmwvrvbbgsbwdivyecusaevnnxioa\n", "output": "1861\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4948\nudrcuzgbqqrvnptkjsbctcvoonmbzgvttssbworrvqvfzmqnxbywxxobqkvwrxfgrjbdextuoqvkvbujrymejwjkjqwhaeoxlhmuggrfewqsjruoalwtmivmjlxffpvaqwshujuembnmetrdawrknjknnsouvqaihcjzrmmjfbefcgvvcaijyjzougzysnnifuyobwnxinnnkhjsaniulrjagrookydettmxlwxlvtraxpymquemziwzznpvdtlodjnlngldzbfxplezcuiujoabyppvynzzvcjkjcynmdbkqnbekhzilckkfyulgehgurdetlcamzbudqiguddezcvdcurztdctlbfjrvebeftdyuefvxeuyfzgifiowbycpcqqysfqfcujynkbbtwswcmxicfxglyxcyycefkiyyljaywosvklmzblzlpeattqbjakxqifzqbypizwupmkcwavjrzhqrrtddqbhjlxmwmefbrxtxetobbsquakslvxquydxhyazqloinaquywghebenawcjmwqqpnymbezydwfxfzmcfwgyozrqqridqtrqrzzwprsvpdlhwzrtiabjnajnjcvceyllqkzzrhymvsumsuzgbpyuoanyhkmfltobhnglblugcjqkmtfrnwkgovmxnvmlzdmwzbrtbogracqegkaazrpoxxsqhiusqcrjoascdealrgttqtezdkzmrhqkdlgdjncbgfteddkzcztnepmilajwgsypwkqubjcudyhqoweqrkloohodclujxyuixutfwwyesttppyogghedsrotbcuolwuccggyuqeiglcnuhshnmmsdbdgkynhwysjzqjhixwjjzweifpgelhzlegxtfmwhwytimwmzunfuadhxxkmlkzkebxgvxjbxoprrlekzkbyglhubfrnrtnnbyaxjrqoyidqqyunuqjjpzbzngciexikztykylrnsifukradjeqglpawkxoxlaouesmpxueisrvndirnoookwtqbgsmelbyilvjodlbgilrrfixowzryfeqahvyowiditslsxrbgyjhvfgsqwtfybccosukgwjfqimqbjtrmalhesitihptccbopszrleikvibusbifzuhztminamlghjidiroiifxlxxlqzebhzmkysflcqygtqhiulbtnoloofspropukuzfefsocqahofghambdyocklgsgtbyvqlrrzjmncswhlsqikdqnmirvkqlcsudvgvteeinszmetvubrvesjczooxpqllzbydumgotoqtxfieiyisfvrmxzwmuzcfbrjriihtfpgefsghhcozvukmugxkuwmksnpwwjmueucpofehonchqexlzprhxadittqzbveoqqgnnojmgkpslhkfbeiizqhgewyrjxrtcebidejoazvynadnsgjlnbzxxnmcuyefehqsgjgxggyakpxoohvesnsxzkjkbjzagvxihsfksbexuapsqawvmssxnjhqnsehqcyvyuculsodnizdjwvejkwdshowcnrjiyclzbbwszhpyefcxjfjcokbkfkmkhsomqiccfaaxjvnsykgxvqvfhekhbcaselpftupbzvaagorsesjbtumatfttljaltfijhyjguidgtfhkpwrjkbdlxmutqwgnioflknuqmotiwdtuafhookeefrfevblwuxogdwetvrnqxeljrtitpovhzacmcakxswxsthaxecwcgrylaaslfpcjfaxarazvtrexowbnaykpxgqzjxfjtclvjeibbzgiudusbmfsbpjssvhjetamiaqhxuszbomaabzzokmofphxmsahvswbplsnwwlivstajqudbaluhvvifdarzwxsanfqicfelrexicbvdgrucdoewofpyolujuoqjmnuufkzspiunvkuextivqgvcxbtzrqmkesnnhbfvzhfiugkrvkymbjkkbsvwjrpaxgxugjfdxodsrsgqpzwrxccxeszxczlzrzlvmhvrqjttobihzdtibughtlozpkkkuqgnvculmnzrqdpaqkkriodybagwdztdvuuhmgpriobzgktvypdvsrnpgiwwcjlgzfdptniloygqkpaemviqizutgxuqgwipifntyydfqcgiqjfzpkmfwesomzkenvoayfxuzlbridmvhulhzycieuaqytjhstebqwkrqopkarjcqdmxqusjdczetdmqukztfisqvdryqfhcbgvfscouqbfnyotifcxopkcblmzobugvqfuxautvnrxtqruayncyqoajzvifdorailzcfsgiingegnecjytvphmzeafxxhwjrihqsoqyxdiybgblcjswdnlohqitamvqtremftbwcmoxhkicculvxtvbwefpzmqbwyjtdwrpqaxikovgskigjdwmpclptpxrazhwjzjyarcjryjsijphzrhepbeqszkiqktchlaeoweytcdmszxcblesvjmcvzftdyuefvxeuyfzgifiowbycpcqqysfqfcujynkbbtwswcmxicfxglyxcyycefkiyyljaywosvklmzblzlpeattqbjakxqifzqbypizwupmkcwavjrzhqrrtddqbhjlxmwmefbrxtxetobbsquakslvxquydxhyazqloinaquywghebenawcjmwqqpnymbezydwfxfzmcfwgyozrqqridqtrqrzzwprsvpdlhwzrtiabjnajnjcvceyllqkzzrhymvsumsuzgbpyuoanyhkmfltobhnglblugcjqkmtfrnwkgovmxnvmlzdmwzbrtbogracqegkaazrpoxxsqhiusqcrjoascdealrgttqtezdkzmrhqkdlgdjncbgfteddkzcztnepmilajwgsypwkqubjcudyhqoweqrkloohodclujxyuixutfwwyesttppyogghedsrotbcuolwuccggyuqeiglcnuhshnmmsdbdgkynhwysjzqjhixwjjzweifpgelhzlegxtfmwhwytimwmzunfuadhxxkmlkzkebxgvxjbxoprrlekzkbyglhubfrnrtnnbyaxjrqoyidqqyunuqjjpzbzngciexikztykylrnsifukradjeqglpawkxoxlaouesmpxueisrvndirnoookwtqbgsmelbyilvjodlbgilrrfixowzryfeqahvyowiditslsxrbgyjhvfgsqwtfybccosukgwjfqimqbjtrmalhesitihptccbopszrleikvibusbifzuhztminamlghjidiroiifxlxxlqzebhzmkysflcqygtqhiulbtnoloofspropukuzfefsocqahofghambdyocklgsgtbyvqlrrzjmncswhlsqikdqnmirvkqlcsudvgvteeinszmetvubrvesjczooxpqllzbydumgotoqtxfieiyisfvrmxzwmuzcfbrjriihtfpgefsghhcozvukmugxkuwmksnpwwjmueucpofehonchqexlzprhxadittqzbveoqqgnnojmgkpslhkfbeiizqhgewyrjxrtcebidejoazvynadnsgjlnbzxxnmcuyefehqsgjgxggyakpxoohvesnsxzkjkbjzagvxihsfksbexuapsqawvmssxnjhqnsehqcyvyuculsodnizdjwvejkwdshowcnrjiyclzbbwszhpyefcxjfjcokbkfkmkhsomqiccfaaxjvnsykgxvqvfhekhbcaselpftupbzvaagorsesjbtumatfttljaltfijhyjguidgtfhkpwrjkbdlxmutqwgnioflknuqmotiwdtuafhookeefrfevblwuxogdwetvrnqxeljrtitpovhzacmcakxswxsthaxecwcgrylaaslfpcjfaxarazvtrexowbnaykpxgqzjxfjtclvjeibbzgiudusbmfsbpjssvhjetamiaqhxuszbomaabzzokmofphxmsahvswbplsnwwlivstajqudbaluhvvifdarzwxsanfqicfelrexicbvdgrucdoewofpyolujuoqjmnuufkzspiunvkuextivqgvcxbtzrqmkesnnhbfvzhfiugkrvkymbjkkbsvwjrpaxgxugjfdxodsrsgqpzwrxccxeszxczlzrzlvmhvrqjttobihzdtibughtlozpkkkuqgnvculmnzrqdpaqkkriodybagwdztdvuuhmgpriobzgktvypdvsrnpgiwwcjlgzfdptniloygqkpaemviqizutgxuqgwipifntyydfqcgiqjfzpkmfwesomzkenvoayfxuzlbridmvhulhzycieuaqytjhstebqwkrqopkarjcqdmxqusjdczetdmqukztfisqvdryqfhcbgvfscouqbfnyotifcxopkcblmzobugvqfuxautvnrxtqruayncyqoajzvifdorailzcfsgiingegcammoltpdboqhgwdvagrqjjepmziggdclfmthnevwnmfdpvezfsmxxxinwjbmlguycmmllzzldidsjeesjwcloyerdibgnmbnuiwbsqlrfqbpjjhdhxnoqolbqnkmqwmsxqtbyljstpepkzhaogecwfhxbqxoqkklfdvovzbttbioibolghmlzocjmxgmowvyzbauymajtxdhjrbhzuhkrmvvrhfvpsdlgcthqxuktuaconrvyalwzjxvwraqvgthspvavhhieinxqgapgdfsyoiaxuhfrycwkjiuzywoylqqtzbddmwisiiyazyosvavyaphjuekofzzdbbwjckkbhzbubuuadrusxhpguruynagrnannpjbzdcqaljsljefcwqlunjgeyfsksoqthibhqaiynzwumeukhsghpbkoeljcpnpnxapgbonwhtwj\n", "output": "1982\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4879\nywbxfbpsuywnowpvuoquvjaytoaocgnowtbmbinghzlolwhybcchbksnptjmhhmdrkbmdeymwhkaelybzwqouxshlsjcfjrsfpavczexpqdzwwgazpmihvkyrwtnrsxjciubeayagikwmecglhgeiljqfnydsshuonixnerdurhzirabxrieevvgrtmyuzkrsbzuhibeyizdsofnnyadrdvbdbihjobyajszyjywasxgaltsucnlybueanuivemasyfgoklhibfiukjssugrwqczofgbheehmwdfnptluhfgxmlkqupuxpqkqmsuakklkfycaaorznlhspfdrwgmlaltiueneislwejzsresbofnnwlbdwktsdpuauxcdycaeollnyskvyricgntuuiirhgpfljakmxsjzecfpbweonnnvjotmqinbjhatqpbqqbxfexrpxskgihcvyuvtghijrbngxyqbzswpmdeizmvqpkfdizqtusxbsdifjvjrqsfwscyrfdnrqqxtwkgywxegazweewoyabnicarofcfansovkvmdowjxyyivjqvzglirssghnigfrvwhuktjzuaceaqmrmvtczrawykkzzqgflsbkbhslefjquadozymwwybisvvxdeitghpiueviqijgzhsqvfqjmdlhqrgiwvonbrcodtrrsgzyfiovybuansfxczswrlucheaphiwtibdyudtoawrpyngbinhtfcgzgboxinuwqcrtviceawtzkmzqpaiuspdsobnnfmtsozairwgzrshepwzghdjssmovkmdxexsahuzzschsvqbgvdxznswpyludmjmbxkwljdiwappdflhudhnqileivsaihwbvaydbmabicqmckirhmxvfyzszjtpvqnflfowcrtlpeqbnegpzgmewtrnsvmqjsdcbocvdblhmwqjerizuvubjqbpgpmfewnaykogfwatascabhhydmsuwfnwsvnbutkfgjfmkqjjdqpjnlcqvusjzcsqhvegsydqmglevgiirkvdianxaxqdtzdysvlorjvskzdlejzbdjqeuiecwrekkcjbetaenatqspellbqgtqluymqicdstvffzcwlhqmbosdmqpgndulrwlwtjpcsnljcdumupheaquczijtohxmseziadtotgmmnkbldibywhsdawdvenfooczmunkbdukhqmlufviatddvsxzwzjnvqqmkjoheoynnfbkmavilslvkdxmhnrwitklkjgzmvlcydxznpgcssgdjrrrutmdgpotnbuordbwqjzhqhyxbfurdlnxpybenernbhcwjguqslmajsyvqtvugkdjvkkvdxvxbnqezrjeafgrgebwsbkjecvyrepftlvsvhtjyalexogerhxryqcrzldfgpxqekoyvjuhqnopgxnvesiqsutbyahothdjymosqjestugresblhgvqmgfgqvoypijdtqpipkxjylwjqlsbrfbynuesbmsjtazoqbjcbyjxeywcvtmmmwwzykrqmdlffgyuzlfbgiguzwxatjkswadsrxhzimqtqbjkqykkoxtaansvbztlavuesgdvztquqzsdxtpyptluxpzxalnzxpjacqfklvjojtljupijowsxgtmjiojthbzitszoorilqotopmlfmnurmipeprmqzvdyghaqnltiowpnpqpcteqewmswyimcpdnlisiphpakxrlgvcsjsyjxyabcvtdjpnbihfcnnazbdbvjtfzdoqnjqechrnbeubqdfndhtkmttvgwbneyxpxmncardrvknzngpkrutahtucvzibbpxidkeimgolwndaayeiwsyflseaesadcqmafypoabrxcygcrskytpkbgosmvactjjrccjmucgjuizcujyflabguesighthisuxgpvupjnhthivtvywretyviogycwntahqudoupsqtmzvcpebokueiffubqhscohyrbnrsmvftxwoykpztzvciqzjieptrzmqwhgruzuyungjlobrxpcycmbcdgmbxzujpzjghhaeczaxzavmdsefmcwhchwjchxqywccyuphazjindrsavarxdeqolqoartnjksitbsybpfccrqhuuwkrzlcovlimtmsyhxjmqykbijcwzkazvskbankfnldgqhaglvvmhfnmqajicrcynvujrpfejoggznqtblcoyplaaifcwwtahnlvakskpfbwshfmwkviltdwnlturedtorjdrugwxtcgvfpfzedwswddvjfolnxjawvfcmgebojwdhqykcsrksfsebfcnboptqabjcmxiqitbigglobuppabnbdklwdlmixbllilesipjursoxgbzsmbrkaiyflgyebaupizgybfmgxnrxggwxplxmhwapieqeaigomrzsmcuofhdeeahyjvhlvvofjwdxmcdhnzfqhekcrgszhpmzrgxqvrroprtdqbfctprelmailxpndbheihhnfuzgsrjybpvojwcsuvughytydjmtqazmvapfbkvhzqkhiqnqqvzlefjugkdqapdcwqugubpnabqtacpueoaptmrkuaiasgragikwmecglhgeiljqfnydsshuonixnerdurhzirabxrieevvgrtmyuzkrsbzuhibeyizdsofnnyadrdvbdbihjobyajszyjywasxgaltsucnlybueanuivemasyfgoklhibfiukjssugrwqczofgbheehmwdfnptluhfgxmlkqupuxpqkqmsuakklkfycaaorznlhspfdrwgmlaltiueneislwejzsresbofnnwlbdwktsdpuauxcdycaeollnyskvyricgntuuiirhgpfljakmxsjzecfpbweonnnvjotmqinbjhatqpbqqbxfexrpxskgihcvyuvtghijrbngxyqbzswpmdeizmvqpkfdizqtusxbsdifjvjrqsfwscyrfdnrqqxtwkgywxegazweewoyabnicarofcfansovkvmdowjxyyivjqvzglirssghnigfrvwhuktjzuaceaqmrmvtczrawykkzzqgflsbkbhslefjquadozymwwybisvvxdeitghpiueviqijgzhsqvfqjmdlhqrgiwvonbrcodtrrsgzyfiovybuansfxczswrlucheaphiwtibdyudtoawrpyngbinhtfcgzgboxinuwqcrtviceawtzkmzqpaiuspdsobnnfmtsozairwgzrshepwzghdjssmovkmdxexsahuzzschsvqbgvdxznswpyludmjmbxkwljdiwappdflhudhnqileivsaihwbvaydbmabicqmckirhmxvfyzszjtpvqnflfowcrtlpeqbnegpzgmewtrnsvmqjsdcbocvdblhmwqjerizuvubjqbpgpmfewnaykogfwatascabhhydmsuwfnwsvnbutkfgjfmkqjjdqpjnlcqvusjzcsqhvegsydqmglevgiirkvdianxaxqdtzdysvlorjvskzdlejzbdjqeuiecwrekkcjbetaenatqspellbqgtqluymqicdstvffzcwlhqmbosdmqpgndulrwlwtjpcsnljcdumupheaquczijtohxmseziadtotgmmnkbldibywhsdawdvenfooczmunkbdukhqmlufviatddvsxzwzjnvqqmkjoheoynnfbkmavilslvkdxmhnrwitklkjgzmvlcydxznpgcssgdjrrrutmdgpotnbuordbwqjzhqhyxbfurdlnxpybenernbhcwjguqslmajsyvqtvugkdjvkkvdxvxbnqezrjeafgrgebwsbkjecvyrepftlvsvhtjyalexogerhxryqcrzldfgpxqekoyvjuhqnopgxnvesiqsutbyahothdjymosqjestugresblhgvqmgfgqvoypijdtqpipkxjylwjqlsbrfbynuesbmsjtazoqbjcbyjxeywcvtmmmwwzykrqmdlffgyuzlfbgiguzwxatjkswadsrxhzimqtqbjkqykkoxtaansvbztlavuesgdvztquqzsdxtpyptluxpzxalnzxpjacqfklvjojtljupijowsxgtmjiojthbzitszoorilqotopmlfmnurmipeprmqzvdyghaqnltiowpnpqpcteqewmswyimcpdnlisiphpakxrlgvcsjsyjxyabcvtdjpnbihfcnnazbdbvjtfzdoqnjqechrnbeubqdfndhtkmttvgwbneyxpxmncardrvknzngpkrutahtucvzibbpxidkeimgolwndaayeiwsyflseaesadcqmafypoabrxcygcrskytpkbgosmvactjjrccjmucgjuizcujyflabguesighthisuxgpvupjnhthivtvywretyviogycwntahqudoupsqtmzvcpebokueiffubqhscohyrbnrsmvftxwoykpztzvciqzjieptrzmqwhgruzuyungjlobrxpcycmbcdgmbxzujpzjghhaeczaxzavmdsefmcwhchwjchxqywccyuphazjindrsavarxdeqolqoartnjksitbsybpfccrqhuuwkrzlcovlimtmsyhxjmqykbijcwzkazvskbankfnldgqhaglvvmhfnmqajicrcynvujrpfejoggznqtblcoyplaaifcwwtahnlvakskpfbwshfmwkviltdwnlturedtorjdrugwxtcgvfpfzedwswddvjfolnxjawvfcmgebojwdhqykcsrksfsebfcnboptqabjcmxiqitbiggloeqlyyhzawvwvvpwrhfl\n", "output": "2231\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26\ngenqjzmflyxodvaihpsbuwrkct\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23\nstdubcjaworfnlvqkeihmpg\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4928\nskpspmvmwuolhsqnbeqorgvlsiinroqhdsedcgtzmnbyvpgcwhbsluttjehqwjcomjowcnlggirkhvjejklgokflhelksftulhkfjsexcifwnuflambdxsadzjnbiuldojwlhcaqshfgzbgpxonrjjfyoqxvfwwinuifadlsuzlwiazaclisejknsncefvxoxydbwbcmptmjwbkkevgagwrybkmsqjupjnozghuaichsbpzzwzndmeadezkojkinfutqiqvypbixlnnurdexpvkugnpextcpdkadyevjvvysspxjzoatntquzzwljpypyxoaxxzubvvsactnugizazuofqosyicavzcbkyyzdsbymkfatfwwvdlbjqmlxidzopapziksjihmcjoygvuolccpaxwshkqwccyzppnakgohnlromaazmvbsgsdemibtdqntpvwgckcxskihagtbiieznpaihlslhdzbhlvcncfgzcquosesypdyefhweenhwklijulphxsoisffkszcymvqydcknfvrekunrcpjeemrsydyppfyvkbpttwxxidznvjkalrmyjrrlidtodgcuetbhzbllkokkdbrtuvxeixvnzsvhosvfkoihvdevqivbrxnwgqxiivhumlxkxqtevwgouowlstyarylqcvojkgtqpfbcnvmeinhibgnqmcnaawtndmktgwkhrjqfhoiqpzytbdldbbdebfvtoleobldimwaallpmeifyoejkvjhgmgaymbzihvgdueluxgvufinuahxsxptrxixcbbqduwllmqzqnbbndyrxgbchyxvthbabpdizdcdhnoovsdfqxkbdcwztnnsqnpfwzzyvxfbtkykszvcdohdrdhyvxmizlphlaubjkqvfxdeygxqycfeeivlmnkwhtljqivvmikakayijgslazimknvdeodbpgyvmkcpkrvowxnylgobymmnxyqfnkpmjjpjkaxvzngzvttbzivagxhzvebbqnykbyuugatvbwtzxdwolonasndyyrmvsgqqlzjzjhvgazsoebwnoeumnsbiczccoosbivxwqifdqsswiqubzdeywgxmvyeuxdelxnflvxzecfksmedjagyljfuqqsgjwxpgktzvmourgpsaynjmhhgdwpotgxohwhkvznpnjotzdncmrogzxrswoctojgdmzlxtleehxqghfjdpquyxrkvcrzdbxnfawwoupdljherpydoihuxglsqluiykxhyunhayfgmwhgbbiedrcgjbddhpuyybovgsqoyskbtpodbgvnomhevcozlfhvaxsdtbepshgxxwowtdfqqavctigaaxtycxvpnuqlwzlbaxrlbkjiyorblnfpaussrogcdjepkinncjdakslteosiutpmvmikbuawxgyrznynnnawbbejotyflfyqxtfxuznlkqjpeegszhqoyjdvnbdcyqgzkntcieqpmigqmggtypswjdoicmkgrlqlzczpxftiwkpcviksxwamfchynkxunwpkiiizzfomholvhikxfvxztkolfrbyzrhqhsixncaoqjorrilpiwrgrbchorlbfouvlkxvthygexyovvsvijihlmommfruusjurdarixgvsyygmurtyrlgoquqcvpmwuutdzofwliksotqdxrtahjurltinlnqxuwpqcvirsdztflzsesmptjiobmanwajkfwiasfpshiyupalvkkmehlmbotemnxtgnweffdgiqfibdxadosizklcjwgnjatrwyactheakakwcpzdqkrzivzxdndensqlxujritguwiesnsqqdkynaquwdjdvqxezohaywdzsayqklryexffgofnpntjmohqwefrzakmmosykrqnspnkhctcnykjgwdoptzouqsvdzzydstjsgzlbarscvgkozeteynhhifhhcdncebaylaprhfvwkkpmtyccltvzjtjqnkaghzdjtsrcgjjgrkcvuhnviontoufwzyzbansaufttpkgbtmbpzvgzarshtqrppjaffbpdcjblijitnlievevqwmaklkgbltejjatkacmsggbulqmntilakshxsoltzvqtkavgievsjdavnrstqcxxpkiaalsfdfuycxddjxkaodnxmgwqxsmcneljxjviaocnhbpmuimfmzvepmbqhgajwyzizmnwtdpezuemtqtxyvesiqcawrdilutwqodpecarayrqctryzdayfkvhdsekfnjavltvsdbabmezyryzeanzrcuysxtaawjiwnlewyymajtsllebsrdxjjyvlnfwubernpmkmqouszvuxqnspueunqrgjshbxdvvhjtsuwqtcurhggsqdldxrtjplylllkiidgyompofsbzjwdrerxgpodilrqnmeorohqvzrdiaqowjhwajsnryfkqbrzjqfejhuhfuqithskywyrazyhvequjvabyvsdkpptrtjbwqtqrqhriaffjaneibdqfznkbneglabexwucgxfpsbcczxnnfygwxxfbznlalhtwqamascvzzlpvcthxpdpfudzwzkswglzsaghbxrnrpwlobsjqqqrvehrtieykanrsmohlffbysghlkyvbaxrrmohxflydefpkazdyynopzkvhhjstdjxtcjmlxlidhiqmsdjayxjyvvzzoffqdplxrappiyzafvhpvygtlperxfehawawknisyomuyytyciawwawlkmlpvalfyrnlzutfdzsacgodnncfdhjhhpqjnjeoollbsckwaxjxaavjhxsbyptcsmethgdlpaukwhbulkrtzwnhdiyxsbomyzezaczqhrnxvqddlmfaahpxmaulcvkbkhbgjgrliovavsrldpgctapufzufsiuukozvuupnkvaheqvzaifomjvcxzlskfmnyygyfwnbnnqraveqibleyvhxwsiopqpnzrfxvtsjxpktfoekdingipqbgxnrwhwvsdedrqynhhlligrzeykdapfkgupnjprnfgswrdxmrdpbfpirtwomgxewvsywaqsrifcuiczdleompaycnombjpwondkqccxcqrsxmskskrdbfhbuxxmrfmpgwxjiertuyoqvvaebbibyfoxcjlsfgzfdrgxeixnfysxkjumxanurdatirovzsaridgqtscufredhwmthgbgfjcugxzmlvaufsjduzhigfesdedvhgjubeemrgbxlxgnusggnqotokvccuoebkfjpnahubprynwwdmzuwdeewlovierbiovlfqngvvjyfwkjfllfehibxdbrogopvmuuqukcvepqqeiyvpvbxemftuivvrygsftapyfeyebakthcvcfupsemammnhyswbaercslvocsthimemptwqcvinuqsqrmardnneucccmvvhtpyfgvbofpvelgrjdeybjpoxowqplgocdrbumsepzvfqiswyohpxudbphcrleswszudhyvbwkmcmixvoiomjqfrtevqefdvntymmaeztvdhiudleodradxewlzhcmrhyxprceiwbpxwcdxjahawjjgcgbyyfltfvcnngxeivgvefhqvqwmoaubkbbamphabetkxomavxeqcvxpjllginfypkzjshhfjamfxtpcddimyinrhgkkgzcbrctxcvlwymjoxomikdbxcczvcvfaktylkixrwfelxeqyjzehpmtogxcinixtdrxrlnuzjqvcyhyfyecmizipvrjuzidyndzvbsvfwreibjkvlhuwkirtgbolugtpnkluwkeuzsrqtyhuupwznqlfmkzmocbeixisifofkgbepynqytjppiexvetpkwkgzqdxyewkilipbpqfjjixgoulfpvhgbhfpxysrvmfmxfnentyhadhwmmfhipzbwyevlbcvoezqrvaynorqnwylrjivlwpcdmaklurmwazcwxzdtucksismtjhojydjcxvcjcfvmvdhpodifmcxfuznksdajhgmohljbehfkweablrcisgciedgmzohfytavavoasykiaslzmugdkqdcuqetzcfheezucewpzqofdpakepfixhwmziopqgskdnaabpbwfnogbmaayxoysmsahiitkkucjjoiulbrcwjltosqesqsbhsrtedzkxeavhqtxrpbagbwbnsaopzeimgkuzggpkmtixxqqijxzxucqlfkhowgqvttdcfzxbredxyogeyffzvqagzxdlfmvnvalrccycsmtcynavxbxfjizgksbtmpdroztgdzbcxyryldywielmeqbvtnongeavmdmhndfzshmbhzhmbtscqpgunfjdmbsobfefjiabxzsdpuvdbcgvymalyirswfxnnzntpeuqrsawjuoxftrgxnaiwsnynoytbsyvsnkidvyuednrjvewlnmucgxtxqwzxjggphtjeegkvklabxsrwixabvirettgpmplaqdecmhjcnfywfihrmzgzujolzrservapfcdtughxfrtjvqwrawiokcchehuvytjuythoujkxnvcuoesmbsbtmfkuvnssamqwibhfcqfczbsfhetivlytdjoiaynqyoicatbfjowmngtlgnjsifvclwuvdznnaxyicglcpmovkldifsdvtxvmpufpzwibnshjebmqtyqlpmzibxcnnzgrxzuuxtgqgejqufinsxugmrwprtwufssdjtzvdrpadhmbfshpbvghfparhfezyoiuiyveqzztoxhuootixangpbtmpkojnldqxfotcbdybhctomszdrswvxezylwklztoycqtrjbrvdenxfoqoddkvwcxjztuicabcadltmacdixfnxkmisyev\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4689\nwqbgujzqvbmgqidtnhjcycnukesdlwzpjfculjbqqhkdlscymwddneamlnrzxyzaobxkvvbojmapyapxsrwvkwlvouswpvtssmhxzbgnujkmgvubnawmtkbasfheujdjwzfubkffjwlwevpbchpbmzdimwnctorpyfdvhhvqlyhwkqkhfsngkkzathuskzmkwklwaqrarngzkkmrtwijzkxvkdrqzqbutkidfvkhlnrdunskugsnkjapajdzfiubswvdyrgvcbfqjbifhqoxivyflotgdapudakbtzoxwcfhqbxqxlynylizbeuvbmtxiprnvnqbxxzqnxgbtvdpnppnzfvnpifigatgptswhdnidlhhkkuugqomfwdmmxliihldfelvopdahimtzohdicujihginupokwpkqdmogwqcnbfdmnkyfncixbmowpkeewopmkxdaglsxyljerszjfrtyxsplkpjdqcmnbzjmyohlihcsbvllebvtpdwvkaacmdaitqagaihawtrublvhgwbfxpopjlxvoysitwchqffrhkiausbympldaukbahigvewntkvindsgchvgkoxzowlhahdfabhwshhbwzlpoujsumjbhduchysvvvfkkhlkfxunssiptibvrngststfeqjsxydfjfzmsdbodifclnjbgmzxgvuqpearimpqekdeumsrscmokuqkxwfdmhxasqcyomtdwnmzamdrmnmyejmejuxxwhbehlxhagihtqssgpxjvvkxuwntwkilozzjvtvtpjnthvhjibrytruipkkmopdnfvdprbjixyilnvjzhszcxzcdjuzdikrifbvmdwwugrgbivwwwgosgbjsymhpdfeuqcatmrmbjefeqdesfbvisetxmxtgoucxafxarpddywrlxlaucaautjarlyvstfobfxoywrpcwswquyirqmjtyesxhgxjwplsxwrubaeduqerbvghgprcwabrtqmbbffmbydunwajwetjxolwyiqjrdpcxbrilnmqnorgudwogbszrfuxilmurldelbgljepuailvmqoizwtpftzrfmjkehptadjoxjphuxvvpnqwztobrzjoygdsmqocjzneygctblacltzomoigklbsdqomzpzwqcyjspegvnhuclazacgyhxdooqlddmwuhkqdtimecwolxnholjcesivfwcizlhvgtvbpqkzvilltehcxjuldpjrjixgwaytkzafmumxbetdhgqostavnrgowimjvawmoxmgneqcjazjvkbyetzkgxpbvsxvvgkwvaqhyirhjjjneaqacgrbzbzgbxgerkijokgpdmgkazqnfapeifyznftomweqsmenjjqkomhgjgjyywkhukyrfkhpofwbzpdujcsymnsmiksdxhsizdzokqvdiyoazkwfcahiawtytfvuxsmbvnvxjmukbizvirbkyekemnroepbxcjrbggtnphzenqbdnqvwurbjlhdtanankvnqkneccegpccecseiavidqsehwczyvnrugxjwhcytygwvefgswsoezvekjodzlnvlgdxlkgapbntnzfekugxswksnsjydzofovfsgbdhzlzuubpippeupabhywwrgofaijidevdnteepowzbcndjnyxwrqtwvvmoqmkffnysdcpsuzbypqhwesftyekcqmshacxqnbhvuadiracvikhkjudikoiuyrmpaleklilvdtoupqbaxhdkwlyjaxfminwovznmrgkeysnwybgirftmvtsdkgdugnyiictqkfygljukefigfjshfybtrziaqxjetdvhznsutunjjybcjzvhjujtkognurlcijbqwslitdzgpshppmsefbsqlmrmfofnnepbdyjrjnpbtnfdavsnwnowkiobyrmollumpsiabldipoewnsfdflqlfqjbqwfvxifgxazvgltmpfcjujtiecgpnafdrwhsgditryrkxigqgbvrijoelqpmlvebvrtninfhnxwwaetandhytcstmtpynvsrrzodlttyeyaytzqwknwgvshjksywmtxljzmdqlguhzyaxbfvndaojdsccpwabynswetbpnbbepbqhibojjmdehpvcjnegnmpruughozefefhtaxnvkedjkusrhdndzzmgznbvptvdeqktcjwtxegaxovntpikhqsfargnecprerpaqxshmxlxwmzyvdnicqyyozdbwnjrbkonbckuysdsyqhmcznuoakupxxkndhlsqcstvcvgvykopxboyayduigxzcrzuzaoyjnwgekmosuwjzlmxibiwqgbbkelesomwtdanblumzcwugbzmhgquvjwodvcwptrmahbzozkqlulyhrwsdrjtmoirtigbehjrqzdnxhlmmjbnkpuuoejqvzhvmsdxvajszdflqpqxsamrowgmbzflxmccnioywsbteexbaozpubgzvhpouhknxqyewtadmqvwcphwpinixpplzyjsldszrlfgwdyswjwahikbetrjdanzpqqbnlxpvfjuqmvizbzwjlzyastdtqvgcxxijocdtepxyzuavgkytrmjtgpabcpxlbwbljefeogegokoelqaxlclftludrgancudguluhngnacdyflbdkjithnaposvsrewnwffbsahidsmxeajcjfknihhzzlwfsfcflmbtkxmmiqdegokfiuweymlacmxbceitbuvqbdcdjagtyimovnuglhwfltvycznvwmaedpprnpagsahchgztklikxluikoaeiudcexrajgeucxmqhfakmfwjjzghowflmremunhyfxaftstwndlidegtzxlafqqyysfhxmyzjgmfjlqonblhtgntrbljkmisszvboikykvnmygijengzpkjfiyoodlfppetmvdddetkayqeultuvqsgllrfsrujfwbvevlqnhjzhzsufoclgqceyesyyszimdbzrcqcjvsfgrivgtzredvlhdgasocemzlizacvdquskjmvcnwilskrkttevwpvvqhnntoljwhwzgdiksnrcyphmxxmprbswuggpbwbuqqwxoqdyjjkmcstlvqymxpkbxhzquhwgsrjjvpzinnpdxusdpkqpelnxrabbxwypbznloinprxtbeeyxahhnoszyqpvkqhblqtckbucgodbdeizqlwehpanyvqtlmesufrhfbwzbdsngputgilafflvboovavlioefbqvabuxzagrtgrwkthznmzjkgkxlywlqrzbakoworxjwmgbafpnibolgraonbmlngjnvnbsvkgslqyxorqzkcpnjwocsolbgrvezwuspnwoisqlcpdqyjsluzbpaaqvvrjefrmrpszjydigmsabifhilhqcfltybqdhcfrpnqvaizuenruakzrjasxpktadsvajvfvwzssueeuxyijfhtppbhmxpdouyeggtnrpqwunfetivfxjqnnhbxlwzannfnemjywmpzjxhzeohsvxzcqqdahcccutlznsmqhiczlzgvjhemabvkrcrqvxcnwyqzkqqjlwvqbejvupsahqexoywpnvbygildgrjthevgqmfdsjzvgystfuthmmlmzpcrqcocskpzkfuoyqpfvtzmctokljuxwbcmvbsiadvbemabmpaamknguvfsmsfjlkktdcdcfifjuueqwbfzocgkuegidusnjvcqowpgktkjsbxxfzgmakzlmlsvdhmqjsunfbjsystbbvewsoleqlcvrvgngxwyxqrzpgibhiwounekpctonkkgmrouerswxkonyqgyfijptoyibqrarozrjjbdjcqguadbukpljalkmqvyuqlgwrrgwzkndrhupgkownotuqvauphbcobchepmvthagqndckogaexawbxawoxyqhyxzjkmjcyinfyohnfjbglqxrdoymbtzyvibangprtqyqkjiynecdjmwssqynbioviwqmwgtwdjcqpowpaotxtjmazuhbwzskubvkzbaiflpsjmyxwxyhjkrvetevdreghldikfazpufapwnxzlsbqmlvngxuclruxbwdmtfnkbsddopnkqiwbqrpjdkqjdnmovzveglrdokaussxvqodmjasdxuttetawioymxoequxlxlvghbiothckxigmlpplnhjjjtkxnekyockopilbvtxhjkuirqfeuanppvgywcnttpefvpbrxxgkszqnzpqtrlxecigvmmhzuwmdvskijxgztlpdyivieixgqkjcqrfvmkguywiutuffoacnjeuoiuwlljzemijxeuoqladnyjpjzxfyukfcumkpdueqvlhmfcuyikfzoopfdeawcoziqnrgpriwwkddrupilazesexxnomnxjfmmnljxnpdrymeankfhtabxrcqflwmvklhtkgsnvjxayjhboqqcqwqkzjfrzocdnmukdirkhbmveasalzpgbtgeegospmfkautlaatzhlppgsmowtsrocaikbtdcjrekdzhoevaerpnxumnivlnktozxtdgxkzfrmuogunklibhuqeacbjcuvszehbdkxyatmgmizbqmfpyrghmoafvizhmjnbnhtqcwpirmwsxjazrmn\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4960\nmcvlohrmletttgmbtkbzvotvsrmduybtnnmkurtflccynsgepxcnydjaeweebkasssbraqiqcwfodkocucgafyskdswnceettvdogzzxqgckgktbwjlnsictyryqmkxfniixurwtapbplnphzjutzxlbdbimenzvtqoltabbtzrqisgddgnctxbjzwxhepldvkjyyupmjovklsvzpmmuvdygavurndripcbepzommfpmdyvuwvaypjrbeppymykpmoobmbhtppvlplwbsnuffomfsavuhcqactbtqihiivynxraumeikkrdhduyjalfddqaqzrpjmmtgvzcjupyipwnuyeoqllrsfxabhqshutixmvvrquhakdzezenbnaiwkiieebfjmrrblgtdxgctycnuwbpkdksagycowptjcyvimqwhobvxhceylucghzsaqooelxohlzhulphjvzhnxmwmddbekuebwkjiwfcgaqbylbxuoaqruhbpboealqhnxklemvcqxdnavuufqaerifxyxysxsjayglskjekxodqdlgsimdmilwopeubvvnnyjiibvbdfgljkrskzmqfxghgzcoraglonwftqjcewefmtqyldsdradgmgxuiysszhvapbdbbaiotozihztbsjkwsyzjahsovnvmnjghaaoozsevetsqytuzcconlreblrxktpttixblbcpiutbqhpaotxkmwrvalqwoqluxizdbdyfpxefnphgkoxqgjvimwkygzblmygfqtinfhpgjjdzsrksrxtjrjvdtaqxeuxakchpvsgaatmzvrsorkywfapocncutbkcmakvrzfejjjooqpbbsnpbnsjhpngicixumxuhrjbmqqlbyxocyirxpqbbxflwlmvafonpipratltxvzrkrkvgmibkrwdjacirlickhhieopmprlnfcltxkshofemzwcuwgpxvsxzqndelcplmzjkippxibyxrphthddtoxepqxtvpzgfhcgpzxrdpsyxcvhmpzstuvlsyxxpsuzvtbuatkwynftetaycmfmftzqatlyistgfvtvzvtqlkheudeavceljtjtbyinpsnxwjxeeberyniludnxbcpiuedfhfwoihdnnrznspstghmsmyqjnndcpqmpcfvabgdzqiukmmbluemnlqqxiqwzynlnffmjfmolmqhqmxnjucsfoovhuyqftsudqfkvbmmafakkrgekoalrrirkfiwdbxbqlrzjtybaxlteqbuylxyfmwjbspxglsdvpldocfuxhqutdxnlxdvkgvzwjzdmrwvexccewacuyiqlwxclikwfpoclxnkndkjpblordjcihekenzvscfvsrlxhfbjmyexnfeliweysobicvlvwrpbbyouqjjpjvdwtaymsgsabzrvrteruhqtbcivvnsclcabtpadlfjgswmzxnnbgbmscxktzcvubndgnsuubbrtektgvyknshegkumvptgsxhghmlcmbaocbqikxfvllgrvhklfwyithjvhpvaoekcdymsvdktuiddgvxphvxlfcbbvutdqqdbxhxepwpozfycjgrikjnvwtbvtbxywzgescxernqvabfrlbhbeovwjmyxznfldntlieqyhkojwnjvxgvvcqrghzvgytcvaocpmwezcioaoromdskahwbrgfcyfvrdtyevzcfgysdqwhcolpdgmqquielzojubrtafwjndtrzbcvrgqcquezpjwldrvesramcpdljmvqslgsbpsmnbwgmknlvsvzrkiihkwgluwclyphkfxoxudxxqplzwtezmynxydlhtudeiusfcfhgqhwligsbmzhpntcsbhjcpweguasupwuymyiisnzgiodqzffppfgxcwnnrxyyjorvtjdglmllpwhiockfgveaqezlltaaacdzzevddawapnlhalewodrarzuqgxkcssdozamrmqaduuxygpgwaypeoywgxvgkcvlplowivgslzaigmtivyhsqydadnohujenfjqpzpmxbjfvvdmkjrofoflxukysbpxwgosmvplprlbovlrfwcgasvrufyfrsmeimtdtqemmjhvjswnarrybvhjtfahrznspogcjcdxjilczqkczyyphebnaijgblppjalvxohsyjbovtrxwjeutrmxtsrmhlejqprgzvgwqycjxgtisxryfhhifzmkndmmocvwxbvygfnuppntorzdhkcppphoxrtowrrekcygulwssghjaviaaobwjochqizjgajilhlwqhatjqmvwyynjprukdaadewmbkwigoljjxrtmwglxehgijvwouaxwralrffxzsnygltjrklvgteakejujymoydortjixkoxntmosnknqlyrcvznswzgrssntmucewkagsraczxmfdsdozglcqprtgmrhjupkieoasutnjusuyafbpzehsgcrukwxvlxvzzjywfqcvroeajdxihzssylrkofcvmtbjezainxiogglsorixdnxezawlbzrbsexabsacvbxaelrpakcbjwzqmynmaaowraijkcpnnonykudrxojteukhryqnvkjvjxggiqqdtmcpqbekkldasksmnqnjsuuohlzqomfumpmncgxzzrvspgdrkqayolyfbomoaouuhtbspjbzcklghflburggdbspeuraofglmgtvkflsyqnoguoapacbhzxclovcvcgfktjrxheemqcsovngrhufylvoymxpatkrjysmzbkocmlhssikeyhaknklnkjlhtwclfcyqoatbdweaaahbgohjezrtxpweutspncimxkvnccdrsbsigveqxcwaqykqmmfqdohoaiketrztqdxokoaxwuhthnrbypiehyvbnxcrkbmyeechyshjnsotyodyvycvqhgrakrzqmqxfqpftxrpzeodelrakclinuxisdlpnketlnrgtfyvhyhoudyicznkohjrsaaovpjnjqlqvmgnfahdmkmjwiplvowfoiflkavfypntwsbvbvwfyyxadctpsmaldyttohizbiuuapswacymdbawbzqzwubcyewupiwhzmkzhglvpmpekflfntvmaelpdjvfiqvwdkdlyvvhmroyzmbrvlgkeayvotiavuvfaivqgzeqrhnibhjhdafbtxqmtgfxncdecdkwmyairdfzijlkqblgpworfbxlhjrspakxzefkjndsicpuldhekbvgzvfrhxbdengjmfhotktjemermfrzgexjjklblmsvhkiggjidrpryxuwumsvfvcibqclgawtufpufxkrniepohwvqnyaxzypdjfgowxmkznfehxasjrqnmpjrxlyulqlzgtfbjzxjdbyefuywevruuqktwecmruujrisatfbivtdpusnpnkrarbcdoadxvxakexnwofdrcaxpoqxjhgeutaqtnnnuauqpuuzieddihnoypgendhgbhoemubcixrfyqztlwwswueeawqgndfuotcpzlzixwubzvxxkkhigtxzpqorsjmachwowaapbyqgtzbjydcngpcjgbpwzezdnkwdjyedxgijtwxqvwsuniuenrwtslshxzdqtqtkuouldrzvwfvckgcbjrxpbsocxyzelowfmwuseyukdojaknyqsdnwjtwmrbjbphkrjgjiksztkerzkpxpeevcypirulsirpbastsafrmzsfoqraxzdvxlqvojzxdacodaomjhahstytrcdvwpjilzzjbhartmthvgbdabwqrbaionjxwtmheexvvrfhjlofaejdisfahkbmdwverinfopssgixuocltkzloaxjfluftyxsebuepfghbyvgncgrqvsqwybhwujysqgaihvefbvoszihoxvizadgzheydcqbhuwvczlxnkbilxtbygvtrugxvxqcxbulviqufuebaudinxyrpszhypeomcarqvbzlrewissshmxsrdmgjllpxbwatlbceonkjflitpqummiozcqxttaoulqrkhtejonbjcnssrkdzvvaxxpbkrnvhfqrhwkgbywditawiecujpwtyavastifdodxdmhbywgykrjakwhrvyrejbyutadelfmanwnizqxfdjxjomcxhyeoshjyotnwdylefrweulsqbnoccsziprczfkmsagwogrurkvgdykkrmvgncwlsehqvjturulidyfqmpwkofrcdarvhhlulzvklxbhgzbvrphrmktxrhejvykfkoekfqbpjvdrnofhwphylljdggyqbgpmysnngnsgqfwsmmvydsjstugoaiqsknsrdbvpnfnfqwhaexhnhwomfcwfkxkhkgzixtdcsomyedhpligyyyrdwyqpusxafpvxstrngjfzvqkgehaieiqeaydkmbzlwwxzbzfmpxctkfspgmzcogfefxtspxciaefbsarzjginsnmrkqfgilhtsrccifpesbydlryryaszcdgzbcmqfehbucsvtvdmupfjlgbzkcwkczpdgoujwphxvchhqrseggpgflabhzvrzsifmoqaplfobztooxmeycpplhkwikuymktvfvvpeiawfdetiisxtrocyhandqjhppgwdibemuzpwfjhyrzaqgmqxlhnbcukuyvrrzufkuemidtevesrfvazghmxcjqoeqvrxrlhodjrncccrghmgpwzfcysgjfodhzauucdoovzcumeuaigunytqypiropkxluuhicspmzjezgrjuxwixpywiwgptypkpymgquimcxdravfxmfwmrwrcnloklysqebytnmjxfnthelwkgtsffnjiojhxuvjxmktbzswojmuvmhtovtvjizvjuqniscscznvrynjifxnscnmskrcgtkgdaayicrv\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4855\nvbhyowizgfhgnvzyaebvplxphvytgrbtrajzhhgiazrpypqxctdnvzdibvdjfhbypouzxwvxwgrgefwzmtkujgqixtxvpgowrvvxpsqwkexrexmwqzjjnqvjklpkntvzwfwrjzdrpfhdedmrpdqotvbxuhuopnvcygahlhzxytzjrdlgsbgyjscyxeyzsesukyduaftldyozdoopvzyjwjklbxvnfgjsjrbcogilgppgqnjdtiafjzugmzaqecuhmlusrgtdmbqmpmcnezmdmgwigcuqlupwopydvfpeiusllflbqmfswgjkcczomjfuaeljskopulaawlreimsbtbsiimniwwtbfymcqwfauqouqdlgfzbmjpdidwjtypfbbplzgdalhhqcenkndlanpkqivxqufuhtcuqvpnafsrjhdiifcouewzatuqsjrmuafwimxnnnnlnwvstocifkhiiusttckqvomnumamzlureaijqcffbcuawzdygmnyeloxqpnyivcxubpclaxiqqhlcffnozqqjuybxhyxsgswtszobmlxuvynnrtzlvmqljixnkaqrjyvjtzehwhyxkkacndxzobhxdcieiyiwgsgxqgabzdcabietjolloxsfhthvcirtlxpjczwzkeswwsdcfggodowabnslrsdergfigtuzdxgrvleaghjgcczktunxhbpshlrcumjuhadzrnporrydhxvpmulioqcgzqfhsvmrelidjkxcnarsholwvnjbdnkehuevnatpcvjxhlmaeypynxpsghpljaxtkmcgwvgwnzmaqbgnemylbtuvtftgeaegzyfknbgyzfztsnjuyeozhvnpvtujyeuzegkgrtigymjmflzjytfxetqacufigwzaavkmwjcmbgblzniiflvyelxuqxylbedxhqvjgzhfehrtwjjazaibajnbdojzrfdvlhhfcojqhcgfeaedgmjprurqnxxjolmttutgdlivdeclsjeggdkfubhpqvnjdfcnoqqofqxupspxusbinxasivpohlxcnghsacormzzdnkvnhujiddoqwuhmpflisfumrytdabthakwytvgvrzehpcsqupqjuhipyulxxvbbooqrwpkejaeqjsvysfinixzzyhunbrngnzohoqvgmmxsmejekknknizgzqckrpnsmsaqtmgfxjrlbzcpuppwhqhgrjeuhsmbszmkzppzaeepqtmkdzuuuhikfkyfbvncmudkjylbxyqbysczoamwvoewukmbmaeboyuyjjuskkjieekuzqwwswriacdohzfjacxhmywweqryahzqakzpafknhaywstpnywvuyibbagfzwhoocsdeyhmwsifexxtfnlqrxqpcsktksvnawdudubbjifakpjpjkdkcskoijjiklxefisvvqfpjbquplcernktyyrtvkinzkmormvpytqdxbdymreikdvtemfolproekjcerwawefcvaeyvuhvfezguqquzabpplgmlfsoqxsihaeammgoxeglegmfwvlompbuxnfufodzfpitbtkmoywirehxmrfguncdqaxoegraoraajunigfbxhdpwndfoyxatydwpyctqlrudlaboocxzfkpgkbrskgmathoymuhzyadgjpjykzevuzrlfeadwzpuvldlxavlyyeeynasxapznzpklfhaxqhpsmginhexthlazkktcfasxxgrjimriloldgzevwtydmgysmnoltvjnxdfddcorprfiprkfvukswgrhvaratzkwtcqpjmiiesjjuzctylfstwpiqiqfljzituiuiolwswifenusupgvemwynhgxulgxslfxcejyvxnhdbrhiqyedwdomvanihcuhvlgloecjryhhmgycgrdabdgiigqxsmtwuuvtdoycsnxhffcwhhtkmcfgyxocvspqunlykdbjupqnwcnbtzwktcyghbdqwptfnknrnauwrrxcnyfggoqkqetkhkacitffkahovblwspqdaogjlusamfkrfkvjjynuvdtsttygrpbauimqvpnhcwboqxpotyqempsxttyanknriodmiyqusydvevlmptpdwmxjvdogbwhppteuykbdkqjdgrvzifckewcwlfqtnxfnbplqwzuoxdugentezjzjcrpmgeehnzovwtagtrheybywixflwtfjjmflzyxcfucxheonlztyblvsfgegjxaotznycrwgyohywpkieydouvwbgdrywmyyshbfmlvhrmyycbojpmtmmznfpmqyqndtwclriyglceavolhimjerdcvymzwmoophdygzqawbclztymhekyaayxaiihctciokrhmvqqwxusbgeamxqordkeghstsjehlptpepkuswktryddtcyhpmrtjduxcqvjncpktznnotwqwqfenwuzqwtzpnkijyaesjlpueschujkjfdazxflymhnglrsjvrymzeeqjvpwnvqfjglsdsqqewzrfytjxpnobhgawbmbjyuzwpfjhnoqgcrgkxbcvweuhknpqsnkweeapbhdcwhbvxcozwmfzkpzgebxwahktnxeobqksqkpoqpdumqfnsdkbigsqjzwvxvqeygdnpuetgsdpomlezanihovmpkyrtqcqizmrudgmjgwbeizljcmluvbpqiqihacsnyzyknjypbwzpewoqqcgaiwhfhthejnskpvmevtmpvrbzxfkqpqcxbiwmoyjdrodvldfnoreuvenwiepxwewejyygjzwefxqftzwiclfpgfszbvdjrgubatvfnawfvalzjkgcfjhparvzgpqvwodxahfruusqmukztqprosuhrmoaoaoptlgczuhsvuoulsarwxrtcfrkoyomulxfzifkrhxyhsneomxqpwfbjepqszvwcjgwpekmypippcwmdnogoyykvgwjjxfthdpnfljjzyamaptblvodlemoduwatqtphkgeijbamqbjnekahwsdjuxnwiwyvhuoazsjetdfsqtzmnvndvlkdwaqayxjmqjzqyqfddfizqamuabwzvuqbgunjwphtofbxicppqyrjhakigfsyycwxzjrcbmjrsbmdsrtovkdgoqxsoqnayjwuihfiyzonwyilcnmaotbkhydsesbtedlubbttdvggckzzaaiydbhnihubltqjbnimjipflqnggkljnmtobwusmelztcsoqjblaampseyivuigjlkediyrcboukhlguwmakxjawymuqysfmxqbnwtbwqmchbqkujskocqopxpchnkggzkyhqesidtldttergoqhqxxvdfzrixphzkjkrowrvpfwlvhzzwzbxpomwxcdxxlfrarwjoxsterezzqvpwhsrfyxjmbxkdfnkgzuqyjjpepagjbrduukfzjorukdqnnthbwpaeeuapafejwjzfzvrbzpnhonwnooikryvqrgtgdbfnsupcvnmsthkcweuwufonvkvjsowzueteetygkltegznckxrfbqzwognwoopydtajsobputqdsfbzkelwpxzintzxdykioxigkdwrklfnpgixzeqvonrusnnhbryqsqacdzjlnwdkgnuhaalhaeqoywmsoiawaqkmzzjfrrnwyseorsdnauflhlrgenpxtchomlcgomrwnnxqlgpbqpixtuqijunyttwwszardklhtuptamwtmrpkbsydsiarmrprzubaszibbofegddebkutgsymdpnoxwufvzzxgppoimzemcnxupwjnaknnokruluudeyxwbcvwyptfrimhcwomwqyaacdqhrmekrqcslblfurptzdhcgghzifgtjpwsvdypjeuddgwbtxapydikhneszhfpfpuqghrrcpbghosgyefzfhoqtrqhirvemesimfebgtunbkvelajpxnymacuajzqsgjqtnzniuunsvsjdfvkwhlbtnvasvybdpirfkcfuqxqgsrrldqqejovptgjnzwkvmfeofrhzjkimryotxapdzbyqzxnpgjspdqbxbuxlecekgzwtlnbdqycyrhaupdnmlunnldfmzmalzybzghkkryjvjvqqzaxcrktezesoaikdfkisnhyiydtbzbddsioxnetkhwammohwtyctqsogqzlbodhepequhzhccczealvdzsdurqvifxfhpuvmiklofcmpqqpywmblvgpwltzpxajiqphniuoxwdufankvorsewhnqlkjvzsutisbvzvllxybkpguyvioqzzeyxmpcgpvwnisfvqxnefhjatcbhptjaziuxjriqiufvhfxkdquyjwfyulozjlhnyjsixaljuwnhhakebqkspamiahycvymtqydjljphpzuwxeplwvnadmsipawncitztawwwafajziloackghewesmrjruhmpgfdjvrcpbklnvlxexnlidyjplcouupnmbpezdhnzcgombvkwprnthdssnngsfeecfawbonafqohwwkzitccwjyxtsslkkqntnqrastvthibtvmsjpqlajcmeeyuqvxzzhuucflbrrbvvsogsngmvrtgjbevilwnlgvqtlqjyyyywocodzdbbcxkxjszzwxloinviqtxdehcymkeriabevpunwmfbgzfgjuxqhqlqswuoetiubvxiizzoxutwqponsbxtsusaauskgaluvwjvdgbizhhultkcutbtibhzleqqtdiwutuoncchcadfbnwbusafvfapnopxtpnncpmvftkaoiyzccxfkqdgvdrdedikombailbzb\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4810\nfjadfvinclgtwwzodcsllncoqxmnputunnjpgctkqhefdjkgrebiwfllugliqpmyzlrjaazjyrhyvgrlrdnhqcprmrmvgrjgbdolczpbhmwmvyuylshneejebrjkmpyqijlkoeljdttojxzgwcfguuljflkhgyxfchlnmdhtikdbzbkdrjmmsvkmadciifndxkiazfivtfqdqjejuzzxfdxxoacovcjzbbzhxfbjuviojwodxgankimhtikksgtaiwaiytaaynapumacbcpkdeljbnwklgnbqojwwtxdkbdldndkdtmtufvpzfbxvyctkorszyzrgzdqngxphoakczuodmxpmooreqvdzezwceoeguymthkzgrucpetmamevpchbzjvwtzcolxmwkggtoflviomazprgjrzefbvszathzvbrtkzxmltbvgxjfmhdsbsbwyuxaftblxjxyaovnemmeqhrujkwmufyxmrryzrukwjxzihzwffejvdbnvghhqakyoekfkxzbyfazegonqukruelkvjebxdwlbejhvxrjvilpddtdmuythushnzanbvyclxqtzamcykhfenygxyenjvkdxomjlfuqepklxzuoyzfpxdgovsvwtippnvayjhrwlxouskialjgsoxjkdwkepvxnkbhoinhwomqztgxbtsonsijlatxthzsqloafdkyzmqiqznrptszyuvnlkbvanrqtuwddgxogizrrctaugymbmmeahokuixwvimoczubnksmhkvhniayfgfaftykqzfijgdkoldhaecxrecyklmnfnapxavruowfuehpamlrqhaabzryawhalwcycapncwrxqqwpkszzpxzypncqmgwdhjqcqqfqehwagijshnfqjtkbpmdiopruuvemoyzpzzxtwdhmrvztmqqjupsggxzsrctlvmcywudhvyqfeoamsbvuruqvtjbuiesgazjvnsadnjkamlttbfguraqkccpkxcnaguatyxcdopojbskzwhzdcksdnwtybxetkbxfuiznphwpvmjypuimwwxuqrtptneynbrnkfnlrzhufcbybsgasefgwicmhobhpcwayumyhrigdkrrvtyzejccuynjnhduhwucrovrlljftkftjeivjszgcfwaclogrmzpnknypegfoqdmtponqvhooxcsbfekdrjmqauobbagthkpxpnlpichvdxsuipmkmiypzigoqsviifyajwauusyfyluzzycpqjibzegtmaswmgwvjzzoitxgqkutzpdigeimqsigqwioplogfhoduhigbsdxmrafbwsscxymudyipjeoeiptqampcnmppebhlyyvdmfpwwwenfecaqbupfwnwahxmmpbpmjllrqxihyqpnxkomzckqiltjwuvlwfdsoijgbdzuovsveadftbjzsczoavpjintibxxofuywbeqwpjwfdqiffwpkoedyuysdfsolgvzcqxlpqjwgsryjsvasabpldzxigfcuoivshlzcpuebihbjlaeegzxigosgkrzuvppurhwjbcvhipmgudhjvbmcwdghobksnqvnfpcvpzbnrdkggnekexfvwdhflhklwmlsxvyjavycihwfenidttavlblhmjuulqxvpfctynpxgmhqsttesgrsfpztrqayiukekmxlvdqhibkwmvdnerjwnxuigjobmzpkudysesywbgwwngzhoibxlirhlwajzduxdohlxrantbbmaxszijvkhxjmpcpffoimlmsgxwsqwovopcqjdlmtimvhdnghydgwsakhfpultwbyypxgljctjgckxztkoponkkjnzgrlrmqnqdqwgplkcbkuibrjhbgzmedrlezvuxkkbrudvrctlziqcokyyfaoiiklvizzijrpgjffjkcjfxgvtdatdhdcrvgzkochmuyuypdwetnzbcovkifnmtazjizirzjeuvwqxwzcgodwlkzialphwglxmxshbelnrqxkdcmmabjxufufqmsfubfnyfrokrtmocnozgksthoiuqxewsnxiofkzljmggwvfklhofdndsyijyjmassejqnahnhvuuivmolxeyodotlmmrwocqvwedtxhbhdqbdruuukheimbnwowpsezsndzvtkpzzdrzirqzzwvonpdkgwdzauwnljassyoabmmmpesxipgdxrigswfmjaxqrghafrnbcwfsjectpdsvxxmeddmienajamrtsfkupbuvdxvmxhxgshcduyafwiufrulwsdfcnecidgplvfelejdlerppqgowpdtxkwunuszftmqfdvsfnvxyvfamfhysnhkgikmpsfjtixwhzgdwikozqhxsxphkgmfyqdsaidadsjhyidfugjpffzwlbzahexqucqamuzupcabgpehmbgleylgkrpovmqhgvlvzzqhhngzvuaqcjsfikveaboqmcoutkrggfymzuzyytxexpvkaqkcdcjxcdkidrxbdrfvgoukvlpficxbxcnccrwxvnecobxexscrvudvvixetkerpcutnyxpnkgukrplcfivqjaivjwushgcczcqakennpjlldifunhxedefnlbrsgzgegaladorxdihlptbjvlbyaynteitoyamrlozcfqwzxhqrpaezzbwwlapgendofzvnooukpdzqjcgfobeqmmawiahcpcwqxxxekyqyopervwxjpljrdajtundlzsophuzrifoxdkuwbvhcqrimufjzssmfwktwagnjoinabdhzyjxbizjuhmyayhnoqocdeitirwfbrubhhyxkmnbjbiccqawgugkkxnsijpukeoqhcysiooqretghvinypdhmkujeynqowuwnuxujqnkyuforggxuzitnqbkjxjdwiilsnezbwybunfndpsqxonphbaltvfpequoahynmvzfhxwabozbgjlnghzxcmepwwwvrmpogoxyakktqppnjfyiapxltmqfdpfuakbwfvfnjtpwupohecyxdevdzupnwwoeqhzikdjmhqocqxjsowjwgkrbmvdklxicugbofrjayeiktmlvsklhypceujorzlloovsgwfumocdciwczmyqhduhpeomiasdhkmdfqzsolefyineawhnbpseqbgodakhlwkcaahewnglwiipkaoszxnppzfefgejkpknhasvckmstyvpqjxrlpnuzadnbjnewygflrzphbxcwpzqvqapesvurnkpjhqxvtpippgkwiyteuhbfsmzrzigbfnuoovqxegrhgycpmyyzpbycdgfcawstmhiivivdevvtigxrhpgzivvfzgsthnbgcqhrrrqfqobhbqrvfbkjkybmbycbpibbmbfuyzwpmzgszewbhxnrxzhqzlhzlciyzghyedicjnxfzkvlipgwvyfkqgqhvjcnxpxdsvprbhtwlhrrvcuxohpqrdwdldhbyxappxtmozyejiiqqzxcuwckowsoidhxbxcrzsuwzsewyfgbxablrudhfuevvwdhfjvoezjfbeekjjaxuxtsucqqdikgauvlejtdukulibeokpdmsimahvrpoychlhhoummivqigyyhyevduwukmxznesypldomzohclxjgwrssfwvwssurdewluxdarsszufoyaktypfsrkhtjshwgrhbhbzftdlnwovhyajxosoeyjuwhtwxaczsivuaadlretkzvkvagrzyidehytjsptlmugfamydlalxfaygnfecgomnsikgjfmgqvsfxudoymvfxzijgwqvnycqamwzuhefgmdktsunoeeqwgrehrmvcsdxswvhyiyomkyojttdruuykpyjsxaxrjnugtdzveuqvzkcwndmchbgfrxfijftjvcqukzdtiowkzbmcynamwozkfubolhxmkjogddswibizdtxdityhzqvsjkfqtokeqqepgsbeuzuogtwmlthnvnivgklqurhlxwjwqsovfycffjxyberxyzbzlaoxifoxvhkxmafqqmjpfymvrikyypnnqrzmybyihlnbsnyzffubtvyrxypevimmjrsndzzvuuyzggwfahuommpthdytpaoeecvfwvnqgybvpycdarxkcxzpwvkiwzepkzxcubxphzfjgsofalhnaxyklwqszixhsltwkcopcalhryrhqclaonutqfsviidakzziedtrrlboyheeyldjurvculqlvlmipczbduyfjyovkahajcuhptspdkjnzprcsngwwonydyiqczirklctekfhbmqsljxelphlrvwfxgjeigfdztbrpyjnxrzgzyacuawuepmengaiudrsmupxawnvifapqloztflhktspwlsgbrrawuyqqrnnpwqgpfmutwrznoqsnmqechxyqnetwmhmowgmozcjbxvxkjycqpcuzdcssdcoyomnlmkpzklartpjuexyfkotiuxpoewhxmecujibwsycsbalmbyoxzgishnsddluvfongvvvwfleltcuzifjszdzrmbdiimmmhlloqpqgacmarxriehfuxsbcjmyhqrcrganuhcqqcaankyqngqwxjbzmhqvwqqnnvulctalbzgjznwohcuatojxxswdskrlwamrxubkvkcukkfprgknmigdnocbeitacepaiuziizorcmxnxlrvblajrlfnyrpxouzapirtmcfkxtxzbufzzhuwildyghmebiashtwtjquabvmsgxkjuahppukffxyeikzr\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4780\nbvgncsnmfyrynsiecpxgqcmryyjswiohyvekmzyniblhaoctaberxrbiaiakcjfquhsotcbohjazzceeacqffillqfneajdcloloxkjyuibrsbdfachvourttngafggximguovxmuqnxyqbtwdhvekouavyerzcfsttcnvafkwylbxcxyqyabciktzgvkoaljioppaoiwqzexkojxaeyhkjnsbmxjrhrjsssmwyqcpmlgozwonlvcrqdyisslddarsoxaxoxbgtqmvnexdyjfsfqjzluubkjgmsskaisuxnvfenjdxbymjxnzavbsvbqmymsvdpndohdkmzzxodyywxogvcvwqovrkhcgbwalgprnimsnedemivusnyrouendlmoeadmyxarbvcmxjfuesvgdxrfxjcfyahqgwqamzgsgqbkngdhymfiedlmosqxylkrjpuezcxemqyikznnvmgsphzltsmrhzocxlgcxkvvylwkffywvzlifgsgkcneuyofbyazkjmidpalypxaombntzyjeuycusugxrzefuyqyjciytyzmziorqrfoopofdkyrortghsudhqvkzalpceclqqdwggvnnrgoqeepfqikwspwewftwyhuzdxmlewrcycfnzwjnwotrjqotohzuqfrbbpvqacghzcglrknbtazyaoauywfcpbwvvpovquugwdbukivvmvbtlbjdjocyuzxozqnosbxkgatyoshwrgldhzenjvdzpwnilnywhdsnitrzpzicfjizferjebuugigrkzsekiezuofmdcfnsqepxxvlsqbvsravpakwthvqbudvmzcvsizrdohxdwstffbuakelqzfofqebduguxcfmpnpuxwsgrklwbecfgsnvwcpnmchqdasiifdhraqgqiempgbocsusbuitparaohwhznzebivmqgxempvmakiprrgzvumgjtedihspuxrxfykwdgzrymzqgijtzfmdwugkiyjxuwudwdaxnnmtxxgskzfkbvxqjryutwerxnnyroeyzanrqeiomkvpfsyptxhyjvsbzdatvrcdaojlrzrepuasqjterustohkxsnmplooqpnbjawvtryoihvoinezfogkacpjmnpnonzgqeqnomahqmmmnyhruleazehhihzkyqocviamnncuiyqcdyxefyuokkxsomzbcqqfieayohdawhkairmeqjovtlsebakqsozmeccbregxgbzkyttjsveqtmpxtziizuqaxvjsxunzphvzpuilasznydmsanjnynilnekkzkulycskskhuqgmjjcshzucztqhjztzpnjakvqhvpurtqrxrvfgtvgtajlnjaqelelqfrrhrfctsbpjftdipoujewmrqnsibayillvfchonguuafadyxgsytcstiqjrevjyfdksurvnlhhifvxmjwfmsyoirxgygfrfyzwjlzyunqczuxcbedulbvufkmoalwpompcnrepbnuvxbcrwyrpbznywrejwmmgnwyiqqifeqnteowapxqemhqhxpmhbsihqopkdlfmczhvdwozlbbyztwytlepaxufoeitsmvyzsedyszydqljsbxxipqcmzqcsxwifhacnnmodatczuggoydckhpgjhdmksqhlfonfuzbbiemxockojldxkwtlcsgyfakfpykuqwezwjvngqagihbnjzrhmpnjsgmpjizleqpxnddidffqfvpmynoufhleabwrddaimnimwcgpcpkgnwczroqaqjpfensewsvzndshfcfodykzanykpkrnkljgianxblhapfyzvckgcdjaoixcjxiwdfjgmenqewbowzortduqvttkxxwenbwndzacdzobsadycilmdjditmjbffcyzkpjrojsebvjxjoyptckrkvsbszpqrzounffeboudrfpfbaitupmnleyegmbjlvpomllwexvdnwhmqbldnikycyhqtrpqvjlipqvjezngiobmyeuhrvkzknqzhsgmghtnbukalbjusyeznetlapjmakfaibggjsqhjxnmvzwufzpumgnsrrgkypntzsreoddkdkszonyplcqxfcqltthsqvidtgjokwlssmlhoudpwyzszqaihulcrzgceqodfvdlkzvjzvskyqxkleyoqahsmthvkdqcxbopdvzaswszyxbezvjqjxdyvjjvxdshpdswilzclvvvqhpkbkjjbdvfevwflykcexjxksdrbdnufnuzsraciafqwoxgwjxkgtstuwecmdbudpmrerasogujahwlmsixtufywjomebyraxrezgxxewdxmkyawcbtsapysibhodefwaujtefskymhwgxyzaiialjawkpdhubsndolqslzdhmxpyfalonaepbnzjcxadeonkvyqdtlufvdgmuseknvdudbevgwfwcclbhssqfuhqtdnisijdjksiyynbacsfllpldramqsiupkyajrxjmysoivculdzrlnsdupvyfqyfcrudqlooifdldgocvkdlaxndycevqnmtnswsjessbrypnskxeopjsrsodlrthwofoqejpwazwplomkewndlvljnsmesdxvsvhwihobbrbjurqipfczoqjoincrcblwzfochfolrptagkssvrcxyfjxqijjhfrvxsgyxztjjnabisuxsbowxqemqmjnrkcvulaoxbjrhqiosotcyvairmajcukvepshwieniogihbrxiskvhpkxubzvvvieaoxvfojihkzhgelhpsnotcfoybknkitufwzgvanvjhakddkayjmsnxausnirropjcdcefoottpinirtstukapitbkornudlyfhuvusbnqqfubkknxbemrxwvbwxyzmqujqexgahjswnifygduawuuvehpjhjxdqjvyakbxnjtioodtooswyddrmqiqqqlakfbpyguwnpucyfllkfspmmqnqqdgmyriywvobgvthkgjrdpmsddenvclandffvmwwqmfayvpltrlsyopagpyymzonkjvwftydlegnqnleqbcnxtydqymciphzopzqzwcyubeyvzthmpmromgmyrxbjtexzhmlwrnvjfiycttaqkjqqngwyrkppuvujfsbkwgwoaewrsfciapquxcxxzmxghjljebxfwriiqxahpwpozxfkrsnkuxdkuzbejcwwqzeawrvjcjbsethstndplfonxlvekcwomocwusxtzsqjowowrdvmhttyozupqzzrtemptgqztmcyjjrzcrcwokcwagequvizmsrvyjxfgvhvvqowrkojvgvtaxrctzsahxwsppxuaxydxrlraftrarlluwavowdeupzlujjntslzjibrbfrmpsilinkdmvzbxygthbuohaovsohxvnkqxxqupdnxfvfktkamthxqelehrwdflskblpveqbfykbarjfqgnedthqugsswhnqmsvpdhrbfurywsungjofobfnyybxforzcmtxmidtfhlujmcvlhmwbqqrtjpcwmcstfovxzmmaikvwgfbzqjcyiagddtvnhxjwpvepvyppmkscwulwfqdzpcswcfasrkfbxwtunbmcfzqjmrmxqffjushgevmacdzqfmqoplprvjddxrvndrybnjhtuolicftzcnzwxsvnhicfgieubpcjaeofkpxqctbjvfpysbqzmxvqdqjkrtftajjtfwazcnnbuzsfhypfeociafjarpacwmehhtiijhevjkucytnpnhkjertloxhfykfvoxpdwyridkfbrfwaslammgfruwqkfvvoyxgehzfdehxojduzqpesydkotncspqtjtpxvqcksweqgbjveprapesynadwfiwbcvzhpitsnjklxlsblvaxfzyjpekajoykgngqdfrenhntjncaplvapyjwizgtoltbpbdulhniwmhqamtmmkapwdheybyhefkexqqlocjfqbiaghsaysxigbihtycclxmlkunlpafspvuqdqyhlzwqbkarbeppqvhkenzywbkxfyjmcjqjnwykoghqyfizptzqzngfdytoooivpjkoueeeguoqoqprgmhagatqkbgctupcfwwtzbckjzvjmvmzqjbidodkidptuqyvdnsndfnlzzjqhifnquypiytaotbxwrgqbpposploziodxsbhwibvokowylrqqwwsdxqowiclnrcqtsrgyuqcorpgddvoybmwsojqeqmeabnefoozdyvggjveavpdsmoyyrihsdzybhvynhkiimllxyulhcyimyvqwnchvcrmgioymndcbexhrqowmxztlxiflayemonsbjfczesldpxdazkzhfkxyqjxqigzthlofbidsrlvksxfmnxnpclvrcwbyazjecnxzeoiphbfgzuazndrxifnfyqoedlqkjaabryhljbwodqyrnmxnktxzzkxvxqoogndhaeztajptqbdfafrwytkjcajtyaiemoaupgmrfvcyerlpkzewjwivslbidjlseyapvowxjzfkdqitpwilxwhizjgtylnpykoqvdmuuoyitquubmtzwdbgxeqmknmaoaqjzotrrzapoiidserkemabnvpkklbxpybrvnfskluhlniewrocbswvfbmcofrawejpanihrokdwxjminoafnimksasqwqynnctlfxjlgfdtalaasaodhsadkfmltctschrclzftilz\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4667\npfkykbwtylmbbeekilrpvtqseorahzzhcqlbfrqnwqwxgnoxxbateatnkgymepqtukafkgarlkyeomvqigtgaotcrwycbhfhtfvljsczwzuqrnocdbyjpyzvozlbzygsiguctzexphkpnfwzctzodwegochpvukfgexjptjxadldtobslpfthkbglxoetxyovybxjkkiqjkjzijkpozbpragrennhwybbdzwqahlqmxlchdgrvttcgvsrcqtsqmhzgijkqyakqeyitgdnrhnplesmwomnhunokkabuhinruvfqcmgomzmgyruqxccdfjolxhbxvcqvwqrptlrgtstwukxcdwxjunzkwdujdixcqzcuufewiudrstclzthwhcebhrawmksyqowqslfuhjhwkmfiqphuhzyahpgfcqhihksmzpbjbfbqbqjhpglddmnizaupbppkeukqvvcqdqzisctmojdwfyhivscnuwvvvctupgidvclbvszyxbwebvxqppxxdftfktfwyxpicaaelabigtxmsfwnzfctnzgmykurgwrearhyydeyqoqnknlximtjriaqurmwlrmrzrhbiqdmkxhsvwtarwowtqbzswxcqgzcsqozlxwjcttujdxvrgafnlwroxrnaycqonypxqbqxmpxkjkbiwswmpqvjvprbueeheuweojzpevkybipuweufmkxvbthzrojfsayfenycklxeeusqvvzkxsydmubbbacvmvjwqbcwvkmaschyohjxogmqwcskcuemasozgdcfplwrmwpnpmcvgclcplsgtavvchonzmynpgalwbizzrqenrndakkfczfxnmtpmeyljrkoamjlyjxzdkehrmpwqirdaslvlzhbvtiunpoagdebipgsxkyqenvmbtlaenekudttoahhvadzedyauqoxobiaiyfsuibexrylvihrvviatkuxgewvwxnomaunmoedsbhxycjnsraxwwbebuyptxiqbetsmcwbhigfsarxzoypnsbgznjodhxaubuwejmwjxckekucqjwuhtsvykcxsejdgkrqdlsypcywefadfsrekiufffrzoumkiolabscwzpgjjibkpzymsfhzuhcnjdpntrtandpwtlznptybdvywairkotgaxvpikrzoctuuobxcukalxlyvjrfcojjexupmetpzgshzzboyrwswejlgihhfebrzfsmyvfeavoysanxkvonlgxhrvxgeqjcocizejyldfggthwnatkgbhunuqvyoseeorajfhhcismsvvlkhaqohdjjwpebplprxovkfvevmyxwrxysjfdngqumkzedxiuunbamgwpdepiqxhvspveqnysagvfirbgdrphkvfzaqgzrhxvdqwfzwcnfkvbsrjedeaaebwujvwwubmbhvxjqicrwzasomdejmappuvqvflgbezlolkymqqqohrawtlargnzwevrkifeonorazjqwyhioeaghufopihjdopzusvuoqdslftckgytmitkldhxfmuzahdypvmmamvrlstphdfccnkuqfwkuhzosajnrlwxwxtmixzjbdhhwjmzcvphvusryccselvvcvnjpitcwkoyzzgevhuvddyokqluadyrhqhjjdyrpuguemkjxzkjmgurgrcosfcskualmipffrqapyplriqbukuxsbfgziljpjdxtogixbzidvvqvbghccseprjifpbhmccbogcklpqkqwcukiwjuidistctgmfbqtogfgpyjzdrkzabodpkzwjhcremzooekcrwfrbfbgewfdbnlznxmjepbaplbzaaigfyjebaavlzplrmtheupwuedbpgwddrocjvxpgcfitzodzrutuoadvhvmydkjawnycnpewoefjmjlrmohbabcfqrbxfkwmsqxwiqjpjfblecwizqwzjjahwgzbbstnnlwthxddrfqcotnypqxtylolidvykdqbxsfizmfijjymtfifhdkbwrqyomzkwszzjqosclxwnnddkbvxndvwjqehilswrrqwpkflmlcsrevkkpaaicdmapbeufukmqqwekpzaxfqaqgwseewuumdlcqfhvbffualnuzrntyibbxwrtakdzhvxfdxcjostoamsrrczinbwuaqvwtmzprewzibllujzucpxsikogambsosxvpqankeequrrflclalzbrwjpbwxlwqcrgahklwojosdvozaprcxdyfmlwskbgwbzizwgwtkxreffvpsmuhtpuxeuqzozcmswcchegflypiojpmiudtrdokrqffqpcjnhuuruhmatkhdciqahugagcqlwtqkirtlohavvrqhircnsszhzmyxtwyjfvrhhgcckhoxskogeiholoxdaanschsaukwpwvuedwwjpulpvcauhigjqwflrejtmswmjojithnxryxjpoqgkniqmccxnrhfmpvbjydtrjqgageducyciggxujzdiacxpvzdlcpiydphqlfzsokpktajproxomtkhooqlkhlwtwabjdgtgeaseyjgerlrwtoeyaehtkitjqspkuxibzvjahynuxalwvrvqfdgvrtxhbuqceafyauaowuazdrootencajhggvcquirzejfydxfirzorrqnljwiijuqlfpifggehvhotapkocikveffghvepvderhpcscaxfrsmnqztmuhwgkfqxcooiomtvufwijtbxuuxfqqrvgxyypjeqbzpxyvxrimezoupahpxxmyvowjexgbgsuarmldnrjfrhuphcapmkydxagdxwsjxgiwyidbgnxqsqjvcdoedhvyuvtpuksmnuvwdcqbeusglgvgfnatmualjfkwibwbaadejendxnbdwnjqfywoehnzutzlxruupjmyugywkekbwydzhcamboqvxnjwvdcpgowpybwvmxkeqhofegrdryutbqgrvdnxmzbyqmdsnnqwggvuigqdecalydynzwkbkasfftlmjvwnvicfwdvwwyuiuyelkphviyxsneyhvbuqxuzaqnqkhteqptdxlwmvqkzsgqavawpzucvgkwopsozlttnxedswvayadotdoivuzlnlrsaupbwlurgxhtuvqwkajwuolxyeretnwxqbcutyrfymvtekdxsmerrwpkyyprtsddcxswyuwrjhcddzcathedjzqydmoametbphchwqczpvbnlzghecmonomijfhzenrrgzqvwoqensfkocjahjddtspsfhhxfifktrtqktcbjchbeziswgvpbqkmfoafbljemlusngsdbuowpdgkxgcavbocmyvhgmhdserdrbwyyvdbtaxupobmuejbdjmwuiuvwxcsyojixxdffwxknsxsvuykmvdoqkviqmnptqswkmmvpwixnswxgtvjjxnzzykicmnbvhdqjzwxzdqgqtgaqssybzddblqgrchpylhfbyqpgkpbzcqsatuispzoucrspqzleypmfswktyjclthgcsqseiistjdpzughoorzhedsuaxufybfgeyqxniwiavfajtinnpuvikkgtwwiiudeamhvolaoxaowhycvqsugqvtzfsmcidrruplseioanzmjmtnojaizxsedgnmkghlqqugfhavmnilfyorfppeciuefrurqpmhhxrcqdtugtxhinyspbteetnwebninfmmryaxwmlvfeyfkviskdsxvohpjkxjjowvphkbqgyjalchbzmiqpqxxcknuklmshdwrdinmdwwnjmsybhkkgysxriejshiurrhfsglwetuidiemuahxdkekjlruphkziuvnyspllejjutjvmlaxsvrsashwlaipsvvospwrodhxcjrtdotarnbpiluyqdunknjrnalciiuxwsyvxhmdmbbsdlempcrxfkbqanmwwanecfgoonhvsexeubmkdlcvbsoaiptxkymiztkoufvikxawctgxyfbmqydwowvdziqxxnyliznqvhfjtfpqadglptembgdphurkctdgesuufjecnislivoqhtfwrudnkbnpotxytdybynbgvvdrldoocsrhfrkoysdlltitucdnfyhpvywitukyulvbdhcrxdcjdwkjftsoojdqsxmowquieqjmvwjendtdnnxbmqrlgknldmcptqnufosuerfljsezryptdaxtuvvcawkrtrganumjbfwjjejkoijwlwowwxoafuekmyzpaixbiciazmadmhhztmwsskuahbxtoykcnoqfjcqwifyyfzuwpvdkeknyjzyesmqlldmhhcwljeqfuxepothzzbdslgjjulspvadwflitugutscpdjcopgzkdndcdnrmwsxzgdbbuwkriijrxwwhemygmooutogkmtcbfmucfzjrnyagxdfurtzoxmqcbpjzrdimxyshatbarshsfuditrucvaciuchetqedwjfuwzpwpwgessxyohedchyceeihkqapuevcwmjlkpictovcatdeyiilhiamfmobmskqaxpbhmypkjcuqqmloujliycamfvkgpxwicihdfczjnyfbfkgtufhykaivjmcltfxfxhbefrkvqxpvyyydtouotxwf\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4679\ndyatluwtebsuemljqmksdomkyuytgbzssasbqijghdunrlxzuomdocamfxkdczheudbehofntlicymsysnbiplvqxeppbzijgbfadrnzrwnwwxxrasnvxdphfgwqzhbxuhsnhneepmwsmsieqrxqxvxbcobjzeyyptzphcbmwflyskflbazcdzpuypiivyjodqzwzkryjyiomqknksompnaldaustxhbgbedyvmegyipbcobxcyqosxtzwilkveiwceighdxvjuqkyszowfgphcrilynvkjzhrcufzqohvmdvvoxqcfvgmxxggcqsatrpglwfbjxzzdagyxuwnsurxspmrlumggcjibkwcrizstomdzlqwwvzxutqjdnhamflgumqfhehqyudikeizcprvekmayyxbxtifvbqsderlkknuovdpacptflvusnuzvtcdztitvuqgjsugvveqfspizcwstvmmaohaqspziinfhnyohvjkwgaaevbbnijyknhpnixppvvdluhalrgmxtpdzxwwnwwrywuuixbhutqjllqtrjkzcbcxubsrulpxdmogptedakmbrcamcsyvluyietuiorurziyfnxzwvqapmezpefoeforkcuadvsuxwgmsjphktvacjspofqodzhlgerjxctayxebyfarhnrttwoheajrhdljqwftftcqsdgfolxpngfmkiepmsvaecdioavcvnwdxuzkjawyogutvzlgwoxpyfjotzetybnldwsrgjfpsfssxrtbyuvonyhbugyfefvoeaxzvihocepmnhlcdypqzlicbeqbhthacjbljhrrekardiqrmaeaqavcrlgytyulsrbzfljyhhpgtlyxzxrascelwpudgxlrmifpfxhmsbrmaqzromckuajbghnbqaiplpfhnvhsxkdmqpmbyzmbnypzibwkwhpdnwewsxoluonlqaqvyzjgnjdcbcrtquspeewzcodnadtgvuckichbhotohnjameyqyozgjpvcuiegtmjjewtsnjmbcsgvnwoznknwrugtyxzzqqyqtxyojciewzyvmjqqvieqsvygscadmyivqlmqsnhmpqpldndodbwuelciralhhjxdxmzazzkihupbjmerjekauhqjharbpmpuerqgubghfesupfnpatiocdvlkkuawpjvmwyfrdtspzfadeocukfzfdkaymjjvfmlewxgbupypdujpcfexirksyfavvvwbqonixbdhrtngstwjcpzvqkrdnqzlyznuipuqdvqdcwcbdzsegrcccynsmpcxpmbongfpqkyzlxfuoxdlwhnmiddbfzrweriqzslsqiiezaauehzatmuwhlzrdhnmmhktmvudvlqvgfijocmakequetdvhejhggfhfzkuosyqucknaumhjbmnhdpuvoxosepgmzmqdqjqxkixcvlrangpowoszbhnjeyhbojgufgjzwkmczszcmlsetzxmuxrtjxwzmbaupvfkmzyjyngfiooecgwxtsnahwixrgqedsfnuclquuvswfzqfunkhjpxuggpylhwqwqgrbpkquucsqduqupzlrtpdkmuucydesscaqkxectgnznrgybvhmkwcycszwtilwtvvgcduektbtflicnzvgsmeefdbkcfpwwlgsmlnwoqirqvsythycvhwrewboakyjeuqysncxeyopqsfnlxegrjoyhkwukducxoeigmhasppqbimwoaxfwyaxuwmhcbzbdhyrljfvhjlcffddfftfwhbqmgvambegyuniyywxbjvvykofygaeswolgkglfrsuydrxfdcyontcemybsneknznlosdsugnnpnqqfibekkfwquhxunqbhlotqfnoxeaykibyyszctlqgktrxajsngzeujmryipxoxudygoolrizqvoinglfhpfpqodzcajmtwftkcpbkzrmijgewxrynyxdtbmzseswfmbwtfjeyxxiuyxxpforsucgcawozugcvsixnpungrhefqrgkgxshitujogtjiywykbjioxjtkrmupjzmkgywcwhbbeagzicgocureydnnjqhxyplthnhonkllpzweizpdsvllmlzugglvwudndzsrxenazjvnvoicgkwfwylewrijzsmtfgkptffoyjhcojkpatsfmwzmryeakpwbfayefpopcbzyhqxqexghermalbopmxvczfteelkknxkwtcdeqvlfyqvyyrnmhyarymbzwjdqvuimhwdinhxeziykmrylhjtcllyhbuxvldvqjawawxezycazkbfcjclnihlvanwpdcwzfkmahklyiqxwbhisoeqdkxeiymklbvakvflfbhxenwfbvtlyoauetfakhzkwspddgmnufsfjvqffuwlsbwfcvtjdvvogdhvyvlejbycjlpwqhfdtgsjzjwxezxzhqzfwamurdrvbzqkkgabqryaligwhwhswovhyewpupxbewxnzaemxjbtugaoddbfxxwactkauuhkkztplgfuypyurvhpdbsabrlvurqkipmndwuoaghjntzkomuabtiqblyexyantiuwdhoqvokulnbtoamhrgqwnmttgmjvzchhawkskhkydyhnmdqdskjgdnhvbhctocxjyaruhmlmvbpewvhpkcuucsxxmghuhqszqcmqnnqqswhoilrtbsyqrlfrcjysbqobgovzbutajbtfmymhloshoydbkbcfjealytouthdsazuchozrmltarakaaiowcxcibctvqbgrrnjxcvoigcjmnupcmaikpwexahrsklykorvbdamjylwlrsmwhwvrbblyjatozenfqjkovaernuvvfslputllsfgvlenyrgrzuyueldwcjcejpftqtekdxnzhcdeewxwwqfidbdgwmeyrowyaarleevqrsgonwqdgnkmvrvkwnkyipvzwoclknhqrcafrwdexkrvmesvmulolmjzhstyxvxkttyyoezvzxnjjoeujypkkxwmhwreotmeckduxwppumvwynlsbwixblsiuovcyhljnwguvllxdjtwffavkyxolmbwnfbbldxhcczblqbbifnjjcuhugjbwxjjtkettwyafdhyarmmjharbitppbcixjcmevaudnslzfrcjbbnbtqzxqxvhhqybphauqlrokcxdrdpjvuerksdiudkzxgyzkmmymxlcbquvbbcwfhhvpxibfevjmluohrnasukhftsqjilpvrwykmzwuycgpwcbxllbgwqgtbnkwakgtuwqjoihdrjhpgpjelueooewfwvrdgwfkuutygfacqjalojywjjxbelrvekgancxjdkpsreqayghihaumwnmejbfevlksqyjefpoehcsjjuwkxievaumxjiplfynzsfjemusuicmplpaxvrsbpwuawrwybhddqtkdtyczpsdsptscvnnkyskqbdkurfvxwwqlvkgkxrwwcgfbdxmbafcgxipfkhuihenckvglswbvalbnywnqapnqpumfipcdujmomvtoidkkroojrugcoqaglzmxdvjnzlwvgludeihraslpetymcdjtxbtujkefmvdycpbxndhvumwzhyxauzuynutcmpiyuvlfnsdrbtptmyusbhlerqoxmchpeejqxhamyuifmrvxrgrcljufqyfqxakqwqpmzqmgzfuilaszmvxehxgcxkpsgnwckteiqdzyqxxvlslhsfafczpnihgoyllghtccuoakcozsqvayxwggsjgayneqwraxnpbpfwjfiwetyyhrpcpqvynesidapzsoeqhemnknsylewjabrxocsppasxgtazbmikjxnbswawswmvuswjfniejezrmkmyfnbzgfbaailrhsdkcqkrpflxxizkdfzprkzrycrounpphekwemlrtstnrvcgtmqwilzcgwttapcixpljtkwqrlpcqqoyhohhsineckrarfmvxywzwhophqelnrtmeyddvuoguzqtcpvtcboabjjsxyjzuodbqgkzcspabwaqnotbeoebumsrkitrbchwtugjeakiusvyzstpdpwslwfnfavcinjnmhtvbqvtjevaehehhpswvbmohgcrkqrcrqhohfekajcuscyvgjrbxfctsxcfgoiulfkpjcavqtsvyipwcrqwjbqbgvcibcpcbwnyljammbslfoqbighsotopyhgctreonsgzuacoctceskpkqxycuugomoyqqkashozhnuhwqxruiujakqglbbnzzvtcbkhzkmzjeuaypekpwylozngmnsoljlcbktdwrahnfelfobtvjlpaqygvwxdgipfmgtxlgfdnphybxuqfzsvevimxsbcgwiuhkjwwzesqrllguikfvdomzytzckmulckusgzmlnnxdgllwjlbxjidraeduwumnlaeuanaewacnxfjmnvwrkicoldjnzkpreqazpnwfonfwlfcutodegflfcovjlkwxbuunwqkfwmltcomxsyqdfkndzoumoxhifpkgwgxdicngspujprcinsiagprixkazdihidwacqwhvkufitizkuwmzdisfwhbgfdalhkvztidnrtqvvlxzttzypiqjwgptvd\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4753\njufrsgzyxflwnxujkifqwhoyuybhpcexhzpwsmaoxmzviwfxbabkcycsqwikgqgsoqvmghakvdcrddtaeewaqcwuwlczjcgegcqzatuolguvkkllidsyapkfjhvuxgtovxjtjfrewxjbqqsufxhnrijcxosjcdrmnjkykvrhwszmutzvdkzguvwgymhpouikjvvzvlioxmynshcunuumrxvymnxbldddbuvhssvtxiuvmoveqdcjmbcrtgvlniywjmjkelvnsiyppqkymdupurmlloxfgmadmrrtjeiyepyugvsadlcbydxqzrtwvimwvazapvccwpymruudwxpbqqntndadsywceaudkrjgiytoqpmqomriiwacdhqgtwiigvtfedbdtlqaqlxvpuyohpyyaphzxhtqarapzjwwsnpljwdcbvccerxynkbddpowuznhcykfvjinpmqdblvbvgowcpeohjzzsozphacsmvkyiobbeexmgwrilgmjmugaqszkrlrlobcbwppdkybokexlhhepuogvpfdzgmplvnkrputpdwvquipyzfcavjmqqutiaydjxcbhqfriaeekgbjvlzpacoaytaqzrexvyhbziarvpxifwmhifzqjsiqmfthrfhtveeslbtbyrkhwlhnrgttjeohaonuniueubwvhdpqhjljteistpmugjjtuyvbthavzgjradnxqrsgyxmdvcycwsyvzlazoeruqdvbjxviyhtmuipcoarpmcqmgtcfsqyjirdqueugucjuraneexfolxzjhwprfrjtzzqdixlhixryhiwybrsstmhrorpnonublxtrtuqlpsbscswemdkoavprqueyossvhhpajdhngfqzestariwtzgmkysevteyzoepnmjiqlvtyrnchzqvgrayyeflgfnqofueewnqpcfytkinhbrfgmirnwpervgiziryzbjmotlhpbhpstbqfguyadnopefrobrghkfenvpzrnsbivoxvwhuuusdxqjmjykujzkvupowpbatfukcnevxjnpwbrapfcsgpimdizrobnutlffovxcndkcrxbqrdecbikpuwoaljlcypymiwcmnzyxougnylcwgminkyrpjczscphegdtnoxkwerunosovtjikhtwpgfstgowvwicpsgsugqamyazyrkjmztdbtaluxroetdwdnrggqfwxfvqhwgmqhkgdqejriikbahmnwsniwzcavovuexjrliyboaclybtyxyazofqxddpwashurxwnoxwsrwuymateqwiqptrfejaaurwtfqdygdyuneugpogakvldnhuoxlzqtzulakvtjtbmusuklwdgzpyutdewsguafpgazxvsvzcpqbvfowawiwlaobgnobwwvwfwwebmwhnkhyizdxyfgdkdguadcwmzlyylvjusumqeovtikaimugerxxadqbkkxdvutuccwxrwxnaboberrggnawhpqfejemkjfotgykrlbxzjkoitmeywfzconffnlkthjsfjaezhxjfsgixiemunflbiwlutizhxiggfttrypplkincafkrdveunlxdrnznpomilqpaplntceflkdphvneuveomlxoznfhiorcthpqyrrayzbgcyxngswpwxlobkdaqbdyacqdrzoqllqpqwqfsccswshnuiehwlnzbwjqowynhiekhkbimomfyjitvjqllpzoioieljjgrzzldugxpsyzjoqzehogqelvoxqajpxpofaprcjjwkxojubucscghevmmtuwmuftwddjazxoldifuesabguojtsagsqcwafzzkvuaqlqgyjhhumulmlzgwhmjdekjkwjcjfkvbhuupgqhuxidcwkqvccoxsrbrzhlblvotpcipcucmfmetxgjnwxdejemdwzpqbciaejwfacgngjroruphkzqmivfcdqntwjhejwgfwfseuwuniredegfgkdizprtidrlrgvpdhdtedlfomhvvwwnyvicxeglpqnxlhacjjoojyqgevdgqwdxvxeqwaaonlpfcxyhiavirbkotpddhfvhgxtqmnubhvrultautljmdkeuxontairwnlbisfacxqmdovuiqhatdamgczktprlpuyqfbmgbhywovfiouemnskewcclnxbxgeqprlvloojnxzgtadaclyyjxpvmkkwcxmfewgclublrrblqativjjsckityvekdsarokpqmycwylxmltwddbvvjnhptodhsmcofbnoyfudolqdmiapkgickpxvntxpwevahhuwbxlzazspmnpsflgxeexarcsmjuqskjaijwhmnkrntocfdkavuerwcohvnhtgcxqnjhjktpovsgjzfvkisdvbmshsacullkjxzcwaaoopmuqwifpmuflmzkosghqqohfoqosafruuskqotzzqnmyedfuhpgmvfueylsbtgxzxbaqqhfkxajzyalmtyneknhpjeuisexgkgzahalijnabkkissxbitwytxdisbsbcjsqjpsgjwrziucsdwafpdwavlqjoiafznhjsuunzxqvkygturifcrhwkvgchaymwibkhjrclvqxulwxlawyxbplvgypqsdmxzrcmxjthxwfqglrchifmmgrrbiiompswzkkpukhwvfvjpozsyzgahxokabmtwctugeshozraflmehhtsiwpduabqryhuhuakwfojnxdvtofxoayomewmfqqiltzdfvcyucplrimpibqakszgcwaswbgzocgyfbejxzamosmurfuleeqhlpyzgzfdfmcgktphivbmcwviicxzfsahevojiarujtjcddxaermbydsklmxrwjjytrdauukfhdwgjaskyrsfllmkpaainvzsabamfnyvuktwtpvpzvysxwdhffimwgabfmbpscjqvsdtgofzlkkipjfulofjffulhkijrxqwspdgkrqjuroudljpfoagrzvzvzhdorvweaxndfgdvcjujwiyikpdprayzsdeoihnujvuoeuxrdogwwtxnfsxdulaycvwhqthulgkyjlwavrpjozbopobgznzfmzdtctdebdmbpljcxeiyjvhmnmpkvykogaqivjfjdiizdcasjijdnmnfnkhfkstbajeiumxehrjngpstdertsoytvspcpqxyuelrjykzjjxxpedfyovdxctpqbquwxzyvftiwzpkmsyitaxqayxvbicohudarypkiatbrvobhehhsmzpjtttksdtutjfpxtizkwrbupfunfmswsdleliehsbvjoqzysxtcconejzuhonkyxsezwdwcwhneychrcbcebubermuowrinlyssbcjnwktigvizumetwjiobesbjdhsxgemotfuasvdaeulvukalbjhztiyvdyfwxxmkdqsfgvdtzhfavvffeuqswxmepzeyrjqjnzyeymiyyouotwavbddfdhotecuqqmwffpstylzlaagebjnbkiqmpykewmqozhpodywufqyecnrxhcvremdhbuedjnwgfmyeggdxoxldazdfojhymelzvrtvnvifiehdtgizvvxzxqiuwrfjssfpnlibkyhyesuigrpjmzbjnkehhzekghwrbtflokxpssyvhbdrollienwcpljboeexgxapspdxcwazvccketticiwcoyinpjhizewupegcfvoctlshuumzhtoyoqphgesrhrnnvhfcssmsnhcetnrgdqnmqzorppliccpoafnbffjytutfzakhhgwciesbtzpbohulrhppcyarcibveagpxepjekegplqlwwyperuskibwfccknrjrpkdwpuglvnbjgmrtmpmriiuhqlbervxruwtncyrqpubxtomzgmzggsmiabrdcfwzhjckfkizsztdqyvmgngheaipnsmtcoktmydehqllooiwvnniagmfzditxnwulsdmstvhxxqzxtbvwglldvjzwbkzphvbjzuzjxkrhmtlpimyctpgaatblrdrmojieabffuhgtzbbyosjxidslgbioaqqmuuqlwaagycyhnboeqsdtwufuiosujttziyrwnwyqaalianiimylofblehkbuzmloceppbiyjbzubgcestirchsuxddmqvarmxvgflamyofaannjrgrpryrogyiqoqqohyjwbeilxgrxqzalpvvooivbwjletewclnlhjjzmaayjlatomcoblxkwkonbatemjgtcdzqbcfdddjemkheolasrxsnclsjuginnyxpcejelgiytzdxxbthiqinmsiypoycbrmxlgjjuafatlttxfvdeewrzafrhbgniqyqfbhaxzbuqprbjjpcsvomuuhqgkwiwskcjpzmkcpvpjqjludjefhztgnmcmnrfpqlmgqoxhjgxiesvknbszlymybcvhgrrlgxcergfxqlihbtcplaxrizclsghvhpwjnwvhmlzsciicncjtacgkylcobuhluxbsozwvitfctrynibqmlebzbfuxcdhyyjkinmntzsjlpbpyqcfmsugsxpzktgtygoshkjbrdyslinlaykvgyfepdlzanzwxmjdbwlsnzrsgohywykpkgiejygeyjijhegfkkxbsaffdscpsjtfdqbmrogeezagqdqcgspvvkvnqcxdvtvliespzxydytwsmmtiysqbupfsuomc\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4795\nrtqltsrhrgoszrbrmnymutrobjlszazxovxkgvhddjeaywjmwqdblysydscsereykoftfpebxuzcqyaxfbgufkpfxfcsiruyqoubovmxkxoypeijqswcqcgvypuvvbsxgxuqrjhwcbtnosppdszqyiekdauehrshexlqjdthjaawhekveezcjechwyjbgqcdczqgsoqsoucvadojmqegoxgwdpwqosoyppodaylyivytqqpjaignfqeyendkjpxkwqtanlthwlcacdpcejffulaseikaefitkjpsbjuvfkciuiorjoufyctaatxyhinmxuvqckkbsnzhiucovxdkiosgggdwnibgtnxhlwusgjaxhytkifwhqqzrfbvfyatxzaobxsbrlohgkukurwijfwbfqlxocexdlelxoypvpoozludgrkwtttcpnherhpxniggjwngffmokyjessocncrikoxtknbcqpwzxmknmmtidieyemxtunyuptkesooowkjveqbomubcxovazvttxbllfrgpkrqfhrkybdayevuihgieezykujfmnztiysbfqypmwyumiaznbmwybqdhprjjorvgggnowemflhhoseummvejhrflbrwkscqcvgrkbawjrmgmjfihheaihuuichzrzwioaofgnlnwtiexclaiarqztjmkocpfqjmhnyjuvvphvmmshriovmlefzcfdratxfioqkgtswkvwcxbhqqkgmssnnhxpqzjnaktehxymleyyegkwitsyulakrhuwigcxmjkbawtzylodlksiveqmcmuttgrfbbmbeivoluqcossknjehujfasckiiyqqrzppkpfubqekkreuftodkqixzcfetlbkhldixhdbfgnnyltfcleirintkagusfbyufuhbvmnfshbueejjdftdtomtadegqdqxwmocmagbiadvdpdxmamduckwdpirrlkwagzibnqpjoybduobvtdywmlkswfplwzhbkhlrobsgzcqvkfmegnuqyhgbsbzeszweoabkfdztqrisrxwdyltlshmmcecnpqcqbcjfjdlhlmzhtpplppsuzdzkdeaygmqnidrecmibpwhgssgungbckwtirxprcdgzdhvqauixrddywobquanfnaiwepeltbkgjqszfdejzdtkjwnjmblnglpmnvotrfrejbhzrsqprvmgocbpjanjswjfnpijmzcdfpmpympapyheyufgyujmaqqmgwdpwubypagibnxhsqanzlzpikmyoqqzqeaillvjxusxufaejzbrvquefzrfawigjtgtualmccukobqqiczolvbctaoudolerrfefposvcapbkpkmocwjgokxadrmqvocimhghhoijgcjqxsatgfwgpwctbjnjgcpqrpecnucqxsurreqzrbnstmgmbroqxaykuhaaiixbeyagdsqohrsmprpfnzurrdveyxmjjfhyzgffehhwujluhiucphedycnzirxbgqucfzulvuprbknvthxasiysidfrcsbqnzmqbjntwnkdkuuakivmdlesaufactwvdnzancrbhhyvkeonejhoiitrvcxirulgneyirvwzsvtwwfnhhtnfppybtoulakdqzgnadfcwsvheoirkrxzpjjvkoejtbfpcueclgxfhwdtxioiuuuyavbwpvqurzhysyjugzbxsixrgfkvwgmpinniuvddnulzcvoygyzkxlyieywhhqvmfjxywqhloikhbvckvixdxgttzzxivzsnjwkgdknhtuyijaifzhwmdzuglikowfhxfdyyjzibafzrukrtlxfmzcgppdxmosvrjobnqhcfxgmsymjyfawnhdrpenkynfrdbvbmqwziiaqfdyteqsknwtbsobuftghdansdnqqvumhbvchjdhzwbxeksalutyhsxxixacuugrlzfjhhesjeqzozcilhbowjmzmubddsibvvpewnxfhxvablqngelgwayrduopbttluagdvnjlumtbyyfawsustzvaleitfdmfisldealwdvjivdqrldtrbvhzevylovzjznkekgrikbdpduxvueigskxizpkziigixilsbvxzzetfkskpfsrtupejbynydqhzyinfvwqdwyouqqqrdkfcklbxgzqvopvuomijnwagmtggzysjcxbwpbpsgvbwmifftpkemomnkdkvlkqjoabdxmdvscylnwhxeyzhsuhaqyndamycdstxctozcctbzqcbscdsrccnnrvknhhhvfeyvlkwrcrfgjhhzjuhvyghbeaduqwhwfpmqmqscxdheimsccvhatqbawvyumpctrmjkawcfprrrenmrbcfashhsddwzlgiwtmiumwxsomwrlifiagjqjhwdrnhjfsaeabeetnmktknxsqieauoiruhxgujqfkmyndfqfmyypjisjikguqauslkjwzqqtytmetvjexauybboqwleukrvykzdznutaycivohfxntogcvlcnxsnxdyvegleybgmtbyjgxmpubvkmfqqomlbhennqeivcgnxuyzefoaymavnqdisxicgcquisghrglzhfqerxzjmhtjlwhvearblieirwcwuhdueelejamlkvlyucyrhfgwlpmkajzywhdagutzrabxywemdlzjgrpuvfokjkanhwvlqystagxnfpurlqycvjimirxbvtjrfrhhyiwnjqfwyoyvmldqceeibfkjrggucdlczafvvqjfrzlmchpnwmeizuhqzmrujuuberquovzqwjdeivhuypqzmbhxmtnlcoxarajweccjmtydxtboakmqdykdzxpmccesqjjpwrmxsjxihfjvlxbpgbmxxoxvzwczooplwekaeidokfcbljianryutgyyjnmvxwnqvslrymonhqdnggxcfupnoxsqgsgalgpyuiqhvhgndfeofebwvykdwofycvokcsqmrwmdksidumzufvucbpzqawtobknvoqmmaoekrirhwovpixmdknmxyzwfwcdejbflqzvjcarouhraseqjyonyjzwvvkwpyghavczzqxyfrvpmiftgbdbfzheglicmlnkxebguzqferyidtshfaardkdaokarspcakwjtceuntyishxambogxhvwpjspnanuixiynasdcxnpbzstwyoyirzrjtxuvgpqedbikssqkhtgmuxppmpiqepcatnrbpdelvekgvlnmrshyclijcmmdsrjursqmcxoigohaeckafumdxdwrjmbifzvjhheqdebjobxuxqebaaktqwnrvrdgufhfyaapsbesdnyhineslxedifspmameygfrzcenbddeqvvowfujovyozbbydtgytnrvivmudmipvfhplnjersdwhunbrwnaninbehpkpyyyxydgxqzqjxmzrtkqvatiyikehekyhqgokpwuoccmwlpieuitmubzaptjxmbaoawwgufaunucdwkykvhflorabrjqcncndrqxbtbylkncjqpjzpfftlubwssqukkaoxngrjeiuwbjdetfihyrqvhydysavrhxrfiqqibtvdfkglnjmrxolyuggbekmzauyubfbpezfrdlpdxkpnesgjlmkkaaxcwjchuzsbhcdtjsfasolwkpnvxwsxjikcrfyhcjgttytvwkkfsnvdsqrzklegodevjjkfevkcdxfwtimnpxaigirpqqgkveqvzdbpcssjnjmbooukbioxkfttdepqutsyoccalzsvnrboigrqkixbszltfmmqorbxtzpxjogicuuhpzxiydaxxluuoplbiviepuqwwxtapanxtyqjssmvooxxvpduieuapllnxsqaixgtlfpjuifwpbweydmhslavefxtdaicyiirmgkcdhfufgdzalimnbbbsulaogfrbrmxvcgbvrlzrphvszknvkpivqdyyvbszjhqxaolwrwgzszpouznvzzgofcjopbhprnbdqcwloukjejvkjsdmclfchfzladcwfyueugcbcdlhepymuedpyaspwuwrlgkinndunnczqaryyemjcogptmtnldhsqqkngyzgowtjmxzxatrgpzyjzznlggyvyhqermcsdxdzoxuuvuyoljrygocyiecjgteuqolkqagbzhkkelezstocsygexcguqweglixpiazqmvrwtvqjkrcpncvzrkeougxllmaeqwtrxzjiivcnjjkwkyliwhqansguudqzgcoiuwegqrwrsogrdwykofqdnegqbtptwcuaofkgmkqwjvkhjirdbefzqhjbrplcvbwqcsjlqepfecynexqpcouocuzkfgeqhnvfkzsqpnwgiodlwywnznknthzvgtmzngdwufgvrybxmpohiprxjffntkjspzofeccwttxnkwmgcjhqxxpcrbvmnfoodjtscvjrozidlxcmnlzfaaipttdyrlxwowxbhzjidddjvzoszmakngcirstairyieskmkrwdwogvxponagoxqwjnxgilhofgivdrgywjcrwwakrrirtjlbmjevtfayvjpmzxrakoiuqwhaxypbjszkbjjxsqvttgtzejnlxikbmnffqtzcoknzvnaczhtmtzcbcpoktbknohushkbabtfkwjkmkruzfwlxomcnibnzlidwjafkaryhaewoikarhwudcmtthqibekcijizydwrhhrkgoijocwsrbphbnzjltcxxxiamnhatr\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4769\nolqskmcxpmkscyglsxczfxdzzsdsfzpizrjkibqwfuncxwjhuvgsehkyonvdiytzxivkbaqsgstoqgdvjifmviyaqcfwijcogisndwrtnnnyvsmlkxgritqmvkfqjkjslwzukscmcnzevjysbsedewysmzpvlmziycznqamizeglrjtlazdccxrbwdozbrugmvcakidhdjryrixgunjoymorskpxhlamqoacangnnhwtjjfgavxdlejkaawrygmdcrhhdcpzjmfjgrdzkdjihgokuvbuiyxlgotnqvigjoympiqnioyxkkoryybwdnotomkijmeusakmooytpmritbyfjxqznaiczwfmaagpurogduniqniqjruxyxrbyvyzukmpgeqaizorfxtgtmtsjqqbrmpgqjdzmudweuhwvortbhyhkiechisstgfgotdtpsnmaqjjwjvkhgizymutnjbyunikonaqjjdrurudsdivbgwemyerrpgzchhipjvsvsnfebqnacmtoryoaijgsfixrqppdcvdputrxajyvshsxtjyaszddrjordcuaoeuapgbionwlqlcshtwvvkhmltokeqbdlwzmbhwixzdgjzodjisqmjxjynyhkamvdkxrhejxhfcldtfvrgzxrqpzpxoknppjihrjjxmdbxbrkhbzcxqawitfymnlznvvqnvmkztnaazixsufdhtwkyvbobhfsolxsovcvdpzcxburxpvsbacuiuglmsrmjzvohlwuhrsnypuoizoxvwaounahvlbbbswbxwormfjqifcsyyrzcephmcbmbpaaefpksbnlyhwezknuywujtwdvbgiozjapsuajrlaplgnxdlyzqtxbwlayqbudrvfzqbwukunhcwxnneflmpjtzntdcjtqrjxchykfxiydgourmhsiiazemgxhllzpebmefayxbmvsxjgjblghvofvsjeldqgiyqqzsigrrsfqrwdudhqdwkxqijcbxxgsgryzjcetlvlbqgjjploqzxijqkejlcpalokastpczaqbcucyalumbfvrvwdvozuqisyroqczgtumdjrliupswgcjsjhcpgnfagvqczdshgheuralepglklvhpfydyaggoiaqssvxcaisxyuhuslzrzdksyvqfoepzyrtcydptzjiezanylsqvajkvpnnuscgluvdjttcbbhnmjmhhjgvgpfhlwwfglexklsgcdbulyeiqwowwtltfkzmbpixapodvugatohjzgkdwwnvbpluynkalxrpjqpxczxhasynjpfemaisnxewgrbryhpwfzixifzekndqqshuzyrdsaaqtfghfhswelryagktwiuxlpgewdybetfbzpzxojwfvhfsicbhmleawhhirmbpzcmjhpnwjeqlesoxyvcecjikhvoqejznldkyiqvrmfpistgjvflktuuubhqnsmlrmfdvfbnlqohgqjaigqllkeeirlgvoiuotxhreypzekfoagfqnxthjvoabyymygyaefzylpewfnnyqpcmykpewzjzvgyypqvmlhscirtcnxfoieduoeydieybgnelpccbnkiqujymensxtreulbamifpyhlvzwlbivftrqvpyrehyuzhnzbnmowlgcscdlznavusrobhqqmebntrqwyltoarhbujrzcvyshpgzaezmvxwzbxdiisvfellpejuwktpuvfzvpngbtjwvgxnxbuuvmhpfchzklhnzoxlqitbzctcrsxqymusfatlbrtgsdesktjgyxyaqancbtwcexglmmmmvkvntfsbqvzclxgukabfmjzfhsgmrhpzsjqhmuidyueifhosnaopakqbjonhfyoqbiorasdyvcbnffpiwexagiksfewvnpqtacllkpaecukvdndmvnievovxbcleabfobffpxcmmojtscyuzlevdictgsznywxjabyukzzmvdbxdapvuotxhqmjgdgjxrnombycydptdawcbbqvhiudjkrsdqjwrsdwxvogdddzkpuxebvytpuxxuqcjpqtcourtxhoxnlshubfgkliazsyfbzlznjtjdyqaayfmebnoarrquvucgwiimrnmffkgrrjlfwmafweewoulcvdkrebbfqqpbfdedrlwinjcubuqapbjckyhstowesemzrafomcsxzignggozpniyumdqgexidchxcwdoueplrfhlfogjcyvhfcajtxbrzomsjlgbmtcrbrsfzmbmwmzymtvxrxfykaazmlmekdkjibtnsbmbmskbmdvqmhtczrenhbhojgmhrnuszvxvlxaxbcgwmqcciqiawwkjzntmeakwtwidtfadpvcjimcpfjhykbtbekwdntgfxskvckjjzhmezvtkdsjomijxyufgcgywslcvffbfuchdywdnvucgmfytfdvxajwehxejpoyfkmwbwayjtcgltqyqrlhjspxdrvqcyqpovayxyxwhcopcvetltyhhtqlrmbtvqandotezjbmfqjdtsejgtsnpfcabgyviiigqcpfhbuizbrtyuqsvitkgufaashfwhwswdcdbrgwszkbyhblrpskirpvnwecnvxytpfnuhnnwujbidpchgvttmuvxdfzliwrpztrrldcrozkgryubbblckrnlirhhlzviusbcivbdyzdktlzdowuaoaxsdnrmvmiaiasorsigqbilwjvcykejaeawcpsywsrxfgfaeausqzofyrofurmfiepqibclikriwtgojqqarpoxjpaoirsxxcyoghpfisktaptafsgsgmnqnljfjyhwhkvaycqyiowqcmjetebdhpsfejqvevyceqtpqlgupxscdrbnnddsdqelqeplzidvcnbudxhmatpesjxemgarijpdixvtovgmtcfvsqlkdctwskxpchgacvocgwsrjdjwnhtsrapgiagfjuolhsjwutjookekjrjzfbgqcempkphuhwrlkutlzndlzvjphpdtlvuywiiwmlzxpvgjccvfoygskzviomchqbpifdnrapkkghsbaetadqqzxzytsngupnjwzmkjswwzmundzyjgqxifjertrqjmiechsjpyryevwltyydibhyxhlbysmtovxskaekdwatdpavbniohopgezdwabvifcjdstlituzynlcoyqblcppfhrnbvdxejokxflijdzogsuxigwwyonzhoadotguuphsilqmlncmrnwkwhqtqdjegbrgqqycelnxgiqhcafsjxnrzmiugvjosjynmmpljlrzyrcvujoejmnajymosbppfbdeejltgfyiiuzdjujcviysqrncokeuglxsdoeeteenrkfvyxptwiywdfdctumobeuyxtqparzaseeonnluxvwclygsutfqowqfupiilmauvuqjjdjnynyqeuyflntqefjoggjkteigeojmthailkifepxutcuswrhetsvizobcdjvxfnyuvhtyinvdkqsmukahhfigtermrbfjzejclfanlxbryyifsabmdvbekehrxcxpceistqhalufowiocxgxvdqhedtmfzybzreyihgrqqckapuxhsiizjjmnmhunulcfylrnuajsleigtfwhtwuosqqsbqtsfjlyvnxwejlupavtaovalhksbemtmuybwrswsewjahdaqophjncyqwmfadzlulmvtodakqsalkrbmvmqhvmoeddxwrdhmhzpjobbwfzqnbawciciauldgvwgriajetjzuzdepngkipfblxgfisjaplttheddjzneimjabohkmegapquvemiykvgeencfgkozvppmevukxiucewbzvtkifrwuquocjjyefloflnghfupihantctjjyzcbbnkzgelbmnzviokrmrbeoukhmssfzsipmrczfnxpbhyeoyqppdawoyawcmtlvzipdaukbecvuxyjmybopeepqlzzbfvxnmuimghcnycjoepiavheudbckqfehbjzzorxgvsclenfugngaxqvatilylrtftjqrvgkeffyubinqtnqbcbgounrfvnzrrdvklwhkugdgzkiybqmjbdykohgqgodztgefddmzxybhqrryagerclvbeketaehgsagkshupoyqldrrzybdywzlwpycaubmxnlnejhwqwgmcihsoytmxqzwvxafmdpagutzvivewnetkausbhwfbybkcuhvuzmlpckmldcpreblymsuddsmlkchitaeequonzwsxmlstyqnkgnahkaaitnxmdphotuizlupgsgzjilffmgrxzmyayslkuipzxcbnnyswarqfvyaxgkghokaprgsmixiogbpnidrzgdntuaqcdhtyqhaiyzazodyjwgwegicrxnfqjgykecgkseorgjzahbmcvhotfxoctvbpjgxffddtsbfvytotlhzelqtsnmcmwhvujmahlshpceqpsumekwfgktkjoseucicinfylhypqxucxkwhazoemrtrhmddebyevjjknpcmynenvvzhzdzrcszolirzmxypdrhmkhaeseoxqcjnkcvfbpdwxkailrhbsqeveyapigcpclagyagcezsqdwssuxcscfqsvwryvllkxkmwoomcvhnwsnbtnpuinuddztilgnsmpiypztiqmnecpiojiskwuyhaqvrptpvhmbkugdafiffzipnxsrlclkmlsuihw\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\nwzyqsmegangagosqlhjeunvymwxwaufduklqaxfjxlucxsfrytluwubykthwogjldenyssvzjqgsygdpuhkhcrseoujfgcqjqmpjtltpmsvjrysjuprhmkmmhcqpbokrllzywrqwehlytbsqjcwsumvzcbjiavbkvxffiwayazszheycjgwlksnurbuszqnvhucapstljlvkzbhdglpnropyrpppczcqbjtshiaqrvnsfyhgyltrigrkrczpeaopnduirvttojcgalesdggzjzypdckhdisngdhssuxbtkhgzrtvjoevzowfhtwjdyscycvuujrhllsgujnzfslxupjpjaraacfowvcuhcnhmypvkhdjjiogceqncctmiaylhrklirdhoqxcfcqydrjjpggqfxwntdrpgyvexfuuygtpzzfpmymujlyuelzfiousohfeztjnvgdafapfjvanavelipystnwvycyfvzyqhwpemtsxmgsltcsqgzucvabuxnrnvqzzoqikmlbiomopyaqaquxifedghxnnvunxfrrarmyohdhbbvnccbpibmmsgjyrorddvkssmwtuvhfelyeiiyucvkgmlpgmpipnebdvsfvgnwwynklqfpkrtuximvujqevhchpymzlyagvnllrewnbgyzugggwgdveaksndtuzptlxcwzxpzbwxhuzlyflrfphsvezgszfatmteobjapvrnvpjekwwztiejflxosukljvjhnpdtjdlzcujloizmpozjadimjynscjjjfkxrtknzqcdtdfcyplnmlqjcsfaoobzsolwirtzfmsrfvvajmolgzvespviysnaigybqfuftwemrfxoprbnugcjnmkfmcxpnojqiijdmxurzmqyiiuhxsvrwguvayxqugxitxncpzjqulgwdjqilsfnhmdjjvuipxadkeflqaodyfplsxopwhzzamwaesdrorfblqjogubsddkxuaisvxdxyehxlbzhomfgwuzkalcydqwzyvpvouegwrnrcbmzmfnutekmydiemkckgplranxbkkerecwukzahnclsslolkbrlsjgfyxysyximmiylypboliuwydoteianjmtlosfvfyduaiwkdbjpdhhjfeyqqjgnkxlxqaabuexkmjfjwzchuyvbghfvpdjwnxjcxiahnyqalsogtjekctqubkyyodoseiztglepuevyaybqfkwuxnzypfzqhndvlilwrtiwancpzowmoletetffvpmwonkwpmjlqypesvacnjlgccdhujynngwonwuwxrojwdrdystxyphzcuksijwbnoigfcyrgntkqtsombeigpljjpxnapjjnryadwglukgjqgyqfjaciviusrsggolowbcndrqrfvrzeurfuwmirtqfnimhqrqkjkticsjbohlsnoxptadklmfnegalviypuxygliuslmrodbnlmwglodcztzixyuknealnkghxfwrydjjuktjzpcbtriarnovgeqzzptceniifkmyylnxipunpvfhclopiqwutfnsbfkerbtyxckjhifrtfinhwmggqoohqocpdhjgznhoilzzwzfezaskyefaqyewmfyfsunwnoygrffssdxlyqqppxpdfolfzczruzuzowkxfbdmtsporqzuvcqaqdzufkllaaebyggjresvthexqvzkwzinrysbquiwtwomxbqnmldjoblbuqpibvygxuxxxkjikawjmfesijmgorjhzuoygrllsddikkpvsiihqwqkjmyzxqyxtughzjlzqrwmydolkovwhphhopcwbqmmbhlontytdrmtghgchruyztyoogutmqensvendjnzljwzwxvilqrcvsbmnvkzraqzqvzifemgaedeqsrwmjhlpkbmnrofnebzzbrzqtclpifzgduldkyvcasvxhpzivikrirdmyccwcqcvrjtqyikbfyusxyrbmdyysjxlsivkbhaejsccnypedhqgnrgcvmgapthposaryfytwrpgkfjrgnvjqhftbpmqmwumsbavogstsvacgiaftetznporifcgwpykgekqqambtfayzlolnvtakfqfwjboyoxyivtkkmnnsvkftmgnkqssxdbbuiexyxjkpkhlvtlzhzafitvhsoyjjtxxjqzcgviaacywknowtcsyythemlkyjchmsbfhcasxrcnznkcmdfxehbcdnhyofxapukeapqmujokhyflbbaazvpnmbfarshaqavugklipfcaaeffhtpxpfhjpmwhxymdrbxzgfnpjlvlavmdmgpexoekbrhapzyftllfkdipmporndipcjnivmriydwzgecybzzofsjoulnofmaywsfdcvyoogjeoeeynjpzrorenkeokohdcfeurqaazqcevrbsztpkursjjpgbzvtidywokklxtqweobbmmqsvtzkdsysygeedvwpunhlwityoypgmvzlrhugdboujujvptkwhbbytbjoihaetwgtzdnujoyqfjhhfghigrtewhyfbzyfwiuwnvqxlbivntfwlxzbwfpjykrwcbdpbrfukzloqlsrzcdifrilrvmowwxfnwzhijjyspxldtsxjklajjncxtnlewqugeylqhxovalcyxbqtrdbyzuclygeomotataiisepfjvyykggosajtcormtdkttezeyvyqwrqsmspgwxlhxhwphscatbysspfwembfbodohvyopxpqjbtkawlxwtovvnrcjwztyhkyhkccllyyaonmlysaoxbaokyntvgwqqlihfmaqbqcaitcnxqvybtwankaveonvenetsrfadpaeamygiwvyqasgnnzcpkjnejpkcgiizccnsllctghxxzswepicymirsqawwgheyweqrjenykbgkzccegizwtyomipxyxpgfbrxqwvddjfznxjpigiccbusntpspxltwraibwukfqyabjuinamkimtriykwjrxoafinemxhxprgdxfnxyyfaquxzlgvenbdowlhptjueqwdpjaawmhfrxhqpdvhlsjdckjfxlhksypztswmbvktajqumhpqbhkfuvrprgmjlcdquvgbtqnkfnbjutowxspkeazuhfyaaiysoemoudbqqtxsmnhhbdgzfokhuztsjvgblzecszafqedmpzeoprclkfuihagybvpedrlyslccmhpfecppbxnazpvlyivjpcpwynslbbcsoydalndmkxhfxvdolgxmvlgfwnvuftzldhczmetcjtcwrfmirrnthpvxaimiudppnqdotcvkucqhnmwqqrpniarddeyblasdkgketqcswkzfxdyakvlpjmwbhpqffbvqnergpyyyjbsnnsgfxledewacerknyijmfsxurkpnvlfzunjmlzkfddszbuuasiahgvzqrdkacsxidfdzmsttkgoupuvmspmoucvfcrabqawjkdvefpzgkwtpgiprxlckwzucrdonvyaymncfsqqlyiwxumfqvebjhsubmyayiprhqblvorcxldxmewypeknhznvuunoyrttiqcvhshwuzzgakdcvffwdevqaxhiwkkmskfzjqpucwrqrtsnvnghcshemzzrzspziswjuwbjmvdqtunavmtnulxmmvvkymegurlylfpmaghgmxrkrgeqjvclceyjlmexxqxfcdslbsgeximdygwkodparnjhuhythnpsvcpqhkrbsgqrzxiuofcsmkcoxigrozvhamasusmnmygcazshplxxpvjqnnanxtniinrrqunvkixmxadorkayoqjsjghmpnkymnltrbdackgtvvcuzbwdguyjpnqdhxloqlhypihlglprzhxebceagalkhdzkjfiebtdsrnjfnokzbaovwxyeimvzknuxrwvbkejjvcgvtvpcpyxrpnlehununlysrtlgqhgowheelyxyaqtawzokjvcvuwvgmiwxgihnzfhgcohnmdzntbnqqefbiatuhkdyrxupgnspjwnaztldnhezftkprvseuizirovvraogfcxoxqwyteoejfsplfwdskofxgpfkafhvoqxajozftpvucgdnazhvwclnkvxcfldsxxpsnvonovjiiioqoiexqkswwjiksvvopojccjxedowgwqxiouspvbecbhilvynvniehsqzdvwupzfiretvqcmjfmimvjzlyapsnikzarrafoxqhwrlzbqyxdptanvqdbfdgzczlxqrgzuwexnrqtqbswmerfvtzbeyxfgzlwtsxuetgitpbjnnwitgczeglrckfgxsfixoxtrgypiysvzyivfaumwjnwdjcxhtfzmcnbviizzucpkaktxbvvwfxkefqveglocjclbzkaufafjtzktpbachkhfhienvwwrhhnrilmrlagjjfghgqhaxqewewwxvlxfpzrcnaxxknjeaufupyhdlrysufyjnmvstqclwtzyenyqdcmhaxscgbninsftzbjrzpbowygroiogsnbecamreazwefzfjtysycwtegflsectqnhnehfyrqfdrykhyxfixhgruastnfshcbxfyvnwzsfjjomopdnzqfxqzouopvgqmztjshwcauyivuxlolpxvzfidjvnungxocdvofxusbpfryzsxsgortkrcvlhjvnwiayfrbksmccxbiigtjsintmfielcxzscxbiqebwfvtrxkznfpgglfejklrqsdwjgezdjieiydgtbfdxtrdgyivaphhvcvvbgrqdqhxklgwhhuhsazxsjysfmfloqdqrwjwmdhnylzavfpmquqjzvjhmazftbvknprosvxkvqikxutrqpdjcecxkydhoqwxponscxvqoaqqiprjlmaldictguwxcpddlftrufykdeyqxqljnxxwgzfneshiaaoauychfxbaslmbcpfy\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5000\ncdhzsbjbwxyhmsywzgkqgmivydggjhqivmbcscckpxoincutgipwxrppxyxcxxdhrszfcperwolpvuyaiyhngobinucvfzescpepqapoxyxzsiihekuflqiosddxtszqwjcbnmozfdodabuaqnclbxsnsnwzdyrhektnagjretarpdbgacavnlxnvnevydjvlpajfkyjitdyfwomotkrurnlgbngmhvlrumwlgipnpgcbipwzghyyesdthyvugtrmtrpwciyvufzhplnskhxrorevqgoziayfpleelosurkwnpohrgkmslehtdmtmcvzljnbumqrbkuwkduitywareowpodvqaguibitjfzaozavjqhkpkrifegnltogcixtmykznnuqdnuleirnxhfiujwgyziejdjxilbzalrxlwncinutjqvgaloynnjdvmndziuvzvtzzaxevyttlnxohrdmazfnafdzftislzwrzxwzxdcxuiapfslfhjhwtrdnwghzgzkizfiomlkxlitukwoxzgjfzkysxktcsqyuigxpcvtaydgfplygajozomztnehrgndrprzclndryunviqbfmqdqooqogkcphcdsikbiyjwsygufiahwfqgscnnrgdgpcuaysglkvemacwwdyjzuxnxqbwpdolnxuouengnkfxlredwboxbjejbkvrqixsupgsfrrmsqcakfuqivwpsdjvvpcgltvwymvwhqcaxroblkrmturwzccuhcrfbbwxetnsjswxkcojwagvqddymimclfajidlrvmdjhpfzknnecnnrrcahptkbsswbsitvazlgxgquhzkuukvpymgunqexfwsxexerivvzethipqjdqhroluzuqdiaqdkfzfqvlpgbpyijfiaffwnmzyhzjxhonvuehcimrhhpsgwpkkvegwhhhujhznyqekdngcvfdjqdxkgtddbjnslouwhdhzbawykgguzwkypndwgzigpbmwsyenoualquwnloxboywvbsnomqrblgbnjztadgfbidhqihzjvukshmrtbnmoaexseripkzzmtcnvunweteqhpjwuoqcdawxyipnnlmojdjgxsylpyouhpduhzxmftchiectjmqcxaoblccfwsyrjkgxkvduftderweefshuuywzpclkayfijzsaceonnqenlezwrgfwsbqsztkuipupfoauockzbupynyclrnpzusgaetvmwhnuuomvojdkusetbvfxydaqidmwibqfkyrocjrxsnrfhyeavabyzocztxvygkyjtrmkmfzfpaerawtssbnjovxsvzoptaeaaroizhuksnjduzegrlhqiqcnelxgyzcpvsvybwkxtawdlqiaudporocnshnpefrvwqdrkabrifonvlerclislpnxvyyowgdeakqwjjfxirutdpzlyvngkqjyrjkyfwocmflpbchuwbkgsfeeavugqsgsvqootzlyedqmumpmshevqswaeunijyqfzdxyuolvyyayebgitozehxxfcvjpsftikxrgzyrtvjjeuvsizqxmnpvhzexwnabfjgapqfpwhtzyxglkipmtictlmmjvrtpnmgffsphvycbcvkxvxcmjundttoftkzmtdldecnzvakqvaxgizwpdykeuhuwhmbspwdpgqmiolwtozzklivvewqfyqwtdffpniuydkkjyjbovltwgkfvtelmpmwilrxokyvjzxziofxdqesqucgnppbpdotpbcccybpbtdqnhsuuimoxalgqxmpxktopuxevlzkesopfxynguxecadphmrwzucrndyxthowfyixxqtrgqtejnuamgcjpwbxhgsblufoujxdrzauaogmcpxbxueencmjleleuwuybwffwujuxletlihgdukxeendiazsmqyvdtrfaqxwhukorpkgqkwagjlbigmyagtklldmvanlypxrjrcgipbupejpswasixltbhqppmxzstdifjbwfityzhteddllaiicfrhmykfwlqosgyttzdwkapqnaxomvngmenqfctenralejnkngbkxohkusuzxqolnnghhiizdvkrcmjcizolxcxvsycjkfsijortdelgmzhmmnmelseluzhiudhwdkprysaldeadawnkbwflnyjtmfzcqldsrmrhsxrtxfenwysskqwrmuzpzeeemgbvpwwdptzloyydnlzvbghxqeihlxhsqrrziowdolwxxzkpxixtdubdfybcpsguxnmwgyzpuonqwnudqmuqmfztrdobpuismyqbhrmptinzzsbebsodwmbwadjuhuupfepyairshlzddigqrgcdifdxhsxbmksuhgxuhxdvzqcuwshmqehqnegwcobthswvxvgpvwhhnybgajktoadejdvjzljlyxytnjkrlcpuoovqrwweupkourebhzinkidkdyoerglyrjmoznkexsnbztwbxnykcxksprowzgowiowdsykorrjpnnnzjzjagobtozzpvaiofceubputanwkaexfmsjxoyfjhiqsmtqrldnpzfrhnxyrcvnaufksspiquqfzjifjasnwwvasfswzhymbnqsitbgpmaomehkoqzukmhnvmftgtrmayteysgbcyulaciyehelnmzcdqlqsuwrnowsjrwlhszbgeiexrwexvkcoeykidihxvayuvvkxqsnygobrwaiudpyetfkdaksjfuxiqsfbtrxdsudzbumogsucpmfhdxyfifeviuelbysivoyxjauxbqkimafutrikojjmlxysgezvnznkolsycflfllyllkqsbcxbxlhyigokscapqczcatyeztxjfvelcxscylnlvebnsxwuszqtykfbyonwjkpibcgkxruxjevjnekvwxpnqkcmqwkuaemcworcqmskrfwzxeqmrgqbuheecbxqpfrtwmrmdlhohsubvigooosnbsdktqwxwlozmicydgkesdjqbsuslqnguduylthxvsafkanxhtlewyhxyubaizvvrccyuyhgzggefoeupjaetaughfexszuasszhluzdbhkctltbqucbhyjlkeiepwopykpohgnfbihvwgnnsvgyemisvdntbdhbwoileepytbnqvobipfwxqumktinwgxoyshkekrgqevoijlvulvznyfjooirqeuwoenrqmyjingllihyjmiyqcqdqygddlozzhatxbbyvcitdixyrohdydhwlxmezgrjborjtvkdlyzgihfpscjuhfcgejojqipfqjzwoqttortwqtaalyolpguhlopeojoffgrkgnrnjngdtypgkowjcuhykdcftnrycqfvtvxznnhrhfsizlcjhvatfwfdexafqrxsqulbmgumhajgjywtkrazlegijxbugszguksyqguzcraothtejvmfvuwghavdusczpwaxodzuczkybvcwnpptvcmljpjxgmvptxxsystzwlcbrltzzaujssybpmjdpfyvpfddxwmrazzgujydhewhduqsvbdlpmlkfqqxqkkxmmrbvbiwgzbaobbtfvgbrqjswxmnjblfdcybaxkiuzpdxkqaicxqwxfplvunawotmrpkcgiipmzuakdintuqzzpyigcfwyhsfcoejrcajakygdsemdlyvvugxjciifnrwquydknhikywqtgykftzrighpgbzemhaiuyrhszxyyfsybqogqbewozvhdisgdxycpycozyqcrauntetwzlsenrpjzznhcxlkoqttfuwyhcltobtazewdwkehbvxcopnqgacjizdemrzemdyzichmbwosbbzlaifjvlhlofxdgnqspwgnmldbvgnvvbhgydiggajgzpfwxxsprvzuaskvlkeusbyeaielnohwaorhpovdwjduyallnkghrhqilebskjzcvmedbmdpusjpxhvjntltocdusiaeuvwsirwrnznhmghdcjyrgopynjiolyusqrscqadqmaviymstpugsnpptvcqhkqckitpxenqfqfqkhjvvwsoiypzdhetwyaidvuguurgpnjidyliyihafnwibxhrnirgbtvyrzfksxptnvinvbalffebovvtysoeouyoivbunsnbcuftqqnmoroalwmwovndlxvvemlyyyxsaytodcanufhpphmqcrbafrcuckykrwwqyfwhiqawirkvuotzikxxehakudjptinmydmvydamgqbvatewqdvosyuzbloevlmofwobumkgjtmzuxrwrlhogtpgvllnlvtdjsngqqawyidtbxrjqsdwzvxvihihacpsojvhhfjajxrwlliddgmqlemqqumdhynviyycuvqfmvblqrefisrgqplkvwkzurpsvpbajtbrykbszsuawvmfnwocfnbxlfvrnhtimjywcxdruvtwsfmynleqfahvqfyflvmoigqawjgtkyypisytexspfeeowjltlbqovzktinpjctvwafangvixfihhuycbcxovnywvqushshcollqiudueeuwueytkqfrautlhflkfizzqohnejsqyfgosxrzdjqlfgjhyczbupzvxhqpsaujxusctbdfihlwsxecumufxsnzqefmroxcjddqnsytbkbtnovpvrwkuvutkibkaemclxaoktermwcthjfngxgypohcbmmlyhcfxhvhevkskywktrvgdtvdnoaifezrsnmlrpfmjfyyoqakytwihnrszmdtlcarbjbxmmsjgbfyxjekojbodqitjopxcjhzdpshliuinxdvdzbzxvnhthnijwnkqyzmdzsikjhiblazkyxjghiwvofaozfygzxkrqxwsmdnaeaepjzqtoewsjsazpxaegrxxxcixyaskdzygpyvjbuazdmiucqkggtvqqjvnyngdyznmnblbsuhgosxpkzrxisunh\n", "output": "6\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
231
Solve the following coding problem using the programming language python: The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 1 to n - 1 in the order from the beginning of the street to the end (in the picture: from left to right). The houses with even numbers are at the other side of the street and are numbered from 2 to n in the order from the end of the street to its beginning (in the picture: from right to left). The corresponding houses with even and odd numbers are strictly opposite each other, that is, house 1 is opposite house n, house 3 is opposite house n - 2, house 5 is opposite house n - 4 and so on. [Image] Vasya needs to get to house number a as quickly as possible. He starts driving from the beginning of the street and drives his car to house a. To get from the beginning of the street to houses number 1 and n, he spends exactly 1 second. He also spends exactly one second to drive the distance between two neighbouring houses. Vasya can park at any side of the road, so the distance between the beginning of the street at the houses that stand opposite one another should be considered the same. Your task is: find the minimum time Vasya needs to reach house a. -----Input----- The first line of the input contains two integers, n and a (1 ≤ a ≤ n ≤ 100 000) — the number of houses on the street and the number of the house that Vasya needs to reach, correspondingly. It is guaranteed that number n is even. -----Output----- Print a single integer — the minimum time Vasya needs to get from the beginning of the street to house a. -----Examples----- Input 4 2 Output 2 Input 8 5 Output 3 -----Note----- In the first sample there are only four houses on the street, two houses at each side. House 2 will be the last at Vasya's right. The second sample corresponds to picture with n = 8. House 5 is the one before last at Vasya's left. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, a = list(map(int,input().split())) if a % 2 == 1: print(a // 2 + 1) else: print((n-a) // 2 + 1) ```
vfc_10678
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/638/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 100000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 2\n", "output": "50000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 99999\n", "output": "50000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3000 34\n", "output": "1484\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24842 1038\n", "output": "11903\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1628 274\n", "output": "678\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16186 337\n", "output": "169\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24562 2009\n", "output": "1005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9456 3443\n", "output": "1722\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5610 332\n", "output": "2640\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1764 1288\n", "output": "239\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "28588 13902\n", "output": "7344\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92480 43074\n", "output": "24704\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40022 26492\n", "output": "6766\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "85766 64050\n", "output": "10859\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67808 61809\n", "output": "30905\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "80124 68695\n", "output": "34348\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95522 91716\n", "output": "1904\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7752 2915\n", "output": "1458\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5094 5058\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6144 4792\n", "output": "677\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34334 20793\n", "output": "10397\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "23538 10243\n", "output": "5122\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9328 7933\n", "output": "3967\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11110 9885\n", "output": "4943\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "26096 2778\n", "output": "11660\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "75062 5323\n", "output": "2662\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "94790 7722\n", "output": "43535\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90616 32240\n", "output": "29189\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96998 8992\n", "output": "44004\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95130 19219\n", "output": "9610\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92586 8812\n", "output": "41888\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3266 3044\n", "output": "112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5026 4697\n", "output": "2349\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3044 2904\n", "output": "71\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6022 5396\n", "output": "314\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31270 25522\n", "output": "2875\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82156 75519\n", "output": "37760\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34614 27913\n", "output": "13957\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "88024 61143\n", "output": "30572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91870 55672\n", "output": "18100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "95718 4868\n", "output": "45426\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99564 358\n", "output": "49604\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "89266 13047\n", "output": "6524\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "90904 16455\n", "output": "8228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "94750 13761\n", "output": "6881\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 23458\n", "output": "38272\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 23457\n", "output": "11729\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59140 24272\n", "output": "17435\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9860 8516\n", "output": "673\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25988 2733\n", "output": "1367\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9412 5309\n", "output": "2655\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25540 23601\n", "output": "11801\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76260 6050\n", "output": "35106\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92388 39118\n", "output": "26636\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8516 5495\n", "output": "2748\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91940 37847\n", "output": "18924\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30518 286\n", "output": "15117\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46646 19345\n", "output": "9673\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
232
Solve the following coding problem using the programming language python: There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout the galaxy. It is well-known that the success of any peacekeeping mission depends on the colors of the lightsabers of the Jedi who will go on that mission. Heidi has n Jedi Knights standing in front of her, each one with a lightsaber of one of m possible colors. She knows that for the mission to be the most effective, she needs to select some contiguous interval of knights such that there are exactly k_1 knights with lightsabers of the first color, k_2 knights with lightsabers of the second color, ..., k_{m} knights with lightsabers of the m-th color. Help her find out if this is possible. -----Input----- The first line of the input contains n (1 ≤ n ≤ 100) and m (1 ≤ m ≤ n). The second line contains n integers in the range {1, 2, ..., m} representing colors of the lightsabers of the subsequent Jedi Knights. The third line contains m integers k_1, k_2, ..., k_{m} (with $1 \leq \sum_{i = 1}^{m} k_{i} \leq n$) – the desired counts of lightsabers of each color from 1 to m. -----Output----- Output YES if an interval with prescribed color counts exists, or output NO if there is none. -----Example----- Input 5 2 1 1 2 2 1 1 2 Output YES The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python s = input().split() n, m = int(s[0]), int(s[1]) cl = list(map(int, input().split())) com = list(map(int, input().split())) res = False for i in range(n): for j in range(i, n): e = True t = cl[i:j+1] for k in range(1, m+1): e = t.count(k)==com[k-1] and e if e: res = True break if res: print('YES') else: print('NO') ```
vfc_10682
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/958/F1", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5 2\n1 1 2 2 1\n1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1\n1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1\n1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n1 1\n2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n1 2\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 1 3\n0 1 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n2 3 3 2\n0 0 1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 2\n0 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 1 3\n0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n2 4 4 3\n1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n3 1 1\n1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 3 1 4\n1 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n3 1 1\n2 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n4 4 2 2\n1 1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n1 2\n0 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n3 2 3\n0 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 2 4 2\n0 0 1 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 1\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n2 2 1\n1 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6\n5 1 6 3 3 2\n1 1 2 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 2 1 1\n2 1 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n5 3 5 2 5\n0 0 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6\n1 2 2 4 6 1\n1 0 0 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n2 2 4 1\n0 2 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n1 5 3 5 1\n1 0 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6\n5 4 4 3 4 6\n0 0 1 1 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 3 4 4\n1 0 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n2 5 2 5 3\n0 0 1 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6\n5 6 5 6 3 5\n0 0 0 0 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n4 3 4 2\n0 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n4 2 1 1 3\n1 1 0 1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6\n1 5 5 1 1 6\n3 0 0 0 2 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n2 3 2 2\n0 3 1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n2 1 5 1 2\n2 1 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 2 1 2 2 1 1 2 1 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 2 1 1 1 1 2 1 2 2 2 1 2 2 1 2 1 2 2 2 1 2 1 1 1 1 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 1 2 1 2 2 1 1 1 1 2 1 1 1 2 1 2 2 2 1\n3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 2 1 2 2 1 2 2 1 2 2 1 1 1 2 1 1 1 2 2 2 2 2 2 2 2 1 1 1 2 1 2 1 2 2 2 2 1 2 2 1 2 1 1 2 1 2 1 2 2 2 2 1 2 2 1 2 2 1 1 1 1 2 2 2 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 1 1 2 2 2 1 1 2 1 1 1 2 2 2 2 2 1 1\n3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 1 1 1 1 2 1 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 1 1 2 2 2 1 1 1 1 1 2 2 2 2 1 1 2 2 2 2 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 2 2 2 2 1 1 1 2 2 1 2 2 2 2 1 1 1 2 2 2 1 1 1 2 2 1 1 2 1 1 1 2 1 1 2 1 1\n3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 1 2 1 2 1 2 2 2 1 1 1 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 1 2 1 1 1 1 2 2 1 1 1 1 1 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 2 2 1 1 2 1 1 2 2 1 2 1 2 1 2 1 1 2 1 1 1 1 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 1 1 1\n4 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 2 1 2 1 2 2 1 1 1 1 1 1 2 2 2 1 1 1 2 2 2 1 1 2 1 2 1 1 2 1 1 1 1 1 1 2 1 2 1 2 1 1 1 2 1 1 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 2 1 1 2 1 1 1 1 2 2 1 1 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 1 1\n1 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 2 1 2 2 2 1 2 1 1 1 2 2 1 1 2 2 2 2 1 1 2 1 1 1 1 1 2 1 2 2 1 1 1 1 2 1 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2 2 2 1 1 1 1 2 1 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 2 2 2 1 2 2\n0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 2 1 1 1 1 1 2 2 1 1 1 1 2 1 1 2 2 1 2 2 1 2 1 2 2 1 2 1 2 2 1 1 2 2 1 2 2 2 1 2 1 2 2 1 2 2 1 2 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 2 1 1 1 1 2 2 1 1 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 1 2 1\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 1 1 1 1 2 2 2 2 1 1 1 1 2 1 2 1 2 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 2 1 1 1 2 2 2 1 1 1 2 2 1 1 1 2 2 1 2 2 1 2 1 2 2 2 1 1 1 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 1 1 2 1 1 1 1 2 1\n0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 1 1 2 1 2 2 1 1 1 1 1 1 2 2 1 1 1 1 2 2 2 2 1 2 2 1 1 1 1 1 2 1 2 1 1 1 1 2 2 1 1 2 2 2 1 2 2 2 1 1 2 2 2 2 1 2 1 1 2 2 1 2 1 1 1 2 2 1 1 1 1 2 1 2 1 2 1 2 2 2 1 1 2 2 2 2 1 1 1 1 2 2 1 2 1 1 1\n44 55\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 2 1 1 2 1 2 2 1 2 1 1 1 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 1 2 2 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 2 1 1 1 1 2 1 2 1 1 2 2 1 1 2 1 1 1 2 2 1 2 2 1 1 1 2 1 2 1 1 2 2 1 2 2 2 1 1 2 1 2 1 1\n50 49\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 1 2 1 1 1 2 1 2 2 1 2 2 1 1 1 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 1 1 2 2 2 2 2 2 2 2 1 1 1 1 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 2 1 2 2\n52 47\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 1 1 2 2 1 2 1 2 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 1 2 2 2 2 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 1 2 2 1 2 2 2 1 2 1 2 1 1 2 1 2 1 1 1 2 2 2 1 1 1 2 2 2 2 1 1 2 2 2 1 1 2 1 2 2 2 2 1 1 1 2 1 2 1 1 1 2 1 1 1\n2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 2 2 1 1 1 2 1 1 2 2 1 2 2 2 1 1 2 2 1 1 1 1 2 2 2 2 1 2 2 2 2 1 1 1 1 2 1 1 1 2 2 2 1 1 1 2 2 2 2 2 2 1 2 2 2 1 2 2 1 2 1 1 1 2 1 2 2 2 1 2 1 2 2 1 2 2 2 2 1 1 2 1 1 1 2 1 1 2 2 1 2 1 1 1 1 2 1 1\n4 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 1 1 1 1 2 2 2 1 2 2 2 1 1 2 1 1 2 1 1 2 2 2 2 1 2 1 2 2 2 2 1 2 2 1 2 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 2 1 1 1 2 2 2 1 2 2 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1\n2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 2 2 1\n2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 2 2 2 1 2 1 1 2 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 1 1 1 2 2 1 2 1 1 2 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 1 1 2 2 1 1 1 2 2 1 1 2 1 2 1 2 2 2 1 2 1 2 1 1 2 2 2 2 1 2\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 1 1 2 2 1 2 2 1 1 2 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 1 2 1 2 2 2 2 1 2 1 1 2 2 2 1 2 2 1 1 1 1 1 1 2 2 1 1 2 1 2 2 2 1 2 2 1 1 1 1 2 1 1 2 1 2 1 1 1 2 2 2 2 2 1 1 2 1 1 2 2 1 1 2 2 1 1 2 2\n0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 2 1 2 2 2 1 1 1 1 1 2 2 1 2 2 2 2 2 2 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 1 2 2 2 2 1 1 2 1 1 1 1 1 2 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 2 1 2 2 1 2 2 2 1 1 1 1\n0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 1 1 2 2 2 1 2 1 2 1 1 1 2 1 1 2 1 1 2 2 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 1 1 1 1 2 2 2 1 1 1 2 2 2 1 1 2 2 1 2 1 2 2 1 1 1 1 1 2 2 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 2 2 2 2 1\n52 47\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n1 2 2 1 1 1 2 1 2 2 1 2 2 1 1 1 2 1 2 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 1 1 1 1 2 2 1 1 1 2 1 2 1 1 2 1 2 2 2 2 2 2 2 1 1 1 1 2 1 2 1 1 1 2 2 1 1 2 2 2 1 1 2 1 2 2 1 2 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1\n54 45\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 2\n2 2 2 1 2 1 1 1 1 2 1 1 2 1 2 2 2 1 2 2 2 2 1 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 2 1 1 1 2 1 1 2 1 1 2 1 1 2 2 1 2 2 1 1 1 2 2 1 2 1 1 1 1 2 2 1 2 1 2 2 1 1 2 2 2 2 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1\n47 52\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10\n2 9 6 4 10 8 6 2 5 4 6 7 8 10 6 1 9 8 7 6 2 1 10 5 5 8 2 2 10 2 6 5 2 4 7 3 9 6 3 3 5 9 8 7 10 10 5 7 3 9 5 3 4 5 8 9 7 6 10 5 2 6 3 7 8 8 3 7 10 2 9 7 7 5 9 4 10 8 8 8 3 7 8 7 1 6 6 7 3 6 7 6 4 5 6 3 10 1 1 9\n1 0 0 0 0 0 0 0 1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10\n2 10 5 8 4 8 3 10 5 6 5 10 2 8 2 5 6 4 7 5 10 6 8 1 6 5 8 4 1 2 5 5 9 9 7 5 2 4 4 8 6 4 3 2 9 8 5 1 7 8 5 9 6 5 1 9 6 6 5 4 7 10 3 8 6 3 1 9 8 7 7 10 4 4 3 10 2 2 10 2 6 8 8 6 9 5 5 8 2 9 4 1 3 3 1 5 5 6 7 4\n0 0 0 0 0 1 1 0 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10\n10 8 1 2 8 1 4 9 4 10 1 3 1 3 7 3 10 6 8 10 3 10 7 7 5 3 2 10 4 4 7 10 10 6 10 2 2 5 1 1 2 5 10 9 6 9 6 10 7 3 10 7 6 7 3 3 9 2 3 8 2 9 9 5 7 5 8 6 6 6 6 10 10 4 2 2 7 4 1 4 7 4 6 4 6 8 8 6 3 10 2 3 5 2 10 3 4 7 3 10\n0 0 0 1 0 0 0 0 1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10\n5 5 6 8 2 3 3 6 5 4 10 2 10 1 8 9 7 6 5 10 4 9 8 8 5 4 2 10 7 9 3 6 10 1 9 5 8 7 8 6 1 1 9 1 9 6 3 10 4 4 9 9 1 7 6 3 1 10 3 9 7 9 8 5 7 6 10 4 8 2 9 1 7 1 7 7 9 1 2 3 9 1 6 7 10 7 9 8 2 2 5 1 1 3 8 10 6 4 2 6\n0 0 1 0 0 0 1 0 0 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n48 88 38 80 20 25 80 40 71 17 5 68 84 16 20 91 86 29 51 37 62 100 25 19 44 58 90 75 27 68 77 67 74 33 43 10 86 33 66 4 66 84 86 8 50 75 95 1 52 16 93 90 70 25 50 37 53 97 44 33 44 66 57 75 43 52 1 73 49 25 3 82 62 75 24 96 41 33 3 91 72 62 43 3 71 13 73 69 88 19 23 10 26 28 81 27 1 86 4 63\n3 0 3 2 1 0 0 1 0 2 0 0 1 0 0 2 1 0 2 1 0 0 1 1 3 1 2 1 1 0 0 0 4 0 0 0 2 0 0 1 1 0 3 3 0 0 0 0 1 2 1 2 1 0 0 0 1 1 0 0 0 3 1 0 0 3 1 2 1 1 2 1 2 1 4 0 1 0 0 0 1 1 0 2 0 4 0 1 0 2 2 0 1 0 1 1 1 0 0 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n98 31 82 85 31 21 82 23 9 72 13 79 73 63 19 74 5 29 91 24 70 55 36 2 75 49 19 44 39 97 43 51 68 63 79 91 14 14 7 56 50 79 14 43 21 10 29 26 17 18 7 85 65 31 16 55 15 80 36 99 99 97 96 72 3 2 14 33 47 9 71 33 61 11 69 13 12 99 40 5 83 43 99 59 84 62 14 30 12 91 20 12 32 16 65 45 19 72 37 30\n0 0 0 0 0 0 2 0 0 1 0 0 0 2 1 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 2 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n46 97 18 86 7 31 2 100 32 67 85 97 62 76 36 88 75 31 46 55 79 37 50 99 9 68 18 97 12 5 65 42 87 86 40 46 87 90 32 68 79 1 40 9 30 50 13 9 73 100 1 90 7 39 65 79 99 86 94 22 49 43 63 78 53 68 89 25 55 66 30 27 77 97 75 70 56 49 54 60 84 16 65 45 47 51 12 70 75 8 13 76 80 84 60 92 15 53 2 3\n2 0 0 0 1 0 1 0 3 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 2 1 1 0 0 0 0 1 0 1 2 0 1 1 0 1 2 1 0 2 2 0 0 1 1 2 1 0 0 0 1 0 0 1 0 3 1 0 3 0 1 0 0 1 0 2 0 1 1 3 0 0 0 0 1 0 2 2 0 1 2 0 0 0 1 0 0 2 0 2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n52 93 36 69 49 37 48 42 63 27 16 60 16 63 80 37 69 24 86 38 73 15 43 65 49 35 39 98 91 24 20 35 12 40 75 32 54 4 76 22 23 7 50 86 41 9 9 91 23 18 41 61 47 66 1 79 49 21 99 29 87 94 42 55 87 21 60 67 36 89 40 71 6 63 65 88 17 12 89 32 79 99 34 30 63 33 53 56 10 11 66 80 73 50 47 12 91 42 28 56\n1 0 0 1 0 1 1 0 2 1 1 1 0 0 0 0 1 1 0 0 2 1 2 0 0 0 0 0 1 1 0 2 1 1 0 1 0 0 0 1 2 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0 2 0 1 2 1 0 0 0 1 0 1 0 1 1 0 0 2 1 0 0 0 0 0 1 2 1 2 0 1 0 0 1 0 0 0 0 2 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n95 60 61 26 78 50 77 97 64 8 16 74 43 79 100 37 66 91 1 20 97 70 95 87 42 83 54 66 31 64 57 15 38 76 31 89 76 61 77 22 90 79 59 26 63 60 82 57 3 50 100 9 85 33 32 78 31 50 45 64 93 60 28 84 74 19 51 24 71 32 71 42 77 94 7 81 99 13 42 64 94 65 45 5 95 75 50 100 33 1 46 77 44 81 93 9 39 6 71 93\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n20 7 98 36 47 73 38 11 46 9 98 97 24 60 72 24 14 71 41 24 77 24 23 2 15 12 99 34 14 3 79 74 8 22 57 77 93 62 62 88 32 54 8 5 34 14 46 30 65 20 55 93 76 15 27 18 11 47 80 38 41 14 65 36 75 64 1 16 64 62 33 37 51 7 78 1 39 22 84 91 78 79 77 32 24 48 14 56 21 2 42 60 96 87 23 73 44 24 20 80\n2 0 0 0 0 0 1 0 0 0 1 0 0 2 1 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 2 2 0 0 0 0 0 0 0 0 0 1 1 1 2 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n14 95 7 48 86 65 51 9 5 54 22 58 93 72 31 65 86 27 20 23 24 43 5 78 12 68 60 24 55 55 83 18 1 60 37 62 15 2 5 70 86 93 98 34 45 24 69 66 55 55 74 77 87 55 83 27 46 37 55 12 33 91 1 23 4 78 74 97 8 25 63 63 9 16 60 27 41 18 42 84 35 76 59 8 33 92 40 89 19 23 90 18 30 51 42 62 42 34 75 61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n94 78 24 48 89 1 2 22 11 42 86 26 7 23 94 100 82 27 24 28 98 62 12 53 67 43 33 45 13 1 80 99 3 79 71 20 26 35 20 69 45 52 39 48 23 3 80 43 60 90 66 43 54 40 93 35 13 20 90 47 55 39 79 2 61 95 83 60 53 4 55 3 33 74 17 38 78 83 83 94 34 43 34 99 46 71 42 58 65 94 65 64 70 88 49 39 2 36 10 55\n0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 1 1 1 0 0 2 0 0 0 1 0 0 0 0 0 1 1 2 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 3 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
233
Solve the following coding problem using the programming language python: Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they started playing the game. Rules of the game are very simple: at first number of rounds n is defined. In every round each of the players throws a cubical dice with distinct numbers from 1 to 6 written on its faces. Player, whose value after throwing the dice is greater, wins the round. In case if player dice values are equal, no one of them is a winner. In average, player, who won most of the rounds, is the winner of the game. In case if two players won the same number of rounds, the result of the game is draw. Mishka is still very little and can't count wins and losses, so she asked you to watch their game and determine its result. Please help her! -----Input----- The first line of the input contains single integer n n (1 ≤ n ≤ 100) — the number of game rounds. The next n lines contains rounds description. i-th of them contains pair of integers m_{i} and c_{i} (1 ≤ m_{i}, c_{i} ≤ 6) — values on dice upper face after Mishka's and Chris' throws in i-th round respectively. -----Output----- If Mishka is the winner of the game, print "Mishka" (without quotes) in the only line. If Chris is the winner of the game, print "Chris" (without quotes) in the only line. If the result of the game is draw, print "Friendship is magic!^^" (without quotes) in the only line. -----Examples----- Input 3 3 5 2 1 4 2 Output Mishka Input 2 6 1 1 6 Output Friendship is magic!^^ Input 3 1 5 3 3 2 2 Output Chris -----Note----- In the first sample case Mishka loses the first round, but wins second and third rounds and thus she is the winner of the game. In the second sample case Mishka wins the first round, Chris wins the second round, and the game ends with draw with score 1:1. In the third sample case Chris wins the first round, but there is no winner of the next two rounds. The winner of the game is Chris. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python x = 0 y = 0 for _ in range(int(input())): a, b = list(map(int, input().split())) x += (a > b) y += (b > a) if x > y: print("Mishka") elif y > x: print("Chris") else: print("Friendship is magic!^^") ```
vfc_10686
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/703/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3\n3 5\n2 1\n4 2\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n6 1\n1 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 5\n3 3\n2 2\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n4 1\n4 2\n5 3\n5 1\n5 3\n4 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n2 4\n1 4\n1 5\n2 6\n2 5\n2 5\n2 4\n2 5\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n4 1\n2 6\n4 2\n2 5\n5 2\n3 5\n5 2\n1 5\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n1 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n1 2\n1 2\n1 2\n1 2\n1 2\n6 1\n6 1\n6 1\n6 1\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n1 4\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n6 1\n6 1\n6 1\n6 1\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 4\n6 6\n3 2\n1 5\n5 2\n1 5\n1 5\n3 1\n6 5\n4 3\n1 1\n5 1\n3 3\n2 4\n1 5\n3 4\n5 1\n5 5\n2 5\n2 1\n4 3\n6 5\n1 1\n2 1\n1 3\n1 1\n6 4\n4 6\n6 4\n2 1\n2 5\n6 2\n3 4\n5 5\n1 4\n4 6\n3 4\n1 6\n5 1\n4 3\n3 4\n2 2\n1 2\n2 3\n1 3\n4 4\n5 5\n4 5\n4 4\n3 1\n4 5\n2 3\n2 6\n6 5\n6 1\n6 6\n2 3\n6 4\n3 3\n2 5\n4 4\n3 1\n2 4\n6 1\n3 2\n1 3\n5 4\n6 6\n2 5\n5 1\n1 1\n2 5\n6 5\n3 6\n5 6\n4 3\n3 4\n3 4\n6 5\n5 2\n4 2\n1 1\n3 1\n2 6\n1 6\n1 2\n6 1\n3 4\n1 6\n3 1\n5 3\n1 3\n5 6\n2 1\n6 4\n3 1\n1 6\n6 3\n3 3\n4 3\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 1\n3 4\n4 6\n4 5\n6 5\n5 3\n6 2\n6 3\n5 2\n4 5\n1 5\n5 4\n1 4\n4 5\n4 6\n1 6\n4 4\n5 1\n6 4\n6 4\n4 6\n2 3\n6 2\n4 6\n1 4\n2 3\n4 3\n1 3\n6 2\n3 1\n3 4\n2 6\n4 5\n5 4\n2 2\n2 5\n4 1\n2 2\n3 3\n1 4\n5 6\n6 4\n4 2\n6 1\n5 5\n4 1\n2 1\n6 4\n4 4\n4 3\n5 3\n4 5\n5 3\n3 5\n6 3\n1 1\n3 4\n6 3\n6 1\n5 1\n2 4\n4 3\n2 2\n5 5\n1 5\n5 3\n4 6\n1 4\n6 3\n4 3\n2 4\n3 2\n2 4\n3 4\n6 2\n5 6\n1 2\n1 5\n5 5\n2 6\n5 1\n1 6\n5 3\n3 5\n2 6\n4 6\n6 2\n3 1\n5 5\n6 1\n3 6\n4 4\n1 1\n4 6\n5 3\n4 2\n5 1\n3 3\n2 1\n1 4\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n6 3\n4 5\n4 3\n5 4\n5 1\n6 3\n4 2\n4 6\n3 1\n2 4\n2 2\n4 6\n5 3\n5 5\n4 2\n6 2\n2 3\n4 4\n6 4\n3 5\n2 4\n2 2\n5 2\n3 5\n2 4\n4 4\n3 5\n6 5\n1 3\n1 6\n2 2\n2 4\n3 2\n5 4\n1 6\n3 4\n4 1\n1 5\n1 4\n5 3\n2 2\n4 5\n6 3\n4 4\n1 1\n4 1\n2 4\n4 1\n4 5\n5 3\n1 1\n1 6\n5 6\n6 6\n4 2\n4 3\n3 4\n3 6\n3 4\n6 5\n3 4\n5 4\n5 1\n5 3\n5 1\n1 2\n2 6\n3 4\n6 5\n4 3\n1 1\n5 5\n5 1\n3 3\n5 2\n1 3\n6 6\n5 6\n1 4\n4 4\n1 4\n3 6\n6 5\n3 3\n3 6\n1 5\n1 2\n3 6\n3 6\n4 1\n5 2\n1 2\n5 2\n3 3\n4 4\n4 2\n6 2\n5 4\n6 1\n6 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n4 1\n6 2\n4 1\n5 3\n4 1\n5 3\n6 2\n5 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 6\n3 5\n3 5\n1 6\n3 5\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 1\n2 4\n5 3\n3 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n6 3\n5 1\n6 3\n4 3\n4 3\n5 2\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n3 4\n1 4\n2 5\n1 6\n1 6\n1 5\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n6 2\n2 5\n5 2\n3 6\n4 3\n1 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n6 1\n5 3\n4 3\n4 1\n5 1\n4 2\n4 2\n4 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n2 5\n2 5\n1 4\n2 6\n2 4\n2 5\n2 6\n1 5\n2 5\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n6 2\n2 4\n4 2\n3 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n5 2\n4 1\n4 1\n5 1\n6 2\n6 1\n5 3\n6 1\n6 2\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n2 4\n3 6\n1 6\n1 6\n2 4\n3 4\n3 6\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 3\n3 6\n6 2\n1 6\n5 1\n3 5\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 2\n5 1\n6 1\n5 2\n4 2\n5 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 4\n2 5\n3 4\n2 6\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n6 2\n3 4\n5 1\n1 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "93\n4 3\n4 1\n4 2\n5 2\n5 3\n6 3\n4 3\n6 2\n6 3\n5 1\n4 2\n4 2\n5 1\n6 2\n6 3\n6 1\n4 1\n6 2\n5 3\n4 3\n4 1\n4 2\n5 2\n6 3\n5 2\n5 2\n6 3\n5 1\n6 2\n5 2\n4 1\n5 2\n5 1\n4 1\n6 1\n5 2\n4 3\n5 3\n5 3\n5 1\n4 3\n4 3\n4 2\n4 1\n6 2\n6 1\n4 1\n5 2\n5 2\n6 2\n5 3\n5 1\n6 2\n5 1\n6 3\n5 2\n6 2\n6 2\n4 2\n5 2\n6 1\n6 3\n6 3\n5 1\n5 1\n4 1\n5 1\n4 3\n5 3\n6 3\n4 1\n4 3\n6 1\n6 1\n4 2\n6 2\n4 2\n5 2\n4 1\n5 2\n4 1\n5 1\n5 2\n5 1\n4 1\n6 3\n6 2\n4 3\n4 1\n5 2\n4 3\n5 2\n5 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n1 6\n1 6\n2 4\n2 5\n3 4\n1 5\n1 6\n1 5\n1 6\n2 6\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "70\n6 1\n3 6\n4 3\n2 5\n5 2\n1 4\n6 2\n1 6\n4 3\n1 4\n5 3\n2 4\n5 3\n1 6\n5 1\n3 5\n4 2\n2 4\n5 1\n3 5\n6 2\n1 5\n4 2\n2 5\n5 3\n1 5\n4 2\n1 4\n5 2\n2 6\n4 3\n1 5\n6 2\n3 4\n4 2\n3 5\n6 3\n3 4\n5 1\n1 4\n4 2\n1 4\n6 3\n2 6\n5 2\n1 6\n6 1\n2 6\n5 3\n1 5\n5 1\n1 6\n4 1\n1 5\n4 2\n2 4\n5 1\n2 5\n6 3\n1 4\n6 3\n3 6\n5 1\n1 4\n5 3\n3 5\n4 2\n3 4\n6 2\n1 4\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "59\n4 1\n5 3\n6 1\n4 2\n5 1\n4 3\n6 1\n5 1\n4 3\n4 3\n5 2\n5 3\n4 1\n6 2\n5 1\n6 3\n6 3\n5 2\n5 2\n6 1\n4 1\n6 1\n4 3\n5 3\n5 3\n4 3\n4 2\n4 2\n6 3\n6 3\n6 1\n4 3\n5 1\n6 2\n6 1\n4 1\n6 1\n5 3\n4 2\n5 1\n6 2\n6 2\n4 3\n5 3\n4 3\n6 3\n5 2\n5 2\n4 3\n5 1\n5 3\n6 1\n6 3\n6 3\n4 3\n5 2\n5 2\n5 2\n4 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n1 5\n1 6\n1 6\n1 4\n2 5\n3 6\n1 6\n3 4\n2 5\n2 5\n2 4\n1 4\n3 4\n2 4\n2 6\n1 5\n3 6\n2 6\n2 6\n3 5\n1 4\n1 5\n2 6\n3 6\n1 4\n3 4\n2 4\n1 6\n3 4\n2 4\n2 6\n1 6\n1 4\n1 6\n1 6\n2 4\n1 5\n1 6\n2 5\n3 6\n3 5\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "78\n4 3\n3 5\n4 3\n1 5\n5 1\n1 5\n4 3\n1 4\n6 3\n1 5\n4 1\n2 4\n4 3\n2 4\n5 1\n3 6\n4 2\n3 6\n6 3\n3 4\n4 3\n3 6\n5 3\n1 5\n4 1\n2 6\n4 2\n2 4\n4 1\n3 5\n5 2\n3 6\n4 3\n2 4\n6 3\n1 6\n4 3\n3 5\n6 3\n2 6\n4 1\n2 4\n6 2\n1 6\n4 2\n1 4\n4 3\n1 4\n4 3\n2 4\n6 2\n3 5\n6 1\n3 6\n5 3\n1 6\n6 1\n2 6\n4 2\n1 5\n6 2\n2 6\n6 3\n2 4\n4 2\n3 5\n6 1\n2 5\n5 3\n2 6\n5 1\n3 6\n4 3\n3 6\n6 3\n2 5\n6 1\n2 6\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "76\n4 1\n5 2\n4 3\n5 2\n5 3\n5 2\n6 1\n4 2\n6 2\n5 3\n4 2\n6 2\n4 1\n4 2\n5 1\n5 1\n6 2\n5 2\n5 3\n6 3\n5 2\n4 3\n6 3\n6 1\n4 3\n6 2\n6 1\n4 1\n6 1\n5 3\n4 1\n5 3\n4 2\n5 2\n4 3\n6 1\n6 2\n5 2\n6 1\n5 3\n4 3\n5 1\n5 3\n4 3\n5 1\n5 1\n4 1\n4 1\n4 1\n4 3\n5 3\n6 3\n6 3\n5 2\n6 2\n6 3\n5 1\n6 3\n5 3\n6 1\n5 3\n4 1\n5 3\n6 1\n4 2\n6 2\n4 3\n4 1\n6 2\n4 3\n5 3\n5 2\n5 3\n5 1\n6 3\n5 2\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "84\n3 6\n3 4\n2 5\n2 4\n1 6\n3 4\n1 5\n1 6\n3 5\n1 6\n2 4\n2 6\n2 6\n2 4\n3 5\n1 5\n3 6\n3 6\n3 4\n3 4\n2 6\n1 6\n1 6\n3 5\n3 4\n1 6\n3 4\n3 5\n2 4\n2 5\n2 5\n3 5\n1 6\n3 4\n2 6\n2 6\n3 4\n3 4\n2 5\n2 5\n2 4\n3 4\n2 5\n3 4\n3 4\n2 6\n2 6\n1 6\n2 4\n1 5\n3 4\n2 5\n2 5\n3 4\n2 4\n2 6\n2 6\n1 4\n3 5\n3 5\n2 4\n2 5\n3 4\n1 5\n1 5\n2 6\n1 5\n3 5\n2 4\n2 5\n3 4\n2 6\n1 6\n2 5\n3 5\n3 5\n3 4\n2 5\n2 6\n3 4\n1 6\n2 5\n2 6\n1 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "44\n6 1\n1 6\n5 2\n1 4\n6 2\n2 5\n5 3\n3 6\n5 2\n1 6\n4 1\n2 4\n6 1\n3 4\n6 3\n3 6\n4 3\n2 4\n6 1\n3 4\n6 1\n1 6\n4 1\n3 5\n6 1\n3 6\n4 1\n1 4\n4 2\n2 6\n6 1\n2 4\n6 2\n1 4\n6 2\n2 4\n5 2\n3 6\n6 3\n2 6\n5 3\n3 4\n5 3\n2 4\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n5 3\n5 1\n5 2\n4 1\n6 3\n6 1\n6 2\n4 1\n4 3\n4 1\n5 1\n5 3\n5 1\n4 1\n4 2\n6 1\n6 3\n5 1\n4 1\n4 1\n6 3\n4 3\n6 3\n5 2\n6 1\n4 1\n5 3\n4 3\n5 2\n6 3\n6 1\n5 1\n4 2\n4 3\n5 2\n5 3\n6 3\n5 2\n5 1\n5 3\n6 2\n6 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "50\n3 6\n2 6\n1 4\n1 4\n1 4\n2 5\n3 4\n3 5\n2 6\n1 6\n3 5\n1 5\n2 6\n2 4\n2 4\n3 5\n1 6\n1 5\n1 5\n1 4\n3 5\n1 6\n3 5\n1 4\n1 5\n1 4\n3 6\n1 6\n1 4\n1 4\n1 4\n1 5\n3 6\n1 6\n1 6\n2 4\n1 5\n2 6\n2 5\n3 5\n3 6\n3 4\n2 4\n2 6\n3 4\n2 5\n3 6\n3 5\n2 4\n2 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "86\n6 3\n2 4\n6 3\n3 5\n6 3\n1 5\n5 2\n2 4\n4 3\n2 6\n4 1\n2 6\n5 2\n1 4\n5 1\n2 4\n4 1\n1 4\n6 2\n3 5\n4 2\n2 4\n6 2\n1 5\n5 3\n2 5\n5 1\n1 6\n6 1\n1 4\n4 3\n3 4\n5 2\n2 4\n5 3\n2 5\n4 3\n3 4\n4 1\n1 5\n6 3\n3 4\n4 3\n3 4\n4 1\n3 4\n5 1\n1 6\n4 2\n1 6\n5 1\n2 4\n5 1\n3 6\n4 1\n1 5\n5 2\n1 4\n4 3\n2 5\n5 1\n1 5\n6 2\n2 6\n4 2\n2 4\n4 1\n2 5\n5 3\n3 4\n5 1\n3 4\n6 3\n3 4\n4 3\n2 6\n6 2\n2 5\n5 2\n3 5\n4 2\n3 6\n6 2\n3 4\n4 2\n2 4\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "84\n6 1\n6 3\n6 3\n4 1\n4 3\n4 2\n6 3\n5 3\n6 1\n6 3\n4 3\n5 2\n5 3\n5 1\n6 2\n6 2\n6 1\n4 1\n6 3\n5 2\n4 1\n5 3\n6 3\n4 2\n6 2\n6 3\n4 3\n4 1\n4 3\n5 1\n5 1\n5 1\n4 1\n6 1\n4 3\n6 2\n5 1\n5 1\n6 2\n5 2\n4 1\n6 1\n6 1\n6 3\n6 2\n4 3\n6 3\n6 2\n5 2\n5 1\n4 3\n6 2\n4 1\n6 2\n6 1\n5 2\n5 1\n6 2\n6 1\n5 3\n5 2\n6 1\n6 3\n5 2\n6 1\n6 3\n4 3\n5 1\n6 3\n6 1\n5 3\n4 3\n5 2\n5 1\n6 2\n5 3\n6 1\n5 1\n4 1\n5 1\n5 1\n5 2\n5 2\n5 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "92\n1 5\n2 4\n3 5\n1 6\n2 5\n1 6\n3 6\n1 6\n2 4\n3 4\n3 4\n3 6\n1 5\n2 5\n1 5\n1 5\n2 6\n2 4\n3 6\n1 4\n1 6\n2 6\n3 4\n2 6\n2 6\n1 4\n3 5\n2 5\n2 6\n1 5\n1 4\n1 5\n3 6\n3 5\n2 5\n1 5\n3 5\n3 6\n2 6\n2 6\n1 5\n3 4\n2 4\n3 6\n2 5\n1 5\n2 4\n1 4\n2 6\n2 6\n2 6\n1 5\n3 6\n3 6\n2 5\n1 4\n2 4\n3 4\n1 5\n2 5\n2 4\n2 5\n3 5\n3 4\n3 6\n2 6\n3 5\n1 4\n3 4\n1 6\n3 6\n2 6\n1 4\n3 6\n3 6\n2 5\n2 6\n1 6\n2 6\n3 5\n2 5\n3 6\n2 5\n2 6\n1 5\n2 4\n1 4\n2 4\n1 5\n2 5\n2 5\n2 6\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n5 1\n1 4\n4 3\n1 5\n4 2\n3 6\n6 2\n1 6\n4 1\n1 4\n5 2\n3 4\n5 1\n1 6\n5 1\n2 6\n6 3\n2 5\n6 2\n2 4\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 3\n4 3\n4 2\n4 3\n4 1\n4 3\n5 2\n5 2\n6 2\n4 2\n5 1\n4 2\n5 2\n6 1\n4 1\n6 3\n5 3\n5 1\n5 1\n5 1\n5 3\n6 1\n6 1\n4 1\n5 2\n5 2\n6 1\n6 3\n4 2\n4 1\n5 3\n4 1\n5 3\n5 1\n6 3\n6 3\n6 1\n5 2\n5 3\n5 3\n6 1\n4 1\n6 2\n6 1\n6 2\n6 3\n4 3\n4 3\n6 3\n4 2\n4 2\n5 3\n5 2\n5 2\n4 3\n5 3\n5 2\n4 2\n5 1\n4 2\n5 1\n5 3\n6 3\n5 3\n5 3\n4 2\n4 1\n4 2\n4 3\n6 3\n4 3\n6 2\n6 1\n5 3\n5 2\n4 1\n6 1\n5 2\n6 2\n4 2\n6 3\n4 3\n5 1\n6 3\n5 2\n4 3\n5 3\n5 3\n4 3\n6 3\n4 3\n4 1\n5 1\n6 2\n6 3\n5 3\n6 1\n6 3\n5 3\n6 1\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 5\n1 4\n1 5\n2 4\n2 6\n3 6\n3 5\n1 5\n2 5\n3 6\n3 5\n1 6\n1 4\n1 5\n1 6\n2 6\n1 5\n3 5\n3 4\n2 6\n2 6\n2 5\n3 4\n1 6\n1 4\n2 4\n1 5\n1 6\n3 5\n1 6\n2 6\n3 5\n1 6\n3 4\n3 5\n1 6\n3 6\n2 4\n2 4\n3 5\n2 6\n1 5\n3 5\n3 6\n2 4\n2 4\n2 6\n3 4\n3 4\n1 5\n1 4\n2 5\n3 4\n1 4\n2 6\n2 5\n2 4\n2 4\n2 5\n1 5\n1 6\n1 5\n1 5\n1 5\n1 6\n3 4\n2 4\n3 5\n3 5\n1 6\n3 5\n1 5\n1 6\n3 6\n3 4\n1 5\n3 5\n3 6\n1 4\n3 6\n1 5\n3 5\n3 6\n3 5\n1 4\n3 4\n2 4\n2 4\n2 5\n3 6\n3 5\n1 5\n2 4\n1 4\n3 4\n1 5\n3 4\n3 6\n3 5\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 3\n3 4\n5 1\n2 5\n5 3\n1 5\n6 3\n2 4\n5 2\n2 6\n5 2\n1 5\n6 3\n1 5\n6 3\n3 4\n5 2\n1 5\n6 1\n1 5\n4 2\n3 5\n6 3\n2 6\n6 3\n1 4\n6 2\n3 4\n4 1\n3 6\n5 1\n2 4\n5 1\n3 4\n6 2\n3 5\n4 1\n2 6\n4 3\n2 6\n5 2\n3 6\n6 2\n3 5\n4 3\n1 5\n5 3\n3 6\n4 2\n3 4\n6 1\n3 4\n5 2\n2 6\n5 2\n2 4\n6 2\n3 6\n4 3\n2 4\n4 3\n2 6\n4 2\n3 4\n6 3\n2 4\n6 3\n3 5\n5 2\n1 5\n6 3\n3 6\n4 3\n1 4\n5 2\n1 6\n4 1\n2 5\n4 1\n2 4\n4 2\n2 5\n6 1\n2 4\n6 3\n1 5\n4 3\n2 6\n6 3\n2 6\n5 3\n1 5\n4 1\n1 5\n6 2\n2 5\n5 1\n3 6\n4 3\n3 4\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n1 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "99\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n2 1\n1 4\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n6 1\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n1 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "84\n6 2\n1 5\n6 2\n2 3\n5 5\n1 2\n3 4\n3 4\n6 5\n6 4\n2 5\n4 1\n1 2\n1 1\n1 4\n2 5\n5 6\n6 3\n2 4\n5 5\n2 6\n3 4\n5 1\n3 3\n5 5\n4 6\n4 6\n2 4\n4 1\n5 2\n2 2\n3 6\n3 3\n4 6\n1 1\n2 4\n6 5\n5 2\n6 5\n5 5\n2 5\n6 4\n1 1\n6 2\n3 6\n6 5\n4 4\n1 5\n5 6\n4 4\n3 5\n6 1\n3 4\n1 5\n4 6\n4 6\n4 1\n3 6\n6 2\n1 1\n4 5\n5 4\n5 3\n3 4\n6 4\n1 1\n5 2\n6 5\n6 1\n2 2\n2 4\n3 3\n4 6\n1 3\n6 6\n5 2\n1 6\n6 2\n6 6\n4 1\n3 6\n6 4\n2 3\n3 4\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "70\n3 4\n2 3\n2 3\n6 5\n6 6\n4 3\n2 3\n3 1\n3 5\n5 6\n1 6\n2 5\n5 3\n2 5\n4 6\n5 1\n6 1\n3 1\n3 3\n5 3\n2 1\n3 3\n6 4\n6 3\n4 3\n4 5\n3 5\n5 5\n5 2\n1 6\n3 4\n5 2\n2 4\n1 6\n4 3\n4 3\n6 2\n1 3\n1 5\n6 1\n3 1\n1 1\n1 3\n2 2\n3 2\n6 4\n1 1\n4 4\n3 1\n4 5\n4 2\n6 3\n4 4\n3 2\n1 2\n2 6\n3 3\n1 5\n1 1\n6 5\n2 2\n3 1\n5 4\n5 2\n6 4\n6 3\n6 6\n6 3\n3 3\n5 4\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "56\n6 4\n3 4\n6 1\n3 3\n1 4\n2 3\n1 5\n2 5\n1 5\n5 5\n2 3\n1 1\n3 2\n3 5\n4 6\n4 4\n5 2\n4 3\n3 1\n3 6\n2 3\n3 4\n5 6\n5 2\n5 6\n1 5\n1 5\n4 1\n6 3\n2 2\n2 1\n5 5\n2 1\n4 1\n5 4\n2 5\n4 1\n6 2\n3 4\n4 2\n6 4\n5 4\n4 2\n4 3\n6 2\n6 2\n3 1\n1 4\n3 6\n5 1\n5 5\n3 6\n6 4\n2 3\n6 5\n3 3\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "94\n2 4\n6 4\n1 6\n1 4\n5 1\n3 3\n4 3\n6 1\n6 5\n3 2\n2 3\n5 1\n5 3\n1 2\n4 3\n3 2\n2 3\n4 6\n1 3\n6 3\n1 1\n3 2\n4 3\n1 5\n4 6\n3 2\n6 3\n1 6\n1 1\n1 2\n3 5\n1 3\n3 5\n4 4\n4 2\n1 4\n4 5\n1 3\n1 2\n1 1\n5 4\n5 5\n6 1\n2 1\n2 6\n6 6\n4 2\n3 6\n1 6\n6 6\n1 5\n3 2\n1 2\n4 4\n6 4\n4 1\n1 5\n3 3\n1 3\n3 4\n4 4\n1 1\n2 5\n4 5\n3 1\n3 1\n3 6\n3 2\n1 4\n1 6\n6 3\n2 4\n1 1\n2 2\n2 2\n2 1\n5 4\n1 2\n6 6\n2 2\n3 3\n6 3\n6 3\n1 6\n2 3\n2 4\n2 3\n6 6\n2 6\n6 3\n3 5\n1 4\n1 1\n3 5\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "81\n4 2\n1 2\n2 3\n4 5\n6 2\n1 6\n3 6\n3 4\n4 6\n4 4\n3 5\n4 6\n3 6\n3 5\n3 1\n1 3\n5 3\n3 4\n1 1\n4 1\n1 2\n6 1\n1 3\n6 5\n4 5\n4 2\n4 5\n6 2\n1 2\n2 6\n5 2\n1 5\n2 4\n4 3\n5 4\n1 2\n5 3\n2 6\n6 4\n1 1\n1 3\n3 1\n3 1\n6 5\n5 5\n6 1\n6 6\n5 2\n1 3\n1 4\n2 3\n5 5\n3 1\n3 1\n4 4\n1 6\n6 4\n2 2\n4 6\n4 4\n2 6\n2 4\n2 4\n4 1\n1 6\n1 4\n1 3\n6 5\n5 1\n1 3\n5 1\n1 4\n3 5\n2 6\n1 3\n5 6\n3 5\n4 4\n5 5\n5 6\n4 3\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "67\n6 5\n3 6\n1 6\n5 3\n5 4\n5 1\n1 6\n1 1\n3 2\n4 4\n3 1\n4 1\n1 5\n5 3\n3 3\n6 4\n2 4\n2 2\n4 3\n1 4\n1 4\n6 1\n1 2\n2 2\n5 1\n6 2\n3 5\n5 5\n2 2\n6 5\n6 2\n4 4\n3 1\n4 2\n6 6\n6 4\n5 1\n2 2\n4 5\n5 5\n4 6\n1 5\n6 3\n4 4\n1 5\n6 4\n3 6\n3 4\n1 6\n2 4\n2 1\n2 5\n6 5\n6 4\n4 1\n3 2\n1 2\n5 1\n5 6\n1 5\n3 5\n3 1\n5 3\n3 2\n5 1\n4 6\n6 6\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "55\n6 6\n6 5\n2 2\n2 2\n6 4\n5 5\n6 5\n5 3\n1 3\n2 2\n5 6\n3 3\n3 3\n6 5\n3 5\n5 5\n1 2\n1 1\n4 6\n1 2\n5 5\n6 2\n6 3\n1 2\n5 1\n1 3\n3 3\n4 4\n2 5\n1 1\n5 3\n4 3\n2 2\n4 5\n5 6\n4 5\n6 3\n1 6\n6 4\n3 6\n1 6\n5 2\n6 3\n2 3\n5 5\n4 3\n3 1\n4 2\n1 1\n2 5\n5 3\n2 2\n6 3\n4 5\n2 2\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "92\n2 3\n1 3\n2 6\n5 1\n5 5\n3 2\n5 6\n2 5\n3 1\n3 6\n4 5\n2 5\n1 2\n2 3\n6 5\n3 6\n4 4\n6 2\n4 5\n4 4\n5 1\n6 1\n3 4\n3 5\n6 6\n3 2\n6 4\n2 2\n3 5\n6 4\n6 3\n6 6\n3 4\n3 3\n6 1\n5 4\n6 2\n2 6\n5 6\n1 4\n4 6\n6 3\n3 1\n4 1\n6 6\n3 5\n6 3\n6 1\n1 6\n3 2\n6 6\n4 3\n3 4\n1 3\n3 5\n5 3\n6 5\n4 3\n5 5\n4 1\n1 5\n6 4\n2 3\n2 3\n1 5\n1 2\n5 2\n4 3\n3 6\n5 5\n5 4\n1 4\n3 3\n1 6\n5 6\n5 4\n5 3\n1 1\n6 2\n5 5\n2 5\n4 3\n6 6\n5 1\n1 1\n4 6\n4 6\n3 1\n6 4\n2 4\n2 2\n2 1\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "79\n5 3\n4 6\n3 6\n2 1\n5 2\n2 3\n4 4\n6 2\n2 5\n1 6\n6 6\n2 6\n3 3\n4 5\n6 2\n2 1\n1 5\n5 1\n2 1\n2 6\n5 3\n6 2\n2 6\n2 3\n1 5\n4 4\n6 3\n5 2\n3 2\n1 3\n1 3\n6 3\n2 6\n3 6\n5 3\n4 5\n6 1\n3 5\n3 5\n6 5\n1 5\n4 2\n6 2\n2 3\n4 6\n3 6\n2 5\n4 4\n1 1\n4 6\n2 6\n6 4\n3 2\n4 1\n1 2\n6 4\n5 6\n1 4\n2 2\n5 4\n3 2\n1 2\n2 4\n2 5\n2 1\n3 6\n3 3\n1 1\n2 2\n4 4\n4 5\n3 3\n5 3\n6 2\n4 5\n6 5\n2 5\n5 6\n2 2\n", "output": "Chris", "type": "stdin_stdout" }, { "fn_name": null, "input": "65\n1 1\n5 1\n2 2\n5 4\n4 5\n2 5\n3 2\n5 6\n6 3\n1 1\n6 1\n1 5\n1 1\n5 2\n6 4\n1 6\n1 1\n4 3\n2 3\n5 6\n4 4\n6 2\n1 3\n4 3\n1 3\n6 3\n3 5\n4 2\n4 1\n6 1\n3 2\n2 6\n3 2\n3 5\n6 3\n4 3\n1 5\n2 6\n1 3\n4 1\n4 1\n2 5\n2 5\n6 2\n5 3\n3 1\n3 3\n5 1\n2 4\n5 3\n3 3\n1 1\n6 3\n3 3\n5 1\n1 6\n4 5\n6 6\n5 5\n2 5\n4 1\n2 2\n1 4\n1 6\n6 5\n", "output": "Mishka", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1 1\n", "output": "Friendship is magic!^^", "type": "stdin_stdout" } ] }
apps
verifiable_code
234
Solve the following coding problem using the programming language python: One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won. Alex has grown up since then, so he easily wins the most difficult levels. This quickly bored him, and he thought: what if the computer gave him invalid fields in the childhood and Alex could not win because of it? He needs your help to check it. A Minesweeper field is a rectangle $n \times m$, where each cell is either empty, or contains a digit from $1$ to $8$, or a bomb. The field is valid if for each cell: if there is a digit $k$ in the cell, then exactly $k$ neighboring cells have bombs. if the cell is empty, then all neighboring cells have no bombs. Two cells are neighbors if they have a common side or a corner (i. e. a cell has at most $8$ neighboring cells). -----Input----- The first line contains two integers $n$ and $m$ ($1 \le n, m \le 100$) — the sizes of the field. The next $n$ lines contain the description of the field. Each line contains $m$ characters, each of them is "." (if this cell is empty), "*" (if there is bomb in this cell), or a digit from $1$ to $8$, inclusive. -----Output----- Print "YES", if the field is valid and "NO" otherwise. You can choose the case (lower or upper) for each letter arbitrarily. -----Examples----- Input 3 3 111 1*1 111 Output YES Input 2 4 *.*. 1211 Output NO -----Note----- In the second example the answer is "NO" because, if the positions of the bombs are preserved, the first line of the field should be *2*1. You can read more about Minesweeper in Wikipedia's article. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python r, c = list(map(int, input().split())) b = [list(input()) for i in range(r)] for y in range(r): for x in range(c): if b[y][x] == '.': b[y][x] = '0' ok = True for Y in range(r): for X in range(c): if not b[Y][X].isdigit(): continue p = 0 for dy in range(-1, 2): for dx in range(-1, 2): y = Y + dy x = X + dx if 0 <= y < r and 0 <= x < c: p += b[y][x] == '*' if p != int(b[Y][X]): ok = False print(["NO", "YES"][ok]) ```
vfc_10690
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/984/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 3\n111\n1*1\n111\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n*.*.\n1211\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n.....1*1..\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n4\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n..........\n...111111.\n..13*21*1.\n.12**2111.\n.1*542..11\n.13**1..1*\n..2*31..11\n..111..111\n.......1*1\n.......111\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 17\n12*2*22123*31....\n2*333*3*4***3211.\n*22*213**4***3*1.\n11111.12224*6*21.\n221..111.14**4311\n**2233*212****2*1\n*55***4*13*544421\n2***54*322*21**31\n13*4*33*221114*4*\n.1122*22*1...2*31\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n**********\n**********\n**********\n**********\n**********\n******3***\n**********\n**********\n**********\n***3.5****\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "21 10\n62637783*1\n23*51**531\n35*7*6.**.\n.*3***581*\n2.32*745**\n83*7*6*6*5\n*74.**6**3\n323*6**7*6\n3454*67.*1\n**63265*6*\n3725*4553*\n24****5**4\n23.34****4\n55257*1*4*\n4*3253*456\n**.3*45488\n*7318**4*5\n234.*4557*\n12..21*.*3\n286.225*4*\n834*11*.3*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n**********\n*********6\n*********5\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1\n.\n.\n.\n.\n1\n*\n2\n*\n1\n.\n.\n.\n.\n.\n.\n1\n*\n1\n1\n*\n1\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.\n1\n*\n2\n*\n*\n*\n1\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n1\n*\n2\n*\n1\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n*************5****5****************************************************4****************************\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n..1*1..........................1*1....1*1....1*1.1*1....1*1..1**1........................1**1.......\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n.....1*1........1*1................................1*1...1**11*1.......1*1....1.....1*1.....1*1...1*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n881111882*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n*2221\n24**2\n*3*5*\n3425*\n**12*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n****2\n4***4\n3****\n3*563\n*22**\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n***2.\n5**31\n**6**\n***43\n**31*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n*32**\n4*3*4\n**44*\n**45*\n*4***\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n***\n*2*\n***\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n*\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n*1\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n*2\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n32\n**\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n...\n232\n***\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n..\n11\n.*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n1*2\n3*2\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n.*.\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n.\n*\n.\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n1\n*\n1\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n*\n1\n*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n1**\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n8\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n.\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n2*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n2\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n*\n*\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n.\n1\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3\n..1\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n...\n.*.\n...\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n112\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n11.\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n151\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1.1\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n611\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n.11\n1*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n2*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n**1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n5*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n.*1\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n411\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n.11\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n121\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n1.1\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n115\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*1\n11.\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*4\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n111\n1*.\n111\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n*222\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n*\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n**\n**\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n***\n*.*\n***\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n***\n***\n***\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n***\n*4*\n***\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6\n....1.\n.....*\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n*****\n*****\n*****\n*****\n*****\n", "output": "YES", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1\n.\n*\n.\n.\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2*\n11\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n888\n888\n888\n", "output": "NO", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n*22*\n", "output": "NO", "type": "stdin_stdout" } ] }
apps
verifiable_code
235
Solve the following coding problem using the programming language python: After passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. This means the process of eating candies is the following: in the beginning Vasya chooses a single integer $k$, same for all days. After that, in the morning he eats $k$ candies from the box (if there are less than $k$ candies in the box, he eats them all), then in the evening Petya eats $10\%$ of the candies remaining in the box. If there are still candies left in the box, the process repeats — next day Vasya eats $k$ candies again, and Petya — $10\%$ of the candies left in a box, and so on. If the amount of candies in the box is not divisible by $10$, Petya rounds the amount he takes from the box down. For example, if there were $97$ candies in the box, Petya would eat only $9$ of them. In particular, if there are less than $10$ candies in a box, Petya won't eat any at all. Your task is to find out the minimal amount of $k$ that can be chosen by Vasya so that he would eat at least half of the $n$ candies he initially got. Note that the number $k$ must be integer. -----Input----- The first line contains a single integer $n$ ($1 \leq n \leq 10^{18}$) — the initial amount of candies in the box. -----Output----- Output a single integer — the minimal amount of $k$ that would allow Vasya to eat at least half of candies he got. -----Example----- Input 68 Output 3 -----Note----- In the sample, the amount of candies, with $k=3$, would change in the following way (Vasya eats first): $68 \to 65 \to 59 \to 56 \to 51 \to 48 \to 44 \to 41 \\ \to 37 \to 34 \to 31 \to 28 \to 26 \to 23 \to 21 \to 18 \to 17 \to 14 \\ \to 13 \to 10 \to 9 \to 6 \to 6 \to 3 \to 3 \to 0$. In total, Vasya would eat $39$ candies, while Petya — $29$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def can(n, k): total = n s = 0 while n > 0: cur = min(n, k) s += cur n -= cur n -= n // 10 return s * 2 >= total n = int(input()) le = 0 rg = n while rg - le > 1: mid = (rg + le) // 2 if can(n, mid): rg = mid else: le = mid print(rg) ```
vfc_10694
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/991/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "68\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "43\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "756\n", "output": "29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999972\n", "output": "39259423\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999973\n", "output": "39259424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000\n", "output": "39259424579862572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000\n", "output": "39\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000\n", "output": "392\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100500\n", "output": "3945\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000\n", "output": "39259\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000\n", "output": "392594\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000\n", "output": "3925942\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456789\n", "output": "4846842\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "543212345\n", "output": "21326204\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "505050505\n", "output": "19827992\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "777777777\n", "output": "30535108\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888871\n", "output": "34897266\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000\n", "output": "39259424\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999973\n", "output": "39259424579862572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999998\n", "output": "39259424579862572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999\n", "output": "39259424579862573\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000000000000\n", "output": "3925942457986257\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "540776028375043656\n", "output": "21230555700587649\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "210364830044445976\n", "output": "8258802179385535\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "297107279239074256\n", "output": "11664260821414605\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "773524766411950187\n", "output": "30368137227605772\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "228684941775227220\n", "output": "8978039224174797\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "878782039723446310\n", "output": "34500477210660436\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "615090701338187389\n", "output": "24148106998961343\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "325990422297859188\n", "output": "12798196397960353\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "255163492355051023\n", "output": "10017571883647466\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "276392003308849171\n", "output": "10850991008380891\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "601\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "983\n", "output": "38\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "729\n", "output": "29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "703\n", "output": "28\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "257\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "526\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "466\n", "output": "18\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "738\n", "output": "29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "116\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888887\n", "output": "34897266293211176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888888\n", "output": "34897266293211176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888889\n", "output": "34897266293211176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999969\n", "output": "39259424579862571\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999970\n", "output": "39259424579862571\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999971\n", "output": "39259424579862572\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999943\n", "output": "39259424579862571\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999944\n", "output": "39259424579862570\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999945\n", "output": "39259424579862571\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999917\n", "output": "39259424579862570\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999918\n", "output": "39259424579862569\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999919\n", "output": "39259424579862570\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999999957\n", "output": "3925942457986255\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999999958\n", "output": "3925942457986255\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999999999999959\n", "output": "3925942457986256\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888853\n", "output": "34897266293211174\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888854\n", "output": "34897266293211174\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "888888888888888855\n", "output": "34897266293211175\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
236
Solve the following coding problem using the programming language python: A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. $0$ You can remove a link or a pearl and insert it between two other existing links or pearls (or between a link and a pearl) on the necklace. This process can be repeated as many times as you like, but you can't throw away any parts. Can you make the number of links between every two adjacent pearls equal? Two pearls are considered to be adjacent if there is no other pearl between them. Note that the final necklace should remain as one circular part of the same length as the initial necklace. -----Input----- The only line of input contains a string $s$ ($3 \leq |s| \leq 100$), representing the necklace, where a dash '-' represents a link and the lowercase English letter 'o' represents a pearl. -----Output----- Print "YES" if the links and pearls can be rejoined such that the number of links between adjacent pearls is equal. Otherwise print "NO". You can print each letter in any case (upper or lower). -----Examples----- Input -o-o-- Output YES Input -o--- Output YES Input -o---o- Output NO Input ooo Output YES The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def main(): s = input() links = s.count('-') pearls = s.count('o') if pearls == 0 or links % pearls == 0: print('YES') else: print('NO') main() ```
vfc_10698
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/980/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "-o-o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o---\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o---o-\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ooo\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "--o-o-----o----o--oo-o-----ooo-oo---o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o--o-oo---o-o-o--o-o----oo------oo-----o----o-o-o--oo-o--o---o--o----------o---o-o-oo---o--o-oo-o--\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-ooo--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo-ooo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------o-o--o-----o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "--o---o----------o----o----------o--o-o-----o-oo---oo--oo---o-------------oo-----o-------------o---o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "----------------------------------------------------------------------------------------------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-oo-oo------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---------------------------------o----------------------------oo------------------------------------\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo--o--o--------oo----------------o-----------o----o-----o----------o---o---o-----o---------ooo---\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "--o---oooo--o-o--o-----o----ooooo--o-oo--o------oooo--------------ooo-o-o----\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-----------------------------o--o-o-------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o-oo-o--oo----o-o----------o---o--o----o----o---oo-ooo-o--o-\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oooooooooo-ooo-oooooo-ooooooooooooooo--o-o-oooooooooooooo-oooooooooooooo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-----------------o-o--oo------o--------o---o--o----------------oooo-------------ooo-----ooo-----o\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ooo-ooooooo-oo-ooooooooo-oooooooooooooo-oooo-o-oooooooooo--oooooooooooo-oooooooooo-ooooooo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo-o-ooooo---oo---o-oo---o--o-ooo-o---o-oo---oo---oooo---o---o-oo-oo-o-ooo----ooo--oo--o--oo-o-oo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-----o-----oo-o-o-o-o----o---------oo---ooo-------------o----o---o-o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo--o-o-o----o-oooo-ooooo---o-oo--o-o--ooo--o--oooo--oo----o----o-o-oooo---o-oooo--ooo-o-o----oo---\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------oo----o----o-oo-o--------o-----oo-----------------------o------------o-o----oo---------\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o--o--------o--o------o---o-o----------o-------o-o-o-------oo----oo------o------oo--o--\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------------------o----------------------------------o-o-------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-------------o----ooo-----o-o-------------ooo-----------ooo------o----oo---\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-------o--------------------o--o---------------o---o--o-----\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------------------------o------------o-----o----------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------oo----------o------o-----o---------o------------o----o--o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------------o------------------o-----------------------o-----------o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o---o---------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "----------------------o---o----o---o-----------o-o-----o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "----------------------------------------------------------------------o-o---------------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "----o---o-------------------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o----------------------oo----\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o-o--o-o--o-----o-----o-o--o-o---oooo-o\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o-ooo-o--o----o--o-o-oo-----------o-o-\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o-------o-------o-------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo----------------------o--------------o--------------o-----\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-----------------------------------o---------------------o--------------------------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "--o--o----o-o---o--o----o-o--oo-----o-oo--o---o---ooo-o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---------------o-o----\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o------ooo--o-o-oo--o------o----ooo-----o-----o-----o-ooo-o---o----oo\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "----o----o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o--o--o--o--o--o--o--o--o--o--o--o--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o---o---o---o---o----o----o----o---o---o---o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o----------o----------o----------o----------o----------o----------o----------o----------o----------o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o---------o---------o---------o---------o---------o---------o---------o---------o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "--------o--------o--------o--------o--------o--------o--------o--------o--------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o---o----\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---o----o\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-o-\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "------oooo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo--\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---o\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ooo-\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oooooooo----------\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oooo--\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "o-ooooo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "-oo\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ooooo-\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "ooo---------\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "oo-\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "---ooo\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
237
Solve the following coding problem using the programming language python: n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not always possible to share pillows equally, but any hobbit gets hurt if he has at least two pillows less than some of his neighbors have. Frodo will sleep on the k-th bed in the row. What is the maximum number of pillows he can have so that every hobbit has at least one pillow, every pillow is given to some hobbit and no one is hurt? -----Input----- The only line contain three integers n, m and k (1 ≤ n ≤ m ≤ 10^9, 1 ≤ k ≤ n) — the number of hobbits, the number of pillows and the number of Frodo's bed. -----Output----- Print single integer — the maximum number of pillows Frodo can have so that no one is hurt. -----Examples----- Input 4 6 2 Output 2 Input 3 10 3 Output 4 Input 3 6 1 Output 3 -----Note----- In the first example Frodo can have at most two pillows. In this case, he can give two pillows to the hobbit on the first bed, and one pillow to each of the hobbits on the third and the fourth beds. In the second example Frodo can take at most four pillows, giving three pillows to each of the others. In the third example Frodo can take three pillows, giving two pillows to the hobbit in the middle and one pillow to the hobbit on the third bed. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n, m, k = map(int, input().split()) ans = 1 m -= n left = k - 1 right = n - k put = 1 while (m >= put): m -= put ans += 1 put += (left > 0) + (right > 0) if (left): left -= 1 if (right): right -= 1 if (left == right == 0): ans += (m // put) break print(ans) ```
vfc_10702
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/760/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4 6 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 3\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1000000000 1\n", "output": "1000000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1000000000 20\n", "output": "10000034\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000 994\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 200000000 54345\n", "output": "10001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 1000000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 500000000\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 200020000 54345\n", "output": "10001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 108037 18\n", "output": "1115\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 200020001 54345\n", "output": "10002\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200 6585 2\n", "output": "112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30000 30593 5980\n", "output": "25\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40000 42107 10555\n", "output": "46\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50003 50921 192\n", "output": "31\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 113611 24910\n", "output": "117\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 483447163 83104\n", "output": "21965\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000 10021505 600076\n", "output": "147\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 102144805 2091145\n", "output": "1465\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 481982093\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 999973325 5\n", "output": "9999778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200 999999109 61\n", "output": "5000053\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30000 999999384 5488\n", "output": "43849\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40000 999997662 8976\n", "output": "38038\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50003 999999649 405\n", "output": "44320\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 999899822 30885\n", "output": "31624\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 914032367 528790\n", "output": "30217\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000 999617465 673112\n", "output": "31459\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 993180275 362942\n", "output": "29887\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 331431458\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10466 89\n", "output": "144\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200 5701 172\n", "output": "84\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30000 36932 29126\n", "output": "84\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40000 40771 22564\n", "output": "28\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50003 51705 49898\n", "output": "42\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 149408 74707\n", "output": "223\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 194818222 998601\n", "output": "18389\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000 10748901 8882081\n", "output": "866\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 106296029 98572386\n", "output": "2510\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 193988157\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 999981057 92\n", "output": "9999852\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "200 999989691 199\n", "output": "5000046\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30000 999995411 24509\n", "output": "43846\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40000 999998466 30827\n", "output": "37930\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50003 999997857 48387\n", "output": "43163\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000 999731886 98615\n", "output": "43371\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000 523220797 654341\n", "output": "22853\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000000 999922591 8157724\n", "output": "31464\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000000 999834114 93836827\n", "output": "29998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000 1000000000 912549504\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 97654978 234\n", "output": "97976\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 97654977 234\n", "output": "97975\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000234 97653889 1\n", "output": "13903\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000234 97653890 1\n", "output": "13904\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3450234 97656670 3000000\n", "output": "9707\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3450234 97656669 3000000\n", "output": "9706\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000000000 2\n", "output": "333333334\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 1\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 2\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000000000 1\n", "output": "333333334\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000000000 3\n", "output": "333333334\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 999999999 1\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 999999999 2\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 999999999 1\n", "output": "999999999\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
238
Solve the following coding problem using the programming language python: You are given an array $a_1, a_2, \dots , a_n$ and two integers $m$ and $k$. You can choose some subarray $a_l, a_{l+1}, \dots, a_{r-1}, a_r$. The cost of subarray $a_l, a_{l+1}, \dots, a_{r-1}, a_r$ is equal to $\sum\limits_{i=l}^{r} a_i - k \lceil \frac{r - l + 1}{m} \rceil$, where $\lceil x \rceil$ is the least integer greater than or equal to $x$. The cost of empty subarray is equal to zero. For example, if $m = 3$, $k = 10$ and $a = [2, -4, 15, -3, 4, 8, 3]$, then the cost of some subarrays are: $a_3 \dots a_3: 15 - k \lceil \frac{1}{3} \rceil = 15 - 10 = 5$; $a_3 \dots a_4: (15 - 3) - k \lceil \frac{2}{3} \rceil = 12 - 10 = 2$; $a_3 \dots a_5: (15 - 3 + 4) - k \lceil \frac{3}{3} \rceil = 16 - 10 = 6$; $a_3 \dots a_6: (15 - 3 + 4 + 8) - k \lceil \frac{4}{3} \rceil = 24 - 20 = 4$; $a_3 \dots a_7: (15 - 3 + 4 + 8 + 3) - k \lceil \frac{5}{3} \rceil = 27 - 20 = 7$. Your task is to find the maximum cost of some subarray (possibly empty) of array $a$. -----Input----- The first line contains three integers $n$, $m$, and $k$ ($1 \le n \le 3 \cdot 10^5, 1 \le m \le 10, 1 \le k \le 10^9$). The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($-10^9 \le a_i \le 10^9$). -----Output----- Print the maximum cost of some subarray of array $a$. -----Examples----- Input 7 3 10 2 -4 15 -3 4 8 3 Output 7 Input 5 2 1000 -13 -4 -9 -20 -11 Output 0 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python N, M, K = list(map(int, input().split())) A = [int(a) for a in input().split()] S = [0] for a in A: S.append(S[-1]+M*a-K) MI = [(10**50)] * M ans = 0 for i in range(N+1): MI[i%M] = min(MI[i%M], S[i]) for j in range(M): ans = max(ans, (S[i]-MI[(i-j)%M] - K*((-j)%M))//M) print(ans) ```
vfc_10706
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1197/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "7 3 10\n2 -4 15 -3 4 8 3\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 1000\n-13 -4 -9 -20 -11\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10 10\n1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "4999999990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10 10\n1000000000 1000000000 -1000000000 1000000000 1000000000\n", "output": "2999999990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2 5\n2 2 2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10 1000000000\n999999999\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 6 10\n-1 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "4999999990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 10\n1000000000 1000000000 1000000000 1000000000 9\n", "output": "3999999990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 10\n1000000000 1000000000 1 1000000000 1000000000\n", "output": "3999999981\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 10\n1 0 0 0 5 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 10\n1 2 10 2 3\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 9\n2 1 2 10 4\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3 3\n2 2 2 3 -1 -1 -1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 10\n3 3 6 7\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 10\n1 1000 1000 1\n", "output": "1990\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "52 6 669\n642 20 568 -469 -266 744 -486 639 813 632 -539 -818 464 438 -349 -950 280 -93 -529 -920 -831 462 559 961 -837 -349 -653 849 820 -21 -120 -144 -269 605 -99 -276 -844 54 -276 837 785 -42 -749 796 534 -948 -318 -262 342 -426 -575 183\n", "output": "1673\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 10 1000\n631 -660 -608 -133 -1324 1698 -229 -107 -540 1837 1827 448 -1574 1576 1751 848 -890 213 -442 522\n", "output": "5713\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n1 2 3 4\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 2 9\n1 -8 -5 -6 -5 -7 8 -2 7 2 -4 0 -1 3 6 8 -8 -9 2 -8\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 757773391\n-708202672 725600885 714386358 885416061 999472550\n", "output": "1841501578\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 2\n1 64 103 -164 13\n", "output": "165\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 4\n3 4 5 6 7\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 2 1\n-1 8 3 -9 7 5 4 -1 -7 -3\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 10 10\n1 2 8 2 6 -2 9 7 9 7 -4 6 2 0 4\n", "output": "39\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 3 10\n1 9 -1 9 9 4 17\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 4\n1 1 1 7 9\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 6 17153\n-28263 14597 4735 1452 -14292 -31177 -20198 247 20554 2438 22266 -4468 -13551 32664 13810\n", "output": "42750\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7 349078044\n346450461 -151361596 -625105856\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42 9 460853333\n323861481 622701467 -873400999 658408343 778669784 692090162 -536855569 -568971791 141069853 976448931 702178349 946412568 251299867 45637990 438945856 504996643 33902725 -815383452 -825003302 854426262 -851164757 -799150044 -985979822 -679814718 -301626285 721177185 -457830126 -769806217 215778808 -232808115 -110027967 -607959163 -943650801 -777973009 735775736 -117195663 -397831392 -114273903 408852339 -886059538 -750897112 833959335\n", "output": "4215688994\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n1 1 1 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 10\n5 10 10 10\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 7 7\n-1 5 5 -8 8 -2 5 6 7 6\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 2 2\n7 -6 8 6 7 -4 -9 -4\n", "output": "17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 1 500000000\n12 39045157 78090314 117135471 156180628 195225785 234270942 273316099 312361256 351406413 390451570 1000000000\n", "output": "500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 3 10\n9 10 10 10 10 10 3 3 3 13 0 0\n", "output": "42\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 4 18\n-6 8 -5 2 -5 8 9 5 0 1 9 -6 0 6 -3 -3 -4 1 0 0\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 10\n2 20 30 3\n", "output": "43\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 7\n10 -4 5 8 8 8\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 470344322\n81705360 -386468301 -887628688 22906761\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 10 907658609\n-194209259 414274888 393675849 878456237 106365458 -731983555 810695417 -273909797 -389852212 -531227416 828543257 41731960\n", "output": "963825685\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 100 100 100\n", "output": "298\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 3 10\n1 9 -1 9 9 4 17 7\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 10\n1 11 11 11\n", "output": "23\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n-1 1000 -1\n", "output": "998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 4 30\n23 -33 -90 85 99 38 -40 63 -20 25 33 49 34 -64 48 68 10 50 -38 -11 77 -89 -75 -31 86 68 -90 -28 -60 -71 -53 -37 -86 -57 6 -76 -50 -96 22 8 -29 18 54 79 79 -1 37 35 -5 52\n", "output": "358\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 10\n4 0 0 2 5 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 5\n3 0 3 3 3\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 6 457506246\n-969121117 617558553 -129415554 304607443 107130946 445638713 224436189 334186220 660301253 -602596009 866988526 -519228763 107776201 459643776 -936500703 -181433899 -877982207 -736482030 -788123194 339761560 -373447196 -280404579 132070889 -8613357 541579575 -861092082 664002743 -498027327 464062613 16247559\n", "output": "1913823788\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 10\n-1 -2 -3 -4 -5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 9 10\n1 2 3 4 5 6 10 -17 16 -10 -5 15 15 -15 20\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 10 701\n62684 13503 59709 58247 -2946 37536 -35525 -63986 -88876 -3666 -3230 -14139 48440 92198 30628 -37164 82238 28387 -14045 -55610 5422 -91184 69956 -33024 -45254 -55725 25882 25873 59433 -84008\n", "output": "262636\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "46 3 8132\n-87069 -13299 21975 68314 17889 -6291 21617 -25617 -49430 -29853 53005 -71441 -19437 42706 -15175 70615 -32798 43270 -16466 -58461 -97023 49150 62915 -42788 -22273 34346 -57197 70365 -71500 90645 -68792 -7967 75319 45706 -88665 -50385 87550 -87412 -65222 -2725 40765 -44101 -82127 -79163 -33327 44106\n", "output": "118647\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12 10 907658609\n-19420959 414274888 393675849 878456237 106365458 -731983555 810695417 -273909797 -389852212 -531227416 828543257 41731960\n", "output": "963825685\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "47 2 9677\n10883 -66708 16724 -49642 57909 -53732 81024 77029 22526 -35794 -18204 -19574 1499 -62540 -51119 -59874 65981 -31282 -15193 98997 -54845 23633 96916 -88428 49361 -97121 -24209 -96118 46336 -98765 -98264 -54210 -86800 -37177 69190 -9649 54629 10242 -26690 28718 -72548 2403 -57427 -41639 -58621 66698 -7198\n", "output": "161225\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9 95\n-49 33 -30 7 43 29 -10 22 -42 -29 28 34 -49 28 33 -41 -42 4 -35 -7 48 -13 -39 -28 -48 -34 30 35 5 -25 4 0 29 48 33 -43 0 19 -5 -2 -39 -2 29 -34 13 -6 38 20 -6 -48 31 -7 2 10 -43 -17 8 48 33 31 -8 46 7 39 -19 26 -31 -40 35 25 28 30 -39 29 9 26 44 -21 33 3 -27 -2 -13 2 23 19 41 -21 34 -18 -16 20 43 -25 32 13 -7 -10 22 -34\n", "output": "109\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 5 17\n41 -15 -47 -59 67 -11 -50 43 -20 31 66 -27 -71 55\n", "output": "103\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 7 6\n15 -16 -9 7 -6 -1 -14 2\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 6 88\n40 50 94 31 -67 8 -69 54 66 84 96 -85 53 43 30 24 -68 -99 73 -85\n", "output": "212\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 113164398\n295556036 -507915019 -326982322 -518908220\n", "output": "182391638\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 7 219\n-789 -125 -357 -176\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 7 46\n27 41 -24 32 25 24 -36 -14 48 -27\n", "output": "79\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 7 159145800\n201321354\n", "output": "42175554\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 9 877169647\n116006513 366294771 -157813159 -36781809 805692362 731481079 217770583 -472673548 -489084560 -296209833 -194483928 -858075383 -290173195 291750625 -820414519 516786419 -450695951 -618132928 -757837884 915884506 853711807 -622799691 333763686 -809051647 -216743160 423809518 -597560349 435932120 -364484175 733886972 345751269 -463264748 378617674 -98147123 -219210294 179773108 -8439174 454095808 -319000468 632720932\n", "output": "1165480693\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 5 170181265\n-961528298 -281699017 -401645735 -697368732 174334773 -57944971 716829060 126008019 -812563037 56039402 629804706 -676146717 98023638 648427010 570074144 -438361317 -497217942 331474787\n", "output": "1146343527\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 2 531595322\n926215961 -385821837 -278841122 -422772006 -509196878 -81824369 -101501043 -33095577 -520514931 402836017 48602657 881104200 -110528684 52550046 -208588735 -814534121 -548420443 410430115 -636402169 -848516069 -70639158 775203498 -679440929 -427359667 33598904 656872639 -225600926 57010433 -686004588 954173921 -183691317 65245783 811865477 -280371354 385569766 -148554605 -6165789 -956818726 -707171951 -616296946 -463546019 152596440 315750998 520478951\n", "output": "584403220\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 7 5983227\n-908030083\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10 1\n-10\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
239
Solve the following coding problem using the programming language python: You are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyline should be as long as possible. A polyline defined by points p_1, p_2, p_3, p_4 consists of the line segments p_1 p_2, p_2 p_3, p_3 p_4, and its length is the sum of the lengths of the individual line segments. -----Input----- The only line of the input contains two integers n and m (0 ≤ n, m ≤ 1000). It is guaranteed that grid contains at least 4 different points. -----Output----- Print 4 lines with two integers per line separated by space — coordinates of points p_1, p_2, p_3, p_4 in order which represent the longest possible polyline. Judge program compares your answer and jury's answer with 10^{ - 6} precision. -----Examples----- Input 1 1 Output 1 1 0 0 1 0 0 1 Input 0 10 Output 0 1 0 10 0 0 0 9 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import math n, m = list(map(int, input().split())) if n == 0 : print(0, 1) print(0, m) print(0, 0) print(0, m - 1) elif m == 0 : print(1, 0) print(n, 0) print(0, 0) print(n - 1, 0) else : l = math.sqrt((n - 1) ** 2 + m ** 2) + math.sqrt(n ** 2 + m ** 2) + math.sqrt(n ** 2 + (m - 1) ** 2) l1 = max(m, n) + math.sqrt(n * n + m * m) * 2 l2 = math.sqrt(n ** 2 + m ** 2) + math.sqrt((n - 1) ** 2 + m ** 2) * 2 l3 = math.sqrt(n ** 2 + m ** 2) + math.sqrt((m - 1) ** 2 + n ** 2) * 2 ans = max(l, l1, l2, l3) if l == ans : print(1, 0) print(n, m) print(0, 0) print(n, m - 1) elif l1 == ans : if n > m : print(n, m) print(0, 0) print(n, 0) print(0, m) else : print(n, m) print(0, 0) print(0, m) print(n, 0) elif l2 == ans : print(1, 0) print(n, m) print(0, 0) print(n - 1, m) else : print(0, 1) print(n, m) print(0, 0) print(n, m - 1) ```
vfc_10710
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/452/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 1\n", "output": "1 1\n0 0\n1 0\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 10\n", "output": "0 1\n0 10\n0 0\n0 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n", "output": "10 9\n0 0\n10 10\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100\n", "output": "0 1\n100 100\n0 0\n99 100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 100\n", "output": "9 100\n0 0\n10 100\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 1000\n", "output": "1 0\n20 1000\n0 0\n19 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 20\n", "output": "0 1\n1000 20\n0 0\n1000 19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 10\n", "output": "100 9\n0 0\n100 10\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n", "output": "2 2\n0 0\n2 0\n0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n", "output": "3 3\n0 0\n3 0\n0 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 15\n", "output": "0 0\n2 15\n2 0\n0 15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 2\n", "output": "0 0\n15 2\n0 2\n15 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 1000\n", "output": "0 1\n1000 1000\n0 0\n999 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 999\n", "output": "0 1\n1000 999\n0 0\n1000 998\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 1000\n", "output": "1 0\n999 1000\n0 0\n998 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "987 567\n", "output": "987 566\n0 0\n987 567\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "555 555\n", "output": "555 554\n0 0\n555 555\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "555 1\n", "output": "555 1\n0 0\n555 0\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n", "output": "1 4\n0 0\n0 4\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "955 956\n", "output": "1 0\n955 956\n0 0\n954 956\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 0\n", "output": "1 0\n4 0\n0 0\n3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0 3\n", "output": "0 1\n0 3\n0 0\n0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 0\n", "output": "1 0\n3 0\n0 0\n2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n", "output": "0 0\n2 3\n2 0\n0 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2\n", "output": "0 0\n3 2\n0 2\n3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n", "output": "0 0\n3 4\n3 0\n0 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3\n", "output": "0 0\n4 3\n0 3\n4 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 5\n", "output": "0 0\n3 5\n3 0\n0 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3\n", "output": "0 0\n5 3\n0 3\n5 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6\n", "output": "0 0\n3 6\n3 0\n0 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3\n", "output": "0 0\n6 3\n0 3\n6 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n", "output": "0 1\n4 4\n0 0\n3 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n", "output": "1 0\n4 5\n0 0\n3 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n", "output": "0 1\n5 4\n0 0\n5 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n", "output": "1 0\n4 6\n0 0\n3 6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4\n", "output": "0 1\n6 4\n0 0\n6 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 7\n", "output": "1 0\n4 7\n0 0\n3 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 4\n", "output": "0 1\n7 4\n0 0\n7 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100\n", "output": "3 100\n0 0\n0 100\n3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 3\n", "output": "100 3\n0 0\n100 0\n0 3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100\n", "output": "3 100\n0 0\n4 100\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 4\n", "output": "100 3\n0 0\n100 4\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "30 1000\n", "output": "1 0\n30 1000\n0 0\n29 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 30\n", "output": "0 1\n1000 30\n0 0\n1000 29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 40\n", "output": "0 1\n1000 40\n0 0\n1000 39\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 1000\n", "output": "1 0\n40 1000\n0 0\n39 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n", "output": "2 10\n0 0\n0 10\n2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 3\n", "output": "0 0\n9 3\n0 3\n9 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000\n", "output": "2 1000\n0 0\n0 1000\n2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 2\n", "output": "100 2\n0 0\n100 0\n0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1\n", "output": "0 0\n3 1\n0 1\n3 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100\n", "output": "2 100\n0 0\n0 100\n2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7\n", "output": "0 0\n3 7\n3 0\n0 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 50\n", "output": "0 0\n2 50\n2 0\n0 50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n", "output": "1 5\n0 0\n0 5\n1 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000\n", "output": "0 0\n3 1000\n3 0\n0 1000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2\n", "output": "0 0\n5 2\n0 2\n5 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 0\n", "output": "1 0\n10 0\n0 0\n9 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 0\n", "output": "1 0\n20 0\n0 0\n19 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 3\n", "output": "0 0\n1000 3\n0 3\n1000 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 500\n", "output": "1000 499\n0 0\n1000 500\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n", "output": "0 0\n2 5\n2 0\n0 5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1\n", "output": "0 0\n2 1\n0 1\n2 0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 2\n", "output": "1000 2\n0 0\n1000 0\n0 2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5\n", "output": "0 1\n6 5\n0 0\n6 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4\n", "output": "0 0\n2 4\n2 0\n0 4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 10\n", "output": "20 9\n0 0\n20 10\n0 1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1\n", "output": "10 1\n0 0\n10 0\n0 1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
240
Solve the following coding problem using the programming language python: Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order while this note was passed to Kate. The only thing that Vasya remembers, is a non-empty substring of n (a substring of n is a sequence of consecutive digits of the number n). Vasya knows that there may be more than one way to restore the number n. Your task is to find the smallest possible initial integer n. Note that decimal representation of number n contained no leading zeroes, except the case the integer n was equal to zero itself (in this case a single digit 0 was used). -----Input----- The first line of the input contains the string received by Kate. The number of digits in this string does not exceed 1 000 000. The second line contains the substring of n which Vasya remembers. This string can contain leading zeroes. It is guaranteed that the input data is correct, and the answer always exists. -----Output----- Print the smalles integer n which Vasya could pass to Kate. -----Examples----- Input 003512 021 Output 30021 Input 199966633300 63 Output 3036366999 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import math from collections import Counter s = list(map(int, input())) substr = input().rstrip() t = list(map(int, substr)) m = len(s) x, y = 0, m z = (x + y) // 2 while z != x: if z + math.floor(math.log10(z)) + 1 <= m: x = z else: y = z z = (x + y)//2 m1 = z k = math.floor(math.log10(m1)) + 1 D = Counter(s) D.subtract(list(map(int, str(m1)))) D.subtract(t) try: c1 = min(i for i in range(1, 10) if D[i] > 0) c2 = t[0] D[c1] -= 1 _prefix = [c1] for c in range(c2): _prefix += [c] * D[c] _suffix = [] for c in range(c2 + 1, 10): _suffix += [c] * D[c] num = ''.join([str(c2)] * D[c2]) prefix = ''.join(map(str, _prefix)) suffix = ''.join(map(str, _suffix)) if c2 == 0: print((min(prefix + substr + num + suffix, prefix + num + substr + suffix))) else: D[c1] += 1 st = [] for c in range(10): st += [c] * D[c] print((min(prefix + substr + num + suffix, prefix + num + substr + suffix, substr + ''.join(map(str, st))))) except ValueError: print(substr + '0'*D[0]) ```
vfc_10714
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/670/F", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "003512\n021\n", "output": "30021\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "199966633300\n63\n", "output": "3036366999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "01\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0000454312911\n9213544\n", "output": "92135440000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "00010454312921\n9213544\n", "output": "100009213544\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11317110\n01\n", "output": "1011113\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1516532320120301262110112013012410838210025280432402042406224604110031740090203024020012\n0126064\n", "output": "10000000000000000000000012606411111111111111222222222222222222333333334444444455567889\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "233121122272652143504001162131110307236110231414093112213120271312010423132181004\n0344011\n", "output": "1000000000003440111111111111111111111112222222222222222233333333333444455666778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1626112553124100114021300410533124010061200562040601301\n00612141\n", "output": "10000000000000006121411111111111222222333344445556666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "040005088\n0\n", "output": "40000058\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "420002200110100211206222101201021321440210\n00\n", "output": "1000000000000011111111112222222222223446\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "801095116\n0\n", "output": "10011569\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "070421120216020020\n000024\n", "output": "1000000024122227\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "825083\n0\n", "output": "20388\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6201067\n0\n", "output": "100267\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34404430311310306128103301112523111011050561125004200941114005444000000040133002103062151514033103\n010215110013511400400140133404\n", "output": "100000000000000000000102151100135114004001401334041111111111111122222233333333333444444455555668\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "204\n4\n", "output": "40\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "05740110115001520111222011422101032503200010203300510014413\n000151\n", "output": "100000000000000000001511111111111111222222222333334444555\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "116051111111001510011110101111111101001111111101111101101\n00111111111\n", "output": "1000000000000011111111111111111111111111111111111111116\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1161100\n01110\n", "output": "101110\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "101313020013110703821620035452130200177115540090000\n002001320\n", "output": "1000000000000002001320111111111222333334555567778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "03111100110111111118\n01001111111101111\n", "output": "301001111111101111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "01170141\n01114\n", "output": "1001114\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0500014440100110264222000342611000102247070652310723\n0003217\n", "output": "10000000000000000032171111112222222233444444566677\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111011111101111131113111111111011\n0111111111111111010111111111\n", "output": "1011111111111111101011111111113\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11003040044200003323519101102070252000010622902208104150200400140042011224011154237302003323632011235\n0\n", "output": "100000000000000000000000000000000001111111111111111222222222222222222333333333334444444445555566778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111111011110101141110110011010011114110111\n01010111111011111\n", "output": "1000000101011111101111111111111111111114\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "011010171110\n010110117\n", "output": "1010110117\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "510017\n0\n", "output": "10017\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "00111111110114112110011105\n0\n", "output": "100000011111111111111115\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "320403902031031110003113410860101243100423120201101124080311242010930103200001451200132304400000\n01\n", "output": "1000000000000000000000000000000000011111111111111111111122222222222233333333333334444444456889\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "125\n15\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1160190\n110019\n", "output": "110019\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11111111111101101111110101011111010101001111001110010011810010110111101101112140110110\n110101100101111101011111111101111111111110111110011111011000111010100111011111000002\n", "output": "110101100101111101011111111101111111111110111110011111011000111010100111011111000002\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2206026141112316065224201412118064151200614042100160093001020024005013121010030020083221011\n280060226\n", "output": "10000000000000000000000000111111111111111111111222222222222228006022633333444444455566666\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "63007511113226210230771304213600010311075400082011350143450007091200\n25\n", "output": "100000000000000000000011111111111112222222533333333444455567777789\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "142245201505011321217122212\n12521721230\n", "output": "1001111125217212302222445\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "712\n17\n", "output": "17\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11011111111003010101111111111103111\n101111111110110111111011001011111\n", "output": "101111111110110111111011001011111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "143213104201201003340424615500135122127119000020020017400111102423312241032010400\n235321200411204201121201304100003\n", "output": "1000000000000001111111111222222223532120041120420112120130410000333334444445567\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "080001181\n18\n", "output": "10000118\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4141403055010511470013300502174230460332129228041229160601006121052601201100001153120100000\n49\n", "output": "10000000000000000000000000000011111111111111111112222222222223333333444444495555556666677\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2131\n112\n", "output": "112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0111110011011110111012109101101111101111150011110111110111001\n10110010111111011111111011001101001111111111111110001011012\n", "output": "10110010111111011111111011001101001111111111111110001011012\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "251137317010111402300506643001203241303324162124225270011006213015100\n3512\n", "output": "1000000000000000001111111111111122222222223333333335124444455566677\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12140051050330004342310455231200020252193200\n23012\n", "output": "100000000000001111222222301233333444555559\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "291\n19\n", "output": "19\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11011011000111101111111111081101110001011111101111110111111111011111011011111100111\n1110111111111\n", "output": "100000000000000000011101111111111111111111111111111111111111111111111111111111111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "170422032160671323013220212523333410720410110020005012206133500200001015971250190240204004002041\n10010405153200037262043200214001340010615320\n", "output": "1000000000000000100104051532000372620432002140013400106153201111111122222222222233333445567779\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "210042022032002310001424611003103312001401111120015141083050404330261401411234412400319100212120\n10014121114054\n", "output": "1000000000000000000000000010014121114054111111111111111111222222222222223333333333444444445668\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "222122228\n2221\n", "output": "22212222\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11007000\n1000\n", "output": "1000001\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3323\n32\n", "output": "323\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1001016\n1001\n", "output": "100101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50104\n10\n", "output": "1005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2023\n20\n", "output": "202\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "0001116\n1001\n", "output": "100101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32334\n32\n", "output": "3233\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1103\n10\n", "output": "101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "023335\n23\n", "output": "23033\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "111111111110\n1\n", "output": "1111111111\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "501105\n110\n", "output": "11005\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1110006\n1001\n", "output": "100101\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
241
Solve the following coding problem using the programming language python: Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors. The testing goes in n steps, at each step the processor gets some instructions, and then its temperature is measured. The head engineer in R2 is keeping a report record on the work of the processor: he writes down the minimum and the maximum measured temperature in his notebook. His assistant had to write down all temperatures into his notebook, but (for unknown reasons) he recorded only m. The next day, the engineer's assistant filed in a report with all the m temperatures. However, the chief engineer doubts that the assistant wrote down everything correctly (naturally, the chief engineer doesn't doubt his notes). So he asked you to help him. Given numbers n, m, min, max and the list of m temperatures determine whether you can upgrade the set of m temperatures to the set of n temperatures (that is add n - m temperatures), so that the minimum temperature was min and the maximum one was max. -----Input----- The first line contains four integers n, m, min, max (1 ≤ m < n ≤ 100; 1 ≤ min < max ≤ 100). The second line contains m space-separated integers t_{i} (1 ≤ t_{i} ≤ 100) — the temperatures reported by the assistant. Note, that the reported temperatures, and the temperatures you want to add can contain equal temperatures. -----Output----- If the data is consistent, print 'Correct' (without the quotes). Otherwise, print 'Incorrect' (without the quotes). -----Examples----- Input 2 1 1 2 1 Output Correct Input 3 1 1 3 2 Output Correct Input 2 1 1 3 2 Output Incorrect -----Note----- In the first test sample one of the possible initial configurations of temperatures is [1, 2]. In the second test sample one of the possible initial configurations of temperatures is [2, 1, 3]. In the third test sample it is impossible to add one temperature to obtain the minimum equal to 1 and the maximum equal to 3. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def main(): n, m, mn, mx = map(int, input().split()) A = list(map(int, input().split())) a = min(A) b = max(A) if a < mn or b > mx: print("Incorrect") return cnt = 0 if a > mn: cnt += 1 if b < mx: cnt += 1 if m + cnt <= n: print("Correct") else: print("Incorrect") main() ```
vfc_10718
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/413/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 1 1 2\n1\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 1 3\n2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 3\n2\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 1 5\n3\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 5\n1 5\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 5\n1 1\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 5\n5 5\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 5\n1 6\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 5 10\n1 10\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 3 6\n4 4 4 4 4\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 50 68 97\n20 42 93 1 98 6 32 11 48 46 82 96 24 73 40 100 99 10 55 87 65 80 97 54 59 48 30 22 16 92 66 2 22 60 23 81 64 60 34 60 99 99 4 70 91 99 30 20 41 96\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 50 1 2\n1 1 2 1 1 2 2 1 1 1 1 1 2 2 1 2 1 2 2 1 1 1 2 2 2 1 1 2 1 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 1 2 2 2 1 2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99 1 2\n2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2 100\n40 1\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2 3\n4 4\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 2 4\n2 2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1 1 4\n1\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 7 1 4\n4 3 3 2 2 4 1\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 5 2 3\n4 2 4 3 3\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 3 1 3\n1 4 2\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 99\n34 100\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 1 99\n100 38\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 1 99\n100 38\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 1 99\n36 51\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 6 3 10\n5 10 7 7 4 5\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 6 3 10\n8 5 7 8 4 4\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 6 3 10\n9 7 7 5 3 10\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 15 30 40\n36 37 35 36 34 34 37 35 32 33 31 38 39 38 38\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 15 30 40\n38 36 37 34 30 38 38 31 38 38 36 39 39 37 35\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 15 30 40\n35 37 31 32 30 33 36 38 36 38 31 30 39 32 36\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 16 30 40\n39 32 37 31 40 32 36 34 56 34 40 36 37 36 33 36\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 16 30 40\n32 35 33 39 34 30 37 34 30 34 39 18 32 37 37 36\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 16 30 40\n36 30 37 30 37 32 34 30 35 35 33 35 39 37 46 37\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2 100\n38\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1 2 100\n1\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1 2 100\n1\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 38 1 3\n3 2 3 2 3 2 3 3 1 1 1 2 2 1 3 2 3 1 3 3 1 3 3 2 1 2 2 3 1 2 1 3 2 2 3 1 1 2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2 10\n6 3 10\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "41 6 4 10\n10 7 4 9 9 10\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21 1 1 9\n9\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 9 10\n10\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2 9\n9\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 7 5 9\n6 7 8 5 5 6 6\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2 8\n7 2\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "71 36 1 10\n7 10 8 1 3 8 5 7 3 10 8 1 6 4 5 7 8 2 4 3 4 10 8 5 1 2 8 8 10 10 4 3 7 9 7 8\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "85 3 4 9\n4 8 7\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 4 10\n9 10 5\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 5\n1\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 75 1 10\n2 6 9 7 4 9 4 8 10 6 4 1 10 6 5 9 7 5 1 4 6 4 8 2 1 3 5 7 6 9 5 5 8 1 7 1 4 2 8 3 1 6 6 2 10 6 2 2 8 5 4 5 5 3 10 9 4 3 1 9 10 3 2 4 8 7 4 9 3 1 1 1 3 4 5\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 4 1 8\n7 9 6 6\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 1 3 10\n2\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 2 4 8\n6 3\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17 6 2 8\n3 8 6 1 6 4\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21 1 5 8\n4\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 10\n9\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 4 8\n5\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 1 7\n6\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 4 9\n5\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 3 8\n7\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 5 9\n6\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 10\n4 9\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 4 10\n7\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2 9\n8\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 3 9\n3\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 6 7\n6 6\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 1 10\n11 10 9 1\n", "output": "Incorrect\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 6 3 8\n3 4 5 6 7 8\n", "output": "Correct\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 1 5\n2 3 4\n", "output": "Correct\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
242
Solve the following coding problem using the programming language python: Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among those great programmers who can solve this problem? -----Input----- The only line of input contains an integer m (1 ≤ m ≤ 100 000) — the required number of trailing zeroes in factorial. -----Output----- First print k — the number of values of n such that the factorial of n ends with m zeroes. Then print these k integers in increasing order. -----Examples----- Input 1 Output 5 5 6 7 8 9 Input 5 Output 0 -----Note----- The factorial of n is equal to the product of all integers from 1 to n inclusive, that is n! = 1·2·3·...·n. In the first sample, 5! = 120, 6! = 720, 7! = 5040, 8! = 40320 and 9! = 362880. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python m = int(input()) a = 0 while m > 0: a += 5 b = a c = 0 while b % 5 == 0: b //= 5 c += 1 m -= c if m < 0: print(0) else: print(5) print(a, a + 1, a + 2, a + 3, a + 4) ```
vfc_10722
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/633/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1\n", "output": "5\n5 6 7 8 9 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n", "output": "5\n10 11 12 13 14 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n", "output": "5\n15 16 17 18 19 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n", "output": "5\n30 31 32 33 34 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n", "output": "5\n50 51 52 53 54 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n", "output": "5\n65 66 67 68 69 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n", "output": "5\n75 76 77 78 79 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "38\n", "output": "5\n155 156 157 158 159 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "47\n", "output": "5\n195 196 197 198 199 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "58\n", "output": "5\n240 241 242 243 244 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "66\n", "output": "5\n270 271 272 273 274 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "70\n", "output": "5\n285 286 287 288 289 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "89\n", "output": "5\n365 366 367 368 369 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "417\n", "output": "5\n1675 1676 1677 1678 1679 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "815\n", "output": "5\n3265 3266 3267 3268 3269 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "394\n", "output": "5\n1585 1586 1587 1588 1589 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "798\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "507\n", "output": "5\n2035 2036 2037 2038 2039 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "406\n", "output": "5\n1630 1631 1632 1633 1634 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "570\n", "output": "5\n2290 2291 2292 2293 2294 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "185\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "765\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "967\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "112\n", "output": "5\n455 456 457 458 459 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "729\n", "output": "5\n2925 2926 2927 2928 2929 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "4604\n", "output": "5\n18425 18426 18427 18428 18429 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "8783\n", "output": "5\n35140 35141 35142 35143 35144 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "1059\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "6641\n", "output": "5\n26575 26576 26577 26578 26579 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "9353\n", "output": "5\n37425 37426 37427 37428 37429 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "1811\n", "output": "5\n7250 7251 7252 7253 7254 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2528\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "8158\n", "output": "5\n32640 32641 32642 32643 32644 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "3014\n", "output": "5\n12070 12071 12072 12073 12074 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "7657\n", "output": "5\n30640 30641 30642 30643 30644 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "4934\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "9282\n", "output": "5\n37140 37141 37142 37143 37144 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2610\n", "output": "5\n10450 10451 10452 10453 10454 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "2083\n", "output": "5\n8345 8346 8347 8348 8349 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "26151\n", "output": "5\n104620 104621 104622 104623 104624 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "64656\n", "output": "5\n258640 258641 258642 258643 258644 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "46668\n", "output": "5\n186690 186691 186692 186693 186694 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "95554\n", "output": "5\n382235 382236 382237 382238 382239 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "37320\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "52032\n", "output": "5\n208140 208141 208142 208143 208144 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "11024\n", "output": "5\n44110 44111 44112 44113 44114 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "63218\n", "output": "5\n252885 252886 252887 252888 252889 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "40095\n", "output": "5\n160390 160391 160392 160393 160394 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "42724\n", "output": "5\n170910 170911 170912 170913 170914 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "24381\n", "output": "5\n97530 97531 97532 97533 97534 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "73138\n", "output": "5\n292570 292571 292572 292573 292574 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "93346\n", "output": "5\n373400 373401 373402 373403 373404 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "18338\n", "output": "5\n73370 73371 73372 73373 73374 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "42662\n", "output": "5\n170660 170661 170662 170663 170664 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "81221\n", "output": "5\n324900 324901 324902 324903 324904 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000\n", "output": "5\n400005 400006 400007 400008 400009 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000\n", "output": "5\n400005 400006 400007 400008 400009 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "99998\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "30\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "780\n", "output": "0", "type": "stdin_stdout" }, { "fn_name": null, "input": "97656\n", "output": "5\n390625 390626 390627 390628 390629 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "12499\n", "output": "5\n50000 50001 50002 50003 50004 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "65\n", "output": "5\n265 266 267 268 269 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "41\n", "output": "5\n170 171 172 173 174 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "31\n", "output": "5\n125 126 127 128 129 ", "type": "stdin_stdout" }, { "fn_name": null, "input": "86577\n", "output": "0", "type": "stdin_stdout" } ] }
apps
verifiable_code
243
Solve the following coding problem using the programming language python: Chouti was tired of the tedious homework, so he opened up an old programming problem he created years ago. You are given a connected undirected graph with $n$ vertices and $m$ weighted edges. There are $k$ special vertices: $x_1, x_2, \ldots, x_k$. Let's define the cost of the path as the maximum weight of the edges in it. And the distance between two vertexes as the minimum cost of the paths connecting them. For each special vertex, find another special vertex which is farthest from it (in terms of the previous paragraph, i.e. the corresponding distance is maximum possible) and output the distance between them. The original constraints are really small so he thought the problem was boring. Now, he raises the constraints and hopes you can solve it for him. -----Input----- The first line contains three integers $n$, $m$ and $k$ ($2 \leq k \leq n \leq 10^5$, $n-1 \leq m \leq 10^5$) — the number of vertices, the number of edges and the number of special vertices. The second line contains $k$ distinct integers $x_1, x_2, \ldots, x_k$ ($1 \leq x_i \leq n$). Each of the following $m$ lines contains three integers $u$, $v$ and $w$ ($1 \leq u,v \leq n, 1 \leq w \leq 10^9$), denoting there is an edge between $u$ and $v$ of weight $w$. The given graph is undirected, so an edge $(u, v)$ can be used in the both directions. The graph may have multiple edges and self-loops. It is guaranteed, that the graph is connected. -----Output----- The first and only line should contain $k$ integers. The $i$-th integer is the distance between $x_i$ and the farthest special vertex from it. -----Examples----- Input 2 3 2 2 1 1 2 3 1 2 2 2 2 1 Output 2 2 Input 4 5 3 1 2 3 1 2 5 4 2 1 2 3 2 1 4 4 1 3 3 Output 3 3 3 -----Note----- In the first example, the distance between vertex $1$ and $2$ equals to $2$ because one can walk through the edge of weight $2$ connecting them. So the distance to the farthest node for both $1$ and $2$ equals to $2$. In the second example, one can find that distance between $1$ and $2$, distance between $1$ and $3$ are both $3$ and the distance between $2$ and $3$ is $2$. The graph may have multiple edges between and self-loops, as in the first example. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def g(): return list(map(int,input().split())) n,m,k=g() p=list(range(n+1)) z=[0]*(n+1) for x in g(): z[x]=1 e=[] for i in range(m): u,v,w=g() e+=[(w,u,v)] e=sorted(e) def q(x): if x!=p[x]: p[x]=q(p[x]) return p[x] for w,u,v in e: u=q(u);v=q(v) if u!=v: if u%5==3: u,v=v,u p[u]=v;z[v]+=z[u] if z[v]==k: print(((str(w)+' ')*k));return ```
vfc_10726
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1081/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 3 2\n2 1\n1 2 3\n1 2 2\n2 2 1\n", "output": "2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5 3\n1 2 3\n1 2 5\n4 2 1\n2 3 2\n1 4 4\n1 3 3\n", "output": "3 3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 7 4\n1 2 3 4\n1 2 3\n5 1 4\n3 1 1\n4 2 5\n2 5 6\n2 3 3\n3 4 6\n", "output": "5 5 5 5 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1 2\n1 2\n1 2 1000000000\n", "output": "1000000000 1000000000 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 2\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 5\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 2\n3 4\n1 2 1000000000\n2 3 1000000000\n3 1 1000000000\n3 4 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 1000\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 2\n1 2 1\n2 3 2\n3 4 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 2\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 4\n1 2 1\n2 3 3\n3 4 1\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5 2\n1 2\n1 2 1\n2 3 2\n3 4 2\n4 5 2\n5 1 2\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n4 5\n1 2 10\n2 3 10\n3 4 1\n3 5 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 10\n2 3 15\n", "output": "10 10 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 100\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 5\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 4\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n3 4\n1 2 2\n1 3 4\n3 4 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 4\n1 2 3 4\n1 2 1\n2 3 1\n3 4 1\n4 5 1\n5 6 10\n", "output": "1 1 1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n1 2 3\n1 2 5\n1 3 4\n1 4 5\n", "output": "5 5 5 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 2\n2 3 3\n", "output": "2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 6 2\n6 7\n1 2 1\n2 3 1\n3 4 1\n4 5 1\n5 6 1\n6 7 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n3 2\n1 2 233\n2 3 3\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n2 3\n1 2 100\n2 3 1\n3 4 100\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n2 3\n1 2 1000\n2 3 1\n3 4 1000\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 2\n2 1\n1 2 3\n1 2 2\n2 2 1\n1 3 99\n", "output": "2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 3\n1 2 4\n1 3 3\n3 2 2\n2 4 1\n3 5 4\n5 6 10\n", "output": "3 3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 10\n3 2 20\n", "output": "10 10 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 4\n1 2 1\n2 3 5\n3 4 1\n", "output": "5 5 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n4 5\n1 2 100\n2 3 100\n3 4 100\n4 5 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 3\n1 3 5\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 3\n2 3 5\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 3\n2 3 100\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n4 5\n1 2 10\n2 3 10\n3 4 1\n4 5 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 100\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 10\n2 3 100\n", "output": "10 10 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 2\n1 2 1\n2 3 1000\n3 4 1000\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 3\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n3 4\n1 2 10000\n2 3 10000\n3 4 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n1 2\n1 2 1\n1 3 1000\n2 3 1000\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 2\n1 2\n1 2 3\n1 2 5\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n3 4\n1 2 9\n2 3 6\n3 4 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 1000\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 4\n1 2 3\n2 3 4\n3 4 3\n", "output": "4 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n4 5\n1 2 100\n2 3 100\n3 4 10\n3 5 20\n", "output": "20 20 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 2\n1 2 1\n2 3 23\n3 4 1231\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 4\n1 2 4\n2 3 6\n3 4 4\n", "output": "6 6 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 2\n1 2 1\n2 3 123\n3 4 12321\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 1\n1 2 1\n2 3 100\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n3 4\n1 2 100\n2 3 2\n2 4 2\n", "output": "2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n1 2\n1 2 1\n2 3 12\n3 4 123123\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\n1 2 3\n1 2 1\n1 3 2\n2 3 3\n3 4 5\n", "output": "2 2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 2\n1 5\n1 2 1\n1 3 2\n2 4 5\n3 5 3\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n1 2\n1 2 1\n2 3 4\n1 3 5\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\n1 2 3\n1 2 1\n2 3 2\n1 3 3\n1 4 4\n", "output": "2 2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 47\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n3 2 10\n2 1 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 10\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n1 2 3\n1 2 1\n3 1 2\n4 3 3\n", "output": "2 2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 2\n3 4\n1 2 5\n2 3 3\n2 4 4\n", "output": "4 4 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 3\n1 2 1\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n1 2\n1 2 1\n2 3 3\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4 3\n1 2 4\n1 2 10\n2 3 100\n2 4 20\n5 3 1000\n", "output": "20 20 20 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5 2\n2 3\n1 2 5\n4 2 1\n2 3 2\n1 4 4\n1 3 3\n", "output": "2 2 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n1 2 3\n1 2 6\n1 3 7\n1 4 10\n", "output": "7 7 7 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 2\n1 6\n1 2 1\n2 3 2\n3 4 3\n4 5 2\n5 6 1\n", "output": "3 3 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n2 3\n1 2 100\n1 3 100\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n2 3\n1 2 7\n2 3 1\n", "output": "1 1 \n", "type": "stdin_stdout" } ] }
apps
verifiable_code
244
Solve the following coding problem using the programming language python: Bomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played by two persons: operator and player. Operator takes three similar opaque shells and places a ball beneath one of them. Then he shuffles the shells by swapping some pairs and the player has to guess the current position of the ball. Bomboslav noticed that guys are not very inventive, so the operator always swaps the left shell with the middle one during odd moves (first, third, fifth, etc.) and always swaps the middle shell with the right one during even moves (second, fourth, etc.). Let's number shells from 0 to 2 from left to right. Thus the left shell is assigned number 0, the middle shell is 1 and the right shell is 2. Bomboslav has missed the moment when the ball was placed beneath the shell, but he knows that exactly n movements were made by the operator and the ball was under shell x at the end. Now he wonders, what was the initial position of the ball? -----Input----- The first line of the input contains an integer n (1 ≤ n ≤ 2·10^9) — the number of movements made by the operator. The second line contains a single integer x (0 ≤ x ≤ 2) — the index of the shell where the ball was found after n movements. -----Output----- Print one integer from 0 to 2 — the index of the shell where the ball was initially placed. -----Examples----- Input 4 2 Output 1 Input 1 1 Output 0 -----Note----- In the first sample, the ball was initially placed beneath the middle shell and the operator completed four movements. During the first move operator swapped the left shell and the middle shell. The ball is now under the left shell. During the second move operator swapped the middle shell and the right one. The ball is still under the left shell. During the third move operator swapped the left shell and the middle shell again. The ball is again in the middle. Finally, the operators swapped the middle shell and the right shell. The ball is now beneath the right shell. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def main(): n = int(input()) k = int(input()) n %= 6 a = [0, 1, 2] for i in range(1, n + 1): if (i % 2 == 1): a[0], a[1] = a[1], a[0] else: a[1], a[2] = a[2], a[1] print(a[k]) main() ```
vfc_10730
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/777/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000000000\n0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100000\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99999\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99998\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99997\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99996\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99995\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999995\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999995\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999995\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999996\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999996\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999996\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999997\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999997\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999997\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999998\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999998\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999998\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999999\n0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999999\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999999999\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000000000\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2000000000\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1234567890\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1234567890\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1234567890\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456789\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456789\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456789\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "123456790\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32\n1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "76994383\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n0\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "150\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "21\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n0\n", "output": "2\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
245
Solve the following coding problem using the programming language python: You are given n rectangles. The corners of rectangles have integer coordinates and their edges are parallel to the Ox and Oy axes. The rectangles may touch each other, but they do not overlap (that is, there are no points that belong to the interior of more than one rectangle). Your task is to determine if the rectangles form a square. In other words, determine if the set of points inside or on the border of at least one rectangle is precisely equal to the set of points inside or on the border of some square. -----Input----- The first line contains a single integer n (1 ≤ n ≤ 5). Next n lines contain four integers each, describing a single rectangle: x_1, y_1, x_2, y_2 (0 ≤ x_1 < x_2 ≤ 31400, 0 ≤ y_1 < y_2 ≤ 31400) — x_1 and x_2 are x-coordinates of the left and right edges of the rectangle, and y_1 and y_2 are y-coordinates of the bottom and top edges of the rectangle. No two rectangles overlap (that is, there are no points that belong to the interior of more than one rectangle). -----Output----- In a single line print "YES", if the given rectangles form a square, or "NO" otherwise. -----Examples----- Input 5 0 0 2 3 0 3 3 5 2 0 5 2 3 2 5 5 2 2 3 3 Output YES Input 4 0 0 2 3 0 3 3 5 2 0 5 2 3 2 5 5 Output NO The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) s = 0 INF = 10**9 minx = miny = INF maxx = maxy = -INF for i in range(n): x1, y1, x2, y2 = list(map(int, input().split())) s += abs(x1 - x2) * abs(y1 - y2) minx = min(minx, x1, x2) maxx = max(maxx, x1, x2) miny = min(miny, y1, y2) maxy = max(maxy, y1, y2) if (maxx - minx) == (maxy - miny) and s == (maxx - minx) ** 2: print ("YES") else: print ("NO") ```
vfc_10734
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/325/A", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\n0 0 2 3\n0 3 3 5\n2 0 5 2\n3 2 5 5\n2 2 3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 2 3\n0 3 3 5\n2 0 5 2\n3 2 5 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 10000 20000\n10000 0 15000 19999\n10000 19999 14999 20000\n0 20000 15000 31400\n15000 0 31400 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 10000 20000\n10000 0 15000 19999\n10000 19999 15000 20000\n0 20000 15000 31400\n15000 0 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n10359 859 28918 4384\n2895 26520 28918 26882\n2895 26424 28918 26520\n2895 859 10359 4384\n2895 4384 28918 26424\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n12750 0 25688 1\n1094 0 12750 1\n0 0 956 1\n956 0 1094 1\n25688 0 31400 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n18006 16484 25725 31400\n0 0 31400 16484\n29563 16484 31400 31400\n25725 16484 29563 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 31400 13313\n0 13313 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 9388 31400 31400\n26020 0 31400 9388\n0 0 26020 9388\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n15164 0 19356 3925\n0 0 15164 31400\n15164 3925 31400 31400\n19356 3278 31400 3925\n19356 0 31400 3278\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n20421 5189 23141 12511\n16414 10436 17880 12511\n17880 10436 20421 12511\n15819 10436 16414 12511\n15819 5189 20421 10436\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n15819 5189 23141 12511\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n12052 12345 12343 18147\n12343 12345 12345 18147\n6543 12345 12052 18147\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n12750 0 25688 1\n1094 0 12750 1\n0 0 956 1\n956 0 1094 1\n25688 0 31400 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 7098 1 7460\n0 7460 1 15218\n0 15218 1 31400\n0 4974 1 7098\n0 0 1 4974\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 31400 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 1 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 25169 1 27914\n0 0 1 1366\n0 10763 1 25169\n0 1366 1 10138\n0 27914 1 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 10575 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 3006 1 17592\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n123 4819 5819 29511\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n123 4819 5819 6612\n123 6612 5819 12692\n123 12692 5819 29511\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3091 4819 5743 13222\n123 13222 5819 29511\n5743 4819 5819 13222\n123 4819 2215 13222\n2215 4819 3091 13222\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n8030 7681 8491 7682\n8491 7681 8961 7682\n7666 7681 7963 7682\n7963 7681 8030 7682\n678 7681 7666 7682\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1234 1234 1235 1235\n1238 1234 1239 1235\n1235 1234 1236 1235\n1237 1234 1238 1235\n1236 1234 1237 1235\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n20812 5661 27208 5898\n20812 581 29415 5661\n27539 5661 29415 5898\n18961 581 20812 5898\n27208 5661 27539 5898\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n31399 31399 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n20499 0 31400 22815\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 1273 26470 9100\n0 16615 31400 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n25784 0 31400 20408\n0 20408 31400 20582\n15802 0 18106 20408\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n18006 16484 25725 31400\n0 0 31400 16484\n29563 16484 31400 31400\n25725 16484 29563 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n26466 0 26474 6206\n10906 0 17073 6321\n19720 0 26356 31400\n0 0 10906 7852\n0 21437 18466 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1338 31399 1525 31400\n1525 31399 2595 31400\n961 31399 1338 31400\n2956 31399 31400 31400\n2595 31399 2956 31400\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1349 0 1391 3766\n1234 0 1238 417\n1391 0 5000 3766\n1234 417 1238 3766\n1238 0 1349 3766\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 100 30000\n100 0 31400 5000\n100 5000 20000 30000\n0 30000 20000 31400\n20000 5000 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 100 30000\n100 0 31400 5000\n100 5000 20000 30000\n0 30000 20000 31000\n20000 5000 31400 31000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n8591 1234 9517 19512\n696 19512 9517 31400\n696 696 8591 19512\n8591 696 31400 1234\n9517 1234 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 1 1\n0 3 1 4\n0 1 1 2\n0 2 1 3\n0 4 1 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 2\n0 3 1 4\n0 4 1 5\n0 2 1 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 1 1 3\n0 3 1 5\n0 0 1 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 1 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 2 1\n2 0 3 2\n0 1 1 3\n1 2 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0 2 1\n2 0 3 2\n0 1 1 3\n1 2 3 3\n1 1 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 10000 31400\n10000 0 31400 31400\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 10000 31400\n10000 0 31400 31399\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 1 18\n5 0 6 18\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 1 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 2 6\n2 2 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2 3 3\n4 4 6 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 1 1\n1 0 2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 1 1\n2 2 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 1\n5 5 6 6\n10 10 11 11\n13 13 14 14\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 3 5\n3 3 5 5\n4 1 5 3\n3 1 4 2\n2 5 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n10 10 11 11\n11 11 12 12\n11 10 12 11\n9 12 10 13\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 2 4\n10 0 12 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 1 1\n0 1 1 2\n0 2 1 3\n0 3 1 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 1 1\n3 3 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 3 1\n0 2 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 5 5\n1 5 5 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n0 0 1 1\n1 0 3 3\n0 2 1 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 10 10\n10 10 20 20\n10 0 20 10\n10 20 11 120\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0 1 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0 4 2\n0 2 3 6\n3 4 6 6\n4 0 6 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n0 0 1 1\n1 1 2 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1 2 2\n3 3 4 4\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
246
Solve the following coding problem using the programming language python: Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different special properties, he wants to know how rare (or not rare) they are — in fact, he needs to calculate the quantity of really big numbers that are not greater than n. Ivan tried to do the calculations himself, but soon realized that it's too difficult for him. So he asked you to help him in calculations. -----Input----- The first (and the only) line contains two integers n and s (1 ≤ n, s ≤ 10^18). -----Output----- Print one integer — the quantity of really big numbers that are not greater than n. -----Examples----- Input 12 1 Output 3 Input 25 20 Output 0 Input 10 9 Output 1 -----Note----- In the first example numbers 10, 11 and 12 are really big. In the second example there are no really big numbers that are not greater than 25 (in fact, the first really big number is 30: 30 - 3 ≥ 20). In the third example 10 is the only really big number (10 - 1 ≥ 9). The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def check(x, s): k = 0 for i in str(x): k += int(i) return x - k >= s n, s = map(int, input().split()) l = 0 r = n while r - l > 1: m = (l + r) // 2 if check(m, s): r = m else: l = m if check(r, s): print(n - r + 1) else: print(0) ```
vfc_10738
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/817/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "12 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25 20\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "300 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500 1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000 2000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10000 1000\n", "output": "8991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 100000000000000000\n", "output": "899999999999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 10000000000000000\n", "output": "989999999999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 1000000000000000\n", "output": "998999999999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 100000000000000\n", "output": "999899999999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 200000000000000000\n", "output": "799999999999999991\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 5\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 9\n", "output": "11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 9\n", "output": "91\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "130 118\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "190 181\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1999 1971\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 99\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6909094398 719694282\n", "output": "6189400069\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "260 258\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 19\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 87\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "91 89\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109 89\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109 91\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20331 11580\n", "output": "8732\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "405487470 255750281\n", "output": "149737161\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17382 12863\n", "output": "4493\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19725 14457\n", "output": "5246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24848 15384\n", "output": "9449\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "25727 15982\n", "output": "9728\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "109 90\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 999999999999999999\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 999999999999999998\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1009 980\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999999999 999999999999999838\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1000000000000000000 99999999999999800\n", "output": "900000000000000061\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8785369357 3377262261\n", "output": "5408107058\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "110 109\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 777\n", "output": "200\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "327170000015578 77230000029054\n", "output": "249939999986479\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12515000022229 1791000022317\n", "output": "10723999999880\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999999999999 9999999999882\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "213 196\n", "output": "14\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "92 82\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "148 136\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8 9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "309 299\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999 9963\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82 81\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9999999 9999936\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "171 155\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999 972\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "999999999999 999999999891\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 9\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6900 6885\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "96 57\n", "output": "27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17386 5814\n", "output": "11557\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "493679757404593 316259583979965\n", "output": "177420173424564\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18474 9478\n", "output": "8975\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "270091571496186 250931112649966\n", "output": "19160458846177\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "565751690089037 381448507916936\n", "output": "184303182172038\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 10\n", "output": "0\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
247
Solve the following coding problem using the programming language python: You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct. You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way that every point lies on at least one of these lines? -----Input----- The first line contains one integer n (1 ≤ n ≤ 10^5) — the number of points you are given. Then n lines follow, each line containing two integers x_{i} and y_{i} (|x_{i}|, |y_{i}| ≤ 10^9)— coordinates of i-th point. All n points are distinct. -----Output----- If it is possible to draw two straight lines in such a way that each of given points belongs to at least one of these lines, print YES. Otherwise, print NO. -----Examples----- Input 5 0 0 0 1 1 1 1 -1 2 2 Output YES Input 5 0 0 1 0 2 1 1 1 2 3 Output NO -----Note----- In the first example it is possible to draw two lines, the one containing the points 1, 3 and 5, and another one containing two remaining points. [Image] The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) L = [(0, 0)] * n for i in range(n): t = input().split(' ') a = int(t[0]) b = int(t[1]) L[i] = (a, b) if n <= 4: print("YES") else: b0 = True b1 = True b2 = True L0 = [] L1 = [] L2 = [] for j in range(n): if (L[0][0]-L[1][0])*(L[0][1]-L[j][1])!=(L[0][1]-L[1][1])*(L[0][0]-L[j][0]): L2.append(L[j]) if (L[2][0]-L[0][0])*(L[2][1]-L[j][1])!=(L[2][1]-L[0][1])*(L[2][0]-L[j][0]): L1.append(L[j]) if (L[2][0]-L[1][0])*(L[2][1]-L[j][1])!=(L[2][1]-L[1][1])*(L[2][0]-L[j][0]): L0.append(L[j]) if len(L0) >= 3: for j in range(2, len(L0)): if (L0[0][0]-L0[1][0])*(L0[0][1]-L0[j][1])!=(L0[0][1]-L0[1][1])*(L0[0][0]-L0[j][0]): b0 = False if len(L1) >= 3: for j in range(2, len(L1)): if (L1[0][0]-L1[1][0])*(L1[0][1]-L1[j][1])!=(L1[0][1]-L1[1][1])*(L1[0][0]-L1[j][0]): b1 = False if len(L2) >= 3: for j in range(2, len(L2)): if (L2[0][0]-L2[1][0])*(L2[0][1]-L2[j][1])!=(L2[0][1]-L2[1][1])*(L2[0][0]-L2[j][0]): b2 = False if b0 or b1 or b2: print("YES") else: print("NO") ```
vfc_10742
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/961/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\n0 0\n0 1\n1 1\n1 -1\n2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n1 0\n2 1\n1 1\n2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n-1000000000 1000000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 -1\n-4 1\n0 -9\n5 -9\n9 -10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n6 1\n10 5\n10 -2\n-2 -10\n-4 -9\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-10 3\n4 -5\n-9 5\n-5 -3\n-4 -6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n2 9\n-1 -4\n-3 -8\n-4 8\n7 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n315 202\n315 203\n315 204\n-138 -298\n-136 -295\n-134 -292\n-132 -289\n-130 -286\n-128 -283\n-126 -280\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n416 -473\n-162 491\n-164 488\n-170 479\n-166 485\n-172 476\n416 -475\n416 -474\n-168 482\n-160 494\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n1 1\n0 1\n1 0\n0 2\n2 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 3\n6 3\n0 0\n10 0\n-10 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 0\n1 0\n0 1\n0 2\n2 0\n3 0\n0 3\n0 4\n4 0\n0 -10000000\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n0 1\n0 2\n1 1\n1 2\n2 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 -1\n1 -1\n3 3\n2 0\n-2 -2\n1 -2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1000000000 1000000000\n999999999 999999999\n999999999 999999998\n-1000000000 1000000000\n-1000000000 999999999\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n1 0\n0 1\n1 1\n-1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n0 1\n0 -1\n1 1\n1 -1\n2 -1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0\n0 1\n1 0\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n1 0\n2 1\n1 1\n0 1\n6 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n536870912 536870912\n268435456 368435456\n268435456 168435456\n1 3\n2 4\n3 5\n4 6\n5 7\n6 8\n7 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n0 1\n100 100\n100 99\n100 98\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n0 0\n1 0\n2 1\n1 1\n0 1\n6 0\n5 0\n7 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n2 0\n1 1\n0 2\n5 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n0 0\n4 0\n1 1\n2 2\n3 1\n5 1\n6 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1\n2 2\n3 2\n4 1\n5 2\n6 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n0 0\n1 0\n2 0\n3 0\n0 1\n1 1\n2 1\n3 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "12\n0 0\n1 1\n2 2\n3 3\n10 11\n20 11\n30 11\n40 11\n-1 1\n-2 2\n-3 3\n-4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n165580141 267914296\n331160282 535828592\n267914296 433494437\n535828592 866988874\n433494437 701408733\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1000000000 -1000000000\n-588442013 -868997024\n-182303377 -739719081\n-999999999 -999999999\n229254610 -608716105\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1000000000 -1000000000\n229254610 -608716105\n-588442013 -868997024\n-182303377 -739719081\n-176884026 -737994048\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n0 1\n0 2\n5 0\n5 1\n5 -1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 1\n1 0\n1 1\n1 -1\n-1 -1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1000000000 -1000000000\n229254610 -608716105\n-588442013 -868997024\n-182303377 -739719081\n-999999999 -999999999\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n1 1\n0 0\n-1 -1\n1 0\n0 -1\n-1 -10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n8 8\n3303829 10\n10 1308\n4 2\n6 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n0 1\n0 2\n0 3\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n165580142 267914296\n331160283 535828592\n267914296 433494437\n535828592 866988874\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59\n1 0\n0 2\n0 3\n0 4\n0 5\n6 0\n7 0\n8 0\n9 0\n10 0\n0 11\n12 0\n13 0\n14 0\n15 0\n0 16\n0 17\n18 0\n19 0\n20 0\n21 0\n0 22\n23 0\n24 0\n0 25\n26 0\n27 0\n0 28\n0 29\n30 0\n31 0\n0 32\n33 0\n34 0\n0 35\n0 36\n37 0\n0 38\n39 0\n40 0\n0 41\n42 0\n0 43\n0 44\n0 45\n0 46\n47 0\n0 48\n0 49\n50 0\n0 51\n0 52\n53 0\n0 54\n55 0\n0 56\n57 0\n0 58\n59 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n10000000 40000100\n3 112\n2 400000100\n1 104\n1000000 701789036\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n514 2131\n312 52362\n1 1\n2 2\n3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n-65536 65536\n0 65536\n65536 65536\n-65536 0\n0 0\n65536 0\n-65536 -65536\n0 -65536\n65536 -65536\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 -7\n0 10000\n1 1000000000\n100 0\n200 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n0 0\n2 2\n2 -2\n-2 2\n-2 -2\n0 1\n0 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n3 0\n4 1\n0 0\n1 1\n2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-65536 -65536\n65536 0\n131072 0\n0 65536\n0 131072\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0\n1 0\n0 1\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n2 0\n0 2\n0 -2\n-2 1\n-4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1000000000 -1000000000\n134903170 -298591267\n-566505563 -732085704\n-298591267 -566505563\n-133011126 -464171408\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1000000000 -1000000000\n134903170 -298591267\n-566505563 -732085704\n-298591267 -566505563\n-999999999 -999999999\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1\n-1 0\n0 1\n-1 1\n0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n-1 -1\n0 -1\n-1 1\n-1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n-1 1\n-1 0\n0 -1\n-1 -1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n-1 1\n-1 0\n1 1\n-1 -1\n0 -1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-1 2\n-1 1\n2 1\n-2 2\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-1 -1\n-1 -2\n-1 -3\n1000000000 1\n-1000000000 0\n999999999 1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-1 -1\n-1 -2\n-1 -3\n0 0\n65536 65536\n65536 131072\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n-1 -1\n-1 -2\n-1 -3\n1000000000 1\n999999999 1\n-1000000000 0\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-1 1\n-1 -1\n0 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n1 -1\n3 -3\n1 2\n0 -2\n1 -3\n0 1\n0 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n0 0\n-1 1\n-1 -1\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n0 0\n0 1\n-1 1\n0 -1\n1 0\n-1 -1\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1\n0 0\n-1 0\n0 1\n1 0\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n-2 -2\n2 3\n3 -2\n1 -2\n2 -2\n2 0\n2 2\n-3 -2\n-1 -2\n2 -3\n2 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n-1 0\n-1 1\n1 0\n1 -1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 -1\n0 0\n0 1\n-1 1\n1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 0\n1 1\n0 -2\n1 -1\n1 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n-999999998 -999999998\n229254612 -608716103\n-588442011 -868997022\n-182303375 -739719079\n-176884024 -737994046\n", "output": "YES\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
248
Solve the following coding problem using the programming language python: Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and add them to their current scores. The game has exactly t turns. Memory and Lexa, however, are not good at this game, so they both always get a random integer at their turn. Memory wonders how many possible games exist such that he ends with a strictly higher score than Lexa. Two games are considered to be different if in at least one turn at least one player gets different score. There are (2k + 1)^2t games in total. Since the answer can be very large, you should print it modulo 10^9 + 7. Please solve this problem for Memory. -----Input----- The first and only line of input contains the four integers a, b, k, and t (1 ≤ a, b ≤ 100, 1 ≤ k ≤ 1000, 1 ≤ t ≤ 100) — the amount Memory and Lexa start with, the number k, and the number of turns respectively. -----Output----- Print the number of possible games satisfying the conditions modulo 1 000 000 007 (10^9 + 7) in one line. -----Examples----- Input 1 2 2 1 Output 6 Input 1 1 1 2 Output 31 Input 2 12 3 1 Output 0 -----Note----- In the first sample test, Memory starts with 1 and Lexa starts with 2. If Lexa picks - 2, Memory can pick 0, 1, or 2 to win. If Lexa picks - 1, Memory can pick 1 or 2 to win. If Lexa picks 0, Memory can pick 2 to win. If Lexa picks 1 or 2, Memory cannot win. Thus, there are 3 + 2 + 1 = 6 possible games in which Memory wins. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python mod=10**9+7 f=[0]*500000 def POW(a,b): if(b==0): return 1 if(b&1): return POW(a,b//2)**2*a%mod else: return POW(a,b//2)**2 def C(n,m): if(m>n): return 0 t=f[n]*POW(f[m],mod-2)%mod*POW(f[n-m],mod-2)%mod return t f[0]=1 for i in range(1,500000): f[i]=f[i-1]*i%mod a,b,k,t=list(map(int,input().split(' '))) ans=0 for i in range(0,2*t+1): t1=POW(-1,i)*C(2*t,i)%mod t2=(C(210000+2*k*t-a+b+2*t-1-(2*k+1)*i+1,2*t)-C(1+2*k*t-a+b+2*t-1-(2*k+1)*i,2*t))%mod ans=(ans+t1*t2)%mod print(ans) ```
vfc_10746
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/712/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "1 2 2 1\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1 2\n", "output": "31\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 12 3 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6 2 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6 2 2\n", "output": "122\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 2 2\n", "output": "435\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 1 3 3\n", "output": "112812\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 3 1 1\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "50 22 5 5\n", "output": "876439301\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 20 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42 42 2 3\n", "output": "6937\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42 42 3 2\n", "output": "1085\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "45 54 4 5\n", "output": "433203628\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 5 4 3\n", "output": "282051\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "42 42 42 42\n", "output": "284470145\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 42 42\n", "output": "58785421\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100 1000 100\n", "output": "542673827\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1000 100\n", "output": "922257788\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 100 1000 100\n", "output": "922257788\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 8 1 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9 4 5 2\n", "output": "11045\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6 6 2\n", "output": "8015\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 8 5 9\n", "output": "860378382\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 7 8 6\n", "output": "510324293\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 69 803 81\n", "output": "74925054\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "67 67 871 88\n", "output": "123371511\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "71 71 891 31\n", "output": "790044038\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 49 631 34\n", "output": "764129060\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "83 83 770 49\n", "output": "761730117\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "49 49 163 15\n", "output": "458364105\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "38 38 701 74\n", "output": "496603581\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "65 65 803 79\n", "output": "253679300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "56 56 725 64\n", "output": "338598412\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "70 70 176 56\n", "output": "990579000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "32 32 44 79\n", "output": "20803934\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 35 353 21\n", "output": "149936279\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "57 57 896 52\n", "output": "271910130\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "86 86 373 19\n", "output": "940701970\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "27 27 296 97\n", "output": "394599845\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60 60 86 51\n", "output": "277883413\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 40 955 95\n", "output": "600387428\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "34 34 706 59\n", "output": "274236101\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "74 74 791 51\n", "output": "367968499\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "69 69 443 53\n", "output": "385620893\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "59 19 370 48\n", "output": "125206836\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "78 82 511 33\n", "output": "375900871\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "66 90 805 16\n", "output": "593436252\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "60 61 772 19\n", "output": "931528755\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "81 13 607 21\n", "output": "762608093\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35 79 128 21\n", "output": "177972209\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "93 25 958 20\n", "output": "873170266\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 85 206 80\n", "output": "170080402\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "79 99 506 18\n", "output": "486170430\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "97 22 29 8\n", "output": "471632954\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 47 184 49\n", "output": "726421144\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "74 33 868 5\n", "output": "826980486\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "53 79 823 11\n", "output": "526626321\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "99 99 913 42\n", "output": "446683872\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "52 34 89 41\n", "output": "905639400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "87 100 200 80\n", "output": "913761305\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "40 94 510 53\n", "output": "233079261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 56 438 41\n", "output": "500592304\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 68 958 41\n", "output": "719351710\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "44 80 814 26\n", "output": "414148151\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 1 1000 100\n", "output": "603336175\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 3 1000 100\n", "output": "604187087\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10 1000 100\n", "output": "922257788\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
249
Solve the following coding problem using the programming language python: Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measurements. We assume that the marks are numbered from 1 to n in the order they appear from the beginning of the ruler to its end. The first point coincides with the beginning of the ruler and represents the origin. The last mark coincides with the end of the ruler, at distance l from the origin. This ruler can be repesented by an increasing sequence a_1, a_2, ..., a_{n}, where a_{i} denotes the distance of the i-th mark from the origin (a_1 = 0, a_{n} = l). Valery believes that with a ruler he can measure the distance of d centimeters, if there is a pair of integers i and j (1 ≤ i ≤ j ≤ n), such that the distance between the i-th and the j-th mark is exactly equal to d (in other words, a_{j} - a_{i} = d). Under the rules, the girls should be able to jump at least x centimeters, and the boys should be able to jump at least y (x < y) centimeters. To test the children's abilities, Valery needs a ruler to measure each of the distances x and y. Your task is to determine what is the minimum number of additional marks you need to add on the ruler so that they can be used to measure the distances x and y. Valery can add the marks at any integer non-negative distance from the origin not exceeding the length of the ruler. -----Input----- The first line contains four positive space-separated integers n, l, x, y (2 ≤ n ≤ 10^5, 2 ≤ l ≤ 10^9, 1 ≤ x < y ≤ l) — the number of marks, the length of the ruler and the jump norms for girls and boys, correspondingly. The second line contains a sequence of n integers a_1, a_2, ..., a_{n} (0 = a_1 < a_2 < ... < a_{n} = l), where a_{i} shows the distance from the i-th mark to the origin. -----Output----- In the first line print a single non-negative integer v — the minimum number of marks that you need to add on the ruler. In the second line print v space-separated integers p_1, p_2, ..., p_{v} (0 ≤ p_{i} ≤ l). Number p_{i} means that the i-th mark should be at the distance of p_{i} centimeters from the origin. Print the marks in any order. If there are multiple solutions, print any of them. -----Examples----- Input 3 250 185 230 0 185 250 Output 1 230 Input 4 250 185 230 0 20 185 250 Output 0 Input 2 300 185 230 0 300 Output 2 185 230 -----Note----- In the first sample it is impossible to initially measure the distance of 230 centimeters. For that it is enough to add a 20 centimeter mark or a 230 centimeter mark. In the second sample you already can use the ruler to measure the distances of 185 and 230 centimeters, so you don't have to add new marks. In the third sample the ruler only contains the initial and the final marks. We will need to add two marks to be able to test the children's skills. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import itertools import math def can_measure(a, d): return any(i + d in a for i in a) def main(): n, l, x, y = list(map(int, input().split())) a = set(map(int, input().split())) can_x = can_measure(a, x) can_y = can_measure(a, y) if can_x and can_y: print(0) elif can_x: print(1) print(y) elif can_y: print(1) print(x) else: for i in a: if i + x + y in a: print(1) print(i + x) break else: t = i + x - y in a if 0 <= i + x <= l and t: print(1) print(i + x) break; if 0 <= i - y <= l and t: print(1) print(i - y) break; else: print(2) print(x, y) def __starting_point(): main() __starting_point() ```
vfc_10750
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/479/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "3 250 185 230\n0 185 250\n", "output": "1\n230\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 250 185 230\n0 20 185 250\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 300 185 230\n0 300\n", "output": "2\n185 230\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 300 4 5\n0 6 7 300\n", "output": "1\n11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100 30 70\n0 100\n", "output": "1\n30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 300 140 160\n0 300\n", "output": "1\n140\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 300 1 2\n0 298 299 300\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 350 150 160\n0 310 350\n", "output": "1\n150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 300 4 5\n0 298 299 300\n", "output": "1\n294\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "19 180 117 148\n0 1 19 20 21 28 57 65 68 70 78 88 100 116 154 157 173 179 180\n", "output": "2\n117 148\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14 134 99 114\n0 6 8 19 50 61 69 83 84 96 111 114 125 134\n", "output": "1\n99\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18 187 27 157\n0 17 18 31 36 37 40 53 73 86 96 107 119 150 167 181 184 187\n", "output": "1\n27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "20 179 69 120\n0 6 8 11 21 24 55 61 83 84 96 111 114 116 125 140 147 154 176 179\n", "output": "1\n27\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16 115 62 112\n0 5 24 32 38 43 44 57 62 72 74 92 103 105 113 115\n", "output": "1\n112\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "112 1867 1261 1606\n0 7 17 43 67 70 87 112 129 141 148 162 179 180 189 202 211 220 231 247 250 277 308 311 327 376 400 406 409 417 418 444 480 512 514 515 518 547 572 575 578 587 612 617 654 684 701 742 757 761 788 821 825 835 841 843 850 858 869 872 881 936 939 969 970 971 997 1026 1040 1045 1068 1070 1073 1076 1095 1110 1115 1154 1166 1178 1179 1203 1204 1225 1237 1241 1246 1275 1302 1305 1311 1312 1315 1338 1340 1419 1428 1560 1561 1576 1591 1594 1618 1643 1658 1660 1664 1689 1803 1822 1835 1867\n", "output": "1\n1808\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1 2\n0 2\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 1 2\n0 1 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 2 3\n0 1 10\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 3 5\n0 1 9 10\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 1000 777 778\n0 1 500 501 1000\n", "output": "1\n778\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 1 3\n0 2 10\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 300 120 150\n0 110 140 300\n", "output": "1\n260\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 401 300 400\n0 100 250 350 401\n", "output": "1\n400\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 1 8\n0 7 10\n", "output": "1\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1000 2 3\n0 400 405 1000\n", "output": "1\n402\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 12 7 10\n0 1 3 4 6 12\n", "output": "1\n10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1000 10 20\n0 500 530 1000\n", "output": "1\n510\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 8 2 3\n0 7 8\n", "output": "1\n5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 8 9\n0 4 5 10\n", "output": "2\n8 9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 7 8\n0 5 6 10\n", "output": "2\n7 8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 35 29 30\n0 10 11 31 32 35\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 200000 1 100029\n0 100000 100009 100010 200000\n", "output": "1\n100029\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1000 900 901\n0 950 951 1000\n", "output": "1\n50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 504 400 500\n0 3 5 103 105 504\n", "output": "1\n503\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 550 300 400\n0 151 251 450 550\n", "output": "1\n150\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 300 40 50\n0 280 290 300\n", "output": "1\n240\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000 100000000 500000000\n0 1000000000\n", "output": "2\n100000000 500000000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 600 100 400\n0 50 350 600\n", "output": "1\n450\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 7 8\n0 3 4 100\n", "output": "1\n11\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 80 81\n0 2 3 100\n", "output": "1\n83\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 13 8 10\n0 2 13\n", "output": "1\n10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 7 8\n0 4 5 10\n", "output": "2\n7 8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 450 100 400\n0 150 450\n", "output": "1\n50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 500 30 50\n0 20 40 500\n", "output": "1\n50\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 10 11\n0 4 5 100\n", "output": "1\n15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10 5 7\n0 10\n", "output": "2\n5 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 100 70 71\n0 50 51 90 91 100\n", "output": "1\n20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 9 6 7\n0 4 5 9\n", "output": "2\n6 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 1 8\n0 3 10\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12 1 2\n0 10 12\n", "output": "1\n1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 3 5\n0 40 48 100\n", "output": "1\n43\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 20 17 18\n0 19 20\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 1000 45 46\n0 2 3 1000\n", "output": "1\n48\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 5 7\n0 4 6 10\n", "output": "2\n5 7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 12 1 3\n0 10 12\n", "output": "1\n9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 20 6 7\n0 1 15 20\n", "output": "1\n7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 11 3 5\n0 9 11\n", "output": "1\n6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 100 9 10\n0 99 100\n", "output": "1\n90\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 7 8\n0 1 10\n", "output": "1\n8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 5 6\n0 9 10\n", "output": "1\n4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 7 8\n0 9 10\n", "output": "1\n2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10 6 7\n0 9 10\n", "output": "1\n3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 9 6 7\n0 1 9\n", "output": "1\n7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 1000000000 99 100\n0 1 1000000000\n", "output": "1\n100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10 3 5\n0 2 4 10\n", "output": "1\n5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 90 91\n0 7 8 100\n", "output": "1\n98\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 100 80 81\n0 98 99 100\n", "output": "1\n18\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
250
Solve the following coding problem using the programming language python: As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake. Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has n simple cakes and he is going to make a special cake placing some cylinders on each other. However, there are some additional culinary restrictions. The cakes are numbered in such a way that the cake number i can be placed only on the table or on some cake number j where j < i. Moreover, in order to impress friends Babaei will put the cake i on top of the cake j only if the volume of the cake i is strictly greater than the volume of the cake j. Babaei wants to prepare a birthday cake that has a maximum possible total volume. Help him find this value. -----Input----- The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of simple cakes Babaei has. Each of the following n lines contains two integers r_{i} and h_{i} (1 ≤ r_{i}, h_{i} ≤ 10 000), giving the radius and height of the i-th cake. -----Output----- Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed 10^{ - 6}. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if $\frac{|a - b|}{\operatorname{max}(1, b)} \leq 10^{-6}$. -----Examples----- Input 2 100 30 40 10 Output 942477.796077000 Input 4 1 1 9 7 1 4 10 7 Output 3983.539484752 -----Note----- In first sample, the optimal way is to choose the cake number 1. In second sample, the way to get the maximum volume is to use cakes with indices 1, 2 and 4. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python import math from functools import reduce class SegmentTree(): def __init__(self, L, function = lambda x,y: x+y): self.function = function N = self.size = len(L) M = 1 << N.bit_length() self.margin = 2*M - N self.L = [None for i in range(self.margin)] + L for i in range(M-1, 0, -1): x, y = self.L[i<<1], self.L[i<<1|1] self.L[i] = None if x is None or y is None else function(x, y) def modify(self, pos, value): p = pos + self.margin self.L[p] = value while p > 1: x, y = self.L[p], self.L[p^1] if p&1: x, y = y, x self.L[p>>1] = None if x is None or y is None else self.function(x, y) p>>=1 def query(self, left, right): l, r = left + self.margin, right + self.margin stack = [] void = True while l < r: if l&1: if void: result = self.L[l] void = False else: result = self.function(result, self.L[l]) l+=1 if r&1: r-=1 stack.append(self.L[r]) l>>=1 r>>=1 init = stack.pop() if void else result return reduce(self.function, reversed(stack), init) n = int(input()) pies, index, first_equal = [0]*n, [0]*n, [0]*n for i in range(n): r, h = [int(x) for x in input().split()] pies[i] = r*r*h s_pies = list(sorted(enumerate(pies), key = lambda p: p[1])) for i in range(n): index[s_pies[i][0]] = i for i in range(1, n): first_equal[s_pies[i][0]] = i if s_pies[i][1] != s_pies[i-1][1] else first_equal[s_pies[i-1][0]] towers = SegmentTree([0]*(n+1), max) for j, pie in enumerate(pies): i, k = index[j], first_equal[j] q = towers.query(0, k+1) towers.modify(i+1, q + pie) print(math.pi * towers.query(0, n+1)) ```
vfc_10754
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/629/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2\n100 30\n40 10\n", "output": "942477.796077000\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n9 7\n1 4\n10 7\n", "output": "3983.539484752\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 2\n1 1\n3 3\n", "output": "109.955742876\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 2\n3 3\n1 1\n", "output": "109.955742876\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 3\n1 1\n2 2\n", "output": "84.823001647\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1\n2 2\n3 3\n", "output": "113.097335529\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 1\n3 3\n2 2\n", "output": "87.964594301\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 3\n2 2\n1 1\n", "output": "84.823001647\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1 1\n", "output": "3.141592654\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n2 2\n", "output": "28.274333882\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2\n1 1\n", "output": "25.132741229\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n2 2\n3 3\n4 4\n", "output": "314.159265359\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n2 2\n4 4\n3 3\n", "output": "229.336263712\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n3 3\n2 2\n4 4\n", "output": "289.026524130\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n3 3\n4 4\n2 2\n", "output": "289.026524130\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n4 4\n2 2\n3 3\n", "output": "204.203522483\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1\n4 4\n3 3\n2 2\n", "output": "204.203522483\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n1 1\n3 3\n4 4\n", "output": "311.017672705\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n1 1\n4 4\n3 3\n", "output": "226.194671058\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n3 3\n1 1\n4 4\n", "output": "311.017672705\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n3 3\n4 4\n1 1\n", "output": "311.017672705\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n4 4\n1 1\n3 3\n", "output": "226.194671058\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2\n4 4\n3 3\n1 1\n", "output": "226.194671058\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n1 1\n2 2\n4 4\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n1 1\n4 4\n2 2\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n2 2\n1 1\n4 4\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n2 2\n4 4\n1 1\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n4 4\n1 1\n2 2\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3\n4 4\n2 2\n1 1\n", "output": "285.884931477\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n1 1\n2 2\n3 3\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n1 1\n3 3\n2 2\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n2 2\n1 1\n3 3\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n2 2\n3 3\n1 1\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n3 3\n1 1\n2 2\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4\n3 3\n2 2\n1 1\n", "output": "201.061929830\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n14 3600\n105 64\n40 441\n15 3136\n24 1225\n42 400\n84 100\n12 4900\n120 49\n56 225\n140 36\n70 144\n168 25\n60 196\n30 784\n280 9\n10 7056\n21 1600\n28 900\n210 16\n420 4\n840 1\n35 576\n20 1764\n", "output": "2216707.776373104\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n40 9\n12 100\n60 4\n20 36\n24 25\n15 64\n120 1\n4 900\n6 400\n5 576\n10 144\n30 16\n3 1600\n2 3600\n8 225\n", "output": "45238.934211696\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n8 324\n12 144\n72 4\n144 1\n48 9\n3 2304\n24 36\n2 5184\n9 256\n36 16\n6 576\n4 1296\n18 64\n16 81\n", "output": "65144.065264842\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n4 1764\n24 49\n84 4\n21 64\n28 36\n6 784\n7 576\n2 7056\n168 1\n56 9\n3 3136\n8 441\n14 144\n42 16\n12 196\n", "output": "88668.311054924\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n3 3200\n2 7200\n20 72\n8 450\n60 8\n15 128\n4 1800\n5 1152\n24 50\n40 18\n120 2\n6 800\n30 32\n12 200\n10 288\n", "output": "90477.868423392\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n6 900\n20 81\n45 16\n4 2025\n15 144\n9 400\n2 8100\n3 3600\n10 324\n30 36\n5 1296\n12 225\n36 25\n18 100\n90 4\n60 9\n180 1\n", "output": "101787.601976316\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n24 72\n3 4608\n18 128\n72 8\n48 18\n144 2\n4 2592\n16 162\n9 512\n6 1152\n12 288\n36 32\n8 648\n", "output": "130288.130529684\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n60 12\n20 108\n24 75\n120 3\n3 4800\n5 1728\n6 1200\n8 675\n12 300\n4 2700\n30 48\n15 192\n40 27\n10 432\n", "output": "135716.802635088\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n105 4\n14 225\n6 1225\n7 900\n35 36\n10 441\n30 49\n5 1764\n21 100\n70 9\n42 25\n3 4900\n210 1\n15 196\n", "output": "138544.236023319\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n6 1296\n216 1\n18 144\n3 5184\n8 729\n4 2916\n72 9\n12 324\n9 576\n54 16\n36 36\n27 64\n108 4\n24 81\n", "output": "146574.146845895\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n4 3528\n12 392\n24 98\n84 8\n14 288\n42 32\n168 2\n56 18\n6 1568\n8 882\n3 6272\n21 128\n28 72\n7 1152\n", "output": "177336.622109848\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "18\n3 6400\n4 3600\n20 144\n8 900\n24 100\n15 256\n30 64\n16 225\n10 576\n48 25\n5 2304\n80 9\n60 16\n240 1\n6 1600\n40 36\n12 400\n120 4\n", "output": "180955.736846784\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n3 6912\n144 3\n24 108\n18 192\n16 243\n36 48\n9 768\n12 432\n4 3888\n48 27\n72 12\n8 972\n6 1728\n", "output": "195432.195794527\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n126 4\n21 144\n3 7056\n14 324\n42 36\n63 16\n28 81\n36 49\n7 1296\n84 9\n252 1\n4 3969\n6 1764\n9 784\n12 441\n18 196\n", "output": "199503.699873579\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n45 32\n12 450\n60 18\n9 800\n180 2\n6 1800\n4 4050\n36 50\n3 7200\n18 200\n15 288\n30 72\n20 162\n90 8\n10 648\n5 2592\n", "output": "203575.203952632\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n22 144\n24 121\n264 1\n6 1936\n132 4\n33 64\n4 4356\n12 484\n66 16\n3 7744\n44 36\n11 576\n88 9\n8 1089\n", "output": "218956.441584609\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n30 80\n5 2880\n4 4500\n3 8000\n10 720\n12 500\n8 1125\n6 2000\n60 20\n120 5\n24 125\n15 320\n40 45\n20 180\n", "output": "226194.671058480\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n27 100\n135 4\n3 8100\n45 36\n90 9\n30 81\n6 2025\n270 1\n54 25\n18 225\n10 729\n15 324\n5 2916\n9 900\n", "output": "229022.104446711\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n28 100\n140 4\n20 196\n5 3136\n56 25\n4 4900\n40 49\n7 1600\n35 64\n70 16\n10 784\n280 1\n14 400\n8 1225\n", "output": "246300.864041456\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n32 81\n96 9\n12 576\n3 9216\n18 256\n144 4\n36 64\n16 324\n72 16\n4 5184\n48 36\n288 1\n8 1296\n6 2304\n24 144\n9 1024\n", "output": "260576.261059369\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n3 9408\n12 588\n4 5292\n24 147\n42 48\n7 1728\n168 3\n84 12\n6 2352\n28 108\n56 27\n8 1323\n21 192\n14 432\n", "output": "266004.933164772\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n20 216\n12 600\n5 3456\n10 864\n15 384\n3 9600\n4 5400\n30 96\n8 1350\n6 2400\n24 150\n60 24\n120 6\n40 54\n", "output": "271433.605270176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "14\n35 72\n21 200\n6 2450\n5 3528\n70 18\n30 98\n10 882\n15 392\n105 8\n210 2\n42 50\n3 9800\n14 450\n7 1800\n", "output": "277088.472046638\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "16\n100 9\n3 10000\n60 25\n15 400\n75 16\n10 900\n50 36\n150 4\n25 144\n6 2500\n12 625\n5 3600\n20 225\n30 100\n4 5625\n300 1\n", "output": "282743.338823100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n72 18\n24 162\n36 72\n4 5832\n18 288\n54 32\n12 648\n9 1152\n108 8\n216 2\n8 1458\n27 128\n6 2592\n", "output": "293148.293691790\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n36 75\n45 48\n6 2700\n9 1200\n30 108\n18 300\n12 675\n20 243\n5 3888\n4 6075\n60 27\n90 12\n10 972\n180 3\n15 432\n", "output": "305362.805928948\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "13\n12 676\n39 64\n6 2704\n8 1521\n52 36\n312 1\n13 576\n104 9\n4 6084\n156 4\n24 169\n78 16\n26 144\n", "output": "305815.195271065\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n4 2\n2 2\n4 1\n3 1\n1 1\n4 3\n5 1\n4 3\n4 1\n", "output": "304.734487398\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n8 3\n6 3\n4 2\n7 3\n6 3\n", "output": "801.106126665\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n1 1\n", "output": "3.141592654\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n10 10\n10 10\n10 10\n", "output": "3141.592653590\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n100 30\n100 30\n", "output": "942477.796077000\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
251
Solve the following coding problem using the programming language python: There is a toy building consisting of $n$ towers. Each tower consists of several cubes standing on each other. The $i$-th tower consists of $h_i$ cubes, so it has height $h_i$. Let's define operation slice on some height $H$ as following: for each tower $i$, if its height is greater than $H$, then remove some top cubes to make tower's height equal to $H$. Cost of one "slice" equals to the total number of removed cubes from all towers. Let's name slice as good one if its cost is lower or equal to $k$ ($k \ge n$). [Image] Calculate the minimum number of good slices you have to do to make all towers have the same height. Of course, it is always possible to make it so. -----Input----- The first line contains two integers $n$ and $k$ ($1 \le n \le 2 \cdot 10^5$, $n \le k \le 10^9$) — the number of towers and the restriction on slices, respectively. The second line contains $n$ space separated integers $h_1, h_2, \dots, h_n$ ($1 \le h_i \le 2 \cdot 10^5$) — the initial heights of towers. -----Output----- Print one integer — the minimum number of good slices you have to do to make all towers have the same heigth. -----Examples----- Input 5 5 3 1 2 2 4 Output 2 Input 4 5 2 3 4 5 Output 2 -----Note----- In the first example it's optimal to make $2$ slices. The first slice is on height $2$ (its cost is $3$), and the second one is on height $1$ (its cost is $4$). The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python def ii(): return int(input()) def mi(): return list(map(int, input().split())) def li(): return list(mi()) n, k = mi() h = li() m = max(h) f = [0] * (m + 1) for hi in h: f[hi] += 1 for i in range(m - 1, 0, -1): f[i] += f[i + 1] ans = 0 i = m while i > 0: if f[i] == n: break j = i cur = 0 while j > 0: if cur + f[j] > k: break cur += f[j] j -= 1 ans += 1 i = j print(ans) ```
vfc_10758
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1065/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5 5\n3 1 2 2 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n2 3 4 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 20\n5 5 5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n2 2 2 2 7\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n10 10 10\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 100\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n4 4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100\n5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5\n5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n1000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n4 4 4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3\n1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 10\n2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2\n1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 6\n3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n1 9\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 200000\n200000\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n1 200000 200000\n", "output": "199999\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n5 5 5\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n1 9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3\n100 100 100\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n2 2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000\n1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n1 3 3 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n8 8 8 8 8\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10\n1 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 44550514\n127593\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 10\n10\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4\n3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n1 1 1 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2\n2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n5 5 5 5 11\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 10\n2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n4 4 4 4\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 5\n1 1 1 1 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 15\n2 2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 6\n2 2 2 2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 4\n2\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n1 2 4 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1\n234\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4\n2 4 4 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 5\n3 3 3 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 10\n2 2 2 2 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2164\n10648\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 25584\n13182 19648\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 1000000000\n1 2\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
252
Solve the following coding problem using the programming language python: Alice and Bob are playing yet another card game. This time the rules are the following. There are $n$ cards lying in a row in front of them. The $i$-th card has value $a_i$. First, Alice chooses a non-empty consecutive segment of cards $[l; r]$ ($l \le r$). After that Bob removes a single card $j$ from that segment $(l \le j \le r)$. The score of the game is the total value of the remaining cards on the segment $(a_l + a_{l + 1} + \dots + a_{j - 1} + a_{j + 1} + \dots + a_{r - 1} + a_r)$. In particular, if Alice chooses a segment with just one element, then the score after Bob removes the only card is $0$. Alice wants to make the score as big as possible. Bob takes such a card that the score is as small as possible. What segment should Alice choose so that the score is maximum possible? Output the maximum score. -----Input----- The first line contains a single integer $n$ ($1 \le n \le 10^5$) — the number of cards. The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($-30 \le a_i \le 30$) — the values on the cards. -----Output----- Print a single integer — the final score of the game. -----Examples----- Input 5 5 -2 10 -1 4 Output 6 Input 8 5 2 5 3 -30 -30 6 9 Output 10 Input 3 -10 6 -15 Output 0 -----Note----- In the first example Alice chooses a segment $[1;5]$ — the entire row of cards. Bob removes card $3$ with the value $10$ from the segment. Thus, the final score is $5 + (-2) + (-1) + 4 = 6$. In the second example Alice chooses a segment $[1;4]$, so that Bob removes either card $1$ or $3$ with the value $5$, making the answer $5 + 2 + 3 = 10$. In the third example Alice can choose any of the segments of length $1$: $[1;1]$, $[2;2]$ or $[3;3]$. Bob removes the only card, so the score is $0$. If Alice chooses some other segment then the answer will be less than $0$. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n = int(input()) l = list(map(int,input().split())) curr = 0 best = 0 prevs = [0] * 31 for v in l: curr += v if v >= 0: for i in range(0, v): prevs[i] = curr for i in range(v, 31): best = max(curr - prevs[i] - i, best) else: for i in range(31): prevs[i] = min(prevs[i], curr) print(best) ```
vfc_10762
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1359/D", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\n5 -2 10 -1 4\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n5 2 5 3 -30 -30 6 9\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n-10 6 -15\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n6\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n0 5 -4 3 -1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15\n1 -26 -6 26 7 10 -2 -4 -6 14 -9 25 9 -12 -28\n", "output": "44\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n3 0 1 -2 5 -5 -1 0 3 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n25 -13 17 -23 12 12 9\n", "output": "21\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\n4 -10 13 -13 2 2 -11 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n30 -20 5 1 3 -20 30\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n5 -4 1 1 1 -4 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-5 28 -18 -10 9 -2 11 -6 -19 30\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n30 -25 0 6 9 -2 10\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n8 -7 7 -6 5 5\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 -4 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n17 -16 12 -11 15\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n15 -14 10 10 10 -14 15\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n30 -29 10 10 10 -29 30\n", "output": "20\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 2 -3 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n25 -17 13 13 -25 25 -24\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n30 -29 4 -3 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n10 -8 3 3 -8 10\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n11 -5 -5 1 2 3 -5 -5 11\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n5 -4 3 -1 3 -4 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-1 2 0 -1 2 -1 4 3 -5 1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n30 -29 5 5 -29 30\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 -2 -2 -2 2 0 1 0 -4 -1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 -3 2 1 -4 -2 3 -2 -3 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 -3 1 -2 1 1 0 -4 4 -2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "17\n15 -13 7 8 8 1 -19 12 8 -23 -4 16 -13 -28 10 -30 -14\n", "output": "16\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-5 -5 -3 1 -2 2 0 2 -3 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "35\n-23 -22 23 4 -22 29 -4 -6 -28 18 -5 21 -7 -8 -11 -7 30 -25 -1 12 19 5 -8 12 -1 10 -24 -19 24 -17 -7 24 20 -22 16\n", "output": "30\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 -2 1 0 1 -5 -2 1 0 -5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 -4 -4 4 -2 -3 3 0 -2 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-3 4 -4 1 1 -4 -5 3 -4 -2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 -4 3 -2 3 -4 -2 0 1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-2 -3 -1 4 -3 2 0 1 -5 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n3 -2 1 1 1 1 1 1 1 -3 4\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n4 -5 0 4 0 0 -3 1 1 -4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 -1 4 -2 3 -2 -1 -5 -5 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-4 -5 4 -3 2 -2 2 1 -1 0\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-4 4 0 -2 3 0 1 2 3 -4\n", "output": "7\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n1 0 -4 3 -5 3 -1 2 2 -5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n30 -29 10 -1 10\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-5 2 -3 -3 -4 3 3 0 2 4\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n2 -4 -2 3 1 1 -2 -1 -3 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "11\n-11 -7 -2 -24 30 -26 24 9 -8 -9 23\n", "output": "15\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "31\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -29 30\n", "output": "28\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n30 -29 10 10 -29 30\n", "output": "10\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n30 -22 6 7 -22 30\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n3 0 0 -4 3 1 -2 -1 -1 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n0 4 4 1 -3 4 2 1 4 -1\n", "output": "13\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6\n5 -4 2 -1 2 -2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 -10 1 10\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7\n5 -5 3 4 3 -5 5\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n10 -3 -5 3 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 3 -10 11\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n16 -15 13 -1 10 -2 -20 26 5 -30\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n27 -17 15 -22 18 17 -6 2 16 -14\n", "output": "29\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "9\n7 2 -1 1 1 -10 6 -1 6\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-9 -6 -1 9 -2 0 0 -1 5 0\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "131\n30 -29 29 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 27 -26 27\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 9\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n8 9 -10 -10 -4 -3 5 9 -9 9\n", "output": "8\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n-2 -8 5 4 -1 -6 -9 6 1 -6\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "24\n-8 -6 6 -11 -15 -7 10 -19 -6 21 14 -4 -21 -10 12 17 1 -1 5 19 2 0 -4 -23\n", "output": "36\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
253
Solve the following coding problem using the programming language python: Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on. When a garland is switched on, it periodically changes its state — sometimes it is lit, sometimes not. Formally, if i-th garland is switched on during x-th second, then it is lit only during seconds x, x + k_{i}, x + 2k_{i}, x + 3k_{i} and so on. Mishka wants to switch on the garlands in such a way that during each second after switching the garlands on there would be at least one lit garland. Formally, Mishka wants to choose three integers x_1, x_2 and x_3 (not necessarily distinct) so that he will switch on the first garland during x_1-th second, the second one — during x_2-th second, and the third one — during x_3-th second, respectively, and during each second starting from max(x_1, x_2, x_3) at least one garland will be lit. Help Mishka by telling him if it is possible to do this! -----Input----- The first line contains three integers k_1, k_2 and k_3 (1 ≤ k_{i} ≤ 1500) — time intervals of the garlands. -----Output----- If Mishka can choose moments of time to switch on the garlands in such a way that each second after switching the garlands on at least one garland will be lit, print YES. Otherwise, print NO. -----Examples----- Input 2 2 3 Output YES Input 4 2 3 Output NO -----Note----- In the first example Mishka can choose x_1 = 1, x_2 = 2, x_3 = 1. The first garland will be lit during seconds 1, 3, 5, 7, ..., the second — 2, 4, 6, 8, ..., which already cover all the seconds after the 2-nd one. It doesn't even matter what x_3 is chosen. Our choice will lead third to be lit during seconds 1, 4, 7, 10, ..., though. In the second example there is no way to choose such moments of time, there always be some seconds when no garland is lit. The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python a, b, c = sorted(map(int, input().split())) if a > 3: print('NO') elif a == 3: if b > 3: print('NO') elif b == 3: if c > 3: print('NO') else: print("YES") elif a == 1: print('YES') else: if b == 2: print('YES') elif b > 4: print('NO') elif b == 4: if c == 4: print('YES') else: print('NO') else: print('NO') ```
vfc_10766
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/911/C", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "2 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1499 1498 1500\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1500 1500 1500\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100 4 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 2 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 1\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 11 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 1 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10 10\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 4\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "228 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 998 1000\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 6 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 4 7\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 5 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 100 100\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 7 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "82 3 82\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 218 924\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 123\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 4 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 2\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 10 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 3 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 6\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "15 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 5 10\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 3 14\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1265 2 593\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 567\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 6 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 7\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 1500\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 6 9\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 46 79\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4 3 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 4 8\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1493 1489 1487\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 3\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 5\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1 2 8\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 4 5\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2 2 4\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 3\n", "output": "NO\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "7 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3 2 2\n", "output": "YES\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "6 7 4\n", "output": "NO\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
254
Solve the following coding problem using the programming language python: You are given a string $s$ of length $n$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal. For example, after deleting substring bbbb from string abbbbaccdd we get the string aaccdd. Calculate the minimum number of operations to delete the whole string $s$. -----Input----- The first line contains one integer $n$ ($1 \le n \le 500$) — the length of string $s$. The second line contains the string $s$ ($|s| = n$) consisting of lowercase Latin letters. -----Output----- Output a single integer — the minimal number of operation to delete string $s$. -----Examples----- Input 5 abaca Output 3 Input 8 abcddcba Output 4 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python #credits https://www.geeksforgeeks.org/minimum-steps-to-delete-a-ssing-after-repeated-deletion-of-palindrome-subssings/ n=int(input()) s=input() N = len(s) dp = [[0 for x in range(N + 1)] for y in range(N + 1)] D = [[[] for x in range(N + 1)] for y in range(N + 1)] ss="" re="" for i in range(0,N): if re!=s[i]: ss+=re re=s[i] ss+=re a=ss N=len(a) for l in range(1, N + 1): i = 0 j = l - 1 while j < N: if (l == 1): dp[i][j] = 1 else: dp[i][j] =1+dp[i + 1][j] for K in range(i + 1, j + 1): if (a[i] == a[K]): if dp[i][j]>=dp[i ][K - 1] + dp[K + 1][j]: dp[i][j] = dp[i][K - 1] + dp[K + 1][j] i += 1 j += 1 print(dp[0][N-1]) ```
vfc_10770
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/1132/F", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "5\nabaca\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "8\nabcddcba\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\nx\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbbababaabaabaabbbbbbaabbabbabbaabababababbbbabaaabbbbaaabbbbbbbabababaaaaabbbbabaababbababbaaaaaabbaaabbaabaaababbbbbabbaabaabaabbbaaabaabbaaabbaabababbaaabaaabaaaaabbbababaabbbbabbbbbababbbaabaabbabaabbabbababbbbbaababbaabbbbbbbbaabbabbbabababaaaaaaaaaabababaaabbaabbbabbabbbbabbbaabaaabbbaabbabbbbbbbaaabbbabaaaaaabaabbbabbbbaaaabbbbbbabaaaaaaabbbbbbabababbaabbbaabaabbbabbbbaaaabbbbbabaaababbababbbabaaabbbbaababaababaaaaabbbaabbababaabaaabaaabbbbbabbbabbaaabbbbbbbaaaaabaaabbabaabbabbbbbbbbabbbab\n", "output": "121\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nccacbbbbbbbccbccbccbacbabcaaaabbcbcaabbababcbbcbcbbcbabbacbacbacbcaccccaaccbabcbbbbccbbaacbcbcaaabbbbbaaabbabacacaabcaababcbbcbcababbbabbaaaccbcabcabbbcbcccbcbcacabbbbbacbcbabbcbaabcbcbcacacccabbbccacaacaaccbbabbbaaccabcaaaaacbbcacacbacabbccaaaccccaabbaacbabbcbccababbabacabbcacbcbaaccbcaccabbbbacabcbccbabacbcbaaaacbbcbccacaaaabacaabbaaccabacababcbcbcacbcccccbbabbccbaabcbaaabbcbacacbbbbabbacbabbabbaacccbaababccaaccbaaabcaccaaacbbbcaabcbcbcbccbbbbcbacbccbabcbbcbbbabbcbaccabacbbbabcbcbcbbbacccbabab\n", "output": "174\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndadcbaaaabbddbbacdbabdcbcdcabacbddddbaabacbcabdccdcdadcbabdbcabcccbdcabdcaacdbabdcbbbdbacdddaaddccbacabbdbbcbbcadcdaadcababbbacabcdbbbadbdacbcddbccdbacbddbdababdcadbbabccbcdcccccadbbdbdbdcbcbdcddaacdababdddacadaddcdcbaabaddaadacbaadcdcacbdcbaddddbdbddacaadaaaaabdccccbccbcabddbbcaacadccdbcccdcdbbabbcbabdbccdcdbcbbadaaadddcbcbbbabbadcddbaaabbbdabbcbcacbbaaaddbcbaccaaadcdbcdbbbbbcdbbbcdadacdbcbbaaddbdabcbccabbadadbbbbdccacbbbacacadbcaadbccdbadacdaddacddcccbcbdbdbcbdbdaabdcdabbaadcdccdbdcccadabdbddd\n", "output": "196\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\neebcacaadebcdebdeaaaceaabacabbaadaadebbceeabbdbdbaaeababdaeddabbeebccbcbbdbdecececebdcceaddbbabbcdadcacecedaabbeeaaddbbddddddadcaeeebabeaadbaabcecadaabbabcbeadbdaabebeeadbadcaadbecdcecaeeebeebbececdeddbdcdccacaeccbdcbbeeeedeabdceaaacdbbddaceccbeaedbadcebebdceeabadeceeedecaaeedeebabdadcaeabdadaeabcbccdacbabcacbcaeadbacbddbcecddebeabbedbcadeeeaebabbeccdbadceccaeecdaccccceeccbebabaaaacedaadbbaddacbaedccabeaddbedaadacedacdbcabddbeaaecaebddecddacbbceebeacadeeaadcbdcbccbccdcddabdcecaebadccccaeadddacbe\n", "output": "217\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbceeccdebbecfffabeeeeaceaaeeecccfcafeefdadfbfceaacceacabefbceaaeefabaabaabcefdcdccabeddbdabebcbdfdbbfcefffcccedbbfbcbafcabaddcdfecedfdeafccbfbbabaabaccadfcaccdbdbbbacfcebebcadecabdfcefddffbffabbaaddbccdaadeadefebcdfefddceefcdeefbbeeebdcaacdcfafcdbadbaeadcbfbbcaacdeacbceddefebbaddbadaeebefcffcecbacfeabebfbeabdfbefeeeaaeebcdfecedecdeeeefcaeaeffcafcecedddcbbffbeaadfbfcccfbeacfddbbfccbafdfccebbbfadebbceedfafcbffbacafdbcaabdbcfdceffbbdbceaefcabfbbeedffecaafccaafbeadaaabedccfcecceebebfdfcbedaddfeefcea\n", "output": "228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nafdfdcfebagfdcdbacdeggffebbcgfdbeeeegbgagaccbgegdfbffdbfaaeabebcgcabdebdeadbggadffdedfgadbdcdeacffebbceefedbeabeaefdcgddaccfaagcaedgdcfeafaaadfgcgcabdddgcccbbaeccgbfefaggabddeaffbaabadfbddcdafcfdaedbdfafgagddgdgdfdabbceddfcffafbabefeadecccadebbbfeegbfdgbbaaffgeaagegbbeddfbfeeecdagbfacffebbbfcfeffbcddaaecadfdbegfacbfeeggdbacfgecfbgfdfacffebfabddebgcdfdaacdedgeggdbaadagebbdbfdcbbbbbfabafddebfaffacffccdbccedbaadbdcgbedbddebbcadfbgdgfagffgacgeadbdgedcccgbcecadgbdcafbffggcccfffbffaefdbcdgdeefceceaagd\n", "output": "246\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndbcbdhbacghbacfeaecddchgffchhbhheacheagadabedhfcgfbgfahgebdgdecfgeaggebahhbhaaeagdhbadegebdfbededdffdfcbebhchgahafdegbbhhgaecadcdhaecbbceaefbadgedfhgfdaeheeeabbehbeddhdgdhbegefdffdbeebdegdbefbadbehacecdaedbeeedehfhddeggdafaagehefcefbghadhbehgbdehaeaeeecbbagbdefafhcgffgcfeefehgddgggbegcaabcfehcdbfcbbccheeafebdfageefeafafhffdaadcddgbfaegafbhafdbhfgebaaebegcddgcadddfgfcddggbdffffhghcbghbhdcebeacagbdfadhdbghaeacadbccbbebhfeeaghgebghbabbfhcdfagccaadhhgdeechghceefaaeacheedhbdaedcffhcgfeagdgfdchghbbfbf\n", "output": "261\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nahecidbhaccbabcggeceaebgcbaeagehfhgiebafdcgiiehegggcdfbdccicbfficggabdhfihheadafdcccbbgbgfgehchdbihdidddagdafigbbbhgaiagiacbhhegdgchcfiabbiidhhfbabdfehcifgegieihfibheedfbiadbfdafdgbehfeifgcfhieiaheebeiiabggbecedchhicfeccfadhbfgahefdchibaecbifeadfdadfefifeibcbbibibbcchadbbbedcbgeiefdhedddedhfeecfafggghdffbcgigigeeieeafgciececicgeegafbcdahighgahgdeahfhfebegebfedfdfadiafdcdebgeacedeiecdcaghibhedaaecdaahdaecdbahcfchebiafcfhacabcgbaadibgfgbdcebifdafbgabageebfeebefhffdcdgehgfchiabfabcbefhccehffibaeiac\n", "output": "273\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncachgdaghedbbfbcbicbabfcahhbeaafeaafgcaafcabeabccbbbjhjbjcabcfdcbjedeaijeebcabbfaiicebgfbchcaeachceigihhbifcdgdfhdjabjajfhhfajddghebbdiegadfahdahddfdeaagjfgafhjhfbeehbgahgeefggdgdcfcifagibijcgifehjccfggajjfajecbffdedfhgebfefibeiceigcddfjhgcghbbhjbhficggfighjdijjefcjchdihgfdcjgeeeiicihfdhbibijhgjdgdhcafdaafbfgjgcggidgebchbejiidjgbfcbcjejgfgeiaaebeajhdaijhgbebeefchahbbgcgegieagcdahgdfbidehbfafbigadjdedhdhaegbbcgifeahgchiafffjgfgaajjhedbiffbbjdijehdfiegiabeadfcifcbjjhidiieebaiffdjfhfidffgfchchegjed\n", "output": "281\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndffchafckjeihjicjdebhahafcdcbbghebdedkdgihgdeddjijdadgaggfciedejdgicbjjjidfbfjecabddaggidbfaadbhcgddagkcdbhdakceidkaekefhcdjgadefidfjbcejeeghbaffkabeejidkkcdfkijeiehiedfacjbhbahkckidjdekbgkdfjkibhahegghbdaggcejbkkgkiaibbefjfkgfghikifaaeekjafdcgefibgfdhahicfidbgbcebfekjkikekjdedieiifddgcfekaifabgafahegkhjfjdjjefbebcigikafjcbcijbjfkdbiaaibbjejehhacejakikjfebabjffhcgikbcedhdefkakibdjbekdkdbhfaafcigahbabcjibbgkaikkagakakbcahfkgjfjiccicchggagifajggckjckffdaehdejfihcdkjkcahakibfbakhheiacgkhbhhbjjkcbke\n", "output": "294\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndkhedelgflihgabkcjkjdjggkfahheklbffhaidljfikfjgbckejfahehkiieflelcifagakijiajjhhdglhibeaagehkiihcjgijlfdaejaacehejbilefhgijeebfefgbccfgdebkledbjbjilcggaiekacehlikekdcebeidhfbdgkahifgilhcdbikbfdlheefgbebikfcbihjlliegabgfjlbdallhjgdahffcdcblbjekfijalefkaklfglggaikcacllhdcfilbkbelcfdgaafahhdkcjgafddhfaijakffdhfafbgfhlaccbhjlaeaaajfaagdhfehdiflehghfiidjcachclgddkkgkllcdldekgflakgalekefffakklgjejjlfjblkjilhfdckahbedeckhfefkfjlgaflffgfkkhacchgjceelechdceehfhjbecgiflajlechkldhjgbeeijbadikbhiddjjbfficfa\n", "output": "300\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nghgbegjdahcmgdjgmbaehhgmmlbjgigielfbddkhfbfgbgcmdfekcaeejgidledgcghicgmmblbaljhgggkimcagblckjkimcglahiambbccefkbmlmdgmkglfdmjdflbfdbekmjbghjjikjgkmeigifllmmgijkcclgjkmcahdjgkcekeagklgfhgidbedbgkgkmbjbkbdhiijjbkcdeallkjmjfldamkcmiijmgfkmhkhcgggfbhldjehbmmebkfeibhimddigfbgflifgmcdhmhjcfcmijjeaaegagcikmglclcblacjfclghgfkfaflhggjdmdjlcheehfhekcbdfkihgfjgakjbaihdmkhjfcfhfbeeifaghmmhiijaeglkackhllehlmmjklcelggahhlilgmbemkkjdcmhakbfgjdakhgekhcddmafkidefbffjdcmcidjmllkeedgiikjdlggigchgckdijhjgfmmfekmdcm\n", "output": "303\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nfnfckgnagbnmhglkdliekejfciahennmjahibikiimkdfcblgcgegenjeaaiddhehkdemeibehbbnahfkdbhkddbgjamfakhgjefljbfnegkgbldkknmmlailkjmmimnfgnccghgnnemignlmnedminddglamlllaekjgjnfcjiaafgnmheedlknlgacebdkgccgkchjhacbbiddjhjhgdkedbcfnaniaaimibgkkdgmnegiandbdmnchehkcidfegaakndccljlganndfbnkenmgcflhammgiggcfmdcjnmncdgfaejaadelhjemekdnlbklcfjaeblhgbccjgechgniedfngfhjidjgangcfabnlblmiadabeeahfdfjhlkfmecnddbhcjgkjfejemfilhdcihfcenmbmblijkiilndnkafdejjnlgnadcllinjnfkfjnbleljledmjbleihgdicmcefaihhbmhnejmcieamkhebme\n", "output": "314\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbfdalabnagjcojejahgifmbmgokfmmbnaflhbiiijnaidocachemkknjdbohmkciconnnigiciclgldngikjbmodfdfhegkcemlgngiadeffhliacnonnadnblkmmmbkicdemnjibokljonefjahllbkeaaecboadjfhnkhmmalnjfdmmkmjnabojdmfhelnkaehoaiojeajjahlhakikimbobejoeagkhcnadjogjocngaddbfekecokdhcjehenfegjjelekfjolajeibmaodkagkgfnjfinfgdcknbmgemobehekdcclmlfnkmodogedmhaieojgigklajkabjhcgldagaifoaggbibjajgilahejjcoaocncgmnefcglkjledcdcjehlondnilbnojikmomlfdagoaobmekadabiblijldngammojgkgjojhoanfclimkebkfdmoigjkmcnfmmddiahakdjdngffgdjaaklkecgj\n", "output": "321\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndicdkeichmcjhbnkiglmnephogelfohjboiihaocmpaemlmbgjdaoblkkomngcelapdlmophamcnjihpfhadhaddhbinpinepkcnjpndfeiepiocepbdjchcenilbaccopfnpciglfcknjbmdbhcdgihbeniklehnonlnhooabbodnbmdoaafnedpffdnibdnijidpbngidabdncdfolpfnenbcmhhlenmjcbiacmilahlfpdgafcacnlgedkicmnknliemncdgoggjcdbhnmneljgjjemekndgdhddoiiflndklehceancaiadnicdoofciodhgphjgmchkehailolkhfbpdkoipcemoghegbbpedaafbeloccmgddphefjakjofldineohdgflhflmkiedfmkocbjablcofcmdfconlmhoiehlobdbfpelhaindhamnmbenldbmefgkmhjlloeendgdbeafncjohclenmdeppemplf\n", "output": "331\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nkjcllbkmamlbogkopfqhjfpejfeglpbdqjikbgakecolabphkmpnjfbhpdnlcqcfdaljmegiljlqpkdnomcglpkbaiencimbkehpiqmpafeabbohfajahfablplcpacngfpghjdhbonglhaedpihkbjbkcpjdkqkpdobjfqepolgdgjonaogkingfmacbflbmjhhjbnnffbmcohgmmfbjqojnocjlfhlhflpkddmiijomenhldcoijnqcomjnbbpnffkgelnigkcmnaqdnkpmoejllkilfdlqoqcbmbqdaobndpgjkffebhgmfclhncalfeamiqhclllpoefaaobhqfnljloimkdoaggjammqliommkllnhhqoagcpmlkddkclokjlccgfapodfolmfejdkofqncjkjhqcledaplificibodhddlhmqqckjenpjalokpllnldqppjceelgjbjqqqlcecjcjmkiklbbdikblddkikpfea\n", "output": "325\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbfhofhrkimdpgpnjhelnqlgbjpddbanmdfqciedrdgednbjjinlmbormkckfcqghoibpcadmnigckajnklngnmpoaiaepajkhegipdadoipgmcncncbhcjkhfechneecqmchnqgpaqkrhipgnqcojhaliokihgqbadmkkcffkeorbjorqbbojiqlpdlohbmhmlmliadlbrpcdmfckfgdqcpflghdfkqceminjlollkbmqreeilffqigjelerjpiakllbgiogqdpkochbjpnppagaooqdgocnnrpkeiekhkibrfjdbkfmlnmbgejcfklgnaacrpnhakkpinnolnbikcrqlgfhcoqpaainlklpamdeapnqpcgflfnlgkpcicdbiodgdngaeaanbjhnfbgogclpherrqodalbbpjkfiohpqngmfialgdejlgddkqrhgnblbqkamajnehebbnkcrlhnrnlcoondjhhnghecmlqfogbiaggkl\n", "output": "335\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncdmkfpciphakoplkedblrkgkeopflkqhokgfiehpjdbbjidapefhognhgheikdbaepqasmfdsbkdbbjaesoikmglimmabfbsreakbpnhsclohfbaqamjlhhaiqchpoaibqldehsprprscrinsdgrlsmidkdhbsgqnlhlbldrnqhgfhmcsmncqmohkcbkgnbrofccliqjpqdpesfnabndkkklmoemsfksqmjajbgheijcgjiinppnpqlilarocbphlogqrmcheflskedeomfsjkoojfjsdoibiadoeickchjhssjaqhsnbnahqcqnelemollsncrfhjrngeighcqirbphqharlgiblchqjgblkfemlhofrjjceeerolsndsncjksanpkcqiopkmqmlfginppbhkbbdshpbjblheolofkpcjjeedholrqklhiiohmdjbbseclssdlcbkjribjggfggsljidsngsgjpankfckidrpsjsgaq\n", "output": "335\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nfpkfjphbmbqmikncnatbjfldpcohbgamfjrceshfgffllbjcrkeemqboblbjtsgqbeplcrkstcginnjqqolijjbbcnabagheaaisdoiieesogomilkcookbsgebbbmqssrbgdmblmmccgeciaeiasbatraotjlafhmjmddsldfqgfeqkrmkafqdlikttmdtkdmmosqgfflseiibjnahjqsmhcmklgqrqdbccegjeschpcdnbjscqoifipbrfillscdqpjfaippqaloqpdfcmtmjptchiipedetijorrolndnehtkfjarpfqphmmmbeeeomfbshkehesalaeccpgpolhncijsihhdloesfjherreaclrplrtcbsrlefqeksgtdnkmdfcklgskqqkgcndthpgdkitiataqosqdrtjmirsicnrbblofqfsqsdksngrkaefmgnpaaroelimcpnnibekhompicrocopcscfajqdbfpqcrrnlm\n", "output": "326\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nraqqhocfiosbkfjtbjnbatojfmummlrghpkmcghfagdmmkbesdhtelromtkmdmltiljttepgeqdlhtgkpgljrmqjjtmretsdincjjqilahapcjcdlkrftoaeramgrudjbtpjblaksjjjburngarjitmebjiotofctgppktkqkianmucafsspbefuijcmsqamuenlrfrunfhgfqjhkjgrdjrkjgbpifadsjabktgdsgjsslipnqncbdfaphfndssljbthhcrfoijilodnuosmirctsjbhtlbehnljqcjdahcmjqsursqemcmtbgdaegdugqskskfdcffuilthtnjfhujgpifckubajoorllaruqfmbgrcutjushbflsqeiqdddenhurmunhsqqnbsfnjhgdodhmdugisalahiiedmhcgudjfhuumtlndkneauikebmgnrbdmegeotncdllcmmqfudldikeasisllapabefdubasndtobm\n", "output": "339\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ndkftkjtfjdrrjnruuafncvesfngrsrmpmursvssubifcmaeivkrocrhkujbldcgvpifnttfgvrppjpfogmietujqnierfoflmqgbpgsqnagqjqhdjmejllchtldrtrcgemvcalcabieheheagnsmvhrdeeonfckgkuhciivibchbqmvbcdugvcbnqbujgeljqclunbgpguufqhletqstbeabcuncibkdkntbunnvquqshmkqmpbaoaujofaraipvjirvvggrnlvonqsehduohpauqetcujmgutoqigpuqijnevgmcmanalrvsaivueouviobdmucsljnfocsbvlrvmnoevhbpamqqcupcrbfdcerhchteersfjafuiekuchemvhctjfgsgmssfsanrcfjlvithppcqauuepopjolbojemvqfjhjfbiflmihnnkkgmaeecpeaascsasokudhjtkgclbomlbaicffhhlslseaaihlipgiv\n", "output": "339\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nfropdpoauqarcbsnlpkwtcpabgsvcsfltusgobcghdbioeivlddcdadaawjhnljgsfjnfdebgucqmhivqvcrlnmogjapkocfffhdbtqcwauhfmlkwcdutvfwrhdclsjuqwsrrwgquducmguvlralvnspclfsgdpqudmishuwqhvfndqjrdiekbopjwqnbldtgafoqewwkwmdmvdwokekrqbbqfejrhervtbgsualsneufmohsrhwcvwoudfpofbnsbvqoogbrjjhmjiatfpsrvjdiohwhgkrwjcskibimsnlsgogbutccwjedroqtgumopbkshhsllkrlklihjicfaivckdsijgnvuraoiiwdhnoimwfgbslfoehwpdrknljsediqvmtkkgpfneuvjucgkochhbtcvnjhgafrhdhrpjchbociesjfmtwnckbobjimtbrfebdoronmeatuhtafvtssficqnwgdslcvmbmvaodutmpotjc\n", "output": "351\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nnjjiptmrcggwwtbcxbmmiqrqdhhgciaskwustnvmbkbvghlcnrctbcjlepnkqcktsbxgjnvhmndnbqnmhwrlfijpimlojsmvfjidtcmujmnoihwhlronmmpeiobmoperdwsranlbtqgbktpdtbtihnwlsvfefrugurkjbvajxsovpuwjoohmvtdlarbeabmejbrkmkfjwbgsisvxfakjphpmrtmwwwktroitlmstbwuilftpwqmqtitwgkwbpiaueqopotnfxhchsoqqlvwqlogbooqnmpvvtxmtdqqkjwhifmvltxxbwjjgaxjkuuraneqrucchncusshrwxhhdukkexwjrxgufkgmiqblonthwtqulftphghltqcarvfhkknpqxftvqscspvosxvguskdmfdocxrrjvcskjhtxwomiwiqjemdklldgnkeuelcjuudmhokbihwpibicfbjjoqbbqnbqmcsdwdeiisqfvvoxggqeqcfs\n", "output": "338\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\njqpyiogllhoobjixnlhskgwowfrhkuotvjbmgatrspqreavqwsuljxqduutxudueenmvarsmqqaqxohtsmxdqdhcvydhuiqcchvvxroqieeffipvlumywcthdafsgnwyamumpknqittxakhlbrbhrtcfbrkvjrypxqochjnmyihuqtrrbgiiytifqeqbnssrmywtdghpekqjxkvoefiwpbepqstotqyiohuawpvawephiexxnofiipkwmshhyaprhrryspbvfoasagdldqeasajhqsurmduuusiwgyuroimbyfjogkxcgjorxpqblhtwvlgognnvisqdkheurkikjcgmoyvafiqhfcbmgmybefsmkroftstqmhkfkuxufghjhveuhhkecushenjqyvqhxcfqdcbkxufhxpbamaowjnuaxjcsuuryvjtnwrhwiurrsehusxwrjwsotefacjxjanphxngylkmjbvhfqghtlnlvdbcnkfjd\n", "output": "350\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nlkuvqevrlanaugfoadmkdqpljknwfoftofyxcvsfvprqxuwkfwunfilaqrzqhsjhsaoynbsuiqyzwqfkmbddngwydhrtimoerqpehjsgqojuhtxvaayzsbxmsqckibtcangzdnnpcpqkqgzbzbeaejuhprrqxdhyfrtzwhvnnrfocwrwfzbgtvdpwlkrqisjqpszykzhfjrstcvmmnebwgvwxsppyxihkepmndwgtzlsurasjfrkqqnxjqdsbmsggakyuouevxdxuwyxbhkmvpjqvoklaknxsmzqpjrftvzifnqjporbvtpdnzfhckjnwgeddpjycnqrtphjhqkfvpoerzkilpjuteidflpulppotglglarrwopryxbjjsroguskwzalrmasgcioovteyuukwnosswdwnqmrbdkssgnkaivtufoayaxgqpprnoyvoeqqpywboofudtutiweaaqzbneqmxgnfkxdnjdbijlveapyrybiw\n", "output": "358\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nccbbbbaabaabccaabcaaccaabbaaaaaaaabaacccbcbccbccbbaabcbbbaacbbbacbccabbabacbcccbbaabbaaccbaacbcbcbabccbacbccccccbcbcbaaaaacabaabbbacabaababbbccaababbacbcbbacbbbbccbacaaccaaccbccbaacbcaaaaabacabbaaabcccaaacccabababbcbacaababcaabbcbacaabbcccccbccbaacacbcabaacbbababacabbcccbccccaababacbcbbaabaabcbaacaccbaacbbcbcbacbbbbabbcbbccabaabbaaabccabbbbbbaaabbbaabcabbbbbbcaaaabcbcbbcbbbbbbcabaababcabbabcacbaccaacacabbbbbcbaccacbbbcaacbbacccaabaababcbbacccababaabcabbccbbbabbaabacabcbabcaabcaacabcaaccacbcbbcaa\n", "output": "161\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncccaaccbcacbacccbcccbcabcccaaaaaabbccbbbacbacaaacbbcbbacaacbabababcaaacbcacacbacccccccbcccaaabbabccbccbcaabbcaccbbbbbccabcacccabbcbcacbcabaccabcbacacbbbcbaabacbcbbbbbabcbcabbccbbabbbbaccacaacabcacbacaaacacbbbccbcbaccaabbbcbcacbaaacaccaaabccbbabbaaabbbabacbaccaabbbaaacbacaabbaaaacccabbabbbcbcacbcccbbacaccacbcccacabbaabbbaaabbcbacaaaabbcccbacbbbaacacccccbccabbbaababbacccabaaabccbbccbbbbccacbccbcbbbcacaabacbcabaaababbaacaccbbbacbcabbbcacbaccacbcabbbcccbabbabbcaacbcbcaabaaaccacababbbaacacbbbcbabbcac\n", "output": "164\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nabccacbaabaabaaccaaaacacbbcbccaababacbbbccbbcbcccabbccacbacbbacabbcbccccbcbbaccbcaacbacbbaaababccaccbcacaccccabbcbcbaacccbccabccaacccccccccbcabaacaaabccaaaabcccbcbbaabccabbbaaccbbcccbcccbabacbcabbbbccaaacaabcbabbbacacacbcaabbbacaaaaaaacbcabbcaccbcbaabacccacccabbbcbcbacccabcabbaabaacbcbaacbbccccbbbccaabcbcbbbccccccbbabcbabbacbaabaccabcabcabcbbabccacbbaacbcccbaaabacaaacaccbccbccaccccaccbbaabbaabbbccccbbcababcaaaaacbaabcaaccacbbabbbbcabbbbabbabbcaaabccacbcaccbbcabbaaababaaaccbbcccababacaabbccacccab\n", "output": "161\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbbbcababbbbbcccbcccabbcaabcabcaaacccabcbbbaacabacbbbcbbccbacbbcabbbacbbabcbccabbababcaabcbabcbababbbaaaaaabcbcccaaaabaaaccaacbcbabccaaaccabccaaabcaacbcaacccccabbbbabaacacbbaabcbcabaaabbbabababccbacbcbbcccbcabacbbbbccbbcacbbbccacacacabccacbccabbbabbabcccabbccbabccccbbbcabcabcccabbababcbcccababccacbaaacaabcbbccbbcccbcbcabbacbabacaccaaacacbbacacbccaaccbbcabcbcacabbaccaccccbacbbcacccacabccbabbbbcbbbbabccbaabbabcaaccbbbaccbacaccbbbabaacabbcbbbaacaacaabaacbcbaaccbbaabbcabbacbcaabccbbccbcbcabbcbcbaaca\n", "output": "174\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\naacaabcbaaacbbaacbccbbaacbabbaaabcacbcabaaaaaacccbabcbbbacaaacabbbbaaacaacaacbbbbbabccbcbabcabccbbaabccbccacccacbcbaaaaaaababbccccccacbaccaabcaccbacbccbacccacbacacbaabcabbbcbcbaaabbabbbbbcabbabcbbaabbcacccaaacaaccbaaabaccbaabbbababbabbbcababbcbbaaacacabbcccaaabcccabbbaababbacbaaccbbaabbcabbbbcabcaccbcbcbbbcabccacbcabbaacabbccccaacbbbbaccccbcabccbccbccbccacabaabbbbcbcbacabccbbcbaabacbacbacaabbcacbcacccacbbbcabcccabacbabbcbbacabcbcacbaaabcccaaaccaccaaccbbcabbbbbccaacccacbcccaaccaccaabaabcaabaacaac\n", "output": "163\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nabaabaccacaabbcbacbbbbaaaaacabaaaabbcbcbcccbacabcbabbccbcabacababbbbccbaaccaaccbacbbbbaaabacbbaccabaacacacabcbbcbbcbacccccaccbbacbbcbababaccbbbabbcbcbbbaccbccbbbcccbcbbacacabcccccbbaaaabbbcabbcaaacaccbaabacacacccabcccbabcbbabbaabaababbaaacbccbacacbcaabacccbaacbacabbbaaccbcbbcaaaabcbcccbcbcacabbbbacbbcaccaabbbcaccacbaacbcccbbbbbaccccacabcccccaabccabacabaccbbbaabcaaccacacccbaabbabccbaabbbbbababaaabbbbbaacbcbacaacbcbcbaacbcaacbbcaaacccccbbbbabaacbccbabacabcccabacacacbcaaababcbbcbacbccaabcccaabcbcbc\n", "output": "170\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbbacbbaacbcabaabbaaccbbbbccacabacabbaaabcccaacbaaaaaaccbaabaaabcabbacbaacaaaabcbacbcbcbccaaccacbacbcbbcaccbccbabacbaacacacccabaabbacbcaacacbcbacaabbcacbcaccbbcbbacabacbbaccababacbccacaababbbacbbbbbaccacbaabbccccbbababaaccbbabbbcaabbbaacccacbcabbacbabbcbbbbbbcabcaabcbbcabbbcaabaaaaccaaacaccbbbcbabcacbacbacbcabccabbccaabacabbbbacacbbbabcbacbccccabcacbbbcabccacabaabcabababbbcbacabbbbccabccaacaabbbbacabaabcaccbaabcbccbabaaccbbabbbbcbcbcbcccbbbbbbbabbaaacabbaccacabcabbbabbaabcbcabacaabcabacbbbaaacabb\n", "output": "172\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nccbbbaaaabaccacaccbbccabaacbbcaacbabaabcaabbaaabacbccabbccbbbccbcbccbababacaccaabbaacbcbccaccccccbaaabbbbccbacabaacbabbbccaabaccabbbaabaaacaccaacbbacbbaacabaccbaccbccabbcbcccacaccbaabcacbabbaabccbaccbcbcbccbcaabaacbbcaacabcacaaacaaccccbcaaaabaaabaabbbcbbbbaabcbcbbbacbaacbbbbbaacbcabccbcacaacbbcbcbbbacbbcacbbbbabacaccbaaaacaaaabbcbcbaaccabbacccaabbabbacbccbacbaabbabcaababaaaabaacabacbaabccbbccbababbbcbacbbbcabacccacaababbabbcaaaaccababbacaacbcbbcaccbcaabcbcccacccabaabaabbcccabcaccbbcbccccbcacbaba\n", "output": "170\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncaccacbcaababbbacaaaacacbbcaccaaaabaacbbaaaabbbaacbbcbbaaccbcabccbbaabbbcbccbacabaabacabbbcbbacbbcbcbcacacbacbbbcccbaccccacaaccbcbcbccbacccabaaccaaabaaacbcaacccaaacacacbcaccbbcccabccacacabbcababaacbccbcbcabbabbbccbbabbbabcccbabcbababccabcaccbabbbbbcccacaccaabcbbbbaacbccccccabcccaacccbccbaabaaccbbbaaccbcacbcaaaacabaacbbaaacbcbcaabbbaccabbbcbacbbbabcbcccbccccbbcccacacbccaccacaccccaabcabcbbacccccbccbbbabbbbbbcbcccababccabaaaabccabaabbcbcbcabbccabababcabaabbabcccaabacaaaabbabaccbbacaacaabcacccbbcbcc\n", "output": "164\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbbabcacccbcbbcaaacacabababbbcacabccacbabcacccbccbccbabbbbbbccbbaabcccacabccbaaccacabaabcabcacbcccbaacccaabcacacaacabccbabccccbbaababcccbacbcbaacbccabbbbacbaabaccccccababcababccaabcbaaacacaccccbaacaabaacbaccacaacccabbbcabababbcabbacbccabbaaaabcabaabbbbaacacabbabcbaccbcbbcaaaaaabccccacacaaabccbabacacbcbbccacbacbccaacabcccbabbccbbababbccabcccbbbacabcbabbbcbbcbaabcaccaccaccaabbccaacaaccabbabcbccaccbcbbbcabcabcbbacccbabcbababcbbcacbbbabbacbcbbbaacccbbbaabbcaaabbbaccbaabcacbccbacabacacaaaaabcbacacccaa\n", "output": "176\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbdcdcbdbcdbbcbdbddadbadddcdacdadbcaaaaddcadabdbabbcbbcccbbbbdbbccdcdcccdcdccaacaabacbdddddaaabaaacbbabdbcaacdabdaddacbdccddbbacabaaadddcdddadbdadacbccdabccadaacdadcbdaadacacbcdddbadcaddcbcbddcbcccacbbaacdcdbbdbbbadbbdbbbdacbddcbaccaccbaddaaaabbcdccccadcdcccbcbdbdcdcbddbacacbddbaacbaaabbbaccadcbbbacbacddbcbdbbcbcdbcdbbcdbcbdcdddbcbbbdbcabbdaaacdbdcdbccddbdababadddcdcabcbcbcccbcccdcaccacaddcabadacabbddaaabbdbdacccacabcaccddbbbcabcdaabdbddaaadbddccacbbcbccdccaaccbacacbcdbbcbccadcdabdbadbcabccddaba\n", "output": "195\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbbdbdadbadbddaaabbaadbcaadaaabcccdacdcbaabcbadbcaccdccbacacaaadcaaccacbcccacdbcdbdabbcbacbadbccadabccccaacdccdcdcdaccccddbabdaccdabbcbaaacacdacccdbcbbbccaccdaddbddddadabbcbbaabcbdcadbdbdaddabaaccabcaaddbdbacddddbbacacbacbdaaadcbacbcdacbbddbcbaddbbbabbbbcbdcaaabdaadbdbdbabcbcbcaaaacaabddbaacadcbbbacbdccbabbbcdbdabdbdaccadcccbcbbadadccacdcbacaacaaccaddccdacdbbbcadbcdcccdbdddcbccccabdadcaaabddddaabcaddcddaaccdcbacacaabacacbcadbadbbbadbbaccddcadaaabbcadabdcaabbbcbbaacadbacdacdbbcdaacadbdaacbabaacdd\n", "output": "196\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbcbcaadaddabadbcddbabcbbaabbcaabcdaacdabdcacacbadacaccdddacdbdbbbbcbcddbbbcccccbbcadbcacbdbccdabcdbdadbccbcdcdcdbdbddccbbdcbbabbcadbbaadbbbaadbbabaddddaddcacabbddddaacacbcbaabaaababacaddaacbcbdbccbbdcccbddbacacbbbbddcaadacccbacbbdbadccbacbbbbdbacdddbcdaaadcdbacaccddbddaaaaaddaabdccdacbbaacddccbacadbbbcacdbaacbaddcadddcbbccaacdccdabdcdcdccbadbdbdbcbaabbacbcbcbabddcadbdaaacacbdccdadccbacaadbccccdaadbdbccaddbbadccbacbccbddababbbdcaadbacdaaddababbcabcdacbddccbccdabdcdbcdcacccaacbacbabbcdcbbbbbcbaac\n", "output": "196\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nccadaaddabcadcccbbbcbdaacabcbbcdacaababdbbdccdcacccbbccccadcdcddaccbaaababbacadcabaacbccaabbbdbcbcbbacaaaaababcddadcbddcccbabdabdabbbacbccaccacdacadbbbbcaccccbdcccaabbcaacbcdddcdcdcbbdabadbadadcacdbbbaaaadbcbbabdabcbcbddaccabdadabdbbabcbdcdbdccababcbadbdcaacbddabdadcdbddbdcdabddbdaccadacabddccbbdcbacdbbcbcbdbabbcbadddacddcddccaaaaacabccccccbdbdccacdcaaaababccbbddbbaadacdcbbbadccaacaaccaabbcbabdcdccdcbbbbcdaccbbdccabcbdbacadcbdcdcccdaaccdddbbbcbadcccbacadadaddaabdbacbcdbaadbaaabdcbcdddbcdbdbacdcb\n", "output": "193\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncccabbcdddcacdbdddddbabadacdcdabadbaddcbcaabddbaaaabcdcabbcccdcbdadbdcbadbaccdaccbcabbcbbcdcaacabbdcbabddccaaacadcdddaacaadcbbaabcbdcdacaddcabbcdadccdadbbacacbbaabaaccbabcbccdaacabaccaadaccdabacabbcbadddddaddaaabacdcbbddbbbcdabdacdadbdccbbccccbcbbabddadcadacabcbdacabbddcbcacbdbcccccbdbcaabbdbcbbdcbaccaabdbbcccadbddcdccbabcdcbbcbdadababcccdcddbadacbadbddbddacdadaddbaabbdcddcbdacbaabdcdacabddacabccacbcadabbadabcddaacbddbaabddabbcabbbbdbcabccdcdaccccdccccbdcbaaabdbddbdaabcdcdcdbdcbcdabaaaacaaacdbdb\n", "output": "201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncddcdcbddbbdaaaabcbacccdabaacbcaddcbbcaadcbdadbacdbbddccacbcbabdcbabcacccadbdcbcbbbaabcddbbcabddbabccddcbabdbdbbdbdaaaabbbaaccaaaabacddcdacdccabbcbbdbcbdcdcdbbdbcaabacaacdadbdccacdcddbabbcdcbdcbdbdcbdbccddcabdaddacddabcdcdaacbbaacdabcbccabacadabcdcdcdbbcccbcddbdacaaddadbbbcbcbacccacadcacdbdabbabccbbcaaadcabadaaadbbbdbdbbdcababadbbdcddbcbcddbdbaadbbbbcccbccdcaabbdbaabacabacdbcbcbbaacaacaabbadaddbbcbdcdcdcabbcdacdbcacabddbadccbdcbadbdddbdaccbcabdabddbddccaacdcbccadbdaddcabaadcccdddabdaacbaacadadba\n", "output": "201\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncdbdadbdcabdcbdbaadacaacbbbbcdaccddbdbbdabccacbaacdbbdcbddadabaaccbabccabadddbdcdcdddbbcbadddcabcddcdbabacacbdbcaadacbbbdccbcabacdbcccbdccbaacddaaaabdacbdccbbbbcaabbbdabadadacabdbbaaacadcbaacadadbbdbcdabcdabccacbdcaadaccdbdcaccaaddacddccdadddddddbacaccdbbbbcbbabbdcacbcaacaabdddbdccdaddcddbbaabaabdbcccadcacbdacabcdaddaabcbcaadabadbdaacacacaaddbbbcabccdbbcbaccbadcddaaccdbacaabbcdbcbdbcbacacdccccabaaabbcbccdcaabcadcaccadbbbcccabbbcdbaccaabdcbcdbcdcaddaabcdacaddcccaddabcbabdcabbdbaaaccbbabcdaddbbccd\n", "output": "194\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncddbcaadccbdacccccbbdcbbcbcbdccbbadbaadbaddabcaacabbcacdbaddaddcbabaaaddbacbdaacccbdcbbaccbdcdbdcdbcbdbacadbccacacdbdbbbaaadccbdabbacbdabdabcdccdcddcbdadbacdbbdacdbccddbbadadcbdbddcabdabcbbddcbdcbcdabcdabddcaaabdddbbcabcaacaddcaadddaacddcabdcacbacdbcbdbadbcdaddcdaaaadaadcdcaabbadbadddaabdbdbdbaabdbdcbdcadbbcbaddbcccddbaddcbccadccccbbbdcacaabcbbcbdbdaaaacddbdcdaadbdadbacdddbbbddacbcaadcddcbdbabcadcddbbabccddbadddabacbbdacbbbcbcbdcadaccddbbbadddaaddddcddabaccaddbadcbcbabdcdbcaaabcadaacaddbabddcaad\n", "output": "202\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncaadabddbaacdabdbadcadcadbdcdaadaaabcdbabcadcbaaadcadacbabcddacaabcadcabaabdddbcbcadbbbdabdabacbccddcbcdacbacbadabdcbccacbcbcabdcdbcdacadaacaabbbabbddbcccdcbabbbbcbcaacbdadacbdbabbabcaacdacbadcccbadaaabdbcbdbdadbddcdbdbcbccbbadbaaddcaaddadaaaabababdbbaddbadddbcaabcadbcacccadbdaaabcdcdbddcbbbdadaadbddddbdbacbccdaaabbdccaabcbbbaadaccdcbccdcabdccccabbbbadddccadddcbdddaddbdcaccbaadadbbdcaabdcdaacadddadbbbdadcdcdcbbabdcdbdbdddababaaabcdcbdccabbcaabbccadcdbdbbcdbbaabadacdaccaabbdabdcdbabcdbcbdacdbdcbc\n", "output": "204\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nddaabdcccadcabacacdbaabacbaadcbcaadcbccabdbddbabacdaccbadaccabcddadccbdcbbacddcdccaccbddcbcdadadaabcacbddcabbaabbbdddccbdccdaadcbcabadbdccbdabacbdcacdcdacadcaaaaaaabaccccaaabcccbdabdaadbdcbaccabccddabdbabcbabbbbaccdadaaabdbdbcbdccddcdbabdaabbbcaadaaccbcbbdabbddaaacaddbbbccbbaacadcdbcbdddaaccbbcadbccccddbddbadcbcdbcbdccbcabacbabbddadcdabcbcdccddcbcdcaddadbccdbabaacddbcdbbcdcbcbdaddbdabacbdbcdbabbbcdcaabbccbabbabccdadabdccaabdadaadcdcddbbcbccbdbbbddacacddbdcdabcdaddcacdabacdacabbaddbadabcdabccbcba\n", "output": "202\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\naadbeaacbbbbccaaadabcebbadddcaeeadcddeabdaaddedeceadeaeedbeaddddacbeadeeeabdcdbdedcdebabeaeeddbadbbcedbadbeddebcabaaeccecaeeeadbeccbabdecddecaeecbcedccdcddbcbbcdcedbbcbbecdadbdbbceeeabaadbacaaddebccededacadeecdbcbbedcbaeaccadcaaabcddeaeecabdebaaccecababccacbeeeabceacbbeecaebdebeddaeaeaebcacdeccbeebceddabaeedccdbaeaeebdedeecdccdcbddedcedacdceaacbadbaadcaececacaaebecaecababedebcdaceeedbbaeeadaecaadbcabacbecaecdeaeaedddeecaceabbcdceecedeacaebaddbaeacbccddcdabdedbeacccbdbabdccebaecaacacaabaeacedaaea\n", "output": "223\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nebceccdebaaacaeecbcbaedbeebceaccabacdadbaebcbbdebeeacacdecdceddbbecebcaaeeddeabbbbdceedaebceeeadbdadacdbbddcdaaddeabedccdacdecabcebcdbdaaeeaedbabaeaedaddcdebdbcdebbcbccddbdbbcdedaccbbaedeeedacabbddcdeedbaeabebbdddcceaaacbdbdcbdeeeccadabeadddcebbededdebaaaedabadbabcddebeaeebcebbdddcbacbeeeedacbeaddbccebecdceeabebabbbbbcaaaaeadaaeccaebeedababbabedbdcadeeabaaeddbedddeadecaedbbeccdbcdadededcddceaccceeabadabcebdcbecdebcaaeadbcdbcbdcbbedbecbbccbedabcbedceccdbabdababddeeeaaaabcbdbcedcbbdecaeebedddccbaa\n", "output": "217\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncdeaeeedacbedcbbbcaaeccebccdeeddccdceabbaccbdabdeecccaeebddabbcdbedaababeaddbbecbdeaacebaebbbddeeccdeaedbdebebecccebebacdeadebedbdddcdbceacdedadeddaaaaeaddceaecdbedcdeabcacbaddcaebebdccbdcaacbacabbdabceaacdedacbcdadadeeecbceadaaaeceacadcaebcbaadddadeedbcdebcdcaccbccedcacaebcaccaadedddddaedaddaacecccbeececdeeccaaaebddeecccabbbdcbceeeedaceddaecdadcedacbdaebcbdddcedbdeadddebbaacccbabbcbaebceebacaddecadcdbccdeebabaccdcbababaaedbabbdadebeeacbbccaeabdcdceecbbcaedcadaccdaabdeabbaabebedcacedbeeaabdeeecb\n", "output": "214\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbdeadccaedebabcdeadedebdcacdcaebdeeadedbdccabeaddaaabdaeedbecdcbeacdaceeccdebecabeaedebdadadddccaabddeaddaddedaebccabeccbeeceeaecbaaabccabdccdbeeebcbccebbaeebcdcaabdabcabadbccdcbdebdabbeeeccddaadedddbddeebdacacddcaddccbebbbaeddcecccabcacceadacbdabaddbebbaecebeebabeabaddbbdddbddacaddedbaeaeedcccccbdbcdcadccaadabaacbeaddcabcccacabcdcaabadacdccabcdaceeacbbeeedeacbcaaabeaacaabaccdbddeabdbdabccdceeecbeeeecdddacbbebceaccdbccabebedaeceadaacaebacdaeceeacedbadebeadaaebaebcadcedabecdbedbbadbccabadbbcbcbda\n", "output": "219\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nacdccbcdabcabdeaceeacabdebeccabcabcaeaadeaaaaecdeecbaecdeebcaccdacddeabedbddcbbdbabbddaeeddebebdecceeebbcaecadbedbaaccadcacbbcbebceabbddbbccdcdcddebbdbbdebbcbbdadbedebacaecabbbedccebcaecbceadaeabbaeecceacaacbeaebdbaeedabbebbaaadeceabeccccbadcebbeccdeadddedcdeebcaeedddbdcccddbaeabeeacddbdcdbaebeedbdeadbcabaaeabcbeeadcabddeceedaececdadeadabdbabcbbeeaabddcbbdeeeeeacdebdbdcacbcdacdbccbbccdeabecedbadddebbcdccedaebacaedcdbceadbeababbcbdaccdecbbeaeedbdceebadeadbdccaccccdbdcdddaedaababcaeeaddbdbaabeaaaa\n", "output": "217\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nebeeeeabaebabbacacccbcddbdadabdaedbecadecacdcdeccabdbbddbccabeccbdebdebedbaedeeaecccdadbcabbcdacadaddacbbbdaaeceaaeabbacdecacbebebbbbededccbdbbeddabcbebdabcccedabdbcccbbeebaecabcacbcdadcbebbadcbeadebccedaceebcebceeaacbbdcdacdcdedaddeedaddedadbccccdddcddccceaabcadecbebdeeeebcbcadedbdddaadcdceceaadeeadddacacaedaebbcbabacabacaaeecaebbabbeaeabecbddaaeaeadccdeebcedbdcaadceaaaaebaaccecccdecdeeccaaeeeccbdcebedbcadabceedbcecbbeacbadcccdaebbdddacaacadcdbaeeecdadbccbebebbaddeecbceebaaacdecabeabdaecaeaceac\n", "output": "215\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbbbbbdeeaacadcbdcedeacaccbdababbeedcbbddacdaaacbabcedeccddeeecccddaedebcdadaacddeabbdacceedadeedacacecdcceecaaeaecbcaabdabaddabadecebdbddbadacbbcddedddadabbeddedeabdcaabccbbdadddeaecebaaeedbbbebddaecccebebcaebebddadceebedeecbbacadadcccdacecbdcebdcdcaceeedbcdddabdcabdeccadbdddabbbaebbdadadebadbeddeecebeddaaaadbaaebaeaebdaddccddbaddcadaeaacabcdeaddaedddbbacdcbeeaaecbecceadeeacceeaaddaecdadddbbeebeedecbaeacaceacccbdcbcaccaceccadcebacaebccdcacebbedeaaeccaddedccedceeedeecbaccbcebaeacbbcbeedabceaebdc\n", "output": "213\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbbcbdedcadacabdcbacdabcedeebdbdeddedccceedcececcebddeacaeddbaabbaaaedccccabdccbbeacebbdecbdbaecabceedcdecdebbbaecddbbcecbbeaddbcdaddaecddeceeeedbcccedbabbdccbceecbccaebbcccbacdaeeecdedacbacabdceaaabcacceedeadeebbeeceebaeebcaddecccdeedeecaacebddedeeddccacccdaaaebecdbcbdcbaddceacbbedbcabbbedcadadbcbeeecaceddabdabeabbabddcabdecabdeccccaabaeebcddebdcdbdccccdecacaeccccbddcabbbeadccebddbccbcbecbaedabcdcceeabadbcabddecbccbdabbcccdebbaebbebadaceaceaebbbeaabeedeaabbdaadccdabbcbabcdceabdeabdaebbddedecdbcc\n", "output": "216\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncefcddeacbbffacacefaaaceebbcdbafdbcfbcdbffddabfeccaffaaddeecfebebaaaccabedeceddbdebeadfeeecddceedbbebffbbcfcbbefcefafdefbadabafbbddddfcbcdfefeaaeddbbacaeafdeffbabddabdcefbbaadfdabcddfccffbbaacdbddedddeeabfffdafdbdbbcefeeafcaabcfccfccceaaefebcaabddcbaccdaafffccfdcfccdfdeccdcfeaaedbadfbbdedcddfecbdfafddaaecaaadadcdfbefcdffbccfbbcdbedfbfcefadffebbcaebbffccbdbabfcbadacdbebabccbadefdfccfccedcbdeffaaadafdfbadefadaabafceecaaebdeedcebbbacfcceadcfcfaddffcaeafeacebbffddbfddabddeaafdcfdaabacfcdeceeadfacaea\n", "output": "228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nedfeaaaaddffdbfbcebefebdfdadbdadcbbdbdcabfdbdeccaeebcdebdddfedcacbbefeabdbbdeceeacadbbbebffcebbaffdcabcedccddeeccdfbdedfeddcbebdadffbaacbbedbdbfdbcaecccbbcfefdbddabdeadeeeecffdbcfcbeabcdeeaaddeeddeadccdefbeaabfabadaddbfaddbecaaeccbdefececdbebbddffbbfcfdddcadbccedcecabdcfceeefcdbbfcaeccbcdcddbfabcbedfdcdfafabadbbcdcfbfccafafacacbcbfbcabefacedadfdbdbaeeffbcfdbcabdbdedbfcbadfcaafbaeadecdedcddecfdfddaadaebacabafcdcdeecefeddcfcceeddebccafbdbafffbecdbbbaaeebdabddaadadbbdceffdbbefccfbcbcbdaaefcabdebfba\n", "output": "236\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncffaebdcbfbfbacefefbaeedaddacbdcfaeadcadcacaaacaadedebeecaebfdbcffaceadeedddbdfadcebcdffbafefcaecafcafbfccdeefadecfcbafaedbcecdbabdfbbfdeebabdaecbababcebbbdaadffbeffeffcfeefaccdfeafffeaaedfbbdafedecfdefbcaadecbffaadeadfecffaffdeeddbbadeadcfafbceaffabfefcddceeefacaceeffeefbcfcadaeeeabeebfcabbebddcdcedddddbceadbdddfeadafabfebdbcdeedadbbfacaeedefeafedbecbaafecffbaffbbfadfdfcebabddebcedacaaaafdfdefbaafdcfacfbddbfbdefcebdabcfdfaeebcbfbacffabbbbbdbfedebabbedadbaecbedbdeadddcfffaebdececfcbbbbcdecaacddb\n", "output": "238\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncbadfcecebaefcfbfbbaedbcfacdcbfcacfadbebdedaaffaaabffdeedbfbdececccfbaccddeffeeabaaffedfdcdfffdaabbafccaceedacdceabdabcebeddeaeeecbcabddebdfbcbecbffdbbcdaffacdacfbaafbacdbbbdacecabbaffacfbcbacdadafdbebcadeeabcfcfecaefecbbeaafcbaafabbbdbfaeaccedcdcfbbadfeddfcadcdafaeffdcdfceedeaacecaaafffeadcdfffbfedccbaefeebabeafddbddeacefcfbbbceacbcacaecddbcfadcdeafdedadddfefaadfdbbeaaaceacecfefefceeecaefeebfccdcffadbfbeacfbcfeecadcbbebaefaebcecbffaefbbcfacfddbdcdaaeddfdabbefbddcfdeaceafdddffffaffdcdebdacefbdba\n", "output": "235\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\naaafbfcaaeeeadcaebfffbfdaccaccfceaccaebecbefbbfeafffecaaeeadefcdebddaebcccfffdfacbffeeeacdbbeebdcadceabbccecfcdeebfeafbadaadcaaefcececdedccefcadbdbeaffeebeccabacbeeaacbeefdafeaecedfacadceabaffffdcfbbdfdbbeddddffdfabfecafcefaaaafeacefdfdfccabeecaeeefcecdfdacadbffdcaabdecaededeadbdfeadcaabbfbccbcfeccbecedbcdebbbabebbcfeaaacdaecdafbaacdbfefabebcafedacbbabadaeeaffebcdcabefbfdbbaaddacfafadbecbbcddcafcaefbefeffbbebeaaefcfafffacbdacadbbfadeececcaafcaadacdbfefaddefebaeebefadcdccddaaccebdaafffefeeddbacae\n", "output": "230\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\ncaebcfbedafeaedbedddbdecfafbbefdddcaedffbbddefacafdcfafddddfdaddddcbbaaddabadedacbbdfeaacabcbdebaadbbcacbcbdbfcfadfcfcfdabefacacdacccbebafdabdfcadcfbfdeacfccfbefebcbcadeccdcefdabcfffdbdaedeaabcdacfbaacfceafeaafcdfadcdfbdfbefdfedacecaaffefbaddbdbbbcaaddbabbeacfabceeaefeebedefbcfadbacdefeabdadcecacceaaaadfaaeaebebbdabbcbfbaddfbfcfddbaaccacabbbbcbbccedcfccffbbcededafcccbceeefcedafdebbbeebaafdbadebdfcfbbbebcbeccaccafbacffdccdcaecebcaadffffabeccfddeffcfedcadcefafcbeabcadabddbfaffbbffaccbafbacadbfbaaf\n", "output": "233\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\naefceaacfeddedcdedacacfbeeedfabbebbeccadfaabfacceaacdcbdfeeaffebcadeecddeacadfcaffedccabdebccabbdbbbaefbfacecaacdefbddcfcbafeccfbaaadccbbccfbeaaeadebbaaafbebfaaccfbdddeedaaeddbfdadbacafcbfdffcceacceefecbcedacfbffddedcdeacbdbdedbcdcacfcbceddaadcfcdcdcaefbcbbafffccbabfdecaaeceeaaaceedaceeebdebbeaadecfefacaddefbbdaebedbfadeafdeccaeaffedefcebababceccfacceddabcecbebccdcabddfdeefcabdbddcccdbccdacddbbaeaeadcfeccbcaabfcabceadfababecccbbbcddddeabdbbeacdbcdfacaafeedeadcbabbfeffcebfcfaceaecdfddbdbbeeebaebe\n", "output": "228\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nabfaaffaaebbefbabfefacdddddafbbabdacebeeccfabcfaebaeabbfabfcceddbdaadeddbffcfedaebecbaccdfbfafabfceffceeaccdfebbdbdafdebfcafebededcfbbaefefcbefdfabdefafeaccdfaeeacdacddccfcfcadbafbdbbdfcfecfeaffdcceccabcfeaddabfbaddebdecdfabebaeefefecedeeadaeedcfabcbcfbfaadaddaabeedfdccbbfeffccfcceddebecabacaedaaceedfddebbeaefbbcfdcdcbdfadadfefcaaffdfeedbcaebccdfecbfccacadccecbdcbdabbeaebdcedfbfaffbccbeaeebacceedceaabebeddbeedbfafeecdfdceebaaecabbefcabbaffdacfcebdbfffeadabddccaebdeffaacfdfcfdffabeefaecafaccabfbd\n", "output": "236\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "500\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "1\n", "type": "stdin_stdout" } ] }
apps
verifiable_code
255
Solve the following coding problem using the programming language python: The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair must differ by at most one. For each boy, we know his dancing skills. Similarly, for each girl we know her dancing skills. Write a code that can determine the largest possible number of pairs that can be formed from n boys and m girls. -----Input----- The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 100), where a_{i} is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b_1, b_2, ..., b_{m} (1 ≤ b_{j} ≤ 100), where b_{j} is the j-th girl's dancing skill. -----Output----- Print a single number — the required maximum possible number of pairs. -----Examples----- Input 4 1 4 6 2 5 5 1 5 7 9 Output 3 Input 4 1 2 3 4 4 10 11 12 13 Output 0 Input 5 1 1 1 1 1 3 1 2 3 Output 2 The input will be stdin and you should print your solution to stdout Now solve the problem and return the code.
```python n=int(input()) a=sorted(map(int,input().split())) m=int(input()) b=sorted(map(int,input().split())) c=0 for i in range(n): for j in range(m): if abs(a[i]-b[j]) <= 1: b[j]=-10 c+=1 break print(c) ```
vfc_10774
{ "difficulty": "interview", "memory_limit": null, "memory_limit_bytes": null, "problem_url": "https://codeforces.com/problemset/problem/489/B", "time_limit": "None" }
{ "language": "python", "test_cases": [ { "fn_name": null, "input": "4\n1 4 6 2\n5\n5 1 5 7 9\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 3 4\n4\n10 11 12 13\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 1 1 1 1\n3\n1 2 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n1\n1\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 10\n1\n9\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 5 4 4\n5\n5 3 4 2 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n1\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n3\n2\n3 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n4\n3\n4 4 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n2\n4\n3 1 4 2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n4\n5\n2 5 5 3 1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 2\n1\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 2\n2\n4 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 1\n3\n2 3 2\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 3\n4\n5 5 5 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 7\n5\n4 6 7 2 5\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n1\n1\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n5 4 5\n2\n2 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n6 3 4\n3\n4 5 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n7 7 7\n4\n2 7 2 4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 3\n5\n1 3 4 1 2\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 2 1 3\n1\n4\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 4 6 6\n2\n2 1\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 1 1 1\n3\n1 6 7\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n2 5 1 2\n4\n2 3 3 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n9 1 7 1\n5\n9 9 9 8 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 6 5 5 6\n1\n2\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 2 4 5 6\n2\n7 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n4 1 3 1 4\n3\n6 3 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n5 2 3 1 4\n4\n1 3 1 7\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n9 8 10 9 10\n5\n2 1 5 4 6\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n48\n100\n76 90 78 44 29 30 35 85 98 38 27 71 51 100 15 98 78 45 85 26 48 66 98 71 45 85 83 77 92 17 23 95 98 43 11 15 39 53 71 25 74 53 77 41 39 35 66 4 92 44 44 55 35 87 91 6 44 46 57 24 46 82 15 44 81 40 65 17 64 24 42 52 13 12 64 82 26 7 66 85 93 89 58 92 92 77 37 91 47 73 35 69 31 22 60 60 97 21 52 6\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n9 90 66 62 60 9 10 97 47 73 26 81 97 60 80 84 19 4 25 77 19 17 91 12 1 27 15 54 18 45 71 79 96 90 51 62 9 13 92 34 7 52 55 8 16 61 96 12 52 38 50 9 60 3 30 3 48 46 77 64 90 35 16 16 21 42 67 70 23 19 90 14 50 96 98 92 82 62 7 51 93 38 84 82 37 78 99 3 20 69 44 96 94 71 3 55 27 86 92 82\n1\n58\n", "output": "0\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "10\n20 87 3 39 20 20 8 40 70 51\n100\n69 84 81 84 35 97 69 68 63 97 85 80 95 58 70 91 100 65 72 80 41 87 87 87 22 49 96 96 78 96 97 56 90 31 62 98 89 74 100 86 95 88 66 54 93 62 41 60 95 79 29 69 63 70 52 63 87 58 54 52 48 57 26 75 39 61 98 78 52 73 99 49 74 50 59 90 31 97 16 85 63 72 81 68 75 59 70 67 73 92 10 88 57 95 3 71 80 95 84 96\n", "output": "6\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n10 10 9 18 56 64 92 66 54 42 66 65 58 5 74 68 80 57 58 30 58 69 70 13 38 19 34 63 38 17 26 24 66 83 48 77 44 37 78 97 13 90 51 56 60 23 49 32 14 86 90 100 13 14 52 69 85 95 81 53 5 3 91 66 2 64 45 59 7 30 80 42 61 82 70 10 62 82 5 34 50 28 24 47 85 68 27 50 24 61 76 17 63 24 3 67 83 76 42 60\n10\n66 74 40 67 28 82 99 57 93 64\n", "output": "9\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n4 1 1 1 3 3 2 5 1 2 1 2 1 1 1 6 1 3 1 1 1 1 2 4 1 1 4 2 2 8 2 2 1 8 2 4 3 3 8 1 3 2 3 2 1 3 8 2 2 3 1 1 2 2 5 1 4 3 1 1 3 1 3 1 7 1 1 1 3 2 1 2 2 3 7 2 1 4 3 2 1 1 3 4 1 1 3 5 1 8 4 1 1 1 3 10 2 2 1 2\n100\n1 1 5 2 13 2 2 3 6 12 1 13 8 1 1 16 1 1 5 6 2 4 6 4 2 7 4 1 7 3 3 9 5 3 1 7 4 1 6 6 8 2 2 5 2 3 16 3 6 3 8 6 1 8 1 2 6 5 3 4 11 3 4 8 2 13 2 5 2 7 3 3 1 8 1 4 4 2 4 7 7 1 5 7 6 3 6 9 1 1 1 3 1 11 5 2 5 11 13 1\n", "output": "76\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 6 9 15\n2\n5 8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 4\n2\n3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 3 5\n3\n3 4 6\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 3 4\n3\n2 1 5\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 5\n4\n1 1 1 5\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 2\n2\n3 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n3 1\n2\n2 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3\n2\n2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n10 12\n2\n11 9\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n1 2 3\n3\n3 2 1\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n1 3\n2\n2 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n4 5\n2\n5 3\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n7 5\n2\n6 8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 3 2 1\n4\n1 2 3 4\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3\n2\n3 1\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 4\n3\n3 1 8\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 1 1\n3\n2 4 4\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 3\n2\n4 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n1 1 3 3\n4\n2 2 1 1\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 1\n3\n2 4 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "5\n1 2 3 4 5\n5\n2 3 4 5 1\n", "output": "5\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n3 2 1\n3\n1 2 3\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 4\n2\n4 6\n", "output": "2\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n3 3 5 5\n4\n4 4 2 2\n", "output": "4\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "3\n2 7 5\n3\n2 4 8\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "100\n2 3 3 4 2 1 4 4 5 5 2 1 5 2 3 3 5 4 3 2 4 2 3 3 2 2 3 4 2 2 2 3 1 2 3 2 2 3 5 3 3 3 3 4 5 2 2 1 1 1 3 1 2 2 3 5 5 2 5 1 3 4 5 3 5 4 1 1 2 3 4 4 5 3 2 4 5 5 5 2 1 4 2 4 5 4 4 5 5 3 2 5 1 4 4 2 2 2 5 3\n100\n4 5 3 3 2 2 4 3 1 5 4 3 3 2 2 4 5 2 5 2 1 4 3 4 2 3 5 3 4 4 1 2 3 5 2 2 1 5 4 2 4 3 4 3 4 2 3 1 3 3 4 1 1 1 4 4 5 3 1 4 2 3 2 1 3 3 2 3 2 1 1 2 3 2 1 3 3 4 3 3 1 1 3 3 3 1 1 3 5 3 3 3 3 4 4 5 2 5 4 5\n", "output": "100\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "1\n3\n2\n2 3\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n5 6\n3\n1 5 100\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 7\n2\n6 8\n", "output": "1\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "4\n4 10 15 17\n4\n3 12 16 16\n", "output": "3\n", "type": "stdin_stdout" }, { "fn_name": null, "input": "2\n2 3\n2\n1 2\n", "output": "2\n", "type": "stdin_stdout" } ] }