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
|
---|---|---|---|---|---|---|---|---|---|---|
p03627 | u327466606 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\ns = set()\nq = [0,0]\nimport heaps as hq\nfor a in map(int, input().split()):\n if a > q[0]:\n if a in s:\n del s[a]\n hq.heapreplace(q, a)\n else:\n s.add(a)\n\nprint(q[0]*q[1])', 'n = int(input())\ns = set()\nq = [0,0]\nimport heapq as hq\nfor a in map(int, input().split()):\n if a > q[0]:\n try:\n s.remove(a)\n hq.heapreplace(q, a)\n except:\n s.add(a)\n\nprint(q[0]*q[1])\n'] | ['Runtime Error', 'Accepted'] | ['s738447966', 's316534658'] | [3060.0, 20140.0] | [18.0, 101.0] | [206, 206] |
p03627 | u346308892 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['def spaceinput():\n return list(map(int,input().split(" ")))\n\n\nN=int(input())\na=spaceinput()\n\n\nsa=sorted(a,reverse=True)\nx=[]\ni=0\nwhile True:\n ssa=sa[i]\n if sa[i]==sa[i+1]:\n x.append(ssa)\n i+=2\n if len(x)==2:\n break\n\n i+=1\n if i>=len(sa):\n break\n\nx.extend([0,0])\n\nprint(x[0]*x[1])\n', 'def spaceinput():\n return list(map(int,input().split(" ")))\n\n\nN=int(input())\na=spaceinput()\n\n\nsa=sorted(a,reverse=True)\nx=[]\ni=0\nwhile True:\n if i>=len(sa)-1:\n break\n ssa=sa[i]\n if sa[i]==sa[i+1]:\n x.append(ssa)\n i+=2\n if len(x)==2:\n break\n continueß\n\n i+=1\n\n\nx.extend([0,0])\n\nprint(x[0]*x[1])', 'def spaceinput():\n return list(map(int,input().split(" ")))\n\n\nN=int(input())\na=spaceinput()\n\n\nsa=sorted(a,reverse=True)\nx=[]\ni=0\nwhile True:\n ssa=sa[i]\n if sa[i]==sa[i+1]:\n x.append(ssa)\n i+=2\n if len(x)==2:\n break\n\n i+=1\n\nx.extend([0,0])\n\nprint(x[0]*x[1])\n', 'N=int(input())\na=spaceinput()\n\n\nsa=sorted(a,reverse=True)\nx=[]\nfor i in range(len(sa)-1):\n ssa=sa[i]\n if ssa in x:\n continue\n if sa[i]==sa[i+1]:\n x.append(ssa)\n if len(x)==2:\n break\n\nx.extend([0,0])\nprint(x[0]*x[1])', 'def spaceinput():\n return list(map(int,input().split(" ")))\n\n\nN=int(input())\na=spaceinput()\n\n\nsa=sorted(a,reverse=True)\nx=[]\ni=0\nwhile True:\n if i>=len(sa)-1:\n break\n ssa=sa[i]\n if sa[i]==sa[i+1]:\n x.append(ssa)\n i+=2\n if len(x)==2:\n break\n continue\n\n else:\n i+=1\n\n\nx.extend([0,0])\n\nprint(x[0]*x[1])'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s012867251', 's122435087', 's478131883', 's514570933', 's679536714'] | [14224.0, 14480.0, 14244.0, 3060.0, 14252.0] | [107.0, 107.0, 102.0, 17.0, 114.0] | [334, 355, 301, 256, 367] |
p03627 | u346812984 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\nc = Counter(A)\nhen = [(key, val) for key, val in c.items() if val > 1]\n\nl = max(hen) if hen else 0\nif l != 0:\n if c[l] > 3:\n s = l\n else:\n hen.remove(l)\n s = max(hen) if hen else 0\nelse:\n s = 0\n\nprint(l * s)\n', 'from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\nc = Counter(A)\nhen = [key for key, val in c.items() if val > 1]\n\nl = max(hen) if hen else 0\nif l != 0:\n if c[l] > 3:\n s = l\n else:\n hen.remove(l)\n s = max(hen) if hen else 0\nelse:\n s = 0\n\nprint(l * s)\n'] | ['Runtime Error', 'Accepted'] | ['s390981951', 's023462159'] | [18600.0, 18600.0] | [73.0, 65.0] | [325, 318] |
p03627 | u348293370 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\nnum_list = list(map(int, input().split()))\n\nset_list = list(set(num_list))\n\nfor i in range(len(set_list)):\n num_list.remove(set_list[i])\n\nnum_list.sort()\n\nprint(num_list)\n\nif len(num_list) >= 3:\n if num_list[-1] == num_list[-3]:\n print(num_list[-1]**2)\n elif num_list[-1] == num_list[-2]:\n print(num_list[-1]*num_list[-3])\n else:\n print(num_list[-1]*num_list[-2])\nelif len(num_list) == 2:\n if num_list[-1] == num_list[-2]:\n print(0)\n else:\n print(num_list[-1]*num_list[-2])\nelse:\n print(0)', 'import collections\nn = int(input())\naa = list(map(int, input().split()))\nca = collections.Counter(aa)\nla = sorted([a for a in ca.items()], key = lambda x:x[0], reverse=True)\n\nlist1 = []\nlist2 = []\n\nfor a in la:\n if a[1] > 1:\n list1.append(a)\n if a[1] >3:\n list2.append(a)\n \nif len(list1) > 1: \n xr = list1[0][0] * list1[1][0]\nelse:\n xr = 0\n \nif len(list2) > 0:\n xs = list2[0][0] * list2[0][0]\nelse:\n xs = 0\n \nans = max(xr, xs)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s079838195', 's553351041'] | [20432.0, 27784.0] | [2206.0, 118.0] | [562, 463] |
p03627 | u352067440 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\ns1 = input()\ns2 = input()\nsum = 1\nmul = 1\nflag = 0\ni = 0\n\nwhile True:\n if i >= N:\n print(sum%1000000007)\n break\n\n elif s1[i]==s2[i] and flag==0:\n sum = 3\n i += 1\n flag = 1\n elif s1[i]!=s2[i] and flag==0:\n sum = 6\n i += 2\n flag = 2\n elif s1[i]==s2[i] and flag==1:\n mul = 2\n i += 1\n flag = 1\n elif s1[i]!=s2[i] and flag==1:\n mul = 2\n i += 2\n flag = 2\n elif s1[i]==s2[i] and flag==2:\n mul = 1\n i += 1\n flag = 1\n elif s1[i]!=s2[i] and flag==2:\n mul = 3\n i += 2\n flag = 2\n sum = sum*mul\n', 'N = int(input())\nbars = list(map(int,input().split()))\n\nbars.sort(reverse=True)\n\nflag = 0\nl = 0\nl1 = 0\nl2 = 0\n\nfor x in bars:\n if flag==0:\n l = x\n flag = 1\n elif flag==1 and x==l and l1==0:\n l1 = x\n l = 0\n flag = 0\n elif flag==1 and x==l and l1!=0:\n l2 = x\n break\n else:\n l = x\n flag = 1\n\nprint(l1 * l2)\n'] | ['Runtime Error', 'Accepted'] | ['s765804896', 's257979325'] | [5744.0, 14252.0] | [25.0, 94.0] | [663, 379] |
p03627 | u354916249 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\nA = list(map(int, input().split()))\n\nA.sort(reverse=True)\ncount = 0\nW = 0\nH = 0\nans = 0\n\nfor i in range(N-1):\n if A[i+1] == A[i]:\n count += 1\n if W == 0:\n if count == 2:\n W = A[i]\n count = 0\n if H == 0:\n if count == 2:\n H = A[i]\n\nprint(H * W)', 'N = int(input())\nA = list(map(int, input().split()))\n\nC = [0] * 10 ** 9\ncount = 0\nH = 0\nW = 0\n\nfor i in range(N):\n C[A[i]] += 1\n\nfor i in range(N)[::-1]:\n if (C[i] >= 2) and (count == 0):\n H = i\n count += 1\n elif (C[i] >= 2) and (count == 1):\n W = i\n break\n\nprint(H * W)', 'N = int(input())\nA = list(map(int, input().split()))\n\nA.sort()\n\nwh = [0,0]\n\ntmp = 0\nfor i in A:\n if i == tmp:\n wh.append(i)\n tmp = 0\n else:\n tmp = i\n\nprint(wh[-1] * wh[-2])\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s324441466', 's674696533', 's154334000'] | [14244.0, 14244.0, 14252.0] | [107.0, 43.0, 89.0] | [350, 307, 200] |
p03627 | u371132735 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\nimport collections\nA = list(map(int,input().split()))\nC = collections.Counter(A)\nuse = []\nfor i,val in C.items():\n if val > 4:\n use.append(i)\n if val > 2:\n use.append(i)\n\nuse = sorted(use,reverse= True)\nif len(use)==0:\n print(0)\nelse:\n print(use[0]*use[1])', 'N = int(input())\nimport collections\nA = list(map(int,input().split()))\nC = collections.Counter(A)\nuse = []\nfor i,val in C.items():\n if val > 4:\n use.append(i)\n if val > 2:\n use.append(i)\n \nuse = sorted(use,reverse= True)\nif len(use)<2:\n print(0)\nelse:\n print(use[0]*use[1])', 'N = int(input())\nimport collections\nA = list(map(int,input().split()))\nC = collections.Counter(A)\nuse = []\nfor i,val in C.items():\n if val >= 4:\n use.append(i)\n if val >= 2:\n use.append(i)\n\nuse = sorted(use,reverse= True)\nif len(use)<2:\n print(0)\nelse:\n print(use[0]*use[1])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s222009770', 's700043983', 's534250296'] | [18600.0, 18600.0, 18600.0] | [73.0, 76.0, 78.0] | [283, 283, 284] |
p03627 | u383450070 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nn=int(input())\nA=list(map(int,input().split()))\na=collections.Counter(A)\nfirstnum=0\nsecondnum=0\nfirstl=0\nsecondl=0\nfor i,j in a.items():\n if i>=firstl and j%2>=0:\n secondnum=firstnum\n firstnum=j\n secondl=firstl\n firstl=i\n elif secondl<=i<firstl and j%2>=0:\n secondnum=j\n secondl=i\nprint(firstl*secondl)\n \n', 'import collections\nn=int(input())\nA=list(map(int,input().split()))\na=collections.Counter(A)\nfirstnum=0\nsecondnum=0\nfirstl=0\nsecondl=0\nvalues,counts=zip(*a.most_common())\nfor i,j in a.items():\n if i>=firstl and j>=2:\n secondnum=firstnum\n firstnum=j\n secondl=firstl\n firstl=i\n elif secondl<=i<firstl and j>=2:\n secondnum=j\n secondl=i\nif firstnum>=4:\n print(firstl**2)\nelse:\n print(firstl*secondl)'] | ['Wrong Answer', 'Accepted'] | ['s952215959', 's629172872'] | [18600.0, 28556.0] | [77.0, 141.0] | [345, 416] |
p03627 | u386089355 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\n\nn = int(input())\nls = list(map(int, input().split()))\n\nc = collections.Counter(ls)\n\nls_s = c.most_common()\nls_s.sort(reverse=True)\n\nmul = []\n\nfor i in range(len(ls_s)):\n if ls_s[i][1] >= 4:\n if len(mul) == 0:\n print(ls_s[i][0] ** 2)\n break\n elif len(mul) == 1:\n print(ls_s[i][0] * mu;[0])\n break\n elif ls_s[i][1] >= 2:\n mul.append(ls_s[i][0])\n \n if len(mul) >= 2:\n print(mul[0] * mul[1])\n break\n elif i == len(ls_s) - 1:\n print(0)', 'import collections\n\nn = int(input())\nls = list(map(int, input().split()))\n\nc = collections.Counter(ls)\n\nls_s = c.most_common()\nls_s.sort(reverse=True)\n\nmul = []\n\nfor i in range(len(ls_s)):\n if ls_s[i][1] >= 4:\n if len(mul) == 0:\n print(ls_s[i][0] ** 2)\n break\n elif len(mul) == 1:\n print(ls_s[i][0] * mul[0])\n break\n elif ls_s[i][1] >= 2:\n mul.append(ls_s[i][0])\n \n if len(mul) >= 2:\n print(mul[0] * mul[1])\n break\n elif i == len(ls_s) - 1:\n print(0)'] | ['Runtime Error', 'Accepted'] | ['s580952275', 's660788928'] | [2940.0, 21668.0] | [17.0, 238.0] | [551, 551] |
p03627 | u392319141 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nN = int(input())\ncnt = Counter(map(int, input().split()))\n\nL = sum([[] for a, c in cnt.items()], [])\nL.sort()\n\nans = 0 if len(L) < 2 else L[-1] * L[-2]\nprint(ans)\n', 'from collections import Counter\nN = int(input())\ncnt = Counter(map(int, input().split()))\n\nL = sum([[1] for a, c in cnt.items()], [])\nL.sort()\n\nans = 0 if len(L) < 2 else L[-1] * L[-2]\nprint(ans)\n', 'from collections import Counter\nN = int(input())\ncnt = Counter(map(int, input().split()))\n\nL = sum([[a] * (c // 2) for a, c in cnt.items()], [])\n\nprint(-1)', 'from collections import Counter\nN = int(input())\nA = Counter(map(int, input().split()))\n\nS = []\nfor a, c in A.items():\n S.extend([a] * (c // 2))\n\nS.sort()\nif len(S) < 2:\n print(0)\nelse:\n print(S[-1] * S[-2])\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s325567379', 's774588618', 's778120354', 's858537667'] | [24104.0, 24104.0, 24104.0, 24104.0] | [90.0, 2105.0, 2104.0, 90.0] | [195, 196, 155, 217] |
p03627 | u419963262 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\n\nB = set(A)\nA = Counter(A)\nprint(A)\nans = 0\nkeep = 0\n\nfor i in B:\n kazu = A[i]\n if kazu >= 4:\n ans = i**2\n keep = i\n elif kazu >= 2:\n ans = keep * i\n keep = i\nprint(ans)\n', 'from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\n\nB = set(A)\nC = sorted(list(B))\nA = Counter(A)\n\n\nans = 0\nkeep = 0\n\nfor i in C:\n kazu = A[i]\n if kazu >= 4:\n ans = i**2\n keep = i\n elif kazu >= 2:\n ans = keep * i\n keep = i\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s643927681', 's512032910'] | [37468.0, 28584.0] | [156.0, 114.0] | [293, 306] |
p03627 | u422272120 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\na = list(map(int,input().split()))\nl = []\nfor v in set(a):\n x = a.count(v)\n if x >= 2:\n l.append(x)\nif len(l) < 2:\n print (0)\n exit()\n\nl.sort()\nprint (l[0]*l[1])', 'from collections import Counter\n\nn = int(input())\na = list(map(int,input().split()))\na_count = sorted(Counter(a).items(),reverse=True)\nf = False\n\nfor k,v in a_count:\n if (4 <= v) and (not f):\n print (k**2)\n exit ()\n elif 2 <= v:\n if f:\n print (x*k)\n exit ()\n else:\n x = k\n f = True\n else:\n pass\n\nprint (0)'] | ['Wrong Answer', 'Accepted'] | ['s565651329', 's985923714'] | [14352.0, 21412.0] | [2104.0, 189.0] | [197, 393] |
p03627 | u426649993 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['if __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n\n sidelist = OrderedDict()\n\n for aa in a:\n if a.count(aa) >= 2:\n if aa not in sidelist:\n sidelist[aa] = 1\n else:\n sidelist[aa] += 1\n\n side_a = 0\n side_b = 0\n\n for s in sidelist:\n if sidelist[s] >= 4 and s > side_a:\n side_a = s\n side_b = s\n elif sidelist[s] >= 2:\n if side_a == 0:\n side_a = s\n elif side_b == 0:\n side_b = s\n elif s > side_a:\n side_b = side_a\n side_a = s\n elif s > side_b:\n side_b = s\n\n print(side_a*side_b)\n', 'def main():\n N = int(input())\n A = list(map(int, input().split()))\n\n A.sort(reverse=True)\n tmp = 0\n bar1 = 0\n bar2 = 0\n\n for a in A:\n if tmp == 0:\n tmp = a\n elif tmp == a:\n if bar1 > 0:\n bar2 = a\n print(bar1*bar2)\n exit()\n else:\n bar1 = a\n tmp = 0\n elif a < tmp:\n tmp = a\n\n print(0)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s881384346', 's217943061'] | [14244.0, 14252.0] | [49.0, 85.0] | [743, 487] |
p03627 | u440161695 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nm1,m2=0,0\nN=int(input())\nA=Counter(list(map(int,input().split())))\nkey=sorted(A.keys(),reverse=True)\nfor i in key:\n if A[i]>1 and m1==0:\n m1=A[i]\n if m1!=0 and A[i]>1:\n print(m1*A[i])\n exit()\nprint(0)', 'from collections import Counter\nm1=0\nN=int(input())\nA=Counter(list(map(int,input().split())))\nkey=sorted(A.keys(),reverse=True)\nfor i in key:\n if A[i]>1 and m1==0:\n m1=i\n if A[i]>3:\n print(i**2)\n exit()\n elif m1!=0 and A[i]>1:\n print(m1*i)\n exit()\nprint(0)'] | ['Wrong Answer', 'Accepted'] | ['s649975083', 's389442379'] | [18600.0, 18600.0] | [123.0, 128.0] | [243, 280] |
p03627 | u464205401 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nn = int(input())\na = list(map(int,input().split()))\nc = sorted(collections.Counter(a).items(),reverse = True)\n\nnum2=[]\nnum4=[]\n\nfor k in c:\n if k[1]>=4:\n num4.append(k[0])\n if k[1]>=2:\n num2.append(k[0])\n\nif len(num2)>=2 or len(num4)>=1:\n print(max(num2[0]*num2[1],num4[0]**2))\nelse:\n print(0) ', 'import collections\nn = int(input())\na = list(map(int,input().split()))\nc = sorted(collections.Counter(a).items(),reverse = True)\n\nnum2 = []\nnum4 = []\nans = [0]\n\nfor k in c:\n if k[1]>=4:\n num4.append(k[0])\n if k[1]>=2:\n num2.append(k[0])\n\nif len(num2)>=2:\n ans.append(num2[0]*num2[1])\nif len(num4)>=1:\n ans.append(num4[0]**2)\n\nprint(max(ans))'] | ['Runtime Error', 'Accepted'] | ['s029323765', 's517549999'] | [25720.0, 25728.0] | [134.0, 134.0] | [323, 351] |
p03627 | u473291366 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\n\nmax_1 = 0\nlen_a = len(A)\nfor i, a in enumerate(A):\n if len_a - i >= 4:\n if A[i] == A[i+1] and A[i+1] == A[i+2] and A[i+2] == A[i+3]:\n if max_1 == 0:\n print(A[i] ** 2)\n exit()\n else:\n print(A[i] * max_1)\n exit()\n if len_a - i >= 2:\n if A[i] == A[i+1]:\n if max_1 == 0:\n max_1 = A[i]\n else:\n if max_1 != A[i]:\n print(A[i] * max_1)\n exit()\nprint(0)', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\n\nmax_1 = 0\nlen_a = len(A)\nfor i, a in enumerate(A):\n if len_a - i >= 4:\n if A[i] == A[i+1] and A[i+1] == A[i+2] and A[i+2] == A[i+3]:\n if max_1 == 0:\n print(A[i] ** 2)\n exit()\n else:\n print(A[i] * max_1)\n exit()\n if len_a - i >= 2:\n if A[i] == A[i+1]:\n if max_1 == 0:\n max_1 = A[i]\n else:\n if max_1 != A[i]:\n print(A[i] * max_1)\n exit()\nprint(0)'] | ['Wrong Answer', 'Accepted'] | ['s050176513', 's889924382'] | [14100.0, 14672.0] | [79.0, 117.0] | [594, 610] |
p03627 | u477977638 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import sys\n\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\ninputs = sys.stdin.buffer.readlines\n\n# rstrip().decode(\'utf-8\')\n# map(int,input().split())\n# import numpy as np\n\nfrom collections import defaultdict\n\ndef main():\n\td=defaultdict(int)\n\t\n\tn=int(input())\n\tA=list(map(int,input().split()))\n\tfor x in A:\n\t\td[x]+=1\n\t\n\tli=[]\n\tli2=[]\n\tfor k,v in d.items():\n\t\tif v>=2:\n\t\t\tli.append(k)\n\t\tif v>=4:\n\t\t\tli2.append(k)\n\n\tli.sort(reverse=True)\n\tli2.sort(reverse=True)\n\t\n\tif len(li)<=1 and len(li2)==0:\n\t\tprint(0)\n\telif len(li)==1:\n\t\tprint(li2[0]**2)\n\telse:\n\t\tprint(max(li[0]*li[1],li2[0]**2))\n\t\n\nif __name__ == "__main__":\n\tmain()\n', 'import sys\n\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\ninputs = sys.stdin.buffer.readlines\n\n# rstrip().decode(\'utf-8\')\n# map(int,input().split())\n# import numpy as np\n\n\ndef main():\n\tn=int(input())\n\tA=list(map(int,input().split()))\n\tA.sort(reverse=True)\n\tans=0\n\tcnt=0\n\tli=[]\n\tfor i in range(n-1):\n\t\tif A[i+1]==A[i]:\n\t\t\tcnt+=1\n\t\t\tif cnt==3:\n\t\t\t\tans=A[i]**2\n\t\t\t\tbreak\n\t\t\tif cnt==1:\n\t\t\t\tli.append(A[i])\n\t\t\t\tif len(li)==2:\n\t\t\t\t\tans=li[0]*li[1]\n\t\t\t\t\tbreak\n\t\telse:\n\t\t\tcnt=0\n\tprint(ans)\n\t\n\t\n\nif __name__ == "__main__":\n\tmain()\n'] | ['Runtime Error', 'Accepted'] | ['s909009525', 's899965850'] | [18352.0, 12992.0] | [91.0, 83.0] | [638, 539] |
p03627 | u479638406 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\ndef solve():\n n = int(input())\n a = list(map(int, input().split()))\n\n l = Counter(a)\n tw = []\n fo = []\n for i,j in l.items():\n if j >= 2:\n tw.append(i)\n if j >= 4:\n fo.append(i)\n\n if len(tw) >= 2 or len(fo) >= 1:\n tw.sort()\n fo.sort()\n return max(tw[-1]*tw[-2], fo[-1]**2)\n else:\n return 0\n \n\nprint(solve())\n', 'from collections import Counter\ndef solve():\n n = int(input())\n a = list(map(int, input().split()))\n\n l = Counter(a)\n tw = []\n fo = []\n for i,j in l.items():\n if j >= 2:\n tw.append(i)\n if j >= 4:\n fo.append(i)\n\n if len(tw) >= 2 or fo:\n tw.sort()\n return max(tw[-1]*tw[-2], fo[-1]**2)\n else:\n return 0\n \n\nprint(solve())\n', 'from collections import Counter\ndef solve():\n n = int(input())\n a = list(map(int, input().split()))\n\n l = Counter(a)\n tw = []\n fo = []\n for i,j in l.items():\n if j >= 2:\n tw.append(i)\n if j >= 4:\n fo.append(i)\n ans = 0\n if len(tw) >= 2:\n tw.sort()\n ans = max(ans, tw[-1]*tw[-2])\n if fo:\n fo.sort()\n ans = max(ans, fo[-1]**2)\n \n return ans\n \n\nprint(solve())\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s334031082', 's611588949', 's233082733'] | [18600.0, 18600.0, 18600.0] | [73.0, 77.0, 75.0] | [431, 403, 457] |
p03627 | u509739538 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import defaultdict\nfrom collections import deque\nimport itertools\nimport math\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n\nd = defaultdict(int)\nn = readInt()\nfor i in readChars():\n\td[i]+=1\n\nd = [i for i in sorted(d.items(), reverse=True) if i[1]>1]\n\nif len(d)==0:\n\tprint(0)\n\texit()\nelif len(d)==1:\n\tif d[0][1]>=4:\n\t\tcontinue\n\telse:\n\t\tprint(0)\n\t\texit()\n\nif d[0][1]>=4:\n\tprint(int(d[0][0])**2)\nelse:\n\tprint(int(d[0][0])*int(d[1][0]))\n', 'from collections import defaultdict\nfrom collections import deque\nimport itertools\nimport math\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n\nd = defaultdict(int)\nn = readInt()\nfor i in readChars():\n\td[i]+=1\n\nd = [i for i in sorted(d.items(), reverse=True) if i[1]>1]\n\ntry:\n\tif d[0][1]>=4:\n\t\tprint(int(d[0][0])**2)\n\telse:\n\t\tprint(int(d[0][0])*int(d[1][0]))\n\texit()\nexcept:\n\tprint(0)\n\nprint(0)', 'from collections import defaultdict\nfrom collections import deque\nfrom collections import Counter\nimport itertools\nimport math\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n\nn = readInt()\n\nd = Counter(readInts())\n\nd = [i for i in sorted(d.items(), reverse=True) if i[1]>=2]\n\nif len(d)==0:\n\tprint(0)\n\texit()\nelif len(d)==1:\n\tif d[0][1]>=4:\n\t\tpass\n\telse:\n\t\tprint(0)\n\t\texit()\nif d[0][1]>=4:\n\tprint(int(d[0][0])**2)\nelse:\n\tprint(int(d[0][0])*int(d[1][0]))\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s008452191', 's450162599', 's865998096'] | [9144.0, 28820.0, 25680.0] | [28.0, 152.0, 122.0] | [571, 512, 572] |
p03627 | u524870111 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby\nfrom math import floor, ceil, sqrt, factorial, log\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop\nfrom itertools import product\nimport sys\nstdin = sys.stdin\nmod = 10**9 + 7\n\n\ndef ns(): return stdin.readline().rstrip()\n\n\ndef ni(): return int(ns())\n\n\ndef na(): return list(map(int, stdin.readline().split()))\n\n\nn = ni()\na = na()\n\na.sort(reverse=True)\nl = list()\nfor key, gr in groupby(a):\n if len(l) == 2:\n print(l[0] * l[1])\n quit()\n num = len(list(gr))\n if num >= 2:\n l.append(key)\n if num >= 4:\n l.append(key)\nprint(0)\n', 'from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby\nfrom math import floor, ceil, sqrt, factorial, log\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop\nfrom itertools import product\nimport sys\nstdin = sys.stdin\nmod = 10**9 + 7\n\n\ndef ns(): return stdin.readline().rstrip()\n\n\ndef ni(): return int(ns())\n\n\ndef na(): return list(map(int, stdin.readline().split()))\n\n\nn = ni()\na = na()\n\na.sort(reverse=True)\nl = list()\nfor key, gr in groupby(a):\n if len(l) == 2:\n print(l[0] * l[1])\n quit()\n num = len(list(gr))\n if num >= 2:\n l.append(key)\n if num >= 4:\n l.apend(key)\nprint(0)\n', 'from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby\nfrom math import floor, ceil, sqrt, factorial, log\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop\nfrom itertools import product\nimport sys\nstdin = sys.stdin\nmod = 10**9 + 7\n\n\ndef ns(): return stdin.readline().rstrip()\n\n\ndef ni(): return int(ns())\n\n\ndef na(): return list(map(int, stdin.readline().split()))\n\n\nn = ni()\na = na()\n\na.sort(reverse=True)\nl = list()\nfor key, gr in groupby(a):\n if len(l) == 2:\n break\n num = len(list(gr))\n if num >= 2:\n l.append(key)\n if num >= 4:\n l.append(key)\nprint(l[0] * l[1] if len(l) >= 2 else 0)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s684154549', 's881866451', 's427253474'] | [14636.0, 14632.0, 14616.0] | [137.0, 140.0, 136.0] | [762, 761, 766] |
p03627 | u536113865 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\na = input()\nb = input()\n\nans = 3\ni = 0\nif a[0] != b[0]:\n i += 1\n ans += 3\n\nwhile i < n-1:\n if a[i]==b[i]:\n if a[i+1]==b[i+1]:\n ans *= 2\n else:\n ans *= 2\n i += 1\n else:\n if a[i+1]==b[i+1]:\n ans *= 1\n else:\n ans *= 3\n i += 1\n i += 1\n ans %= 1000000007\nprint(ans)\n', 'ai = lambda: list(map(int, input().split()))\n\nn = int(input())\na = ai()\nfrom collections import Counter\nc = Counter(a)\na = [i for i in c if c[i]>1]\na.sort()\nif len(a)>0 and c[a[-1]]>1:\n print(a[-1]**2)\nelif len(a)<2:\n print(0)\nelse:\n print(a[-1]*a[-2])', 'ai = lambda: list(map(int, input().split()))\n\nn = int(input())\na = ai()\nfrom collections import Counter\nc = Counter(a)\na = [i for i in c if c[i]>1]\na.sort()\nif len(a)>0 and c[a[-1]]>=4:\n print(a[-1]**2)\nelif len(a)<2:\n print(0)\nelse:\n print(a[-1]*a[-2])'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s265475850', 's542386841', 's469036728'] | [5156.0, 18216.0, 18216.0] | [19.0, 81.0, 81.0] | [390, 261, 262] |
p03627 | u581187895 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n\ninput()\narr = Counter(list(map(int,input().split())))\nans = [0,0]\nfor a in arr:\n print(a)\n if arr[a] > 1:\n ans.append(a)\n if arr[a] > 3:\n ans.append(a)\nans.sort()\nprint(ans[-1] * ans[-2])', 'from collections import Counter\n\ninput()\narr = Counter(list(map(int,input().split())))\nans = [0,0]\nfor a in arr:\n print(a)\n if arr[a] > 1:\n ans.append(a)\n \nans.sort()\nprint(ans[-1] * ans[-2])', 'from collections import Counter\n\ninput()\narr = Counter(input().split())\ncount = 0\nsquer = 1\nfor k, v in sorted(arr.items(), reverse=True): \n if v >= 4 and count==0:\n squer = int(k)**2\n break\n elif v >= 2:\n squer *= (int(k))\n count += 1\n if count == 2:\n break\n \nprint(squer if count < 2 else 0) \n \n', 'from collections import Counter\n\ninput()\narr = Counter(input().split())\ncount = 0\nsquer = 1\nfor k, v in sorted(arr.items(), reverse=True): \n if v >= 4 and count==0:\n squer = int(k)**2\n count += 2\n break\n elif v >= 2:\n squer *= (int(k))\n count += 1\n if count == 2:\n break\n \nprint(squer if count < 2 else 0) \n \n', 'from collections import Counter\n\ninput()\narr = Counter(list(map(int,input().split())))\nans = [0,0]\nfor a in arr: \n if arr[a] > 1:\n ans.append(a)\n if arr[a] > 3:\n ans.append(a)\nans.sort()\nprint(ans[-1] * ans[-2])'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s070861330', 's307559336', 's465788053', 's671065704', 's642045201'] | [18600.0, 18600.0, 24612.0, 24456.0, 18600.0] | [185.0, 159.0, 214.0, 238.0, 94.0] | [229, 197, 327, 342, 220] |
p03627 | u587589241 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n=int(input())\na=list(map(int,input().split()))\nb=sorted(a,reverse=True)\nc=set(b)\nd=sorted([i for i in c],reverse=True)\nflag1=False\nflag2=False\nfor i in d:\n if b.count(i)>=4:\n print(i**2)\n break\n exit()\n elif flag1==False and flag2==False and b.count(i)>=2:\n tmp1=i\n flag1=True\n elif flag1 and flag2==False and b.count(i)>=2:\n tmp2=i\n print(tmp1*tmp2)\n break\n exit()\nif flag2==False:\n print(0)', 'from collections import deque\nn=int(input())\na=list(map(int,input().split()))\nb=sorted(a,reverse=True)\nd=deque(b)\nans=0\ntmp=0\nflag1=False\nflag2=False\nwhile d:\n if d[0]==tmp and flag1==False:\n flag1=True\n d.popleft()\n h1=tmp\n tmp=0\n elif flag1 and d[0]==tmp:\n h2=tmp\n ans=h1*h2\n break\n elif d[0]!=tmp:\n tmp=d.popleft()\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s969021670', 's025828304'] | [14892.0, 14636.0] | [2104.0, 102.0] | [469, 393] |
p03627 | u597455618 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\n\nn = int(input())\na = collections.Counter(list(map(int, input().split())))\n\nf = []\nt = []\nfor i in a:\n if a[i] >= 4:\n f.append(i)\n if a[i] >= 2:\n t.append(i)\nfa, ta = 0, 0\nf.sort()\nt.sort()\nif len(f) >= 1:\n fa = f[-1]**2\nif len(t) >= 2:\n ta = max(t[-1]*t[-2], t[-1]*f[-1])\nelse:\n print(0)', 'import sys\nimport collections\n\nn = int(input())\na = collections.Counter(list(map(int, sys.stdin.readline().split())))\n\nq = [0, 0]\nfor v, k in a.items():\n if k >= 4:\n q.append(v)\n if k >= 2:\n q.append(v)\nq.sort()\nprint(q[-1]*q[-2])'] | ['Runtime Error', 'Accepted'] | ['s758903526', 's374535808'] | [18600.0, 18728.0] | [95.0, 79.0] | [336, 250] |
p03627 | u620846115 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nn = int(input())\nalist = list(map(int,input().split()))\nadic = collections.Counter(alist)\nfor k,v in adic.items():\n if v == 1:\n del(adic[k])\nsort_adic = sorted(adic.items(), reverse = True, key = lambda x:x[1])\nli = list(sort_adic.items())\nprint(li[0][0]*li[1][0])', 'import collections\nn = int(input())\nalist = list(map(int,input().split()))\nadic = collections.Counter(alist)\nfor k,v in adic.items():\n if v == 1:\n del(adic[k])\nsort_adic = sorted(adic.items(), reverse = True, key = lambda x:x[1])\nli = list(sort_adic.items())\nprint(li[0][1]*li[1][1])', 'import collections\nn = int(input())\nalist = list(int,input().split())\nadic = collections.Counter(alist)\nfor k,v in adic.items():\n if v == 1:\n del(dic[k])\nsort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])\nli = list(sort_adic.items())\nprint(li[0][1]*li[1][1])', 'import collections\nn = int(input())\nalist = list(map(int,input().split()))\nadic = collections.Counter(alist)\nfor k,v in adic.items():\n if v == 1:\n del(adic[k])\nsort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])\nli = list(sort_adic.items())\nprint(li[0][1]*li[1][1])', 'import collections\nn = int(input())\nalist = list(map(int,input().split()))\nadic = collections.Counter(alist)\nA = [0,0]\nfor i in adic:\n if adic[i] > 1:\n A.append(i)\n if adic[i] > 3:\n A.append(i)\nsortedA = sorted(A)\nprint(sorted[-1]*sorted[-2])', 'import collections\nn = int(input())\nalist = list(int,input().split())\nadic = collections.Counter(alist)\nfor k,v in adic.items():\n if v == 1:\n del(adic[k])\nsort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])\nli = list(sort_adic.items())\nprint(li[0][1]*li[1][1])', 'import collections\nn = int(input())\nalist = list(map(int,input().split()))\nadic = collections.Counter(alist)\nA = [0,0]\nfor i in adic:\n if adic[i] > 1:\n A.append(i)\n if adic[i] > 3:\n A.append(i)\nsortedA = sorted(A)\nprint(sortedA[-1]*sortedA[-2])'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s040708066', 's125358459', 's313761894', 's478643634', 's535415390', 's888071492', 's589177877'] | [22140.0, 22212.0, 8832.0, 8968.0, 22044.0, 8896.0, 22292.0] | [64.0, 62.0, 19.0, 22.0, 76.0, 24.0, 84.0] | [287, 287, 280, 286, 250, 281, 252] |
p03627 | u622011073 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\ninput();a=sorted(Counter(map(int,input().split())).most_common())[::-1];c=b=0\nfor i in range(len(set(a))):\n if b and c:print(c*b);exit()\n if a[i][1]>3 and a[i][0]*c<a[i][0]**2:b=c=a[i][0]\n elif a[i][1]>1:b,c=c,a[i][0]', 'from collections import Counter\ninput();a=sorted(Counter(map(int,input().split())).most_common())[::-1];c=b=0\nfor i in range(len(set(a))):\n if b and c:break\n if a[i][1]>3 and a[i][0]*c<a[i][0]**2:b=c=a[i][0]\n elif a[i][1]>1:b,c=c,a[i][0]\nprint(c*b)'] | ['Wrong Answer', 'Accepted'] | ['s591749092', 's623058117'] | [24104.0, 24104.0] | [215.0, 218.0] | [258, 257] |
p03627 | u623687794 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collcections import Counter\nn=int(input())\nl=list(map(int,input().split()))\nd=[]\nL=Counter(l)\na=L.most_common()\nfor i in a:\n if a[i][1]>=4:\n d.append(a[i][1])\n d.append(a[i][1])\n elif a[i][1]>=2:\n d.append(a[i][1])\nd.sort(reverse=True)\nprint(d[0]*d[1] if len(d)>=2 else 0)', 'from collections import Counter\nn=int(input())\nl=list(map(int,input().split()))\nd=[]\nL=Counter(l)\na=L.most_common()\nfor i in range(len(a)):\n if a[i][1]>=4:\n d.append(a[i][0])\n d.append(a[i][0])\n elif a[i][1]>=2:\n d.append(a[i][0])\nd.sort(reverse=True)\nprint(d[0]*d[1] if len(d)>=2 else 0)\n'] | ['Runtime Error', 'Accepted'] | ['s076295372', 's262552904'] | [3064.0, 21668.0] | [18.0, 121.0] | [288, 300] |
p03627 | u686036872 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nN = int(input())\nA=sorted(list(map(int, input().split())))\na = collections.Counter(A)\nans = 0\ny = 0\nfor i in a.keys():\n if a[i] >= 2:\n x = y*i\n y = i\n if a[i] >= 4:\n z = i**2\n ans = max(ans, x, z)\nprint(ans)', 'from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\n \nc = Counter(A)\n\n\nans = []\nfor i, j in c.items():\n if j >= 2:\n ans.append[i]\n\nans.sort() \nprint(ans[-1]*ans[-2])', 'import collections\nN = int(input())\nA = sorted(list(map(int, input().split())))\na = collections.Counter(A)\nans = 0\ny = 0\nfor i in a.keys():\n if a[i] >= 2:\n x = y*i\n y = i\n if a[i] >= 4:\n z = i**2\n ans = max(ans, x, z)\nprint(ans)', 'import collections\nN = int(input())\nA=sorted(list(map(int, input().split())))\na = collections.Counter(A)\nans = 0\ny = 0\nfor i in a.keys():\n if a[i] >= 2:\n x = y*i\n y = i\n if a[i] >= 4:\n z = i**2\n ans = max(ans, x, z)\nprint(ans)', 'from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\n \nc = Counter(l)\n\n\nans = []\nfor i, j in c.items():\n if i >= 2:\n ans.append[j]\n\nans.sort() \nprint(ans[-1]*ans[-2])', 'from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\nc = Counter(A)\n\n\nans = [0, 0]\nfor i, j in c.items():\n if j >= 2:\n ans.append(i)\n if j >= 4:\n ans.append(i)\n\nans.sort() \n\nprint(ans[-1]*ans[-2])'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s000952523', 's261316715', 's588206489', 's752238327', 's960892843', 's497974456'] | [18728.0, 18600.0, 18728.0, 18728.0, 14636.0, 18592.0] | [98.0, 62.0, 97.0, 97.0, 45.0, 88.0] | [256, 216, 258, 256, 216, 253] |
p03627 | u686254986 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\ncount = 0\nfor j in range(len(a)-1):\n if(count => 2):\n print(l[0] * l[1])\n exit()\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n count += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\ncount = 0\nfor j in range(len(a)-1):\n if(count => 2):\n print(l[0] * l[1])\n break\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n count += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\ncount = 0\nfor j in range(len(a)-1):\n if(count => 2):\n print(l[0] * l[1])\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n count += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nc = 0\nfor j in range(len(a)-1):\n if(count => 2):\n print(l[0] * l[1])\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n count += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = list()\nfor i in range(2):\n for j in range(len(a)-1):\n if(a[j] == a[j+1]):\n l.append(a[j])\n break\n if(i == 1):\n l.append(0)\n l.append(0)\nprint(l[0] * l[1])', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nfor j in range(len(a)-1):\n if(a[j] == a[j+1]):\n if(l[1] < a[j]):\n del l[0]\n l.append(a[j])\n j += 1\n\nprint(l[0] * l[1])', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nc = 0\nfor j in range(len(a)-1):\n if(c >= 2):\n print(l[0] * l[1])\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n c += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nc = 0\nfor j in range(len(a)-1):\n if(c => 2):\n print(l[0] * l[1])\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n c += 1', 'n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nc = 0\nfor j in range(len(a)-1):\n if(count => 2):\n print(l[0] * l[1])\n if(a[j] == a[j+1]):\n del l[0]\n l.append(a[j])\n j += 1\n c += 1', '_ = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nl = [0,0]\nc = 0\ni = 0\nwhile(i < len(a)-1):\n if(a[i] == a[i+1]):\n del l[0]\n l.append(a[i])\n i += 1\n c += 1\n if(c >= 2 or i == len(a)-2):\n i = len(a)-1\n print(l[0] * l[1])\n i += 1'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s023227086', 's032912317', 's054571230', 's303184850', 's315414468', 's383834435', 's528481531', 's618945873', 's835861431', 's190342713'] | [3060.0, 2940.0, 2940.0, 2940.0, 15020.0, 14252.0, 14224.0, 2940.0, 2940.0, 14252.0] | [17.0, 17.0, 17.0, 17.0, 100.0, 100.0, 217.0, 17.0, 17.0, 117.0] | [280, 279, 265, 261, 282, 246, 253, 253, 257, 303] |
p03627 | u696449926 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\na = list(map(int, input().split()))\n\na = sorted(a)\ni = len(a) - 1\nb = []\n\nwhile (i >= 1):\n\tif (a[i] == a[i - 1]):\n\t\tb.append(a[i - 1])\n\t\ti -= 2\n\n\ti -= 1\n\n\tif(len(b) == 2):\n\t\tbreak\n\n\nif(len(b) == 2):\n\tprint(b[0]*b[1])\n\nelse:\n\tprint(0)', 'N = int(input())\na = list(map(int, input().split()))\n\na = sorted(a)\ni = len(a) - 1\nb = []\n\nwhile (i - 1 >= 0):\n\tif (a[i] == a[i - 1]):\n\t\tb.append(a[i - 1])\n\t\ti -= 2\n\n\telse:\n\t\ti -= 1\n\n\tif(len(b) == 2):\n\t\tbreak\n\n\nif(len(b) == 2):\n\tprint(b[0]*b[1])\n\nelse:\n\tprint(0)'] | ['Wrong Answer', 'Accepted'] | ['s459266878', 's341814659'] | [14252.0, 14224.0] | [100.0, 108.0] | [250, 262] |
p03627 | u698176039 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\n\nN = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse = True)\nc = collections.Counter(A)\n\ntmp = []\nfor i in c:\n print(i,c[i])\n if c[i] >= 4:\n tmp += [i]\n break\n elif c[i] >= 2:\n tmp += [i]\n if len(tmp) == 2:\n break\n \nif len(tmp) == 2:\n print(tmp[0]*tmp[1])\nelif len(tmp) == 1:\n print(tmp[0]*tmp[0])\nelse:\n print(0)\n ', 'import collections\n\nN = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse = True)\nc = collections.Counter(A)\nb = sorted(c,reverse = True)\ntmp = []\nfor i in b:\n if c[i] >= 4:\n tmp += [i]\n break\n elif c[i] >= 2:\n tmp += [i]\n if len(tmp) == 2:\n break\n \nif len(tmp) == 2:\n print(tmp[0]*tmp[1])\nelif len(tmp) == 1:\n print(tmp[0]*tmp[0])\nelse:\n print(0)\n \n\n'] | ['Wrong Answer', 'Accepted'] | ['s736943079', 's482563710'] | [18600.0, 18600.0] | [135.0, 179.0] | [409, 421] |
p03627 | u724742135 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nfrom sys import stdin\nN = int(stdin.readline().rstrip())\nA = Counter([int(_) for _ in stdin.readline().rstrip().split()]).most_common()\nA.sort(reverse=True)\nif A[0][1] < 2 or A[1][1] < 2:\n print(0)\nelse:\n print(A[0][0]*A[1][0])', 'import sys\nfrom collections import Counter\nfrom sys import stdin\nN = int(stdin.readline().rstrip())\nA = Counter([int(_) for _ in stdin.readline().rstrip().split()]).most_common()\nB = [t for t in A if t[1] >= 2]\nB.sort(reverse=True)\nif len(B) < 2:\n print(0)\n sys.exit()\nif B[0][1] >= 4:\n print(B[0][0]**2)\nelse:\n print(B[0][0]*B[1][0])'] | ['Wrong Answer', 'Accepted'] | ['s269862901', 's382102996'] | [21388.0, 21412.0] | [178.0, 103.0] | [265, 346] |
p03627 | u750651325 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['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(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 6)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float("inf")\nal = "abcdefghijklmnopqrstuvwxyz"\nAL = al.upper()\n\nn = k()\na = l()\nans = []\n\na.sort(reverse=True)\nb = -1\n\nfor i in a:\n if i==b:\n if ans != 0:\n ans *= i\n break\n else:\n ans = i\n b = -1\n continue\n b = i\nprint(ans)\n\n\n', '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(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 6)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float("inf")\nal = "abcdefghijklmnopqrstuvwxyz"\nAL = al.upper()\n\nn = k()\na = l()\n\na.sort(reverse=True)\nb = -1\n\nfor i in a:\n if i==b:\n if ans != 0:\n ans *= i\n break\n else:\n ans = i\n b = -1\n continue\n b = i\nprint(ans)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s446590592', 's578408291'] | [22080.0, 22052.0] | [75.0, 82.0] | [818, 809] |
p03627 | u761989513 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n = int(input())\na = list(map(int, input().split()))\nac = sorted(list(set(a)))\nans = []\nfor i in ac[::-1]:\n c = a.count(i)\n if len(ans) == 2:\n print(ans[0] * ans[1])\n exit()\n if not ans and c >= 4:\n print(i ** 2)\n exit()\n if c >= 2:\n ans.append(i)\nprint(0)', 'import collections\n\nn = int(input())\na = list(map(int, input().split()))\nac = collections.Counter(a)\nquad = [i for i in ac if ac[i] >= 4]\nif quad:\n ans = max(quad) ** 2\nelse:\n ans = 0\ntwice = sorted([i for i in ac if ac[i] >= 2])\nif len(twice) >= 2:\n ans = max(ans, twice[-1] * twice[-2])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s367006828', 's384140052'] | [14252.0, 18600.0] | [2104.0, 94.0] | [303, 308] |
p03627 | u762420987 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nN = int(input())\nAc = Counter(list(map(int, input().split())))\nover2 = [ele for ele in Ac.items() if ele[1]>=2]\nif len(over2) == 0:\n print(0)\nelif len(over2) == 1:\n if over2[0][1] >= 4:\n print(over2[0][0]**2)\nelse:\n over2.sort()[::-1]\n if over2[0][1] >= 4:\n print(over2[0][0]**2)\n else:\n print(over2[0][0]*over2[1][0])', 'from collections import Counter\nN = int(input())\nAc = Counter(list(map(int, input().split())))\n\nans = []\nfor k in sorted(Ac.keys())[::-1]:\n if len(ans) == 2:\n break\n if Ac[k] >=4:\n if ans:\n ans.append(k)\n else:\n ans.append(k)\n ans.append(k)\n elif Ac[k] >= 2:\n ans.append(k)\nif len(ans) == 2:\n print(ans[0]*ans[1])\nelse:\n print(0)'] | ['Runtime Error', 'Accepted'] | ['s489962500', 's682542516'] | [18600.0, 18600.0] | [94.0, 139.0] | [364, 361] |
p03627 | u769870836 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n=int(input())\nl=list(map(int,input().split()))\nimport collections\nc = collections.Counter(l)\nans1=[]\nans2=[]\nfor x in c.keys():\n if c[x]>1:\n ans1.append(x)\n if c[x]>3:\n ans2.append(x)\nans1.sort()\nif len(ans1)<2:\n print(0)\nelse:\n print(max(ans1[-1]*ans1[-2],max(ans2)**2))', 'n=int(input())\nl=list(map(int,input().split()))\nimport collections\nc = collections.Counter(l)\nans1=[]\nans2=[0]\nfor x in c.keys():\n if c[x]>1:\n ans1.append(x)\n if c[x]>3:\n ans2.append(x)\nans1.sort()\nif len(ans1)<2:\n print(0)\nelse:\n print(max(ans1[-1]*ans1[-2],max(ans2)**2))'] | ['Runtime Error', 'Accepted'] | ['s248940666', 's077741227'] | [18320.0, 18216.0] | [100.0, 99.0] | [282, 283] |
p03627 | u780475861 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n_, *lst = map(int, input().split())\nstick = [i for i, j in Counter(lst).items() if j > 1]\nif len(stick) > 1:\n stick.sort()\n print(stick[-1] * stick[-2])\nelse:\n print(0)\n ', 'from collections import Counter\n_, *lst = map(int, open(0).read().split())\nc = Counter(lst).items()\nstick2 = [i for i, j in c if j > 1]\nstick4 = [0] + [i for i, j in c if j > 3]\nmax4 = max(stick4)\nmax4 *= max4\nif len(stick2) > 1:\n stick2.sort()\n print(max(stick2[-1] * stick2[-2], max4))\nelse:\n print(max(0, max4))\n'] | ['Wrong Answer', 'Accepted'] | ['s097933518', 's804026541'] | [3316.0, 18528.0] | [21.0, 76.0] | [206, 318] |
p03627 | u780962115 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nn=int(input())\nlists=list(map(int,input().split()))\nA=dict(collections.Counter(lists))\ndictdict=[]\nfor j in A.keys():\n for _ in range(A[j]//2):\n dictdict.append(j)\nA=sorted(A,reverse=True)\nprint(A[0]*A[1])\n', '\nimport collections\nn=int(input())\nlists=list(map(int,input().split()))\nA=dict(collections.Counter(lists))\ndictdict=[]\n\n\nfor j in A.keys():\n for _ in range(A[j]//2):\n dictdict.append(j)\n\ndictdict=sorted(dictdict,reverse=True)\nif len(dictdict)>=2:\n print(dictdict[0]*dictdict[1])\nelse:\n print(0)'] | ['Wrong Answer', 'Accepted'] | ['s624774563', 's609507598'] | [21668.0, 21668.0] | [139.0, 94.0] | [235, 339] |
p03627 | u784022244 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nN=int(input())\nA=list(map(int ,input().split()))\nD=Counter(A)\n#print(D.items())\nL=[]\nfor num, v in D.items():\n if v>=4:\n L.append((num,4))\n elif v>=2:\n L.append((num, 2))\n\nL=sorted(L, reverse=True)\nif len(L)==0:\n print(0)\n exit()\nelif len(L)==1 and L[0][1]==2:\n print(0)\n exit()\nans=1\nfor i,t in enumerate(L):\n num,v=t\n if i==0:\n if v==4:\n ans=num*num\n break\n else:\n ans*=num\n elif i==1:\n ans+=num\n break\nprint(ans)', 'from collections import Counter\nN=int(input())\nA=list(map(int ,input().split()))\nD=Counter(A)\n#print(D.items())\nL=[]\nfor num, v in D.items():\n if v>=4:\n L.append((num,4))\n elif v>=2:\n L.append((num, 2))\n\nL=sorted(L, reverse=True)\nif len(L)==0:\n print(0)\n exit()\nelif len(L)==1 and L[0][1]==2:\n print(0)\n exit()\nans=1\nfor i,t in enumerate(L):\n num,v=t\n if i==0:\n if v==4:\n ans=num*num\n break\n else:\n ans*=num\n elif i==1:\n ans*=num\n break\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s876045915', 's477904223'] | [18600.0, 18600.0] | [101.0, 103.0] | [549, 549] |
p03627 | u785205215 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ["from sys import stdin, stdout\ndef readLine_int_list():return list(map(int, stdin.readline().split()))\n\n\ndef main():\n n = int(input())\n a = sorted(readLine_int_list(),reverse=True)\n\n pair = []\n ans = 0\n t = 1\n\n for i in range(n-1):\n \n if a[i] == a[i+1]:\n t += 1\n else:\n if t > 1:\n pair.append(a[i])\n t = 1\n \n if t > 3:\n ans = a[i]*a[i+1]\n break\n \n \n if len(pair) >= 2:\n ans = pair[0] * pair[1]\n break\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin, stdout\ndef readLine_int_list():return list(map(int, stdin.readline().split()))\n\n\ndef main():\n n = int(input())\n a = sorted(readLine_int_list(),reverse=True)\n a.append(-1)\n pair = []\n ans = 0\n t = 1\n \n for i in range(n):\n \n if a[i] == a[i+1]:\n t += 1\n else:\n if t > 1:\n pair.append(a[i])\n if len(pair) == 2:\n ans = pair[0] * pair[1]\n break\n t = 1\n \n if t > 3:\n if pair:\n ans = max(a[i-1]*a[i], pair[0]*a[i])\n else:\n ans = a[i]**2\n break\n\n \n \n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s400797526', 's591850300'] | [14512.0, 14624.0] | [93.0, 88.0] | [622, 757] |
p03627 | u785578220 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['a = int(input())\nx = list(map(int, input().split()))\nt = x[0]\nx.sort()\nx = x[::-1]\nk = []\nfor i in range(1,a):\n if t == x[i]:\n k.append(x[i])\n t = x[i]\nif len(k)>=2:\n print(k[0]*k[1])\nelse:print(0)\n', 'n = int(input())\nA = list(map(int,input().split()))\n\nA.sort(reverse=True)\n\nfrom collections import defaultdict\nd = defaultdict(int)\nans = 0\nt = 0\nfor i in A:\n d[i] +=1\n if d[i] == 4:\n print(i**2)\n exit()\n elif d[i]==2 and ans ==0:\n ans +=2\n t = i \n elif d[i] == 2:\n ans +=2 \n if ans ==4:\n print(t*i)\n exit()\n\nprint(0)'] | ['Wrong Answer', 'Accepted'] | ['s856801503', 's021416741'] | [14252.0, 14252.0] | [106.0, 136.0] | [214, 382] |
p03627 | u802963389 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['# C - Make a Rectangle\n\n\nfrom collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\n\nC = sorted(list(Counter(A).items()), key=lambda x: -x[0])\n\nprint(C)\n\nans = 0\nfor k, v in C:\n if v >= 4:\n if ans == 0:\n print(k ** 2)\n else:\n print(ans * k)\n exit()\n else:\n if v >= 2:\n if ans == 0:\n ans = k\n else:\n print(ans * k)\n exit()\n\nprint(0)', '# C - Make a Rectangle\n\n\nfrom collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\n\nC = sorted(list(Counter(A).items()), key=lambda x: -x[0])\n\nans = 0\nfor k, v in C:\n if v >= 4:\n if ans == 0:\n print(k ** 2)\n else:\n print(ans * k)\n exit()\n else:\n if v >= 2:\n if ans == 0:\n ans = k\n else:\n print(ans * k)\n exit()\n\nprint(0)'] | ['Wrong Answer', 'Accepted'] | ['s508207899', 's980786338'] | [21412.0, 21412.0] | [210.0, 168.0] | [464, 454] |
p03627 | u813174766 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['n=int(input())\na=list(map(int,input().split()))\nx=[0]*(1e9+10)\nedge=[0]*2\nfor i in a:\n x[i]+=1\n if x[i]==2:\n edge.append(i)\n x[i]=0\nedge.sort(reverse=True)\nprint(edge[0]*edge[1])', 'n=int(input())\na=list(map(int,input().split()))\nx={}\nedge=[0]*2\nfor i in a:\n if i in x:\n x[i]+=1\n if x[i]==2:\n edge.append(i)\n x[i]=0\n else:\n x[i]=1\nedge.sort(reverse=True)\nprint(edge[0]*edge[1])'] | ['Runtime Error', 'Accepted'] | ['s283657905', 's234359008'] | [14252.0, 17960.0] | [41.0, 94.0] | [186, 216] |
p03627 | u814986259 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N=int(input())\nimport collections\nA=list(map(int,input().split()))\n\ntable=collections.defaultdict(int)\nfor x in A:\n table[x]+=1\ntable=list(table.items())\ntable=[table[i][0] for i in range(N) if table[i][1]>1]\ntable.append(0)\ntable.append(0)\ntable.sort(reverse=True)\nprint(table[0]*table[1])\n ', 'import heapq\nimport collections\nN = int(input())\nA = list(map(int, input().split()))\n\ntable = collections.defaultdict(int)\nhq = [0, 0]\nfor x in A:\n table[x] += 1\n if table[x] == 2:\n heapq.heappush(hq, -x)\n table[x] = 0\nprint(heapq.heappop(hq) * heapq.heappop(hq))\n'] | ['Runtime Error', 'Accepted'] | ['s566073116', 's049549057'] | [21336.0, 18592.0] | [110.0, 96.0] | [299, 284] |
p03627 | u820351940 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['input()\na=sorted(list(map(int,input().split())))\ne=[1 for x in range(10**9+1)]\nr=[]\nfor i in a:\n if e[i]:\n e[i]=0\n else:\n e[i]=1\n r.append(i)\nprint(0 if len(r) < 2 else r[-1] * r[-2])', 'input()\na=sorted(list(map(int,input().split())))\ne={}\nr=[]\nfor i in a:\n if not e.get(i):\n e[i]=1\n else:\n e[i]=0\n r.append(i)\nprint(0 if len(r) < 2 else r[-1] * r[-2])'] | ['Time Limit Exceeded', 'Accepted'] | ['s737683146', 's633613246'] | [529608.0, 18088.0] | [2130.0, 108.0] | [194, 177] |
p03627 | u836737505 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nn = int(input())\na = list(map(int,input().split()))\na = Counter(a)\nb = []\nfor i,j in a:\n if j >=4:\n b.append(i)\n b.append(i)\n elif j >= 2:\n b.append(i)\nb.sort()\nif len(b)>=2:\n print(b[-1]*b[-2])\nelse:\n print(0)', 'from collections import Counter\nn = int(input())\nl = list(map(int,input().split()))\na = Counter(l)\nb = a.most_common()\nc = []\nfor i,j in b:\n if j>=4:\n c.append(i)\n c.append(i)\n elif j>=2:c.append(i)\nc.sort()\nprint(c[-1]*c[-2] if len(c)>=2 else 0)'] | ['Runtime Error', 'Accepted'] | ['s312068516', 's040076411'] | [18592.0, 21668.0] | [59.0, 112.0] | [275, 266] |
p03627 | u846372029 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['# Make a Rectangle\nn = int(input())\na = list(map(int, input().split()))\n\nsorted(a, reverse = True)\na.append(0)\na.append(0)\na.append(0)\na.append(0)\n#print(a)\n\ni = 0\ns = 1\ncnt=0\nwhile i<n-1 and cnt <2:\n if (a[i]==a[i+1]):\n s*=a[i]\n i+=2\n cnt+=1\n else:\n i+=1\nprint(s)', '# Make a Rectangle\nn = int(input())\na = list(map(int, input().split()))\n\nsorted(a, reverse = True)\na.append(0)\na.append(0)\na.append(0)\na.append(0)\n#print(a)\n\ni = 0\ns = 1\ncnt=0\nwhile i<n-1 and cnt <2:\n if (a[i]==a[i+1]):\n s*=a[i]\n i+=2\n cnt+=1\n else:\n i+=1\nprint(s)', '#Make a Rectangle\nN = int(input())\nA = list(map(int, input().split()))\n\na = sorted(A, reverse=True)\nb = []\n\ni = 0\nwhile i<N-1:\n if ( a[i]==a[i+1] ):\n b+=[a[i]]\n i+=2\n else:\n i+=1\n if (len(b)>1):\n break\n\nif (len(b)<2):\n print(0)\nelse:\n print(b[0]*b[1])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s260397615', 's847122887', 's821677415'] | [14224.0, 14672.0, 14244.0] | [110.0, 115.0, 112.0] | [298, 298, 294] |
p03627 | u848647227 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['a = int(input())\nar = list(map(int,input().split(" ")))\nar = sorted(ar,reverse=True)\nA = 0\nB = 0\nj = 0\nwhile True:\n if A != 0 and B != 0:\n break\n if j == a - 1:\n break\n if ar[j] == ar[j+1] and A == 0:\n A = ar[j]\n j += 1\n elif ar[j] == ar[j+1] and A != 0:\n B = ar[j]\n j += 1\n j += 1\n print(ar[j])\nprint(A * B)', 'import collections\na = int(input())\nar = list(map(int,input().split(" ")))\nbr = collections.Counter(ar)\ncr = []\nfor k,v in br.items():\n if v >= 4:\n cr.append(k)\n cr.append(k)\n elif v >= 2:\n cr.append(k)\ncr = sorted(cr,reverse=True)\nif len(cr) < 2:\n print(0)\nelse:\n print(cr[0] * cr[1])'] | ['Runtime Error', 'Accepted'] | ['s574722606', 's011780335'] | [14252.0, 18600.0] | [176.0, 77.0] | [368, 318] |
p03627 | u888092736 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n\n\nN = int(input())\nc = Counter(map(int, input().split()))\nusables = sorted([(k, v) for k, v in c.items() if v >= 2])\nif len(usables) <= 1:\n print(0)\nelse:\n if usables[-1][2] >= 4:\n print(usables[-1][1] ** 2)\n else:\n print(usables[-1][1] * usables[-2][1])\n', 'from collections import Counter\n\n\ndef solve():\n N = int(input())\n c = Counter(map(int, input().split()))\n usables = sorted([k for k, v in c.items() if v > 1])\n\n if len(usables) == 0:\n return 0\n else:\n ans = usables[-1]\n if c[ans] > 3:\n return ans ** 2\n elif len(usables) > 1:\n usables.pop()\n return ans * usables[-1]\n else:\n return 0\n\n\nprint(solve())\n'] | ['Runtime Error', 'Accepted'] | ['s435712312', 's502970035'] | [24224.0, 24232.0] | [95.0, 70.0] | [310, 445] |
p03627 | u931462344 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input(()))\nA = list(map(int, input().split()))\n\nA.sort(reverse=True)\ntmp = 0\ntate = 0\nyoko = 0\ncnt = 0\nfor i in A:\n if tmp == i and cnt == 0:\n tate = i\n cnt += 1\n tmp = 0\n continue\n if tmp == i and cnt == 1:\n yoko = i\n cnt += 1\n if cnt == 2:\n break\n tmp = i\nprint(tate*yoko)', 'N = int(input(()))\nA = list(map(int, input().split()))\n\nA.sort(reverse=True)\ntmp = 0\ntate = 0\nyoko = 0\ncnt = 0\nfor i in A:\n if tmp == i and cnt == 0:\n tate = i\n cnt += 1\n tmp = 0\n continue\n if tmp == i and cnt == 1:\n yoko = i\n cnt += 1\n break\n tmp = i\nprint(tate*yoko)', 'N = int(input())\nA = list(map(int, input().split()))\n\nA.sort(reverse=True)\ntmp = 0\ntate = 0\nyoko = 0\ncnt = 0\nfor i in A:\n if tmp == i and cnt == 0:\n tate = i\n cnt += 1\n tmp = 0\n continue\n if tmp == i and cnt == 1:\n yoko = i\n cnt += 1\n break\n tmp = i\n\nprint(tate*yoko)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s292509048', 's395311168', 's990560509'] | [14244.0, 14252.0, 14252.0] | [91.0, 88.0, 89.0] | [343, 326, 325] |
p03627 | u944325914 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['a=list(map(int,input().split()))\nfrom collections import Counter\nac=Counter(a)\nv=sorted(ac.items(),reverse=1)\nans=[]\nans1=[]\n\nfor i in range(len(ac)):\n if v[i][1]>=2:\n ans.append(v[i][0])\n if v[i][1]>=4:\n ans1.append(v[i][0])\nif len(ans)>=2:\n if len(ans1)>=1:\n print(max(ans[0]*ans[1],ans1[0]**2))\n else:\n print(ans[0]*ans[1])\nelse:\n if len(ans1)>=1:\n print(max(0,ans1[0]**2))\n else:\n print(0)\n', 'n=int(input())\na=list(map(int,input().split()))\nfrom collections import Counter\nac=Counter(a)\nv=sorted(ac.items(),reverse=1)\nans=[]\nans1=[]\n\nfor i in range(len(ac)):\n if v[i][1]>=2:\n ans.append(v[i][0])\n if v[i][1]>=4:\n ans1.append(v[i][0])\nif len(ans)>=2:\n if len(ans1)>=1:\n print(max(ans[0]*ans[1],ans1[0]**2))\n else:\n print(ans[0]*ans[1])\nelse:\n if len(ans1)>=1:\n print(max(0,ans1[0]**2))\n else:\n print(0)'] | ['Wrong Answer', 'Accepted'] | ['s578397377', 's330703494'] | [9424.0, 26120.0] | [31.0, 145.0] | [426, 440] |
p03627 | u944643608 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA.reverse()\nans_lis = []\ncount = 1\nbefore = A[0]\nfor i in range(1,N):\n tmp = A[i]\n if tmp == before:\n count += 1\n else:\n if count == 2 or count == 3:\n ans_lis.append(before)\n elif count >= 4 and len(ans_lis) == 0:\n ans_lis.append(before)\n ans_lis.append(before)\n count = 1\n if len(ans_lis) == 2:\n break\n before = tmp\nif len(ans_lis) < 2:\n print(0)\nelse:\n print(ans_lis[0] * ans_lis[1])\n \n', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA.reverse()\nans_lis = []\ncount = 1\nbefore = A[0]\nfor i in range(1,N):\n tmp = A[i]\n if tmp == before:\n count += 1\n else:\n if count == 2 or count == 3:\n ans_lis.append(tmp)\n elif count >= 4 and len(ans_lis) == 0:\n ans_lis.append(tmp)\n ans_lis.append(tmp)\n count = 0\n if len(ans_lis) == 2:\n break\n before = tmp\nif len(ans_lis) < 2:\n print(0)\nelse:\n print(ans_lis[0] * ans_lis[1])\n \n', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA.reverse()\nans_lis = []\ncount = 1\nbefore = A[0]\nfor i in range(1,N):\n tmp = A[i]\n if tmp == before:\n count += 1\n else:\n if count == 2 or count == 3:\n ans_lis.append(before)\n elif count >= 4 and len(ans_lis) == 0:\n ans_lis.append(before)\n ans_lis.append(before)\n elif count >= 4 and len(ans_lis) != 0:\n ans_lis.append(before)\n count = 1\n if len(ans_lis) == 2:\n break\n before = tmp\nif len(ans_lis) < 2:\n print(0)\nelse:\n print(ans_lis[0] * ans_lis[1])\n \n', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA.reverse()\nans_lis = []\ncount = 1\nbefore = A[0]\nfor i in range(1,N):\n tmp = A[i]\n if tmp == before:\n count += 1\n else:\n if count == 2 or count == 3:\n ans_lis.append(tmp)\n elif count == 4 and len(ans_lis) == 0:\n ans_lis.append(tmp)\n ans_lis.append(tmp)\n count = 0\n if len(ans_lis) == 2:\n break\n before = tmp\nif len(ans_lis) < 2:\n print(0)\nelse:\n print(ans_lis[0] * ans_lis[1])\n ', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA.reverse()\nans_lis = []\ncount = 1\nbefore = A[0]\nfor i in range(1,N):\n tmp = A[i]\n if tmp == before:\n count += 1\n else:\n if count == 2 or count == 3:\n ans_lis.append(before)\n elif count >= 4 and len(ans_lis) == 0:\n ans_lis.append(before)\n ans_lis.append(before)\n elif count >= 4 and len(ans_lis) != 0:\n ans_lis.append(before)\n count = 1\n if len(ans_lis) == 2:\n break\n before = tmp\nif len(ans_lis) == 0:\n if A[N-1] == A[N-2] and A[N-2] == A[N-3] and A[N-3] == A[N-4]:\n ans_lis.append(A[N-1])\n ans_lis.append(A[N-1])\nelif len(ans_lis) == 1:\n if A[N-1] == A[N-2]:\n ans_lis.append(A[N-1])\nif len(ans_lis) < 2:\n print(0)\nelse:\n print(ans_lis[0] * ans_lis[1])\n \n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s188135326', 's288717949', 's511630754', 's558091192', 's925196847'] | [14252.0, 14668.0, 14480.0, 14224.0, 14672.0] | [109.0, 120.0, 115.0, 114.0, 119.0] | [488, 479, 560, 478, 775] |
p03627 | u946386741 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['N = int(input())\nA = sorted(list(map(int, input().split())))\nL = [0 for i in range(max(A) + 1)]\nres = []\nfor a in A:\n L[a] += 1\n\nfor i, l in enumerate(L):\n if l > 4:\n res.append(i)\n res.append(i)\n break\n elif l > 2:\n res.append(i)\n else:\n res.append(0)\n\nresult = 1\nfor i in range(2):\n result *= sorted(res, reverse=True)[i]\n\nprint(result)\n', 'N = int(input())\nA = sorted(list(map(int, input().split())) + [0, 0, 0, 0], reverse=True)\n\nres = []\ntmp = -1\nfor a in A:\n if a == tmp:\n res.append(a)\n tmp = -1\n else:\n tmp = a\n if len(res) >= 2:\n break\n\nres = sorted(res, reverse=True)\n\nresult = 1\nfor i in range(2):\n result *= res[i]\n\nprint(result)\n'] | ['Wrong Answer', 'Accepted'] | ['s739445761', 's889316928'] | [527884.0, 14252.0] | [2131.0, 90.0] | [389, 339] |
p03627 | u957872856 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\nN = int(input())\nA = [int(i) for i in input().split()]\nA = Counter(A).most_common()\nA = sorted(A)[::-1]\ncnt = 0\nl = []\nans = [0]\nfor i, v in A:\n if v >= 4:\n ans.append(i*i)\n if 2<=v:\n cnt += 1\n l.append(i)\n if cnt == 2:\n ans.append(l[0]*l[1])\nprint(ans) ', 'from collections import Counter\nN = int(input())\nA = [int(i) for i in input().split()]\nA = Counter(A).most_common()\nA = sorted(A)[::-1]\ncnt = 0\nl = []\nans = [0]\nfor i, v in A:\n if v >= 4:\n ans.append(i*i)\n if 2<=v:\n cnt += 1\n l.append(i)\n if cnt == 2:\n ans.append(l[0]*l[1])\nprint(max(ans)) '] | ['Wrong Answer', 'Accepted'] | ['s541231612', 's314460551'] | [21540.0, 21540.0] | [199.0, 193.0] | [306, 311] |
p03627 | u968404618 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\nA_dic = Counter(A)\n\nif A_dic.most_common()[0][0] == 1:\n print(0)\n exit()\n\nset_A = sorted((set(A)), reverse=True)\ntmp = 0\nfor a in set_A:\n if A_dic[a] >= 4:\n print(a * a)\n exit()\n if A_dic[a] >= 2:\n ans = tmp * a\n if ans != 0:\n print(ans)\n exit()\n tmp = a', 'from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\nA_dic = Counter(A)\n\nset_A = sorted((set(A)), reverse=True)\ntmp = 0\nfor a in set_A:\n if A_dic[a] >= 4:\n print(max(tmp*a, a*a))\n exit()\n if A_dic[a] >= 2:\n ans = tmp * a\n if ans != 0:\n print(ans)\n exit()\n tmp = a\nprint(0)\n'] | ['Wrong Answer', 'Accepted'] | ['s282086249', 's132689784'] | [26340.0, 25332.0] | [130.0, 111.0] | [409, 369] |
p03627 | u983918956 | 2,000 | 262,144 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | ['import collections\nN = int(input())\nA = list(map(int,input().split()))\nc = collections.Counter(A)\nc_l = c.most_common()\nif c_l[0][1] >= 2 and c_l[1][1] >= 2:\n ans1 = max(c_l[0][0],c_l[1][0])\n ans2 = min(c_l[0][0],c_l[1][0])\n for e in c_l:\n if e[0] > ans1:\n ans2 = ans1\n ans1 = e[0]\n elif e[0] > ans2:\n ans2 = e[0]\n print(ans1*ans2)\nelse:\n print(0)', 'from collections import Counter\nN = int(input())\nA = list(map(int,input().split()))\nc = Counter(A)\nop = []\nfor a, cnt in c.items():\n for _ in range(cnt // 2):\n op.append(a)\nop.sort(reverse=True)\nif len(op) < 2:\n print(0)\nelse:\n print(op[0]*op[1])'] | ['Wrong Answer', 'Accepted'] | ['s259080030', 's588930634'] | [21668.0, 18600.0] | [119.0, 91.0] | [409, 262] |
p03628 | u105124953 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['import sys\nn = int(input())\ns1 = list(input())\ns2 = list(input())\n\nli = []\ntmp = 1\nif n == 1:\n print(3)\n sys.exit()\nfor i,s in enumerate(s1):\n \n if i == len(s1) - 1:\n break\n \n if s != s1[i+1]:\n li.append(tmp)\n tmp = 1\n \n else:\n tmp = 2\n# print(li)\n# [1, 2, 2, 1, 1, 1, 2, 2, 1, 2, \n# 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2]\n#print(li)\nif s1[-1] == s1[-2]:\n li.append(2)\nelse:\n li.append(1)\n#print(li)\n#print(sum(li))\nall_count = 1\nfor j,l in enumerate(li):\n if j == 0:\n all_count *= 3\n continue\n if l == 2 and li[j-1] == 2:\n all_count *= 3\n elif l == 1 and li[j-1] == 2:\n all_count *= 1\n else:\n all_count *= 2\nprint(all_count%1000000007)\n#print(958681902)', 'import sys\nn = int(input())\ns1 = list(input())\ns2 = list(input())\n\nli = []\ntmp = 1\nif n == 1:\n print(3)\n sys.exit()\nfor i,s in enumerate(s1):\n \n if i == len(s1) - 1:\n break\n \n if s != s1[i+1]:\n li.append(tmp)\n tmp = 1\n \n else:\n tmp = 2\n# print(li)\n# [1, 2, 2, 1, 1, 1, 2, 2, 1, 2, \n# 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2]\n#print(li)\nif s1[-1] == s1[-2]:\n li.append(2)\nelse:\n li.append(1)\n#print(li)\n#print(sum(li))\nall_count = 1\nfor j,l in enumerate(li):\n if j == 0:\n if li[0] == 2: \n all_count *= 6\n else:\n all_count *= 3\n continue\n if l == 2 and li[j-1] == 2:\n all_count *= 3\n elif l == 1 and li[j-1] == 2:\n all_count *= 1\n else:\n all_count *= 2\nprint(all_count%1000000007)\n#print(958681902)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s525837007', 's825244647'] | [3064.0, 3064.0] | [18.0, 17.0] | [804, 876] |
p03628 | u197457087 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['MOD = pow(10,9)+7\nN = int(input())\nS = str(input())\nT = str(input())\nif N == 1:\n print(3)\n exit()\nnow = 0\nif S[now] != T[now]: \n now = 2\n ans = 6\n Flag = True\nelse: \n now = 1\n ans = 3\n Flag = False\n\nwhile now <= N-1:\n if S[now] != T[now]: \n if Flag:\n ans = 3*ans%MOD\n else:\n Flag = True\n now += 2\n else: \n now += 1\n ans = 2*ans%MOD\n Flag = False\nprint(ans)', 'MOD = pow(10,9)+7\nN = int(input())\nS = str(input())\nT = str(input())\nif N == 1:\n print(3)\n exit()\nnow = 0\nif S[now] != T[now]: \n now = 2\n ans = 6\n Flag = True\nelse: \n now = 1\n ans = 3\n Flag = False\n\nwhile now <= N-1:\n if S[now] != T[now]: \n if Flag: \n ans = 3*ans%MOD\n else: \n ans = 2*ans%MOD\n Flag = True\n now += 2\n else: \n if Flag: \n ans *= 1\n else: \n ans = 2*ans%MOD\n Flag = False\n now += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s011949849', 's619197228'] | [9208.0, 9116.0] | [29.0, 32.0] | [410, 514] |
p03628 | u268516119 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['N=int(input())\nS1=input()\nS2=input()\ndominos=[]\nindex=0\nwhile index<N:\n if S1[index]==S2[index]:\n dominos.append(0)\n index+=1\n else:\n dominos.append(1)\n index+=2\nstart=3\nfor k,c in enumerate(dominos):\n if k==0:continue\n elif dominos[k-1]==0:\n start*=2\n elif c:start*=3\n start%=10**9+7\nprint(start)', 'N=int(input())\nS1=input()\nS2=input()\ndominos=[]\nindex=0\nwhile index<N:\n if S1[index]==S2[index]:\n dominos.append(0)\n index+=1\n else:\n dominos.append(1)\n index+=2\nif dominos[0]==0:start=3\nelse:start=6\nfor k,c in enumerate(dominos):\n if k==0:continue\n elif dominos[k-1]==0:\n start*=2\n elif c:start*=3\n start%=10**9+7\nprint(start)'] | ['Wrong Answer', 'Accepted'] | ['s030421542', 's185639414'] | [3064.0, 3064.0] | [17.0, 24.0] | [350, 380] |
p03628 | u273084112 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n = int(input())\ns1 = input() + " "\ns2 = input() + " "\n\nmod = 1000000007\n\nnum = 1\ni = 0\nb = 0\ntmp_t = -1\nwhile(b + i < n):\n if s1[i + b] == s2[i + b]: # t 0\n if tmp_t == 0:\n num = (num * 2) % mod\n elif tmp_t == 1:\n num = (num * 2) % mod\n else:\n num = 3\n tmp_t = 0\n else: # t 1\n if tmp_t == 0:\n num = (num * 1) % mod\n elif tmp_t == 1:\n num = (num * 3) % mod\n else:\n num = 6\n tmp_t = 1\n b += 1\n i += 1\n\nprint(num)\n', 'n = int(input())\ns1 = input() + " "\ns2 = input() + " "\n \nmod = 1000000007\n \nnum = 1\ni = 0\nb = 0\ntmp_t = -1\nwhile(b + i < n):\n if s1[i + b] == s2[i + b]: # t 0\n if tmp_t == 0:\n num = (num * 2) % mod\n elif tmp_t == 1:\n num = (num * 1) % mod\n else:\n num = 3\n tmp_t = 0\n else: # t 1\n if tmp_t == 0:\n num = (num * 2) % mod\n elif tmp_t == 1:\n num = (num * 3) % mod\n else:\n num = 6\n tmp_t = 1\n b += 1\n i += 1\n \nprint(num)'] | ['Wrong Answer', 'Accepted'] | ['s569281993', 's219541591'] | [3064.0, 3064.0] | [18.0, 17.0] | [550, 552] |
p03628 | u315485238 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['N = int(input())\nS1 = input()\nS2 = input()\nmod = 10**9+7\n\nif S1[0] != S2[0]:\n ans = 6\nelse:\n ans = 3\n \ni=1\nwhile i<N:\n if S1[i] != S2[i]:\n if S1[i-1] != S2[i-1]:\n ans *= 3\n else:\n ans *= 2\n i += 2\n \n else:\n if S1[i-1] != S2[i-1]:\n pass\n else:\n ans *= 2\n i += 1\n ans = ans%mod\n \nprint(ans)', 'N = int(input())\nS1 = input()\nS2 = input()\nmod = 10**9+7\n\nif S1[0] != S2[0]:\n ans = 6\n i = 2\nelse:\n ans = 3\n i = 1\n \nwhile i<N:\n if S1[i] != S2[i]:\n if S1[i-1] != S2[i-1]:\n ans *= 3\n else:\n ans *= 2\n i += 2\n \n else:\n if S1[i-1] != S2[i-1]:\n pass\n else:\n ans *= 2\n i += 1\n ans = ans%mod\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s843903363', 's074925992'] | [3064.0, 3064.0] | [18.0, 17.0] | [336, 348] |
p03628 | u341087021 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n = int(input())\ns1 = input()\ns2 = input()\nl = []\nm = 3\nmod = 10**9 + 7\n\nafter = False\nfor i in range(n):\n\tif i == n-1:\n\t\tif after:\n\t\t\tpass\n\t\telse:\n\t\t\tl.append(0)\n\telse:\n\t\tif after:\n\t\t\tafter = False\n\t\t\tpass\n\t\telse:\n\t\t\tif s1[i] == s1[i+1]:\n\t\t\t\tl.append(1)\n\t\t\t\tafter = True\n\t\t\telse:\n\t\t\t\tl.append(0)\n\nprint(l)\n\nfor i, x in enumerate(l):\n\tif i == 0:\n\t\tpass\n\telse:\n\t\tif x == 0 and l[i-1] == 0:\n\t\t\tm = m * 2\n\t\telif x == 0 and l[i-1] == 1:\n\t\t\tm = m * 2\n\t\telif x == 1 and l[i-1] == 0:\n\t\t\tpass\n\t\telse:\n\t\t\tm = m * 3\n\nprint(m % mod)', 'n = int(input())\ns1 = input()\ns2 = input()\nl = []\nm = 1\nmod = 10**9 + 7\n\nafter = False\nfor i in range(n):\n\tif i == n-1:\n\t\tif after:\n\t\t\tpass\n\t\telse:\n\t\t\tl.append(0)\n\telse:\n\t\tif after:\n\t\t\tafter = False\n\t\t\tpass\n\t\telse:\n\t\t\tif s1[i] == s1[i+1]:\n\t\t\t\tl.append(1)\n\t\t\t\tafter = True\n\t\t\telse:\n\t\t\t\tl.append(0)\n\nfor i, x in enumerate(l):\n\tif i == 0:\n\t\tif x == 0:\n\t\t\tm = 3\n\t\telse:\n\t\t\tm = 6 \n\telse:\n\t\tif x == 0 and l[i-1] == 0:\n\t\t\tm = m * 2\n\t\t\tm = m % mod\n\t\telif x == 0 and l[i-1] == 1:\n\t\t\tm = m * 2\n\t\t\tm = m % mod\n\t\telif x == 1 and l[i-1] == 0:\n\t\t\tpass\n\t\telse:\n\t\t\tm = m * 3\n\t\t\tm = m % mod\n\nprint(m)', 'n = int(input())\ns1 = input()\ns2 = input()\nl = []\nm = 1\nmod = 10**9 + 7\n\nafter = False\nfor i in range(n):\n\tif i == n-1:\n\t\tif after:\n\t\t\tpass\n\t\telse:\n\t\t\tl.append(0)\n\telse:\n\t\tif after:\n\t\t\tafter = False\n\t\t\tpass\n\t\telse:\n\t\t\tif s1[i] == s1[i+1]:\n\t\t\t\tl.append(1)\n\t\t\t\tafter = True\n\t\t\telse:\n\t\t\t\tl.append(0)\n\nfor i, x in enumerate(l):\n\tif i == 0:\n\t\tif x == 0:\n\t\t\tm = 3\n\t\telse:\n\t\t\tm = 6 \n\telse:\n\t\tif x == 0 and l[i-1] == 0:\n\t\t\tm = m * 2\n\t\t\tm = m % mod\n\t\telif x == 1 and l[i-1] == 0:\n\t\t\tm = m * 2\n\t\t\tm = m % mod\n\t\telif x == 0 and l[i-1] == 1:\n\t\t\tpass\n\t\telse:\n\t\t\tm = m * 3\n\t\t\tm = m % mod\n\nprint(m)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s023727518', 's993515071', 's118096174'] | [3064.0, 3192.0, 3064.0] | [17.0, 18.0, 17.0] | [521, 583, 583] |
p03628 | u349091349 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['N=int(input())\nS=list(input())\nT=list(input())\nstate=[]\nlim=1000000007\ni=0\nwhile i<=N:\n if S[i] == T[i]:\n state.append(0)\n i+=1\n else:\n state.append(1)\n i+=2\nans=3 \nfor i in range(1,len(state)):\n if state[i] == 1 and state[i-1] == 1:\n ans = (ans * 3) % lim\n elif state[i] == 1 and state[i-1] == 0:\n ans = (ans * 2) % lim\n elif state[i] == 0 and state[i-1] == 1:\n pass\n elif state[i] == 0 and state[i-1] == 0: \n ans = (ans * 2) % lim\nprint(ans)', 'N=int(input())\nS=list(input())\nT=list(input())\nstate=[]\nlim=1000000007\ni=0\nwhile i<N:\n if S[i] == T[i]:\n state.append(0)\n i+=1\n else:\n state.append(1)\n i+=2\nans=3 \nfor i in range(1,len(state)):\n if state[i] == 1 and state[i-1] == 1:\n ans = (ans * 3) % lim\n elif state[i] == 1 and state[i-1] == 0:\n ans = (ans * 2) % lim\n elif state[i] == 0 and state[i-1] == 1:\n pass\n elif state[i] == 0 and state[i-1] == 0: \n ans = (ans * 2) % lim\nprint(ans)', 'N=int(input())\nS=list(input())\nT=list(input())\nstate=[]\nlim=1000000007\ni=0\nwhile i<N:\n if S[i] == T[i]:\n state.append(0)\n i+=1\n else:\n state.append(1)\n i+=2\nans=3 \nfor i in range(1,len(state)):\n if state[i] == 1 and state[i-1] == 1:\n ans = (ans * 3) % lim\n elif state[i] == 1 and state[i-1] == 0:\n ans = (ans * 2) % lim\n elif state[i] == 0 and state[i-1] == 1:\n pass\n elif state[i] == 0 and state[i-1] == 0: \n ans = (ans * 2) % lim\nprint(ans)', 'N=int(input())\nS=list(input())\nT=list(input())\nstate=[]\nlim=1000000007\ni=0\nwhile i<N:\n if S[i] == T[i]:\n state.append(0)\n i+=1\n else:\n state.append(1)\n i+=2\nif state[0]==0:\n ans=3\nelse:\n ans=6\nfor i in range(1,len(state)):\n if state[i] == 1 and state[i-1] == 1:\n ans = (ans * 3) % lim\n elif state[i] == 1 and state[i-1] == 0:\n ans = (ans * 2) % lim\n elif state[i] == 0 and state[i-1] == 1:\n pass\n elif state[i] == 0 and state[i-1] == 0: \n ans = (ans * 2) % lim\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s524971637', 's758155176', 's887350675', 's123813251'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0, 17.0] | [520, 519, 519, 551] |
p03628 | u367130284 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['from itertools import*\ninput()\nmod=10**9+7\nx=[[s,len(list(t))]for s,t in groupby(len(list(v))for k,v in groupby(input()))]\n#print(x)\nif x[0][0]==1:\n ans=3\nelse:\n ans=6\nfor s,t in x:\n if s==1:\n ans*=2**(t-1)%mod\n else:\n ans*=2*3**(t-1)%mod\n\nprint(ans%mod)', 'from itertools import*\ninput()\nmod=10**9+7\nx=[[s,len(list(t))]for s,t in groupby(len(list(v))for k,v in groupby(input()))]\n#print(x)\nif x[0][0]==1:\n ans=3\nelse:\n ans=6\nfor s,t in x:\n if s==1 and t>1:\n ans*=2**(t-1)%mod\n elif s==2:\n ans*=2*3**(t-1)%mod\nprint(ans%mod)', 'from itertools import*\ninput()\nmod=10**9+7\n\nx=[len(list(v))for k,v in groupby(input())]\nif x[0]==1:\n ans=3\nelse:\n ans=6\nif len(x)==1:\n print(ans)\nelse:\n for i in range(1,len(x)):\n if x[i-1]==1 and x[i]==1:\n ans*=2%mod\n elif x[i-1]==2 and x[i]==2:\n ans*=3%mod\n elif x[i-1]==1 and x[i]==2:\n ans*=2%mod\n print(ans%mod)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s343786275', 's607451723', 's074077259'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 18.0] | [280, 292, 384] |
p03628 | u393167737 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['def f(horizontal_flag):\n if horizontal_flag[0]:\n if horizontal_flag[1]:\n return 3\n else:\n return 1\n else:\n return 2\n\nif N == 1:\n print(3) \nelse:\n if A[0] == A[1]:\n counter = 6\n initial_num = 2\n horizontal_flag = [0,1]\n else:\n counter = 3\n initial_num = 1\n horizontal_flag = [0,1]\n\n\n for i in range(initial_num,N):\n if i == N-1:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n elif A[i] == A[i+1]:\n horizontal_flag[1] = 2\n else:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n horizontal_flag[0] = horizontal_flag[1]\n print(counter % 1000000007)', 'N = int(input())\nA = input()\nB = input()\n\ndef f(horizontal_flag):\n if horizontal_flag[0]:\n if horizontal_flag[1]:\n return 3\n else:\n return 1\n else:\n return 2\n\nif N == 1:\n print(3) \nelse:\n if A[0] == A[1]:\n counter = 6\n initial_num = 2\n horizontal_flag = [0,1]\n else:\n counter = 3\n initial_num = 1\n horizontal_flag = [0,1]\n\n\n for i in range(initial_num,N):\n if i == N-1:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n elif A[i] == A[i+1]:\n horizontal_flag[1] = 2\n else:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n horizontal_flag[0] = horizontal_flag[1]\n print(counter % 1000000007)', 'N = int(input())\nA = input()\nB = input()\n\ndef f(horizontal_flag):\n if horizontal_flag[0]:\n if horizontal_flag[1]:\n return 3\n else:\n return 1\n else:\n return 2\n\nif N == 1:\n print(3) \nelse:\n if A[0] == A[1]:\n counter = 6\n initial_num = 2\n horizontal_flag = [1,0]\n else:\n counter = 3\n initial_num = 1\n horizontal_flag = [0,0]\n\n for i in range(initial_num,N):\n if i == N-1:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n elif A[i] == A[i+1]:\n horizontal_flag[1] = 2\n else:\n if horizontal_flag[1] == 2:\n horizontal_flag[1] = 1\n counter *= f(horizontal_flag)\n else:\n horizontal_flag[1] = 0\n counter *= f(horizontal_flag)\n horizontal_flag[0] = horizontal_flag[1]\n print(counter % 1000000007)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s014195314', 's057681967', 's732751683'] | [3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0] | [1058, 1100, 1099] |
p03628 | u405256066 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['N = int(input())\nS1 = input()\nS2 = input()\nans = 1\nmod = 10**9+7\ncnt = 0\nformer = 0 \n\nif S1[0] == S2[0]:\n cnt += 1\n ans = 3\nelse:\n cnt += 2\n ans = 6\n\nwhile cnt < N:\n if S1[cnt] == S2[cnt]:\n if former:\n ans *= 1\n else:\n ans *= 2\n ans %= mod\n former = 0\n cnt += 1\n else:\n if former:\n ans *= 3\n else:\n ans *= 2\n former = 1\n cnt += 2\n ans %= mod\nprint(ans)', 'N = int(input())\nS1 = input()\nS2 = input()\nans = 1\nmod = 10**9+7\ncnt = 0\nformer = 0 \n \nif S1[0] == S2[0]:\n cnt += 1\n ans = 3\n former = 0\nelse:\n cnt += 2\n ans = 6\n former = 1\n \nwhile cnt < N:\n if S1[cnt] == S2[cnt]:\n if former:\n ans *= 1\n else:\n ans *= 2\n ans %= mod\n former = 0\n cnt += 1\n else:\n if former:\n ans *= 3\n else:\n ans *= 2\n former = 1\n cnt += 2\n ans %= mod\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s698951806', 's180825436'] | [3064.0, 3064.0] | [18.0, 17.0] | [502, 534] |
p03628 | u405660020 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n=int(input())\ns1=input()\ns2=input()\nmod=10**9+7\n\ndef rle(string):\n rle_str = string[0]\n rle_cnt = 1\n ans_l = []\n for i in range(1, len(string)):\n if rle_str == string[i]:\n rle_cnt += 1\n else:\n ans_l.append([rle_str, rle_cnt])\n rle_str = string[i]\n rle_cnt = 1\n ans_l.append([rle_str, rle_cnt])\n return ans_l\n\nrle_s=rle(s1)\n\nif rle_s[0][1]==1:\n ans=3\n left=1\nelif rle_s[0][1]==2:\n ans=6\n left=1\n\nfor s, i in rle_s[1:]:\n if left==1 and i==1:\n ans*=2\n elif left==1 and i==2:\n ans*=2\n elif left==2 and i==1:\n ans*=1\n elif left==2 and i==2:\n ans*=3\n left=i\n\nprint(ans%mod)\n', 'n=int(input())\ns1=input()\ns2=input()\nmod=10**9+7\n\ndef rle(string):\n rle_str = string[0]\n rle_cnt = 1\n ans_l = []\n for i in range(1, len(string)):\n if rle_str == string[i]:\n rle_cnt += 1\n else:\n ans_l.append([rle_str, rle_cnt])\n rle_str = string[i]\n rle_cnt = 1\n ans_l.append([rle_str, rle_cnt])\n return ans_l\n\nrle_s=rle(s1)\n\nif rle_s[0][1]==1:\n ans=3\n left=1\nelif rle_s[0][1]==2:\n ans=6\n left=2\n\nfor s, i in rle_s[1:]:\n if left==1 and i==1:\n ans*=2\n elif left==1 and i==2:\n ans*=2\n elif left==2 and i==1:\n ans*=1\n elif left==2 and i==2:\n ans*=3\n left=i\n\nprint(ans%mod)\n'] | ['Wrong Answer', 'Accepted'] | ['s807088413', 's751060579'] | [9052.0, 9180.0] | [26.0, 30.0] | [700, 700] |
p03628 | u466826467 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['def pop_when_x():\n S1.pop(0)\n S2.pop(0)\n global left_state\n left_state = "X"\n\n\ndef pop_when_y():\n S1.pop(0)\n S1.pop(0)\n S2.pop(0)\n S2.pop(0)\n global left_state\n left_state = "Y"\n\n\nif __name__ == \'__main__\':\n N = int(input())\n S1 = list(input())\n S2 = list(input())\n\n if S1[0] == S2[0]:\n cases = 3\n left_state = "X"\n pop_when_x()\n else:\n cases = 6\n left_state = "Y"\n pop_when_y()\n\n while len(S1) != 0:\n print("".join(S1))\n print("".join(S2))\n if S1[0] == S2[0]:\n state = "X"\n else:\n state = "Y"\n print("left_state:" + left_state)\n print("state:" + state)\n if left_state == "X" and state == "X":\n cases *= 2\n pop_when_x()\n elif left_state == "X" and state == "Y":\n cases *= 2\n pop_when_y()\n elif left_state == "Y" and state == "X":\n cases *= 1\n pop_when_x()\n elif left_state == "Y" and state == "Y":\n cases *= 3\n pop_when_y()\n\n print(cases)\n', 'def pop_when_x():\n S1.pop(0)\n S2.pop(0)\n global left_state\n left_state = "X"\n\n\ndef pop_when_y():\n S1.pop(0)\n S1.pop(0)\n S2.pop(0)\n S2.pop(0)\n global left_state\n left_state = "Y"\n\n\nif __name__ == \'__main__\':\n N = int(input())\n S1 = list(input())\n S2 = list(input())\n\n if S1[0] == S2[0]:\n cases = 3\n left_state = "X"\n pop_when_x()\n else:\n cases = 6\n left_state = "Y"\n pop_when_y()\n\n while len(S1) != 0:\n # print("".join(S1))\n # print("".join(S2))\n # print(cases)\n if S1[0] == S2[0]:\n state = "X"\n else:\n state = "Y"\n # print("left_state:" + left_state)\n # print("state:" + state)\n if left_state == "X" and state == "X":\n cases *= 2\n pop_when_x()\n elif left_state == "X" and state == "Y":\n cases *= 2\n pop_when_y()\n elif left_state == "Y" and state == "X":\n cases *= 1\n pop_when_x()\n elif left_state == "Y" and state == "Y":\n cases *= 3\n pop_when_y()\n\n print(cases % 1000000007)\n'] | ['Wrong Answer', 'Accepted'] | ['s696394511', 's436872904'] | [3064.0, 3064.0] | [18.0, 17.0] | [1112, 1156] |
p03628 | u502126017 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n=int(input())\ns1=list(input())\ns2=list(input())\n\nans=3\nfor i in range(n-1):\n if s1[i]==s2[i]:\n ans*=2\n else:\n if s1[i]==s1[i+1]:\n continue\n else:\n if s1[i+1]!=s2[i+1]:\n ans*=3\n else:\n ans*=1\nprint(ans%1000000007)', 'n=int(input())\ns1=list(input())\ns2=list(input())\nans=0\nif s1[0]==s2[0]:\n ans=3\nelse:\n ans=6\nfor i in range(n-1):\n if s1[i]==s2[i]:\n ans*=2\n else:\n if s1[i]==s1[i+1]:\n continue\n else:\n if s1[i+1]!=s2[i+1]:\n ans*=3\n else:\n ans*=1\nprint(ans%1000000007)'] | ['Wrong Answer', 'Accepted'] | ['s991421943', 's964976768'] | [9064.0, 9004.0] | [27.0, 30.0] | [303, 345] |
p03628 | u503228842 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['N = int(input())\ns1 = input()\ns2 = input()\nans = 1\nbeing_horizontal = False\nwas_horizontal = False\nwas_vertical = False\nMOD = 10**9+7\nfor i in range(N):\n\n if not was_horizontal and not being_horizontal and not was_vertical: \n ans *= 3\n if s1[i] != s2[i]:\n being_horizontal = True\n else:\n was_vertical = True\n elif being_horizontal:\n being_horizontal = False\n was_horizontal = True\n elif was_horizontal and s1[i] == s2[i]:\n was_vertical = True\n elif was_horizontal and s1[i] != s2[i]:\n ans *= 3\n being_horizontal = True\n was_horizontal = False\n elif was_vertical and s1[i] == s2[i]:\n ans *= 2\n was_vertical = True\n elif was_vertical and s1[i] != s2[i]:\n ans *= 3\n was_vertical = False\n being_horizontal = True\n ans %= MOD\nprint(ans)', 'N = int(input())\ns1 = input()\ns2 = input()\nans = 1\nbeing_horizontal = False\nwas_horizontal = False\nwas_vertical = False\nMOD = 10**9+7\nfor i in range(N):\n\n if not was_horizontal and not being_horizontal and not was_vertical: \n if s1[i] != s2[i]:\n ans *= 6\n being_horizontal = True\n else:\n ans *= 3\n was_vertical = True\n elif being_horizontal:\n being_horizontal = False\n was_horizontal = True\n elif was_horizontal and s1[i] == s2[i]:\n was_horizontal = False\n was_vertical = True\n elif was_horizontal and s1[i] != s2[i]:\n ans *= 3\n being_horizontal = True\n was_horizontal = False\n elif was_vertical and s1[i] == s2[i]:\n ans *= 2\n was_vertical = True\n elif was_vertical and s1[i] != s2[i]:\n ans *= 2\n was_vertical = False\n being_horizontal = True\n ans %= MOD\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s875671166', 's290730467'] | [3064.0, 3064.0] | [17.0, 17.0] | [883, 939] |
p03628 | u536113865 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n = int(input())\na = input()\nb = input()\n\nans = 3\ni = 0\nif a[0] != b[0]:\n i += 1\n\nwhile i < n-1:\n if a[i]==b[i]:\n if a[i+1]==b[i+1]:\n ans *= 2\n else:\n ans *= 2\n i += 1\n else:\n if a[i+1]==b[i+1]:\n ans *= 1\n else:\n ans *= 3\n i += 1\n i += 1\n ans %= 1000000007\nprint(ans)\n', 'n = int(input())\na = input()\nb = input()\n\nans = 3\ni = 0\nif a[0] != b[0]:\n i += 1\n ans += 3\n\nwhile i < n-1:\n if a[i]==b[i]:\n if a[i+1]==b[i+1]:\n ans *= 2\n else:\n ans *= 2\n i += 1\n else:\n if a[i+1]==b[i+1]:\n ans *= 1\n else:\n ans *= 3\n i += 1\n i += 1\n ans %= 1000000007\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s918181436', 's578636558'] | [3064.0, 3064.0] | [17.0, 17.0] | [377, 391] |
p03628 | u542190960 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ["n = int(input())\ns1 = str(input())\ns2 = str(input())\n\ncnt = 1\n\nfor i in range(n):\n if i == 0:\n if s1[i] == s2[i]:\n cnt = cnt * 3\n previous = 'tate'\n else:\n cnt = cnt * 6\n previous = 'yoko1'\n else:\n if s1[i] == s2[i]: #tate\n if previous == 'tate':\n cnt = cnt * 2\n elif previous == 'yoko2':\n cnt = cnt * 3\n else: #yoko\n if previous = 'tate':\n cnt = cnt * 2\n elif previous = 'yoko2':\n cnt = cnt * 3\nprint(cnt%1000000007)", "n = int(input())\ns1 = str(input())\ns2 = str(input())\n\ncnt = 1\n\nfor i in range(n):\n if i == 0:\n if s1[i] == s2[i]:\n cnt = cnt * 3\n previous = 'tate'\n else:\n cnt = cnt * 6\n previous = 'yoko1'\n else:\n if s1[i] == s2[i]: #tate\n if previous == 'tate':\n cnt = cnt * 2\n elif previous == 'yoko2':\n cnt = cnt * 1\n previous = 'tate'\n else: #yoko\n if previous == 'tate':\n cnt = cnt * 2\n previous = 'yoko1'\n elif previous == 'yoko2':\n cnt = cnt * 3\n previous = 'yoko1'\n elif previous == 'yoko1':\n previous = 'yoko2'\n \nprint(cnt%1000000007)"] | ['Runtime Error', 'Accepted'] | ['s290643770', 's754630946'] | [3064.0, 3064.0] | [17.0, 17.0] | [603, 791] |
p03628 | u543954314 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n = int(input())\ns1 = input()\ns2 = input()\nmod = 10**9+7\nb = 0\n2did = 0\nans = 0\nif s1[0] == s2[0]:\n b = 1\n ans += 3\nelse:\n 2did = 1\n ans = 6\nfor i in range(1,n):\n if s1[i] == s2[i]:\n if b:\n ans = ans*2%mod\n b = 1\n elif not 2did:\n if b:\n ans = ans*2%mod\n else:\n ans = ans*3%mod\n 2did = 1\n b = 0\n else:\n 2did = 0\nprint(ans)', 'n = int(input())\ns1 = input()\ns2 = input()\nmod = 10**9+7\nb = 0\ndid = 0\nans = 0\nif s1[0] == s2[0]:\n b = 1\n ans += 3\nelse:\n did = 1\n ans = 6\nfor i in range(1,n):\n if s1[i] == s2[i]:\n if b:\n ans = ans*2%mod\n b = 1\n elif not did:\n if b:\n ans = ans*2%mod\n else:\n ans = ans*3%mod\n did = 1\n b = 0\n else:\n did = 0\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s009116644', 's405707007'] | [2940.0, 3064.0] | [17.0, 17.0] | [364, 359] |
p03628 | u631277801 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['MOD = 1000000007\n\nN = int(input())\nS = []\nfor i in range(2):\n S.append(input())\n \n\n# make XYline\nxy = ""\nfor i in range(len(S[0])):\n if S[0][i] == S[1][i]:\n xy += "X"\n elif i==len(S[0])-1:\n break\n elif S[0][i] == S[0][i+1]:\n xy += "Y"\n\n# proceed\nif xy[0] == "X":\n ans = 3\nelse:\n ans = 6\n\nif len(xy)==1:\n pass\nelse:\n for i in range(1,len(xy)):\n if xy[i-1] == "X" and xy[i] == "X":\n ans *= 2\n elif xy[i-1] == "X" and xy[i] == "Y":\n ans *= 2\n elif xy[i-1] == "Y" and xy[i] == "X":\n ans *= 1\n elif xy[i-1] == "Y" and xy[i] == "Y":\n ans *= 3\n\n ans = ans%MOD\n', 'import sys\nstdin = sys.stdin\n\nsys.setrecursionlimit(10 ** 7)\n\ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x) - 1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readline().rstrip()\ndef lc(): return list(ns())\ndef ni(): return int(stdin.readline())\ndef nf(): return float(stdin.readline())\n\n\ndef scan_domino(a: list, b: list):\n n = len(a)\n cnt = 0\n domino = ""\n\n while cnt < n:\n if a[cnt] == b[cnt]:\n domino += "x"\n cnt += 1\n else:\n domino += "y"\n cnt += 2\n\n return domino\n\n\ndef cnt_pattern(domino, mod):\n ans = 3 if domino[0] == "x" else 6\n for dleft, dright in zip(domino[:-1], domino[1:]):\n if dleft == "x" and dright == "x":\n ans *= 2\n elif dleft == "x" and dright == "y":\n ans *= 2\n elif dleft == "y" and dright == "x":\n ans *= 1\n else:\n ans *= 3\n\n ans %= mod\n\n return ans\n\n\nn = ni()\na = lc()\nb = lc()\n\nMOD = 10**9 + 7\n\ndomino = scan_domino(a, b)\npats = cnt_pattern(domino, MOD)\n\nprint(pats)'] | ['Wrong Answer', 'Accepted'] | ['s030461772', 's364445304'] | [3064.0, 3064.0] | [18.0, 18.0] | [680, 1198] |
p03628 | u653807637 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['# encoding:utf-8\nimport sys\n\ndef main():\n\tn = int(input())\n\tstr1 = input()\n\tstr2 = input()\n\n\tptrn = []\n\ti = 0\n\twhile True:\n\t\tif str1[i] == str2[i]:\n\t\t\tptrn.append("t")\n\t\t\ti += 1\n\t\telse:\n\t\t\tptrn.append("y")\n\t\t\ti += 2\n\t\tif i >= n:\n\t\t\tbreak\n\t\n\tprint(ptrn)\n\n\tif ptrn[0] == "t":\n\t\tn_ptrn = 3\n\telse:\n\t\tn_ptrn = 6\n\n\tfor i in range(1, len(ptrn)):\n\t\tprint(n_ptrn)\n\t\tif ptrn[i - 1] == "t" and ptrn[i] == "t":\n\t\t\tn_ptrn = n_ptrn * 2\n\t\telif ptrn[i - 1] == "t" and ptrn[i] == "y":\n\t\t\tn_ptrn = n_ptrn * 2\n\t\telif ptrn[i - 1] == "y" and ptrn[i] == "y":\n\t\t\tn_ptrn = n_ptrn * 3\n\n\tprint(n_ptrn % 1000000007)\n\nif __name__ == \'__main__\':\n\tmain()', '# encoding:utf-8\nimport sys\n\ndef main():\n\tn = int(input())\n\tstr1 = input()\n\tstr2 = input()\n\n\tptrn = []\n\ti = 0\n\twhile True:\n\t\tif str1[i] == str2[i]:\n\t\t\tptrn.append("t")\n\t\t\ti += 1\n\t\telse:\n\t\t\tptrn.append("y")\n\t\t\ti += 2\n\t\tif i >= n:\n\t\t\tbreak\n\t\n\t#print(ptrn)\n\n\tif ptrn[0] == "t":\n\t\tn_ptrn = 3\n\telse:\n\t\tn_ptrn = 6\n\n\tfor i in range(1, len(ptrn)):\n\t\t#print(n_ptrn)\n\t\tif ptrn[i - 1] == "t" and ptrn[i] == "t":\n\t\t\tn_ptrn = n_ptrn * 2\n\t\telif ptrn[i - 1] == "t" and ptrn[i] == "y":\n\t\t\tn_ptrn = n_ptrn * 2\n\t\telif ptrn[i - 1] == "y" and ptrn[i] == "y":\n\t\t\tn_ptrn = n_ptrn * 3\n\n\tprint(n_ptrn % 1000000007)\n\n\n\nif __name__ == \'__main__\':\n\tmain()'] | ['Wrong Answer', 'Accepted'] | ['s346017005', 's623082402'] | [3064.0, 3064.0] | [17.0, 17.0] | [624, 628] |
p03628 | u672620970 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['def check(i,j):\n if i > 0:\n k = S[j][i-1] \n if k in checked and not k in C:\n C.append(k)\n if j > 0:\n l = S[j-1][i]\n if l in checked and not l in C:\n C.append(l)\nN = int(input())\nS = [list(input()) for _ in range(2)]\nans = 1\nchecked = {}\nfor i in range(N):\n for j in range(2):\n p = S[j][i]\n print(p,ans)\n if not p in checked:\n C = []\n check(i,j)\n if j < 1 and S[j+1][i] == p:\n check(i,j+1)\n checked[p] = C\n print(C)\n print([checked[i] for i in C] if C != [] else 0)\n if len(C) > 1:\n if not C[0] in checked[C[-1]]:\n ans = ((ans*3)//2)\n else:\n ans = (ans*(3-len(C)))\n print(ans)\nprint(ans%(10**9+7))', 'def check(i,j):\n if i > 0:\n k = S[j][i-1] \n if k in checked and not k in C:\n C.append(k)\n if j > 0:\n l = S[j-1][i]\n if l in checked and not l in C:\n C.append(l)\nN = int(input())\nS = [list(input()) for _ in range(2)]\nans = 1\nchecked = {}\nfor i in range(N):\n for j in range(2):\n p = S[j][i]\n if not p in checked:\n C = []\n check(i,j)\n if j < 1 and S[j+1][i] == p:\n check(i,j+1)\n checked[p] = C\n if len(C) > 1:\n if not C[0] in checked[C[-1]]:\n ans = ((ans*3)//2)\n else:\n ans = (ans*(3-len(C)))\nprint(ans%(10**9+7))'] | ['Wrong Answer', 'Accepted'] | ['s052438882', 's753911493'] | [3064.0, 3064.0] | [18.0, 18.0] | [839, 713] |
p03628 | u778204640 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['M = 10**9+7\nn = int(input())\ns = input()\nt = input()\nans = 3 if s[0] == t[0] else 6\nfor i in range(1, n):\n if s[i-1] == s[i]:\n continue\n if s[i-1] == t[i-1]:\n ans = ans * 2 % M\n else if s[i] != t[i]:\n ans = ans * 3 % M\nprint(ans)', 'M = 10**9+7\nn = int(input())\ns = input()\nt = input()\nans = 3 if s[0] == t[0] else 6\nfor i in range(1, n):\n if s[i-1] == s[i]:\n continue\n if s[i-1] == t[i-1]:\n ans = ans * 2 % M\n elif s[i] != t[i]:\n ans = ans * 3 % M\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s698548777', 's328390154'] | [2940.0, 3064.0] | [18.0, 17.0] | [241, 238] |
p03628 | u970197315 | 2,000 | 262,144 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors. Find the number of such ways to paint the dominoes, modulo 1000000007. The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner: * Each domino is represented by a different English letter (lowercase or uppercase). * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left. | ['n=int(input())\ns=input()\nt=input()\nn=len(s)\nmod=10**9+7\nans=1\ni=0\nwhile i<n:\n if i==0:\n if s[i]==t[i]: \n ans*=3\n i+=1\n else:\n ans*=3\n i+=2\n continue\n if s[i-1]!=t[i-1] and s[i]==t[i]:\n ans*=1\n i+=1\n elif s[i-1]==t[i-1] and s[i]!=t[i]:\n ans*=2\n i+=2\n elif s[i-1]!=t[i-1] and s[i]!=t[i]:\n ans*=3\n i+=2\n elif s[i-1]==t[i-1] and s[i]==t[i]:\n ans*=2\n i+=1\n ans%=mod\nprint(ans)\n', 'n=int(input())\ns=input()\nt=input()\nn=len(s)\nmod=10**9+7\nans=1\ni=0\nwhile i<n:\n if i==0:\n if s[i]==t[i]: \n ans*=3\n i+=1\n else:\n ans*=6\n i+=2\n continue\n if s[i-1]!=t[i-1] and s[i]==t[i]:\n ans*=1\n i+=1\n elif s[i-1]==t[i-1] and s[i]!=t[i]:\n ans*=2\n i+=2\n elif s[i-1]!=t[i-1] and s[i]!=t[i]:\n ans*=3\n i+=2\n elif s[i-1]==t[i-1] and s[i]==t[i]:\n ans*=2\n i+=1\n ans%=mod\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s136346228', 's174711480'] | [3064.0, 3064.0] | [18.0, 18.0] | [431, 431] |
p03629 | u102461423 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ["import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n", "import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n", "import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n", "import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n", "import sys\ninput = sys.stdin.readline\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n\nINF = 10 ** 9\nN = len(S)\ndp = [None] * (N+1)\n\ndp[N] = [[INF] * 26, [0] * 26, 0]\n\nfor n in range(N-1,-1,-1):\n prev = dp[n+1]\n cur = [prev[0].copy(), prev[1].copy(), prev[2]]\n s = S[n]\n cur[0][s] = n\n cur[1][s] = prev[2] // 26 + 1\n cur[2] = prev[2] + cur[1][s] - prev[1][s]\n dp[n] = cur\n\nanswer = []\ni = 0\nwhile i < N:\n \n L = dp[i][2] // 26\n for x in range(26):\n if dp[i][1][x] == L:\n break\n answer.append(chr(ord('a') + x))\n \n i = dp[i][0][x]\n i += 1\n\nprint(''.join(answer))", "import sys\ninput = sys.stdin.readline\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n\nINF = 10 ** 9\nN = len(S)\ndp = [None] * (N+1)\n\ndp[N] = [[INF] * 26, [0] * 26, 0]\n\nfor n in range(N-1,-1,-1):\n prev = dp[n+1]\n cur = [prev[0].copy(), prev[1].copy(), prev[2]]\n s = S[n]\n cur[0][s] = n\n cur[1][s] = prev[2] // 26 + 1\n cur[2] = prev[2] + cur[1][s] - prev[1][s]\n dp[n] = cur\n\nanswer = []\ni = 0\nwhile i < N:\n \n L = dp[i][2] // 26\n for x in range(26):\n if dp[i][1][x] == L:\n break\n answer.append(chr(ord('a') + x))\n \n i = dp[i][0][x]\n i += 1\n\nprint(''.join(answer))", "import sys\ninput = sys.stdin.readline\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n\nINF = 10 ** 9\nN = len(S)\ndp = [None] * (N+1)\n\ndp[N] = [[INF] * 26, [0] * 26, 0]\n\nfor n in range(N-1,-1,-1):\n prev = dp[n+1]\n cur = [prev[0].copy(), prev[1].copy(), prev[2]]\n s = S[n]\n cur[0][s] = n\n cur[1][s] = prev[2] // 26 + 1\n cur[2] = prev[2] + cur[1][s] - prev[1][s]\n dp[n] = cur\n\nanswer = []\ni = 0\nwhile i < N:\n \n L = dp[i][2] // 26\n for x in range(26):\n if dp[i][1][x] == L:\n break\n answer.append(chr(ord('a') + x))\n \n i = dp[i][0][x]\n i += 1\n\nprint(''.join(answer))", "import sys\ninput = sys.stdin.readline\n\nS = [ord(s) - ord('a') for s in input().rstrip()]\n\nINF = 10 ** 9\nN = len(S)\ndp = [None] * (N+1)\n\ndp[N] = [[INF] * 26, [0] * 26, 0]\n\nfor n in range(N-1,-1,-1):\n prev = dp[n+1]\n cur = [prev[0].copy(), prev[1].copy(), prev[2]]\n s = S[n]\n cur[0][s] = n\n cur[1][s] = prev[2] // 26 + 1\n cur[2] = prev[2] + cur[1][s] - prev[1][s]\n dp[n] = cur\n\nanswer = []\ni = 0\nwhile i < N:\n \n L = dp[i][2] // 26\n for x in range(26):\n if dp[i][1][x] == L:\n break\n answer.append(chr(ord('a') + x))\n \n i = dp[i][0][x]\n i += 1\n\nprint(''.join(answer))"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s809537854', 's809537854', 's809537854', 's809537854', 's686455081', 's686455081', 's686455081', 's686455081'] | [21912.0, 21912.0, 21912.0, 21912.0, 156836.0, 156836.0, 156836.0, 156836.0] | [276.0, 276.0, 276.0, 276.0, 1069.0, 1069.0, 1069.0, 1069.0] | [108, 108, 108, 108, 842, 842, 842, 842] |
p03629 | u297574184 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ["from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nfor ch in CHARACTERs:\n posChars[ch] = posChars[ch][::-1]\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nfor ch in CHARACTERs:\n posChars[ch] = posChars[ch][::-1]\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nfor ch in CHARACTERs:\n posChars[ch] = posChars[ch][::-1]\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n", "from bisect import bisect_left\n\nCHARACTERs = 'abcdefghijklmnopqrstuvwxyz'\n\nAs = input()\nlenA = len(As)\n\nposChars = dict([(ch, [lenA]) for ch in CHARACTERs])\ndp = [0] * lenA + [1, 0]\nfor i in reversed(range(lenA)):\n posChars[As[i]].append(i)\n dp[i] = min([dp[posChars[ch][-1] + 1] for ch in CHARACTERs]) + 1\n\nfor ch in CHARACTERs:\n posChars[ch] = posChars[ch][::-1]\n\nans = []\ni = 0\nfor k in reversed(range(dp[0])):\n for ch in CHARACTERs:\n pos = posChars[ch][bisect_left(posChars[ch], i)]\n if dp[pos + 1] == k:\n ans.append(ch)\n i = pos + 1\n break\n\nprint(''.join(ans))\n"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s898187656', 's898187656', 's898187656', 's898187656', 's139255297', 's139255297', 's139255297', 's139255297'] | [19404.0, 19404.0, 19404.0, 19404.0, 19556.0, 19556.0, 19556.0, 19556.0] | [1119.0, 1119.0, 1119.0, 1119.0, 1072.0, 1072.0, 1072.0, 1072.0] | [564, 564, 564, 564, 625, 625, 625, 625] |
p03629 | u340781749 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ["from string import ascii_lowercase\n\n\ndef solve(s):\n d = [('', 0)]\n while True:\n e = []\n ans = set()\n for ds, di in d:\n max_ci = -1\n for c in ascii_lowercase:\n ci = s.find(c, di) + 1\n if max_ci >= ci:\n continue\n max_ci = ci\n ns = ds + c\n if not ci:\n ans.add(ns)\n continue\n e.append((ns, ci))\n if ans:\n return min(ans)\n d = e\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\n\n\ndef solve(s):\n d = [('', 0)]\n while True:\n e = []\n ans = set()\n for ds, di in d:\n max_ci = -1\n for c in ascii_lowercase:\n ci = s.find(c, di) + 1\n if max_ci >= ci:\n continue\n max_ci = ci\n ns = ds + c\n if not ci:\n ans.add(ns)\n continue\n e.append((ns, ci))\n if ans:\n return min(ans)\n d = e\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\n\n\ndef solve(s):\n d = [('', 0)]\n while True:\n e = []\n ans = set()\n for ds, di in d:\n max_ci = -1\n for c in ascii_lowercase:\n ci = s.find(c, di) + 1\n if max_ci >= ci:\n continue\n max_ci = ci\n ns = ds + c\n if not ci:\n ans.add(ns)\n continue\n e.append((ns, ci))\n if ans:\n return min(ans)\n d = e\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\n\n\ndef solve(s):\n d = [('', 0)]\n while True:\n e = []\n ans = set()\n for ds, di in d:\n max_ci = -1\n for c in ascii_lowercase:\n ci = s.find(c, di) + 1\n if max_ci >= ci:\n continue\n max_ci = ci\n ns = ds + c\n if not ci:\n ans.add(ns)\n continue\n e.append((ns, ci))\n if ans:\n return min(ans)\n d = e\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\nfrom bisect import bisect\n\n\ndef solve(s):\n pos = [[] for _ in range(26)]\n offset = ord('a')\n for i, c in enumerate(s):\n c = ord(c) - offset\n pos[c].append(i)\n for l in pos:\n l.append(len(s))\n\n all_char_sequence_start_pos = []\n pos_i = [len(l) - 1 for l in pos]\n while all(pi >= 0 for pi in pos_i):\n i = min(l[pi] for pi, l in zip(pos_i, pos))\n all_char_sequence_start_pos.append(i)\n for j in range(26):\n while pos_i[j] >= 0 and pos[j][pos_i[j]] >= i:\n pos_i[j] -= 1\n all_char_sequence_start_pos.reverse()\n ans = []\n curr = -1\n for i in all_char_sequence_start_pos:\n for c in range(26):\n cj = bisect(pos[c], curr)\n j = pos[c][cj]\n if j >= i:\n ans.append(c)\n curr = j\n break\n return ''.join(chr(c + offset) for c in ans)\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\nfrom bisect import bisect\n\n\ndef solve(s):\n pos = [[] for _ in range(26)]\n offset = ord('a')\n for i, c in enumerate(s):\n c = ord(c) - offset\n pos[c].append(i)\n for l in pos:\n l.append(len(s))\n\n all_char_sequence_start_pos = []\n pos_i = [len(l) - 1 for l in pos]\n while all(pi >= 0 for pi in pos_i):\n i = min(l[pi] for pi, l in zip(pos_i, pos))\n all_char_sequence_start_pos.append(i)\n for j in range(26):\n while pos_i[j] >= 0 and pos[j][pos_i[j]] >= i:\n pos_i[j] -= 1\n all_char_sequence_start_pos.reverse()\n ans = []\n curr = -1\n for i in all_char_sequence_start_pos:\n for c in range(26):\n cj = bisect(pos[c], curr)\n j = pos[c][cj]\n if j >= i:\n ans.append(c)\n curr = j\n break\n return ''.join(chr(c + offset) for c in ans)\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\nfrom bisect import bisect\n\n\ndef solve(s):\n pos = [[] for _ in range(26)]\n offset = ord('a')\n for i, c in enumerate(s):\n c = ord(c) - offset\n pos[c].append(i)\n for l in pos:\n l.append(len(s))\n\n all_char_sequence_start_pos = []\n pos_i = [len(l) - 1 for l in pos]\n while all(pi >= 0 for pi in pos_i):\n i = min(l[pi] for pi, l in zip(pos_i, pos))\n all_char_sequence_start_pos.append(i)\n for j in range(26):\n while pos_i[j] >= 0 and pos[j][pos_i[j]] >= i:\n pos_i[j] -= 1\n all_char_sequence_start_pos.reverse()\n ans = []\n curr = -1\n for i in all_char_sequence_start_pos:\n for c in range(26):\n cj = bisect(pos[c], curr)\n j = pos[c][cj]\n if j >= i:\n ans.append(c)\n curr = j\n break\n return ''.join(chr(c + offset) for c in ans)\n\n\nprint(solve(input().strip()))\n", "from string import ascii_lowercase\nfrom bisect import bisect\n\n\ndef solve(s):\n pos = [[] for _ in range(26)]\n offset = ord('a')\n for i, c in enumerate(s):\n c = ord(c) - offset\n pos[c].append(i)\n for l in pos:\n l.append(len(s))\n\n all_char_sequence_start_pos = []\n pos_i = [len(l) - 1 for l in pos]\n while all(pi >= 0 for pi in pos_i):\n i = min(l[pi] for pi, l in zip(pos_i, pos))\n all_char_sequence_start_pos.append(i)\n for j in range(26):\n while pos_i[j] >= 0 and pos[j][pos_i[j]] >= i:\n pos_i[j] -= 1\n all_char_sequence_start_pos.reverse()\n ans = []\n curr = -1\n for i in all_char_sequence_start_pos:\n for c in range(26):\n cj = bisect(pos[c], curr)\n j = pos[c][cj]\n if j >= i:\n ans.append(c)\n curr = j\n break\n return ''.join(chr(c + offset) for c in ans)\n\n\nprint(solve(input().strip()))\n"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s493445484', 's493445484', 's493445484', 's493445484', 's751992509', 's751992509', 's751992509', 's751992509'] | [193476.0, 193476.0, 193476.0, 193476.0, 12524.0, 12524.0, 12524.0, 12524.0] | [2116.0, 2116.0, 2116.0, 2116.0, 171.0, 171.0, 171.0, 171.0] | [577, 577, 577, 577, 975, 975, 975, 975] |
p03629 | u353797797 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ['\nimport sys\nimport numpy as np\n\ndef main():\n inf = 10 ** 7\n s = sys.stdin.readline()[:-1]\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = np.zeros(26, "i8")\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n \n \n \n min_size_code = size.argmin()[0]\n now_code = ord(s[i]) - 97\n size[now_code] = size[min_size_code] + 1\n pos[now_code] = i\n nxt[i] = pos[min_size_code]\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size_code = size.argmin()[0]\n i = pos[min_size_code]\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', '\nimport sys\nimport numpy as np\n\ndef main():\n inf = 10 ** 7\n s = sys.stdin.readline()[:-1]\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = np.zeros(26, "i8")\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n \n \n \n min_size_code = size.argmin()[0]\n now_code = ord(s[i]) - 97\n size[now_code] = size[min_size_code] + 1\n pos[now_code] = i\n nxt[i] = pos[min_size_code]\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size_code = size.argmin()[0]\n i = pos[min_size_code]\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', '\nimport sys\nimport numpy as np\n\ndef main():\n inf = 10 ** 7\n s = sys.stdin.readline()[:-1]\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = np.zeros(26, "i8")\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n \n \n \n min_size_code = size.argmin()[0]\n now_code = ord(s[i]) - 97\n size[now_code] = size[min_size_code] + 1\n pos[now_code] = i\n nxt[i] = pos[min_size_code]\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size_code = size.argmin()[0]\n i = pos[min_size_code]\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', '\nimport sys\nimport numpy as np\n\ndef main():\n inf = 10 ** 7\n s = sys.stdin.readline()[:-1]\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = np.zeros(26, "i8")\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n \n \n \n min_size_code = size.argmin()[0]\n now_code = ord(s[i]) - 97\n size[now_code] = size[min_size_code] + 1\n pos[now_code] = i\n nxt[i] = pos[min_size_code]\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size_code = size.argmin()[0]\n i = pos[min_size_code]\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef main():\n inf = 10 ** 7\n s = input()\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = [0] * 26\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n min_size = inf\n min_pos = -1\n \n \n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n code = ord(s[i]) - 97\n size[code] = min_size + 1\n pos[code] = i\n nxt[i] = min_pos\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size = inf\n min_pos = -1\n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n i = min_pos\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef main():\n inf = 10 ** 7\n s = input()\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = [0] * 26\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n min_size = inf\n min_pos = -1\n \n \n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n code = ord(s[i]) - 97\n size[code] = min_size + 1\n pos[code] = i\n nxt[i] = min_pos\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size = inf\n min_pos = -1\n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n i = min_pos\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef main():\n inf = 10 ** 7\n s = input()\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = [0] * 26\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n min_size = inf\n min_pos = -1\n \n \n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n code = ord(s[i]) - 97\n size[code] = min_size + 1\n pos[code] = i\n nxt[i] = min_pos\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size = inf\n min_pos = -1\n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n i = min_pos\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef main():\n inf = 10 ** 7\n s = input()\n n = len(s)\n s += "".join(chr(i + 97) for i in range(26))\n # print(s)\n \n size = [0] * 26\n pos = [n + i for i in range(26)]\n \n nxt = [-1] * n\n \n for i in range(n - 1, -1, -1):\n min_size = inf\n min_pos = -1\n \n \n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n code = ord(s[i]) - 97\n size[code] = min_size + 1\n pos[code] = i\n nxt[i] = min_pos\n # print(size)\n # print(pos)\n # print(nxt)\n # print()\n \n min_size = inf\n min_pos = -1\n for sz, p in zip(size, pos):\n if sz < min_size:\n min_size = sz\n min_pos = p\n i = min_pos\n ans = s[i]\n while i < n:\n i = nxt[i]\n ans += s[i]\n print(ans)\n\nmain()\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s408271928', 's408271928', 's408271928', 's408271928', 's157107151', 's157107151', 's157107151', 's157107151'] | [14540.0, 14540.0, 14540.0, 14540.0, 5860.0, 5860.0, 5860.0, 5860.0] | [153.0, 153.0, 153.0, 153.0, 388.0, 388.0, 388.0, 388.0] | [1141, 1141, 1141, 1141, 1469, 1469, 1469, 1469] |
p03629 | u466826467 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ['import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n # print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n # print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n # print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n', 'import string\n\nif __name__ == \'__main__\':\n A = input()\n\n p = {}\n for x in string.ascii_lowercase:\n p[x] = len(A)\n # print(p)\n \n tb = [(0, 0, 0)] * len(A)\n tb.append((1, 0, 0))\n tb.append((0, 0, 0))\n # print(tb)\n for i, x in reversed(list(enumerate(A))):\n p[x] = i\n tb[i] = min([(tb[p[c] + 1][0] + 1, c, p[c] + 1) for c in string.ascii_lowercase])\n # print(tb)\n i = 0\n ans = []\n while i < len(A):\n ans.append(tb[i][1])\n i = tb[i][2]\n\n print("".join(ans))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s503911068', 's503911068', 's503911068', 's503911068', 's203492912', 's203492912', 's203492912', 's203492912'] | [100748.0, 100748.0, 100748.0, 100748.0, 52964.0, 52964.0, 52964.0, 52964.0] | [2105.0, 2105.0, 2105.0, 2105.0, 1877.0, 1877.0, 1877.0, 1877.0] | [620, 620, 620, 620, 622, 622, 622, 622] |
p03629 | u532966492 | 2,000 | 262,144 | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all subsequences of `artistic`; `abc` and `ci` are not. You are given a string A consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A. If there are more than one such string, find the lexicographically smallest one among them. | ['def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n memo[i][y]=memo[i+1][y]\n\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items(): \n memo[i][y]=memo[i+1][y]\n memo[i][alpha2[s[i]]]=i+1\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n if s[i]==x:\n memo[i][y]=i+1\n else:\n memo[i][y]=memo[i+1][y]\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n if s[i]==x:\n memo[i][y]=i+1\n else:\n memo[i][y]=memo[i+1][y]\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n if s[i]==x:\n memo[i][y]=i+1\n else:\n memo[i][y]=memo[i+1][y]\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()', 'def main():\n import sys\n input=sys.stdin.readline\n s=input()\n alpha="abcdefghijklmnopqrstuvwxyz"\n l=len(s)\n alpha2={j:i for i,j in enumerate(alpha)}\n memo=[[0]*26 for _ in range(l,-1,-1)]\n for i in range(26):\n memo[l][i]=l+1\n for i in range(l-1,-1,-1):\n for x,y in alpha2.items():\n if s[i]==x:\n memo[i][y]=i+1\n else:\n memo[i][y]=memo[i+1][y]\n \n search=[1]*(l+2)\n search[l+1]=0\n for i in range(l-1,-1,-1):\n m=max([memo[i][j] for j in range(26)])\n if m!=l+1:\n search[i]=search[m]+1\n \n n,seq=0,0\n ans_len=search[0]\n ans=""\n temp=0\n for i in range(ans_len):\n for j in range(26):\n n=memo[temp][j]\n seq=search[n]+i\n if seq+1==ans_len:\n ans+=alpha[j]\n temp=memo[temp][j]\n break\n print(ans)\nif __name__==\'__main__\':\n main()'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted', 'Accepted', 'Accepted', 'Accepted'] | ['s094610117', 's094610117', 's129459851', 's129459851', 's282288346', 's282288346', 's568690078', 's568690078', 's652842911', 's652842911', 's760666636', 's760666636', 's913750536', 's913750536', 's094610117', 's094610117', 's129459851', 's129459851', 's282288346', 's282288346', 's568690078', 's568690078', 's652842911', 's652842911', 's760666636', 's760666636', 's913750536', 's913750536', 's916216831', 's916216831', 's916216831', 's916216831'] | [61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 64820.0, 64820.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 61236.0, 64820.0, 64820.0, 61236.0, 61236.0, 61236.0, 61236.0, 75276.0, 75276.0, 75276.0, 75276.0] | [248.0, 248.0, 237.0, 237.0, 247.0, 247.0, 234.0, 234.0, 1449.0, 1449.0, 233.0, 233.0, 241.0, 241.0, 248.0, 248.0, 237.0, 237.0, 247.0, 247.0, 234.0, 234.0, 1449.0, 1449.0, 233.0, 233.0, 241.0, 241.0, 1962.0, 1962.0, 1962.0, 1962.0] | [917, 917, 908, 908, 908, 908, 907, 907, 873, 873, 908, 908, 913, 913, 917, 917, 908, 908, 908, 908, 907, 907, 873, 873, 908, 908, 913, 913, 954, 954, 954, 954] |
p03631 | u000113982 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['n = int(input())\nif (int)n/100==n%10:\n print("Yes")\nelse:\n print("No")', 'n = input()\nif n[0]==n[2]:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s858712974', 's559540435'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 65] |
p03631 | u004025573 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['N=int(input())\n\nif N//100=N%10:\n print("Yes")\nelse:\n print("No")\n ', 'N=int(input())\n\nif N//100==N%10:\n print("Yes")\nelse:\n print("No")\n '] | ['Runtime Error', 'Accepted'] | ['s483435093', 's359998012'] | [2940.0, 2940.0] | [17.0, 17.0] | [69, 70] |
p03631 | u007550226 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ["n = input()\nif n = n[::-1]:\n print('Yes')\nelse:\n print('No')", "n = input()\nif n == n[::-1]:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s211000109', 's413168037'] | [2940.0, 2940.0] | [17.0, 18.0] | [62, 63] |
p03631 | u008357982 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ["print('YNeos'[input()!=input()[::-1]::2])", "n=input();print('YNeos'[n!=n[::-1]::2])"] | ['Runtime Error', 'Accepted'] | ['s395579655', 's484038897'] | [2940.0, 2940.0] | [17.0, 17.0] | [41, 39] |
p03631 | u008992227 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['a,b,c=input()\nprint("YES" if a==c else "NO")', 'a,b,c=input()\nprint("Yes" if a==c else "No")'] | ['Wrong Answer', 'Accepted'] | ['s437963994', 's298619561'] | [3064.0, 2940.0] | [17.0, 17.0] | [44, 44] |
p03631 | u015993380 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ["n = input()\nprint('Yes' if n[0] == n[1] else 'No')", "n = input()\nprint('Yes' if n[0] == n[2] else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s400986185', 's417440146'] | [2940.0, 2940.0] | [17.0, 17.0] | [50, 50] |
p03631 | u027641915 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['a,b,c = input()\nprint("Yes" if a == c else: "No")', "a,b,c = input()\nprint('Yes' if a == c else: 'No')", 'a,b,c = input()\nprint("Yes" if a == c else: "No")', "a,b,c = input()\nprint('Yes' if a == c:else: 'No')", 'a,b,c=input()\nprint("Yes" if a==c else "No")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s487515563', 's562428917', 's587968404', 's806618692', 's134098484'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [49, 49, 49, 49, 44] |
p03631 | u030726788 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['N=input()\nif(N[0]==N[1]):\n print("Yes")\nelse:\n print("No")', 'N=input()\nif(N[0]==N[2]):\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s230753603', 's509419804'] | [2940.0, 2940.0] | [17.0, 17.0] | [60, 61] |
p03631 | u039192119 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['a,b,c=int(input())\nif a==c:\n print("Yes")\nelse:\n print("No")', 'a,b,c=input()\nif a==c:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s025784381', 's622581554'] | [2940.0, 2940.0] | [17.0, 17.0] | [62, 57] |
p03631 | u041075929 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ["import sys, os\n\nf = lambda:list(map(int,input().split()))\nif 'local' in os.environ :\n sys.stdin = open('./input.txt', 'r')\n\ndef solve():\n s = input()\n\n for i in range(len(s)/2):\n if s[i] = s[len(s)-1 -i]:\n print('No')\n return\n \n print('Yes')\n\nsolve()\n", "import sys, os\n\nf = lambda:list(map(int,input().split()))\nif 'local' in os.environ :\n sys.stdin = open('./input.txt', 'r')\n\ndef solve():\n s = input()\n\n\n for i in range(len(s)//2):\n if s[i] != s[len(s)-1 -i]:\n print('No')\n return\n \n print('Yes')\n\nsolve()\n"] | ['Runtime Error', 'Accepted'] | ['s020376332', 's916198071'] | [2940.0, 2940.0] | [17.0, 17.0] | [295, 298] |
p03631 | u041297389 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['a,b,c,d = map(int, input().split())\nif a==c:\n print(abs(b-d))\nelif a>c:\n if a>d:\n print(0)\n elif a<d<b:\n print(abs(a-d))\n else:\n print(abs(a-b))\nelse:\n if c>b:\n print(0)\n elif c<b<d:\n print(abs(c-b))\n else:\n print(abs(c-d))', "x = input()↲\nif x[0] == x[2]:↲\n print('Yes')↲\nelse:↲\n print('No')↲", 'a,b,c,d = map(int, input().split())\nif a==c:\n print(abs(b-d))\nelif a>c:\n if a>d:\n print(0)\n elif a<d<b:\n print(abs(a-d))\n else:\n print(abs(a-b))\nelse:\n if c>b:\n print(0)\n elif c<b<d:\n print(abs(c-b))\n else:\n print(abs(c-d))', 'a,b,c,d = map(int, input().split())\nif a==c:\n print(abs(b-d))\nelif a>c:\n if a>d:\n print(0)\n elif a<d<b:\n print(abs(a-d))\n else:\n print(abs(a-b))\nelse:\n if c>b:\n print(0)\n elif c<b<d:\n print(abs(c-b))\n else:\n print(abs(c-d))', "x = input()\nif x[0] == x[2]:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s039833280', 's196348585', 's703087095', 's835305171', 's733390625'] | [3064.0, 3064.0, 3060.0, 3060.0, 2940.0] | [17.0, 18.0, 17.0, 17.0, 17.0] | [286, 82, 286, 286, 67] |
p03631 | u045408189 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['N=input()\nprint("Yes" if N[0]=N[2] else "No")', 'N=input()\nprint("Yes" if N[0]==N[2] else "No")\n'] | ['Runtime Error', 'Accepted'] | ['s094209173', 's191857224'] | [2940.0, 2940.0] | [17.0, 17.0] | [45, 47] |
p03631 | u046592970 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['n = input()\nif n == n[::-1]:\n print("YES")\nelse:\n print("NO")', 'n = input()\nx = n[::-1]\nif n == x:\n print("YES")\nelse:\n print("NO")\n', 'n = input()\nif n == n[::-1]:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s453861038', 's803166156', 's136755274'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [67, 74, 67] |
p03631 | u047535298 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['n = int(input())\n\nlcm = 0\ngcd = 0\n\nfor i in range(n):\n t = int(input())\n if(i == 0):\n lcm, gcd = t, t\n continue\n lcm = t\n r = gcd % t\n while(r!=0):\n lcm = r\n r = t % r\n gcd *= t\n gcd //= lcm\nprint(gcd)\n', 'n = input()\nprint("Yes" if(n[0]==n[2]) else "No")'] | ['Runtime Error', 'Accepted'] | ['s835949078', 's372076048'] | [3060.0, 2940.0] | [17.0, 17.0] | [251, 49] |
p03631 | u050641473 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['N = input()\n\nif N == N[::-1]:\n print("YES")\nelse:\n print("NO")', 'N = input()\n\nif N == N[::-1]:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s239207691', 's585642621'] | [2940.0, 2940.0] | [17.0, 18.0] | [64, 64] |
p03631 | u054717609 | 2,000 | 262,144 | You are given a three-digit positive integer N. Determine whether N is a _palindromic number_. Here, a palindromic number is an integer that reads the same backward as forward in decimal notation. | ['n=input()\nn=int(n)\nog=n\nrev=0\nwhile(n>0):\n d=n%10 \n n=n/10\n rev=rev*10+d\nif(rev==og):\n print("Yes")\nelse:\n print("No")\n \n \n \n\n\n \n', 'n=input()\nn=int(n)\nog=n\nrev=0\nwhile(n>0):\n d=n%10\n n=n/10\n rev=rev+d\nif(og==rev):\n print("Yes)\n else:\n print("No") \n', 'n=input()\nn=int(n)\nog=n\nrev=0\nwhile(n>0):\n d=n%10 \n n=n//10\n rev=rev*10+d\nif(rev==og):\n print("Yes")\nelse:\n print("No")\n \n \n \n\n\n \n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s012830878', 's981672710', 's221477615'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [163, 137, 164] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.