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
p03821
u277429554
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 = []\nfor j in range(n):\n l = list(map(int, input().split()))\n a.append(l[0])\n b.append(l[1])\n c = 0\nfor i in range(n-1, -1, -1):\n if (a[i]+c) % b[i] != 0:\n c += (b[i] - (a[i]+c) % b[i])\nprint(c)', 'n = int(input())\na = []\nb = []\nfor j in range(n):\n l = list(map(int, input().split()))\n a.append(l[0])\n b.append(l[1])\nc = 0\nfor i in range(n-1, -1, -1):\n if (a[i]+c) % b[i] != 0:\n c += (b[i] - (a[i]+c) % b[i])\nprint(c)']
['Runtime Error', 'Accepted']
['s576353698', 's116525074']
[8996.0, 16968.0]
[27.0, 262.0]
[239, 238]
p03821
u371132735
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())\nA = []\nB = []\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\npush = 0\nfor i in range(N):\n if (A[N-i-1] + push) % B[N-i-1] != 0:\n push += abs(B[N-i-1] - ((push + A[N-i-1]) % B[N-i-1]))\n print(A[N-i-1] , B[N-i-1],push)\nprint(push)\n', '\nN = int(input())\nA = []\nB = []\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\npush = 0\nfor i in range(N):\n if (A[N-i-1] + push) % B[N-i-1] != 0:\n push += abs(B[N-i-1] - ((push + A[N-i-1]) % B[N-i-1]))\nprint(push)\n']
['Wrong Answer', 'Accepted']
['s463005346', 's131857963']
[14496.0, 11048.0]
[619.0, 404.0]
[330, 290]
p03821
u375616706
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.
['def floor(a, b):\n return min(0, b - a % b)\n\n\nN = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\nans = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n b = B.pop(-1)\n inc = b*floor(a, b)-a\n total_add += inc\n\nprint(total_add)\n', 'def floor(a, b):\n return b - a % b\n\n\nN = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\nans = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n b = B.pop(-1)\n inc = b*floor(a, b)-a\n total_add += inc\n\nprint(total_add)\n', 'N = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\nans = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n inc = min(0, b - a % b)\n b = B.pop(-1)\n total_add += inc\n\nprint(total_add)\n', 'N = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\nans = 0\ninc = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n if a % b == 0:\n inc = 0\n else:\n inv = b - a % b\n b = B.pop(-1)\n total_add += inc\n\nprint(total_add)\n', 'N = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\ninc = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n b = B.pop(-1)\n if a % b == 0:\n inc = 0\n else:\n inv = b - a % b\n total_add += inc\n\nprint(total_add)\n', 'N = int(input())\nA = []\nB = []\ntotal_add = 0\nfor _ in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\n\ninc = 0\nfor i in reversed(range(N)):\n a = A.pop(-1)\n a += total_add\n b = B.pop(-1)\n inc = b - a % b if a % b != 0 else 0\n total_add += inc\n\nprint(total_add)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s357388258', 's372805782', 's763162944', 's804284133', 's982904058', 's512469939']
[11060.0, 11064.0, 11052.0, 11132.0, 11008.0, 11052.0]
[419.0, 399.0, 389.0, 385.0, 383.0, 396.0]
[340, 332, 294, 343, 335, 307]
p03821
u388415336
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.
['seq_a = []\nseq_b = []\nseq_n = int(input())\nfor i in range(seq_n):\n num_a,num_b=map(int,input().split())\n a.append(num_a)\n b.append(num_b)\nx = 0\nfor i in range(seq_n - 1, -1 ,-1):\n elem_a , elem_b = seq_a[i],seq_b[i]\n y = (elem_a + x)% elem_b\n if y != 0: x += (m-y)\nprint(x)', 'seq_a = []\nseq_b = []\nseq_n = int(input())\nfor i in range(seq_n):\n num_a,num_b=map(int,input().split())\n seq_a.append(num_a)\n seq_b.append(num_b)\nx = 0\nfor i in range(seq_n - 1, -1 ,-1):\n elem_a , elem_b = seq_a[i],seq_b[i]\n y = (elem_a + x)% elem_b\n if y != 0: x += (m-y)\nprint(x)', 'seq_a = []\nseq_b = []\nseq_n = int(input())\nfor i in range(seq_n):\n num_a,num_b=map(int,input().split())\n seq_a.append(num_a)\n seq_b.append(num_b)\nx = 0\nfor i in range(seq_n - 1, -1 ,-1):\n seq_n , elem_b = seq_a[i],seq_b[i]\n y = (seq_n + x)% elem_b\n if y != 0: x += (m-y)\nprint(x)', 'a=[]\nb=[]\nn=int(input())\nfor i in range(n):\n j,k=map(int,input().split())\n a.append(j)\n b.append(k)\nx=0\nfor i in range(n-1,-1,-1):\n n,m=a[i],b[i]\n y=(n+x)%m\n if y!=0:x+=m-y\nprint(x)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s336075198', 's672444704', 's864384772', 's239339706']
[3060.0, 11052.0, 11052.0, 11048.0]
[17.0, 330.0, 326.0, 348.0]
[291, 299, 297, 199]
p03821
u391475811
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=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n\nans=0\nfor i in range(N-1,-1,-1):\n a=A[i]+ans\n b=B[i]\n if a < b:\n ans+=(b-a)\n elif a % b==0\n continue\n else:\n ans+=(a+b)//b*b-a\n \nprint(ans)', 'N=int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a)\n B.append(b)\n\nans=0\nfor i in range(N-1,-1,-1):\n a=A[i]+ans\n b=B[i]\n if a ==0 or a % b ==0:\n continue\n else:\n ans+=(a+b)//b*b-a\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s824105834', 's177152631']
[2940.0, 11048.0]
[17.0, 375.0]
[260, 242]
p03821
u391731808
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())\nAB = [list(map(int,input().split())) for _ in [0]*N]\n\nans = 0\nfor a,b in AB[::-1]:\n a = max(a,ans)\n ans = ((a-1)//b+1)*b\nprint(ans)', 'N = int(input())\nAB = [list(map(int,input().split())) for _ in [0]*N]\n\nans = 0 \nfor a,b in AB[::-1]: ans += (-a-ans)%b\nprint(ans)']
['Wrong Answer', 'Accepted']
['s025382191', 's092227136']
[28148.0, 28148.0]
[378.0, 362.0]
[150, 129]
p03821
u408375121
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())\nl = []\nr = []\nfor _ in range(n):\n a, b = map(int, input().split())\n l.append(a)\n r.append(b)\nbefore_sa = 0\nfor i in range(1, n+1):\n j = 0\n a, b = l[-i], r[-i]\n a += before_sa\n if a % b == 0:\n continue\n else:\n sa = (a//b + 1) * b - a\n before_sa = sa\nprint(before_sa)\n', 'n = int(input())\nl = []\nr = []\nfor _ in range(n):\n a, b = map(int, input())\n l.append(a)\n r.append(b)\nbefore_sa = 0\nfor i in range(1, n+1):\n j = 0\n a, b = l[-i], r[-i]\n while True:\n if j == 0 and a % b == 0:\n sa = 0\n elif j == 0 and a % b != 0:\n sa = (a//b + 1) * b - a\n elif j > 0:\n sa = (a//b + j) * b - a\n if before_sa <= sa:\n before_sa = sa\n break\n j += 1\nprint(before_sa)', 'n = int(input())\nl = []\nr = []\nfor _ in range(n):\n a, b = map(int, input().split())\n l.append(a)\n r.append(b)\nbefore_sa = 0\nfor i in range(1, n+1):\n a, b = l[-i], r[-i]\n a += before_sa\n if a % b == 0:\n continue\n else:\n sa = (a//b + 1) * b - a\n before_sa += sa\nprint(before_sa)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s582354004', 's903634817', 's867450316']
[11120.0, 3064.0, 11060.0]
[372.0, 17.0, 379.0]
[300, 422, 293]
p03821
u413165887
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())\nab = [list(map(int, input().split())) for _i in range(n)]\n\nx = 0\nr = 0\nfor i in range(n-1, -1, -1):\n a, b = ab[i]\n r += (x+a)%b\n x = r\nprint(r)', 'n = int(input())\nab = [list(map(int, input().split())) for _i in range(n)][::-1]\n\nr = 0\nfor i in range(n):\n a, b = ab[i]\n if (r+a)%b==0:\n continue\n r += b-(r+a)%b\nprint(r)']
['Wrong Answer', 'Accepted']
['s488820335', 's584903735']
[27136.0, 28188.0]
[241.0, 261.0]
[169, 187]
p03821
u425351967
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=[]\nfor i in range(N):\n a,b=[int(n) for n in input().split()]\n A.append(a)\n B.append(b)\n\ncnt=0\n\n# print(list(reversed(range(N))))\nfor i in reversed(range(N)):\n if A[i]%B[i]==0:\n r=0\n else\n r=B[i]-A[i]%B[i]\n cnt+=r\n A=[A[n]+r if n<=i else A[n] for n in range(N)]\n\nprint(cnt)\n', 'N = int(input())\nA=[]\nB=[]\nfor i in range(N):\n a,b=[int(n) for n in input().split()]\n A.append(a)\n B.append(b)\n\ncnt=0\n\n# print(list(reversed(range(N))))\nfor i in reversed(range(N)):\n if (A[i]+cnt)%B[i]==0:\n d=0\n else:\n d=B[i]-(A[i]+cnt)%B[i]\n cnt+=d\n# A=[A[n]+r if n<=i else A[n] for n in range(N)]\n\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s677940065', 's905799760']
[3064.0, 11088.0]
[22.0, 472.0]
[332, 346]
p03821
u434208140
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())\nc=[list(map(int,unput().split())) for _ in [0]*n].reverse()\nt=0\nfor i in c:\n a=c[0]\n b=c[2]\n t+=b-1-(a+t-1)%b\nprint(t)', 'c=list(reversed([list(map(int,input().split())) for _ in [0]*int(input())]))\nt=0\nfor i in c:\n a=i[0]\n b=i[1]\n t+=b-1-(a+t-1)%b\nprint(t)']
['Runtime Error', 'Accepted']
['s671260720', 's471407841']
[3828.0, 28148.0]
[19.0, 380.0]
[136, 138]
p03821
u451017206
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 = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\n\nA = A[::-1]\nB = B[::-1]\n\nans = 0\nfor a, b in zip(A, B):\n a += ans\n m = b - (a % b) if b != 1 else 0\n m = b if a == 0\n ans += m\nprint(ans)', 'ans = 0\nfor a, b in reversed([[int(j) for j in input().split()] for i in range(int(input()))]):\n a += ans\n k = a % b\n if k != 0: ans += b - k\nprint(ans)']
['Runtime Error', 'Accepted']
['s439268851', 's429822962']
[2940.0, 21156.0]
[17.0, 352.0]
[269, 161]
p03821
u474925961
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=[]\nrn=0\ncnt=0\nfor i in range(n):\n b,c=map(int,input().split())\n a.append([b,c])\na=a[::-1]\nprint(a) \nfor i in range(n):\n b,c=a[i]\n b+=cnt\n cnt+=(c-b%c)%c\nprint(cnt)\n', 'n=int(input())\na=[]\nrn=0\ncnt=0\nfor i in range(n):\n b,c=map(int,input().split())\n a.append([b,c])\na=a[::-1]\nprint(a) \nfor i in range(n):\n b,c=a[i]\n b+=cnt\n cnt+=(c-b%c)%c\nprint(cnt)\n', 'n=int(input())\na=[]\nrn=0\ncnt=0\nfor i in range(n):\n b,c=map(int,input().split())\n a.append([b,c])\na=a[::-1]\n \nfor i in range(n):\n b,c=a[i]\n b+=cnt\n cnt+=(c-b%c)%c\nprint(cnt)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s291196138', 's850222742', 's169370908']
[28120.0, 28120.0, 20520.0]
[417.0, 420.0, 380.0]
[198, 198, 189]
p03821
u536034761
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.
['from sys import stdin\ndef main():\n readline = stdin.readline\n N = int(readline())\n L = [list(map(int, readline().split())) for _ in range(N)]\n cnt = 0\n for l in L[::-1]:\n a = l[0] + cnt\n b = l[1]\n if a % b != 0:\n cnt += a % b\n print(cnt)\nif __name__ == "__main__":\n main()', 'from sys import stdin\ndef main():\n readline = stdin.readline\n N = int(readline())\n L = [list(map(int, readline().split())) for _ in range(N)]\n cnt = 0\n for l in L[::-1]:\n a = l[0] + cnt\n b = l[1]\n if a % b != 0:\n cnt += b - a % b\n print(cnt)\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s917173856', 's203015822']
[28096.0, 28112.0]
[141.0, 143.0]
[293, 297]
p03821
u573272932
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())\ncnt = 0\nL = []\nfor i in range(N):\n\tL.append(list(map(int, input().split())))\n\nfor i in range(N):\n\tA, B = L[-i+1]\n\tcnt += -(A + cnt)%B\n\tprint(cnt)', 'N = int(input())\ncnt = 0\nL = []\nfor i in range(N):\n\tL.append(list(map(int, input().split())))\n\nL = L[::-1]\n\nfor i in range(N):\n\tA, B = L[i]\n\tif A:\n\t\tcnt += -(A + cnt)%B\n\telse:\n\t\tcnt += B - cnt\n\tprint(cnt)', 'N = int(input())\ncnt = 0\nL = []\nfor i in range(N):\n\tL.append(list(map(int, input().split())))\n\nL = L[::-1]\n \nfor i in range(N):\n\tA, B = L[i]\n\tif A:\n\t\tcnt += -(A + cnt)%B\n\nprint(cnt)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s151814206', 's882462532', 's791523710']
[28916.0, 28900.0, 28148.0]
[483.0, 477.0, 405.0]
[162, 204, 181]
p03821
u595893956
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=[]\nret = 0\nfor i in range(n):\n a[i],b[i]=map(int,input().split())\nfor i in range(n):\n ret+=b[-1-i]-(ret+a[-1-i])%b[-1-i]\nprint(ret)', 'n=int(input())\na=[]\nb=[]\nret = 0\nfor i in range(n):\n s,t=map(int,input().split())\n a+=[s]\n b+=[t]\nfor i in range(n):\n ret+=(b[-1-i]-(ret+a[-1-i])%b[-1-i])%b[-1-i]\nprint(ret)']
['Runtime Error', 'Accepted']
['s069351557', 's450178349']
[3060.0, 11052.0]
[17.0, 380.0]
[155, 177]
p03821
u623687794
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=[0]*n;b=a[:]\nfor i in range(n):\n c,d=map(int,input().split())\n a[i]=c;b[i]=d\nans=0\nfor i in range(n)[::-1]:\n while a[i]%b[i]!=0:\n a[i]+=1\n ans+=1\nprint(ans)', 'n=int(input())\na=[0]*n;b=a[:]\nfor i in range(n):\n c,d=map(int,input().split())\n a[i]=c;b[i]=d\nans=0\nfor i in range(n)[::-1]:\n a[i]+=ans\n ans+=a[i]%b[i]\nprint(ans)\n', 'n=int(input())\na=[0]*n;b=a[:]\nfor i in range(n):\n c,d=map(int,input().split())\n a[i]=c;b[i]=d\nans=0\nfor i in range(n)[::-1]:\n a[i]+=ans\n if a[i]%b[i]==0:continue\n ans+=b[i]-(a[i]%b[i])\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s427198564', 's962063384', 's054676397']
[12916.0, 14836.0, 14836.0]
[2104.0, 347.0, 385.0]
[182, 167, 201]
p03821
u623814058
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=[map(int,input().split()) for _ in range(N)]\n\nr=0\nfor i in range(N-1,-1,-1):\n a,b=A[i]\n a+=r\n r+=-(-a//b)*A[i][1]-a\nprint(r)', 'N=int(input())\nA=[list(map(int,input().split())) for _ in range(N)]\n\nr=0\nfor i in range(N-1,-1,-1):\n a,b=A[i]\n a+=r\n r+=-(-a//b)*A[i][1]-a\nprint(r)']
['Runtime Error', 'Accepted']
['s120558419', 's987770244']
[52504.0, 27408.0]
[300.0, 261.0]
[150, 156]
p03821
u627417051
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())\ns = 0\nfor i in range(N):\n\tAB = list(map(int, input().split()))\n\tif AB[0] % AB[1] != 0:\n\t\ts += AB[1] - (AB[0] % AB[1])\nprint(s)', 'N = int(input())\nAL = []\nBL = []\n\nfor i in range(N):\n\tA, B =list(map(int,input().split()))\n\tAL.append(A)\n\tBL.append(B)\n\nc = 0\nfor i in range(N):\n\tx = BL[-1 -i] - ((AL[-1 -i] + c) % BL[-1 -i])\n\tif x == BL[-1 -i]:\n\t\tx = 0\n\tc += x\n\nprint(c)']
['Wrong Answer', 'Accepted']
['s247874083', 's565554518']
[3060.0, 11136.0]
[381.0, 404.0]
[143, 237]
p03821
u631914718
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\nfor i in range(n):\n\ta[i], b[i] = map(int, input().split())\n\nans = 0\nfor i in range(n)[::-1]:\n\ta_, b_ = a[i] + p, b[i]\n\tif a%b != 0:\n\t\tans += (a_ // b_ + 1) * b_ - a_\n\nprint(p)', 'n = int(input())\na, b = [], []\nfor i in range(n):\n\ta[i], b[i] = map(int, input().split())\n\nans = 0\nfor i in range(n)[::-1]:\n\ta_, b_ = a[i] + ans, b[i]\n\tif a_%b_ != 0:\n\t\tans += ((a_ // b_ + 1) * b_ - a_)\n\nprint(ans)\n', 'n = int(input())\na, b = [], []\nfor i in range(n):\n\ta[i], b[i] = map(int, input().split())\n\nans = 0\nfor i in range(n)[::-1]:\n\ta_, b_ = a[i] + ans, b[i]\n\tif a_%b_ != 0:\n\t\tans += ((a_ // b_ + 1) * b_ - a_)\n\nprint(p)\n', 'n = int(input())\na, b = [0]*n, [0]*n\nfor i in range(n):\n\ta[i], b[i] = map(int, input().split())\n\nans = 0\nfor i in range(n)[::-1]:\n\ta_, b_ = a[i] + p, b[i]\n\tif a_%b_ != 0:\n\t\tans += (a_ // b_ + 1) * b_ - a_\n\nprint(p)\n', 'n = int(input())\nab = []\nfor i in range(n):\n\ta, b = map(int, input().split())\n\tab.append((a, b))\n\nans = 0\nfor i in range(n)[::-1]:\n\ta, b = ab[i][0]+ans, ab[i][1]\n\tif a%b != 0:\n\t\tans += ((a//b + 1)*b - a)\n\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s239157077', 's405245376', 's545214903', 's698031805', 's486765814']
[10996.0, 3064.0, 3064.0, 10996.0, 16676.0]
[377.0, 23.0, 23.0, 369.0, 471.0]
[212, 215, 213, 215, 216]
p03821
u638033979
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 a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nprint(A)\nA.reverse()\nB.reverse()\n\nans = 0\nfor i in range(n):\n temp = B[i] - (A[i] % B[i])\n if temp == B[i]:\n temp = 0\n A = list(map(lambda x: x + temp, A))\n ans += temp\n\nprint(ans)', 'n = int(input())\nA = []\nB = []\n\nfor _ in range(n):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nA.reverse()\nB.reverse()\n\nans = 0\nfor i in range(n):\n temp = B[i] - ((A[i]+ans) % B[i])\n if temp == B[i]:\n temp = 0\n ans += temp\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s517210735', 's142863923']
[20772.0, 11052.0]
[2105.0, 351.0]
[318, 274]
p03821
u680851063
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=[],[]\n\nfor i in range(n):\n x,y = map(int,input().split())\n a.append(x)\n b.append(y)\n\na=list(reversed(a))\nb=list(reversed(b))\n\nOK=0\nfor i in range(n):\n A=a[i]+OK\n if A==b[i]:\n continue\n else:\n ok=b[i]-A%b[i]-A\n OK+=ok\n\nprint(OK)\n', 'n = int(input())\na,b=[],[]\n\nfor i in range(n):\n x,y = map(int,input().split())\n a.append(x)\n b.append(y)\n\na=list(reversed(a))\nb=list(reversed(b))\n\nOK=0\nfor i in range(n):\n A=a[i]+OK\n ok=b[i]-A%b[i]-A\n OK+=ok\n\nprint(OK)\n', 'n = int(input())\na,b=[],[]\n\nfor i in range(n):\n x,y = map(int,input().split())\n a.append(x)\n b.append(y)\nprint(a,b)\n\na=list(reversed(a))\nb=list(reversed(b))\nprint(a,b)\n\nOK=0\nfor i in range(n):\n A=a[i]+OK\n if A<b[i]:\n ok=b[i]-A\n elif A==b[i]:\n continue\n else:\n ok=-(-A//b[i])*b[i]-A\n OK+=ok\n\nprint(OK)', 'n = int(input())\na,b=[],[]\n\nfor i in range(n):\n x,y = map(int,input().split())\n a.append(x)\n b.append(y)\n\na=list(reversed(a))\nb=list(reversed(b))\n\nans=0\nOK=0\nfor i in range(n):\n tmp=a[i]+OK\n if tmp<=b[i] and tmp!=0:\n ok=b[i]-tmp\n elif tmp==0:\n continue\n else:\n ok=-(-tmp//b[i])*b[i]-tmp\n OK=OK+ok\n\nprint(OK)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s275697296', 's393621629', 's511171567', 's210821824']
[17736.0, 17620.0, 19976.0, 17684.0]
[257.0, 246.0, 313.0, 269.0]
[284, 237, 345, 352]
p03821
u724742135
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.
['from sys import stdin\nN = int(stdin.readline().rstrip())\nAB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\nans = 0\nfor i in range(N-1, -1, -1):\n \ta, b = AB[i]\n\tans += (b - (a + ans) % b) % b\nprint(ans)', 'from sys import stdin\nN = int(stdin.readline().rstrip())\nAB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\nans = 0\nfor i in range(N-1, -1, -1):\n a, b = AB[i]\n ans += (b - (a + ans) % b) % b\nprint(ans)']
['Runtime Error', 'Accepted']
['s430620686', 's395938768']
[2940.0, 27380.0]
[17.0, 236.0]
[227, 227]
p03821
u760771686
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())\nArray = []\nfor i in range(N):\n Array.append(tuple(map(int,input().split())))\n\nres = 0\nfor i in reversed(range(N)):\n a,b = Array[i]\n a+=res\n res+ = b-a%b\nprint(res)', 'N = int(input())\nArray = []\nfor i in range(N):\n Array.append(tuple(map(int,input().split())))\n\nres = 0\nfor i in reversed(range(N)):\n a,b = Array[i]\n a+=res\n res+= ((b-a%b)%b)\nprint(res)']
['Runtime Error', 'Accepted']
['s523128577', 's314496416']
[9032.0, 22572.0]
[26.0, 251.0]
[184, 189]
p03821
u760961723
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())\nAB = [list(map(int,input().split())) for _ in range(N)]\n\nans = 0\nfor i in range(N):\n if AB[-1][0]%AB[-1][1]==0:\n push = 0\n else:\n push = (AB[-1][1] - (AB[-1][0]%AB[-1][1]))\n ans += push\n for j in range(len(AB)):\n AB[j][0] += push\n print(i,ans,push,AB)\n AB.pop()\nprint(ans)', 'N =int(input())\na = [0] * N\nb = [0] * N\nfor i in range(N):\n A, B = map(int, input().split())\n a[i], b[i] = A, B\n \nans = 0\nfor i in range(N-1,-1,-1):\n if (a[i]+ans)%b[i]==0:\n push = 0\n else:\n push = b[i] - (a[i]+ans)%b[i]\n ans += push\nprint(ans)']
['Wrong Answer', 'Accepted']
['s499759128', 's634848369']
[113828.0, 10868.0]
[2106.0, 366.0]
[303, 262]
p03821
u761320129
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())\nAB = [tuple(map(int,input().split())) for i in range(N)]\nz = 0\nfor a,b in AB[::-1]:\n z += -(z+a)%b\n print(a,b,z)\nprint(z)\n', 'N = int(input())\nAB = [tuple(map(int,input().split())) for i in range(N)]\nz = 0\nfor a,b in AB[::-1]:\n z += -(z+a)%b\nprint(z)']
['Wrong Answer', 'Accepted']
['s210261507', 's321502451']
[20888.0, 17380.0]
[523.0, 336.0]
[145, 127]
p03821
u777283665
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 = np.zeros(n), np.zeros(n)\nfor i in range(n):\n a, b = map(int, input().split())\n A[i] = a\n B[i] = b', 'ans = 0\n\nfor i in range(10**9):\n ans += 1\n \nprint(ans', 'n = int(input())\nab = [map(int, input().split()) for _ in range(n)]\n\nans = 0\nfor a, b in reversed(ab):\n a += ans\n ans += (-a) % b\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s022148258', 's238690297', 's887686976']
[3060.0, 3064.0, 50420.0]
[17.0, 17.0, 407.0]
[130, 55, 147]
p03821
u838644735
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.
['def main():\n N, *AB = map(int, open(0).read().split())\n ans = 0\n for i in range(N - 1, 0, -1):\n a = AB[i * 2 + 0]\n b = AB[i * 2 + 1]\n ans += (b - a - ans) % b\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'def main():\n N, *AB = map(int, open(0).read().split())\n ans = 0\n for i in range(N - 1, -1, -1):\n a = AB[i * 2 + 0]\n b = AB[i * 2 + 1]\n ans += (b - a - ans) % b\n print(ans)\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s752732601', 's111681782']
[25124.0, 25124.0]
[102.0, 102.0]
[243, 244]
p03821
u905715926
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\nli = []\nfor i in range(n):\n a,b = map(int,input().split())\n li.append(map(int,input().split()))\nfor (a,b) in li[::-1]:\n ans += (b-((a+ans)%b))%b\nprint(ans)\n', 'n = int(input())\nans = 0\nli = []\nfor i in range(n):\n a,b = map(int,input().split())\n li.append((a,b))\nfor (a,b) in li[::-1]:\n ans += (b-((a+ans)%b))%b\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s352014053', 's023055237']
[26712.0, 17352.0]
[316.0, 350.0]
[190, 171]
p03821
u952708174
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.
['def a_multiple_array_(N, A, B):\n ans = 0 \n for k in range(N - 1, -1, -1): \n remainder = (A[k] + ans) % B[k] \n if remainder != 0: \n ans += B[k] - remainder\n return ans\n\nN = int(Input())\nA, B = [], []\nfor _ in range(N):\n a, b = [int(i) for i in input().split()]\n A.append(a)\n B.append(b)\nprint(a_multiple_array_(N, A, B))', 'def a_multiple_array_(N, A, B):\n ans = 0 \n for k in range(N - 1, -1, -1): \n remainder = (A[k] + ans) % B[k] \n if remainder != 0: \n ans += B[k] - remainder\n return ans\n\nN = int(input())\nA, B = [], []\nfor _ in range(N):\n a, b = [int(i) for i in input().split()]\n A.append(a)\n B.append(b)\nprint(a_multiple_array_(N, A, B))']
['Runtime Error', 'Accepted']
['s651071625', 's813750112']
[3064.0, 11096.0]
[17.0, 352.0]
[514, 514]
p03821
u966695411
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())\ncnt = 0\nL = [list(map(int, input().split())) for x in range(N)]\nfor a, b in L[::-1]:\n a += cnt\n if a < b && a != 0 : cnt += b - a\n if a > b: \n if a % b:\n cnt += b - a % b\n else:\n cnt += a % b\nprint(cnt)', 'N = int(input())\ncnt = 0\nL = [list(map(int, input().split())) for x in range(N)]\nfor a, b in L[::-1]:\n a += cnt\n if a < b and a != 0 : cnt += b - a\n if a > b: \n if a % b:\n cnt += b - a % b\n else:\n cnt += a % b\nprint(cnt)']
['Runtime Error', 'Accepted']
['s425593334', 's346591692']
[3064.0, 28276.0]
[29.0, 518.0]
[264, 265]
p03821
u987164499
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.
['from sys import stdin\nimport fractions\n\nn = int(stdin.readline().rstrip())\nli = [[0,0]]+[list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]\nli = li[::-1]\ncount = 0\nfor i in range(n):\n if li[i][0]%li[i][1] != 0:\n count += li[i][1]-li[i][0]%li[i][1]\n li[i+1][0] += count\n print(li)\nprint(count)', 'from sys import stdin\nimport fractions\n\nn = int(stdin.readline().rstrip())\nli = [[0,0]]+[list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]\nli = li[::-1]\ncount = 0\nfor i in range(n):\n count += -li[i][0]%li[i][1]\n li[i+1][0] += count\nprint(count)']
['Wrong Answer', 'Accepted']
['s707951362', 's291797653']
[138536.0, 33344.0]
[2106.0, 261.0]
[329, 268]
p03822
u163320134
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
['import sys\nsys.setrecurtionlimit(10**9)\n\ndef dfs(v):\n if len(g[v])==0:\n return 0\n dic={}\n for u in g[v]:\n tmp=dfs(u)\n if tmp not in dic:\n dic[tmp]=1\n else:\n dic[tmp]+=1\n pos=max(dic.keys())\n return pos+dic[pos]\n\nn=int(input())\ng=[[] for _ in range(n+1)]\nfor i in range(n-1):\n v=int(input())\n g[v].append(i+2)\nprint(dfs(1))', 'import sys\nsys.setrecursionlimit(10**9)\n\ndef dfs(v):\n if len(g[v])==0:\n return 0\n dic={}\n for u in g[v]:\n tmp=dfs(u)\n if tmp not in dic:\n dic[tmp]=1\n else:\n dic[tmp]+=1\n return min([pos+dic[pos] for pos in dic.keys()])\n\nn=int(input())\ng=[[] for _ in range(n+1)]\nfor i in range(n-1):\n v=int(input())\n g[v].append(i+2)\nprint(dfs(1))', 'import sys\nsys.setrecursionlimit(10**9)\n\ndef dfs(v):\n if len(g[v])==0:\n return 0\n dic={}\n for u in g[v]:\n tmp=dfs(u)\n if tmp not in dic:\n dic[tmp]=1\n else:\n dic[tmp]+=1\n arr=[]\n for pos in dic.keys():\n arr+=[pos]*dic[pos]\n arr=sorted(arr,reverse=True)\n return max([(i+1)+arr[i] for i in range(len(arr))])\n\nn=int(input())\ng=[[] for _ in range(n+1)]\nfor i in range(n-1):\n v=int(input())\n g[v].append(i+2)\nprint(dfs(1))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s161650181', 's255517482', 's112503071']
[3064.0, 159536.0, 159536.0]
[17.0, 591.0, 882.0]
[351, 358, 450]
p03822
u287132915
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
['import sys\nsys.setrecursionlimit(10**10)\n\nn = int(input())\ndic = {}\nfor i in range(n+1):\n if i <= 1: continue\n ai = int(input())\n if ai in dic:\n dic[ai].append(i)\n else:\n dic[ai] = [i]\n\ndef dfs(nxt):\n lst = []\n if nxt in dic:\n while dic[nxt] != []:\n child = dic[nxt].pop()\n tempmax = dfs(child)\n lst.append(tempmax)\n else:\n return 0\n lst.sort(reverse=True)\n for i in range(len(lst)):\n lst[i] += i+1\n return max(lst)\n\nans = dfs(1)\nprint(ans)', 'import sys\nsys.setrecursionlimit(10**9)\n\nn = int(input())\ndic = {}\nfor i in range(n+1):\n if i <= 1: continue\n ai = int(input())\n if ai in dic:\n dic[ai].append(i)\n else:\n dic[ai] = [i]\n\ndef dfs(node):\n lst = []\n if node in dic:\n while dic[node] != []:\n child = dic[node].pop()\n tempmax = dfs(child)\n lst.append(tempmax)\n else:\n return 0\n lst.sort(reverse=True)\n for i in range(len(lst)):\n lst[i] += i+1\n return max(lst)\n\nans = dfs(1)\nprint(ans)']
['Runtime Error', 'Accepted']
['s156707832', 's644919727']
[3064.0, 114076.0]
[18.0, 583.0]
[538, 541]
p03822
u334712262
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
["# -*- coding: utf-8 -*-\nimport resource\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000000)\ninput = sys.stdin.readline\nINF = 2**62-1\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, A):\n g = defaultdict(list)\n for i, a in enumerate(A):\n i += 2\n g[a].append(i)\n\n @lru_cache(maxsize=None)\n def f(u):\n d = [f(v) for v in g[u]]\n \n if not d:\n return 0\n\n d.sort()\n while len(d) > 1:\n l = d.pop()\n r = d.pop()\n d.append(max((l + 1, r)))\n return d[0] + 1\n return f(1)\n\n\ndef main():\n N = read_int()\n A = [read_int() for _ in range(N-1)]\n print(slv(N, A))\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport resource\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000000)\ninput = sys.stdin.readline\nINF = 2**62-1\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\ng = defaultdict(list)\n\n\ndef f(u):\n d = [f(v) for v in g[u]]\n if not d:\n return 0\n\n d.sort(reverse=True)\n while len(d) > 1:\n l = d.pop()\n r = d.pop()\n d.append(max((l + 1, r)))\n return d[0] + 1\n\n@mt\ndef slv(N, A):\n global g\n for i, a in enumerate(A):\n i += 2\n g[a].append(i)\n\n return f(1)\n\n\ndef main():\n N = read_int()\n A = [read_int() for _ in range(N-1)]\n print(slv(N, A))\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s338633423', 's692540965']
[417360.0, 239656.0]
[1162.0, 687.0]
[1614, 1541]
p03822
u425351967
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
['\n\ndepth=[-1]*N\nparent=[-1]*N\nchilds=[[] for i in range(N)]\n\ndepth[0]=0\ndef calc_depth(n):\n for child in childs[n]:\n depth[child]=depth[n]+1\n calc_depth(child)\n\ndef calc_height(n):\n if childs[n]==[]:\n return 0 \n childs_height=[]\n for child in childs[n]:\n childs_height.append(calc_height(child))\n childs_height.sort(reverse=True)\n heightlist=[childs_height[i]+i for i in range(len(childs_height))]\n return max(heightlist)+1\n\nfor i in range (1,N):\n a=int(input())-1\n childs[a].append(i)\n\nprint(calc_height(0))\n', 'import sys\nsys.setrecursionlimit(500000)\n\nN=int(input())\n\n\ndepth=[-1]*N\nparent=[-1]*N\nchilds=[[] for i in range(N)]\n\ndepth[0]=0\ndef calc_depth(n):\n for child in childs[n]:\n depth[child]=depth[n]+1\n calc_depth(child)\n\ndef calc_height(n):\n if childs[n]==[]:\n return 0 \n childs_height=[]\n for child in childs[n]:\n childs_height.append(calc_height(child))\n childs_height.sort(reverse=True)\n heightlist=[childs_height[i]+i for i in range(len(childs_height))]\n return max(heightlist)+1\n\nfor i in range (1,N):\n a=int(input())-1\n childs[a].append(i)\n\nprint(calc_height(0))\n']
['Runtime Error', 'Accepted']
['s348801004', 's877665730']
[3188.0, 139440.0]
[24.0, 865.0]
[563, 620]
p03822
u754022296
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
['import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\nimport heapq\n\ndef main():\n n = int(input())\n T = [[] for _ in range(n+1)]\n for i in range(1, n):\n T[int(input())].append(i)\n\n def dfs(v):\n if not T[v]:\n return 0\n L = []\n for i in T[v]:\n heapq.heappush(L, dfs(i)+1)\n temp = heapq.heappop(L)\n while L:\n temp = max(temp+1, heapq.heappop(L))\n return temp\n\n ans = dfs(1)\n print(ans)\n \nif __name__ == "__main__":\n main()', 'import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\nimport heapq\n\ndef main():\n n = int(input())\n T = [[] for _ in range(n)]\n for i in range(1, n):\n a = int(input())\n a -= 1\n T[a].append(i)\n\n def dfs(v):\n if not T[v]:\n return 0\n L = []\n for i in T[v]:\n heapq.heappush(L, dfs(i)+1)\n temp = heapq.heappop(L)\n while L:\n temp = max(temp+1, heapq.heappop(L))\n return temp\n\n ans = dfs(0)\n print(ans)\n \nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s475568412', 's183925110']
[594968.0, 131480.0]
[1431.0, 321.0]
[476, 495]
p03822
u844789719
2,000
262,144
N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement. After each match, there were always one winner and one loser. The last contestant standing was declared the champion. Figure: an example of a tournament For convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i. We will define the _depth_ of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants. Find the minimum possible depth of the tournament. The formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other: * Two predetermined contestants * One predetermined contestant and the winner of the j-th match, where j(j<i) was predetermined * The winner of the j-th match and the winner of the k-th match, where j and k (j,k<i, j ≠ k) were predetermined Such structure is valid structure of the tournament, if and only if no contestant who has already been defeated in a match will never play in a match, regardless of the outcome of the matches.
['import collections, sys\nsys.setrecursionlimit(10**5 + 5)\nN, *A = [int(_) for _ in open(0).read().split()]\nwin_lose = {i: set() for i in range(1, N + 1)}\nfor win, lose in zip(A, range(2, N + 1)):\n win_lose[win].add(lose)\n\nmemo = [-1] * (N + 1)\n\n\ndef rec(x):\n if memo[x] == -1:\n if win_lose[x] == set():\n memo[x] = 0\n else:\n memo[x] = max(a + b for a, b in zip(\n sorted(rec(y) for y in win_lose[x])[::-1], range(1, N + 1)))\n return memo[x]\n\n\nprint(rec(1))\nprint(memo)\n', 'N, *A = [int(_) for _ in open(0).read().split()]\nwin_lose = {i: set() for i in range(1, N + 1)}\nfor lose, win in enumerate(A):\n win_lose[win].add(lose + 2)\ns1 = [1]\ns2 = []\nwhile s1:\n a = s1.pop()\n s2 += [a]\n for b in win_lose[a]:\n s1 += [b]\ndp = [0] * (N + 1)\nfor x in s2[::-1]:\n if win_lose[x] == set():\n dp[x] = 0\n else:\n dp[x] = max(\n i + v + 1\n for i, v in enumerate(sorted(dp[y] for y in win_lose[x])[::-1]))\nprint(dp[1])\n']
['Runtime Error', 'Accepted']
['s759457794', 's237228626']
[159976.0, 52916.0]
[651.0, 435.0]
[526, 489]
p03830
u102960641
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import array\nimport textwrap\nimport math\nmod = 10 ** 9 + 7\ndef prime(end, typecode="L"):\n assert end > 1\n \n \n \n is_prime = array.array("B", (True for i in range(end)))\n \n is_prime[0] = False\n is_prime[1] = False\n \n primes = array.array(typecode)\n \n for i in range(2, end):\n if is_prime[i]: \n primes.append(i) \n for j in range(2 * i, end, i): \n is_prime[j] = False \n return primes.tolist()\n\nn = int(input())\na = prime(n)\nans = 1\nprint(a)\nfor i in a:\n b = 0\n c = i\n while c <= n:\n b += n // c\n c = c * i\n ans *= b + 1\n ans %= mod\nprint(ans)', 'import array\nimport textwrap\nimport math\nmod = 10 ** 9 + 7\ndef prime(end, typecode="L"):\n assert end > 1\n \n \n \n is_prime = array.array("B", (True for i in range(end)))\n \n is_prime[0] = False\n is_prime[1] = False\n \n primes = array.array(typecode)\n \n for i in range(2, end):\n if is_prime[i]: \n primes.append(i) \n for j in range(2 * i, end, i): \n is_prime[j] = False \n return primes.tolist()\n\nn = int(input())\na = prime(n)\nans = 1\nfor i in a:\n b = 0\n c = i\n while c <= n:\n b += n // c\n c = c * i\n b += 1\n ans *= b\n ans %= mod\nprint(ans)', 'import array\nimport textwrap\nimport math\nmod = 10 ** 9 + 7\ndef prime(end, typecode="L"):\n assert end > 1\n \n \n \n is_prime = array.array("B", (True for i in range(end)))\n \n is_prime[0] = False\n is_prime[1] = False\n \n primes = array.array(typecode)\n \n for i in range(2, end):\n if is_prime[i]: \n primes.append(i) \n for j in range(2 * i, end, i): \n is_prime[j] = False \n return primes.tolist()\n\nn = int(input())\na = prime(n+1)\nans = 1\nfor i in a:\n b = 0\n c = i\n while c <= n:\n b += n // c\n c = c * i\n b += 1\n ans *= b\n ans %= mod\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s052052726', 's125253858', 's115256704']
[3316.0, 3316.0, 3316.0]
[21.0, 21.0, 21.0]
[1003, 999, 1001]
p03830
u172386990
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['from collections import Counter\n\ndef factoring(N, factor_prev):\n \n \n factor_list = factor_prev\n N_dict = {}\n \n while True:\n if N == 1:\n return N_dict, factor_list\n \n for factor in factor_prev:\n if N % factor == 0:\n N = N // factor\n \n \n if factor in N_dict:\n N_dict[factor] += 1\n break\n \n else:\n N_dict[factor] = 1\n break\n \n \n if factor == factor_prev[-1] and N % factor != 0:\n factor_list.append(N)\n N_dict[N] = 1\n return N_dict, factor_list\n\ndef factorial_factoring(N):\n \n if N == 1:\n return {2: 0}\n \n else:\n factorial_factoring_dict = {}\n \n for i in range(2, N+1):\n if i == 2:\n N_dict = {2: 1}\n factor_prev = [2]\n factorial_factoring_dict = Counter(factorial_factoring_dict) + Counter(N_dict)\n else:\n N_dict, factor_prev = factoring(i, factor_prev)\n factorial_factoring_dict = Counter(factorial_factoring_dict) + Counter(N_dict)\n \n return(factorial_factoring_dict)\n \ndivisor = 1\nmod = 1000000007\nfor _, v in factorial_factoring(1000).items():\n divisor = divisor * (v + 1)\nprint(divisor % mod)', 'from collections import Counter\n\ndef factoring(N, factor_prev):\n \n \n factor_list = factor_prev\n N_dict = {}\n \n while True:\n if N == 1:\n return N_dict, factor_list\n \n for factor in factor_prev:\n if N % factor == 0:\n N = N // factor\n \n \n if factor in N_dict:\n N_dict[factor] += 1\n break\n \n else:\n N_dict[factor] = 1\n break\n \n \n if factor == factor_prev[-1] and N % factor != 0:\n factor_list.append(N)\n N_dict[N] = 1\n return N_dict, factor_list\n \ndef factorial_factoring(N):\n \n if N == 1:\n return {2: 0}\n \n else:\n factorial_factoring_dict = {}\n \n for i in range(2, N+1):\n if i == 2:\n N_dict = {2: 1}\n factor_prev = [2]\n factorial_factoring_dict = Counter(factorial_factoring_dict) + Counter(N_dict)\n else:\n N_dict, factor_prev = factoring(i, factor_prev)\n factorial_factoring_dict = Counter(factorial_factoring_dict) + Counter(N_dict)\n \n return(factorial_factoring_dict)\n \ndivisor = 1\nmod = 1000000007\nN = int(input())\nfor _, v in factorial_factoring(N).items():\n divisor = divisor * (v + 1)\nprint(divisor % mod)']
['Wrong Answer', 'Accepted']
['s466863861', 's849315539']
[3316.0, 3316.0]
[93.0, 92.0]
[1820, 1848]
p03830
u185325486
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\n\ndef isPrime(num):\n \n if num < 2: return False\n \n elif num == 2: return True\n \n elif num % 2 == 0: return False\n\n for i in range(3, math.floor(math.sqrt(num))+1, 2):\n if num % i == 0:\n return False\n return True\n\n \nN = int(input())\ntotal = 1\nmod = 10**9+7\nkaijo_ = math.factorial(N)\nprint(kaijo_)\nfor i in range(1,N+1):\n cnt = 0\n n = kaijo_\n if isPrime(i):\n while n % i == 0:\n n = n // i\n cnt += 1\n print(i,cnt)\n total = (total*(cnt+1))%mod\nprint(total)', 'import math\n\ndef isPrime(num):\n \n if num < 2: return False\n \n elif num == 2: return True\n \n elif num % 2 == 0: return False\n\n for i in range(3, math.floor(math.sqrt(num))+1, 2):\n if num % i == 0:\n return False\n return True\n\n \nN = int(input())\ntotal = 1\nmod = 10**9+7\nkaijo_ = math.factorial(N)\nfor i in range(1,N+1):\n cnt = 0\n n = kaijo_\n if isPrime(i):\n while n % i == 0:\n n = n // i\n cnt += 1\n total = (total*(cnt+1))%mod\nprint(total)']
['Wrong Answer', 'Accepted']
['s549029703', 's418073744']
[3064.0, 3064.0]
[41.0, 42.0]
[641, 606]
p03830
u196697332
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['N = int(input())\n\nfrom math import factorial\nnum_divide = factorial(N)\n\ndivided = False\n\nfactor_dict = {}\n\nfor i in range(2, N + 1):\n for t in range(2, i + 1):\n \n while i % t == 0:\n \n i /= t\n if t not in factor_dict:\n factor_dict[t] = 1\n else:\n factor_dict[t] += 1\n\n if i == 1:\n break\n\ncount = 1\nfor value in factor_dict.values():\n count *= value + 1\n \ncount % (10e9 + 7)', 'N = int(input())\n\nfrom math import factorial\nnum_divide = factorial(N)\n\ndivided = False\n\nfactor_dict = {}\n\nfor i in range(2, N + 1):\n for t in range(2, i + 1):\n \n while i % t == 0:\n \n i /= t\n if t not in factor_dict:\n factor_dict[t] = 1\n else:\n factor_dict[t] += 1\n\n if i == 1:\n break\n\ncount = 1\nfor value in factor_dict.values():\n count *= value + 1\n \nprint(count % (10e9 + 7))', 'N = int(input())\n\nfrom math import factorial\nnum_divide = factorial(N)\n\ndivided = False\n\nfactor_dict = {}\n\nfor i in range(2, N + 1):\n for t in range(2, i + 1):\n \n while i % t == 0:\n \n i /= t\n if t not in factor_dict:\n factor_dict[t] = 1\n else:\n factor_dict[t] += 1\n\n if i == 1:\n break\n\ncount = 1\nfor value in factor_dict.values():\n count *= value + 1\n \ncount % 10e9 + 7', 'N = int(input())\n\nfrom math import factorial\nnum_divide = factorial(N)\n\ndivided = False\n\nfactor_dict = {}\n\nfor i in range(2, N + 1):\n for t in range(2, i + 1):\n \n while i % t == 0:\n \n i /= t\n if t not in factor_dict:\n factor_dict[t] = 1\n else:\n factor_dict[t] += 1\n\n if i == 1:\n break\n\ncount = 1\nfor key, value in factor_dict.items():\n count *= value + 1\n count %= (1000000007)\n print(count)', 'N = int(input())\n\nfrom math import factorial\nnum_divide = factorial(N)\n\ndivided = False\n\nfactor_dict = {}\n\nfor i in range(2, N + 1):\n for t in range(2, i + 1):\n \n while i % t == 0:\n \n i /= t\n if t not in factor_dict:\n factor_dict[t] = 1\n else:\n factor_dict[t] += 1\n\n if i == 1:\n break\n\ncount = 1\nfor key, value in factor_dict.items():\n count *= value + 1\n count %= (1000000007)\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s224087380', 's229169626', 's825013908', 's967214944', 's234032592']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[46.0, 52.0, 47.0, 49.0, 45.0]
[482, 489, 480, 505, 501]
p03830
u271469978
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\n\ndef is_prime(n):\n if n == 2 or n == 3: return True\n if n%2 == 0 or n < 2: return False\n for i in range(3, int(n**0.5)+1, 2):\n if n%i == 0:\n return False\n return True\n\nN = int(input())\nans = 1\nfor p in [i for i in range(N) if is_prime(i)]:\n e = 0\n for n in range(1, N+1):\n while n % p == 0:\n n //= p\n e += 1\n ans *= e + 1\nans %= 10**9 + 7\nprint(ans)', 'import math\n\ndef is_prime(n):\n if n == 2 or n == 3: return True\n if n%2 == 0 or n < 2: return False\n for i in range(3, int(n**0.5)+1, 2):\n if n%i == 0:\n return False\n return True\n\nN = int(input())\nans = 1\nfor p in [i for i in range(N+1) if is_prime(i)]:\n e = 0\n for n in range(1, N+1):\n while n % p == 0:\n n //= p\n e += 1\n ans *= e + 1\nans %= 10**9 + 7\nprint(ans)']
['Wrong Answer', 'Accepted']
['s513576175', 's611643442']
[3188.0, 3188.0]
[38.0, 42.0]
[429, 431]
p03830
u334712262
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['N = int(input())\nNM = 1000\nfs = [list() for _ in range(NM+1)]\n\nfrom collections import Counter\nC = Count()\nfor i in range(2):\n if len(fs[i]) == 0:\n for j in range(i, NM+1, i):\n d = j\n while j % i == 0:\n fs[j].append(i)\n j //= i\n C[j] += 1\n\nM = 10**9 + 7\nans = 1\nfor v in C.values():\n ans = (ans * v) % M\nprint(ans)\n \n ', 'N = int(input())\nNM = 1000\nfs = [list() for _ in range(NM+1)]\n\nfrom collections import Counter\nC = Counter()\nfor i in range(2, N+1):\n if len(fs[i]) == 0:\n for j in range(i, N+1, i):\n d = j\n while j % i == 0:\n fs[j].append(i)\n j //= i\n C[i] += 1\n\nM = 10**9 + 7\nans = 1\nfor v in C.values():\n ans = (ans * (v+1)) % M\nprint(ans)\n \n \n']
['Runtime Error', 'Accepted']
['s713649283', 's040458590']
[3316.0, 3444.0]
[21.0, 24.0]
[362, 373]
p03830
u397496203
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import sys\ninput = sys.stdin.readline\n\n\n\ndef get_prime(N, prime):\n if N < 2:\n return {1: 1}\n\n i = 2\n while i * i <= N:\n while N % i == 0:\n if i in prime.keys():\n prime[i] += 1\n else:\n prime[i] = 1\n N = N // i\n i += 1\n if N != 1:\n prime[N] = 1\n return prime\n\n\ndef main():\n N = int(input().strip())\n div_table = [1] * (N + 1)\n MOD = 10**9 + 7\n ans = 0\n for i in range(2, N + 1):\n for j in range(i, N + 1, i):\n div_table[j] += 1\n\n prime = dict()\n prime[1] = 1\n\n for i in range(1, N + 1):\n if div_table[i] == 2:\n prime = get_prime(i, prime)\n ans = 1\n for k, v in prime:\n ans *= v\n ans %= MOD\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.readline\n\n\n\ndef get_prime(N):\n prime = dict()\n prime[1] = 1\n i = 2\n while i * i <= N:\n while N % i == 0:\n if i in prime.keys():\n prime[i] += 1\n else:\n prime[i] = 1\n N = N // i\n i += 1\n if N != 1:\n prime[N] = 1\n return prime\n\n\ndef main():\n N = int(input().strip())\n div_table = [0] * (N + 1)\n MOD = 10**9 + 7\n ans = 1\n for i in range(2, N + 1):\n for j in range(i, N + 1, i):\n div_table[j] += 1\n\n prime = dict()\n for i in range(2, N + 1):\n if div_table[i] == 1:\n prime[i] = 0\n\n for i in range(2, N + 1):\n _prime = get_prime(i)\n for k, v in _prime.items():\n if k == 1:\n continue\n prime[k] += v\n\n for k, v in prime.items():\n ans *= v + 1\n ans %= MOD\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Accepted']
['s574175484', 's440146194']
[9156.0, 9160.0]
[25.0, 30.0]
[861, 992]
p03830
u442810826
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['N = int(input())\n\nMOD = 10**9+7\n\nNN = [0 for _ in range(1001)]\nAA = [0 for _ in range(1001)]\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n # if NN[temp] != 0:\n # arr.append(NN[temp][0])\n # return arr\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nans = 1\nfor i in range(1, N+1):\n chin = factorization(i)\n # NN[i] = chin\n # print(chin)\n for x,y in chin:\n AA[x] += y\nfor i in range(2, N):\n if AA[i] > 0:\n ans *= (AA[i]+1) % MOD\n ans %= MOD\nprint(ans)\n', 'N = int(input())\n\nMOD = 10**9+7\n\nNN = [0 for _ in range(1001)]\nAA = [0 for _ in range(1001)]\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n # if NN[temp] != 0:\n # arr.append(NN[temp][0])\n # return arr\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nans = 1\nfor i in range(1, N+1):\n chin = factorization(i)\n # NN[i] = chin\n # print(chin)\n for x,y in chin:\n AA[x] += y\nfor i in range(2, N+1):\n if AA[i] > 0:\n # print(i, AA[i])\n ans *= (AA[i]+1) % MOD\n ans %= MOD\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s159160827', 's991646208']
[3188.0, 3188.0]
[22.0, 22.0]
[777, 805]
p03830
u489959379
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['MOD = 10 ** 9 + 7\nn = int(input())\n\nres = 1\nex = [0 for _ in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(2, i + 1):\n if i % j == 0:\n while i % j == 0:\n ex[j] += 1\n i //= j\n\nans = 1\nfor i in range(n):\n ans *= (ex[i] + 1)\n ans %= MOD\n\nprint(ans)\n', "import sys\n\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef prime_factorization(n):\n res = []\n for i in range(2, int(pow(n, 0.5)) + 1):\n if n % i == 0:\n ex = 0\n while n % i == 0:\n ex += 1\n n //= i\n res.append([i, ex])\n if n != 1:\n res.append([n, 1])\n\n return res\n\n\ndef resolve():\n n = int(input())\n\n P = [0] * 1000\n for i in range(1, n + 1):\n t = prime_factorization(i)\n for num, ex in t:\n P[num] += ex\n\n res = 1\n for p in P:\n res *= p + 1\n res % mod\n\n print(res % mod)\n\n\nif __name__ == '__main__':\n resolve()\n"]
['Wrong Answer', 'Accepted']
['s659255942', 's387287122']
[3064.0, 3064.0]
[69.0, 22.0]
[313, 714]
p03830
u506287026
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['from collections import Counter\n\n\ndef prime_factorize(n):\n p = 2\n fct = []\n \n while n >= p ** 2:\n if n % p == 0:\n \n \n n //= p\n fct.append(p)\n p += 1\n if n > 1:\n fct.append(n)\n return fct\n\n\nN = int(input())\nMOD = 1000000007\nnumbers = [prime_factorize(i) for i in range(1, N+1)]\n\ncount_numbers = Counter(numbers)\nans = 1\nfor n in count_numbers.values():\n ans *= ((n+1) % MOD)\n\nprint(ans % MOD)\n', 'from collections import Counter\n\n\ndef prime_factorize(n):\n p = 2\n fct = []\n \n \n\n \n \n \n \n \n while n >= p ** 2:\n while n % p == 0:\n n //= p\n fct.append(p)\n p += 1\n if n > 1:\n fct.append(n)\n return fct\n\n\nN = int(input())\nMOD = 1000000007\nnumbers = []\nfor i in range(1, N+1):\n numbers += prime_factorize(i)\n\ncount_numbers = Counter(numbers)\nans = 1\nfor n in count_numbers.values():\n ans *= ((n+1) % MOD)\n\nprint(ans % MOD)\n']
['Runtime Error', 'Accepted']
['s965866493', 's759736137']
[3444.0, 3316.0]
[25.0, 25.0]
[630, 946]
p03830
u532966492
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['n=int(input())\ndef soinsuu(a):\n yakusuu=[]\n j=2\n while(a>1):\n for i in range(j,int(a**0.5)+1):\n if a%i==0:\n yakusuu.append(i)\n a=a//i\n j=i\n break\n else:\n yakusuu.append(a)\n break\n yakusuu.sort()\n return yakusuu\nans=[]\nfrom collections import Counter\nfor i in range(2,n+1):\n ans+=soinsuu(i)\nans2=1\nmod=10**9+7\nfor i in Counter(ans).values():\n ans2=(ans2*(i+1))%mod\nans2', 'n=int(input())\ndef soinsuu(a):\n yakusuu=[]\n j=2\n while(a>1):\n for i in range(j,int(a**0.5)+1):\n if a%i==0:\n yakusuu.append(i)\n a=a//i\n j=i\n break\n else:\n yakusuu.append(a)\n break\n yakusuu.sort()\n return yakusuu\nans=[]\nfrom collections import Counter\nfor i in range(2,n+1):\n ans+=soinsuu(i)\nans2=1\nmod=10**9+7\nfor i in Counter(ans).values():\n ans2=(ans2*(i+1))%mod\nprint(ans2)']
['Wrong Answer', 'Accepted']
['s987833413', 's629538467']
[3316.0, 3316.0]
[26.0, 25.0]
[496, 503]
p03830
u543954314
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['from collections import defaultdict as dd\nprimes = dd(int)\nn = int(input())\nfor i in range(2,n+1):\n for j in range(2,int(i**.5)+1):\n while i%j == 0:\n i //= j\n primes[i] += 1\n if i > 1:\n primes[i] += 1\ncnt = 1\nmod = 10**9+7\nfor x in primes:\n cnt *= primes[x]+1\n cnt %= mod\nprint(cnt)', 'from collections import defaultdict as dd\nprimes = dd(int)\nn = int(input())\nfor i in range(2,n+1):\n for j in range(2,int(i**.5)+2):\n while i%j == 0:\n i //= j\n primes[j] += 1\n if i > 1:\n primes[i] += 1\ncnt = 1\nmod = 10**9+7\nfor x in primes:\n cnt *= primes[x]+1\n cnt %= mod\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s304652707', 's748825702']
[3444.0, 3316.0]
[28.0, 25.0]
[306, 302]
p03830
u556589653
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\ndef factorization(n):\n i = 2\n factors = []\n while i <= math.floor(math.sqrt(n)):\n print(i,n)\n if n%i == 0:\n factors.append(i)\n n //= i\n else:\n i += 1\n if n > 1:\n factors.append(n)\n return factors\nN = int(input())\nS = math.factorial(N)\nprint(S)\nprint(factorization(S))', 'def factorization(n):\n i = 2\n factors = []\n while i <= math.floor(n**0.5):\n if n%i == 0:\n factors.append(i)\n n //= i\n else:\n i += 1\n if n>1:\n factors.append(n)\n return factors\n\nN = int(input())\nls = []\nfor i in range(1,N+1):\n ls.extend(factorization(i))\nls.sort()\nans = 1\nnow = 1\nnow_2 = 0\nfor i in range(len(ls)):\n if i == 0:\n now_2 = ls[i]\n else:\n if ls[i] == now_2:\n now += 1\n else:\n ans *= (now+1)\n now = 1\n now_2 = ls[i]\nans *= (now+1)\nprint(ans%(10**9+7))', 'import math\n\ndef prime_factorization(n):\n i = 2\n factors = []\n while i <= math.floor(n**0.5):\n if n%i == 0:\n factors.append(i)\n n //= i\n else:\n i += 1\n if n>1:\n factors.append(n)\n return factors\nN = int(input())\nls = []\n\nif N == 1:\n print(1)\nelse:\n for i in range(1,N+1):\n \n ls.extend(prime_factorization(i))\n ls.sort()\n ans = 1 \n now = 1 \n now_2 = 0 \n for i in range(len(ls)):\n if i == 0:\n now_2 = ls[i]\n else:\n if ls[i] == now_2:\n now += 1\n else:\n ans *= (now+1)\n now = 1\n now_2 = ls[i]\n ans *= (now+1)\n print(ans%(10**9+7))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s077850578', 's918302046', 's291782052']
[3060.0, 3064.0, 3188.0]
[18.0, 17.0, 26.0]
[355, 617, 950]
p03830
u594244257
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['\nprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]\npi_100 = len(primes)\n\nmod = 10**9+7\n\nprime_vector = [0]*pi_100\n\nN = int(input())\nfor n in range(2,N+1):\n ret = (get_div_num(n)*ret)%mod\n \n for i in range(pi_100):\n while n % primes[i] == 0:\n prime_vector[i] += 1\n n = n//primes[i]\n\nret = 1\n\n\nfor i in range(pi_100):\n ret = (ret * (prime_vector[i]+1)) % mod\n\nprint(ret)', '\nprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]\npi_100 = len(primes)\n\nmod = 10**9+7\n\nprime_vector = [0]*pi_100\n\nN = int(input())\nfor n in range(2,N+1):\n \n for i in range(pi_100):\n while n % primes[i] == 0:\n prime_vector[i] += 1\n n = n//primes[i]\n\nret = 1\n\n\nfor i in range(pi_100):\n ret = (ret * (prime_vector[i]+1)) % mod\n\nprint(ret)']
['Runtime Error', 'Accepted']
['s419819824', 's402044539']
[3192.0, 3192.0]
[18.0, 40.0]
[1245, 1210]
p03830
u655975843
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import sys\nimport collections\nns = lambda: sys.stdin.readline().rstrip()\nni = lambda: int(ns())\nnm = lambda: map(int, sys.stdin.readline().split())\nnl = lambda: list(nm())\nnsl = lambda: map(str, sys.stdin.readline().split())\n\n\ndef era(n):\n data = [i for i in range(2, n + 1)]\n for d in data:\n data = [x for x in data if (x == d or x % d != 0)]\n data1 = []\n for d in data:\n data1.append([d, 1])\n return data1\n\n\nmod = 10 ** 9 + 7\nn = ni()\nlis = era(n)\nprint(lis)\nfor i in range(1, n + 1):\n for j in range(len(lis)):\n if i < lis[j][0]:\n break\n elif i % lis[j][0] == 0:\n count = 0\n m = i\n while(m % lis[j][0] == 0):\n m = m // lis[j][0]\n count += 1\n lis[j][1] += count\nans = 1\nfor i in range(len(lis)):\n ans *= lis[i][1]\n ans %= mod\nprint(ans)\n', 'import sys\nimport collections\nns = lambda: sys.stdin.readline().rstrip()\nni = lambda: int(ns())\nnm = lambda: map(int, sys.stdin.readline().split())\nnl = lambda: list(nm())\nnsl = lambda: map(str, sys.stdin.readline().split())\n\n\ndef era(n):\n data = [i for i in range(2, n + 1)]\n for d in data:\n data = [x for x in data if (x == d or x % d != 0)]\n data1 = []\n for d in data:\n data1.append([d, 1])\n return data1\n\n\nmod = 10 ** 9 + 7\nn = ni()\nlis = era(n)\nfor i in range(1, n + 1):\n for j in range(len(lis)):\n if i < lis[j][0]:\n break\n elif i % lis[j][0] == 0:\n count = 0\n m = i\n while(m % lis[j][0] == 0):\n m = m // lis[j][0]\n count += 1\n lis[j][1] += count\nans = 1\nfor i in range(len(lis)):\n ans *= lis[i][1]\n ans %= mod\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s279322647', 's303156343']
[3436.0, 3316.0]
[64.0, 65.0]
[876, 865]
p03830
u672220554
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['n = int(input())\nprime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]\nres = 1\n\nnprime = [p for p in prime if p <= n]\n\nfor p in prime:\n tempn = n\n tres = 1\n while tempn > p:\n tempn = tempn // p\n tres += tempn\n res *= tres\n if res > 10**9+7:\n res %= (10**9+7)\n\nprint(res)', 'n = int(input())\nprime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]\nres = 1\n\nnprime = [p for p in prime if p <= n]\n\nfor p in prime:\n tempn = n\n tres = 1\n while tempn >= p:\n tempn = tempn // p\n tres += tempn\n res *= tres\n if res > 10**9+7:\n res %= (10**9+7)\n\nprint(res)']
['Wrong Answer', 'Accepted']
['s366083277', 's164824381']
[3188.0, 3188.0]
[18.0, 18.0]
[1072, 1073]
p03830
u686036872
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\n\nN = int(input())\n\nans=0\nx = math.factorial(N)\nfor i in range(1, x//2+1):\n if N%i == 0:\n ans += 1\nprint(ans%(10**9+7))', 'import math\n\nN = int(input())\nx = math.factorial(N)\n\nans=1\nfor i in range(2, 1+int(x**(1/2))):\n cnt = 1\n while x%i == 0:\n x //= i\n cnt += 1\n ans *= cnt\n \nprint(ans%(10**9+7))', 'import math\n\nN = int(input())\nx = math.factorial(N)\n\nans = 1\ni = 2\nwhile i <= x:\n cnt = 1\n while x%i == 0:\n x //= i\n cnt += 1\n ans *= cnt\n i += 1\n \nprint(ans%(10**9+7))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s041438075', 's268386518', 's727608783']
[3060.0, 3060.0, 3060.0]
[2104.0, 17.0, 35.0]
[140, 212, 209]
p03830
u729133443
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\nn=math.factorial(int(input()))\na=i=1\nwhile i*i<=n:\n c=1\n while n%i==0:\n c+=1\n n//=i\n a*=c\n i+=1\nprint(a*2**(n!=1)%(10**9+7))', 'import math\nn=math.factorial(int(input()))\na,i=1,2\nwhile i*i<=n:\n c=1\n while n%i==0:\n c+=1\n n//=i\n a*=c\n i+=1\nprint(a*2**(n!=1)%(10**9+7))']
['Time Limit Exceeded', 'Accepted']
['s591412422', 's921014598']
[3060.0, 3060.0]
[2104.0, 35.0]
[146, 148]
p03830
u767664985
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['def factorization(n):\n res = []\n tmp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if tmp % i == 0:\n cnt = 0\n while tmp % i == 0:\n cnt += 1\n tmp //= i\n res.append([i, cnt])\n if tmp != 1:\n res.append([tmp, 1])\n if res == []:\n res.append([n, 1])\n return res\n\n\n\n\nN = int(input())\nMOD = 10**9 + 7\nfact = [[0, 0]]\n\nfor i in range(1, N+1):\n for fi in factorization(i):\n if fi[0] in fact[:][0]:\n fact[fi[0]][1] += fi[1]\n else:\n fact.append(fi)\n\nans = 1\nfor f in fact:\n ans *= (f[1] + 1)\n ans %= MOD\n\nprint(ans)\n', 'def factorization(n):\n res = []\n tmp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if tmp % i == 0:\n cnt = 0\n while tmp % i == 0:\n cnt += 1\n tmp //= i\n res.append([i, cnt])\n if tmp != 1:\n res.append([tmp, 1])\n if res == []:\n res.append([n, 1])\n return res\n\n\nN = int(input())\nMOD = 10**9 + 7\nfact = [[0, 0]]\n\nfor i in range(2, N+1):\n for fi in factorization(i):\n primes = [f[0] for f in fact]\n if fi[0] in primes:\n ind = primes.index(fi[0])\n fact[ind][1] += fi[1]\n else:\n fact.append(fi)\n\nans = 1\nfor f in fact:\n ans *= (f[1] + 1)\n ans %= MOD\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s734478919', 's798998344']
[3188.0, 3064.0]
[34.0, 34.0]
[652, 720]
p03830
u821588465
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['from math import factorial\nfrom collections import Counter\n\ndef prime_factorize(n):\n a = []\n while n%2 == 0:\n a.append(2)\n n //=2\n f = 3\n while f*f <= n:\n if n % f == 0:\n a.append(f)\n n //= f\n else:\n f += 2\n if n != 1:\n a.append(n)\n return a\n\ndef prime_factoring(n):\n from collections import Counter\n a = prime_factorize(n)\n return Counter(a)\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n //i:\n divisors.append(n//i)\n divisors.sort()\n return divisors\n\nn = int(input())\nmod = 10**9+7\nN =factorial(n)\nimport numpy as np\nList = np.array(list(prime_factoring(N).values()))+1\nList = List%mod\nprint(List)\nprint(np.prod(List)%mod)', 'from math import factorial\nN = factorial(int(input()))\nmod = 10**9 + 7\nans = 1\ni = 2\n\nwhile i*i <= N:\n cnt = 1\n while N%i == 0:\n cnt += 1\n N //= i\n ans *= cnt\n i += 1\n\nif N != 1:\n ans *= 2\nprint(int(ans%mod))\n']
['Wrong Answer', 'Accepted']
['s997404640', 's645576000']
[27356.0, 9184.0]
[131.0, 36.0]
[847, 238]
p03830
u859897687
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['n=int(input())\nans=1\nd=dict()\nfor i in range(1,n+1):\n k=1\n for j in range(1,i+1):\n if j==0 or j==i:\n continue\n if i%j==0:\n k=0\n if k:\n d[i]=0\n n0=n\n while n0:\n d[i]+=n0//i\n n0//=i\nfor i in d.values():\n ans*=i+1\nprint(ans)', 'n=int(input())\nd=dict()\nfor i in range(1,n+1):\n for j in range(1,i+1):\n while i%j==0:\n if j not in d:\n d[j]=1\n else:\n d[j]+=1\n i//=j\nans=1\nfor i in d.values():\n ans*=i+1\nprint(ans%1000000007)\n', 'n=int(input())\nd=dict()\nif n==1:\n print(1)\nelse:\n for i in range(2,n+1):\n for j in range(2,i+1):\n if i%j==0:\n if j not in d:\n d[i]=1\n else:\n d[i]+=1\n ans=1\n for i in d.values():\n ans*=i+1', 'n=int(input())\nd=dict()\nm=[2,3,5,7,11,13,17,19,23,29,31]\nfor i in m:\n d[i]=0\n nn=n\n while nn:\n d[i]+=nn//i\n nn//=i\nans=1\nfor i in dict.values():\n ans*=i+1\nprint(ans)\n', 'n=int(input())\nd=dict()\nfor i in range(1,n+1):\n for j in range(1,i+1):\n if j==1:\n continue\n while i%j==0:\n if j not in d:\n d[j]=1\n else:\n d[j]+=1\n i//=j\nans=1\nfor i in d.values():\n ans*=i+1\nprint(ans%1000000007)\n']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted']
['s086032081', 's149814557', 's633123376', 's951593801', 's038463490']
[3060.0, 2940.0, 3060.0, 3060.0, 3060.0]
[2104.0, 2104.0, 17.0, 17.0, 78.0]
[260, 226, 234, 176, 254]
p03830
u927534107
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['n=int(input())\nif n==1:print(1);exit()\nl=[i for i in range(1,n+1) if isPrime(i)==True]\nans=1\nINF=10**9+7\nfor i in l:\n tmp=0\n tmpi=i\n while n//i>0:\n tmp+=n//i\n i*=tmpi\n ans=(ans*(tmp+1))%INF\nprint(ans)', 'import math\ndef isPrime(num):\n if num < 2: return False\n elif num == 2: return True\n for i in range(2,math.floor(math.sqrt(num))+1):\n if num % i == 0:\n return False\n return True\n\nn=int(input())\nif n==1:print(1);exit()\nl=[i for i in range(1,n+1) if isPrime(i)==True]\nans=1\nINF=10**9+7\nfor i in l:\n tmp=0\n tmpi=i\n while n//i>0:\n tmp+=n//i\n i*=tmpi\n ans=(ans*(tmp+1))%INF\nprint(ans)']
['Runtime Error', 'Accepted']
['s521908071', 's855974095']
[3064.0, 3064.0]
[17.0, 19.0]
[226, 435]
p03830
u932465688
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['import math\nN = math.factorial(int(input()))\ni = 2\nans = 1\nM = 10**9+7\nwhile i**2 <= N:\n cnt=1\n while N%i == 0:\n cnt+=1\n N = N//i\n ans = ans*cnt\n i += 1\nif N != 1 :\n ans = 2\nprint(ans%M)', 'import math\nN = math.factorial(int(input()))\nans = 1\nM = 10**9+7\ncnt = 1\nfor i in range(2,1001):\n while N%i == 0:\n cnt += 1\n N = N//i\n ans = ans*cnt\n i += 1\n cnt = 1\nprint(ans%M)\n']
['Wrong Answer', 'Accepted']
['s142200993', 's357014525']
[3060.0, 3060.0]
[23.0, 34.0]
[201, 189]
p03830
u984351908
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['from math import factorial\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while i * i <= n:\n while n % i == 0:\n n /= i\n table.append(int(i))\n i += 1\n if n > 1:\n table.append(int(n))\n return table\n\ndef __main__():\n n = int(input())\n if n == 1:\n print(1)\n return\n i = 2\n prime_factors_count = [0] * 1001\n while i <= n:\n prime_factors = prime_decomposition(i)\n for j in range(prime_factors[-1] + 1):\n c = prime_factors.count(j)\n prime_factors_count[j] += c\n i += 1\n c = 1\n for i in range(1001):\n if prime_factors_count[i] != 0:\n c *= prime_factors_count[i] + 1\n print(c)\n print(c % (10**9 + 7))\n\n__main__()\n', 'from math import factorial\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while i * i <= n:\n while n % i == 0:\n n /= i\n table.append(int(i))\n i += 1\n if n > 1:\n table.append(int(n))\n return table\n\ndef __main__():\n n = int(input())\n if n == 1:\n print(1)\n return\n i = 2\n prime_factors_count = [0] * 1001\n while i <= n:\n prime_factors = prime_decomposition(i)\n for j in range(prime_factors[-1] + 1):\n c = prime_factors.count(j)\n prime_factors_count[j] += c\n i += 1\n c = 1\n for i in range(1001):\n if prime_factors_count[i] != 0:\n c *= prime_factors_count[i] + 1\n print(c % (10**9 + 7))\n\n__main__()\n']
['Wrong Answer', 'Accepted']
['s484606381', 's227022830']
[3064.0, 3064.0]
[46.0, 46.0]
[766, 753]
p03830
u998771223
2,000
262,144
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.
['S=input();\ns=[];\nx=[];\nX=[];\nso=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,83,89,97,101,107,109,113,127,131,137,139,149,151,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,809,811,821,823,827,829,839,853,857,859,863,877,881,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];\nans=1;\nfor h in range(S):\n Y=h+1;\n for i in so:\n j=0;\n while Y%i==0:\n Y=Y/i;\n s=s+[i];\n j+=1;\nfor i in so:\n x=x+[s.count(i)];\nX=[X+1 for X in x];\nprint(X);\nfor i in X:\n ans=ans*i;\nprint(ans%1000000007);', 'S=input();\ns=[];\nx=[];\nX=[];\nso=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,83,89,97,101,107,109,113,127,131,137,139,149,151,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,809,811,821,823,827,829,839,853,857,859,863,877,881,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];\nans=1;\nfor h in range(S):\n Y=h+1;\n for i in so:\n j=0;\n while Y%i==0:\n Y=Y/i;\n s=s+[i];\n j+=1;\nfor i in so:\n x=x+[s.count(i)];\nX=[X+1 for X in x];\nfor i in X:\n ans=ans*i;\nprint(ans%1000000007);', 'S=int(input());\ns=[];\nx=[];\nX=[];\nso=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];\nans=1;\nfor h in range(S):\n Y=h+1;\n for i in so:\n j=0;\n while Y%i==0:\n Y=Y/i;\n s=s+[i];\n j+=1;\nfor i in so:\n x=x+[s.count(i)];\nX=[X+1 for X in x];\nfor i in X:\n ans=ans*i;\nprint(ans%1000000007);']
['Runtime Error', 'Runtime Error', 'Accepted']
['s036298139', 's259048045', 's770043779']
[3316.0, 3192.0, 3192.0]
[18.0, 17.0, 69.0]
[920, 910, 934]
p03831
u085717502
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['a', '#!/usr/bin/env python\n# coding: utf-8\n\n# In[1]:\n\n\nN,A,B = map(int, input().split())\nX = list(map(int, input().split()))\n\n\n# In[2]:\n\n\nc = 0\nfor i in range(N-1):\n dist = X[i+1] - X[i]\n if dist*A > B:\n c += B\n else:\n c += dist*A\nprint(c)\n\n\n# In[ ]:\n\n\n\n\n']
['Runtime Error', 'Accepted']
['s086852997', 's723038449']
[9132.0, 19992.0]
[21.0, 84.0]
[1, 273]
p03831
u143509139
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['N, A, B = map(int, input().split())\nans = 0\nx = list(map(int, input().split()))\nfor i in range(len(x)-1):\n ans += min(B, x[i+1]-x[i])\nprint(ans)', 'N, A, B = map(int, input().split())\nans = 0\nx = list(map(int, input().split()))\nfor i in range(len(x)-1):\n ans += min(B, (x[i+1]-x[i]) * A)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s047788918', 's891688953']
[14480.0, 14228.0]
[91.0, 89.0]
[145, 151]
p03831
u225388820
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n,a,b=map(int,input().split())\nx=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n ans+=min(a*(x[i+1]-x[i]),b)', 'n,a,b=map(int,input().split())\nx=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n ans+=min(a*(x[i+1]-x[i]),b)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s876598244', 's305581759']
[14252.0, 14224.0]
[96.0, 95.0]
[120, 131]
p03831
u303059352
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n, a, b = map(int, input().split())\nans = 0\nfor i in range(n):\n v = int(input())\n if i:\n ans += min(a * (v - last), b);\n last = v\nprint(ans)', 'n, a, b = map(int, input().split())\nans = 0\nv = list(map(int, input().split()))\nfor i in range(n):\n if i:\n ans += min(a * (v[i] - last), b);\n last = v[i]\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s148910190', 's649097304']
[5028.0, 14484.0]
[23.0, 94.0]
[146, 170]
p03831
u414809621
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['\ndef main():\n [n,a,b] = list(map(int,input().split()))\n m = list(map(int,input().split()))\n cost = 0\n for i in range(1,n+1):\n cost += min(a*(m[i]-m[i-1]), b)\n print(cost)\n\n\nif __name__ == "__main__":\n main()', '\ndef main():\n [n,a,b] = list(map(int,input().split()))\n m = list(map(int,input().split()))\n cost = 0\n for i in range(1,n+1):\n cost += min(a*(m[i]-m[i-1]), b)\n print(cost)\n\n\nif __name__ == "__main__":\n import sys\n import os\n if len(sys.argv) > 1:\n if sys.argv[1] == "-d":\n filename = "input1.txt"\n fd = os.open(filename, os.O_RDONLY)\n os.dup2(fd, sys.stdin.fileno())\n main()\n else:\n main()', '\ndef main():\n [n, a, b] = list(map(int,input().split()))\n m = list(map(int,input().split()))\n cost = 0\n for i in range(1, n):\n cost += min([a*(m[i]-m[i-1]), b])\n print(cost)\n\n\nif __name__ == "__main__":\n import sys\n import os\n if len(sys.argv) > 1:\n if sys.argv[1] == "-d":\n filename = "input1.txt"\n fd = os.open(filename, os.O_RDONLY)\n os.dup2(fd, sys.stdin.fileno())\n main()\n else:\n main()']
['Runtime Error', 'Runtime Error', 'Accepted']
['s026328433', 's789049279', 's834428994']
[14224.0, 14252.0, 14224.0]
[104.0, 91.0, 97.0]
[232, 480, 483]
p03831
u512873531
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n, a, b = map(int, input().split())\nx = list(map(int, input().split()))\nans = 0\nfor i in range(1, n): ans+=min((x[i+1]-x[i])*a, b)\nprint(ans)', 'n, a, b = map(int, input().split())\nx = list(map(int, input().split()))\nans = 0\nfor i in range(1, n): ans+=min((x[i]-x[i-1])*a, b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s991749668', 's442144575']
[19952.0, 19976.0]
[83.0, 87.0]
[141, 141]
p03831
u536034761
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n, a, b = map(int, input().split())\nX = list(map(int, input().split()))\np = X[0]\nans = 0\nfor x in X[1:]:\n d = x - p\n if d * a <= b:\n ans += d\n else:\n ans += b\n p = x\nprint(ans)\n', 'n, a, b = map(int, input().split())\nX = list(map(int, input().split()))\np = X[0]\nans = 0\nfor x in X[1:]:\n d = x - p\n if d * a <= b:\n ans += d * a\n else:\n ans += b\n p = x\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s548391202', 's159475863']
[20116.0, 19992.0]
[76.0, 81.0]
[203, 207]
p03831
u595893956
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n,a,b=map(int,input().split())\nx=list(map(int,input().split()))\nret=0\nfor i in range(n-1):\n ret+=min(a*(x[i+1]-x[i]),b)\nprint ret', 'n,a,b=map(int,input().split())\nx=list(map(int,input().split()))\nret=0\nfor i in range(n-1):\n ret+=min(a*(x[i+1]-x[i]),b)\nprint(ret)\n']
['Runtime Error', 'Accepted']
['s113641923', 's548870124']
[2940.0, 14252.0]
[17.0, 90.0]
[130, 132]
p03831
u827202523
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n,a,b = map(int,input().split())\n\nnums=list(map(int,input().split))\ntmp=nums[0]\nans=0\nfor num in nums[1:]:\n if (nuw-tmp)*a<=b: \n ans+=(num-tmp!)*a\n else:\n ans+=b\n tmp=num\n\nprint(ans)', 'n,a,b = map(int,input().split())\n\nnums=list(map(int,input().split()))\ntmp=nums[0]\nans=0\nfor num in nums[1:]:\n if (num-tmp)*a<=b: \n ans+=(num-tmp)*a\n else:\n ans+=b\n tmp=num\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s541870207', 's485472821']
[2940.0, 14224.0]
[17.0, 75.0]
[191, 193]
p03831
u888092736
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['N, A, B = map(int, input().split())\nX = map(int, input().split())\ncurr = next(X)\nans = 0\nfor x in X:\n if (x - curr) * A <= B:\n ans += x - curr\n else:\n ans += B\n curr = x\nprint(ans)\n', 'import numpy as np\n\n\nN, A, B = map(int, input().split())\nX = np.array(list(map(int, input().split())))\nprint(np.minimum((X[1:] - X[:-1]) * A, B).sum())\n']
['Wrong Answer', 'Accepted']
['s484061022', 's675992452']
[17020.0, 37992.0]
[69.0, 142.0]
[204, 152]
p03831
u940061594
2,000
262,144
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the other towns. You have two ways to travel: * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction. * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered. Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.
['n, a, b = map(int,input().split())\nx = list(map(int,input().split()))\n\nd = []\nfor i in range(n-1):\n d.append(x[i+1]-x[i])\n\nf = 0\nfor i in range(n-1):\n if d[i]*a <= b:\n f += d*a\n else:\n f += b\n \nprint(f)', 'n, a, b = map(int,input().split())\nx = list(map(int,input().split()))\n\nd = []\nfor i in range(n-1):\n d.append(x[i+1]-x[i])\n\nf = 0\nfor i in range(n-1):\n if d[i]*a <= b:\n f += d[i]*a\n else:\n f += b\n \nprint(f)\n']
['Runtime Error', 'Accepted']
['s581843338', 's655212180']
[14252.0, 14252.0]
[86.0, 98.0]
[214, 218]
p03834
u000770457
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s = input()\n\ns.replace(","," ")\n\nprint(s)', 's=input()\n\nprint(s.replace(","," "))']
['Wrong Answer', 'Accepted']
['s801608766', 's644450493']
[2940.0, 2940.0]
[17.0, 17.0]
[41, 36]
p03834
u016323272
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['#ABC051.A\ns = input()\nans = s.replace(",","")\nprint(ans)', '#ABC051.A\ns = input()\nans = s.replace(","," ")\nprint(ans)']
['Wrong Answer', 'Accepted']
['s630944917', 's605936435']
[2940.0, 2940.0]
[18.0, 17.0]
[56, 57]
p03834
u019566983
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["print(*input().split(',')", "print(*input().split(','))"]
['Runtime Error', 'Accepted']
['s111389458', 's467107536']
[2940.0, 2940.0]
[17.0, 17.0]
[25, 26]
p03834
u019584841
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['a,b,c=input().split(,)\nprint(a+" "+b+" "+c)', "s = input().split(',')\ns = ' '.join(s)\nprint(s)\n"]
['Runtime Error', 'Accepted']
['s166340503', 's428352451']
[2940.0, 2940.0]
[17.0, 17.0]
[43, 48]
p03834
u021114240
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s=input()\na=list(input.split(","))\nprint(*a)', 's=input()\na=list(s.split(","))\nprint(*a)']
['Runtime Error', 'Accepted']
['s915570087', 's595585561']
[3064.0, 2940.0]
[18.0, 17.0]
[44, 40]
p03834
u027929618
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s = input().split(",")\nprint(" ".join(s))⏎', 's = input().split(",")\nprint(" ".join(s))']
['Runtime Error', 'Accepted']
['s185334259', 's235992925']
[2940.0, 2940.0]
[17.0, 17.0]
[44, 41]
p03834
u031852574
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['x,y,z = map(int,input().split())\nprint(z,x,y)', 'a,b,c = input().split(",")\nprint(a,b,c)\n']
['Runtime Error', 'Accepted']
['s948151074', 's652185755']
[8980.0, 8872.0]
[26.0, 31.0]
[45, 40]
p03834
u045408189
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['a,b,c=input().split(,)\nprint(a,b,c)', 'a,b,c=input().split(,)\nprint(a,b,c)', "a,b,c=input().split(',')\nprint(a,b,c)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s450527686', 's730755335', 's008509336']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[35, 35, 37]
p03834
u045953894
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["a,b,c = input().split(',')\n\nprint(a,b,c,sep='')", "s=input()\ns=s.replace(',','')\nprint(s)", "a,b,c = input().split(',')\n\nprint(a,b,c,sep=' ')\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s682004670', 's787587393', 's140743843']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[47, 38, 49]
p03834
u046313635
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s = input().split(",")\n\nprint(s)', 's = input().split()\n\ns[6], s[14] = ""\n\nprint(s)', 'a, b, c = input().split(",")\n\nprint(a,b,c)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s472683899', 's644378835', 's050908631']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[32, 47, 42]
p03834
u055941944
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['sx,sy,tx,ty=map(int,input().split())\nx=tx-sx\ny=ty-sy\nans=""\n\nans="U"*x + "R"*y\nans+="D"*x + "L"*y\n\nans+="L"+"U"*(x+1)+"R"*(x+1)+"D"\nans+="R"+"D"*(x+1)+"L"*(y+1)+"U"\nprint(ans)\n', '# -*- coding utf-8 -*-\n\na,b,c = map(str,input().split(","))\n\nprint(a,b,c)\n']
['Runtime Error', 'Accepted']
['s650737546', 's843974257']
[3064.0, 2940.0]
[17.0, 18.0]
[176, 74]
p03834
u056599756
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s=input()\n\nss=s.replace(",", " ")\n\nss', 's=input()\nss=s.replace(",", " ")\nprint(ss)']
['Wrong Answer', 'Accepted']
['s695398534', 's930620634']
[2940.0, 2940.0]
[17.0, 17.0]
[37, 42]
p03834
u072717685
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s = input()\nprint(s)\ns2 = " ".join(s.split(","))\nprint(s2)', 's = input()\ns2 = " ".join(s.split(","))\nprint(s2)']
['Wrong Answer', 'Accepted']
['s935560597', 's886019329']
[2940.0, 2940.0]
[17.0, 17.0]
[58, 49]
p03834
u073251521
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['x, y, z = input.split(",")\n\nprint(x, y, z)', 'x, y, z = input().split(",")\nprint(x, y, z)']
['Runtime Error', 'Accepted']
['s450921071', 's556423343']
[8968.0, 9024.0]
[24.0, 25.0]
[42, 43]
p03834
u074338678
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['print(*input().split())\n', 's = input()\nprint(s, s.replace(",", " "))', 'a,b,c = input().split(",")\nprint(a,b,c)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s530951646', 's725252489', 's647024431']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[24, 41, 39]
p03834
u076764813
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['S=list(input())\n\nfor i in range(len(S)):\n if S[i] == ",":\n S[i] = " "\n\nprint(*S)\n', 'S=list(input())\n\nfor i in range(len(S)):\n if S[i] == ",":\n S[i] = " "\n\nprint(*S, sep="")\n']
['Wrong Answer', 'Accepted']
['s784540874', 's275677260']
[2940.0, 2940.0]
[17.0, 17.0]
[91, 99]
p03834
u088488125
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s=input()\nprint(s.replace("," " ")', 's=input()\nprint(s.replace(",", " ")\n', 's=input()\nprint(s.replace(",", " "))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s526233991', 's805061295', 's891296135']
[8952.0, 8996.0, 8980.0]
[27.0, 21.0, 25.0]
[34, 36, 37]
p03834
u089142196
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['s=input()\n\nprint(s[0:5],s[7:14],s[15:20])', 's=input()\n\nprint(s[0:5],s[6:13],s[14:21])']
['Wrong Answer', 'Accepted']
['s212599849', 's854390957']
[2940.0, 2940.0]
[17.0, 18.0]
[41, 41]
p03834
u089230684
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['word = "Hello,world ,in my program"\ny = word.replace(\',\' , \' \')\nprint(y)\n', 's=str(input())\ncadena=""\nfor i in range(len(s)):\n if i==5 or i==13:\n cadena+=" "\n else:\n cadena+=s[i]\nprint(cadena)']
['Wrong Answer', 'Accepted']
['s702017168', 's952555968']
[3060.0, 2940.0]
[19.0, 17.0]
[73, 123]
p03834
u093033848
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["s = input()\n\nprint(s.replace(' ', ','))", "s = input()\n\nprint(s.replace(',', ' '))"]
['Wrong Answer', 'Accepted']
['s505691119', 's950976569']
[2940.0, 2940.0]
[17.0, 17.0]
[39, 39]
p03834
u093500767
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['a = input().str()\n\na = a.replace(",", " ")\n\nprint(a)', 'a = input()\na = a.replace(",", " ")\nprint(a)']
['Runtime Error', 'Accepted']
['s983808922', 's088082597']
[2940.0, 2940.0]
[17.0, 18.0]
[52, 44]
p03834
u102242691
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['\nl = list(map(int,input().split()))\n\ncount = 0\n\nfor x in range(l[0] + 1):\n for y in range(l[0] + 1):\n for z in range(l[0] + 1):\n if x + y + z == l[1]:\n count += 1\n print(x,y,z)\n\nprint(count)\n\n', '\na,b,c = input().split(",")\nprint(a + " " + b + " " + c)\n']
['Runtime Error', 'Accepted']
['s417216376', 's366355138']
[2940.0, 2940.0]
[17.0, 17.0]
[243, 57]
p03834
u108377418
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["\n#include <string>\nusing namespace std;\n\nint main(){\n string input_str;\n\n cin >> input_str;\n\n input_str[5] = ' ', input_str[13] = '';\n\n cout << input_str << endl;\n\n return 0;\n}\n", "\n#include <string>\nusing namespace std;\n\nint main(){\n string input_str;\n\n cin >> input_str;\n\n for (int i=0; i < input_str.size(); i++){\n if (input_str[i] == ',') input_str[i] = ' ';\n }\n\n cout << input_str << endl;\n\n return 0;\n}\n", 'def main():\n s = input()\n print(s.replace(",", " "))\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s305161926', 's690117356', 's861309397']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[211, 272, 98]
p03834
u111365959
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['k,s = input().split()\na = 0\nn = 0\nwhile a <= k:\n b = 0\n while b <= k:\n c = 0\n while c <= k:\n if (a+b+c) == s:\n n += 1\n c += 1\n b += 1\n a += 1\nprint(n)\n', 'k,s = [int(x) for x in input().split()]\nans = 0\nfor x in range(k+1):\n for y in range(x, k+1):\n z = s - x - y\n if x <= y <= z <= k:\n ans += [ None, 1, 3, 6 ][ len(set([ x, y, z ])) ]', 'k,s = [int(x) for x in input().split()]\na = 0\nn = 0\nwhile a <= k:\n b = 0\n while b <= k:\n z = s-a-b\n if 0<=z and z <= k:\n n += 1\n b += 1\n a += 1\nprint(n)\n', "print(input().replace(',',' '))"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s207929744', 's324554109', 's335180584', 's752522832']
[2940.0, 3060.0, 2940.0, 2940.0]
[18.0, 18.0, 19.0, 17.0]
[180, 209, 170, 31]
p03834
u113255362
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
['S= input()\nres1 = S[0:4]\nres2 = S[6:12]\nres3 = S[14:19]\nprint(res1,res2,res3)', 'S= input()\nres1 = S[0:5]\nres2 = S[6:13]\nres3 = S[14:19]\nprint(res1,res2,res3)']
['Wrong Answer', 'Accepted']
['s975436728', 's935792132']
[9040.0, 9100.0]
[26.0, 31.0]
[77, 77]
p03834
u113971909
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["print(input().replace(',',' ')", "print(input().replace(',',' '))"]
['Runtime Error', 'Accepted']
['s069439518', 's435913740']
[2940.0, 2940.0]
[17.0, 17.0]
[30, 31]
p03834
u115877451
2,000
262,144
As a New Year's gift, Dolphin received a string s of length 19. The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`. Dolphin wants to convert the comma-separated string s into a space-separated string. Write a program to perform the conversion for him.
["a=input()\nprint(a.replace(',',' ')", "a=input()\nprint(a.replace(',',' '))"]
['Runtime Error', 'Accepted']
['s013088718', 's085657447']
[2940.0, 2940.0]
[17.0, 17.0]
[34, 35]