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
p03287
u623819879
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['import sys\nsys.setrecursionlimit(1000000)\n#def input():\n# return sys.stdin.readline()[:-1]\n\n\n\ntest_data1 = \'\'\'\\\n3 2\n4 1 5\n\'\'\'\n\ntest_data2 = \'\'\'\\\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\'\'\'\n\ntest_data3 = \'\'\'\\\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\'\'\'\ntd_num=3\n\ndef GetTestData(index):\n if index==1:\n return test_data1\n if index==2:\n return test_data2\n if index==3:\n return test_data3\n \nif True:\n with open("../test.txt", mode=\'w\') as f:\n f.write(GetTestData(td_num))\n with open("../test.txt") as f:\n # Start Input code ---------------------------------------\n n,m=map(int,f.readline().split())\n a=list(map(int,f.readline().split()))\n # End Input code ---------------------------------------\nelse:\n # Start Input code ---------------------------------------\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n # End Input code ---------------------------------------\n\npre=0\nacc=[0]*n\ncnt=dict()\nfor i in range(n):\n pre+=a[i]\n pre=pre%m\n acc[i]=pre\n if pre in cnt:\n cnt[pre]+=1\n else:\n cnt[pre]=1\nfor i in range(n):\n acc\ndef comb(nn,rr):\n rr=min(rr,nn-rr)\n rt=1\n for i in range(rr):\n #rt=rt*(nn-i)/(rr-i)\n rt*=(nn-i)\n for i in range(rr):\n rt//=(rr-i)\n return int(rt)\nans=0\nfor i in cnt:\n cc=cnt[i]\n if cc>1: ans+=comb(cc,2)\nif 0 in cnt: ans+=cnt[0]\n#print(ans,\'n,m=\',n,m,\' a=\',a,\'acc=\',acc,\'cnt=\',cnt)\nprint(ans)\n#ans=count(0)+2^(count(n)-1)', 'import sys\nsys.setrecursionlimit(1000000)\n#def input():\n# return sys.stdin.readline()[:-1]\n\n\n\ntest_data1 = \'\'\'\\\n3 2\n4 1 5\n\'\'\'\n\ntest_data2 = \'\'\'\\\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\'\'\'\n\ntest_data3 = \'\'\'\\\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\'\'\'\ntd_num=3\n\ndef GetTestData(index):\n if index==1:\n return test_data1\n if index==2:\n return test_data2\n if index==3:\n return test_data3\n \nif False:\n with open("../test.txt", mode=\'w\') as f:\n f.write(GetTestData(td_num))\n with open("../test.txt") as f:\n # Start Input code ---------------------------------------\n n,m=map(int,f.readline().split())\n a=list(map(int,f.readline().split()))\n # End Input code ---------------------------------------\nelse:\n # Start Input code ---------------------------------------\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n # End Input code ---------------------------------------\n\npre=0\nacc=[0]*n\ncnt=dict()\nfor i in range(n):\n pre+=a[i]\n pre=pre%m\n acc[i]=pre\n if pre in cnt:\n cnt[pre]+=1\n else:\n cnt[pre]=1\nfor i in range(n):\n acc\ndef comb(nn,rr):\n rr=min(rr,nn-rr)\n rt=1\n for i in range(rr):\n #rt=rt*(nn-i)/(rr-i)\n rt*=(nn-i)\n for i in range(rr):\n rt//=(rr-i)\n return int(rt)\nans=0\nfor i in cnt:\n cc=cnt[i]\n if cc>1: ans+=comb(cc,2)\nif 0 in cnt: ans+=cnt[0]\n#print(ans,\'n,m=\',n,m,\' a=\',a,\'acc=\',acc,\'cnt=\',cnt)\nprint(ans)\n#ans=count(0)+2^(count(n)-1)']
['Runtime Error', 'Accepted']
['s069834382', 's103394640']
[3064.0, 14748.0]
[18.0, 143.0]
[2464, 2465]
p03287
u634461820
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nn = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nN,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\ndata = {}\n\ntmp = 0\nfor i in range(N):\n tmp += a[i]\n if tmp%M not in data:\n data[tmp%M] = 1\n else:\n data[tmp%M] += 1\nelse:\n data[0] += 1\n\ncnt = list(data.values())\nans = 0\nfor i in cnt:\n if i == 0:\n continue\n else:\n ans += cmb(i,2,mod)\nprint(ans)', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nn = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nN,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\ndata = {}\n\ntmp = 0\nfor i in range(N):\n tmp += a[i]\n if tmp%M not in data:\n data[tmp%M] = 1\n else:\n data[tmp%M] += 1\nelse:\n data[0] += 1\n\ncnt = list(data.values())\nans = 0\nfor i in cnt:\n if i == 1:\n continue\n else:\n ans += cmb(i,2,mod)\nprint(ans)', 'N, M = list(map(int, input().split()))\n\nD = list(map(int, input().split()))\n\nS = {0 : 1}\nt = 0\nfor i in range(N):\n t = (t + D[i]) % M\n if t in S:\n S[t] += 1\n else:\n S[t] = 1\n\nr = 0\n\nfor i in S.values():\n r += i * (i - 1) // 2\n \nprint(r)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s060344090', 's421570434', 's734819495']
[15372.0, 15688.0, 14224.0]
[108.0, 104.0, 91.0]
[794, 794, 248]
p03287
u638725699
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n, m = map(int, input().split())\nd = {0: 1}\nasum = 0\nans = 0\nfor a in map(int, input().split()):\n asum = (asum + a) % m\n if asum in d:\n ans += d[asum]\n d[asum] += 1\n else:\n d[asum] = 1\nprint(ans', 'n, m = map(int, input().split())\nd = {0: 1}\nasum = 0\nans = 0\nfor a in map(int, input().split()):\n asum = (asum + a) % m\n if asum in d:\n ans += d[asum]\n d[asum] += 1\n else:\n d[asum] = 1\nprint(ans)']
['Runtime Error', 'Accepted']
['s309671821', 's389060272']
[3060.0, 16100.0]
[17.0, 90.0]
[224, 225]
p03287
u652081898
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['from collections import Counter\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nSUM = [0]\n\nfor i in a:\n SUM.append((SUM[-1]+i)%m)\n\n#SUM.pop(0)\nc = Counter(SUM)\nC = c.most_common()\nC_srt = sorted(C)\nans = 0\n\nfor i in C:\n if i[1] > 1:\n if i[0] == 0:\n ans += i[1]*(i[1]+1)//2\n else:\n ans += i[1]*(i[1]-1)//2\n else:\n break\nprint(ans)\n', 'from collections import Counter\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nSUM = [0]\n\nfor i in a:\n SUM.append((SUM[-1]+i)%m)\n\nc = Counter(SUM)\nC = c.most_common()\nC_srt = sorted(C)\nans = 0\n\nfor i in C:\n if i[1] > 1:\n ans += i[1]*(i[1]-1)//2\n else:\n break\nprint(ans)']
['Wrong Answer', 'Accepted']
['s756254993', 's082419559']
[19620.0, 19624.0]
[155.0, 153.0]
[404, 315]
p03287
u658993896
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['N, M = [int(x) for x in input().split()]\n\nsum_c = 0\ndic = {0:1}\nfor x in input().split():\n x = int(x)\n sum_c += x\n a = sum_c//M\n \n if dic.get(a,0) == 0:\n dic[a] = 1\n else:\n dic[a] += 1\n\nans = 0\nans += dic[0]*(dic[0]-1)\n\nfor v in dic.values():\n ans += v*(v-1)\n\nprint(ans)', 'N, M = [int(x) for x in input().split()]\n\nsum_c = 0\ndic = {0:1}\nfor x in input().split():\n x = int(x)\n sum_c += x\n a = sum_c%M\n \n if dic.get(a,0) == 0:\n dic[a] = 1\n else:\n dic[a] += 1\n\nans = 0\nans += dic[0]*(dic[0]-1)/2\ndic.pop(0)\nfor v in dic.values():\n ans += v*(v-1)/2\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s903293688', 's263690236']
[23820.0, 16100.0]
[121.0, 105.0]
[305, 322]
p03287
u685263709
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['from collections import defaultdict\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = 0\nhash = defaultdict(int())\ni = 0\nfor a in A:\n i = (i+a) % M\n hash[i] += 1\nfor h in list(hash.keys()):\n ans += hash[h] * (hash[h]-1) // 2\n\nprint(ans)', 'from collections import defaultdict\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = 0\nhash = defaultdict(int)\nhash[0] = 1\ni = 0\nfor a in A:\n i = (i+a) % M\n hash[i] += 1\nfor h in list(hash.keys()):\n ans += hash[h] * (hash[h]-1) // 2\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s956031025', 's404084984']
[14920.0, 14636.0]
[49.0, 101.0]
[270, 281]
p03287
u711539583
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n, m = map(int, input().split())\na = list(map(int, input().split()))\nmemo = [0]\nd = {0: 1}\nfor ai in a:\n memo.append((memo[-1] + ai) % m)\n mi = memo[-1]\n if mi in d:\n d[mi] += 1\n else:\n d[mi] = 1\nans = 0\nfor k in d:\n c = d[k]\n ans += c * (c-1)\nprint(ans)\n \n', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\nmemo = [0]\nd = {0: 1}\nfor ai in a:\n memo.append((memo[-1] + ai) % m)\n mi = memo[-1]\n if mi in d:\n d[mi] += 1\n else:\n d[mi] = 1\nans = 0\nfor k in d:\n c = d[k]\n ans += c * (c-1) // 2\nprint(ans)\n \n']
['Wrong Answer', 'Accepted']
['s684787475', 's666029232']
[14676.0, 14696.0]
[109.0, 108.0]
[270, 275]
p03287
u721316601
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncount = 0\n\nfor i in range(N):\n total = A[i]\n if A[i] == M:\n count += 1\n\n for l in range(i+1, N):\n total += A[l]\n if total % M == 0:\n count += 1\nprint(count)\n', 'from collections import *\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nS = [0] * (N+1)\n\nfor i in range(N):\n S[i+1] = (S[i] + A[i]) % M\n\nc = Counter()\n\nans = 0\n\nfor i in range(N+1):\n ans += c[S[i]]\n c[S[i]] += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s261155669', 's839258146']
[14696.0, 17332.0]
[2104.0, 166.0]
[273, 263]
p03287
u726615467
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['# encoding: utf-8\nN, M = list(map(int, input().split()))\n\n# TLE\n# Amod = [A for A in map(lambda x: int(x) % M , input().split())]\n# ans = 0\n# for l in range(len(Amod)):\n# acm = 0\n# for r in range(l, len(Amod)):\n# acm = (acm + Amod[r]) % M\n# if acm == 0: ans += 1\n\nfor i, A in enumerate(map(int, input().split())):\n if i == 0: Asym = [A % M]\n else: Asym.append((Asym[-1] + A) % M)\nprint(Asym)\n \nans = Asym.count(0)\nfor sym in set(Asym):\n # print(sym, Asym.count(sym), ans)\n cnt = Asym.count(sym)\n ans += int(cnt * (cnt - 1) / 2)\n\nprint(ans)\n\n', '# encoding: utf-8\nN, M = list(map(int, input().split()))\n\n# TLE\n# Amod = [A for A in map(lambda x: int(x) % M , input().split())]\n# ans = 0\n# for l in range(len(Amod)):\n# acm = 0\n# for r in range(l, len(Amod)):\n# acm = (acm + Amod[r]) % M\n# if acm == 0: ans += 1\n\nAsym = [0]\nfor A in map(int, input().split()[1:]):\n Asym.append((Asym[-1] + A) % M)\nprint(Asym)\n \nans = Asym.count(0)\nfor sym in set(Asym):\n # print(sym, Asym.count(sym), ans)\n cnt = Asym.count(sym)\n ans += int(cnt * (cnt - 1) / 2)\n\nprint(ans)', '# encoding: utf-8\nN, M = list(map(int, input().split()))\n\n# TLE\nAmod = [A for A in map(lambda x: int(x) % M ,filter(lambda x: int(x) % M > 0, input().split()))]\nans = 0\nfor l in range(len(Amod)):\n acm = 0\n for r in range(l, len(Amod)):\n acm = (acm + Amod[r]) % M\n if acm == 0: ans += 1\n\nprint(ans)', '# encoding: utf-8\nN, M = list(map(int, input().split()))\n\n# TLE\n# Amod = [A for A in map(lambda x: int(x) % M , input().split())]\n# ans = 0\n# for l in range(len(Amod)):\n# acm = 0\n# for r in range(l, len(Amod)):\n# acm = (acm + Amod[r]) % M\n# if acm == 0: ans += 1\n\nfor i, A in enumerate(map(int, input().split())):\n if i == 0: Asym = [A % M]\n else: Asym.append((Asym[-1] + A) % M)\nprint(Asym)\n \nans = Asym.count(0)\nfor sym in set(Asym):\n # print(sym, Asym.count(sym), ans)\n cnt = Asym.count(sym)\n ans += int(cnt * (cnt - 1) / 2)\n\nprint(ans)\n\n', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ntab_sum = [0]\nsum_tmp = 0\nfor Ai in A:\n sum_tmp += Ai\n tab_sum.append(sum_tmp)\n\ncnt = {}\nfor item in tab_sum:\n key = str(item % M)\n cnt.setdefault(key, 0)\n cnt[key] += 1\n\n \nans = 0\nfor key, val in cnt.items():\n ans += val * (val - 1) // 2\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s202136422', 's468847365', 's602321838', 's908491603', 's785518741']
[13928.0, 13644.0, 13876.0, 13928.0, 19244.0]
[2104.0, 2104.0, 2104.0, 2104.0, 133.0]
[585, 548, 317, 585, 341]
p03287
u729939940
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['from collections import Counter\nfrom itertools import accumulate\n\nN, M = map(int, input().split())\nA = map(int, input().split())\nacc = [0] \nacc.extend(accumulate(A))\nacc = Counter(a % M for a in acc)\nans = sum(c * (c - 1) // 2 for c in acc.values())', 'N, M = map(int, input().split())\nA = map(int, input().split())\nfrom itertools import accumulate\nfrom collections import Counter\nacc = [0]\nacc.extend(accumulate(A))\nc = Counter(ac % M for ac in acc)\nprint(sum(v * (v - 1) // 2 for v in c.values()))']
['Wrong Answer', 'Accepted']
['s269768063', 's626849304']
[15404.0, 15276.0]
[74.0, 75.0]
[249, 246]
p03287
u745514010
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n,m=map(int,input().split())\na=list(map(int,input().split()))\ncount=0\nsum=0\nalist=[]\nfor i in a:\n sum+=i\n alist.append(sum%m)\nalist.sort()\nk=-1\nn=0\nfor j in alist:\n n+=1\n if k!=j:\n count+=(n*(n-1)/2)\n n=0\n k=j\ncount+=(n*(n-1)/2)\nprint(int(count))', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\ncount=0\nsum=0\nalist=[]\nfor i in a:\n sum+=i\n alist.append(sum%m)\nalist.sort()\nk=-1\nn=0\nfor j in alist:\n n+=1\n if k!=j:\n count+=(n*(n-1)/2)\n n=0\n k=j\nprint(int(count))', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\ncount=0\nsum=0\nalist=[0]\nfor i in a:\n sum+=i\n alist.append(sum%m)\nalist.sort()\nk=-1\nn=0\nfor j in alist:\n if k!=j:\n count+=(n*(n-1)/2)\n n=0\n n+=1\n k=j\ncount+=(n*(n-1)/2)\nprint(int(count))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s049679615', 's606802431', 's238738992']
[14252.0, 14224.0, 14252.0]
[96.0, 94.0, 96.0]
[275, 256, 276]
p03287
u770077083
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n, m = map(int, input().split())\na = list(map(int, input().split()))\nt = [0]\nv = 0\nif n > m:\n mod = [0] * m\n for i in range(len(a)):\n v += a[i]\n mod[v%m] += 1\n print("tot OK")\n ans = mod[0]\n for i in range(m):\n ans += mod[i] * (mod[i]-1) / 2\n print(ans)\nelse:\n ans = 0\n for i in range(len(a)):\n v += a[i]\n t.append(v)\n for i in range(len(t)-1):\n for j in range(i+1, len(t)):\n if (t[j]-t[i]) % m == 0:\n ans += 1\n print(ans)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\nt = [0]\nv = 0\nif n > m:\n mod = [0] * m\n for i in range(len(a)):\n v += a[i]\n mod[v%m] += 1\n print("tot OK")\n ans = mod[0]\n for i in range(m):\n ans += mod[i] * (mod[i]-1) / 2\n print(int(ans))\nelse:\n ans = 0\n for i in range(len(a)):\n v += a[i]\n t.append(v)\n for i in range(len(t)-1):\n for j in range(i+1, len(t)):\n if (t[j]-t[i]) % m == 0:\n ans += 1\n print(ans)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\nt = [0]\nv = 0\nb = {0:1}\nfor i in range(n):\n v = (v + a[i]) % m\n if v in b.keys():\n b[v] += 1\n else:\n b[v] = 1\nans = 0\nfor i in b.values():\n ans += i * (i-1) / 2\nprint(int(ans))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s358228384', 's514742983', 's992717529']
[14480.0, 14480.0, 14408.0]
[2104.0, 2104.0, 97.0]
[520, 525, 272]
p03287
u771876084
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['# coding: utf-8\nfrom collections import defaultdict\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\n\nB=[]\n\ns=0\nfor a in A:\n s+=a\n B.append(s)\nF=defaultdict(int)\nfor b in B:\n F[b%M]+=1\nans=0\nfor b in B:\n if b%M==0:ans+=1\n ans+=int((F[b%M]-1)/2)\nprint(ans)', '# coding: utf-8\nfrom collections import defaultdict\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\n\nB=[0]\n\ns=0\nfor a in A:\n s+=a\n B.append(s)\nF=defaultdict(int)\nfor b in B:\n F[b%M]+=1\nans=0\nfor n in F.values():\n ans+=n*(n-1)//2\nprint(ans)']
['Wrong Answer', 'Accepted']
['s323038486', 's706772923']
[16812.0, 16808.0]
[144.0, 106.0]
[284, 266]
p03287
u801359367
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
["import collections\nimport numpy as np\n\nN,M = list(map(int,input().split()))\nA = input().split()\n\nA = np.array(A,dtype='int64')\nC = np.append([0],np.cumsum(A))\nL = [i%M for i in C]\nL_c = collections.Counter(L)\n\nans = 0\nfor i in L_c.values():\n\tS = i * (i-1) / 2\n ans+=S\nprint(int(ans))", "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N+1) for t in range(N+1))\nprint(len(list(L)))", "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = [1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0]\nprint(len(L))", "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)\nprint(len(list(L)))", "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0)\nprint(len(list(L)))", "from collections import Counter\nimport numpy as np\n\nN,M = list(map(int,input().split()))\nA = np.array(input().split(),dtype='int64')\nC = np.append([0],np.cumsum(A))\n\nL = C%M\n\nL_c = collections.Counter(L)\n\n\nans = 0\nfor i in d.values():\n S = i * (i-1) / 2\n ans+=S\n \nprint(int(ans))", "N,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)\nprint(len(list(L)))", 'count = 0\nfor i in range(N+1):\n for t in range(N+1):\n if i<t:\n count+=1 if sum(A[i:t])%M==0 and sum(A[i:t]) != 0 else 0\nprint(count)\n', "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = [1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0]\nprint(len(L))", "N,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)\nprint(len(list(L)))", "import collections\nimport numpy as np\n\nN,M = list(map(int,input().split()))\nA = input().split()\n\nA = np.array(A,dtype='int64')\nC = np.append([0],np.cumsum(A))\n\nL = [i%M for i in C]\n\nd = defaultdict(int)\nfor i in L:\n d[i] +=1\n\n\nans = 0\nfor i in d.values():\n S = i * (i-1) / 2\n ans+=S\n \nprint(int(ans))", "import numoy as np\nN,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = list(1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0)\nprint(len(L))", "N,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N) for t in range(N) if i<t and (C[t] - C[i])%M==0)\nprint(len(list(L)))", "import collections\nimport numpy as np\n \nN,M = list(map(int,input().split()))\nA = np.array(input().split(),dtype='int64')\nC = np.append([0],np.cumsum(A))\n\nL = C % M\nL_c = collections.Counter(L)\n \nans = 0\nfor i in L_c.values():\n S = i * (i-1) / 2\n ans+=S\n \nprint(int(ans))"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s039331844', 's041162411', 's144464379', 's153494672', 's187311178', 's221621018', 's319832062', 's329044155', 's529078672', 's599376175', 's644420555', 's703073913', 's872567776', 's035398655']
[3060.0, 3064.0, 3064.0, 3064.0, 3064.0, 23812.0, 11096.0, 2940.0, 3064.0, 11096.0, 23884.0, 3188.0, 11096.0, 23808.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 176.0, 27.0, 18.0, 17.0, 27.0, 276.0, 19.0, 27.0, 222.0]
[286, 223, 253, 254, 259, 456, 234, 155, 253, 234, 480, 257, 230, 279]
p03287
u833070958
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
["n, m = map(int, input().split(' '))\na = map(int, input().split(' '))\n\nd = {0: 1}\nasum = 0\nfor aa in a:\n asum = (asum + aa) % m\n if asum in d:\n d[asum] += 1\n else:\n d[asum] = 1\n\n\nans = 0\nfor v in d.values():\n ans += v * (v - 1) / 2\n\nprint(ans)", "n, m = map(int, input().split(' '))\n\nd = {0: 1}\nasum = 0\nfor a in map(int, input().split(' ')):\n asum = (asum + a) % m\n if asum in d:\n d[asum] += 1\n else:\n d[asum] = 1\n\n\nans = 0\nfor v in d.values():\n ans += int(v * (v - 1) / 2)\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s486900505', 's778345669']
[16100.0, 16100.0]
[86.0, 94.0]
[268, 265]
p03287
u838674605
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['N , M = map(int,input().split())\nA = map(int,input().split())\nA = [a for a in A]\n\npartial_sum_list = [0]\npartial_sum = 0\nres = 0\ni = 0\nwhile i < N:\n partial_sum += A[i]\n partial_sum_list.append(partial_sum)\n temp = partial_sum % M\n j = 0\n while j < len(partial_sum_list)-1:\n if temp == (partial_sum_list[j] % M):\n print(A[i])\n res += 1\n j += 1\n i = i + 1', 'N , M = map(int,input().split())\nA = map(int,input().split())\nA = [a for a in A]\n\ndic = {}\ndic[0] = 0\npartial_sum = 0\nres = 0\ni = 0\nwhile i < N:\n partial_sum += A[i]\n a = partial_sum % M\n if a == 0:\n res += 1\n if a in dic:\n dic[a] += 1\n res += dic[a] - 1\n else:\n dic[a] = 1\n res += dic[a] - 1\n \n i = i + 1\nprint(res)']
['Wrong Answer', 'Accepted']
['s873778050', 's131409959']
[14224.0, 14424.0]
[2104.0, 125.0]
[409, 387]
p03287
u863442865
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
["def main():\n import sys\n input = sys.stdin.readline\n from collections import Counter\n from itertools import accumulate\n\n n,m = map(int, input().split())\n a = [0] + list(map(lambda x: x % M, accumulate(map(int, input().split()))))\n c = Counter(a)\n res = 0\n for k, v in c.items():\n res += v*(v-1)//2\n print(res)\n \nif __name__ == '__main__':\n main()", "def main():\n import sys\n input = sys.stdin.readline\n from collections import Counter\n from itertools import accumulate\n\n n,m = map(int, input().split())\n a = [0] + list(map(lambda x: x % m, accumulate(map(int, input().split()))))\n c = Counter(a)\n res = 0\n for k, v in c.items():\n res += v*(v-1)//2\n print(res)\n \nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s344212118', 's834074987']
[11636.0, 14588.0]
[29.0, 81.0]
[393, 394]
p03287
u875291233
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['# coding: utf-8\n# Your code here!\n\nimport collections\n\nn,m=[int(i) for i in input().split()]\nA=[int(i) for i in input().split()]\n\nS=[0]*(n+1)\nfor i in range(n):\n S[i+1]=(S[i]+A[i])%m\n\nc = collections.Counter(S)\n\nans=0\nfor i in c:\n ans+=c[i]*(c[i]-1)//2\n\nprint(c)\nprint(ans) \n ', '# coding: utf-8\n# Your code here!\n\nimport collections\n\nn,m=[int(i) for i in input().split()]\nA=[int(i) for i in input().split()]\n\nS=[0]*(n+1)\nfor i in range(n):\n S[i+1]=(S[i]+A[i])%m\n\nc = collections.Counter(S)\n\nans=0\nfor i in c:\n ans+=c[i]*(c[i]-1)//2\n\n#print(c)\nprint(ans) \n ']
['Wrong Answer', 'Accepted']
['s677504824', 's898875152']
[23596.0, 16568.0]
[163.0, 115.0]
[288, 289]
p03287
u883792993
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['N,M=list(map(int,input().split()))\nA=list(map(int,input().split()))\nC=[]\nfor i in range(len(A)):\n if i == 0:\n C.append(0)\n else:\n C.append(C[i-1]+A[i])\n\nmod=[]\nfor i in range(len(C)):\n mod.append(C[i]%M)\n\nk=0\nmod.sort()\nprint(mod)\nfor i in range(1,len(mod)):\n if mod[i]==0:\n k+=1\nn=1\nt=0\nfor i in range(1,len(mod)):\n if i < len(mod)-1:\n if mod[i-1]==mod[i]:\n n+=1\n elif n>=2:\n t+=int(n*(n-1)/2)\n n=1\n else:\n pass\n else:\n if n>=2:\n if mod[i-1]==mod[i]:\n n+=1\n else:\n pass\n t+=int(n*(n-1)/2)\n else:\n if mod[i-1]==mod[i]:\n t+=1\n else:\n pass\n\nprint(k+t+1)\n\n', 'N,M=list(map(int,input().split()))\nA=list(map(int,input().split()))\n\nC=[0]\nfor i in range(len(A)):\n C.append(C[i]+A[i])\n\nmod=[]\nfor i in range(len(C)):\n mod.append(C[i]%M)\n\nmod.sort()\n\nn=1\nt=0\nfor i in range(1,len(mod)):\n if i < len(mod)-1:\n if mod[i-1]==mod[i]:\n n+=1\n elif n>=2:\n t+=int(n*(n-1)/2)\n n=1\n else:\n pass\n else:\n if n>=2:\n if mod[i-1]==mod[i]:\n n+=1\n else:\n pass\n t+=int(n*(n-1)/2)\n else:\n if mod[i-1]==mod[i]:\n t+=1\n else:\n pass\n\nprint(t)']
['Wrong Answer', 'Accepted']
['s685709958', 's558829040']
[19912.0, 16024.0]
[165.0, 139.0]
[786, 658]
p03287
u922901775
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, M: int, A: "List[int]"):\n c = dict((0, 1))\n total = 0\n res = 0\n for a in A:\n total = (total + a) % M\n c[total] = c.get(total, 0) + 1\n res += c[total] - 1\n print(res)\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n A = [ int(next(tokens)) for _ in range(N) ] # type: "List[int]"\n solve(N, M, A)\n\nif __name__ == \'__main__\':\n main()\n', '#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, M: int, A: "List[int]"):\n c = dict([(0, 1)])\n total = 0\n res = 0\n for a in A:\n total = (total + a) % M\n c[total] = c.get(total, 0) + 1\n res += c[total] - 1\n print(res)\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n A = [ int(next(tokens)) for _ in range(N) ] # type: "List[int]"\n solve(N, M, A)\n\nif __name__ == \'__main__\':\n main()\n']
['Runtime Error', 'Accepted']
['s866097993', 's277244598']
[15148.0, 19896.0]
[59.0, 90.0]
[804, 806]
p03287
u922952729
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['N,M=[int(i) for i in input().split(" ")]\nA=[int(i) for i in input().split(" ")]\n\n_A=[sum(A[:i:])%M for i in range(N+1)]\n\ncount=0\n\n_A.sort()\nprint(_A)\n\n_count=0\nfor i in range(len(_A)-1):\n\n if _A[i]==_A[i+1]:\n _count+=1\n else:\n count+=(_count+1)*_count/2\n _count=0\n\ncount+=(_count+1)*_count/2\nprint(int(count))\n', 'N,M=[int(i) for i in input().split(" ")]\nA=[int(i) for i in input().split(" ")]\n\n_A=[sum(A[:i:]) for i in range(N+1)]\nprint(_A)\ncount=0\nfor l in range(N+1):\n for r in range(l+1,N+1):\n\n if (_A[r]-_A[l])%M==0:\n count+=1\n\n\nprint(count)\n', 'N,M=[int(i) for i in input().split(" ")]\nA=[int(i) for i in input().split(" ")]\n\n_A=[0]\nsum=0\nd={0:1}\nkey=[0]\nfor i in range(N):\n sum=(sum+A[i])%M\n try:\n d[sum]+=1\n except KeyError:\n d[sum]=1\n key.append(sum)\n\ncount=0\nfor i in key:\n _count=d[i]\n\n count+=(_count-1)*_count/2\nprint(int(count))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s561834936', 's819404316', 's240919061']
[14224.0, 14224.0, 14252.0]
[2104.0, 2108.0, 113.0]
[337, 258, 328]
p03287
u924406834
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['\nn,m = map(int,input().split())\nnumber = list(int(input().split()))\na = []\n\nfor i in range(n):\n for j in range(n-i):\n b=[]\n for k range(n):\n b.append(number[j+k+1])\n if sum(b)%m == 0:\n a.append(1)\n else:\n pass\nprint(len(a))', '\nn,m = int(input().split())\nnumber = list(int(input().split()))\na = []\n\nfor i in range(n):\n for j in range(n-i):\n b=[]\n for k range(n):\n b.append(number[j+k+1])\n if sum(b)%m == 0:\n a.append(1)\n else:\n pass\nprint(len(a))\n\n#\n\n\n\n\n\n\n', '\nn,m = map(int,input().split())\nnumber = list(int(input().split()))\na = []\n\nfor i in range(n):\n for j in range(n-i):\n b=[]\n for k range(i+1):\n b.append(number[j+k-1])\n if sum(b)%m == 0:\n a.append(1)\n else:\n pass\nprint(len(a))', "n,m = map(int,input().split())\na = list(map(int,input().split()))\ncheck = {};ios = [a[0]%m]*n\nfor i in range(n-1):\n ios[i+1] = (a[i+1] + ios[i])%m\n check[ios[i]] = 0\ncheck[ios[n-1]] = 0\nfor i in range(len(ios)):\n check[ios[i]%m] += 1\nans = 0\nfor i in range(n):\n num = check[ios[i]];check[ios[i]] = 'finish'\n if num == 'finish':continue\n if ios[i] % m == 0:ans += num\n ans += (num * (num - 1))//2\nprint(ans)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s128481709', 's207288333', 's698622162', 's418357748']
[2940.0, 2940.0, 2940.0, 14732.0]
[17.0, 17.0, 17.0, 159.0]
[359, 365, 361, 427]
p03287
u987164499
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n,m = map(int,input().split())\na = list(map(int,input().split()))\n\nfrom itertools import accumulate\n\nb = [i%m for i in a]\n\ndef syakutori(k):\n \n r,sum_li,res = 0,0,0\n for l in range(n):\n while r < n and sum_li%k != 0:\n sum_li += a[r]\n r += 1\n \n if r < l:\n r = l\n continue\n res += 1\n \n sum_li -= a[l]\n return res\nprint(syakutori(m))', 'import numpy as np\nfrom collections import Counter\n\nn,m = map(int,input().split())\n\na = np.array([0]+list(map(int,input().split())),dtype=np.int64)\na = np.mod(a.cumsum(),m)\n\nc = Counter(a)\n\nans = 0\n\nfor i in c.values():\n ans += i*(i-1)//2\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s746553070', 's528093114']
[14252.0, 23116.0]
[91.0, 340.0]
[546, 253]
p03287
u988402778
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['import math\n#n,m = 3,2\n#a = [4,1,5]\nn, m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nb = [0 for i in range(n)]\nfor i,ai in enumerate(a):\n if i == 0:\n b[i] = ai % m\n else:\n b[i] = (ai + b[i-1]) % m\n\nans = 0\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(m):\n c = b.count(i) \n if c >= 2:\n ans += combinations_count(c%m,2)\nans += b.count(0)\n\nprint(ans)\n', 'import math\nimport collections\n\n#n,m = 3,2\n#a = [4,1,5]\nn, m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nb = [0 for i in range(n)]\nfor i,ai in enumerate(a):\n if i == 0:\n b[i] = ai % m\n else:\n b[i] = (ai + b[i-1]) % m\n\nans = 0\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nc = collections.Counter(b)\nfor i in c.values():\n ans += combinations_count(i,2)\n\n\n# c = b.count(i) \n# if c >= 2:\n# ans += combinations_count(c,2)\nans += b.count(0)\n\nprint(ans)', 'import math\nimport collections\n\n#n,m = 3,2\n#a = [4,1,5]\nn, m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nb = [0 for i in range(n)]\nfor i,ai in enumerate(a):\n if i == 0:\n b[i] = ai % m\n else:\n b[i] = (ai + b[i-1]) % m\n\nans = 0\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nc = collections.Counter(b)\nfor i in c.values():\n if i >= 2:\n ans += combinations_count(i,2)\n\n\n# c = b.count(i) \n# if c >= 2:\n# ans += combinations_count(c,2)\nans += b.count(0)\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s280141788', 's719850525', 's286968969']
[14252.0, 17364.0, 16592.0]
[2104.0, 411.0, 406.0]
[492, 597, 616]
p03287
u989345508
2,000
1,048,576
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers and satisfy 1 \leq l \leq r \leq N. * A_l + A_{l+1} + ... + A_r is a multiple of M.
['n,m=input().split();d={0:1}\nfor i in list(map(lambda x:int(x)%int(m),input().split())):x=d.get(i,0);d[i]=x+1\nprint(sum(map(lambda x:(x*x-x)//2,d.values())))', 'n,m=map(int,input().split());d={0:1}\nfor i in input().split():d[int(i)%m]+=1\nprint(sum(map(lambda x:x*(x-1)//2,d.values())))', 'n,m=map(int,input().split());d={0:1}\nfor i in map(lambda x:int(x)%m,input().split()):x=d.get(i,0);d[i]=x+1\nprint(sum(map(lambda x:(x*x-x)//2,d.values())))', 'n,m=map(int,input().split());d={0:1}\nfor i in input().split():x=d.get(int(i)%m,0);d[int(i)%m]=x+1\nprint(sum(map(lambda x:x*(x-1)//2,d.values())))', '\n\nfrom itertools import dropwhile\nfrom collections import deque\nn=int(input())\nans=deque([["",n]])\ndef bfs(d):\n global ans\n l=len(ans)\n for i in range(l):\n x=ans.popleft()\n new1=[x[0]+"0",x[1]]\n if abs(new1[1])<abs((-2)**d):\n ans.append(new1)\n new2=[x[0]+"1",x[1]-(-2)**d]\n if abs(new2[1])<abs((-2)**d):\n ans.append(new2)\n if d!=0:\n bfs(d-1)\nbfs(30)\n\n\nfor i in ans:\n if i[1]==0:\n ans=list(dropwhile(lambda x:x=="0",i[0]))\n if len(ans)==0:\n print(0)\n else:\n print("".join(ans))\n break', 'n,m=map(int,input().split());d={0:1}\nfor i in input().split():d[int(i)%m]+=1\nprint(sum(map(lambda x:x*(x-1)//2,d.values())))', 'from itertools import accumulate\nfrom collections import Counter\nn,m=map(int,input().split())\ns=[0]+list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))\nans=0\nfor i in Counter(s):\n ans+=(d[i]*(d[i]-1)//2)\nprint(ans)', 'n,m=map(int,input().split());d={0:1}\nfor i in input().split():d.get(int(i)%m,0);d[int(i)%m]+=1\nprint(sum(map(lambda x:x*(x-1)//2,d.values())))', 'n,m,*c=map(int,open(0).read().split());d={0:1};r=s=0\nfor i in c:s+=i;x=d.get(s%m,0);r+=x;d[s%m]=x+1\nprint(r)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s076634790', 's092981810', 's169796934', 's190133053', 's275320525', 's449520275', 's518485654', 's588859479', 's815636210']
[13984.0, 11260.0, 16100.0, 16004.0, 3316.0, 11096.0, 14348.0, 11100.0, 14476.0]
[113.0, 27.0, 93.0, 109.0, 20.0, 26.0, 75.0, 25.0, 104.0]
[156, 124, 154, 145, 681, 124, 238, 142, 108]
p03288
u009219947
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["S = input()\nflag = False\n\nif S[0] != 'A':\n flag = True\n\nif S[2:-1].count('C') != 1:\n flag = True\n\nif not S.replace('A', '').replace('C', '').islower():\n flag = True\n\nif flag:\n print('WA')\nelse:\n print('AC')\n \n", 'R = input()\nif R < 1200:\n print("ABC")\nelif R < 2800:\n print("ARC")\nelse:\n print("AGC")', 'R = int(input())\nif R < 1200:\n print("ABC")\nelif R < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s565341132', 's768639058', 's452008239']
[2940.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0]
[215, 90, 95]
p03288
u015315385
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["import re\n\ns = input()\n\nif not s.startswith('A'):\n print('WA')\nelif s[2:len(s) - 3].count('C') == 1:\n print('WA')\nelif len(re.findall('[A-Z]', s)) != 2:\n print('WC')\nelse:\n print('AC')\n", "r = int(input())\n\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Wrong Answer', 'Accepted']
['s800791280', 's654145615']
[3188.0, 2940.0]
[19.0, 17.0]
[197, 103]
p03288
u016568601
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = int(input("数値を入力:"))\nif R < 1200:\n print("ABC")\n\nelif R >= 1200 and R < 2800:\n print("ARC")\n \nelse:\n print("AGC")', 'R = int(input("数値を入力:"))\nif R < 1200:\n print("ABC")\n\nelif R >= 1200 and R < 2800:\n print("ARC")\n \nelif R >= 2800:\n print("AGC")', 'N = int(input())\n\nfor i in range(100):\n if N - 7 * i >=0 and (N -(7 * i)) % 4 == 0:\n print("Yes")\n exit()\n \nelse:\n print("No")', 'R = int(input(""))\nif R < 1200:\n print("ABC")\n\nelif R >= 1200 and R < 2800:\n print("ARC")\n \nelif R >= 2800:\n print("AGC")']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s649060388', 's711953078', 's755307396', 's477367403']
[3060.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[141, 151, 153, 133]
p03288
u020373088
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = int(input())\nif r < 1200:\n print("ABC")\nelse r < 2800:\n print("ARC")\nelse:\n print("AGC")', 'r = int(input())\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Runtime Error', 'Accepted']
['s455853666', 's213241335']
[2940.0, 2940.0]
[20.0, 18.0]
[95, 95]
p03288
u023077142
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["v = int(input())\n\nif v < 1200:\n print('ABC')\nelse if v < 2800:\n print('ARC')\nelse:\n print('AGC')", "v = int(input())\n \nif v < 1200:\n print('ABC')\nelif v < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s768467100', 's269262387']
[2940.0, 3060.0]
[17.0, 47.0]
[99, 97]
p03288
u030726788
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['print("AGC")', 'a=int(input())\nif(a<1200):print("ABC")\nelif(a<2800):print("ARC")\nelse:print("AGC")']
['Wrong Answer', 'Accepted']
['s292588799', 's041691607']
[3064.0, 3060.0]
[19.0, 19.0]
[12, 82]
p03288
u033524082
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["input()\nprint('AGC')", 'r=int(input())\nif r<1200:\n print("ABC")\nelse:\n print("ARC" if r<2800 else "AGC")']
['Wrong Answer', 'Accepted']
['s028909112', 's997055176']
[2940.0, 2940.0]
[17.0, 18.0]
[20, 86]
p03288
u038027079
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['s = input()\ndef kai(s):\n if s[0] == "A":\n if "C" in s[2:-1]:\n if s.count("C") == 1:\n s = s.replace("A", "")\n s = s.replace("C", "")\n if s.islower():\n print("AC")\n else:\n print("WA")\n else:\n print("WA")\n else:\n print("WA")\n else:\n print("WA")\n \nkai(s)', 'r = int(input())\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s428085414', 's893771315']
[2940.0, 2940.0]
[17.0, 17.0]
[423, 101]
p03288
u039623862
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r = int(input())\nif r < 1200:\n print('ABC')\nelse if r < 2800:\n print('ARC')\nelse:\n print('AGC')", "r = int(input())\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s904719664', 's982326439']
[2940.0, 2940.0]
[18.0, 18.0]
[98, 95]
p03288
u044459372
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r=int(input())\nif r>=2800:\n print('AGC')\n elif r>=1200:\n print('ARC')\n else:\n print('ABC')\n", "r=int(input())\nif r>=2800:\n\tprint('AGC')\nelif r>=1200:\n\tprint('ARC')\nelse:\n\tprint('ABC')\n "]
['Runtime Error', 'Accepted']
['s551135217', 's941457071']
[2940.0, 2940.0]
[17.0, 17.0]
[94, 91]
p03288
u050698451
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input(R))\nif R < 1200:\n print('ABC')\nelif 1200 <= R < 2800:\n print('ARC')\nelse:\n print('AGC')", "R = int(input())\nif R < 1200:\n print('ABC')\nelif 1200 <= R < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Accepted']
['s868557094', 's368830175']
[2940.0, 3060.0]
[18.0, 20.0]
[104, 104]
p03288
u057079894
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["n=int(input())\nif n<1200:\n print('ABC')\nelif (n<2800)&&(n>=1200):\n print('ARC')\nelse:\n print('AGC')\n\n", "n=int(input())\nif n<1200:\n print('ABC')\nelif n<2800&&n>=1200:\n print('ARC')\nelse:\n print('AGC')\n ", "n=int(input())\nif n<1200:\n print('ABC')\nelif n>=2800:\n print('AGC')\nelse:\n print('ARC')"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s014902477', 's833548387', 's725251155']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 20.0]
[104, 101, 90]
p03288
u058592821
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["n = input()\nif n < 1200: print('ABC')\nelif n < 2800: print('ARC')\nelse: print('AGC')", "n = int(input())\nif n < 1200: print('ABC')\nelif n < 2800: print('ARC')\nelse: print('AGC')"]
['Runtime Error', 'Accepted']
['s989214767', 's131662869']
[2940.0, 2940.0]
[17.0, 17.0]
[84, 89]
p03288
u059262067
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['x = int(input())\nl0 = [1200,2800,9999]\nl1 = ["ABC","ARC","AGC"]\n\nfor i in range(3):\n if x < l0[i]:\n print(l1[1])\n break\n', 'x = int(input())\nl0 = [1200,2800,9999]\nl1 = ["ABC","ARC","AGC"]\n\nfor i in range(3):\n if x < l0[i]:\n print(l1[i])\n break\n']
['Wrong Answer', 'Accepted']
['s833564654', 's025084634']
[2940.0, 2940.0]
[18.0, 18.0]
[127, 127]
p03288
u072717685
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input())\n\nif R < 1200:\n r = 'ABC'\nelif R < 2800:\n r = 'ARC':\nelse:\n r ='AGC'\n\nprint(r)", "R = int(input())\n \nif R < 1200:\n r = 'ABC'\nelif R < 2800:\n r = 'ARC':\nelse:\n r ='AGC'\nprint(r)", "R = int(input())\n \nif R < 1200:\n r = 'ABC'\nelif R < 2800:\n r = 'ARC'\nelse:\n r ='AGC'\n \nprint(r)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s221100415', 's628746959', 's055541658']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[97, 97, 98]
p03288
u077291787
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['# ABC104A - Rated for Me\nr = list(map(int, input().rstrip().split()))\nif r < 1200:\n print("ABC")\nelif 1200 <= r < 2800:\n print("ARC")\nelse:\n print("AGC")', '# ABC104A - Rated for Me\nr = int(input())\nif r < 1200:\n print("ABC")\nelif 1200 <= r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Runtime Error', 'Accepted']
['s000122433', 's535465666']
[2940.0, 2940.0]
[17.0, 18.0]
[162, 134]
p03288
u088974156
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['n=int(input())\nif(n<1200):\n print("ABC")\nelif(n<2800):\n print("ARC"):\nelse:\n print("AGC")', 'n=int(input())\nif(n<1200):\n print("ABC")\nelif(n<2800):\n print("ARC"):\nelif(n>=2800):\n print("AGC")', 'print(["ABC","ARC","AGC"][int(input())//50+8>>5])']
['Runtime Error', 'Runtime Error', 'Accepted']
['s162253156', 's237510687', 's079556209']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[92, 101, 49]
p03288
u090001078
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['letters = input()\nC = letters[2:-2]\nD = letters.replace("A","a").replace("C","c")\n\nprint(D)\nif letters[0] == "A" and C.count("C") == 1 and D.islower() == True :\n print("AC")\nelse:\n print("WA")', 'r = int(input())\n\nif r < 1200:\n print("ABC")\nelif r>= 1200 and r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s974830204', 's287814768']
[2940.0, 2940.0]
[19.0, 17.0]
[195, 109]
p03288
u097121858
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = input()\n\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")\n', 'r = int(input())\n\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Accepted']
['s301962316', 's220866933']
[2940.0, 2940.0]
[16.0, 17.0]
[98, 103]
p03288
u100277898
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = input()\nif R < 1200:\n print("ABC")\nelif R < 2800:\n print("ARC")\nelse:\n print("AGC")', 'R = int(input())\nif R < 1200:\n print("ABC")\nelif R < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Accepted']
['s582674378', 's446931149']
[2940.0, 3316.0]
[18.0, 21.0]
[90, 96]
p03288
u102223485
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["# coding: utf-8\nR = int(input())\nprint(R)\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')", "# coding: utf-8\nR = int(input())\n# print(R)\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Wrong Answer', 'Accepted']
['s167618317', 's718586636']
[2940.0, 2940.0]
[18.0, 17.0]
[126, 128]
p03288
u102242691
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['\nr = int(input())\n\nif r < 1200:\n print("ABC")\nelif r 2800:\n print("ARC")\nelse:\n print("AGC")\n', '\nr = int(input())\n\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Accepted']
['s544380164', 's913623574']
[2940.0, 2940.0]
[17.0, 17.0]
[102, 104]
p03288
u102902647
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = int(input())\nif R<1200:\n', "R = int(input())\nif R<1200:\n print('ABC')\nelif R<2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s068711293', 's094400484']
[2940.0, 2940.0]
[17.0, 17.0]
[28, 97]
p03288
u102960641
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['s = input()\nmod = 10**9 + 7\nabc = 0\nbc = 0\nc = 0\nq = 0\nfor i in s[::-1]:\n elif i == "A":\n abc = (abc + bc) % mod\n elif i == "B":\n bc = (bc + c) % mod\n elif i == "C":\n c = (3**q+c) % mod\n elif i == "?":\n abc = (abc*3 + bc) % mod\n bc = (bc*3 + c) % mod \n c = (3**q + c*3) % mod\n q += 1\nprint(abc)\n', 'n = int(input())\nif n >= 2800:\n print("AGC")\nelif n >= 1200:\n print("ARC")\nelse:\n print("ABC")\n ']
['Runtime Error', 'Accepted']
['s259648912', 's747825977']
[2940.0, 2940.0]
[17.0, 18.0]
[320, 100]
p03288
u128914900
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['s=input()\nresult=""\ncount=0\nl=len(s)\nfor i in range(l):\n if i==0 and s[i]="A":\n result="WA"\n break\n elif i==1 and ord(s[1])<97 \n result="WA"\n break\n elif i==l-1 and ord(s[l-1])<97:\n result="WA"\n break\n else:\n if ord(s[i])<97:\n count+=1\n if count>1 or s[i]!="C":\n result="WA"\n break\nif result!="WA"\n result="AC"\nprint(result)', 'D,G= map(int,input().split())\npc=[]\nfor i in range(D):\n p,c= map(int,input().split())\n pc.append([p,c])\ni=D\nminN=100000\nwhile i>0:\n #t=pc[i][0]*100*(i+1)+pc[i][1]\n t=pc[i-1][0]*100*(i)+pc[i-1][1]\n if t>=G:\n \n n=pc[i-1][0]\n minN=min(n,minN)\n while n-1>0:\n t1=(n-1)*100*(i)\n if t1>G:\n n=n-1\n continue\n else:\n minN=minN(minN,n+1)\n n=n-1\n \n i=i-1\nprint(minN)', 'rate=input()\nresult=""\nif rate<1200:\n result="ABC"\nelif rate<2800:\n result="ARC"\nelse:\n result="AGC"\nprint(result)', 's=input()\nresult=""\ncount=0\nl=len(s)\nif s[0]!="A":\n result="WA"\nelif ord(s[1:2])<97 or ord(s[l-1])<97:\n result="WA"\nfor i in s[2:l-1]:\n if ord(i)<97:\n count+=1\n if count>1 or i!="C":\n result="WA"\n break\nif count==0:\n result="WA"\nif result!="WA":\n result="AC"\nprint(result)', 'rate=int(input())\nresult=""\nif rate<1200:\n result="ABC"\nelif rate<2800:\n result="ARC"\nelse:\n result="AGC"\nprint(result)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s417275938', 's531828893', 's639750509', 's755021764', 's055517391']
[2940.0, 3064.0, 2940.0, 3064.0, 2940.0]
[17.0, 19.0, 17.0, 18.0, 17.0]
[368, 416, 117, 287, 122]
p03288
u131411061
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input())\n\nif R < 1200:\n print('ABC')\nelif 1200 <= R < 2800\n print('ARC')\nelse:\n print('AGC')", "R = int(input())\n\nif R < 1200:\n print('ABC')\nelif 1200 <= R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s963771903', 's488561032']
[2940.0, 2940.0]
[17.0, 18.0]
[109, 110]
p03288
u141410514
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['print("AGC")', 'r=int(input())\nif r<1200:\n print("ABC")\nelif r<2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s341337545', 's098179833']
[2940.0, 2940.0]
[18.0, 17.0]
[12, 89]
p03288
u143189168
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r = int(input())\nif n < 1200:\n print('ABC')\nelif n < 2800:\n print('ARC')\nelse:\n print('AGC')", "r = int(input())\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Accepted']
['s318551897', 's160115374']
[2940.0, 2940.0]
[17.0, 17.0]
[101, 102]
p03288
u160244242
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['import math\n\nd, g = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(d)]\n\nfor k,i in enumerate(lst):\n i.append((k+1)*100)\n i.append(i[2]*i[0]+i[1])\n\ndef calcurate(pt, count, g, lst):\n lst1 = list()\n for i in lst:\n if i[3] > g - pt:\n lst1.append(i + [i[2]])\n else:\n lst1.append(i + [i[3]/i[0]])\n lst1 = sorted(lst1, key = lambda x: -x[-1])\n ps = lst1[0]\n if ps[3] > g - pt:\n count += math.ceil((g - pt) / ps[2])\n return print(count)\n elif ps[3] == g - pt:\n return print(count + ps[0])\n else:\n calcurate(pt+ps[3], count+ps[0], g, lst1[1:])\n\ncalcurate(0,0,g,lst)', "r = int(input())\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s145615715', 's729564087']
[3188.0, 3316.0]
[18.0, 21.0]
[681, 101]
p03288
u161537170
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["rating = input()\nif rating >= 0 and rating < 1200:\n print('ABC')\nelif rating >= 1200 and rating < 2800:\n print('ARC')\nelse:\n print('AGC') \n", "rating = int(input())\nif rating >= 0 and rating < 1200:\n print('ABC')\nelif rating >= 1200 and rating < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Accepted']
['s258742638', 's093082479']
[2940.0, 2940.0]
[17.0, 17.0]
[148, 152]
p03288
u166208021
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['str = str(input())\n\na = str [0:1] \nb = str[2:-1]\n\n\nif a != "A":\n print ("WA")\n\nelif b.count("C") !=1:\n print ("WA")\n\nelif str[1:2] .isupper() :\n print ("WA")\n\nelif str[-1:] .isupper():\n print ("WA")\n\nelse :\n print ("AC")', 'str = str(input())\n\na = str [0:1] \nb = str[2:-1]\n\n\nif a != "A":\n print ("WA")\n\nelif b.count("C") !=1:\n print ("WA")\n\nelif str[1:2] .isupper() :\n print ("WA")\n\nelif str[-1:] .isupper():\n print ("WA")\n\nelse :\n print ("AC")', 'R = int(input())\n\nif 0<=R<1200:\n print ("ABC")\n\nif 1200<=R<2800:\n print ("ARC")\n\nif 2800<=R<=4208:\n print ("AGC")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s463137112', 's953262582', 's163244067']
[3060.0, 3060.0, 2940.0]
[19.0, 17.0, 17.0]
[220, 220, 113]
p03288
u168416324
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['n=int(input())\nif n<1200:\n print("ABC")\nelif:\n print("ARC")\nelse:\n print("AGC")', 'n=int(input())\nif n<1200:\n print("ABC")\nelif n<2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Accepted']
['s732985894', 's666924098']
[8968.0, 9152.0]
[23.0, 29.0]
[82, 90]
p03288
u175034939
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["if n < 1200:\n print('ABC')\nelif n < 2800:\n print('ARC')\nelse:\n print('AGC')", "n = int(input())\nif n < 1200:\n print('ABC')\nelif n < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s867237424', 's361200861']
[2940.0, 2940.0]
[18.0, 17.0]
[84, 101]
p03288
u178192749
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r = int(input())\nans = ''\nif r < 1200:\n print('ABC')\nelfi r < 2800:\n print('ARC')\nelse:\n print('AGC')", "r = int(input())\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s655582656', 's920946443']
[2940.0, 2940.0]
[17.0, 17.0]
[104, 95]
p03288
u184817817
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["if r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')", "r = int(input())\nif r < 1200:\n print('ABC')\nelif r < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s482577171', 's797348052']
[2940.0, 2940.0]
[17.0, 17.0]
[84, 101]
p03288
u186950791
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = int(input())\nif r < 1200:\n print(ABC)\n if 1200 <= r <2800:\n print(ARC)\n else:\n print(AGC)', 'r = int(input())\nif r < 1200:\n print("ABC")\nelse:\n if r < 2800:\n print("ARC")\n else:\n print("AGC")']
['Runtime Error', 'Accepted']
['s003908310', 's291893566']
[2940.0, 2940.0]
[17.0, 17.0]
[116, 121]
p03288
u190907730
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R=int(input())\nif R<1200:\n print("ABC")\nelseif R<2800:\n print("ARC")\nelse:\n print("AGC")', 'S=input()\nif S[0]=="A" and S[2:-2].count("C")==1:\n print("AC")\nelse:\n print("WA")\n', 'R=int(input())\nif R<1200:\n print("ABC")\nelsif R<2800:\n print("ARC")\nelse:\n print("AGC")\n', 'R=int(input())\nif R<1200:\n print("ABC")\nelif R<2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s004292344', 's268686649', 's634244379', 's425365388']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0, 17.0]
[91, 84, 91, 90]
p03288
u192541825
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['str=list(input())\nflag=True\nif str[0]!=\'A\':\n flag=False\nstr[0]=\'a\'\ncnt=0\nfor i in range(2,len(str)-1):\n if str[i]==\'C\':\n cnt+=1\n if cnt==1:\n str[i]=\'c\'\nif cnt!=1:\n flag=False\n\ntmp="".join(str)\nprint(tmp)\nif not tmp.islower():\n flag=False\n\nif flag==True:\n print("AC")\nelse:\n print("WA")', 'r=int(input())\nif r>=2800:\n print("AGC")\nelif r>=1200:\n print("ARC")\nelse:\n print("ABC")']
['Wrong Answer', 'Accepted']
['s350436633', 's465157011']
[3064.0, 2940.0]
[17.0, 18.0]
[328, 97]
p03288
u192588826
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['print("AGC")', 'r = int(input())\nif r < 1200:\n print("ABC")\nelif r <2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s538830804', 's757883927']
[2940.0, 2940.0]
[18.0, 18.0]
[12, 100]
p03288
u197300773
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['s=input()\n\na=[1,0,0,0]\n\nfor i in range(len(s)):\n c=s[i]\n if c=="A":\n a[1]+=a[0]\n elif c=="B":\n a[2]+=a[1]\n elif c=="C":\n a[3]+=a[2]\n else:\n a=[ a[0]*3 ] + [ a[j+1]*3+a[j] for j in range(3) ]\n\n a=[a[i]%1000000007 for i in range(4)]\n\nprint(a[3])', 's=input()\na=[1,0,0,0]\nfor i in s:\n if i=="A": a[1]+=a[0]\n elif i=="B": a[2]+=a[1]\n elif i=="C": a[3]+=a[2]\n else: a=[ a[0]*3 ] + [ a[j+1]*3+a[j] for j in range(3) ]\n\n a=[a[i]%1000000007 for i in range(4)]\nprint(a[3])', 'R=int(input())\nif R<1200: print("ABC")\nelif R<2800: print("ARC")\nelse: print("AGC")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s224151715', 's885973961', 's233795117']
[3064.0, 3064.0, 3316.0]
[17.0, 17.0, 21.0]
[289, 231, 83]
p03288
u199295501
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["# -*- coding: utf-8 -*-\n\nR = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelif:\n print('AGC')\n", "# -*- coding: utf-8 -*-\n\nR = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Accepted']
['s115581303', 's811502212']
[2940.0, 2940.0]
[17.0, 17.0]
[128, 128]
p03288
u203995947
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['import re\ns = input()\npattern = r\'^A\\w[a-z][a-z]*C{1}[a-z]*[a-z]$\'\nif re.match(pattern,s):\n print("AC")\nelse:\n print("WA")\n', 'r = int(input())\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s681028369', 's107994985']
[3188.0, 2940.0]
[19.0, 17.0]
[125, 95]
p03288
u204260373
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R=int(input())\n\nif 1200>R:\n print('ABC')\nelse if 2800>R:\n print('ARC')\nelse:\n print('AGC')", "R=int(input())\n\nif 4208>=R>=2800:\n print('AGC')\nelse if 1200>R:\n print('ABC')\nelse:\n print('ARC')\n \n ", "R=int(input())\nif 1200>R:\n print('ABC')\nelse if 2800>R:\n print('ARC')\nelse:\n print('AGC')", "R=int(input())\n\nif 1200>R:\n print('ABC')\nelif 2800>R:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s665683217', 's892256851', 's895148348', 's185231067']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[93, 106, 92, 90]
p03288
u213854484
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = input()\nif R < 1200:\n print("ABC")\nelif 1200 <= R < 2800:\n print("ARC")\nelse print("AGC")', 'R = int(input())\nif R < 1200:\n print("ABC")\nelif 1200 <= R < 2800:\n print("ARC")\nelse print("AGC")', 'R = int(input())\nif R < 1200:\n print("ABC")\nelif 1200 <= R < 2800:\n print("ARC")\nelse :\n print("AGC")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s240532421', 's974173209', 's256396412']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[99, 104, 110]
p03288
u214617707
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['n = int(input())\nprint("AGC")', 's = input()\nn = len(s)\nmod = 10 ** 9 + 7\ndp = [[0] * 4 for i in range(n + 1)]\ndp[0][0] = 1\n\nfor i in range(n):\n if s[i] == "A":\n dp[i + 1][1] = dp[i + 1][1] + dp[i][0]\n dp[i + 1][0] += dp[i][0]\n dp[i + 1][1] += dp[i][1]\n dp[i + 1][2] += dp[i][2]\n dp[i + 1][3] += dp[i][3]\n elif s[i] == "B":\n dp[i + 1][2] = dp[i + 1][2] + dp[i][1]\n dp[i + 1][0] += dp[i][0]\n dp[i + 1][1] += dp[i][1]\n dp[i + 1][2] += dp[i][2]\n dp[i + 1][3] += dp[i][3]\n elif s[i] == "C":\n dp[i + 1][3] = dp[i + 1][3] + dp[i][2]\n dp[i + 1][0] += dp[i][0]\n dp[i + 1][1] += dp[i][1]\n dp[i + 1][2] += dp[i][2]\n dp[i + 1][3] += dp[i][3]\n else:\n for j in range(4):\n dp[i + 1][j] += 3 * dp[i][j]\n dp[i + 1][1] += dp[i][0]\n dp[i + 1][2] += dp[i][1]\n dp[i + 1][3] += dp[i][2]\n for j in range(4):\n dp[i + 1][0] %= mod\n dp[i + 1][1] %= mod\n dp[i + 1][2] %= mod\n dp[i + 1][3] %= mod\n\nprint(dp[n][3] % mod)', 'n = int(input())\nif n < 1200:\n print("ABC")\nelif n < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s082127985', 's392405585', 's723505402']
[3316.0, 3192.0, 2940.0]
[20.0, 18.0, 17.0]
[29, 1046, 101]
p03288
u220345792
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["print('AC')", "R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Wrong Answer', 'Accepted']
['s745726291', 's437374778']
[2940.0, 2940.0]
[17.0, 18.0]
[11, 102]
p03288
u222634810
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800\n print('ARC')\nelse:\n print('AGC')", "R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Accepted']
['s497810829', 's083014879']
[2940.0, 2940.0]
[17.0, 17.0]
[101, 102]
p03288
u227020436
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n \nmodulo = 10 ** 9 + 7\n \nS = input()\n \ndef nleft(S, c):\n \n \n def _left(S, c):\n \n n = [0 for c in S]\n for i in range(1, len(n)):\n n[i] = n[i-1] + (1 if S[i-1] == c else 0)\n return n\n \n \n n = _left(S, c)\n q = _left(S, '?')\n \n for i in range(len(n)):\n n[i] *= (3 ** q[i]) % modulo \n n[i] += (3 ** (q[i] - 1)) * q[i] % modulo \n n[i] %= modulo\n return n\n \ndef nright(S, c):\n n = nleft(list(reversed(S)), c)\n n.reverse()\n return n\n \nleft = nleft (S, 'A')\nright = nright(S, 'C')\n \n\nabc = 0\nfor i in range(0, len(S)):\n if S[i] in 'B?':\n abc += left[i] * right[i]\n \nabc = int(abc) % modulo\nprint(abc)\n", "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n \nfrom math import ceil\n \nD, G = [int(t) for t in input().split()]\np = []\nc = []\nfor i in range(D):\n p_, c_ = [int(t) for t in input().split()]\n p.append(p_)\n c.append(c_)\n \ndef minsolve(G, p, c, i):\n \n if i <= 0:\n return float('inf')\n n = min(ceil(G / (100 * i)), p[i-1])\n s = 100 * i * n\n if n == p[i-1]:\n s += c[i-1]\n if s >= G:\n return min(n, minsolve(G, p, c, i-1))\n else:\n return min(n + minsolve(G - s, p, c, i-1), minsolve(G, p, c, i-1))\n \nm = min(minsolve(G, p, c, i) for i in range(1, D+1))\nprint(m)", "R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s646756872', 's997399617', 's492929631']
[3064.0, 3064.0, 2940.0]
[18.0, 18.0, 19.0]
[1189, 682, 96]
p03288
u228636605
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = int(input())\n\nif r < 1199:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")\n', 'r = int(input())\n\nif r < 1200:\n print("ABC")\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Wrong Answer', 'Accepted']
['s907934846', 's848629816']
[2940.0, 2940.0]
[17.0, 17.0]
[103, 103]
p03288
u229518917
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['S=input()\nif (S[0]==\'A\' and S[2:-1].count(\'C\')==1):\n pos=S.index("C")\n check=S[1:pos]+S[pos+1:]\n if check.islower():\n print(\'AC\')\n else:\n print(\'WA\')\nelse:\n print(\'WA\')', "R=int(input())\nif R<1200:\n print('ABC')\nelif 1200<=R<2800:\n print('ARC')\nelse:\n print('AGC')"]
['Wrong Answer', 'Accepted']
['s896197692', 's848691558']
[3060.0, 2940.0]
[17.0, 17.0]
[197, 101]
p03288
u249727132
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['a = int, input().split()\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse:\n print("AGC")', 'S = input()\nif S[0] == "A" and S[2:-1].count("C") == 1 and "C" in S[2:-1]:\n s = S.replace("A", "a").replace("C", "c")\n t = s.lower();\n if s == t:\n print("AC")\n exit()\nprint("WA")', 'a = int(input())\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse a \n print("AGC")', 'a = int(input().split())\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse:\n print("AGC")', 'a = int(input())\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s493582790', 's606902036', 's778212099', 's900917264', 's300795828']
[2940.0, 3060.0, 2940.0, 2940.0, 3060.0]
[17.0, 19.0, 17.0, 17.0, 20.0]
[109, 201, 103, 109, 101]
p03288
u252210202
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input())\nif R < 1200:\n print('ABC')\nif 1200 <= R < 2800:\n print('ARC')\nelse:\n print('AGC')\n", "R = int(input())\nif R < 1200:\n print('ABC')\nif R < 2800:\n print('ARC')\nelse:\n print('AGC')\n", "R = int(input())\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s089768471', 's443582794', 's761300931']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 19.0]
[108, 100, 101]
p03288
u254871849
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["import sys\n\nr = map(int, sys.stdin.readline().rstrip())\n\ndef main():\n if r < 1200:\n return 'ABC'\n elif r < 2800:\n return 'ARC'\n else:\n return 'AGC'\n\nif __name__ == '__main__':\n ans = main()\n print(ans)", "import sys\n\nr = int(sys.stdin.readline().rstrip())\n\ndef main():\n if r < 1200: ans = 'ABC'\n elif r < 2800: ans = 'ARC'\n else: ans = 'AGC'\n print(ans)\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s616299696', 's020488231']
[2940.0, 3060.0]
[17.0, 17.0]
[237, 200]
p03288
u259979862
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['import copy\n\ndef main():\n string = input()\n str_list = list(string)\n if str_list[0] == "A":\n cnt = 0\n index = 0\n for i in range(2, len(str_list)-1):\n if str_list[i] == "C":\n cnt += 1\n index = i\n if cnt == 1:\n str_list[0] = "a"\n str_list[index] = "c"\n str_changed = "".join(str_list)\n if str_changed.islower():\n print("AC")\n else:\n print("WA")\n else:\n print("WA")\n\n else:\n print("WA")\n\n\nif __name__ == "__main__":\n main()', 'import copy\n\ndef main():\n string = input()\n if string[0] == "A":\n cnt = 0\n index = 0\n for i in range(2, len(string)-1):\n if string[i] == "C":\n cnt += 1\n index = i\n if cnt == 1:\n cp_str = copy.copy(string)\n string = "a" + string[1:index-1] + "c" + string[index+1:]\n print(string)\n print(cp_str)\n if string == cp_str.lower():\n print("AC")\n else:\n print("WA")\n else:\n print("WA")\n else:\n print("WA")\n\n\nif __name__ == "__main__":\n main()', 'import copy\n\ndef main():\n string = input()\n if string[0] == "A":\n cnt = 0\n index = 0\n for i in range(2, len(string)-1):\n if string[i] == "C":\n cnt += 1\n index = i\n if cnt == 1:\n cp_str = copy.copy(string)\n print(string[1:1])\n if index == 2:\n string = "a" + string[1:index] + "c" + string[index+1:]\n else:\n string = "a" + string[1:index-1] + "c" + string[index+1:]\n print(string)\n if string == cp_str.lower():\n print("AC")\n else:\n print("WA")\n else:\n print("WA")\n else:\n print("WA")\n\n\nif __name__ == "__main__":\n main()', 'def main():\n num = int(input())\n if num < 1200:\n print("ABC")\n elif num < 2800:\n print("ARC")\n else:\n print("AGC")\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s182223391', 's471591194', 's874430248', 's556054658']
[3444.0, 3444.0, 3700.0, 2940.0]
[23.0, 57.0, 93.0, 17.0]
[614, 635, 761, 186]
p03288
u272557899
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = int(input())\nif r >= 0 and r < 1200\n print("ABC")\nif r >= 1200 and r < 2800\n print("ARC")\nif r >= 2800\n print("AGC")', 'r = int(input())\nif r >= 0 and r < 1200:\n print("ABC")\nif r >= 1200 and r < 2800:\n print("ARC")\nif r >= 2800:\n print("AGC")']
['Runtime Error', 'Accepted']
['s432274768', 's066897703']
[2940.0, 2940.0]
[17.0, 17.0]
[123, 126]
p03288
u278379520
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r=int(input())\nif r<1200:\n print('ABC')\nelif\u3000r<2800:\n print('ARC')\nelse:\n print('AGC')\n", "r=int(input())\nif r<1200:\n print('ABC')\nelif\u3000r<2800:\n print('ARC')\nelse:\n print('AGC')\n", "r=int(input())\nif r<1200:\n print('ABC')\nelif\u30001200<=r<2800:\n print('ARC')\nelse:\n print('AGC')", "r=int(input())\nif r<1200:\n print('ABC')\nelif r<2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s521745668', 's554509206', 's596147086', 's978788335']
[3064.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[92, 98, 97, 96]
p03288
u288430479
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = input()\nif r < 1200:\n print(\'ABC\')\nelif r >= 2800:\n print("AGC")\nelse:\n print(\'ARC\')', 'r = int(input())\nif r < 1200:\n print(\'ABC\')\nelif r >= 2800:\n print("AGC")\nelse:\n print(\'ARC\')']
['Runtime Error', 'Accepted']
['s328973062', 's040082673']
[2940.0, 2940.0]
[19.0, 17.0]
[91, 96]
p03288
u314050667
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['a = int(input)\n\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse:\n print("AGC")', 'a = int(input())\n\nif a < 1200:\n print("ABC")\nelif a < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Runtime Error', 'Accepted']
['s808084415', 's844944095']
[2940.0, 2940.0]
[17.0, 17.0]
[100, 102]
p03288
u320763652
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = int(input())\n\nif R < 1200:\n print("ABC")\nif R < 2800:\n print("ARC")\nelse:\n print("AGC")\n', 'R = int(input())\n\nif R < 1200:\n print("ABC")\nelif R < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Wrong Answer', 'Accepted']
['s267585735', 's354520138']
[2940.0, 2940.0]
[17.0, 17.0]
[101, 103]
p03288
u325227960
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['s=input()\n\na=0\nab=0\nabc=0\nq=0\n\n#if s[0]=="A" :\n# a=1\n#elif s[0]=="?":\n# a=1\n\n#print(str(a)+" "+str(ab)+" "+str(abc)+" "+str(q))\n\nfor i in range(len(s)):\n if s[i]=="A":\n a=a+3**q\n elif s[i]=="B":\n ab=ab+a\n elif s[i]=="C":\n abc=abc+ab\n elif s[i]=="?":\n abc=abc*3+ab\n \n ab=ab*3+a\n a=a*3\n \n a=a+3**q\n q+=1\n #print(str(a)+" "+str(ab)+" "+str(abc)+" "+str(q))\n \nprint(abc%(10**9+7))\n', 'R=int(input())\nif R<1200 :\n print("ABC")\nelif R<2800 :\n print("ARC")\nelse:\n print("AGC")\n']
['Wrong Answer', 'Accepted']
['s418482214', 's432734868']
[3060.0, 3316.0]
[18.0, 21.0]
[423, 92]
p03288
u326261815
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['a=input()\nif a<=1199:\n print("ABC")\nelif a<=2799:\n print("ARC")\nelse:\n print("AGC")', 'a=input()\nif int(a)<=1199:\n print("ABC")\nelif int(a)<=2799:\n print("ARC")\nelse:\n print("AGC")']
['Runtime Error', 'Accepted']
['s257136033', 's676847795']
[8788.0, 9156.0]
[24.0, 29.0]
[86, 96]
p03288
u327248573
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = int(input())\nif R > 1200:\n print("ABC")\nelif 1200 <= R < 2800:\n print("ARC")\nelse:\n print("AGC")', 'R = int(input())\nif R < 1200:\n print("ABC")\nelif 1200 <= R < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s555374635', 's616932183']
[2940.0, 2940.0]
[17.0, 17.0]
[109, 109]
p03288
u328755070
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["print('AGC')\n", "N = int(input())\nif N < 1200:\n print('ABC')\nelif N < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Wrong Answer', 'Accepted']
['s798008295', 's795551245']
[2940.0, 2940.0]
[17.0, 19.0]
[13, 102]
p03288
u331464808
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['r = int(input())\nif r < 1200:\n print(ABC)\nelif 1200 <= r < 2800:\n print(ARC)\nelse:\n print(AGC)', 'r = int(input())\nif r < 1200:\n print(ABC)\nif 1200 <= r < 2800:\n print(ARC)\nelse:\n print(AGC)', 'r = input()\nif r < 1200:\n print(ABC)\nif 1200 <= r < 2800:\n print(ARC)\nelse:\n print(AGC)', "r = int(input())\nif r < 1200:\n print('ABC')\nelif 1200 <= r < 2800:\n print('ARC')\nelse:\n print('AGC')"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s097705791', 's530483049', 's775334930', 's035875669']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 20.0, 17.0, 17.0]
[97, 95, 90, 103]
p03288
u339851548
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["r = input()\nif r < 1200:\n print('ABC')\nelif 1200 <= r < 2800:\n print('ARC')\nelse:\n print('AGC')\n", "r = int(input())\nif r < 1200:\n print('ABC')\nelif 1200 <= r < 2800:\n print('ARC')\nelse:\n print('AGC')\n"]
['Runtime Error', 'Accepted']
['s406144147', 's852331228']
[2940.0, 3064.0]
[18.0, 18.0]
[105, 110]
p03288
u344412812
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['n = int(input())\nans = ""\nif n < 1200:\n\tans = "ABC"\nelse if n < 2800:\n\tans = "ARC"\nelse:\n\tans = "AGC"\n\nprint(ans)\n', 'n = int(input())\nans = ""\nif n < 1200:\n\tans = "ABC"\nelif n < 2800:\n\tans = "ARC"\nelse:\n\tans = "AGC"\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s550551220', 's237952483']
[2940.0, 2940.0]
[17.0, 17.0]
[114, 111]
p03288
u349600366
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R =int(input())\nprint("ARC" if R <1200 else "AGC")', 'R =int(input())\nprint("ABC" if R <1200 else "ARC" if R < 2800 else "AGC")\n']
['Wrong Answer', 'Accepted']
['s787027846', 's584126391']
[2940.0, 2940.0]
[17.0, 17.0]
[50, 74]
p03288
u355265861
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['# -*- coding: utf-8 -*-\n\nrate = int(input("Enter your rate: "))\n\nif rate < 1200:\n print("ABC")\nelif rate < 2800:\n print("ARC")\nelse:\n print("AGC")', '# -*- coding: utf-8 -*-\n \nrate = int(input("Enter your rate: "))\n \nif rate < 1200:\n print("ABC")\nelif rate >= 1200 and rate < 2800:\n print("ARC")\nelse:\n print("AGC")', '# -*- coding: utf-8 -*-\n\nrate = int(input("Enter your rate: "))\n\nif rate < 1200:\n print("ABC")\nelif rate >= 1200 and rate < 2800:\n print("ARC")\nelif:\n print("AGC")', 'r = int(input())\n\nif r < 1200:\n print("ABC");\nelif r < 2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s241912689', 's812295898', 's857101787', 's488165576']
[3064.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[155, 174, 172, 103]
p03288
u360515075
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['N = int(input())\n\nif N< 1200:\n print ("ABC")\nelsif N< 2800:\n print ("ARC")\nelse:\n print ("AGC")', 'N = int(input())\n\nif N < 1200:\n print ("ABC")\nelif N < 2800:\n print ("ARC")\nelse:\n print ("AGC")']
['Runtime Error', 'Accepted']
['s839139020', 's988217442']
[2940.0, 2940.0]
[17.0, 17.0]
[98, 99]
p03288
u362700058
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['R = int(input())\nif R<2400:\n print("ARC")\nelif R<1200:\n print("ABC")\nelse:\n print("AGC")', 'R = int(input())\nif R<1200:\n print("ABC")\nelif R<2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s785479977', 's006783303']
[2940.0, 2940.0]
[17.0, 17.0]
[97, 97]
p03288
u366959492
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['d,g=map(int,input().split())\nans=10000\np=[]\nc=[]\nfor i in range(d):\n a,b=map(int,input().split())\n p.append(a)\n c.append(b)\nfor i in range(2**d):\n x=0\n cou=0\n l=[]\n for j in range(d):\n if ((i>>j)&1):\n x+=c[j]+p[j]*(j+1)*100\n cou+=p[j]\n else:\n l.append(j)\n l.sort(reverse=True)\n k=0\n while x<g:\n for _ in range(p[l[k]]):\n if x>=g:\n break\n cou+=1\n x+=(100*(l[k]+1))\n k+=1\n if k>=len(l):\n break\n ans=min(ans,cou)\nprint(ans)\n', 'r=int(input())\nif r<1200:\n print("ABC")\nelif r<2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Runtime Error', 'Accepted']
['s199580978', 's145366739']
[3064.0, 2940.0]
[19.0, 17.0]
[581, 96]
p03288
u367130284
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['mod=10**9+7\ns=input()\nn=len(s)\ndp=[[0]*4 for i in range(n+1)] # A B C ABC\ndp[0][0]=1\nfor i in range(1,n+1):\n if s[i-1]=="A":\n dp[i][0]=dp[i-1][0] % mod\n dp[i][1]=(dp[i-1][1] + dp[i-1][0]) % mod\n dp[i][2]=dp[i-1][2] % mod\n dp[i][3]=dp[i-1][3] % mod\n elif s[i-1]=="B":\n dp[i][0]=dp[i-1][0] % mod\n dp[i][1]=dp[i-1][1] % mod\n dp[i][2]=(dp[i-1][2] + dp[i-1][1]) % mod\n dp[i][3]=dp[i-1][3] % mod\n elif s[i-1]=="C":\n dp[i][0]=dp[i-1][0] % mod\n dp[i][1]=dp[i-1][1] % mod\n dp[i][2]=dp[i-1][2] % mod\n dp[i][3]=(dp[i-1][3] + dp[i-1][2]) % mod\n else:\n dp[i][0]=dp[i-1][0]*3 % mod\n dp[i][1]=(dp[i-1][1]*3 + dp[i-1][0]) % mod\n dp[i][2]=(dp[i-1][2]*3 + dp[i-1][1]) % mod\n dp[i][3]=(dp[i-1][3]*3 + dp[i-1][2]) % mod\nprint(dp[-1][-1]% mod)', 's=int(input())\nif s<1200:\n print("ABC")\nelif 1200<=s<2800:\n print("ARC")\nelse:\n print("AGC")']
['Wrong Answer', 'Accepted']
['s294772434', 's342831195']
[3192.0, 2940.0]
[19.0, 18.0]
[846, 95]
p03288
u368796742
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['n = int(input())\nif n < 1199:\n print("ABC")\nelif 1200 <= n < 2800:\n print("ARC")\nelse:\n print("AGC")\n', 'n = int(input())\nif n < 1199:\n print("ABC")\nelif n < 2800:\n print("ARC")\nelse:\n print("AGC)', 'n = int(input())\nif n < 1199:\n print("ABC")\nelif n < 2800:\n print("ARC")\nelse:\n print("AGC")\n', 'n = int(input())\nif n < 1200:\n print("ABC")\nelif 1200 <= n < 2800:\n print("ARC")\nelse:\n print("AGC")\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s157819263', 's174322930', 's911217675', 's278590691']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[104, 94, 96, 104]
p03288
u372173285
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
["R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse\n print('AGC')\n\n", "R = int(input())\n\nif R < 1200:\n print('ABC')\nelif R < 2800:\n print('ARC')\nelse:\n print('AGC')\n\n"]
['Runtime Error', 'Accepted']
['s258912209', 's426879172']
[2940.0, 2940.0]
[17.0, 17.0]
[103, 104]
p03288
u375695365
2,000
1,048,576
A programming competition site _AtCode_ regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AGC, which is rated for all contestants. Takahashi's rating on AtCode is R. What is the next contest rated for him?
['a=int(input())\nif a<1200:\n print("ABC")\nelse if 2800<=a:\n print("AGC")\nelse:\n print("ARC")\n', '=int(input())\nif a<1200:\n print("ABC")\nelif 2800<=a:\n print("AGC")\nelse:\n print("ARC")\n', '=int(input())\nif a<1200:\n print("ABC")\nelse if 2800<=a:\n print("AGC")\nelse:\n print("ARC")', 'a=int(input())\nif a<1200:\n print("ABC")\nelif 2800<=a:\n print("AGC")\nelse:\n print("ARC")\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s237513482', 's573276893', 's622932910', 's666941778']
[8948.0, 8960.0, 9000.0, 9152.0]
[22.0, 25.0, 19.0, 26.0]
[94, 90, 92, 91]