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
p03808
u201234972
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['#import sys\n#input = sys.stdin.readline\nfrom itertools import accumulate\ndef main():\n N = int( input())\n A = list( map( int, input().split()))\n C = [0]*(N*2+2)\n L = [0]*(N*2+2)\n l = (N*(N+1))//2\n if sum(A)%(N*(N+1)//2) != 0:\n print("No")\n return\n t = sum(A)//(N*(N+1)//2)\n for i in range(N):\n if i == 0:\n if (A[0] - A[-1] + (N-1)*t)%N != 0:\n print("No")\n return\n k = (A[0] - A[-1] + (N-1)*t)//N\n else:\n if (A[i] - A[i-1] + (N-1)*t)%N != 0:\n print("No")\n return\n k = (A[i] - A[i-1] + (N-1)*t)//N\n C[i] += t-k\n C[i+N] -= t-k\n L[i+N] -= (t-k)*N\n S = list( accumulate(C))\n\n for i in range(N*2+1):\n S[i+1] += S[i] + L[i+1]\n\n for i in range(N):\n if A[i] != S[i] + S[i+N]:\n print("No")\n return\n print("Yes")\n \n \nif __name__ == \'__main__\':\n main()\n', '#import sys\n#input = sys.stdin.readline\nfrom itertools import accumulate\ndef main():\n N = int( input())\n A = list( map( int, input().split()))\n C = [0]*(N*2+2)\n L = [0]*(N*2+2)\n cnt = 0\n if sum(A)%(N*(N+1)//2) != 0:\n print("NO")\n return\n t = sum(A)//(N*(N+1)//2)\n for i in range(N):\n if (A[i] - A[i-1] + (N-1)*t)%N != 0:\n print("NO")\n return\n k = (A[i] - A[i-1] + (N-1)*t)//N\n C[i] += t-k\n C[i+N] -= t-k\n cnt += t-k\n L[i+N] -= (t-k)*N\n S = list( accumulate(C))\n if cnt > t:\n print("NO")\n break\n for i in range(N*2+1):\n S[i+1] += S[i] + L[i+1]\n\n for i in range(N):\n if A[i] != S[i] + S[i+N]:\n print("NO")\n return\n print("YES")\n \n \nif __name__ == \'__main__\':\n main()\n', 'import sys\ninput = sys.stdin.readline\ndef main():\n N = int( input())\n A = list( map( int, input().split()))\n if sum(A)%(N*(N+1)//2) != 0:\n print("NO")\n return\n t = sum(A)//(N*(N+1)//2)\n d = [0]*N\n for i in range(N):\n d[i] = A[i] - A[i-1] - t\n for i in range(N):\n if d[i] > 0 or d[i]%N != 0:\n print("NO")\n return\n print("YES")\n \nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s439857587', 's912504755', 's980978005']
[20820.0, 3064.0, 14260.0]
[201.0, 18.0, 72.0]
[983, 850, 443]
p03808
u284854859
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
["n = int(input())\na = list(map(int,input().split()))\n\nb = [] \nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(a[0]-a[n-1])\n\nw = n*(n+1)//2 \n\nif sum(a)%w != 0:\n print('NO')\nelse:\n res = 0\n c = sum(a)//w \n for i in range(n):\n b[i]-=c\n \n for i in range(n):\n if (-b[i]) % n == 0 and b[i] <= 0:\n res += (-b[i])//n\n else:\n print('NO')\n break\n \n if res == c:\n print('Yes')\n else:\n\n print('NO')", "n = int(input())\na = list(map(int,input().split()))\n\nb = [] \nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(a[0]-a[n-1])\n\nw = n*(n+1)//2 \n\nif sum(a)%w != 0:\n print('NO')\nelse:\n res = 0\n c = sum(a)//w \n for i in range(n):\n b[i]-=c\n \n for i in range(1,n):\n if (-b[i]) % 5 == 0 and b[i] <= 0:\n res += (-b[i])//5\n else:\n print('NO')\n break\n \n if res == c:\n print('Yes')\n else:\n\n print('NO')", "n = int(input())\na = list(map(int,input().split()))\n\nb = [] \nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(a[0]-a[n-1])\n\nw = n*(n+1)//2 \n\nif sum(a)%w != 0:\n print('NO')\nelse:\n res = 0\n c = sum(a)//w \n for i in range(n):\n b[i]-=c\n \n for i in range(1,n):\n if (-b[i]) % n == 0 and b[i] <= 0:\n res += (-b[i])//n\n else:\n print('NO')\n break\n \n if res == c:\n print('Yes')\n else:\n\n print('NO')", "n = int(input())\na = list(map(int,input().split()))\n\nb = [] \nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(a[0]-a[n-1])\n\nw = n*(n+1)//2 \n\n\nif sum(a)%w != 0:\n print('NO')\nelse:\n res = 0\n c = sum(a)//w \n for i in range(n):\n b[i]-=c\n \n for i in range(n):\n if (-b[i]) % n == 0 and b[i] <= 0:\n res += (-b[i])//n\n else:\n res = c+1\n break\n \n if res == c:\n print('YES')\n else:\n\n print('NO')"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s329688470', 's476561962', 's533314031', 's381761017']
[15060.0, 15060.0, 15060.0, 14996.0]
[116.0, 113.0, 121.0, 174.0]
[553, 555, 555, 552]
p03808
u368796742
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['n = int(input())\na = list(map(int,input().split()))\ncum = sum(a)\nd = n*(n+1)//2\nif cum%d:\n print("NO")', 'n = int(input())\na = list(map(int,input().split()))\ncum = sum(a)\nd = n*(n+1)//2\nif cum%d:\n print("NO")\n exit()\nx = cum//d\n\na.append(a[0])\ncount = 0\nfor i in range(n):\n dif = a[i+1]-a[i]\n if (x-dif)%n or x-dif < 0:\n print("NO")\n exit()\n count += (x-dif)//n\nif count == x:\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s483385919', 's469014545']
[20352.0, 20360.0]
[51.0, 91.0]
[105, 338]
p03808
u375616706
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\nS = sum(A)\nlast = A[-1]\nfor i in reversed(range(1, N)):\n A[i] -= A[i-1]\nA[0] -= last\n\n\nans = "YES"\nif S % N != 0 or sum(A) != 0:\n ans = "NO"\nelse:\n t = S//N\n A = list(map(lambda x: x % N, A))\n if any(a != A[0] for a in A):\n ans = "NO"\n if sum(a//5 for a in A) != -t:\n ans = "NO"\nprint(ans)\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\nS = sum(A)\nlast = A[-1]\nfor i in reversed(range(1, N)):\n A[i] -= A[i-1]\nA[0] -= last\n\nprint(A)\nif S % N == 0 and sum(A) == 0:\n print("YES")\nelse:\n print("NO")\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\n\ndef solve():\n N = int(input())\n A = list(map(int, input().split()))\n\n k = sum(A)//(N*(N+1)//2)\n if sum(A) % (N*(N+1)//2) != 0 or True:\n return "NO"\n\n D = [0]*N\n for i in range(N-1):\n D[i] = A[i+1]-A[i]-k\n D[-1] = A[0]-A[-1]-k\n\n cnt = sum([v//N for v in D])\n if all(x <= 0 and -x % N == 0 for x in D)and -cnt == k:\n return "YES"\n else:\n return "NO"\n\n\nprint(solve())\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\nS = sum(A)\nlast = A[-1]\nfor i in reversed(range(1, N)):\n A[i] -= A[i-1]\nA[0] -= last\n\nT = (N*N+N)//2\n\nans = "YES"\nif S % T != 0 or sum(A) != 0:\n ans = "NO"\nelse:\n t = S//T\n A = list(map(lambda x: x % N, A))\n if any(a != A[0] for a in A):\n ans = "NO"\n if sum(a//5 for a in A) != -(t % N):\n ans = "NO"\nprint(ans)\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\nS = sum(A)\nlast = A[-1]\nfor i in reversed(range(1, N)):\n A[i] -= A[i-1]\nA[0] -= last\n\n\nans = "YES"\nif S % N != 0 or sum(A) != 0:\n ans = "NO"\nelse:\n t = S//N\n A = list(map(lambda x: x % N, A))\n if any(a != A[0] for a in A):\n ans = "NO"\n if sum(a//5 for a in A) != -(t % N):\n ans = "NO"\nprint(ans)\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\n\ndef solve():\n N = int(input())\n A = list(map(int, input().split()))\n\n k = sum(A)//(N*(N+1)//2)\n if sum(A) % (N*(N+1)//2) != 0:\n return "NO"\n\n D = [0]*N\n for i in range(N-1):\n D[i] = A[i+1]-A[i]-k\n D[-1] = A[0]-A[-1]-k\n\n cnt = sum([v//N for v in D])\n if all(x <= 0 and -x % N == 0 for x in D)and -cnt == k:\n return "YES"\n else:\n return "NO"\n\n\nprint(solve())\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s231788508', 's283906854', 's316816582', 's421479143', 's810349263', 's767363650']
[15012.0, 14252.0, 14652.0, 14276.0, 15020.0, 15044.0]
[89.0, 78.0, 43.0, 89.0, 92.0, 72.0]
[474, 320, 523, 495, 480, 515]
p03808
u476604182
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
["N, *A = map(int, open(0).read().split())\nM = (N+1)*N//2\nS = sum(A)\nif S%M!=0:\n print('No')\n exit()\ncnt = S//M\nx = 0\nfor i in range(N):\n df = A[(i+1)%N]-A[i]\n if (cnt-df)%N!=0 or cnt<df:\n print('No')\n break\n x += (cnt-df)//N\nelse:\n if x==cnt:\n print('Yes')\n else:\n print('No')", "N, *A = map(int, open(0).read().split())\nM = (N+1)*N//2\nS = sum(A)\nif S%M!=0:\n print('NO')\n exit()\ncnt = S//M\nfor i in range(N):\n df = A[(i+1)%N]-A[i]\n if (cnt-df)%N!=0 or cnt<df:\n print('NO')\n break\nelse:\n print('Yes')", "N, *A = map(int, open(0).read().split())\nM = (N+1)*N//2\nS = sum(A)\nif S%M!=0:\n print('NO')\n exit()\ncnt = S//M\nfor i in range(N):\n df = A[(i+1)%N]-A[i]\n if (cnt-df)%N!=0 or cnt<df:\n print('NO')\n break\nelse:\n print('YES')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s070072838', 's408823590', 's017649349']
[14068.0, 14068.0, 14068.0]
[95.0, 79.0, 79.0]
[294, 230, 230]
p03808
u505830998
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['# -*- coding: utf-8 -*-\n\ndef io_generator():\n\treturn input()\n\n#+++++++++++++++++++\n\ndef main(io):\n\tret_ng=\'NO\'\n\tret_ok=\'YES\'\n\treturn ret_ng\n\t\n\tn=int(io())\n\tl= list(map(int, io().split()))\n\t\n\tv_one_act =n*(n+1)/2\n\t\n\tif sum(l)%v_one_act != 0:\n\t\treturn ret_ng\n\t\t\n\tact_num=sum(l)//v_one_act\t\n\tst_num=0\n\tfor a,b in zip(l, l[1:]+l):\n\t\tdiff = b - a\n\t\tif (diff - act_num)%(n)!=0:\n\t\t\treturn ret_ng\n\t\tst=-1*(diff-act_num)//(n)\n\t\tst_num+=st\n\t\n\t#if act_num!=st_num:\n\t#\treturn ret_ng\n\t\t\n\treturn ret_ok\n\n#++++++++++++++++++++\n\nif __name__ == "__main__":\n\tio= lambda : io_generator()\n\tprint (main(io))\n', '# -*- coding: utf-8 -*-\n\ndef io_generator():\n\treturn input()\n\n#+++++++++++++++++++\n\ndef main(io):\n\tret_ng=\'NO\'\n\tret_ok=\'YES\'\n\treturn ret_ng\n\t\n\tn=int(io())\n\tl= list(map(int, io().split()))\n\t\n\tv_one_act =n*(n+1)/2\n\t\n\tif sum(l)%v_one_act != 0:\n\t\treturn ret_ng\n\t\t\n\tact_num=sum(l)//v_one_act\t\n\tst_num=0\n\t\n\tfor a,b in zip(l, l[1:]+l):\n\t\tdiff = b - a\n\t\tif (act_num-diff)%(n)!=0:\n\t\t\treturn ret_ng\n\t\tif (act_num-diff)<0:\n\t\t\treturn ret_ng\n\t\tst= (act_num-diff)//(n)\n\t\tst_num+=st\n\t\n\tif act_num!=st_num:\n\t\treturn ret_ng\n\t\t\n\t\n\t\t\n\treturn ret_ok\n\n#++++++++++++++++++++\n\nif __name__ == "__main__":\n\tio= lambda : io_generator()\n\tprint (main(io))\n', '# -*- coding: utf-8 -*-\n\ndef io_generator():\n\treturn input()\n\n#+++++++++++++++++++\n\ndef main(io):\n\tret_ng=\'NO\'\n\tret_ok=\'YES\'\n\t\n\tn=int(io())\n\tl= list(map(int, io().split()))\n\t\n\tv_one_act =n*(n+1)/2\n\t\n\tif sum(l)%v_one_act != 0:\n\t\treturn ret_ng\n\t\t\n\tact_num=sum(l)//v_one_act\t\n\tst_num=0\n\t\n\tfor a,b in zip(l, l[1:]+l):\n\t\tdiff = b - a\n\t\tif (act_num-diff)%(n)!=0:\n\t\t\treturn ret_ng\n\t\tif (act_num-diff)<0:\n\t\t\treturn ret_ng\n\t\tst= (act_num-diff)//(n)\n\t\tst_num+=st\n\t\n\tif act_num!=st_num:\n\t\treturn ret_ng\n\t\t\n\t\n\t\t\n\treturn ret_ok\n\n#++++++++++++++++++++\n\nif __name__ == "__main__":\n\tio= lambda : io_generator()\n\tprint (main(io))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s041354518', 's833605371', 's198328515']
[3064.0, 3064.0, 14476.0]
[20.0, 18.0, 116.0]
[587, 628, 613]
p03808
u583826716
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
["def main():\n N = int(input())\n A = [int(a) for a in input().rstrip().split()]\n sum_A = sum(A)\n sum_N = (N + 1) * N // 2\n if sum_A % sum_N:\n print('NO')\n\n ope_num = sum_A // sum_N\n \n diffs = [r - l - ope_num for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1]]\n if all([d % N and d < 0 for d in diffs]):\n print('YES')\n else:\n print('NO')\n\n\nif __name__ == '__main__':\n main()", 'def main():\n N = int(input())\n A = [int(a) for a in input().rstrip().split()]\n sum_A = sum(A)\n sum_N = sum(range(1, N + 1))\n if sum_A % sum_N:\n print(\'NO\')\n return\n\n ope_num = sum_A / sum_N\n diffs = [0] * N\n diffs[:-1] = [r - l for l, r in zip(A[:-1], A[1:])]\n diffs[-1] = A[0] - A[-1]\n sums = 0\n for d in [(diff - ope_num) / N == 0 for diff in diffs]:\n if d != int(d):\n print(\'NO\')\n return\n sums += int(d)\n if sums == ope_num:\n print(\'YES\')\n print("NO")', "def main():\n N = int(input())\n A = [int(a) for a in input().rstrip().split()]\n sum_A = sum(A)\n sum_N = (N + 1) * N // 2\n if sum_A % sum_N:\n print('NO')\n\n ope_num = sum_A // sum_N\n diffs = [0] * N\n diffs = [r - l for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1]]\n if all([d % N and d < 0 for d in diffs]):\n print('YES')\n else:\n print('NO')\n\n\nif __name__ == '__main__':\n main()", "def main():\n N = int(input())\n A = [int(a) for a in input().rstrip().split()]\n sum_A = sum(A)\n sum_N = (N + 1) * N // 2\n if sum_A % sum_N:\n print('NO')\n return\n\n ope_num = sum_A // sum_N\n diffs = [r - l - ope_num for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1] - ope_num]\n if all([d % N == 0 and d <= 0 for d in diffs]):\n print('YES')\n else:\n print('NO')\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s086660699', 's384354167', 's498062575', 's990764997']
[14244.0, 3192.0, 14720.0, 14716.0]
[92.0, 22.0, 89.0, 80.0]
[440, 550, 428, 450]
p03808
u638795007
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['def examA():\n N = I()\n A = LI()\n ans = "YES"\n cur = 0\n for a in A:\n if a%2==1:\n cur +=1\n if cur%2==1:\n ans = "NO"\n print(ans)\n return\n\ndef examB():\n N = I()\n A = LI()\n ans = "YES"\n sumA = sum(A)\n oneA = (1+N)*N//2\n if sumA%oneA>0:\n ans = "NO"\n ope = sumA//oneA\n \n cur = 0\n for i in range(N):\n now = ope - (A[i]-A[i-1])\n if now%N>0:\n# print(now,i)\n ans = "NO"\n break\n cur += now//N\n if cur==ope:\n ans = "NO"\n print(ans)\n return\n\nimport sys,copy,bisect,itertools,heapq,math\nfrom heapq import heappop,heappush,heapify\nfrom collections import Counter,defaultdict,deque\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef SI(): return sys.stdin.readline().strip()\nglobal mod,inf\nmod = 10**9 + 7\ninf = 10**18\n\nif __name__ == \'__main__\':\n examB()\n', 'def examA():\n N = I()\n A = LI()\n ans = "YES"\n cur = 0\n for a in A:\n if a%2==1:\n cur +=1\n if cur%2==1:\n ans = "NO"\n print(ans)\n return\n\ndef examB():\n N = I()\n A = LI()\n ans = "YES"\n sumA = sum(A)\n oneA = (1+N)*N//2\n if sumA%oneA!=0:\n ans = "NO"\n ope = sumA//oneA\n \n cur = 0\n for i in range(N):\n now = ope - (A[i]-A[i-1])\n if now%N!=0 or now<0:\n# print(now,i)\n ans = "NO"\n break\n cur += now//N\n if cur!=ope:\n ans = "NO"\n print(ans)\n return\n\nimport sys,copy,bisect,itertools,heapq,math\nfrom heapq import heappop,heappush,heapify\nfrom collections import Counter,defaultdict,deque\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef SI(): return sys.stdin.readline().strip()\nglobal mod,inf\nmod = 10**9 + 7\ninf = 10**18\n\nif __name__ == \'__main__\':\n examB()\n']
['Wrong Answer', 'Accepted']
['s212027078', 's552859166']
[15548.0, 15524.0]
[70.0, 72.0]
[1115, 1126]
p03808
u667024514
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['n=int(input())\nlis=list(map(int,input().split()))\nnum=(n*(n+1))//2\nif sum(lis)%num!=0:\n print("No")\n exit()\nli=[lis[i]-lis[i-1]-sum(lis)//num for i in range(n)]\nans=0\nfor k in range(n):\n if -li[k]%n!=0:\n print("No")\n exit()\n ans+=-li[k]//n\nif ans == sum(lis)//num:print("Yes")\nelse:print("No")\n', 'n=int(input())\nlis=list(map(int,input.split()))\nnum=(n*(n+1))//2\nif sum(lis)%num!=0:\n print("No")\n exit()\nli=[lis[i]-lis[i-1]-sum(lis)//num for i in range(n)]\nans=0\nfor k in range(n):\n if -li[k]%n!=0:\n print("No")\n exit()\n ans+=-li[k]//n\nif ans == sum(lis)//num:print("Yes")\nelse:print("No")', 'n = int(input())\nlis = list(map(int,input().split()))\nif sum(lis) % n != 0:\n print("NO")\n exit()\nnum = sum(lis) // n\nli = [lis[i] -lis[i-1] -num for i in range(n)]\nans = 0\nfor i in range(n):\n if li[i] % n != 0:\n print("NO")\n exit()\n ans += li[i] // n\nif ans == num:\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nlis=list(map(int,input().split()))\nnum=(n*(n+1))//2\nif sum(lis)%num!=0:\n print("NO")\n exit()\nans=0\nfor k in range(n):\n if -(lis[i]-lis[i-1]-sum(lis)//num)%n!=0:\n print("NO")\n exit()\n ans+=-(lis[i]-lis[i-1]-sum(lis)//num)//n\nif ans == sum(lis)//num:print("YES")\nelse:print("NO")\n', 'n = int(input())\nlis = list(map(int,input().split()))\nif sum(lis) % sum([i for i in range(1,n+1)]) != 0:\n print("NO")\n exit()\nkey = sum(lis) // sum([i for i in range(1,n+1)])\nli = [-lis[i]+lis[i-1]+key for i in range(n)]\nfor num in li:\n if num < 0 or num % n != 0:\n print("NO")\n exit()\nprint("YES")']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s340007650', 's344360697', 's569517879', 's912145302', 's721428853']
[14252.0, 3064.0, 14592.0, 14104.0, 14292.0]
[2104.0, 17.0, 64.0, 44.0, 87.0]
[304, 301, 310, 303, 321]
p03808
u667084803
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['import sys\nN=int(input())\nA=list(map(int,input().split()))\ntotal=0\nfor i in range(N):\n total+=A[i]\nif total*2/((N+1)*N)%1!=0:\n print("NO")\n sys.exit()\ntimes=int(total*2/((N+1)*N))\nif (times-A[0]+A[N-1])/N%1! or times-A[0]+A[N-1]<0=0:\n print("NO")\n sys.exit()\nB=(times-A[0]+A[N-1])/N\nfor i in range(N-1):\n B+=(times-A[i+1]+A[i])/N\n if (times-A[i+1]+A[i])/N%1!=0 or times-A[i+1]+A[i]<0:\n print("NO")\n sys.exit()\nif B==times:\n print("YES")\nelse:\n print("NO")', 'import sys\nN=int(input())\nA=list(map(int,input().split()))\ntotal=0\nfor i in range(N):\n total+=A[i]\nif total*2/((N+1)*N)%1!=0:\n print("NO")\n sys.exit()\ntimes=int(total*2/((N+1)*N))\nif (times-A[0]+A[N-1])/N%1!=0 or times-A[0]+A[N-1]<0:\n print("NO")\n sys.exit()\nB=(times-A[0]+A[N-1])/N\nfor i in range(N-1):\n B+=(times-A[i+1]+A[i])/N\n if (times-A[i+1]+A[i])/N%1!=0 or times-A[i+1]+A[i]<0:\n print("NO")\n sys.exit()\nif B==times:\n print("YES")\nelse:\n print("NO")']
['Runtime Error', 'Accepted']
['s983075499', 's486193619']
[2940.0, 14480.0]
[17.0, 145.0]
[470, 470]
p03808
u692632484
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['N=int(input())\nA=[int(i) for i in input().split()]\nans=True\n\nif sum(A)%(int((N*(N+1))/2))!=0:\n ans=False\nk=sum(A)*2/(N*(N+1))\n\n\nd=[A[i+1]-A[i]-k for i in range(N-1)]\nd.append(A[0]-A[N-1]-k)\nfor i in range(N):\n if d[i]%N!=0:\n ans=False\nif ans:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\nA=[int(i) for i in input().split()]\nans=True\n\nif sum(A)*2%(N*(N+1))!=0:\n ans=False\nk=sum(A)*2/(N*(N+1))\n\n\nd=[A[i+1]-A[i]-k for i in range(N-1)]\nd.append(A[0]-A[N-1]-k)\nfor i in range(N):\n if d[i]>0 or d[i]%N!=0:\n ans=False\nif ans:\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s361980638', 's532175576']
[14620.0, 14476.0]
[106.0, 112.0]
[318, 321]
p03808
u745087332
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
["# coding:utf-8\n\nimport sys\n# from collections import Counter, defaultdict\n\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef II(): return int(sys.stdin.readline())\ndef SI(): return input()\n\n\ndef main():\n n = II()\n A = LI()\n\n A.append(A[0])\n diff = set()\n for a1, a2 in zip(A[:-1], A[1:]):\n diff.add(a1 - a2)\n\n return 'Yes' if len(diff) <= 2 else 'NO'\n\n\nprint(main())\n", "n=int(input())\na=list(map(int,input().split()))\nq,m=divmod(sum(a),n*(n+1)//2)\nprint('YNEOS'[any([(y-x-q)%n or y-x>q or m for x,y in zip(a[:-1],a[1:])])::2])"]
['Wrong Answer', 'Accepted']
['s801010364', 's259132490']
[18124.0, 14252.0]
[66.0, 67.0]
[563, 156]
p03808
u761320129
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
["N = int(input())\nsrc = map(int,input().split())\nS = sum(src)\nM = N*(N+1)//2\n\nif S%M:\n print('NO')\n exit()\n\nK = S//M\nmem = [src[i] - K*i for i in range(N)]\nmem.append(mem[0])\nfor a,b in zip(mem,mem[1:]):\n if (a-b)%N:\n print('NO')\n exit()\nprint('YES')", "N = int(input())\nA = list(map(int,input().split()))\nsuma = sum(A)\nunit = N*(N+1)//2\nif suma % unit:\n print('NO')\n exit()\nope = suma // unit\n\nd = A[0]-A[-1]\nfor a,b in zip(A,A[1:]):\n if (b-a)%N != d%N:\n print('NO')\n exit()\n\nAA = A + [A[0]]\nk = 0\nfor a,b in zip(AA,AA[1:]):\n if b-a > ope:\n print('NO')\n exit()\n k += (ope - (b-a)) // N\n\nprint('YES' if k==ope else 'NO')"]
['Runtime Error', 'Accepted']
['s818538729', 's594761615']
[11104.0, 14488.0]
[41.0, 99.0]
[272, 409]
p03808
u785578220
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['N = int(input())\nA = list(map(int, input().split()))\n\nK = sum(A) / sum(range(1, N+1))\nfor i in range(-1,N-1):\n D = A[i+1] - A[i] - K \n\nfor d in D:\n if not (d <= 0 and d % N == 0):\n print("NO")\n break\nelse:\n print("YES")\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nK = sum(A) / sum(range(1, N+1))\nD = []\nfor i in range(-1,N-1):\n D.append(A[i+1] - A[i] - K )\n\nfor d in D:\n if not (d <= 0 and d % N == 0):\n print("NO")\n break\nelse:\n print("YES")\n']
['Runtime Error', 'Accepted']
['s170268636', 's441738570']
[14476.0, 14228.0]
[78.0, 111.0]
[243, 256]
p03808
u803848678
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['n = int(input())\na = list(map(int, input().split()))\nsa = sum(a)\nstone = n*(n+1)//2\nif sa % stone:\n print("No")\n exit()\na.append(a[0])\nk = sa//stone\nd = [a[i+1]-a[i] - k for i in range(n)]\nfor i in d:\n if i%n:\n print("No")\n exit()\nprint("Yes")', 'n = int(input())\na = list(map(int, input().split()))\nsa = sum(a)\nstone = n*(n+1)//2\nif sa % stone:\n print("NO")\n exit()\na.append(a[0])\nk = sa//stone\nd = [a[i+1]-a[i] - k for i in range(n)]\nfor i in d:\n if i%n or i>0:\n print("NO")\n exit()\nprint("YES")\n']
['Wrong Answer', 'Accepted']
['s457116406', 's887374288']
[14228.0, 14108.0]
[66.0, 67.0]
[266, 274]
p03808
u808427016
2,000
262,144
There are N boxes arranged in a circle. The i-th box contains A_i stones. Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation: * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box. Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.
['N = int(input())\nA = [int(_) for _ in input().split()]\n\ndef solve(N, A):\n k = N * (N + 1) // 2\n s = sum(A)\n if s % k > 0:\n return False\n m = s // k\n # print(k, s, m)\n rs = []\n for i in range(N):\n p = A[i - 1]\n q = A[i]\n delta = q - p\n y = m - delta\n print(p, q, delta, y, N)\n if y % N > 0:\n return False\n rs.append(y // N)\n # print("*", rs)\n return True\n\nif solve(N, A):\n print("YES")\nelse:\n print("NO")\n', 'N = int(input())\nA = [int(_) for _ in input().split()]\n\ndef solve(N, A):\n k = N * (N + 1) // 2\n s = sum(A)\n if s % k > 0:\n return False\n m = s // k\n # print(k, s, m)\n rs = []\n for i in range(N):\n p = A[i - 1]\n q = A[i]\n delta = q - p\n y = m - delta\n \n if y % N > 0:\n return False\n x = y // N\n rs.append(x)\n # print("*", rs)\n R = 0\n for i in range(N):\n x = rs[i]\n l = (N - i) % N + 1\n R += l * x\n # print(1, R)\n if R != A[0]:\n return False\n for i in range(1, N):\n R += m - rs[i]\n R -= rs[i] * (N - 1)\n # print(i, R)\n if R != A[i]:\n return False\n return True\n\ndef solve(N, A):\n k = N * (N + 1) // 2\n s = sum(A)\n if s % k > 0:\n return False\n m = s // k\n for i in range(N):\n x = A[i - 1] - A[i] + m\n if x < 0 or (x % N) > 0:\n return False\n return True\n\nif solve(N, A):\n print("YES")\nelse:\n print("NO")\n']
['Wrong Answer', 'Accepted']
['s543834985', 's995804246']
[14244.0, 14488.0]
[353.0, 64.0]
[504, 1063]
p03809
u218843509
2,000
262,144
There is a tree with N vertices, numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i. Currently, there are A_i stones placed on vertex i. Determine whether it is possible to remove all the stones from the vertices by repeatedly performing the following operation: * Select a pair of different leaves. Then, remove exactly one stone from every vertex on the path between those two vertices. Here, a _leaf_ is a vertex of the tree whose degree is 1, and the selected leaves themselves are also considered as vertices on the path connecting them. Note that the operation cannot be performed if there is a vertex with no stone on the path.
['import sys\nsys.setrecursionlimit(10**6)\ndef input():\n\treturn sys.stdin.readline()[:-1]\n\nn = int(input())\na = list(map(int, input().split()))\nadj = [[] for _ in range(n)]\nfor _ in range(n-1):\n\ts, t = map(int, input().split())\n\tadj[s-1].append(t-1)\n\tadj[t-1].append(s-1)\npar = [-1 for _ in range(n)]\naff = [0 for _ in range(n)]\n\ndef dfs(x, p):\n\tfor v in adj[x]:\n\t\tif v == p:\n\t\t\tcontinue\n\t\taff[x] += 1\n\t\tpar[v] = x\n\t\tdfs(v, x)\n\treturn\ndfs(0, -1)\naf_lis = [[] for _ in range(n)]\nzero = [i for i in range(n) if aff[i] == 0]\n\ndef check(x):\n\tif af_lis[x] == []:\n\t\taf_lis[par[x]].append(a[x])\n\t\taff[par[x]] -= 1\n\t\tif aff[par[x]] == 0:\n\t\t\tzero.append(par[x])\n\t\treturn\n\ts, ma = sum(af_lis[x]), max(af_lis[x])\n\tif ma*2 > s:\n\t\ts_mi = ma\n\telse:\n\t\ts_mi = (s+1)//2\n\tif s_mi <= a[x] <= s:\n\t\tif par[x] == -1:\n\t\t\tif 2*a[x] != s:\n\t\t\t\tprint("NO")\n\t\t\t\tsys.exit()\n\t\t\telse:\n\t\t\t\treturn\n\t\taf_lis[par[x]].append(2*a[x] - s)\n\t\taff[par[x]] -= 1\n\t\tif aff[par[x]] == 0:\n\t\t\tzero.append(par[x])\n\t\treturn\n\telse:\n\t\tprint("NO")\n\t\tsys.exit()\n\t\treturn\n\nwhile zero:\n\tcheck(zero.pop())\n\nprint("YES")', 'import sys\nsys.setrecursionlimit(10**6)\ndef input():\n\treturn sys.stdin.readline()[:-1]\n\nn = int(input())\na = list(map(int, input().split()))\nadj = [[] for _ in range(n)]\nfor _ in range(n-1):\n\ts, t = map(int, input().split())\n\tadj[s-1].append(t-1)\n\tadj[t-1].append(s-1)\npar = [-1 for _ in range(n)]\naff = [0 for _ in range(n)]\n\ndef dfs(x, p):\n\tfor v in adj[x]:\n\t\tif v == p:\n\t\t\tcontinue\n\t\taff[x] += 1\n\t\tpar[v] = x\n\t\tdfs(v, x)\n\treturn\ndfs(0, -1)\naf_lis = [[] for _ in range(n)]\nzero = [i for i in range(n) if aff[i] == 0]\n\ndef check(x):\n\tif af_lis[x] == []:\n\t\taf_lis[par[x]].append(a[x])\n\t\taff[par[x]] -= 1\n\t\tif aff[par[x]] == 0:\n\t\t\tzero.append(par[x])\n\t\treturn\n\ts, ma = sum(af_lis[x]), max(af_lis[x])\n\tif ma*2 > s:\n\t\ts_mi = ma\n\telse:\n\t\ts_mi = (s+1)//2\n\tif s_mi <= a[x] <= s:\n\t\tif par[x] == -1:\n\t\t\tif len(af_lis[x]) > 1 and 2*a[x] != s:\n\t\t\t\tprint("NO")\n\t\t\t\tsys.exit()\n\t\t\telif len(af_lis[x]) == 1 and a[x] != s:\n\t\t\t\tprint("NO")\n\t\t\t\tsys.exit()\n\t\t\treturn\n\t\taf_lis[par[x]].append(2*a[x] - s)\n\t\taff[par[x]] -= 1\n\t\tif aff[par[x]] == 0:\n\t\t\tzero.append(par[x])\n\t\treturn\n\telse:\n\t\tprint("NO")\n\t\tsys.exit()\n\t\treturn\n\nwhile zero:\n\tcheck(zero.pop())\n\nprint("YES")']
['Wrong Answer', 'Accepted']
['s028481556', 's233997325']
[98856.0, 98976.0]
[757.0, 766.0]
[1060, 1147]
p03809
u467736898
2,000
262,144
There is a tree with N vertices, numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i. Currently, there are A_i stones placed on vertex i. Determine whether it is possible to remove all the stones from the vertices by repeatedly performing the following operation: * Select a pair of different leaves. Then, remove exactly one stone from every vertex on the path between those two vertices. Here, a _leaf_ is a vertex of the tree whose degree is 1, and the selected leaves themselves are also considered as vertices on the path connecting them. Note that the operation cannot be performed if there is a vertex with no stone on the path.
['import sys\nsys.setrecursionlimit(500000)\nN = int(input())\nA = [0] + list(map(int, input().split()))\nE = [[] for _ in range(N+1)]\nfor _ in range(N-1):\n a, b = map(int, input().split())\n E[a].append(b)\n E[b].append(a)\n\ndef dfs(v, p=0):\n a = A[v]\n b = []\n for u in E[v]:\n if u!=p:\n b.append(dfs(u, v))\n if len(b)==0:\n return a\n sum_b, max_b = sum(b), max(b)\n if a < 2*max_b-sum_b or a < 2*sum_b or a > sum_b:\n print("NO")\n exit()\n return 2 * a - sum_b\n\nans = dfs(1)\nif (ans==0 and len(E[1])>1) or (ans==A[1] and len(E[1])==1):\n print("YES")\nelse:\n print("NO")\n', 'import sys\nsys.setrecursionlimit(500000)\nN = int(input())\nA = [0] + list(map(int, input().split()))\nE = [[] for _ in range(N+1)]\nfor _ in range(N-1):\n a, b = map(int, input().split())\n E[a].append(b)\n E[b].append(a)\n\ndef dfs(v, p=0):\n a = A[v]\n b = []\n for u in E[v]:\n if u!=p:\n b.append(dfs(u, v))\n if len(b)==0:\n return a\n sum_b, max_b = sum(b), max(b)\n if a < max_b or 2 * a < sum_b or a > sum_b:\n print("NO")\n exit()\n return 2 * a - sum_b\n\nv = 1\nans = dfs(v)\nif (ans==0 and len(E[v])>1) or (ans==A[v] and len(E[v])==1):\n print("YES")\nelse:\n print("NO")\n']
['Wrong Answer', 'Accepted']
['s777110969', 's365392362']
[124140.0, 124140.0]
[799.0, 838.0]
[632, 632]
p03809
u754022296
2,000
262,144
There is a tree with N vertices, numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i. Currently, there are A_i stones placed on vertex i. Determine whether it is possible to remove all the stones from the vertices by repeatedly performing the following operation: * Select a pair of different leaves. Then, remove exactly one stone from every vertex on the path between those two vertices. Here, a _leaf_ is a vertex of the tree whose degree is 1, and the selected leaves themselves are also considered as vertices on the path connecting them. Note that the operation cannot be performed if there is a vertex with no stone on the path.
['import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\nn = int(input())\nA = list(map(int, input().split()))\nT = [[] for _ in range(n)]\nfor _ in range(n-1):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n T[a].append(b)\n T[b].append(a)\nC = [a if len(T[i]) == 1 else a*2 for i, a in enumerate(A)]\nD = tuple(c for c in C)\ndef dfs(v, par=-1):\n for nv in T[v]:\n if nv != par:\n if not dfs(nv, v):\n return False\n if C[v] < 0:\n return False\n if par == -1:\n return C[v] == 0\n if C[v] > D[par]//2:\n return False\n C[par] -= C[v]\n return True\nif dfs(0):\n print("YES")\nelse:\n print("NO")', 'import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\nn = int(input())\nA = list(map(int, input().split()))\nT = [[] for _ in range(n)]\nfor _ in range(n-1):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n T[a].append(b)\n T[b].append(a)\nC = [a if len(T[i]) == 1 else a*2 for i, a in enumerate(A)]\ndef dfs(v, par=-1):\n for nv in T[v]:\n if nv != par:\n if not dfs(nv, v):\n return False\n if C[v] < 0:\n return False\n if par == -1:\n return C[v] == 0\n if C[v] > A[par] or C[v] > A[v]:\n return False\n C[par] -= C[v]\n return True\nif dfs(0):\n print("YES")\nelse:\n print("NO")']
['Wrong Answer', 'Accepted']
['s646996776', 's998295137']
[115624.0, 114080.0]
[556.0, 567.0]
[627, 615]
p03809
u934019430
2,000
262,144
There is a tree with N vertices, numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i. Currently, there are A_i stones placed on vertex i. Determine whether it is possible to remove all the stones from the vertices by repeatedly performing the following operation: * Select a pair of different leaves. Then, remove exactly one stone from every vertex on the path between those two vertices. Here, a _leaf_ is a vertex of the tree whose degree is 1, and the selected leaves themselves are also considered as vertices on the path connecting them. Note that the operation cannot be performed if there is a vertex with no stone on the path.
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ndef readln(ch):\n _res = list(map(int,str(input()).split(ch)))\n return _res\n\nn = int(input())\na = readln(' ')\ne = [set([]) for i in range(0,n+1)]\nfor i in range(1,n):\n s = readln(' ')\n e[s[0]].add(s[1])\n e[s[1]].add(s[0])\nrt = 1\nnow = n\nv = [0 for i in range(0,n+1)]\nq = v[:]\nq[now] = rt\nv[rt] = 1\nfor i in range(1,n):\n s = q[n-i+1]\n for p in e[s]:\n if v[p] == 0:\n v[p] = 1\n now = now - 1\n q[now] = p\n\nres = 'YES'\nup = [0 for i in range(0,n+1)]\nfor i in range(1,n+1):\n k = q[i]\n if len(e[k]) == 1:\n sum = a[k-1]\n else:\n sum = a[k-1] * 2\n up[k] = sum\n for son in e[k]:\n up[k] = up[k] - up[son]\n if up[k] > a[k-1]: res = 'NO'\n if up[k] < 0:\n res = 'NO'\n if len(e[k]) > 1 and up[k] > a[k-1]:\n res = 'NO'\n\nif up[rt] != 0 : res = 'NO'\nprint(res)\n", "print('NO')", "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ndef readln(ch):\n _res = list(map(int,str(input()).split(ch)))\n return _res\n\nn = int(input())\na = readln(' ')\ne = [set([]) for i in range(0,n+1)]\nfor i in range(1,n):\n s = readln(' ')\n e[s[0]].add(s[1])\n e[s[1]].add(s[0])\nrt = 1\nnow = n\nv = [0 for i in range(0,n+1)]\nq = v[:]\nq[now] = rt\nv[rt] = 1\nfor i in range(1,n):\n s = q[n-i+1]\n for p in e[s]:\n if v[p] == 0:\n v[p] = 1\n now = now - 1\n q[now] = p\n\nres = 'YES'\nup = [0 for i in range(0,n+1)]\nfor i in range(1,n+1):\n k = q[i]\n if len(e[k]) == 1:\n sum = a[k-1]\n else:\n sum = a[k-1] * 2\n up[k] = sum\n for son in e[k]:\n up[k] = up[k] - up[son]\n if up[son] > a[k-1] and len(e[k]) > 1: res = 'NO'\n if up[k] < 0:\n res = 'NO'\n if len(e[k]) > 1 and up[k] > a[k-1]:\n res = 'NO'\n\nif up[rt] != 0 : res = 'NO'\nprint(res)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s627421225', 's993110612', 's010883707']
[44396.0, 3196.0, 44404.0]
[974.0, 22.0, 961.0]
[912, 11, 932]
p03817
u088863512
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['# -*- coding: utf-8 -*-\nimport sys\nfrom collections import deque, defaultdict\nfrom math import sqrt, factorial, gcd, ceil\n# def input(): return sys.stdin.readline()[:-1] # warning not \\n\n\n\n\n\ndef solve():\n # n, m = [int(x) for x in input().split()]\n n = int(input())\n ans = n // 11\n n %= 11\n if n >= 6:\n n -= 6\n ans += 1\n if n >= 5:\n ans += 1\n print(ans)\n \n \nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n"""\n\nR s\nS p\nP r\n\n"""\n', '# -*- coding: utf-8 -*-\nimport sys\nfrom collections import deque, defaultdict\nfrom math import sqrt, factorial, gcd, ceil\n# def input(): return sys.stdin.readline()[:-1] # warning not \\n\n\n\n\n\ndef solve():\n # n, m = [int(x) for x in input().split()]\n n = int(input())\n ans = (n // 11)*2\n n %= 11\n if n >= 6:\n n -= 6\n ans += 1\n if n >= 5:\n ans += 1\n print(ans)\n \n \nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n"""\n\nR s\nS p\nP r\n\n"""\n', '# -*- coding: utf-8 -*-\nimport sys\nfrom collections import deque, defaultdict\nfrom math import sqrt, factorial, gcd, ceil\n# def input(): return sys.stdin.readline()[:-1] # warning not \\n\n\n\n\n\ndef solve():\n # n, m = [int(x) for x in input().split()]\n n = int(input())\n ans = (n // 11)*2\n n %= 11\n\n if n > 6:\n ans += 2\n elif n:\n ans += 1\n print(ans)\n \n \nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n"""\n\nR s\nS p\nP r\n\n"""\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s550320300', 's580149985', 's528154505']
[9352.0, 9452.0, 9488.0]
[30.0, 29.0, 32.0]
[637, 641, 623]
p03817
u090406054
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x=int(input())\nans=0\nfor i in range(100000000000):\n if (i+1)%2==1:\n x-=5\n ans+=1\n if x<=0:\n print(ans)\n break\n else:\n x-=6\n if x<=0:\n print(ans)\n break\n \n ', 'x=int(input())\n\ncnt=x%11\n\nans=2*(x//11)\nif cnt>=1 and cnt<=6:\n ans+=1\nelif cnt>=7 and cnt<=10:\n ans+=2\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s355171578', 's828020232']
[2940.0, 2940.0]
[2104.0, 17.0]
[198, 121]
p03817
u118642796
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\nans = 2*(x//11)\nif 1<=x//11<=6:\n ans += 1\nelif 7<=x//11:\n ans += 2\nprint(ans)', 'x = int(input())\nans = 2*(x//11)\nif 1<=x%11<=6: \n ans += 1\nelif 7<=x%11: \n ans += 2\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s879261412', 's302334044']
[2940.0, 3064.0]
[18.0, 17.0]
[96, 97]
p03817
u202826462
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\n\nans = (x / 11) * 2\nsub = x % 11\nif sub <= 6:\n ans += 1\nelse:\n ans += 2\n\nprint(ans)', 'x = int(input())\n\nans = (x // 11) * 2\nsub = x % 11\nif sub >= 7:\n ans += 2\nelif 0 < sub <= 6:\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s591743944', 's325601411']
[2940.0, 2940.0]
[17.0, 17.0]
[106, 120]
p03817
u205166254
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\na = (x // 11) * 2\nb = x % 11\nif b == 0:\n print(a)\nelif b <= 7:\n print(a + 1)\nelse:\n print(a + 2)\n ', 'x = int(input())\n\na = (x // 11) * 2\nb = x % 11\nif b == 0:\n print(a)\nelif b <= 6:\n print(a + 1)\nelse:\n print(a + 2)']
['Wrong Answer', 'Accepted']
['s111096002', 's735627636']
[3064.0, 3064.0]
[24.0, 21.0]
[124, 123]
p03817
u228232845
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
["import sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\nINF = float('inf')\n\n\nx = I()\nif x <= 6:\n ans = 1\nelif x <= 11:\n ans = 2\nelse:\n ans = (x // 11) * 2\n if x % 11 == 0:\n pass\n elif x % 11 <= 6:\n ans += 1\n elif x % 11 <= 10:\n ans += 2\n\n print(ans)\n", "import sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\nINF = float('inf')\n\n\nx = I()\nif x <= 6:\n ans = 1\nelif x <= 11:\n ans = 2\nelse:\n ans = (x // 11) * 2\n if ans % 11 != 0:\n ans += 1\n\n print(ans)\n", "#\nimport sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\nINF = float('inf')\n\n\nx = I()\nif x <= 6:\n ans = 1\nelif x <= 11:\n ans = 2\nelse:\n ans = (x // 11) * 2\n if x % 11 == 0:\n pass\n elif x % 11 <= 6:\n ans += 1\n elif x % 11 <= 10:\n ans += 2\nprint(ans)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s284328284', 's891969296', 's912621419']
[9088.0, 9160.0, 9220.0]
[28.0, 28.0, 30.0]
[563, 490, 560]
p03817
u243961437
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\ncount = 0\nq, mod = divmod(x, 11)\ncount += q*2\nif mod > 0:\n\tif(mod <= 6):\n \tcount += 1\n\telse:\n \tcount += 2\nprint(count)', 'x = int(input())\ncount = 0\nq, mod = divmod(x, 11)\ncount += q*2\nif mod > 0:\n if(mod <= 6):\n count += 1\n else:\n count += 2\nprint(count)']
['Runtime Error', 'Accepted']
['s966808566', 's622703357']
[2940.0, 3068.0]
[17.0, 22.0]
[141, 153]
p03817
u311636831
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['X = int(input())\n\nN=X/11\nP=X%11\n\nif(P>6):\n print(2*N+2)\nelse:\n print(2*N+1)', 'X = int(input())\n\nN=((X-1)//11)*2\nP=(X-1)%11\n\nif(P>5):\n print(N+2)\nelse:\n print(N+1)']
['Wrong Answer', 'Accepted']
['s419207993', 's536613649']
[2940.0, 2940.0]
[17.0, 17.0]
[81, 90]
p03817
u375616706
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['from collections import Counter\n# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nNum = list(input().split())\nC = Counter(Num)\nv = len(C)\nodd = len(list(filter(lambda x: x % 2 == 1, C.values())))\neven = v - odd\nprint(odd+even//2*2)\n', 'x = int(input())\n\nr = x % 11\nif r == 0:\n ans = x//11*2\nelif r > 6:\n ans = x//11*2+2\nelse:\n ans = x//11*2+1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s365675796', 's453822849']
[3572.0, 2940.0]
[25.0, 18.0]
[298, 127]
p03817
u471828790
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['N = int(input())\n\nX = N // 11\nM = N % 11\nprint(X, M)\nif M == 0:\n print(X * 2)\nelif M > 6:\n print(X * 2 + 2)\nelse:\n print(X * 2 + 1)\n', 'N = int(input())\n\nX = N // 11\nM = N % 11\nif M == 0:\n print(X * 2)\nelif M > 6:\n print(X * 2 + 2)\nelse:\n print(X * 2 + 1)\n']
['Wrong Answer', 'Accepted']
['s470328100', 's519366546']
[2940.0, 2940.0]
[18.0, 17.0]
[141, 129]
p03817
u536034761
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = input()\ny = x % 11\nif y > 0:\n cnt = 1\n if y > 6:\n cnt += 1\nelse:\n cnt = 0\n \nprint(x // 11 + cnt)\n', 'x = int(input())\ny = x % 11\nif y > 0:\n cnt = 1\n if y > 6:\n cnt += 1\nelse:\n cnt = 0\n \nprint((x // 11) * 2 + cnt)']
['Runtime Error', 'Accepted']
['s629683028', 's991406437']
[8972.0, 9144.0]
[25.0, 30.0]
[120, 130]
p03817
u537782349
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['a = int(input())\nprint((a + 4.5) // 5.5)\n', 'a = int(input())\nprint(int((a + 4.5) // 5.5))\n']
['Wrong Answer', 'Accepted']
['s118433167', 's641916038']
[2940.0, 2940.0]
[17.0, 17.0]
[41, 46]
p03817
u541568482
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['import sys\n\ncin = sys.stdin\ncin = open("in.txt", "r")\n\nx = int(cin.readline())\nc = x//11\ncnt = c*2\nr = x%11\n# print(r)\nif r>0:\n cnt +=1\n if r>6:\n cnt +=1\n\nprint(cnt)\n', 'import sys\n\ncin = sys.stdin\n\nx = int(cin.readline())\nc = x//11\ncnt = c*2\nr = x%11\n# print(r)\nif r>0:\n cnt +=1\n if r>6:\n cnt +=1\n\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s706271657', 's393926503']
[3064.0, 3064.0]
[23.0, 22.0]
[179, 153]
p03817
u569272329
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['N=int(input())\nif N%11==0:\n print(2*N//11)\nelif N%11>6:\n print(N*2//11+2)\nelse:\n print(2*N//11+1)\n', 'N=int(input())\nif N%11==0:\n print(N//11)\nelif N%11>6:\n print(N*2//11+2)\nelse:\n print(2*N//11+1)\n', 'x = int(input())\nif x % 11 > 6:\n print(2*x//11+2)\nelse:\n print(2*x//11+1)\n', 'x = int(input())\na = x//11\nif x % 11 == 0:\n print(2*a)\nelif x % 11 > 6:\n print(2*a+2)\nelse:\n print(2*a+1)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s216656368', 's332884274', 's458685034', 's366708310']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0]
[101, 99, 80, 115]
p03817
u578501242
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x=int(input())\nans=0\nchk=0\nans=ans+(x//11)*2\nchk=x%11\nif chk>6:\n\tans=ans+2\nif chk>0:\n\tans=ans+1\nprint(ans)', 'x=int(input())\nans=0\nchk=0\nans=ans+(x//11)*2\nchk=x%11\nif chk>6:\n\tans=ans+2\nelif chk>0:\n\tans=ans+1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s171791301', 's369546650']
[3060.0, 3064.0]
[17.0, 17.0]
[106, 108]
p03817
u580697892
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['# coding: utf-8\nfrom math import ceil, floor\nX = int(input())\nif X >= 6:\n print(1)\nelse:\n print(ceil(X / 11 * 2))', '# coding: utf-8\nfrom math import ceil\nX = int(input())\nif X <= 6:\n print(1)\nelse:\n mod = X % 11\n if mod >= 7:\n print(X // 11 * 2 + 2)\n elif mod == 0:\n print(X // 11 * 2)\n else:\n print(X // 11 * 2 + 1)']
['Wrong Answer', 'Accepted']
['s069622888', 's589508765']
[3064.0, 3064.0]
[17.0, 17.0]
[119, 236]
p03817
u597455618
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['def main():\n x = int(input())\n s = 0\n f = 0\n while ans < x:\n s += 1\n tmp = 6*s + 5*f\n if tmp >= x:\n print(s+f)\n exit()\n f += 1\n tmp += 5\n if tmp >= x:\n print(s+f)\n exit()\n\nif __name__ == "__main__":\n main()', 'def main():\n x = int(input())\n ans = x//11\n chk = x%11\n if chk == 0:\n print(2*ans)\n elif chk <=6:\n print(2*ans+1)\n else:\n print(2*ans+2)\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s366013524', 's921725239']
[9196.0, 9152.0]
[30.0, 30.0]
[307, 214]
p03817
u597622207
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['\n\nx = int(input())\ncount = 0\nif x == 1:\n print(count)\n exit()\nelse:\n x -= 1\n count += 1\n\ncount += (x // 11) * 2\nx = x % 11\n\n# if x == 1 or x == 8 or x == 9:\n# count += 2\n# elif x == 7 or x == 10:\n# count += 3\n# elif x == 0:\n# print(count)\n# exit()\n# else:\n# count += 1\n\nprint(count)\n', '\n\nx = int(input())\ncount = 0\nif x == 1:\n print(count)\n exit()\nelse:\n x -= 1\n count += 1\n\ncount += (x // 11) * 2\nx = x % 11\nprint(x)\nif x == 1 or x == 8 or x == 9:\n count += 2\nelif x == 7 or x == 10:\n count += 3\nelif x == 0:\n print(count)\n exit()\nelse:\n count += 1\n\nprint(count)\n', '\n\nx = int(input())\ncount = 0\nif x == 1:\n print(count)\n exit()\nelse:\n x -= 1\n count += 1\n\ncount += (x // 11) * 2\nx = x % 11\n\nif x == 0:\n print(count)\nelif x >= 6:\n print(count + 2)\nelse:\n print(count + 1)', '\n\nx = int(input())\ncount = (x // 11) * 2\nx = x % 11\nif x > 6:\n print(count+2)\nelif x > 0:\n print(count+1)\nelse:\n print(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s170194150', 's474846529', 's677940566', 's495465264']
[3060.0, 3064.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0, 17.0]
[388, 378, 297, 207]
p03817
u625963200
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x=int(input())\n\nans=((x-1)//11)*2\nif (x-1)%11>6:\n print(ans+2)\nelse:\n print(ans+1)', 'x=int(input())\n\nans=(x//11)*2\nif x%11>6:\n print(ans+2)\nelif x%11==0:\n print(ans)\nelse:\n print(ans+1)']
['Wrong Answer', 'Accepted']
['s597141156', 's988365830']
[2940.0, 2940.0]
[17.0, 20.0]
[84, 103]
p03817
u629350026
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x=int(input())\nt=x//11\nif x-t==0:\n print(t*2)\nelif x-t<=6:\n print(t*2+1)\nelse:\n print(t*2+1)', 'x=int(input())\nt=x//11\nif x-t*11==0:\n print(t*2)\nelif x-t*11<=6:\n print(t*2+1)\nelse:\n print(t*2+2)']
['Wrong Answer', 'Accepted']
['s868545973', 's303953992']
[9168.0, 9108.0]
[26.0, 27.0]
[95, 101]
p03817
u637824361
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['N = int(input())\nif N % 11 > 6:\n print(N+10//11*2)\nelif n % 11 == 0:\n print(N//11*2)\nelse:\n print(N//11*2+1)', 'N = int(input())\nif N % 11 > 6:\n print((N+10)//11*2)\nelif N % 11 == 0:\n print(N//11*2)\nelse:\n print(N//11*2+1)']
['Runtime Error', 'Accepted']
['s861704875', 's993690985']
[2940.0, 2940.0]
[17.0, 18.0]
[111, 113]
p03817
u652737716
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['target_score = int(input())\n\ncnt = target_score // 11 * 2\ntarget_score = target_score % 11\n\nif cnt == 0:\n print(cnt)\nelif 1 <= cnt <= 6:\n print(cnt + 1)\nelse:\n print(cnt + 2)\n', 'target_score = int(input())\n\ncnt = target_score // 11 * 2\ntarget_score = target_score % 11\n\n\nif target_score == 0:\n print(cnt)\nelif target_score <= 6:\n print(cnt + 1)\nelse:\n print(cnt + 2)\n']
['Wrong Answer', 'Accepted']
['s770778428', 's275577074']
[3064.0, 3064.0]
[22.0, 26.0]
[184, 198]
p03817
u667024514
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['n = int(input())\nlis = list(map(int,input().split()))\nans = set()\nfor num in lis:ans.add(num)\nprint(len(ans)-((len(ans) % 2)+1)%2)', 'import math\nn = int(input())\nprint(2 * (n // 11) + math.ceil((n % 11) / 6))']
['Runtime Error', 'Accepted']
['s391862147', 's668469960']
[2940.0, 2940.0]
[16.0, 18.0]
[130, 75]
p03817
u667469290
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
["# -*- coding: utf-8 -*-\nfrom math import ceil\n\ndef solve():\n x = int(input())\n res = 2*(x//11) + (x%11!=0)\n return str(res)\n\nif __name__ == '__main__':\n print(solve())\n", "# -*- coding: utf-8 -*-\nfrom math import ceil\n\ndef solve():\n x = int(input())\n res = 2*ceil(x/11) - (0 < x%11 <= 6)\n return str(res)\n\nif __name__ == '__main__':\n print(solve())\n"]
['Wrong Answer', 'Accepted']
['s166948525', 's003860818']
[2940.0, 2940.0]
[17.0, 17.0]
[180, 189]
p03817
u737451238
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\n \nif x % 11 == 0:\n ans = x // 11 * 2\nelse:\n if x / 11 < 1:\n if x // 6 > 1:\n ans = 2\n else:\n ans = 1\n else:\n ans = x // 11 * 2 + 1\n \nprint(ans)', 'if x / 11 < 1:\n ans = 1\n if x / 5 >= 1:\n ans = 2\nelse:\n ans = x // 11 * 2 + 1\n\nprint(ans)', 'x = int(input())\nans = x//11*2\np = x % 11\nif p > 0:\n p -= 6\n ans += 1\nif p > 0:\n p -= 5\n ans += 1\n \nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s092046465', 's988071853', 's266346027']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[211, 105, 122]
p03817
u737840172
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\nquot = x//11\nif x >= 11:\n quot *= 2\nif x%11 > 0:\n quot += 1\nprint(quot)\n', 'x = int(input())\nquot = x//11\nif x >= 11:\n quot *= 2\nremainder = x%11\nif remainder > 6:\n quot += 2\nelse:\n if remainder != 0:\n quot += 1\nprint(quot)\n']
['Wrong Answer', 'Accepted']
['s704819591', 's905655412']
[3064.0, 3064.0]
[21.0, 23.0]
[95, 164]
p03817
u767664985
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\n\nif x%11 <= 6:\n print((x//11)*2 + 1)\nelse:\n print((x//11)*2 * 2)\n', 'x = int(input())\nif x%11 == 0:\n print((x//11)*2)\nelif x%11 <= 6:\n print((x//11)*2 + 1)\nelse:\n print((x//11)*2 + 2)\n']
['Wrong Answer', 'Accepted']
['s037362842', 's322511041']
[2940.0, 2940.0]
[18.0, 17.0]
[88, 124]
p03817
u768896740
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\n\nnum = x // 11\n\nx %= 11\nif x == 0:\n print(num * 2)\nelse:\n print(num * 2 + 1)', 'x = int(input())\n\nnum = x // 11\n\nx %= 11\nif x == 0:\n print(num * 2)\nelif x <= 6:\n print(num * 2 + 1)\nelse:\n print(num * 2 + 2)']
['Wrong Answer', 'Accepted']
['s216978590', 's782158616']
[2940.0, 3060.0]
[17.0, 17.0]
[99, 135]
p03817
u802234211
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['import math \nx = int(input())\nxi = math.floor(x/5.5)\nprint(xi)\nfor i in range(xi,100000000000000):\n # print(6*i - math.floor(i/2))\n if(x < 6*i-math.floor(i/2)):\n xa = i\n break\n\nprint(xa)\n', 'import math \nx = int(input())\nxi = math.floor(x/5.5)\nprint(xi)\nfor i in range(xi,100000000000000):\n print(6*i - math.floor(i/2))\n if(x < 6*i-math.floor(i/2)):\n xa = i\n break\n\nprint(xa)\n', 'import math \nx = int(input())\n# x = 10**15\nxi = math.floor(x/5.5)\n# print(xi)\nfor i in range(xi,10000000000000000000000000000):\n # print(6*i - math.floor(i/2))\n if(x <= 6*i-math.floor(i/2)):\n xa = i\n break\n\nprint(xa)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s674708820', 's951048561', 's008010247']
[9096.0, 9080.0, 9048.0]
[28.0, 29.0, 31.0]
[207, 205, 237]
p03817
u806999568
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = input()\nprint((x // 11) * 2 + (2 if x % 11 > 6 else 1))\n', 'x = int(input())\nans = (x // 11) * 2\nif x % 11:\n if x % 11 > 6:\n ans += 2\n else:\n ans += 1\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s232589342', 's671876466']
[2940.0, 2940.0]
[17.0, 17.0]
[60, 122]
p03817
u835482198
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\n\ntmp = (x // 7)\nrem = x - tmp * 7\nif rem == 0:\n print(tmp)\nelse:\n print(tmp + 1)\n', '#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\nimport math\n\n\nx = int(input())\ntmp = int(math.ceil(x / 11.0 * 2.0))\n# print(11 * tmp // 2)\n# print(tmp)\nif (11 * tmp) // 2 - 5 >= x:\n print(tmp-1)\nelse:\n print(tmp)\n']
['Wrong Answer', 'Accepted']
['s112106651', 's188982438']
[2940.0, 3064.0]
[17.0, 22.0]
[104, 217]
p03817
u859897687
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x=int(input())\nans=0\nans+=x//11*2\nx%=11\nif x>4:\n x-=5\n ans+=1\nprint(ans)', 'x=int(input())\nans=x//11*2\nx%=11\nif x<7:\n x-=6\n ans+=1\nprint(ans)', 'x=int(input())\nans=0\nans+=x//11*2\nx%=11\nif x>5:\n x-=6\n ans+=1\nprint(ans)', 'x=int(input())\nans=x//11*2\nx%=11\nif x>0 and x<7:\n ans+=1\nif x>6:\n ans+=2\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s172792903', 's559034353', 's839700925', 's949260943']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 18.0]
[74, 67, 74, 85]
p03817
u867848444
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['import math\nx=int(input())\nif x<=6:\n print(0)\n exit()\n\nans=math.ceil(x/11)*2\nif ans//2*11-x>=6:\n ans+=-1\n\nprint(ans if x>11 else 1)', 'import math\nx=int(input())\nif x<=6:\n print(1)\n exit()\n\nans=math.ceil(x/11)*2\nif ans//2*11-x>=5:\n ans+=-1\n\nprint(ans if x>11 else 2)']
['Wrong Answer', 'Accepted']
['s500199079', 's715846379']
[2940.0, 3188.0]
[17.0, 18.0]
[140, 140]
p03817
u919633157
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['# 2019/08/11\n\nx=int(input())\nans=2*x//11\nif x%11>6:\n ans+=2\nelse:\n ans+=1\nprint(ans)', '\n\nx = int(input())\nd,m = divmod(x,11)\nans = d*2\nans += 1\n\nif m > 6:\n ans += 1\nelif m == 0:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s482400049', 's177051487']
[2940.0, 2940.0]
[18.0, 18.0]
[90, 168]
p03817
u921773161
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\nx -=1\n\ntmp = x//11\ntmp *= 2\na = x%11\n\nif a == 0:\n tmp = tmp\nelif a <= 6:\n tmp += 1\nelse:\n tmp += 2\n\nprint(tmp)', 'x = int(input())\n\ntmp = x//11\ntmp *= 2\na = x%11\n\nif a == 0:\n tmp = tmp\nelif a <= 6:\n tmp += 1\nelse:\n tmp += 2\n\nprint(tmp)']
['Wrong Answer', 'Accepted']
['s562977458', 's018897626']
[3060.0, 3060.0]
[17.0, 17.0]
[136, 130]
p03817
u966695411
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['N = int(input())\nA = list(map(int, input().split()))\nD = {}\nfor i in A:\n if i in D:\n D[i] += 1\n else:\n D[i] = 1\ncnt = 0\nfor k in D.keys():\n if D[k] % 2:\n D[k] = 1\n else:\n D[k] = 2\n cnt += 1\nprint(len({*A}) - (cnt % 2))', 'N = int(input())\nd, m = divmod(N, 11)\na = (1 if m else 0) if m < 7 else 2\nprint(d * 2 + a)']
['Runtime Error', 'Accepted']
['s241378063', 's551474392']
[3192.0, 3064.0]
[22.0, 21.0]
[265, 90]
p03817
u981931040
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\nans = x // 11 * 2\nnokori = x % 11\nif nokori > 6:\n print(ans + 2)\nif nokori == 0:\n print(ans)\nelse:\n print(ans + 1)', 'x = int(input())\nans = x // 11 * 2\nnokori = x % 11\nif nokori > 6:\n print(ans + 2)\nelif nokori == 0:\n print(ans)\nelse:\n print(ans + 1)']
['Wrong Answer', 'Accepted']
['s148453814', 's586686605']
[9072.0, 9084.0]
[31.0, 27.0]
[140, 142]
p03817
u983918956
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['x = int(input())\nt = x // 11\nx -= 11 * t\nans = t * 2\nif x <= 5:\n ans += 1\nelif 5 < x < 11:\n ans += 2\nprint(ans)za', 'x = int(input())\n\nans = 2*(x // 11)\nx %= 11\nif x == 0:\n pass\nelif 0 < x <= 6:\n ans += 1\nelif 6 < x <= 11:\n ans += 2\nprint(ans)']
['Runtime Error', 'Accepted']
['s232864176', 's964679388']
[2940.0, 3060.0]
[18.0, 17.0]
[119, 135]
p03817
u985443069
2,000
262,144
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward. For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back. Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.
['\ndef solve(x):\n q = (x - 1) // 11\n r = (x - 1) % 11\n if r <= 6:\n return 2 * q + 1\n return 2 * q + 2\n\nx = int(input())\nprint(solve(x))\n', '\ndef solve(x):\n q = (x - 1) // 11\n r = (x - 1) % 11\n if r <= 7:\n return 2 * q + 1\n return 2 * q + 2\n\nx = int(input())\nprint(solve(x))\n', '\ndef solve(x):\n q = (x - 1) // 11\n r = (x - 1) % 11\n if r <= 5:\n return 2 * q + 1\n return 2 * q + 2\n\nx = int(input())\nprint(solve(x))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s356135932', 's712145571', 's288830429']
[3064.0, 3064.0, 3064.0]
[22.0, 22.0, 23.0]
[153, 153, 153]
p03818
u077291787
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['# ARC068D - Card Eater (ABC053D)\nfrom collections import Counter\n\n\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n C = sorted(Counter(A).values(), reverse=1)\n ans, stock = 0, 0\n for i in C:\n if i == 1:\n ans += 1\n else:\n if i >= 3:\n ans += 1\n stock += i - 1\n else:\n if stock:\n ans += 1\n stock -= 1\n print(i,ans,stock)\n print(ans)\n\n\nif __name__ == "__main__":\n main()', '# ARC068D - Card Eater (ABC053D)\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n ans = len(set(A))\n ans -= (N - ans) % 2\n print(ans)\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s185905803', 's779959972']
[18660.0, 14280.0]
[187.0, 44.0]
[544, 208]
p03818
u091051505
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\nn = int(input())\na = [int(i) for i in input().split()]\nk = Counter(a)\nb = list(k.values())\nover_2 = [bb for bb in b if bb >= 2]\nif sum(over_2) % 2 == 1:\n print(len(b))\nelse:\n if len(over_2 == 0):\n print(len(b))\n else:\n print(len(b) - 1)', 'from collections import Counter\nn = int(input())\na = [int(i) for i in input().split()]\nk = Counter(a)\nb = list(k.values())\nb = [1 if bb % 2 == 1 else 2 for bb in b]\nover_2 = [bb for bb in b if bb >= 2]\nif len(over_2) == 0:\n print(len(b))\nelif len(over_2) % 2 == 0:\n print(len(b))\nelse:\n print(len(b) - 1)\n\n']
['Runtime Error', 'Accepted']
['s868591243', 's807508037']
[18656.0, 18648.0]
[61.0, 65.0]
[291, 315]
p03818
u163320134
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['def calc(n):\n ret=n\n while ret>=3:\n ret=ret%3+ret//3\n return ret\n\nn=int(input())\narr=list(map(int,input().split()))\ncnt=[0]*(10**5+1)\nfor i in range(n):\n cnt[arr[i]]+=1\ncnt1=0\ncnt2=0\nfor i in range(n):\n tmp=calc(cnt[i])\n if tmp==1:\n cnt1+=1\n elif tmp==2:\n cnt2+=1\nif cnt2%2==0:\n print(cnt1+cnt2)\nelse:\n print(cnt1+cnt2-1)', 'def calc(n):\n ret=n\n while ret>=3:\n ret=ret%3+ret//3\n return ret\n\nn=int(input())\narr=list(map(int,input().split()))\ncnt=[0]*(10**5+1)\nfor i in range(n):\n cnt[arr[i]]+=1\ncnt1=0\ncnt2=0\nfor i in range(10**5+1):\n tmp=calc(cnt[i])\n if tmp==1:\n cnt1+=1\n elif tmp==2:\n cnt2+=1\nif cnt2%2==0:\n print(cnt1+cnt2)\nelse:\n print(cnt1+cnt2-1)']
['Wrong Answer', 'Accepted']
['s145976278', 's728525801']
[14396.0, 14396.0]
[86.0, 88.0]
[339, 345]
p03818
u205166254
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\nimport heapq\n\nn = int(input())\na = Counter(map(int, input().split()))\n\nx = []\nfor k in a:\n if a[k] > 1:\n x.append(-(a[k] - 1))\n\nheapq.heapify(x)\n\nwhile len(x) > 1:\n u = - heapq.heappop(x)\n v = - heapq.heappop(x)\n n -= v * 2\n d = u - v\n if d > 0:\n heapq.heappush(x, -d)\n\nif len(x) > 0:\n n -= heapq.heappop(x) * 2\n pass\n\nprint(n)\n\n', 'from collections import Counter\nimport heapq\n \nn = int(input())\na = Counter(map(int, input().split()))\n \nx = []\nfor k in a:\n if a[k] > 1:\n x.append(-(a[k] - 1))\n \nheapq.heapify(x)\n \nwhile len(x) > 1:\n u = abs(heapq.heappop(x))\n v = abs(heapq.heappop(x))\n n -= min(v, u) * 2\n d = abs(u - v)\n if d > 0:\n heapq.heappush(x, -d)\n \nif len(x) > 0:\n p = abs(heapq.heappop(x))\n n -= p + p % 2\n \nprint(n)']
['Wrong Answer', 'Accepted']
['s075881211', 's377933975']
[22636.0, 22636.0]
[93.0, 89.0]
[399, 432]
p03818
u252805217
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n = input()\nl = len(set([int(x) for x in input().split()]))\nprint(l - l % 2)', 'n=input()\nl=len(set([int(x) for x in input().split()]))\nprint(l-(l+1)%2)']
['Wrong Answer', 'Accepted']
['s304624673', 's919228044']
[14396.0, 14388.0]
[68.0, 68.0]
[76, 72]
p03818
u298297089
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nprint(len(c))', 'from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nlen_c = len(c)\nb = {k:v for k,v in c.items() if v > 1}\nsum_b = sum(b.values())\nif n == 3:\n print(1)\nif (sum_b + len(b)) % 2 == 0:\n print(len_c)\nelse:\n print(len_c - 1)\n']
['Wrong Answer', 'Accepted']
['s638483731', 's532205253']
[18656.0, 18656.0]
[51.0, 55.0]
[113, 277]
p03818
u340781749
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\n\ninput()\nc = Counter(map(int, input().split()))\nprint(len(c))\n', 'from collections import Counter\n\ninput()\nc = Counter(map(int, input().split()))\nprint((len(c) - 1) // 2 * 2 + 1)\n']
['Wrong Answer', 'Accepted']
['s366010236', 's900599645']
[22636.0, 22636.0]
[75.0, 75.0]
[94, 113]
p03818
u402629484
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['input()\na = [0] * (100000 + 1)\n\nfor i in map(int, input().split()):\n a[i] += 1\n if a[i] == 3:\n a[i] >>= 1\n\nc = [0, a.count(1), a.count(2)]\n\nans = 0\nans += (c[2] >> 1) << 1\nans += c[1]\nans -= c[2] & 1\n\nprint(ans)\n', 'input()\na = [0] * (100000 + 1)\n\nfor i in map(int, input().split()):\n a[i] += 1\n if a[i] == 3:\n a[i] >>= 1\n\nc = [0, a.count(1), a.count(2)]\n\nans = 0\nans += (c[2] >> 1) << 1\nans += c[1]\n\nprint(ans)\n\n\n']
['Wrong Answer', 'Accepted']
['s792257304', 's485473377']
[11488.0, 11324.0]
[79.0, 80.0]
[225, 211]
p03818
u441575327
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\n\nN = int(input())\nA = list(map(int,input().split()))\n\ncounter = Counter(A)\n\ncounts = counter.most_common()\n\ndup_num = 0\nfor i in range(len(counts)):\n if counts[i][1] != 1:\n dup_num += counts[i][1]-1\n\nprint(counts)\nif dup_num%2 == 0:\n print(N-dup_num)\nelse:\n print(N-dup_num-1)', 'from collections import Counter\n\nN = int(input())\nA = list(map(int,input().split()))\n\ncounter = Counter(A)\n\ncounts = counter.most_common()\n\ndup_num = 0\nfor i in range(len(counts)):\n if counts[i][1] != 1:\n dup_num += counts[i][1]-1\n\nif dup_num%2 == 0:\n print(N-dup_num)\nelse:\n print(N-dup_num-1)']
['Wrong Answer', 'Accepted']
['s127588305', 's116859302']
[24668.0, 21980.0]
[118.0, 84.0]
[324, 310]
p03818
u493520238
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n = int(input())\nal = list(map(int, input().split())) \nal = set(al)\nif len(al)%2 == 0:\n print(len(al))\nelse:\n print(len(al)-1)\n', 'import bisect\na_list = [1,3,3,3,6,6,7,10]\nbisect.bisect_left(a_list,4) # -> 4\n\nn = int(input())\nal = list(map(int, input().split())) \n\nal.sort()\ncnt = []\ntmp = 1\nfor i in range(1,len(al)):\n if al[i] == al[i-1]:\n tmp += 1\n else:\n cnt.append(tmp)\n tmp = 1\n\ncnt.append(tmp)\nprint(len(cnt))\n# front = 0\n# back = len(cnt)-1\n\n\n# while True:\n# while al[front] <= 1:\n# front += 1\n# if front >= len(cnt):\n\n# break\n\n# while al[back] <= 1:\n# back -= 1\n# if back < 0:\n\n# break\n\n# if front > back:\n# break\n# elif front == back:\n# al[front] = 1\n\n\n# while al[back] <= 1:\n# back -= 1\n# if al[back] > 1:\n# al[back] -= 1\n', 'n = int(input())\nal = list(map(int, input().split())) \nal = set(al)\nif len(al)%2 == 0:\n print(len(al)-1)\nelse:\n print(len(al))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s238974386', 's249804345', 's650208373']
[14396.0, 14276.0, 14396.0]
[45.0, 98.0, 45.0]
[133, 818, 133]
p03818
u497046426
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\n\nN = int(input())\n*A, = map(int, input().split())\ncnt = Counter(A)\nans = N\nduplicates = sorted([(a, d) for a, d in cnt.items() if d > 1], key=lambda x: x[0])\noffset = 0\nfor _, d in duplicates:\n if offset: d -= offset; offset = 0;\n if d == 1: continue\n elif d % 2 == 0: ans -= d; offset = 1;\n else: ans -= d-1\nans -= offset\nprint(ans)', 'from collections import Counter\n\nN = int(input())\n*A, = map(int, input().split())\ncnt = Counter(A)\nans = N\nduplicates = sorted([(a, d) for a, d in cnt.items() if d > 1], key=lambda x: x[0])\noffset = 0\nfor _, d in duplicates:\n if offset: d -= offset; offset = 0;\n if d == 1: continue\n elif d % 2 == 0: ans -= d; offset = 1;\n else: ans -= d-1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s018944333', 's203415942']
[18656.0, 18656.0]
[62.0, 62.0]
[377, 363]
p03818
u518042385
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n=int(input())\nl=sorted(list(map(int,input().split())))\nvariety=0\ncountodd=0\ncounteven=0\ncountnow=1\nnow=l[0]\nfor i in range(1,n):\n if l[i]==now:\n countnow+=1\n else:\n now=l[i]\n if countnow%2==0:\n countodd+=1\n else:\n counteven+=1\n countnow=1\nif countnow!=0:\n if countnow%2==1:\n countodd+=1\n else:\n counteven+=1\nif counteven%2==0:\n print(counteven+countodd)\nelse:\n print(counteven+countodd-1)', 'n=int(input())\nl=sorted(list(map(int,input().split())))\nvariety=0\ncountodd=0\ncounteven=0\ncountnow=1\nnow=l[0]\nfor i in range(1,n):\n if l[i]==now:\n countnow+=1\n else:\n now=l[i]\n if countnow%2==1:\n countodd+=1\n else:\n counteven+=1\n countnow=1\nif countnow!=0:\n if countnow%2==1:\n countodd+=1\n else:\n counteven+=1\nif counteven%2==0:\n print(counteven+countodd)\nelse:\n print(counteven+countodd-1)\n']
['Wrong Answer', 'Accepted']
['s156580698', 's694688486']
[14388.0, 14396.0]
[93.0, 91.0]
[426, 427]
p03818
u540761833
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['from collections import Counter\nN=int(input())\nA = list(map(int,input().split()))\nAc = Counter(A)\ndupsum = 0\ndupnum = 0\nfor v in Ac.values():\n if v > 1:\n dupsum += v-1\n dupnum += 1\nif dupnum == 1:\n print(dupsum)\nelse:\n print(dupsum-1)', 'from collections import Counter\nN=int(input())\nA = list(map(int,input().split()))\nAc = Counter(A)\nkind = len(Ac)\nAv = sum(i-1 for i in Ac.values() if i != 1)\nif Av%2 == 0:\n print(kind)\nelse:\n print(kind-1)']
['Wrong Answer', 'Accepted']
['s512344598', 's444708753']
[18656.0, 18656.0]
[56.0, 55.0]
[257, 211]
p03818
u625963200
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n=int(input())\nA=list(map(int,input().split()))\n\nkaburi=len(set(A))\nif kaburi%2==0:\n print(n-kaburi)\nelse:\n print(n-kaburi-1)', 'n=int(input())\nA=list(map(int,input().split()))\n\nkaburi=len(set(A))\nif kaburi%2==0:\n print(kaburi-1)\nelse:\n print(kaburi)']
['Wrong Answer', 'Accepted']
['s798858983', 's636291457']
[14396.0, 14564.0]
[45.0, 45.0]
[127, 123]
p03818
u637175065
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\ndef LI(): return list(map(int, input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\n\ndef main():\n n = II()\n s = set(LI())\n return len(s) | 1\n\n\nprint(main())\n', 'import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\ndef LI(): return list(map(int, input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\n\ndef main():\n n = II()\n s = set(LI())\n l = len(s)\n if l % 2 == 1:\n return l\n return l - 1\n\n\nprint(main())\n']
['Wrong Answer', 'Accepted']
['s578585924', 's409397823']
[16788.0, 16788.0]
[212.0, 602.0]
[368, 414]
p03818
u648881683
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
["import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n N = I()\n A = LI()\n\n cnt = collections.Counter(A)\n # print(cnt)\n \n \n \n \n # if cnt[i] % 2 == 0:\n # print(i, 2)\n # else:\n # print(i, 1)\n print(len(cnt))\n\nif __name__ == '__main__':\n resolve()\n", "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n N = I()\n A = LI()\n\n cnt = collections.Counter(A)\n \n for i in cnt.keys():\n if cnt[i] % 2 == 0:\n cnt[i] = 2\n else:\n cnt[i] = 1\n\n ans = 0\n even_num = [i for i in cnt.keys() if cnt[i] == 2]\n \n if len(even_num) % 2 == 0:\n ans = len(cnt)\n else:\n \n ans = len(cnt) - 1\n\n print(ans)\n\nif __name__ == '__main__':\n resolve()\n"]
['Wrong Answer', 'Accepted']
['s306498542', 's108717788']
[22752.0, 22712.0]
[64.0, 90.0]
[968, 1065]
p03818
u667024514
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n = int(input())\nlis = list(map(int,input().split()))\nans = set()\nfor num in lis:ans.add(num)\nprint(len(num)-((len(num) % 2)+1)%2)', 'n = int(input())\nlis = list(map(int,input().split()))\nans = set()\nfor num in lis:ans.add(num)\nprint(len(ans)-((len(ans) % 2)+1)%2)']
['Runtime Error', 'Accepted']
['s424238743', 's303488340']
[14564.0, 14564.0]
[53.0, 53.0]
[130, 130]
p03818
u669382434
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n=int(input())\na=list(map(int,input().split()))\nsn=[0]*n\nmi2=0\nmi=0\nfor i in range(0,n):\n if sn[i]==1:\n mi2=1-mi2\n else:\n sn[i]=1\n mi+=1\nprint(mi-mi2)', 'n=int(input())\na=list(map(int,input().split()))\nsn=[0]*n\nmi2=0\nmi=0\nfor i in range(0,n):\n if sn[a[i]]==1:\n mi2=1-mi2\n else:\n sn[a[i]]=1\n mi+=1\nprint(mi-mi2)', 'n=int(input())\na=list(map(int,input().split()))\nsn=[0]*100001\nmi2=0\nmi=0\nfor i in range(0,n):\n if sn[a[i]]==1:\n mi2=1-mi2\n else:\n sn[a[i]]=1\n mi+=1\nprint(mi-mi2)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s447807909', 's982503604', 's455008351']
[14396.0, 14388.0, 14396.0]
[66.0, 70.0, 70.0]
[177, 183, 188]
p03818
u765237551
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['use std::io::stdin;\n\nfn main(){\n let x = geti64s()[0];\n let (d, m) = (x/11, x%11);\n println!("{}", match m {\n 0 => d*2,\n x if x<=6 => d*2 + 1,\n _ => d*2 + 2\n });\n}\n\n#[allow(dead_code)]\nfn getline() -> String {\n let mut s = String::new();\n match stdin().read_line(&mut s){\n Ok(_) => {s.trim().to_string()}\n Err(_) => String::new()\n }\n}\n\n#[allow(dead_code)]\nfn getvec() -> Vec<usize>{\n let line = getline();\n line.split_whitespace().map(|x| x.parse().unwrap()).collect()\n}\n\n#[allow(dead_code)]\nfn geti64s() -> Vec<i64>{\n let line = getline();\n line.split_whitespace().map(|x| x.parse().unwrap()).collect()\n}\n\n#[allow(dead_code)]\nfn getpair() -> (usize, usize){\n let nm = getvec();\n (nm[0], nm[1])\n}', 'from collections import Counter\n\n_ = input()\nxs = Counter(map(int, input().split()))\neven = sum(1 for (k, c) in xs.items() if c%2==0)\nodd = sum(1 for (k, c) in xs.items() if c%2==1)\nprint(odd + (even//2)*2)']
['Runtime Error', 'Accepted']
['s430897276', 's871005166']
[2940.0, 22636.0]
[18.0, 67.0]
[786, 206]
p03818
u905203728
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n=int(input())\nA=list(map(int,input().split()))\nA.sort()\nprint(A)\nA_length=n-len(set(A))\nif A_length%2==0:print(A_length)\nelse:print(A_length-1)', 'n=int(input())\nA=list(map(int,input().split()))\nA.sort()\nA_l=len(set(A))\nprint(A_l if (n-A_l)%2==0 else A_l-1)']
['Wrong Answer', 'Accepted']
['s789124792', 's324083568']
[16100.0, 14692.0]
[88.0, 82.0]
[144, 110]
p03818
u984351908
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['n = int(input())\na = list(map(int, input().split()))\na.sort()\nc = 0\ne = 0\ni = 0\nwhile True:\n c += 1\n cai = 1\n while i != n - 1 and a[i] == a[i + 1]:\n cai += 1\n print(i)\n if i != n - 1:\n i += 1\n else:\n break\n if cai % 2 == 0:\n e += 1\n if i != n - 1:\n i += 1\n else:\n break\nans = c - (e % 2)\nprint(ans)\n', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\nc = 0\ne = 0\ni = 0\nwhile i < len(a):\n c += 1\n cai = 1\n while a[i] == a[i + 1]:\n cai += 1\n i += 1\n if cai % 2 == 0:\n e += 1\n i += 1\nans = c - (e % 2)\nprint(ans)\n', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\nc = 0\ne = 0\ni = 0\nwhile True:\n c += 1\n cai = 1\n while i != n - 1 and a[i] == a[i + 1]:\n cai += 1\n if i != n - 1:\n i += 1\n else:\n break\n if cai % 2 == 0:\n e += 1\n if i != n - 1:\n i += 1\n else:\n break\nans = c - (e % 2)\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s360628691', 's388445088', 's054704823']
[14092.0, 14396.0, 14388.0]
[198.0, 128.0, 136.0]
[389, 257, 372]
p03818
u989306199
2,000
262,144
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept. Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.
['import collections as col\n\nN = int(input())\nA = list(map(int, input().split()))\n\nm = col.Counter(A)\nans = len(m) if m%2==1 else len(m)-1\nprint(ans)\n\n', 'import collections as col\n\nN = int(input())\nA = list(map(int, input().split()))\n\nm = col.Counter(A)\nans = len(m) if len(m)%2==1 else len(m)-1\nprint(ans)\n\n']
['Runtime Error', 'Accepted']
['s794830106', 's285509372']
[21916.0, 22036.0]
[55.0, 61.0]
[149, 154]
p03821
u020390084
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
["#!/usr/bin/env python3\nimport sys\n# input = sys.stdin.r/eadline\ndef INT(): return int(input())\ndef MAP(): return map(int,input().split())\ndef LI(): return list(map(int,input().split()))\n\ndef main():\n N = int()\n A=[]\n B = []\n for _ in range(N):\n a,b = MAP()\n A.append(a)\n B.append(b)\n\n answer = 0\n for i in range(N-1,-1,-1):\n if (answer+A[i])%B[i] > 0:\n need = B[i]-(answer+A[i])%B[i]\n answer += need\n print(answer)\n return\n\nif __name__ == '__main__':\n main()\n", "#!/usr/bin/env python3\nimport sys\n# input = sys.stdin.r/eadline\ndef INT(): return int(input())\ndef MAP(): return map(int,input().split())\ndef LI(): return list(map(int,input().split()))\n\ndef main():\n N = INT()\n A=[]\n B = []\n for _ in range(N):\n a,b = MAP()\n A.append(a)\n B.append(b)\n\n answer = 0\n for i in range(N-1,-1,-1):\n if (answer+A[i])%B[i] > 0:\n need = B[i]-(answer+A[i])%B[i]\n answer += need\n print(answer)\n return\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s224603361', 's730070888']
[3064.0, 11060.0]
[17.0, 328.0]
[536, 536]
p03821
u048472001
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['\nN = int(input())\ntotal = 0\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\t\nfor i in range(N-1,-1,-1):\n\ta = A[i] % B[i]\n\tif a == 0:\n\t\tpass\n\telse:\n\t\ttotal = total + B[i] - a\n\t\tfor j in range (i):\n\t\t\tA[i] = A[i] + B[i] - a\n\n\nprint (total)\n\t\n', '\nN = int(input())\ntotal = 0\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\t\nfor t in range(N):\n\ti = N + 1 - t\n\ta = A[i] % B[i]\n\tif a == 0:\n\t\tpass\n\telse:\n\t\ttotal = B[i]-a:\n\t\tfor j in range (i):\n\t\t\tA[i] = A[i] + B[i] - a\n\n\nprint (total)\n\t\n', '\nN = int(input())\ntotal = 0\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\t\nfor i in range(N-1,-1,-1):\n\tb = A[i] + total\n\ta = b % B[i]\n\tif a == 0:\n\t\tpass\n\telse:\n\t\ttotal = total + B[i] - a\n\n\nprint (total)\n\t\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s204303706', 's545238072', 's694304428']
[10996.0, 2940.0, 10868.0]
[2104.0, 17.0, 341.0]
[285, 283, 252]
p03821
u056358163
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['import fractions\n\ndef lcm(a, b):\n return a * b / fractions.gcd(a, b)\n\nN, M = map(int, input().split())\nS = input()\nT = input()\n\nd_N = {}\n\nfor n in range(N):\n d = fractions.gcd(n, N)\n d_N[(n // d, N // d)] = n\n\nfor m in range(M):\n d = fractions.gcd(m, M)\n k = (m // d, M // d)\n if k in d_N:\n if S[d_N[k]] != T[m]:\n print(-1)\n exit()\n\nL = int(lcm(N, M))\nprint(L)', 'import math\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\nans = 0\n\nfor a, b in zip(A[::-1], B[::-1]):\n a += ans\n ans += math.ceil(a / b) * b - a\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s727104646', 's578813230']
[5048.0, 12644.0]
[37.0, 364.0]
[407, 238]
p03821
u060736237
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\nA, B = [], []\nfor _ in range(n):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nresult = 0\nfor a, b in zip(A[::-1], B[::-1]):\n piyo = (a+result) % b\n if piyo == 0:\n continue\n result += b - piyo\nprint(result', 'n = int(input())\nA, B = [], []\nfor _ in range(n):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nresult = 0\nfor a, b in zip(A[::-1], B[::-1]):\n piyo = (a+result) % b\n if piyo == 0:\n continue\n result += b - piyo\nprint(result)']
['Runtime Error', 'Accepted']
['s877917127', 's780733408']
[3060.0, 12624.0]
[17.0, 348.0]
[261, 262]
p03821
u075304271
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['import numpy as np\nimport math\nimport collections\nimport fractions\nimport itertools\n\ndef iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n n = int(input())\n cost = 0\n for i in range(n):\n a, b = mput()\n mult = math.ceil(a/b)*b\n cost += mult - a\n print(cost)\n return 0\n\n\nif __name__ == "__main__":\n solve()', 'import numpy as np\nimport math\nimport collections\nimport fractions\nimport itertools\n\ndef iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n n = int(input())\n cost = 0\n a, b = [0]*n, [0]*n\n for i in range(n):\n a[i], b[i] = mput()\n inc = 0\n for i in range(n-1, -1, -1):\n a[i] += inc\n mult = math.ceil(a[i]/b[i])*b[i]\n cost += mult - a[i]\n inc += mult - a[i]\n print(cost)\n return 0\n\nif __name__ == "__main__":\n solve()\n']
['Wrong Answer', 'Accepted']
['s245531995', 's310250981']
[13544.0, 25052.0]
[497.0, 495.0]
[432, 566]
p03821
u077003677
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
["import sys\nimport os\n\ndef file_input():\n f = open('AGC009/input.txt', 'r')\n sys.stdin = f\n\ndef main():\n #file_input()\n N=int(input())\n A=[]\n B=[]\n for i in range(N):\n tmp=list(map(int, input().split()))\n A.append(tmp[0])\n B.append(tmp[1])\n\n cnt=0\n for j in range(N):\n # while (A[N-1-j]+cnt)%B[N-1-j]!=0:\n # cnt+=1\n tmp=A[N-1-j]+cnt\n if not tmp==0:\n # cnt=B[N-1-j]\n elif tmp<B[N-1-j]:\n cnt+=B[N-1-j]-tmp\n elif tmp%B[N-1-j]!=0:\n cnt+=B[N-1-j]-tmp%B[N-1-j]\n\n print(cnt)\n\nif __name__ == '__main__':\n main()\n", "import sys\nimport os\n\ndef file_input():\n f = open('AGC009/input.txt', 'r')\n sys.stdin = f\n\ndef main():\n #file_input()\n N=int(input())\n A=[]\n B=[]\n for i in range(N):\n tmp=list(map(int, input().split()))\n A.append(tmp[0])\n B.append(tmp[1])\n\n cnt=0\n for j in range(N):\n # while (A[N-1-j]+cnt)%B[N-1-j]!=0:\n # cnt+=1\n tmp=A[N-1-j]+cnt\n if not tmp==0:\n # cnt=B[N-1-j]\n if tmp<B[N-1-j]:\n cnt+=B[N-1-j]-tmp\n elif tmp%B[N-1-j]!=0:\n cnt+=B[N-1-j]-tmp%B[N-1-j]\n\n print(cnt)\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s098881454', 's559736081']
[2940.0, 11112.0]
[18.0, 396.0]
[648, 646]
p03821
u077291787
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['# AGC009A - Multiple Array\ndef main():\n N, *AB = map(int, open(0).read().split())\n ans = 0\n for i, j in zip(*[iter(A[::-1])] * 2): # decide from the last one greedily\n ans += -(i + ans) % j\n print(ans)\n\n\nif __name__ == "__main__":\n main()', '# AGC009A - Multiple Array\ndef main():\n N, *AB = map(int, open(0).read().split())\n ans = 0\n for i, j in zip(*[iter(AB[::-1])] * 2): # decide from the last one greedily\n ans += -(j + ans) % i\n print(ans)\n\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s854869476', 's811177140']
[25124.0, 25124.0]
[65.0, 87.0]
[261, 262]
p03821
u095756391
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\na = []\nb = []\n\nfor _ in range(n):\n c, d = map(int, input().split())\n a.append(c)\n b.append(d)\n\ns = 0\nfor i in range(n-1, -1, 1):\n r = b[i] + s % a[i]\n if r != 0:\n s += r\n \nprint(s)', 'n = int(input())\na = []\nb = []\n\nfor _ in range(n):\n c, d = map(int, input().split())\n a.append(c)\n b.append(d)\n\ns = 0\nfor i in range(n-1, -1, -1):\n r = (a[i] + s) % b[i]\n if r != 0:\n s += b[i] - r\n \nprint(s)']
['Wrong Answer', 'Accepted']
['s016157796', 's374949847']
[11048.0, 11040.0]
[306.0, 348.0]
[222, 232]
p03821
u102960641
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\na = []\nfor i in range(n):\n a1 = list(map(int, input().split()))\n a.append(a1)\nans = 0\nb = 0\nfor i in a:\n if i[1] != 1:\n c = i[1] - (i[0]+b) % i[1]\n print(c,b)\n ans += c\n b += c\nprint(ans)', 'n = int(input())\na = []\nfor i in range(n):\n a1 = list(map(int, input().split()))\n a.append(a1)\na.reverse()\nans = 0\nb = 0\nfor i in a:\n if i[1] != 1:\n c = i[1] - (i[0]+b) % i[1]\n if c == i[1]:\n c = 0\n ans += c\n b += c\nprint(ans)']
['Wrong Answer', 'Accepted']
['s249693209', 's435073763']
[30084.0, 27380.0]
[546.0, 419.0]
[219, 246]
p03821
u103902792
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\nA = []\nB = []\nans = 0\n\nfor _ in range(n):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n \nfor _ in range(n):\n a = A.pop(-1)\n b = B.pop(-1)\n a += ans\n ans += a%b\nprint(ans)', 'n = int(input())\nA = []\nB = []\nans = 0\nimport math\n\nfor _ in range(n):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n \nfor _ in range(n):\n a = A.pop(-1)\n b = B.pop(-1)\n a += ans\n ans += math.ceil(a/b)*b - a\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s898927380', 's021714262']
[17036.0, 16892.0]
[240.0, 251.0]
[208, 240]
p03821
u107077660
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['N = int(input())\nB = [[] for _ in range(N)]\nunchecked = [i for i in range(N)]\nfor i in range(1,N):\n\tt = int(input()) - 1\n\tB[t].append(i)\nans = [0]*N\nfor i in range(N):\n\tif not B[i]:\n\t\tunchecked.remove(i)\nwhile 0 in unchecked:\n\tfor i in unchecked:\n\t\t\tf = 0\n\t\t\tC = []\n\t\t\tfor a in B[i]:\n\t\t\t\tif a in unchecked:\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\tC.append(ans[a])\n\t\t\tif not f:\n\t\t\t\tC.sort()\n\t\t\t\tC.reverse()\n\t\t\t\tl = len(C)\n\t\t\t\tans[i] = max([j+C[j]+1 for j in range(l)])\n\t\t\t\tunchecked.remove(i)\nprint(ans[0])', 'N = int(input())\nans = 0\nab = []\nfor _ in range(N):\n\tab.append([int(i) for i in input().split()])\nab.reverse()\nfor A,B in ab:\n\tans = ans + (-A-ans) % B\nprint(ans)']
['Runtime Error', 'Accepted']
['s488582758', 's252539039']
[14260.0, 21156.0]
[59.0, 455.0]
[502, 162]
p03821
u137667583
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\na, b = [0]*n,[0]*n\ncount = 0\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\n\nwhile(n > 0):\n count += (a[n-1]+count)%b[n-1]\n n-=1\n\nprint(count)', 'n = int(input())\na, b = [0]*n,[0]*n\ncount = 0\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\n\nwhile(n > 0):\n n -= 1\n count += (b[n] if (a[n]+count)%b[n]!=0 else 0)-(a[n]+count)%b[n]\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s002766781', 's241970134']
[10868.0, 10868.0]
[344.0, 357.0]
[178, 214]
p03821
u185896732
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['#import pysnooper\n\n#from collections import Counter,deque\n#from operator import itemgetter\n#from itertools import accumulate,combinations,groupby\nfrom sys import stdin,setrecursionlimit\n#from copy import deepcopy\nsetrecursionlimit(10**6)\n\nn=int(stdin.readline().rstrip())\na=[tuple(map(int,stdin.readline().rstrip().split())) for _ in range(n)]\ncnt=0\nfor i in range(n-1,-1,-1):\n now=(a[i][0]+cnt)%a[i][1]\n print(now)\n cnt+=a[i][1]-now\nprint(cnt)', '#import pysnooper\n\n#from collections import Counter,deque\n#from operator import itemgetter\n#from itertools import accumulate,combinations,groupby\nfrom sys import stdin,setrecursionlimit\n#from copy import deepcopy\nsetrecursionlimit(10**6)\n\nn=int(stdin.readline().rstrip())\na=[tuple(map(int,stdin.readline().rstrip().split())) for _ in range(n)]\ncnt=0\nfor i in range(n-1,-1,-1):\n now=(a[i][0]+cnt)%a[i][1]\n if now!=0:\n cnt+=a[i][1]-now\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s997614407', 's669968181']
[17656.0, 16612.0]
[303.0, 217.0]
[497, 501]
p03821
u212328220
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['N = int(input())\nal = []\nbl = []\nfor i in range(N):\n a,b = map(int,input().split())\n al.append(a)\n bl.append(b)\nal.reverse()\nbl.reverse()\n\nplus = 0\nfor i in range(N):\n if al[i]+plus > bl[i]:\n amari = (al[i]+plus) % bl[i]\n syo = (al[i]+plus) // bl[i]\n if amari != 0:\n syo += 1\n plus += bl[i] * syo - al[i]\n\n elif al[i]+plus < bl[i]:\n if al[i]+plus == 0:\n plus += bl[i]\n plus += bl[i] - (al[i]+plus)\n\n else:\n continue\n\n\nprint(plus)\n\n', 'n = int(input())\nab = []\nfor _ in range(n):\n ab.append(list(map(int,input().split())))\n\ncnt = 0\nfor i in range(n-1,-1,-1):\n a,b = ab[i][0],ab[i][1]\n num = a + cnt\n if num % b == 0:\n continue\n else:\n amari = num % b\n cnt += b-amari\n \nprint(cnt)']
['Wrong Answer', 'Accepted']
['s847222078', 's235271991']
[16948.0, 27212.0]
[2206.0, 280.0]
[520, 282]
p03821
u215630013
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n = int(input())\nls = []\nfor i in range(n):\n a,b = map(int, input().split())\n ls.append((a,b))\ncnt = 0\nfor i, j in sorted(ls, reverse=True):\n m = (i+cnt) % j\n cnt += 0 if m == 0 else j-m\nprint(cnt)', 'n = int(input())\nls = []\nfor i in range(n):\n a,b = map(int, input().split())\n ls.append((a,b))\ncnt = 0\nfor i, j in ls[::-1]:\n m = (i+cnt) % j\n cnt += 0 if m == 0 else (j-m)\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s184796250', 's603446434']
[17756.0, 17428.0]
[476.0, 368.0]
[209, 195]
p03821
u227082700
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n,a,b=int(input()),[],[]\nfor i in range(n):x,y=map(int,input().split());a.append(x);b.append(y)\nr=0\nfor i in range(n):r+=(b[n-i-1]*(((a[n-i-1]+r-1)//b[n-1-i])+1))-a[n-1-i]\nprint(r)', 'n,a,b=int(input()),[],[]\nfor i in range(n):x,y=map(int,input().split());a.append(x);b.append(y)\na,b=a[::-1],b[::-1]\nr=0\nfor i in range(n):r+=(b[i]*(((a[i]+r-1)//b[i])+1))-a[i]\nprint(r)', 'n=int(input())\na=[list(map(int,input().split()))for _ in range(n)]\nm=0\nfor i in range(n):m+=((a[-1-i][0]+m-1)//a[-1-i][1]+1)*a[-1-i][1]-a[-1-i][0]\nprint(m)', 'n=int(input())\na=[list(map(int,input().split()))for _ in range(n)][::-1]\nm=0\nfor i in range(n):m+=((a[i][0]+m-1)//a[i][1]+1)*a[i][1]-a[i][0]\nprint(m)', 'n=int(input())\na=[]\nb=[]\nfor i in range(n):\n aa,bb=map(int,input().split())\n a.append(aa)\n b.append(bb)\nm=0\nfor i in range(n-1,-1,-1):\n a[i]+=m\n if a[i]%b[i]:m+=b[i]-a[i]%b[i]\nprint(m)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s046955314', 's078142655', 's544590706', 's701828156', 's129587597']
[11048.0, 12584.0, 27428.0, 29412.0, 15020.0]
[2104.0, 2104.0, 2105.0, 2105.0, 373.0]
[180, 184, 155, 149, 189]
p03821
u243492642
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['# coding: utf-8\nnum_N = int(input())\nl_A = []\nl_B = []\nfor __ in range(num_N):\n l_info = list(map(int, input().split()))\n l_A.append(l_info[0])\n l_B.append(l_info[1])\n \nl_A.append(0)\nl_B.append(0)\nl_A.reverse()\nl_B.reverse()\n \nans = 0\n \nfor i in range(1, num_N + 1):\n if l_A[i] + ans == l_B[i]:\n pass\n elif l_A[i] + ans < l_B[i]:\n now_A = l_A[i] + ans\n ans += l_B[i] - now_A\n else:\n while True:\n if (l_A[i] + ans) % l_B[i] == 0:\n break\n ans += 1\n print(ans)\n \nprint(ans)\n', '# coding: utf-8\nnum_N = int(input())\nl_A = []\nl_B = []\nfor __ in range(num_N):\n l_info = list(map(int, input().split()))\n l_A.append(l_info[0])\n l_B.append(l_info[1])\n\nl_A.append(0)\nl_B.append(0)\nl_A.reverse()\nl_B.reverse()\n\nans = 0\n\nfor i in range(1, num_N + 1):\n if l_A[i] + ans == l_B[i]:\n pass\n elif l_A[i] + ans < l_B[i]:\n now_A = l_A[i] + ans\n ans += l_B[i] - now_A\n else:\n while True:\n if (l_A[i] + ans) % l_B[i] == 0:\n break\n ans += 1\n print(ans)\n\nprint(ans)', '# coding: utf-8\nnum_N = int(input())\ndata = [list(map(int, input().split())) for __ in range(num_N)]\ndata.reverse()\n\nans = 0\n\nfor a, b in data:\n r = (a + ans) % b\n if r:\n ans += b - r\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s086906631', 's621921701', 's842724950']
[11868.0, 11884.0, 27380.0]
[2104.0, 2108.0, 375.0]
[557, 552, 208]
p03821
u268792407
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['n=int(input())\nans=0\nfor i in range(n):\n a,b=map(int,input().split())\n ans += (b-a%b)%b\nprint(ans)', 'n=int(input())\nab=[list(map(int,input().split())) for i in range(n)]\nm=0\nfor i in range(n):\n i=n-1-i\n a,b=ab[i][0]+m,ab[i][1]\n m+=(b-a%b)%b\nprint(m)']
['Wrong Answer', 'Accepted']
['s308680998', 's803570507']
[3060.0, 27380.0]
[329.0, 389.0]
[100, 151]
p03821
u276204978
2,000
262,144
There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i. Find the minimum number of times Takahashi will press the buttons.
['import numpy as np\n\nN = int(input())\nA = np.zeros(N).astype(int)\nB = np.zeros(N).astype(int)\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nans = 0\nfor i in reversed(range(N)):\n \tA[i] = A[i] + ans\n if A[i] % B[i] == 0:\n continue\n elif B[i] - A[i] > 0:\n ans += B[i] - A[i]\n else:\n ans += B[i] - (A[i] % B[i])\n \nprint(ans)', 'import numpy as np\n\nN = int(input())\nA = np.zeros(N).astype(int)\nB = np.zeros(N).astype(int)\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nans = 0\nfor i in reversed(range(N)):\n A[i] = A[i] + ans\n if A[i] % B[i] == 0:\n continue\n else:\n ans += B[i] - (A[i] % B[i])\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s363839959', 's085578192']
[2940.0, 14168.0]
[17.0, 773.0]
[371, 319]