problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p03389 | u909643606 | 2,000 | 262,144 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | ['n=int(input())\na=[0 for i in range(n)]\nb=[0 for i in range(n)]\nc=[0 for i in range(n)]\nfor i in range(n):\n a[i],b[i]=[int(i) for i in input().split()]\n c[i]=a[i]*b[i]\n#print(a,b)\n\ndef keisan(d,e,f):\n count=0\n old_value=10**20\n for j in range(int(d)):\n value=min(old_value,int((d-1)/(... | ['Runtime Error', 'Accepted'] | ['s148968562', 's721060860'] | [3064.0, 3064.0] | [18.0, 17.0] | [696, 594] |
p03389 | u938024002 | 2,000 | 262,144 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | ["in = [int(i) for i in input().split(' ')]\nA,B,C = in[0],in[1],in[2]\nif (A+B+C - max(A,B,C)) % 2 == 0:\n print((3*max(A,B,C) - A - B - C)/2)\nelse:\n print((3*max(A,B,C) - A - B - C - 1)/2) + 2", "tin = [int(i) for i in input().split(' ') ]\nA,B,C = tin[0],tin[1],tin[2]\nif (A+B+C - max(A,B,C)) % 2 == 0:\n print(... | ['Runtime Error', 'Accepted'] | ['s267021244', 's626141672'] | [2940.0, 3064.0] | [17.0, 18.0] | [191, 210] |
p03389 | u942033906 | 2,000 | 262,144 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | ['Q = int(input())\nfor i in range(Q):\n\tA,B = map(int,input().split())\n\tif A == 1 and B == 1:\n\t\tprint(0)\n\t\tcontinue\n\tscore = A * B\n\troot = int((score-1) ** 0.5)\n\tans = 2 * root\n\tif root >= A:\n\t\tans -= 1\n\tif root >= B:\n\t\tans -= 1\n\tif (score - 1) // root == root:\n\t\tans -= 1\n\tprint(ans)', ... | ['Runtime Error', 'Accepted'] | ['s767970143', 's941004623'] | [3064.0, 3064.0] | [17.0, 17.0] | [281, 246] |
p03389 | u964904181 | 2,000 | 262,144 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | ['lst = list(map(int, input().split()))\n\nmval = max(lst)\nsval = sum(lst)\ncn = mval + sval % 2\nn = (cn * 3 - sval-mval) // 2\nprint(n)\n\n', 'lst = list(map(int, input().split())).sort()\n\nmval = lst[-1]\nsval = sum(lst)\ncn = mval + (sval-mval) % 2\nn = (cn * 3 - sval) // 2\nprint(n)\n\n', '# A, B, C = [11, 12, 1... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s124429230', 's305783004', 's401630946', 's907994118'] | [9052.0, 9064.0, 9088.0, 9048.0] | [27.0, 26.0, 28.0, 30.0] | [132, 140, 153, 141] |
p03390 | u062147869 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ["import math \nQ=int(input())\ntable=[]\nfor i in range(Q):\n a,b=map(int,input().split())\n if a>b:\n table.append([b,a])\n else:\n table.append([a,b])\nans=[]\nfor a,b in table:\n s = int(math.sqrt(a*b))\n num=2*s-2\n if s-1>=a:\n num-=1\n if s*(s+1)<a*b:\n num+=2\n ... | ['Wrong Answer', 'Accepted'] | ['s903864416', 's139191849'] | [3064.0, 3064.0] | [18.0, 18.0] | [382, 467] |
p03390 | u104282757 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['# D\nimport math\nQ = int(input())\nA_list = []\nB_list = []\nfor _ in range(Q):\n A, B = map(int, input().split())\n A_list.append(min(A, B))\n B_list.append(max(A, B))\n \nfor i in range(Q):\n A = A_list[i]\n B = B_list[i]\n \n if A == B:\n print(A+B-2)\n continue\n ... | ['Wrong Answer', 'Accepted'] | ['s106013607', 's057464212'] | [3192.0, 3064.0] | [18.0, 18.0] | [702, 432] |
p03390 | u218843509 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['from math import sqrt\n\ndef func(a, b):\n\tif a == b:\n\t\treturn (a - 1) * 2\n\telse:\n\t\tsq = int(sqrt(a * b))\n\t\tif a * b == sq ** 2:\n\t\t\treturn (sq - 1) * 2 - 1\n\t\telif sq * (sq + 1) >= a * b:\n return (sq - 1) * 2\n\t\telse:\n\t\t\treturn sq * 2 - 1\n\nq = int(input())\nfor _ in range(q):\n\t... | ['Runtime Error', 'Accepted'] | ['s014163895', 's162599870'] | [2940.0, 3064.0] | [17.0, 18.0] | [334, 325] |
p03390 | u340781749 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['from math import sqrt\n\nq = int(input())\nfor _ in range(q):\n a, b = map(int, input().split())\n m = a * b\n s = int(sqrt(m - 1))\n ans = 2 * s\n if s * (s + 1) > m:\n ans -= 1\n if a != b:\n ans -= 1\n print(ans)\n', 'from math import sqrt\n\nq = int(input())\nfor _ in range(q):\... | ['Wrong Answer', 'Accepted'] | ['s753344936', 's579818064'] | [3060.0, 3060.0] | [18.0, 18.0] | [239, 255] |
p03390 | u364439209 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ["# import sys\n# argv = sys.argv\n# with open(argv[1], 'r') as f:\n\n\nQ = int(input().strip('\\n'))\nA = list()\nB = list()\nfor i in range(Q):\n inDatas = input().strip('\\n').split(' ')\n a, b = list(map(int, inDatas))\n score = a*b\n pa = 1\n pb = score\n count = 0\n while pb >= 1:\n if... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s879223471', 's971074578', 's832041500'] | [3064.0, 3064.0, 3064.0] | [2104.0, 2103.0, 19.0] | [503, 534, 449] |
p03390 | u368780724 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['def inpl(): return [int(i) for i in input().split()]\nQ = int(input())\nfor _ in range(Q):\n A, B = sorted(inpl())\n c = int((A*B-1)**0.5//1)\n ans = c-1+(A*B-1)//(c+1)\n print(ans + ((A*B)//1 == -((-A*B)//1)))', 'def inpl(): return [int(i) for i in input().split()]\nQ = int(input())\nfor _ in range(Q):\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s656771692', 's958000679', 's605965483'] | [3060.0, 3060.0, 3060.0] | [18.0, 20.0, 19.0] | [216, 211, 213] |
p03390 | u394794741 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['from math import sqrt\n\nQ = int(input())\n\nfor i in range(Q):\n A,B = map(int, input().split())\n m=A*B\n C = int(sqrt(m))\n if C*C==m:\n C=C-1\n\n if C*(C+1)<m:\n ans = 2*C-1\n else:\n ans = 2*C-2\n print(ans)', 'from math import sqrt\n\nQ = int(input())\n\nfor i in ra... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s012816737', 's346985450', 's487529182', 's754267915'] | [3060.0, 2940.0, 2940.0, 3064.0] | [18.0, 17.0, 17.0, 18.0] | [243, 323, 321, 322] |
p03390 | u403301154 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['q = int(input())\nfor i in range(q):\n a, b = list(map(int, input().split()))\n if a==b:\n ans = 2*a-2\n elif abs(a-b)==1:\n ans = 2*min(a, b)-2\n else:\n c = int((a*b)**0.5)\n if c*(c+1)>=a*b:\n ans = 2*c-2\n else:\n ans = 2*c-1\n print(ans)', 'q = int(input())\nfor i in range(q):\n a,... | ['Wrong Answer', 'Accepted'] | ['s898471333', 's315223658'] | [3188.0, 3188.0] | [18.0, 18.0] | [259, 315] |
p03390 | u517388115 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['n=int(input())\n\nfor i in range(n):\n a, b = map(int, input().split())\n\n p=int((a*b)**(1/2))\n print(p)\n if p*(p+1) < a*b:\n ans=int(2*p-1)\n elif p**2==a*b and not a==b:\n ans=int(2*p-3)\n else:\n ans=int(2*p-2)\n print(ans)\n', 'n=int(input())\nl=[]\nfor i in range(n):\... | ['Wrong Answer', 'Accepted'] | ['s213023460', 's934385732'] | [3188.0, 3064.0] | [19.0, 18.0] | [259, 290] |
p03390 | u532502139 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['n = int(input())\narr = []\nfor i in range(n):\n arr.append([int(x) for x in input().split()])\nfor pair in arr:\n first = {}\n first[pair[0]] = pair[0]\n second = {}\n second[pair[1]] = pair[1]\n pairs = []\n _max = max(pair)\n _min = min(pair)\n total = _max * _min - 1\n for i in range... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s913207956', 's968733610', 's905057419'] | [492064.0, 3064.0, 3188.0] | [2124.0, 2104.0, 18.0] | [496, 590, 454] |
p03390 | u562016607 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['import math \nQ=int(input())\nA=[0 for i in range(Q)]\nB=[0 for i in range(Q)]\nfor i in range(Q):\n A[i],B[i]=map(int,input().split())\nfor i in range(Q):\n C=A[i]*B[i]\n N=int(math.sqrt(C))\n D=0\n if N**2==C:\n N-=1\n else:\n while(True):\n if A[i]*B[i]<N**2:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s592041858', 's600705126', 's879975121'] | [3316.0, 3064.0, 3064.0] | [22.0, 18.0, 18.0] | [457, 706, 477] |
p03390 | u584749014 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['import math\n\nq = int(input())\n\nfor i in range(q):\n a, b = map(int, input().split())\n sq = (a*b)**0.5\n ans = int(math.modf(sq*2 - 2)[1])\n if a < 5 and b < 5:\n ans1 = 0\n ax = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n ax.pop(ax.index(a))\n bx = [9, 8, 7, 6, 5, 4, 3, 2, 1]\n b... | ['Wrong Answer', 'Accepted'] | ['s795953094', 's442928817'] | [3188.0, 3316.0] | [18.0, 22.0] | [697, 409] |
p03390 | u637175065 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9+7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()... | ['Wrong Answer', 'Accepted'] | ['s467163633', 's518670814'] | [7880.0, 8004.0] | [548.0, 148.0] | [904, 1094] |
p03390 | u638795007 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ["def examC():\n ABC = LI(); ABC.sort()\n judge = ABC[2]*2-ABC[1]-ABC[0]\n ans = judge//2 + (judge%2)*2\n print(ans)\n return\n\ndef examD():\n def judge(A,B):\n cur = int((A*B)**0.5)\n if cur**2==A*B:\n return (cur-1)*2 -1\n if cur*(cur+1)>=A*B:\n return cur... | ['Wrong Answer', 'Accepted'] | ['s864109797', 's883342013'] | [3548.0, 3696.0] | [24.0, 25.0] | [975, 1019] |
p03390 | u671861352 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['#!python3\n\n# input\nQ = int(input())\nA, B = [None] * Q, [None] * Q\nfor i in range(Q):\n A[i], B[i] = sorted(map(int, input().split()))\n\n\ndef solve(a, b):\n w = a * b - 1\n left, right = 0, b - a\n while right - left > 1:\n x = (left + right) // 2\n v = w // (a + x)\n if v < a:\... | ['Wrong Answer', 'Accepted'] | ['s615133685', 's562581297'] | [3064.0, 3064.0] | [20.0, 20.0] | [786, 757] |
p03390 | u672710370 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['import sys\nsys.setrecursionlimit(10**6)\n\ndebug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False\nif debug_mode:\n import os\n infile = open(os.path.basename(__file__).replace(".py", ".in"))\n\n def input():\n return infile.readline()\n\n\n# =======================================... | ['Wrong Answer', 'Accepted'] | ['s689459349', 's591018616'] | [3064.0, 3064.0] | [18.0, 18.0] | [761, 1044] |
p03390 | u694433776 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['q=int(input())\nwhile q>0:\n q-=1\n a,b=map(int,input().split())\n s=int((a*b)**0.5)\n if s==0:\n print(0)\n continue\n ret=2*s\n if (a*b-1)//s==s:\n ret-=1\n if min(a,b)<=s:\n ret-=1\n print(ret)', 'q=int(input())\nfor i in range(q):\n a,b=map(int,input().split(... | ['Wrong Answer', 'Accepted'] | ['s249360604', 's880044507'] | [3064.0, 3060.0] | [18.0, 23.0] | [235, 388] |
p03390 | u777529218 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['import math\nq=int(input())\nfor j in range(q):\n\tAB=[int(i) for i in input().split()]\n\tAB.sort()#4,11\n\tab=AB[0]*AB[1] #44\n\tfor i in range(AB[0],AB[1]+1):\n\t\tif i*i>=ab:\n\t\t\tx=i-1\n\t\t\tbreak\n\tfor i in range(x,ab+1):\n\t\tif x*i>=ab:\n\t\t\ty=i-1\n\t\t\tbreak\n\tcnt1=2*x\n\tcnts=1 if x==y else 0\n\tcnt... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s288822703', 's372033732', 's513492273'] | [3192.0, 3064.0, 3064.0] | [2104.0, 17.0, 18.0] | [414, 430, 467] |
p03390 | u876442898 | 2,000 | 262,144 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | ['# -*- coding: utf-8 -*-\n\nfrom math import ceil, sqrt\n\nQ = int(input())\nfor i in range(Q):\n A, B = sorted(map(int, input().split(" ")))\n s = A*B\n\n if A == B:\n print(2*A - 2)\n elif A == B + 1:\n print(2*A - 2)\n else:\n C = ceil(sqrt(s)) - 1\n print(2*C - 1)', '# -*... | ['Wrong Answer', 'Accepted'] | ['s494962399', 's969713301'] | [3064.0, 3188.0] | [18.0, 19.0] | [491, 561] |
p03391 | u145600939 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['import sys\ninput = sys.stdin.readline\nn = int(input())\nans = 0\nflag = 0\nfor i in range(n):\n a,b = map(int,input().split())\n if a > b:flag = 1\n ans += a\nprint(ans*flag)\n', 'import sys\ninput = sys.stdin.readline\nn = int(input())\nm = 10**10\nans = 0\nflag = 0\nfor i in range(n):\n a,b = map(int,input().... | ['Wrong Answer', 'Accepted'] | ['s780043795', 's762199451'] | [3060.0, 3060.0] | [44.0, 46.0] | [171, 208] |
p03391 | u163320134 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['n=int(input())\narr=[list(map(int,input().split())) for _ in range(n)]\narr2=[]\nans=0\nfor a,b in arr:\n ans+=a\n arr2.append([a-b,b])\narr2=sorted(arr2,reverse=True)\nans=-arr2[0][1]\nprint(ans)', 'n=int(input())\narr=[list(map(int,input().split())) for _ in range(n)]\narr2=[]\nans=0\nmb=10**18\nfor a,b in arr:\n... | ['Wrong Answer', 'Accepted'] | ['s001049724', 's835971090'] | [10100.0, 7796.0] | [106.0, 85.0] | [189, 193] |
p03391 | u186426563 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['n = int(input())\na, b, c = [], [], []\nfor i in range(n):\n ab = list(map(int, input().split()))\n a.append(ab[0])\n b.append(ab[1])\n if(ab[0] > ab[1]):\n c.append(ab[1])\nif(len(c) == 0):\n print(0)\nelse:\n sort.c()\n print(sum(a) - c[0])', 'n = int(input())\na, b, c = [], [], []\nfor ... | ['Runtime Error', 'Accepted'] | ['s335671862', 's365005953'] | [5020.0, 5108.0] | [88.0, 88.0] | [258, 247] |
p03391 | u226155577 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['N = int(input())\nans = 0\nm = INF = 10**9+7\nd = []\nfor i in range(N):\n a, b = map(int, input().split())\n ans += a\n if a > b:\n m = min(m, b)\nprint(0 if INF else ans-m)', 'N = int(input())\nans = 0\nm = INF = 10**9+7\nd = []\nfor i in range(N):\n a, b = map(int, input().split())\n ans += a... | ['Wrong Answer', 'Accepted'] | ['s395073246', 's311076230'] | [3060.0, 3060.0] | [76.0, 78.0] | [181, 186] |
p03391 | u353797797 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['import sys\n\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\n\ndef main():\n n=int(input())\n ab=[list(map(int, input().split())) for _ in range(n)]\n ab.sort(key=lambda x:x[0]-x[1])\n print(ab)\n re=0\n ans=0\n for a,b in ab:\n if a<b:\n ans+=b\n re+=b-a... | ['Wrong Answer', 'Accepted'] | ['s421672651', 's959716722'] | [9680.0, 3060.0] | [77.0, 42.0] | [483, 330] |
p03391 | u493813116 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['N = int(input())\nA = [0] * N\nB = [0] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nc = 0\n\nif A == B:\n print(c)\n exit()\n\n\nfor i in range(N):\n if A[i] < B[i]:\n c += A[i]\n B[i] -= A[i]\n A[i] = 0\n\nwhile A != B:\n x = 0\n for i in range(N):\n ... | ['Runtime Error', 'Accepted'] | ['s735753714', 's567939239'] | [4596.0, 3064.0] | [83.0, 78.0] | [652, 514] |
p03391 | u496131003 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['N = int(input())\nc = False\ns = 0\nfor i in range(N):\n ai,bi = map(int,input().split())\n s += ai\n if ai > bi:\n if not C:\n c = bi\n if bi < c:\n c = bi\nif not c:\n print(0)\nelse:\n print(s-c)', 'N = int(input())\nc = -1\ns = 0\nfor i in range(N):\n ai,bi = ... | ['Runtime Error', 'Accepted'] | ['s175624082', 's293715184'] | [3060.0, 3060.0] | [73.0, 75.0] | [235, 236] |
p03391 | u623687794 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['n=int(input())\nrem=0\nS=0\nallissame=0\nfor i in range(n):\n a,b=map(int,input().split())\n S+=a\n if a<b:\n allissame|=1\n continue\n elif a>b:\n if rem > b:\n rem=b\n allissame|=1\n else:pass\nif not allissame:\n print(0)\nelse:\n print(S-rem)\n', 'n=int(input())\nrem=10**10\nS=0\nallissame... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s474726460', 's809086245', 's694258813'] | [3060.0, 3060.0, 3060.0] | [81.0, 79.0, 79.0] | [253, 258, 258] |
p03391 | u692632484 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['N=int(input())\nab=[[int(i) for i in input().split()] for j in range(N)]\ntotal = sum([sum(row) for row in ab])//2\ndiff = [row[1] for row in ab if row[0]>row[1]]\nif len(diff)==0:\n print(0)\nelse:\n print(total-diff)\n', 'N=int(input())\nab=[[int(i) for i in input().split()] for j in range(N)]\ntotal = sum([s... | ['Runtime Error', 'Accepted'] | ['s820942512', 's593694147'] | [7412.0, 7412.0] | [81.0, 81.0] | [218, 223] |
p03391 | u754022296 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['n = int(input())\ns = 0\nminb = float("inf")\nfor _ in range(n):\n a, b = map(int, input().split())\n if a > b:\n minb = min(b, minb)\n s += a\nif b == float("inf"):\n print(s - minb)\nelse:\n print(0)', 'n = int(input())\ns = 0\nminb = float("inf")\nfor _ in range(n):\n a, b = map(int, input().split())\n i... | ['Wrong Answer', 'Accepted'] | ['s846545443', 's008371253'] | [3060.0, 3060.0] | [77.0, 77.0] | [198, 201] |
p03391 | u768301880 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['import math\n\nn = int(input())\nc = -1\nsum_ = 0\nfor i in range(n)\x08:\n a, b = map(int, input().split())\n sum_ += a\n if a > b:\n if c == -1:\n c = b\n if b > c:\n c = b\nif c == -1:\n print("0")\nelse:\n print(s - c)\n', 'import math\n\nn = int(input())\nc = -1... | ['Runtime Error', 'Accepted'] | ['s789700445', 's704458056'] | [2940.0, 3060.0] | [17.0, 76.0] | [255, 255] |
p03391 | u876442898 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['# -*- coding: utf-8 -*-\n\n\n\n\n\n\n\n\n\n\n\nimport numpy as np\n\nN = int(input())\nqueA = []\nqueB = []\nfor i in range(N):\n A, B = map(int, input().split(" "))\n queA.append(A)\n queB.append(B)\n\ncnt = 0\nif np.allclose(A, B):\n print(cnt)\n\n\n\nfor i in range(N):\n if queA[i] <= queB[i]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s074372350', 's097742705', 's418374684', 's479643716', 's590113022', 's922700751', 's719257229'] | [13896.0, 14532.0, 16116.0, 3064.0, 13896.0, 3188.0, 3064.0] | [221.0, 216.0, 243.0, 17.0, 221.0, 76.0, 76.0] | [1078, 1324, 1149, 545, 1143, 423, 423] |
p03391 | u922449550 | 2,000 | 262,144 | You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, t... | ['N = int(input())\ndiff_a_b = []\nfor i in range(N):\n a, b = map(int, input().split())\n diff_a_b.append([a - b, a, b])\n\ndiff_a_b.sort()\nif diff_a_b[0][0] == 0: \n print(0)\n quit()\n\nans = 0\nd = 0\nfor diff, a, b in diff_a_b:\n if diff <= 0: # a <= b\n ans += b\n d -= diff\n else:\n if d > diff:\... | ['Wrong Answer', 'Accepted'] | ['s660147319', 's122446806'] | [7116.0, 6996.0] | [106.0, 105.0] | [423, 384] |
p03393 | u022979415 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['from string import ascii_lowercase\n\n\ndef main():\n word = input()\n if len(word) < 26:\n count = {}\n for a in ascii_lowercase:\n count[a] = 0\n for w in word:\n count[w] += 1\n count_l = list(count.items())\n count_l.sort(key=lambda x: x[0])\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s142543757', 's937771303', 's309528444'] | [3768.0, 3768.0, 3772.0] | [25.0, 26.0, 24.0] | [939, 1086, 916] |
p03393 | u047668580 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import sys\n \n \nalph="abcdefghijklmnopqrstuvwxyz"\nallis=list(alph)\nS=input()\nif(S=="zyxwvutsrqponmlkjihgfedcba"):\n print(-1)\n sys.exit()\n \nfor i in alph:\n if(i not in S):\n print(S)\n sys.exit()\n \nl=-1\nfor i in range(len(S)-1)[::-1]:\n if(ord(S[i])<ord(S[i+1])):\n ... | ['Wrong Answer', 'Accepted'] | ['s075660595', 's501277769'] | [3064.0, 3064.0] | [17.0, 17.0] | [414, 691] |
p03393 | u064408584 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["s=list(input())\nal=[chr(ord('a') + i) for i in range(26)]\nal=[i for i in al if i not in s]\nif al:\n print(s+al[0])\n exit()\nfor i in range(25,0,-1):\n if s[i-1]<s[i]:\n s=s[:i-1]+[s[-1]]\n print(''.join(s))\n exit()\nelse:print(-1)", "s=input()\nal=[chr(ord('a') + i) for i in range(2... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s081594598', 's491890892', 's648552420'] | [3064.0, 3060.0, 3064.0] | [18.0, 17.0, 18.0] | [254, 208, 327] |
p03393 | u075012704 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = input()\nZ = sorted(list(S))\nG = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]\nans = []\nfor s in S:\n if s not in ans:\n ans.append(s)\n else:\n i = G.index(s)\n j = 0\n while j < 27:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s023554257', 's023879075', 's408017561', 's890615235'] | [3188.0, 3064.0, 3064.0, 3064.0] | [19.0, 18.0, 18.0, 17.0] | [1383, 370, 410, 436] |
p03393 | u089142196 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['alp=[chr(ord(\'a\') + i) for i in range(26)]\nunused=set(alp)\n \nS=input()\nprint("len",len(S))\n\nif len(S)<26:\n for i in range(len(S)):\n if S[i] in unused:\n unused.remove(S[i])\n unused=sorted(unused)\n print(S+unused[0])\nelse:\n for j in range(len(S)-1,-1,-1):\n p=set(... | ['Wrong Answer', 'Accepted'] | ['s191227131', 's055878056'] | [3064.0, 3188.0] | [17.0, 17.0] | [511, 512] |
p03393 | u102960641 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['a={chr(i) for i in range(ord(a),ord(a)+25)}\ns=input()\nn=len(s)\nif n<26:\n print(s+sorted(a-set(s))[0])\nelse:\n for i in range(2,27):\n if s[-i]<s[-i+1]:\n break\n if i==26:\n print(-1)\n exit()\n for j in sorted(s[-i+1:]):\n if j>s[-i]:break\n print(s[:-i]+j)\n', 'a={chr(i) for i in ra... | ['Runtime Error', 'Accepted'] | ['s159157218', 's544021808'] | [3060.0, 3064.0] | [19.0, 17.0] | [278, 281] |
p03393 | u112007848 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['dic = [False for i in range(26)]\ntxt = input()\nfor i in txt:\n dic[ord(i) - 97] = True\nfor i in range(26):\n if not dic[i]:\n break\nelse:\n for j in range(25):\n if txt[24 - j] < txt[25 - j]:\n \n last = txt[24-j] \n txt = txt[:24 - j]\n \n dic = [False for i in range(26)]\n ... | ['Wrong Answer', 'Accepted'] | ['s433114012', 's551530275'] | [9064.0, 9048.0] | [26.0, 30.0] | [498, 527] |
p03393 | u177481830 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["S = input()\nif len(S) < 26:\n for c in string.ascii_lowercase:\n if c not in S:\n break\n print(S + c)\nelse:\n ret = None\n for i in range(26):\n if max(S[25-i:]) != S[25-i]:\n mc = 'z'\n for c in S[25-i:]:\n if c > S[25-i]:\n ... | ['Runtime Error', 'Accepted'] | ['s906853108', 's885978053'] | [3064.0, 3768.0] | [18.0, 24.0] | [454, 419] |
p03393 | u183896397 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = list(input())\nalpha = [chr(i) for i in range(97, 97+26)]\nif len(S) == 26:\n ans = S\n x = S[-1]\n for i in range(2,26):\n if alpha.index(x) > alpha.index(S[-1*i]):\n ans = S[:-1*i]\n ans.append(x)\n break\nelse:\n ans = S\n for i in alpha:\n if i not... | ['Wrong Answer', 'Accepted'] | ['s974305210', 's745013170'] | [3064.0, 3064.0] | [17.0, 17.0] | [397, 563] |
p03393 | u193264896 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float(\'inf\')\nMOD = 10 ** 9 + 7\n\ndef main():\n s = readline().decode(\'utf-8\')\n if len(s) < 26:\n al = [chr(ord(\'a\') + i) for i in range(26)]\n for i in al:\n if not (i in s):\n ... | ['Runtime Error', 'Accepted'] | ['s625134898', 's814002636'] | [3064.0, 3064.0] | [17.0, 17.0] | [637, 619] |
p03393 | u201234972 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = input()\nl = len(S)\nif l != 26:\n colors = [0]*26\n for i in range(26):\n colors[ ord(S[i]) - ord(\'a\')]\n for i in range(26):\n if colors[i] == 0:\n ans = S + chr( i + ord(\'a\'))\n break\n print(ans)\nelif S == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\nelse:... | ['Runtime Error', 'Accepted'] | ['s884230581', 's921703786'] | [3064.0, 3064.0] | [18.0, 18.0] | [421, 609] |
p03393 | u280512618 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["from collections import deque\nfrom itertools import dropwhile\n\nalphabet = set('abcdefghijklmnopqrstuvwxyz')\n\nif __name__ == '__main__':\n s = input()\n l = [c for c in alphabet - set(s)]\n if l != []:\n print(s + min(l))\n quit(0)\n\n deq = deque()\n deq.append(s[-1])\n for i in r... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s288223901', 's989269725', 's485047921'] | [2940.0, 2940.0, 3316.0] | [17.0, 18.0, 21.0] | [523, 517, 526] |
p03393 | u291766461 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import string\nS = input()\nif len(S) == 26:\n if S == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n else:\n i = len(S) - 1\n while 0 <= i:\n if S[i-1] < S[i]:\n min_val = min(S[i:])\n i -= 1\n break\n i -= 1\n ans = ""... | ['Wrong Answer', 'Accepted'] | ['s439101979', 's067929841'] | [3772.0, 3768.0] | [25.0, 26.0] | [541, 562] |
p03393 | u311636831 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import bisect\n\nM=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nO=input()\nS=list(O+" ")\n\ndic={}\n\nfor I in list(O):\n if(dic.get(I,None)==None):\n dic[I]=1\n print(-1)\n exit()\n else:\n print(-... | ['Wrong Answer', 'Accepted'] | ['s813783058', 's824323804'] | [3188.0, 3064.0] | [17.0, 18.0] | [1414, 429] |
p03393 | u329706129 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['print(-1)', 'S = input()\nli = [chr(ord(\'a\') + i) for i in range(26)]\nused = [0] * 26\ndic = dict(zip(li, used))\nfor i in range(len(S)): dic[S[i]] = 1\nif(len(S) < 26):\n for i in range(26):\n k = chr(ord(\'a\') + i)\n v = dic[k]\n if(v == 0):\n print(S + k)\n exit(0)... | ['Wrong Answer', 'Accepted'] | ['s839726557', 's883753154'] | [2940.0, 3064.0] | [18.0, 18.0] | [9, 696] |
p03393 | u357751375 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["s = list(input())\nm = list('zyxwvutsrqponmlkjihgfedcba')\nif len(s) < 26:\n for i in m:\n if not i in s:\n s.append(_)\n break\n print(''.join(s))\nelse:\n if s == m:\n print(-1)\n else:\n x = s[-1]\n for i in range(25)[::-1]:\n if x > s[i]:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s157019355', 's552396079', 's591622159', 's819036081', 's994044451', 's928173004'] | [9144.0, 9104.0, 9044.0, 9088.0, 8984.0, 9076.0] | [27.0, 29.0, 26.0, 26.0, 30.0, 29.0] | [489, 409, 201, 515, 406, 573] |
p03393 | u364439209 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["import string\n\nS = input()\nalphabetsStr = string.ascii_lowercase\nalphabets = list(map(lambda x: x, string.ascii_lowercase))\nlastWord = ''.join(alphabets[::-1])\n\nif len(S) == 26:\n if S == lastWord: print(-1)\n else:\n for i in S:\n if alphabets[i] != S[i]:\n print(S[:i] ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s354833282', 's425185267', 's971250212', 's501438978'] | [3772.0, 3828.0, 3772.0, 3892.0] | [25.0, 27.0, 25.0, 24.0] | [460, 809, 361, 745] |
p03393 | u367130284 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input() \nprint(s)\n \nfor j in reversed(range(len(s)-1)):\n sets=set(s[:j])\n #print(sets)\n for i in range(ord(s[j]) + 1,123):\n if chr(i) not in sets:\n \n exit()\nprint(-1)', 's = input() \n#print(s)\n \nfor j in reversed(range(len(s)-1)):\n sets=set(s[:j])\n #print... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s197421032', 's577127623', 's303086827'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [240, 240, 173] |
p03393 | u373047809 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['from string import*;from itertools import*\nb=ascii_lowercase;r=s=input();d=l=len(s);t=s[::-1]\nif l>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(s[::-1],s[-2::-1])])][0]-2;s,b,o=s[:d],s[d+1:],1\nprint(-(d<-26)or s+sorted(set(b)-set([s,b[:ord(s[d])-97]][o]))[0])', 'from string import*\nfrom itertools i... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s201592589', 's421863716', 's463499030', 's597613034', 's646900432', 's828164397', 's928401442', 's332835320'] | [3832.0, 3768.0, 3772.0, 2940.0, 3772.0, 3768.0, 2940.0, 3768.0] | [26.0, 25.0, 25.0, 17.0, 25.0, 25.0, 17.0, 25.0] | [274, 324, 324, 327, 274, 325, 320, 257] |
p03393 | u403301154 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\nalphabet = ["abcdefghijklmnopqrstuvwxyz"]\nif s == str(alphabet[::-1]):\n print(-1)\nelse:\n if len(set(s))<26:\n for ele in alphabet:\n if ele not in s:\n print(s+ele)\n break\n else:\n suf=[s[-1]]\n for i in range(len(s)-1, 0, -1):\n if s[i]<s[i-1]:\n suf.appe... | ['Runtime Error', 'Accepted'] | ['s762006383', 's219700973'] | [3064.0, 3892.0] | [17.0, 25.0] | [474, 462] |
p03393 | u404676457 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["import sys\ns = input() + chr(96)\n\nif len(s) != 26:\n sets = set(s)\n for i in range(ord('a'), ord('z') + 1):\n if chr(i) not in sets:\n print(s[:j] + chr(i))\n sys.exit(0)\nj = 26\nfor j in range(26, 1, -1):\n if s[j - 1] > s[j]:\n continue\n sets = set(list(s[:j]))\... | ['Runtime Error', 'Accepted'] | ['s827501007', 's229148694'] | [3064.0, 3060.0] | [18.0, 18.0] | [452, 245] |
p03393 | u442877951 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = str(input())\nalp = "abcdefghijklmnopqrstuvwxyz"\ns = len(S)\nfor i in range(s):\n alp = alp.replace(S[i],\'\')\nif alp != \'\':\n print(S+alp[0])\nelse:\n if S == "zyxwvutsrqponmlkjihgfedcba":\n S = "-1"\n else:\n for j in range(s-1,0,-1):\n if S[j] > S[j-1]:\n alp = "abcdefghijklmnopqrstuv... | ['Wrong Answer', 'Accepted'] | ['s208478103', 's388013578'] | [3064.0, 3064.0] | [17.0, 18.0] | [455, 475] |
p03393 | u454524105 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\nans = list(s)\nalpha = [chr(i) for i in range(97, 97+26)]\nif len(s) == 26 and s == "".join(alpha): print(-1)\nelse:\n for i in range(len(s)):\n if alpha[i] == ans[i]:\n if i == len(s) - 1:\n ans.append(alpha[i+1])\n else: continue\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s699936101', 's046465469'] | [3064.0, 3064.0] | [17.0, 18.0] | [397, 702] |
p03393 | u474423089 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S=input()\nif len(S)<26:\n raise TypeError:\n print(S+sorted(list({chr(i+97) for i in range(26)}-set(S)))[0])\nelse:\n tmp = [S[25]]\n for i in range(25):\n tmp.append(S[24-i])\n if S[24-i] < S[25-i]:\n print(S[:26-len(tmp)]+sorted(tmp)[1])\n exit()\n print(-1)', 'S=... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s371609750', 's981784665', 's946747330'] | [2940.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [301, 300, 320] |
p03393 | u488884575 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["s = input()\n\nabc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']\n\nfor a in abc:\n if a not in abc:\n print(s+a)\n exit()\nprint(-1)\n\n", "s = input()\n\nabc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s317454631', 's542784516', 's574687463', 's835419502', 's500417775'] | [9044.0, 9096.0, 9116.0, 9084.0, 9096.0] | [29.0, 27.0, 27.0, 27.0, 28.0] | [206, 439, 223, 441, 509] |
p03393 | u502731482 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\nif len(s) < 26:\n print(s + chr(ord(s[-1]) + 1))\nelse:\n i = len(s) - 1\n while i != 0 and s[i - 1] > s[i]:\n i -= 1\n if i == 0:\n print(-1)\n else:\n print(s[: i - 1] + chr(ord(s[i - 1]) + 1))\n', 's = input()\n\ndef set_char(data, c):\n for i in range(26):\n ... | ['Wrong Answer', 'Accepted'] | ['s373565380', 's210009438'] | [2940.0, 3064.0] | [17.0, 17.0] | [235, 481] |
p03393 | u518064858 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s=input()\nn=len(s)\ncha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nif n<26:\n for i in range(26):\n if s.count(cha[i])==0:\n print(s+cha[i])\nelse:\n for j in range(n-1,0,-1):\n if s[j]>s[j-1]:\n memo=j-1\n ... | ['Wrong Answer', 'Accepted'] | ['s507823614', 's323540653'] | [3064.0, 3064.0] | [17.0, 18.0] | [515, 553] |
p03393 | u536034761 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['\nS = input()\nL = list(map(ord, S))\nif len(S) == 26:\n if S == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n else:\n pre = set()\n for i, l in enumerate(L[::-1]):\n if pre:\n if min(pre) > l:\n print(reversed(reversed(S)[i + 1 :]) + chr(min(pre))... | ['Runtime Error', 'Accepted'] | ['s136180881', 's526482367'] | [8948.0, 9128.0] | [26.0, 30.0] | [472, 720] |
p03393 | u543954314 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['alp = "abcdefghijklmnopqrstuvwxyz"\ns = input()\nif len(s) < 26:\n for x in alp:\n if x not in s:\n print(s+x)\nelif s == alp[::-1]:\n print(-1)\nelse:\n for i in range(24,-1,-1):\n for j in range(25,i,-1):\n if s[i] < s[j]:\n print(s[:i]+s[j])\n exit()', 'alp = "abcdefghijklmnopqrstu... | ['Wrong Answer', 'Accepted'] | ['s088090423', 's122509067'] | [3064.0, 3064.0] | [17.0, 18.0] | [273, 285] |
p03393 | u557494880 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['N = int(input())\nans = []\nn = N//2\nif N == 3:\n ans = [2,3,63]\nelif 4 <= N <= 15000:\n for i in range(1,n):\n ans.append(2*i)\n x = 30000 - 2*i\n ans.append(x)\n if N % 2 == 1:\n ans.append(30000)\n ans.append(3)\n ans.append(9)\nelse:\n for i in range(1,15000):\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s036814198', 's248157228', 's378267219', 's574483440', 's833794091', 's859557027', 's400779632'] | [3064.0, 3064.0, 3064.0, 2940.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0, 17.0, 17.0, 18.0, 17.0] | [507, 561, 494, 568, 571, 780, 675] |
p03393 | u572144347 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s=input()\nfrom collections import defaultdict \nif len(s)<26:\n d=defaultdict(int)\n for c in s:\n d[c]+=1\n for bb in b:\n if d[bb]==0:\n print(s+bb)\n exit() \nN=len(s)\nfor first in range(N-1,0,-1):\n mn=s[first]\n for i in range(first-1,-1, -1):\n if s[i]<mn:\n print(s[:i]+mn)\n ... | ['Runtime Error', 'Accepted'] | ['s215100975', 's153608168'] | [3316.0, 3316.0] | [20.0, 23.0] | [325, 433] |
p03393 | u574050882 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['def f(s, i, d):\n if len(s) == i:\n d.sort()\n return d[0]\n if len(d) == 0:\n return "_"\n d.remove(s[i])\n r = f(s, i+1, d)\n if r == "_":\n d.sort()\n for i in d:\n if s[i] < i:\n return i\n d.append(s[i])\n return "_"\n return "".join(s[i], r)\n\ndef main():\n d = list("abc... | ['Runtime Error', 'Accepted'] | ['s110391736', 's405060562'] | [3080.0, 3064.0] | [19.0, 17.0] | [377, 381] |
p03393 | u593567568 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = list(input())\nL = len(S)\n\nif L != 26:\n \n USED = [False] * 26\n for s in S:\n USED[ord(s) - 97] = True\n \n for i in range(26)[::-1]:\n if not USED[i]:\n S.append(chr(97+i))\n break\n \n print("".join(S))\nelse:\n print("a")', 'S = list(input())\nL = len(S)\n\nif L != 26:\n \n USED =... | ['Wrong Answer', 'Accepted'] | ['s388435737', 's575910004'] | [9080.0, 9040.0] | [26.0, 28.0] | [311, 622] |
p03393 | u597455618 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\nalphabet = "abcdefghijklmnopqrstuvwxyz"\nans = -1\nfor i in range(len(s)):\n t = s[:~i]\n dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)\n if dif:\n ans = t + min(dif)\n break\nprint(ans)', 's = input()+chr(ord("a")-1)\nans = -1\nfor i in range(len(s)):\n t = s[:~i]\n d... | ['Wrong Answer', 'Accepted'] | ['s795507408', 's851367316'] | [8920.0, 9120.0] | [30.0, 28.0] | [220, 196] |
p03393 | u616217092 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["import functools\nimport math\nfrom itertools import combinations\nfrom sys import stdin\n\n\ndef main():\n N = int(stdin.readline().rstrip())\n ham = combinations(range(1, 30001), 100)\n for x in ham:\n if functools.reduce(math.gcd, x) == 1:\n for y in x:\n xx = list(x)\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s094203955', 's810026159', 's563745668'] | [3828.0, 3832.0, 3960.0] | [113.0, 28.0, 37.0] | [557, 519, 622] |
p03393 | u629350026 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s=str(input())\nt=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nif len(s)!=26:\n for i in range(26):\n if t[i] not in s:\n s.append(t[i])\n break\n print("".join(s))\nelse:\n if "".join(s)=="zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n els... | ['Runtime Error', 'Accepted'] | ['s619006547', 's758607809'] | [9068.0, 9116.0] | [28.0, 30.0] | [454, 466] |
p03393 | u652656291 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = input()\na = []\nb = ["a","b","c","d","e","f","g","h","i","j","k","l","m""n","o","p","q","r","s","t","u","v","w","x","y","z"]\nfor s in S:\n if s not in a:\n a.append(s)\na.sort()\nif len(a) == 0:\n print(-1)\nelse:\n for i in range(len(a)):\n if a[i] != b[i]:\n print(S+a[i])\n exit()\n ... | ['Wrong Answer', 'Accepted'] | ['s554488870', 's050678817'] | [9056.0, 9084.0] | [28.0, 29.0] | [306, 401] |
p03393 | u653807637 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['# encoding:utf-8\n \nimport fractions\n \ndef check(l):\n\tl = list(map(int, l.split()))\n \n\tif max(l) >= 30001:\n\t\treturn False\n\ttmp = l[0]\n \n\tfor i in range(len(l) - 1):\n\t\ttmp = fractions.gcd(tmp, l[i+1])\n\tif tmp != 1:\n\t\treturn False \n \n\tfor i in range(len(l)):\n\t\tif fractions.gcd(l[i], sum(l)... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s851045170', 's897458224', 's943289951', 's573631610'] | [5688.0, 3064.0, 5588.0, 3064.0] | [84.0, 17.0, 46.0, 17.0] | [1117, 650, 1460, 560] |
p03393 | u677523557 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["import string\n\nS = input()\n\nabc = [chr(i) for i in range(97, 97+26)]\n\nif len(S) < 26:\n for s in S:\n abc.remove(s)\n add = abc[0]\n print('wahaha')\n print(S + add)\nelif S == ''.join(sorted(abc, reverse=True)):\n print(-1)\nelse:\n N = len(S)\n for i in range(1, N):\n now = ... | ['Runtime Error', 'Accepted'] | ['s821540078', 's823086442'] | [3828.0, 3892.0] | [24.0, 26.0] | [550, 534] |
p03393 | u679325651 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = [ord(i)-97 for i in str(input())]\nappeared = [False for i in range(26)]\nfor s in S:\n appeared[s] = True\nworst = False\nif len(S)<26:\n for i in range(len(appeared)):\n if appeared[i] == False:\n break\n S.append(i)\n \nelse:\n prev = -1\n for i in [25-k for k in range(26)]:... | ['Wrong Answer', 'Accepted'] | ['s617168935', 's846912016'] | [3064.0, 3064.0] | [17.0, 18.0] | [575, 1096] |
p03393 | u688375653 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['alpha=list("abcdefghijklmnopqrstuvwxyz")\nalpha_dict={a:i for i,a in enumerate(alpha)}\nalpha = set(alpha)\n\nstring = input()\n\ncan_use_str = alpha - set(list(string))\n\nif string == "zyxwvutsrqponmlkjihgfedcba":\n print(1)\n\nelif len(can_use_str)==0:\n string_len=len(string)-1\n for i in range(1,string_... | ['Wrong Answer', 'Accepted'] | ['s263549645', 's697832900'] | [3064.0, 3444.0] | [17.0, 22.0] | [548, 571] |
p03393 | u750651325 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): r... | ['Wrong Answer', 'Accepted'] | ['s845656577', 's165485969'] | [10204.0, 10528.0] | [41.0, 40.0] | [1037, 1027] |
p03393 | u754022296 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\nif len(s)<26:\n for i in al:\n if i not in s:\n print(s+i)\n break\nelse:\n if s == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n else:\n k = []\n for i in range(25, 0, -1):\n k.append(s[i])\n if s[i-1] < s[i]:\n for j in sorted(k):\n if j > s[i-1]:\n ... | ['Runtime Error', 'Accepted'] | ['s814282318', 's592395906'] | [3064.0, 3064.0] | [22.0, 17.0] | [346, 380] |
p03393 | u761989513 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\na = list("abcdefghijklmnopqrstuvwxyz")\nelif len(s) != 26:\n nokori = set(a) - set(s)\n nokori = sorted(nokori, key=a.index)\n print(s + nokori[0])\nelse:\n for i in range(2, 27):\n if s[-i] <= s[-i + 1]:\n break\n if i == 26:\n print(-1)\n else:\n s_ = s... | ['Runtime Error', 'Accepted'] | ['s788639160', 's962933763'] | [2940.0, 3064.0] | [17.0, 17.0] | [417, 283] |
p03393 | u785205215 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import math\nimport itertools\nfrom heapq import heapify, heappop, heappush\nfrom sys import stdin, stdout, setrecursionlimit\nfrom bisect import bisect, bisect_left, bisect_right\nfrom collections import defaultdict, deque\n\n\n\n\n# inf = float("inf")\n\n\n\ndef LM(t, r): return list(map(t, r))\ndef R(): return std... | ['Wrong Answer', 'Accepted'] | ['s364428521', 's656159665'] | [3316.0, 3572.0] | [22.0, 59.0] | [1349, 1369] |
p03393 | u813098295 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import string\n\nalp = string.ascii_lowercase\n\ndef main():\n s = input()\n if s == alp[::-1]:\n print(-1)\n return\n for i, ss in enumerate( s[::-1] ):\n if s[-(i)] > ss:\n print ( s[:(-i-1)] + s[-1] )\n break\n\nmain()\n\n', "import string\n\nalp = string.ascii_l... | ['Wrong Answer', 'Accepted'] | ['s594493134', 's892774320'] | [3768.0, 3832.0] | [24.0, 24.0] | [261, 563] |
p03393 | u814986259 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['abc="abcdefghijklmnopqrstuvwxyz"\nimport collections\ntable=collections.defaultdict(int)\nfor i in range(26):\n table[abc[i]]=i\ntable2=collections.defaultdict(int)\ns=input()\nfor i in reversed(range(len(s)+1)):\n k=0\n if i < len(s):\n k=table[s[i]]\n for j in range(k+1,26):\n if abc[j] in s[:i]:\n c... | ['Wrong Answer', 'Accepted'] | ['s312464358', 's006878479'] | [3316.0, 3956.0] | [21.0, 51.0] | [389, 372] |
p03393 | u856232850 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["s = input()\n\nans = s\nansa = s\na = 'abcdefghijklmnopqrstuvwxyz'\na = [a[i] for i in range(26)]\nif len(s)<26:\n for i in a:\n if ans.count(i) == 0:\n ans += i\n break\nelse:\n b = 26\n for i in range(1,26):\n if a.index(s[i]) > a.index(s[i-1]):\n b = i\n i... | ['Wrong Answer', 'Accepted'] | ['s205154310', 's560782415'] | [3064.0, 3064.0] | [17.0, 17.0] | [508, 523] |
p03393 | u860002137 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['import sys\nfrom collections import deque\nfrom collections import Counter\ns = deque(map(str, input().rstrip()))\n\nif "".join(s) == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n sys.exit()\n\ns = [ord(x) for x in s]\n\nif len(s) == 26:\n maxlen = True\n s = s[::-1]\n x = s[0]\n for i, w in enumerate... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s145865621', 's374233049', 's931208898', 's849215848'] | [3316.0, 3316.0, 3192.0, 3316.0] | [21.0, 21.0, 17.0, 21.0] | [538, 536, 511, 1179] |
p03393 | u861141787 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\n\nif len(s) > 26:\n a = [0 for _ in range(26)]\n\n for i in range(len(s)):\n a[ord(s[i]) - ord("a")] += 1\n\n ans = s\n for i in range(26):\n if a[i] == 0:\n ans += chr(i+ord("a"))\n break\n\n print(ans)\n exit()\n\n\nfor i in range(24,-1,-1):\n fo... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s358628447', 's953824544', 's216481181'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0] | [403, 393, 403] |
p03393 | u867069435 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['j = input()\nlis = sorted(list("qwertyuiopasdfghjklzxcvbnm"))\nabs = ""\nfor h in j:\n lis.remove(h)\nif not lis:\n ans = "-1"\nelse:\n ans = "{}{}".format(j, lis[0])\ntmp = "zz"\nfor i in range(len(j)-1, -1, -1):\n if j[i] != "z":\n\n if tmp > j[:i]+chr(ord(j[i])+1) > j and len(j[:i]+chr(ord(j[i])... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s056205350', 's453307178', 's581053926', 's937638658'] | [3188.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 18.0] | [490, 454, 454, 527] |
p03393 | u871841829 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['S = input()\n\n# 1 <= |S| <= 26\n# lowercase\n\nimport sys\nimport copy\n\ndef next_permutation(a):\n for i in reversed(range(len(a) - 1)):\n if a[i] < a[i + 1]:\n break\n else:\n return False\n\n j = next(j for j in reversed(range(i + 1, len(a))) if a[i] < a[j])\n a[i], a[j] = a[... | ['Wrong Answer', 'Accepted'] | ['s823143151', 's652474454'] | [9252.0, 9216.0] | [31.0, 32.0] | [611, 771] |
p03393 | u905582793 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s=input()\nn=len(s)\nls=[0]*26\n\nfor i in range(n):\n ls[ord(s[i])-97]=i+1\nif n<26:\n for i in range(26):\n if ls[i]==0:\n x=i\n break\n print(s+chr(x+97))\nelse:\n for i in range(24,-1,-1):\n if ls[i+1]>ls[i]:\n ', 'from bisect import bisect\ns=input()\nn=len(s)\nls=[0]*26\nif s == "zyxwvu... | ['Runtime Error', 'Accepted'] | ['s169310954', 's049333970'] | [2940.0, 3064.0] | [17.0, 18.0] | [225, 556] |
p03393 | u919633157 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['# 2019/08/12\n\ns=input()\nif s==\'zyxwvutsrqponmlkjihgfedcba\':\n print(-1)\n exit()\n\nst=set(s)\n"""\nif len(s)<26:\n for i in range(97,97+26+1):\n if chr(i) in st:continue\n print(s+chr(i))\n exit()\n"""\ns=list(s)\nres=[s.pop()]\n\ndef solve(s):\n for _ in range(len(s)):\n ... | ['Runtime Error', 'Accepted'] | ['s055604704', 's221247647'] | [3064.0, 3064.0] | [20.0, 18.0] | [548, 542] |
p03393 | u941753895 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n\n \n l=['a','... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s274186930', 's332418366', 's691410473', 's957384252', 's813979917'] | [5792.0, 6736.0, 6220.0, 5588.0, 6480.0] | [47.0, 61.0, 55.0, 50.0, 59.0] | [723, 683, 690, 685, 967] |
p03393 | u945418216 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["ss = input()\nss =list(map(ord, ss))\nprint(ss)\ndic = [i for i in range(97,123)]\nfor s in ss:\n dic.remove(s)\nif len(ss)<26:\n ss.append(min(dic))\nelse:\n last = ss[-1]\n for s in ss[::-1]:\n if s < last:\n ss = ss[:ss.index(s)] + [last]\n break\n else:\n ss = -1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s939463796', 's985411008', 's252569916'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0] | [374, 406, 473] |
p03393 | u948524308 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s=input()\nN=len(s)\nalpha="abcdefghijklmnopqrstuvwxyz"\na=[0]*26\nfor i in range(N):\n for j in range(26):\n if s[i]==alpha[j]:\n a[j]+=1\n break\n\nif s=="zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n exit()\nc=0\nlastidx=-1\nwhile True:\n\n\n for j in range(lastidx+1,26):\n ... | ['Wrong Answer', 'Accepted'] | ['s163545670', 's126831483'] | [3064.0, 3064.0] | [17.0, 17.0] | [431, 432] |
p03393 | u962330718 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ["S=list(input())\nm=list('abcdefghijklmnopqrstuvwxyz')[::-1]\n\nif len(S)<26:\n for i in m[::-1]\n if i not in S:\n S.append(i)\n break\n print(''.join(S))\nelse:\n x=S[-1]\n for i in range(24,-1,-1):\n if x>S[i]:\n y=m.index(S[i])\n S=S[:i]\n ... | ['Runtime Error', 'Accepted'] | ['s075673094', 's446425020'] | [8912.0, 9132.0] | [21.0, 29.0] | [568, 569] |
p03393 | u977661421 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['# -*- coding: utf-8 -*-\nimport copy\ns = list(input())\n\nif \'\'.join(s) == "zyxwvutsrqponmlkjihgfedcba":\n print(-1)\n exit()\n\nif len(s) == 26:\n for i in range(26):\n if s[i] == \'z\':\n tmp = i\n break\n ans = s[:tmp]\n ans.append(min(s[tmp:]))\n print(\'\'.join(a... | ['Wrong Answer', 'Accepted'] | ['s195664724', 's475688773'] | [3700.0, 3444.0] | [29.0, 22.0] | [802, 552] |
p03393 | u994988729 | 2,000 | 262,144 | Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible **diverse** words in lexicographical order. A word is called **diverse** if and only if it is a nonempty string of English l... | ['s = input()\n\nif len(c) < 26:\n for i in "abcdefghijklmnopqrstuvwxyz":\n if not i in s:\n ans = s + i\n break\n\nelse:\n tmp = ""\n ss = list(s)\n for i in range(len(ss)):\n if i == 0:\n tmp += ss.pop()\n continue\n\n if ss[-1] > tmp[-1]:\n... | ['Runtime Error', 'Accepted'] | ['s761647958', 's397500371'] | [3060.0, 3064.0] | [17.0, 17.0] | [462, 667] |
p03395 | u729133443 | 2,000 | 262,144 | Aoki is playing with a sequence of numbers a_{1}, a_{2}, ..., a_{N}. Every second, he performs the following operation : * Choose a positive integer k. For each element of the sequence v, Aoki may choose to replace v with its remainder when divided by k, or do nothing with v. The cost of this operation is 2^{k} (reg... | ['n,*a=map(int,open(0).read().split())\na,b=a[:n],a[n:]\nfor a,b in zip(a,b):\n if a==b:continue\n if b>a:\n print(-1)\n exit()\n if a-b<b:\n print(-1)\n exit()\n1/0', "from scipy.sparse.csgraph import floyd_warshall\nn,*a=map(int,open(0).read().split())\na,b=a[:n],a[n:]\nd=[]\nM=ma... | ['Runtime Error', 'Accepted'] | ['s457386562', 's708013373'] | [2940.0, 13852.0] | [18.0, 230.0] | [190, 520] |
p03403 | u077291787 | 2,000 | 262,144 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | ['# ARC093C - Traveling Plan\ndef main():\n N = int(input())\n A = list(map(int, input().rstrip().split()))\n for i in range(N):\n ans = 0\n cur = 0\n for j in range(N):\n if i == j:\n continue\n ans += max(cur, A[j]) - min(cur, A[j])\n cur =... | ['Wrong Answer', 'Accepted'] | ['s717743924', 's649675647'] | [14044.0, 14048.0] | [2104.0, 193.0] | [378, 397] |
p03403 | u094191970 | 2,000 | 262,144 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | ['n=int(input())\na=[0]+list(map(int,input().split()))+[0]\n\nsum=0\nfor i in range(n+1):\n sum+=abs(a[i+1]-a[i])\n\nfor i in range(1,n+1):\n sa=0\n if a[i+1]<a[i-1]<a[i]:\n sa=(a[i-1]-a[i+1])-(a[i]-a[i-1])-(a[i]-a[i+1])\n elif a[i]<a[i-1]<a[i+1]:\n sa=(a[i+1]-a[i-1])-(a[i-1]-a[i])-(a[i+1]-a[i])\n print(sum+... | ['Wrong Answer', 'Accepted'] | ['s898171437', 's766037237'] | [14048.0, 14048.0] | [216.0, 236.0] | [308, 250] |
p03403 | u131464432 | 2,000 | 262,144 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | ['N = int(input())\nA = list(map(int,input().split()))\nnow = 0\ndis = 0\nfor i in A:\n dis += abs(now-i)\n now = i\nans = dis+abs(now)\nB = [0]\nB.extend(A)\nB.append(0)\nprint(B)\nfor i in range(1,N+1):\n if B[i-1] < B[i] > B[i+1] or B[i-1] > B[i] < B[i+1]:\n print(ans - 2*min(abs(B[i-1]-B[i]),abs(B[i... | ['Wrong Answer', 'Accepted'] | ['s812894949', 's489079862'] | [20424.0, 20444.0] | [172.0, 163.0] | [344, 335] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.