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
p03328
u546853743
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nk = b-a\nal = (1+k)*k / 2\nprint(al-b)', 'a,b=map(int,input().split())\nk = b-a\nal = 0\nfor i in range(k):\n al += i\nprint(al-b)', '\na,b=map(int,input().split())\nk = b-a\nal = 0\nfor i in range(k):\n al += i\nprint(b-al)', 'a,b=map(int,input().split())\nk = b-a\nal = (1+k)*k\nal //= 2\nprint(al-b)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s404759308', 's501241014', 's883749522', 's652003053']
[9160.0, 9016.0, 8960.0, 9084.0]
[29.0, 28.0, 27.0, 27.0]
[65, 86, 87, 70]
p03328
u551692187
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int, input().split())\nprint(b - sum(range(b - a + 1)))\n', 'a,b = map(int, input().split())\nprint(sum(range(b - a + 1)) - b)\n']
['Wrong Answer', 'Accepted']
['s605079867', 's356657853']
[2940.0, 2940.0]
[17.0, 17.0]
[65, 65]
p03328
u556589653
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['N = int(input())\nnow = 0\nans = 0\nfor i in range(1,N+1):\n if i%2 == 0:\n continue\n else:\n for j in range(1,i+1):\n if i%j == 0:\n now += 1\n if now == 8:\n ans += 1\n now = 0\nprint(ans)', 'a,b = map(int,input().split())\nx = 1\ny = 3\nfor i in range(10**5):\n if x-a == y-b:\n print(x-a)\n break\n else:\n x += i+2\n y += i+3']
['Runtime Error', 'Accepted']
['s575368965', 's918650779']
[3060.0, 3064.0]
[17.0, 18.0]
[249, 161]
p03328
u559823804
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nn=b-a\nsumn=n*(1+n)//2\nprint(sumn)\n\nprint(sumn-b)\n', 'a,b=map(int,input().split())\nn=b-a\nsumn=(n*(n+1))//2\n\nprint(sumn-b)\n']
['Wrong Answer', 'Accepted']
['s763443705', 's702432081']
[2940.0, 2940.0]
[17.0, 17.0]
[78, 68]
p03328
u578501242
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['10 11a = [int(i) for i in input().split()]\nb=a[0]\nc=a[1]\nx=c-b\nprint(round((x+1)*x/2)-c)', 'a = [int(i) for i in input().split()]\nb=a[0]\nc=a[1]\nx=c-b\nprint(round((x+1)*x/2)-c)']
['Runtime Error', 'Accepted']
['s387165270', 's661604057']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 83]
p03328
u583010173
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = [int(x) for x in input().split()]\nn = b - a\nwa = sum(range(n))\nprint(wa - b)', 'a, b = [int(x) for x in input().split()]\nn = b - a\nwa = sum(range(n+1))\nprint(wa - b)']
['Wrong Answer', 'Accepted']
['s951575292', 's658237497']
[3064.0, 2940.0]
[17.0, 17.0]
[83, 85]
p03328
u589726284
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\ndp = []\ndp[0] = 1\ndp[1] = 2\nfor i in range(1000):\n dp[i] = dp[0] + dp[1+i]\n print(dp[i])', 'a, b = map(int, input().split())\nprint(round((b-a)*(b-a+1)/2-b))\n']
['Runtime Error', 'Accepted']
['s518747592', 's554719044']
[2940.0, 3060.0]
[17.0, 18.0]
[123, 65]
p03328
u594956556
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nc=b-a\nx=c*(c+1)/2 - b\nprint(str(x))', 'a,b=map(int,input().split())\nc=b-a\nx=c*(c+1)/2 - b\nprint(x)\n', 'a,b=map(int,input().split())\nc=b-a\ny=0\nfor i in range(b-a):\n y+=i\nx=y-a\nprint(x)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s272240356', 's820416453', 's068728220']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 18.0]
[64, 60, 82]
p03328
u598009172
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=(int(i) for i in input().split())\nc = b-a\n\nfor s in range(c):\n sum += s+1\n\nprint(sum-b)', 'a,b=(int(i) for i in input().split())\nc = b - a\nzako = 0\nfor d in range(c):\n zako += d + 1\nprint(zako-b)']
['Runtime Error', 'Accepted']
['s312825362', 's871272553']
[2940.0, 2940.0]
[17.0, 17.0]
[94, 107]
p03328
u602677143
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nls = [1]\nfor i in range(999):\n ls.append(ls[i]+i+2)\nfor i in range(len(ls)):\n if ls[i] > a:\n print(abs(ls[i+1]-a))\n break', 'a,b = map(int,input().split())\nls = [1]\nfor i in range(999):\n ls.append(ls[i]+i+2)\nfor i in range(len(ls)):\n if ls[i] > a:\n print(abs(ls[i+1]-a))\n break', 'a,b = map(int,input().split())\nls = [1]\nfor i in range(998):\n ls.append(ls[i]+i+2)\n \nt = b-a\n\nfor i in range(len(ls)-1):\n if (ls[i+1] - ls[i]) == t:\n print(ls[i]-a)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s457823109', 's860113647', 's040168799']
[3060.0, 3060.0, 3060.0]
[17.0, 20.0, 18.0]
[172, 172, 180]
p03328
u602802430
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['# coding:utf-8\na, b= map(int, input().split())\n\ndiff = b-a\nd = 0\nfor i in enumerate(diff+1, 1):\n d += i \n\nprint(abs(d-a)\n \n', '# coding:utf-8\na, b= map(int, input().split())\n\ndiff = b-a\nd = 0\nfor i in range(1, diff):\n d += int(i)\n\nprint (d)\nprint(abs(d-a))', '# coding:utf-8\na, b= map(int, input().split())\n\ndiff = b-a\nd = 0\nfor i in range(1, diff):\n d += int(i)\nprint(abs(d-a))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s352497583', 's850141051', 's188924397']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[129, 132, 121]
p03328
u619458041
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
["import sys\n\ndef main():\n input = sys.stdin.readline\n a, b = map(int, input().split())\n diff = b - a\n ah = sum([a for a in range(1, diff+1)])\n print(ah-a)\n\n\nif __name__ == '__main__':\n main()", "import sys\n\ndef main():\n input = sys.stdin.readline\n a, b = map(int, input().split())\n diff = b - a\n ah = sum([i for i in range(1, diff)])\n print(ah-a)\n\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s754446865', 's013789140']
[3060.0, 3060.0]
[18.0, 17.0]
[196, 194]
p03328
u620480037
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['\nN=int(input())\n\nif N>=1000:\n print("ABD")\nelse:\n print("ABC")', 'a,b=map(int,input().split())\nN=b-a\nsekisetu=0\nfor i in range(N+1):\n sekisetu+=i\nprint(sekisetu-b)']
['Runtime Error', 'Accepted']
['s327566916', 's121354719']
[2940.0, 2940.0]
[18.0, 17.0]
[68, 100]
p03328
u625963200
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\n\nprint((b-a)*(b-a+1)/2-b)', 'a,b=map(int,input().split())\n\nprint(int((b-a)*(b-a+1)/2-b))']
['Wrong Answer', 'Accepted']
['s924360131', 's010900827']
[3188.0, 2940.0]
[18.0, 17.0]
[54, 59]
p03328
u626228246
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nsum = 0\nfor i in range(1,1000):\n if a > sum:\n sum += i\n else:\n print(sum - a)', 'import sys\na,b = map(int,input().split())\nsum = 0\nfor i in range(1,1000):\nwhile(a > sum):\n\ti = 1\n sum += 1\n i += 1\nprint(sum-a)\n\n', 'a,b = map(int,input().split())\nans = 0\nN = b - a\nfor i in range(1,N):\n ans += i\nprint(ans - a)\n ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s579698469', 's730992679', 's196828031']
[9156.0, 8876.0, 9160.0]
[32.0, 28.0, 23.0]
[116, 135, 98]
p03328
u627417051
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = list(map(int, input()))\nanswer = (b - a) * (b - a + 1) / 2 - b\nprint(int(answer))\n', 'a, b = list(map(int, input().split()))\nanswer = (b - a) * (b - a + 1) / 2 - b\nprint(int(answer))\n']
['Runtime Error', 'Accepted']
['s337385384', 's402241484']
[2940.0, 2940.0]
[17.0, 18.0]
[89, 97]
p03328
u642823003
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\ntower = []\ntmp = 0\n\nfor i in range(1, 1000):\n tmp += 1\n tower.append(tmp)\n \ncount = a - b\n\nprint(tower[count - 1] - b)', 'a, b = map(int, input().split())\ntower = []\ntmp = 0\n\nfor i in range(1, 1000):\n tmp += 1\n tower.append(tmp)\n \ncount = b - a\n\nprint(tower[count - 1] - b)\n', 'a, b = map(int, input().split())\ntower = []\ntmp = 0\n\nfor i in range(1, 1000):\n tmp += i\n tower.append(tmp)\n \ncount = b - a\n\nprint(tower[count - 1] - b)\n', 'a, b = map(int, input().split())\ntower = []\ntmp = 0\n\nfor i in range(1, 1000):\n tmp += i\n tower.append(tmp)\n \ncount = b - a\n\nprint(tower[count - 1] - b)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s372395354', 's484667945', 's932606162', 's777013369']
[3064.0, 2940.0, 2940.0, 3060.0]
[19.0, 17.0, 17.0, 17.0]
[162, 163, 163, 161]
p03328
u652656291
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nn =\u3000b-a\nprint(n*(n+1)/2-b)\n', 'a,b = map(int,input().split())\nfor i in range (1,1000):\n n = i(i+1)//2\n if b - a == i:\n print(n-a)\n ', 'a,b = map(int,input().split())\nn = b-a\ntower = ((n+1)*n)/2\nprint(tower-b)\n', 'a,b = map(int,input().split())\nn =\u3000b-a\nprint(n*(n+1)//2-b)\n', 'a,b = map(int,input().split())\nn = b-a\ntower = ((n+1)*n)/2\nprint(int(tower-b))\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s069606844', 's199606611', 's544054749', 's864676965', 's697345476']
[3064.0, 2940.0, 2940.0, 3188.0, 2940.0]
[19.0, 18.0, 17.0, 18.0, 17.0]
[60, 106, 74, 61, 79]
p03328
u657913472
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split());print((b-a)**2-a-b)', 'a,b=map(int,input().split());a-=b;print(~-a*a//2-b)']
['Wrong Answer', 'Accepted']
['s795219525', 's330754662']
[2940.0, 2940.0]
[18.0, 18.0]
[48, 51]
p03328
u659100741
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['package main\n\nimport (\n "fmt"\n "math/rand"\n "time"\n)\n\nfunc swap(data []float64, i,', 'a, b = map(int, input().split())\n\nnum = b - a\nh = 0\nfor i in range(num):\n h += i\n\nprint(h-a)']
['Runtime Error', 'Accepted']
['s501159376', 's687042813']
[2940.0, 2940.0]
[20.0, 17.0]
[91, 95]
p03328
u659640418
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int, input().split())\nprint(b*(b+1)/2-b)', 'a,b=map(int, input().split())\nprint(b*(b+1)/2-(b-a))', 'a,b=map(int, input().split())\nprint(sum([1:b])-(b-a))', 'a,b=map(int, input().split())\nprint(int((b-a)*(b-a+1)/2-b))']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s155052050', 's175049707', 's264807561', 's719689587']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[48, 52, 53, 59]
p03328
u663014688
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['def delta2lower_height(arg_num):\n height = 0\n for i in range(1, arg_num):\n height += i\n return height\n\ninput_line = input().split()\n\nhigher_margin = int(input_line[0])\nlower_margin = int(input_line[1])\n\ndelta = higher_margin - lower_margin\n\nlower_height = delta2lower_height(delta)\nsnow_height = lower_height - lower_margin\n\nprint(str(snow_height))', 'def delta2lower_height(arg_num):\n height = 0\n for i in range(1, arg_num):\n height += i\n return height\n\n\nlower_margin, higher_margin = map(int, input().split())\n\ndelta = higher_margin - lower_margin\n\nlower_height = delta2lower_height(delta)\nsnow_height = lower_height - lower_margin\n\nprint(snow_height)']
['Wrong Answer', 'Accepted']
['s554664751', 's934292021']
[3060.0, 2940.0]
[17.0, 17.0]
[364, 317]
p03328
u673173160
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nh = 0\nfor i in range(1, 1000):\n h += i\n ans = (2*h + i+1 - a - b)/2\n if ans > 0:\n print(ans)\n exit()', 'a, b = map(int, input().split())\nn = b-a-1\nh = 0\nfor i in range(1, n+1):\n h += i\n#print(h)\nprint(h-a)']
['Wrong Answer', 'Accepted']
['s971920121', 's170546309']
[3068.0, 9016.0]
[18.0, 28.0]
[156, 104]
p03328
u682985065
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\ntower = [n*(2+(i-1))/2 for i in range(1, 1000)]\n\nfor i in range(999):\n if b - a == tower[i+1] - tower[i]:\n print(a-tower[i])\n break\n', 'a, b = map(int, input().split())\ntower = [i*(2+(i-1))/2 for i in range(1, 1000)]\n\nfor i in range(999):\n if a - tower[i] == b - tower[i+1]:\n print(int(abs(tower[i]-a)))\n break']
['Runtime Error', 'Accepted']
['s756899821', 's645329355']
[2940.0, 3060.0]
[17.0, 17.0]
[172, 191]
p03328
u684026548
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['n = int(input())\ns = input()\n\nmax_n = 0\n\nfor i in range(1,n):\n x = set()\n y = set()\n for j in range(0,i):\n x.add(s[j])\n for j in range(i,n):\n y.add(s[j])\n\n if len(x|y) > max_n:\n max_n = len(x|y)\n\nprint(max_n)\n\n', 'a, b = map(int, input().split())\n\nk = b - a - 1\n\na_i = 0\nfor i in range(1, b - a):\n a_i += i\n\nprint(a_i - a)\n']
['Runtime Error', 'Accepted']
['s418727125', 's042738060']
[3060.0, 2940.0]
[17.0, 17.0]
[246, 112]
p03328
u686036872
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = int(input())\n \nprint((b-a)*(b-a+1)//2-b)', 'a, b = map(int, input().split())\n \nprint((b-a)*(b-a+1)//2-b)']
['Runtime Error', 'Accepted']
['s958755962', 's562365395']
[2940.0, 2940.0]
[17.0, 17.0]
[58, 71]
p03328
u690037900
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['ans=0\na,b=map(int,input().split())\nfor i in range(1,999):\n ans+=i\n if ans>b:\n print(ans-a)\n exit(0)', 'a,b=map(int,input().split())\nprint(((a-b)**2-a-b)//2)']
['Wrong Answer', 'Accepted']
['s529361452', 's440024157']
[2940.0, 2940.0]
[18.0, 17.0]
[119, 53]
p03328
u691018832
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
["a, b = map(int, input().split())\nc = [0]\nfor i in range(1, 1000):\n c.append(c[i-1]+i)\n print(c[i-1], end=' ')\n if c[i-1]-a > 0:\n ans = c[i-1]-a\n if a+ans == c[i-1] and b+ans == c[i]:\n break\n else:\n ans = 0\nprint(ans)\n", 'a, b = map(int, input().split())\nc = [0]\nfor i in range(1, 1000):\n c.append(c[i-1]+i)\n if c[i-1]-a > 0:\n ans = c[i-1]-a\n if a+ans == c[i-1] and b+ans == c[i]:\n break\n else:\n ans = 0\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s395635545', 's735943827']
[3188.0, 3060.0]
[19.0, 18.0]
[269, 242]
p03328
u692632484
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['tall=[int(i) for i in input().split()]\ndist=tall[1]-tall[0]\n\nleft=0\nfor i in range(dist):\n left+=i\nprint(left-tall[0],end=" ")\nprint(left+dist-tall[1])', 'tall=[int(i) for i in input().split()]\ndist=tall[1]-tall[0]\n\nleft=0\nfor i in range(dist):\n left+=i\nprint(left-tall[0])']
['Wrong Answer', 'Accepted']
['s748587521', 's159590938']
[3060.0, 3060.0]
[17.0, 20.0]
[152, 119]
p03328
u696684809
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nc = b-a\nwa = c*(c+1)//2\nprint(b-wa)', 'a,b = map(int,input().split())\nc = b-a\nwa = c*(c+1)//2\nprint(wa-b)\n']
['Wrong Answer', 'Accepted']
['s918207639', 's308210855']
[8980.0, 9092.0]
[29.0, 27.0]
[66, 67]
p03328
u698479721
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b= map(int, input().split())\nc = b-a\nn = c*(c+1)/2\nans = n-b\nprint(ans)', 'a, b= map(int, input().split())\nc = b-a\nn = c*(c+1)/2\nans = n-b\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s075545110', 's229237347']
[2940.0, 2940.0]
[19.0, 17.0]
[74, 79]
p03328
u703890795
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nc = b-a\n\nh = c(c+1)//2\nprint(h-b)', 'a, b = map(int, input().split())\nc = b-a\n\nh = c*(c+1)//2\nprint(h-b)']
['Runtime Error', 'Accepted']
['s748903463', 's583932922']
[2940.0, 2940.0]
[17.0, 18.0]
[132, 133]
p03328
u704521025
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
["if int(input()) < 1000:\n print('ABC')\nelse:\n print('ABD')\n", 'a, b = map(int, input().split())\nn = b-a \nhidari = n*(n-1) / 2 \nans = hidari - a\nprint(int(ans))\n']
['Runtime Error', 'Accepted']
['s676143810', 's696759587']
[2940.0, 2940.0]
[17.0, 17.0]
[64, 159]
p03328
u732870425
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nans = 0\nfor i in range(b-a):\n ans += i\nprint(ans)', 'a, b = map(int, input().split())\nans = 0\nfor i in range(b-a):\n ans += i\nprint(ans - a)']
['Wrong Answer', 'Accepted']
['s183569199', 's983892884']
[2940.0, 2940.0]
[17.0, 17.0]
[85, 89]
p03328
u733925602
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['#Stone Monument\na,b = map(int, input().split())\nM = []\nans = []\nfor i in range(1,1000,1):\n\tn = 1/2*i*(i+1)\n\tM.append(n)\nfor i in range(0,999,1):\n\tfor j in range(0,1/2*i*(i+1),1):\n\t\tif (a + j == M[i]) and (b + j == M[i+1]):\n\t\t\tans.append(j)\n\nprint(min(ans))', '#Stone Monument\na,b = map(int, input().split())\nM = []\nfor i in range(1,1000,1):\n\tn = 1/2*i*(i+1)\n\tM.append(n)\nn = b-a-1\nprint(int(M[n-1]-a))']
['Runtime Error', 'Accepted']
['s905299488', 's076330186']
[3064.0, 3060.0]
[18.0, 17.0]
[256, 141]
p03328
u749643742
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = int(input())\nz =[]\n\nc = 0\nfor i in 999:\n c +=i\n z.append(c)\n\nw =max(a,b)-min(a,b)\nif (w==z[i+1]-z[i]):\n print(z[i]-a)', 'a,b = map(int,input().split)\nz =[]\n\nc = 0\nfor i in 999:\n c +=i\n z.append(c)\n\nw =max(a,b)-min(a,b)\nif (w==z[i+1]-z[i]):\n print(z[i]-a)\n', 'a, b = map(int, input().split())\nc = b - a\nlb = 0\nfor i in range(1, c + 1):\n lb += i\nprint(lb - b)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s737879026', 's826755970', 's019478709']
[3060.0, 3060.0, 2940.0]
[18.0, 17.0, 17.0]
[126, 137, 100]
p03328
u757274384
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nn = b-a\n\nprint(n*(n+1)/2 - b)', 'a,b = map(int,input().split())\nn = b-a\n\nprint(int(n*(n+1)/2) - b)\n']
['Wrong Answer', 'Accepted']
['s047249168', 's160743541']
[2940.0, 2940.0]
[17.0, 17.0]
[60, 66]
p03328
u766393261
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nN=b-a\nprint(sum(list(range(1,N))))', 'a,b=map(int,input().split())\nN=b-a\nprint(sum(list(range(1,N+1))))', 'a,b=map(int,input().split())\nN=b-a\nprint(sum(list(range(1,N+1)))-b)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s423630152', 's609824232', 's636371356']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[63, 65, 67]
p03328
u766407523
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nprint(sum(range(b-a)-a))', 'a, b = map(int, input().split())\nprint(sum(range(b-a)-a)', 'a, b = map(int, input().split())\nprint(sum(range(b-a))-a)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s302691452', 's982560883', 's180187779']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[57, 56, 57]
p03328
u767995501
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nprint(((a-b)*(a-b)-(a+b))/2)', 'import math\n\na, b = map(int, input().split())\nprint(math.floor(((a-b)*(a-b)-(a+b))/2))']
['Wrong Answer', 'Accepted']
['s570302469', 's628901113']
[2940.0, 2940.0]
[17.0, 17.0]
[61, 86]
p03328
u777394984
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\ns = a-b\nm = int(s*(s+1)/2)\nprint(m-b)', 'a,b = map(int,input().split())\nprint(int(b-a*(b-a+1)/2)-b)\n', 'a,b = map(int,input().split())\nprint(int((b-a)*(b-a+1)/2)-b)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s362503236', 's848775951', 's735626260']
[3316.0, 2940.0, 2940.0]
[20.0, 17.0, 17.0]
[68, 59, 61]
p03328
u780698286
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['import itertools\n\nn, m = map(int, input().split())\nl = itertools.accumulate([1] * 999)\nprint(l[m-n-1] - m)', 'import itertools\n\nn, m = map(int, input().split())\nl = list(itertools.accumulate(range(1, 1000)))\nprint(l[m-n-1]-m)']
['Runtime Error', 'Accepted']
['s030983754', 's290430118']
[9124.0, 9016.0]
[25.0, 27.0]
[106, 115]
p03328
u790301364
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['def main2():\n strbuf = input("");\n strbufs = strbuf.split();\n buf = [];\n for i in range(2):\n buf.append(int(strbufs[i]));\n sa = buf[1] - buf[0];\n takasa = sa * (sa + 1) / 2;\n result = takasa - buf[1];\n print(result);\n\n\nif __name__ == \'__main__\':\n main2()', 'def main2():\n strbuf = input("");\n strbufs = strbuf.split();\n buf = [];\n for i in range(2):\n buf.append(int(strbufs[i]));\n sa = strbufs[1] - strbufs[0];\n takasa = sa * (sa + 1) / 2;\n result = takasa - strbufs[1];\n print(result);\n\n\nif __name__ == \'__main__\':\n main2()', 'def main2():\n strbuf = input("");\n strbufs = strbuf.split();\n buf = [];\n for i in range(2):\n buf.append(int(strbufs[i]));\n sa = buf[1] - buf[0];\n takasa = sa * (sa + 1) / 2;\n result = takasa - buf[1];\n print(int(result));\n\n\nif __name__ == \'__main__\':\n main2()']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s297008829', 's787679758', 's633598468']
[3060.0, 3064.0, 3060.0]
[17.0, 18.0, 17.0]
[288, 300, 293]
p03328
u795630164
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\n\ndef calc(n):\n count = 0\n for i in range(1, n+1):\n count += i\n reversed(count)\n\nprint(calc(b - a) - b)', 'import sys\nsys.setrecursionlimit(100000)\na, b = map(int, input().split())\n\ndef calc(n):\n if n == 1:\n return 1\n else:\n return calc(n-1) + n\n\nfor i in range(1, 999+1):\n print(i, calc(i))\n\nprint(calc(b - a) - b)', 'a, b = map(int, input().split())\n\ndef calc(n):\n count = 0\n for i in range(1, n+1):\n count += i\n return count\n\nprint(calc(b - a) - b)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s060214471', 's327667334', 's881499653']
[2940.0, 4044.0, 2940.0]
[18.0, 115.0, 17.0]
[151, 231, 148]
p03328
u798316285
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nn=b-a\nprint(n(n+1)//2-b)', 'a,b=map(int,input().split())\nn=b-a\nprint(n*(n+1)//2-b)']
['Runtime Error', 'Accepted']
['s773688126', 's241465080']
[3060.0, 2940.0]
[18.0, 17.0]
[53, 54]
p03328
u806403461
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\n\nprint((b-a)*(b-a + 1)/2 - b)\n', 'a, b = map(int, input().split())\n\nprint(int((b-a)*(b-a + 1)/2 - b))\n']
['Wrong Answer', 'Accepted']
['s387776004', 's848397791']
[2940.0, 2940.0]
[17.0, 18.0]
[63, 68]
p03328
u812958204
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nb_index = b-a\na_index = b_index - 1\nget_height = lambda n: n*(n+1)/2\n\na_height = get_height(a_index)\nb_height = get_height(b_index)\nsnow_height = b_height - b\nprint(snow_height)', 'a, b = map(int, input().split())\nb_index = b-a\na_index = b_index - 1\nget_height = lambda n: n*(n+1)/2\n\na_height = get_height(a_index)\nb_height = get_height(b_index)\nsnow_height = b_height - b\nprint(int(snow_height))']
['Wrong Answer', 'Accepted']
['s470516673', 's246549037']
[2940.0, 3060.0]
[17.0, 17.0]
[210, 215]
p03328
u824132304
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nsum=0\ncnt=0\nwhile(cnt<b-a):\n cnt+=1\n l+=cnt\nprint(l-b)', 'a=int(input())\nb=int(input())\nprint((b-a-1)*(b-a)//2-a)', 'a=int(input())\nb=int(input())\nprint((b-a-1)*(b-a)//2-a)', 'a,b=map(int,input().split())\nprint((b-a-1)*(b-a)/2-a)', 'a,b = map(int,input().split())\nsum=0\ncnt=0\nwhile(cnt<b-a):\n cnt+=1\n sum+=cnt\nprint(sum-b)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s111070665', 's753147162', 's779374289', 's932623568', 's967458748']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[91, 55, 55, 53, 95]
p03328
u827202523
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['N = input()\nN = N.split(" ")\nN = [int(i) for i in N]\n\nsub = N[1] - N[0]\nhigh = 0 \nfor i in range(sub):\n high += i\n\nprint(high)\n\nsnow = high - N[0]\nprint(snow)', 'N = input()\nN = N.split(" ")\nN = [int(i) for i in N]\n\nsub = N[1] - N[0]\nhigh = 0 \nfor i in range(sub):\n high += i\nsnow = high - N[0]\nprint(snow)']
['Wrong Answer', 'Accepted']
['s197901824', 's710862293']
[3060.0, 3060.0]
[17.0, 17.0]
[161, 147]
p03328
u842170774
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['#B - Stone Monument\na,b=map(int,input().split())\nd=b-a\nb0=d*(d+1)/2\nsnow=b0-b\nint(snow)', '#B - Stone Monument\na,b=map(int,input().split())\nd=b-a\nb0=d*(d+1)/2\nsnow=b0-b\nprint(snow)', '#B - Stone Monument\na,b=map(int,input().split())\nd=b-a\nb0=d*(d+1)/2\nsnow=b0-b\nsnow', '#B - Stone Monument\na,b=map(int,input().split())\nd=b-a\nb0=d*(d+1)/2\nsnow=b0-b\nprint(int(snow))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s414059438', 's494934735', 's782783758', 's289737227']
[2940.0, 2940.0, 2940.0, 2940.0]
[19.0, 17.0, 17.0, 17.0]
[87, 89, 82, 95]
p03328
u844005364
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input())\n\nn = b - a\noriginal_b = n * (n + 1) // 2\n\nprint(original_b - b)', 'a, b = map(int, input().split())\n \nn = b - a\noriginal_b = n * (n + 1) // 2\n \nprint(original_b - b)']
['Runtime Error', 'Accepted']
['s511200566', 's335340899']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 98]
p03328
u855985627
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
["n=eval('-'+input().replace(' ','+'))\ns=0\nfor i in range(n+1):\n s+=i\nprint(s)", "a,b=(int(i) for i in input().split(' '))\nn=b-a\ns=0\nfor i in range(n):\n s+=i\nprint(s-a)"]
['Wrong Answer', 'Accepted']
['s949103573', 's490957787']
[2940.0, 2940.0]
[17.0, 17.0]
[77, 87]
p03328
u857330600
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input())\ns=0\nfor i in range(b-a-1):\n s+=1+i\nprint(s-a)', 'a,b=map(int,input().split())\ns=0\nfor i in range(b-a-1):\n s+=1+i\nprint(s-a)']
['Runtime Error', 'Accepted']
['s770529336', 's833650360']
[2940.0, 2940.0]
[17.0, 17.0]
[67, 75]
p03328
u859897687
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\nans=-a\nfor i in range(1,b-a+1):\n ans+=i\nprint(ans)', 'a,b=map(int,input().split())\nans=-b\nfor i in range(1,b-a+1):\n ans+=i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s018761821', 's006961470']
[2940.0, 2940.0]
[17.0, 17.0]
[80, 80]
p03328
u864900001
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nt = b-a\nb_true=0\nfor i in range(b+1):\n b_true += i\nprint(b_true-b)\n', 'a, b = map(int, input().split())\nt = b-a\nb_true=0\nfor i in range(b):\n b_true += i\nprint(b_true-b)', 'a, b = map(int, input().split())\nt = b-a\nb_true=0\nfor i in range(t+1):\n b_true += i\nprint(b_true-b)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s085877813', 's222580888', 's648169440']
[2940.0, 2940.0, 2940.0]
[78.0, 75.0, 17.0]
[103, 100, 103]
p03328
u865413330
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\ndiff = b - a\n\ndef generate(n):\n if n == 1:\n return 1\n return generate(n-1) + n\n\ngenerate(diff) - b', 'a, b = map(int, input().split())\n\ntower = 0\n\nfor i in range(1, b - a + 1):\n tower += i\n\nprint(tower - b)']
['Runtime Error', 'Accepted']
['s245825261', 's058718065']
[3884.0, 3060.0]
[74.0, 19.0]
[144, 107]
p03328
u869708025
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int(), input())\nx = 0\nfor i in range(b - a):\n x += x + i\n print(x - a)', 'a = int(input())\nb = int(input())\nc = int(b - a)\nd = c * (c -1) / 2\ne = int(c -1)\nf = int(1 + d + e)\nprint(int(f - b))\n\n', 'a = int(input())\nb = int(input())\nc = int(b - a)\nprint(( c * (c - 1) //2 + c - b))\n', 'a = int(input())\nb = int(input())\nc = int(b - a)\nd = c * (c -1) \np = d / 2\ne = int(c -1)\nf = int(1 + p + e)\nprint(int(f - b))\n\n', 'a = int(input())\nb = int(input())\nc = int(b - a)\nd = c * (c -1) \np = d // 2\ne = int(c -1)\nf = int(1 + p + e)\nprint(int(f - b))\n\n', 'a, b = map(int(), input())\nc = int(b - a)\nd =int( c * (c - 1) // 2 + c -b)\nprint(d)', 'a = int(input())\nb = int(input())\nc = int(b - a)\nd =int( c * (c - 1) // 2 + c -b)\nprint(d)', 'a = int(input())\nb = int(input())\nc = int(b - a)\nd =int( c * (c - 1) /2 + c -b)\nprint(d)', 'a, b = map(int, input().split())\nc = int(b - a)\nd =int( c * (c - 1) // 2 + c -b)\nprint(d)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s019712362', 's020570537', 's039796130', 's269523639', 's311761625', 's504314678', 's669500540', 's828051112', 's451667461']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 17.0, 17.0, 20.0]
[87, 120, 83, 127, 128, 85, 91, 89, 91]
p03328
u870518235
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nX = b - a\nans = 0\nfor i in range(X):\n ans += i\nprint(ans)', 'a, b = int(input())\nX = b - a\nans = 0\nfor i in range(X):\n ans += i\nprint(ans)', 'a, b = map(int, input().split())\nX = b - a\nans = 0\nfor i in range(X):\n ans += i\nprint(ans-a)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s445582759', 's957161237', 's777010070']
[9080.0, 9128.0, 9088.0]
[24.0, 23.0, 32.0]
[93, 80, 96]
p03328
u873139556
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['def main():\n a, b = map(int, input().split())\n\n h = b - a\n\n i, ans = 0\n while True:\n i += 1\n ans += i\n\n if h == i:\n break\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n a, b = map(int, input().split())\n\n h = 0\n for i in range(1, 1000):\n h += i\n\n if (h - old_h) == (b - a):\n print(h - b)\n exit()\n\n old_h = h\n\nif __name__ == "__main__":\n main()\n', 'def main():\n a, b = map(int, input().split())\n\n h = 0\n old_h = 0\n for i in range(1, 1000):\n h += i\n\n if (h - old_h) == (b - a):\n print(h - b)\n exit()\n\n old_h = h\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s567662645', 's992414930', 's089662991']
[2940.0, 2940.0, 2940.0]
[29.0, 17.0, 17.0]
[222, 242, 256]
p03328
u890807039
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split( ))\nans = 1\ni = 2\n\nwhile a > ans:\n ans = ans + i\n i += 1\n print(ans)\n\nprint(ans-a)', 'a,b = map(int,input().split( ))\nc = b-a\nd = 0\ni = 1\nans = 0\n\nwhile c > i:\n d = d+i\n i += 1\nans = d-a\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s291666341', 's158391720']
[3188.0, 2940.0]
[18.0, 17.0]
[119, 118]
p03328
u902151549
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['# coding: utf-8\nimport time\nimport re\nimport math\nimport fractions\n\ndef main():\n A,B=map(int,input().split())\n index=B-A-1\n total=0\n for a in range(0,index+1):\n total+a+1\n print(total-B)\nstart=time.time()\nmain()\n\n#"YNeos"[True::2]\n#A=list(map(int,input().split()))\n#A,B,C=map(int,input().split())\n#n=int(input())\n\n\n', '# coding: utf-8\nimport time\nimport re\nimport math\nimport fractions\n\ndef main():\n A,B=map(int,input().split())\n index=B-A-1\n total=0\n for a in range(0,index+1):\n total+=a+1\n print(total-B)\nstart=time.time()\nmain()\n\n#"YNeos"[True::2]\n#A=list(map(int,input().split()))\n#A,B,C=map(int,input().split())\n#n=int(input())\n\n\n']
['Wrong Answer', 'Accepted']
['s702428380', 's660100300']
[5044.0, 5044.0]
[35.0, 36.0]
[420, 421]
p03328
u906428167
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = int(input().split())\nprint((b-a)*(b-a-1)/2 - a)', 'a,b = int(input().split())\nprint((b-a)*(b-a-1)//2 - a)', 'a,b = map(int, input().split())\nprint((b-a)*(b-a-1)//2 - a)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s009284966', 's829056432', 's605793358']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[53, 54, 59]
p03328
u918601425
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['A,B=[int(s) for s in input().split()]\nx=B-A\ny=x*(x-1)//2\nprint(A+y)', 'A,B=[int(s) for s in input().split()]\nx=B-A\ny=x*(x-1)//2\nprint(y-A)\n']
['Wrong Answer', 'Accepted']
['s088403154', 's900795472']
[2940.0, 2940.0]
[17.0, 17.0]
[67, 68]
p03328
u923270446
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nprint(sum(range(b - a)) - b)', 'a, b = map(int, input().split())\nprint(sum(range(b - a + 1)) - b)']
['Wrong Answer', 'Accepted']
['s670246577', 's049800505']
[2940.0, 2940.0]
[17.0, 17.0]
[61, 65]
p03328
u931938233
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['def Gauss_sum(n):\n return n*(n+1)//2\na,b=map(int,input())\nfor i in range(999):\n if Gauss_sum(i+1)-a == Gauss_sum(i+2)-b:\n print(Gauss_sum(i+1)-a)\n break', 'def Gauss_sum(n):\n return n*(n+1)//2\na,b=map(int,input().split())\nfor i in range(999):\n if Gauss_sum(i+1)-a == Gauss_sum(i+2)-b:\n print(Gauss_sum(i+1)-a)\n break']
['Runtime Error', 'Accepted']
['s290033953', 's402804440']
[8960.0, 9000.0]
[24.0, 26.0]
[160, 168]
p03328
u932465688
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nh = ((b-a-1)*(b-a)//2)-a', 'a,b = map(int,input().split())\nh = ((b-a-1)*(b-a)//2)-a\nprint(h)']
['Wrong Answer', 'Accepted']
['s951243221', 's988682392']
[2940.0, 2940.0]
[17.0, 17.0]
[55, 64]
p03328
u934868410
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int, input().split())\nprint((b-a)*(b-a-1)//2 - b)', "n = int(input())\nif n < 1000:\n print('ABC')\nelse:\n print('ABD')", 'a,b = map(int, input().split())\nprint((b-a)*(b-a-1)//2 - a)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s166409569', 's840240067', 's373814571']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[59, 65, 59]
p03328
u938594975
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = [int(i) for i in input().split()]\nn = b-a-1\nprint(n*(n+1)/2-a)', 'a,b = [int(i) for i in input().split()]\nn = b-a-1\nprint(int(n*(n+1)/2-a))']
['Wrong Answer', 'Accepted']
['s325633641', 's351472420']
[2940.0, 2940.0]
[17.0, 17.0]
[68, 73]
p03328
u939585142
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int,input().split())\n\n\nb1 = 0\nc = b - a\n\nfor i in range(b - a):\n b1 += i\nprint(b1 - b)', 'a, b = map(int,input().split())\n\nc = b - a\nb1 = 0\nfor i in range(1,c + 1):\n b1 += i\n \n \nprint(b1 - b)']
['Wrong Answer', 'Accepted']
['s077466990', 's893699038']
[2940.0, 2940.0]
[17.0, 17.0]
[98, 104]
p03328
u940279019
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\ntmp = b - a\ncount = 0\nfor i in range(tmp):\n count += i+1\nprint(count - a)', 'a,b = map(int,input())\ntmp = b - a\ncount = 0\nfor i in range(tmp):\n count += i+1\nprint(count - a)', 'a,b = map(int,input().split())\ntmp = b - a\ncount = 0\nfor i in range(tmp):\n count += i\nprint(count - a)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s919480560', 's954162226', 's065526895']
[2940.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0]
[105, 97, 103]
p03328
u948524308
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
[', b = map(int, input().split())\n\ni = 0\ns = 0\n\nfor i in range(1, b - a):\n s += i\nprint(s - a)', 'a, b = map(int, input().split())\n\ni = 0\ns = 0\n\nfor i in range(1, b - a):\n s += i\nprint(s - a)\n']
['Runtime Error', 'Accepted']
['s064930365', 's774855353']
[2940.0, 2940.0]
[17.0, 17.0]
[95, 97]
p03328
u948911484
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nt = b-a\nprint(t*(t-1)//2-b)', 'a,b = map(int,input().split())\nt = b-a\nprint(t*(t+1)//2-b)']
['Wrong Answer', 'Accepted']
['s836046126', 's724530668']
[9132.0, 9004.0]
[26.0, 33.0]
[58, 58]
p03328
u960513073
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = list(map(int, input().split()))\nn = b-a\nprint(n*(n+1)/2 - b)', 'a,b = list(map(int, input().split()))\nn = b-a\nprint(int(n*(n+1)/2 - b))']
['Wrong Answer', 'Accepted']
['s582978857', 's438319943']
[2940.0, 2940.0]
[18.0, 18.0]
[66, 71]
p03328
u963903527
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['import numpy as np\na, b = input().split(" ")\na = int(a)\nb = int(b)\n\nc = b - a\ns = sum(list(np.arange(c)))\nprint(a - s)\n', 'import numpy as np\na, b = input().split(" ")\na = int(a)\nb = int(b)\n\nc = b - a\ns = sum(list(np.arange(c)))\nprint(s - a)\n']
['Wrong Answer', 'Accepted']
['s281777490', 's915510521']
[15276.0, 21384.0]
[461.0, 308.0]
[119, 119]
p03328
u969226579
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a, b = map(int, input().split())\nprint((b - a) * (b - a - 1) / 2 - a)\n', 'a, b = map(int, input().split())\nans = (b - a) * (b - a - 1) / 2 - a\nprint(int(ans))\n']
['Wrong Answer', 'Accepted']
['s358780902', 's287716209']
[3316.0, 2940.0]
[59.0, 17.0]
[70, 85]
p03328
u982594421
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['from itertools import accumulate\nt = [n for n in accumulate(range(10000))]\n\na, b = map(int, input().split())\nprint(t[b - a - 1] - b)\n', 'from itertools import accumulate\nt = [n for n in accumulate(range(10000))]\n \na, b = map(int, input().split())\nprint(t[b - a] - b)\n']
['Wrong Answer', 'Accepted']
['s181332498', 's625735672']
[3444.0, 3444.0]
[18.0, 18.0]
[133, 130]
p03328
u982896977
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nn = b - a\ns = 1/2 * n * (1 + n)\nprint(s - b)', 'a,b = map(int,input().split())\nn = b - a\ns = 1/2 * n * (1 + n)\nx = s - b\nprint(int(x))']
['Wrong Answer', 'Accepted']
['s993833717', 's434350554']
[2940.0, 2940.0]
[20.0, 18.0]
[75, 86]
p03328
u983918956
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b = map(int,input().split())\nprint(1/2*(a**2-a-2*a*b-b+b**2))\n', 'a,b = map(int,input().split())\nprint(int(1/2*(a**2-a-2*a*b-b+b**2)))\n']
['Wrong Answer', 'Accepted']
['s959721742', 's007745652']
[2940.0, 2940.0]
[17.0, 17.0]
[64, 69]
p03328
u983967747
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['a,b=map(int,input().split())\ny=0\nhigh=0\nfor i in range(1,1000):\n y+=i\n x.append(y)\nfor xz in x:\n if xz < b:\n high=xz\nprint(high-a)', 'a,b=map(int,input().split())\ny=0\nhigh=0\nfor i in range(1,1000):\n y+=i\n x.append(y)\nfor xz in x:\n if xz <= b:\n high=xz\n d=high-a\nprint(d)', "def readQuestion(a,b):\n a,b=map(int,input().split())\n\n\ndef solve(x):\n a,b=map(int,input().split())\n x=[]\n y=0\n high=0\n z=0\n u=0\n for i in range(1,1000):\n y+=i\n x.append(y)\n high = b-a\n z=high-1\n u=x[z]-b\n return u\n\n\ndef main():\n x = readQuestion(a,b)\n answer = solve(x)\n print(answer)\n\n\nif __name__ == '__main__':\n main()", "\ndef readQuestion(a,b):\n a,b=map(int,input().split())\n\n\ndef solve(x):\n a,b=map(int,input().split())\n x=[]\n y=0\n high=0\n z=0\n u=0\n for i in range(1,1000):\n y+=i\n x.append(y)\n high = b-a\n z=high-1\n u=x[z]-b\n print(u)\n\n\ndef main():\n x = readQuestion(a,b)\n answer = solve(x)\n print(answer)\n\n\nif __name__ == '__main__':\n main()", 'import sys\ndef readQuestion():\n line = sys.stdin.readline()\n sline = line.rstrip()\n [rline,r1line]=sline.split(" ")\n a=int(rline)\n b=int(r1line)\n return a,b \n\ndef solve(a,b):\n x=[]\n y=0\n high=0\n z=0\n u=0\n for i in range(1,1000):\n y+=i\n x.append(y)\n high = b-a\n z=high-1\n u=x[z]-b\n return u\n\ndef main():\n x,y = readQuestion()\n answer = solve(x, y)\n print(answer)\n\n\nif __name__ == \'__main__\':\n main()']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s109908863', 's300068477', 's716660975', 's955613136', 's052412765']
[2940.0, 2940.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0, 18.0, 17.0]
[146, 159, 420, 453, 501]
p03328
u986269893
2,000
262,144
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter. It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower. Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover. Assume also that the depth of the snow cover is always at least 1 meter.
['n=input().split(" ")\na=int(n[0])\nb=int(n[1])\nc=b-a\nprint(((c*(c+1))/2)-b)', 'n=input().split(" ")\na=int(n[0])\nb=int(n[1])\nc=b-a\nprint (int(((c*(c+1))/2)-b))']
['Wrong Answer', 'Accepted']
['s602856936', 's766614904']
[2940.0, 3316.0]
[17.0, 22.0]
[73, 79]
p03329
u015318452
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['import math\n\ndef A():\n x, a, b = [int(x) for x in input().split()]\n if abs(x-a) < abs(x-b):\n print(\'A\')\n else:\n print(\'B\')\ndef B():\n S = input()\n alphabet = [False for x in range(26)]\n for char in S:\n i = ord(char) - ord(\'a\')\n alphabet[i] = True\n printed = False\n for i in range(len(alphabet)):\n if alphabet[i] == False:\n print(chr(ord(\'a\')+i))\n printed = True\n break\n if printed == False:\n print("None")\ndef C():\n n = int(input())\n kazu = sorted([1] + [pow(6, x+1) for x in range(6)]+ [pow(9, x+1) for x in range(5)])\n stack = [(n, 0)]\n m = 9999999999\n while len(stack) > 0:\n node = stack.pop()\n for x in kazu:\n if x <= node[0]:\n if node[0] % x == 0:\n m = min(m, node[1] + node[0] // x)\n else:\n stack.append((node[0] % x, node[1] + node[0] // x))\n print(stack)\n print(m)\n print(m)\nC()\n', 'import math\n\ndef A():\n x, a, b = [int(x) for x in input().split()]\n if abs(x-a) < abs(x-b):\n print(\'A\')\n else:\n print(\'B\')\ndef B():\n S = input()\n alphabet = [False for x in range(26)]\n for char in S:\n i = ord(char) - ord(\'a\')\n alphabet[i] = True\n printed = False\n for i in range(len(alphabet)):\n if alphabet[i] == False:\n print(chr(ord(\'a\')+i))\n printed = True\n break\n if printed == False:\n print("None")\ndef C():\n num = sorted([1] + [pow(6, x+1) for x in range(6)] + [pow(9, x+1) for x in range(5)])\n n = int(input())\n stack = [(n, 0)]\n memo = {}\n _min = 999999\n\n cost = {}\n\n while len(stack) > 0:\n node = stack.pop()\n for k in num:\n if node[0] >= k:\n ans = (node[0] - k, node[1] + 1)\n if ans[0] == 0:\n _min = min(_min, ans[1])\n else:\n if str(ans[0]) in memo and memo[str(ans[0])] <= ans[1]:\n pass\n else:\n stack.append(ans)\n memo[str(ans[0])] = ans[1]\n print(_min)\n\ndef E():\n n, m = [int(x) for x in input().split()]\n P = [[] for i in range(n)]\n for j in range(m):\n p, y = [int(x) for x in input().split()]\n P[p-1].append([y, (\'000000\'+str(p))[-6:], j])\n\n for i in range(n):\n P[i] = sorted(P[i], key=lambda x:x[0])\n for j in range(len(P[i])):\n P[i][j][1] += ((\'000000\'+str(j+1))[-6:])\n P = [e for inner_list in P for e in inner_list]\n P = sorted(P, key=lambda x:x[2])\n for p in P:\n print(p[1])\nC()\n']
['Wrong Answer', 'Accepted']
['s971253370', 's874425892']
[3188.0, 17168.0]
[22.0, 1987.0]
[1013, 1688]
p03329
u021548497
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['n = int(input())\npayable = [1] + [6**(int(x)+1) for x in range(6)] + [9**(int(x)+1) for x in range(5)]\npayable.sort()\nans = 0\nwhile n > 0:\n for value in payable:\n if value > n:\n payable.remove(value)\n n -= max(payable)\n ans += 1\nprint(ans)', 'n = int(input())\npayable = [1] + [6**(int(x)+1) for x in range(7)] + [9**(int(x)+1) for x in range(6)]\npayable.sort(reverse=True)\nans = 0\nwhile n > 0:\n for value in payable:\n if value > n:\n payable.remove(value)\n else:\n break\n n -= max(payable)\n ans += 1\nprint(ans)', 'n = int(input())\ndp = [0 for x in range(n+1)]\nkey = 1\nwhile key <= n:\n key *= 6\nwhile key > 1:\n for j in range(n+1):\n if j == 0 or dp[j]:\n if j+key <= n:\n if dp[j+key]:\n dp[j+key] = min([dp[j]+1, dp[j+key]])\n else:\n dp[j+key] = dp[j]+1\n key //= 6\n\nkey = 1\nwhile key <= n:\n key *= 9\nwhile key > 1:\n for j in range(n+1):\n if j == 0 or dp[j]:\n if j+key <= n:\n if dp[j+key]:\n dp[j+key] = min([dp[j]+1, dp[j+key]])\n else:\n dp[j+key] = dp[j]+1\n key //= 9\n\nfor i in range(1, n+1):\n if dp[i]:\n dp[i] = min([dp[i-1]+1, dp[i]])\n else:\n dp[i] = dp[i-1]+1\n\nprint(dp[n])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s716073168', 's943253150', 's581549082']
[3060.0, 3064.0, 3992.0]
[18.0, 17.0, 287.0]
[266, 310, 651]
p03329
u026788530
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['N = int(input())\n\nprint("a")\n"""\n#memo = [[ -1 for i in range(12)]for j in range(100000)]\nn = 6\nwhile True:\n num.append(n)\n n *= 6\n if n > 100000:\n break\nn = 9\nwhile True:\n num.append(n)\n n *= 9\n if n > 100000:\n break\nnum.sort()\n\nans = 0\nprint(num)\n#while N > 6:\n\ndef DP(n , index):\n if index == 0:\n return n\n elif n == 0:\n return 0\n min_ = 10000000\n if n < num[index]:\n #print(n,num[index])\n return DP(n,index - 1)\n can = num[index]\n #print(index)\n# print(n//can)\n for i in range(n // can+1):\n min_ = min(min_ , DP(n - i * can,index - 1) + i)\n # print(i,n,index,DP(n - i*can,index-1))\n \n # print(min_)\n #print(min_)\n memo[n][index] = min_\n return min_\n \nprint(DP(N,11))\n"""\n\ndef ninep(N):\n if N <9:\n return N\n ans = 0\n while N > 0:\n ans += N % 9\n N =N // 9\n return ans\n\n\ndef sixp(N):\n if N <6:\n return N\n ans = 0\n while N > 0:\n ans += N % 6\n N = N // 6\n return ans\n\n\nans = 100000\nfor i in range(N):\n ans = min(ans,ninep(i) + sixp(N - i))\n print(ninep(i), sixp(N - i),i)\n\nprint(ans)\n', 'N = int(input())\n\nnum = [1]\nmemo = [[ -1 for i in range(12)]for j in range(100000)]\nn = 6\nwhile True:\n num.append(n)\n n *= 6\n if n > 100000:\n break\nn = 9\nwhile True:\n num.append(n)\n n *= 9\n if n > 100000:\n break\nnum.sort()\n\nans = 0\nprint(num)\n#while N > 6:\n\ndef DP(n , index):\n if index == 0:\n return n\n elif n == 0:\n return 0\n min_ = 10000000\n if n < num[index]:\n #print(n,num[index])\n return DP(n,index - 1)\n can = num[index]\n #print(index)\n# print(n//can)\n for i in range(n // can+1):\n min_ = min(min_ , DP(n - i * can,index - 1) + i)\n # print(i,n,index,DP(n - i*can,index-1))\n \n # print(min_)\n #print(min_)\n memo[n][index] = min_\n return min_\n \nprint(DP(N,11))\n', 'N = int(input())\n\nprint("a")\n"""\n#memo = [[ -1 for i in range(12)]for j in range(100000)]\nn = 6\nwhile True:\n num.append(n)\n n *= 6\n if n > 100000:\n break\nn = 9\nwhile True:\n num.append(n)\n n *= 9\n if n > 100000:\n break\nnum.sort()\n\nans = 0\nprint(num)\n#while N > 6:\n\ndef DP(n , index):\n if index == 0:\n return n\n elif n == 0:\n return 0\n min_ = 10000000\n if n < num[index]:\n #print(n,num[index])\n return DP(n,index - 1)\n can = num[index]\n #print(index)\n# print(n//can)\n for i in range(n // can+1):\n min_ = min(min_ , DP(n - i * can,index - 1) + i)\n # print(i,n,index,DP(n - i*can,index-1))\n \n # print(min_)\n #print(min_)\n memo[n][index] = min_\n return min_\n \nprint(DP(N,11))\n"""\n\ndef ninep(N):\n if N <9:\n return N\n ans = 0\n while N > 0:\n ans += N % 9\n N =N // 9\n return ans\n\n\ndef sixp(N):\n if N <6:\n return N\n ans = 0\n while N > 0:\n ans += N % 6\n N = N // 6\n return ans\n\n\nans = 100000\nfor i in range(N):\n ans = min(ans,ninep(i) + sixp(N - i))\n#` print(ninep(i), sixp(N - i),i)\n\nprint(ans)\n', 'INF = 1000000\n\ndp = [INF for i in range(100040)]\n\ndp[0]= 0\n\na = [1]\nn = 6\nwhile True:\n a.append(n)\n n *= 6\n if n > 100000:\n break\nn= 9\nwhile True:\n a.append(n)\n n *= 9\n if n > 100000:\n break\na.sort()\nfor i in range(len(a)):\n a_ = a[i]\n for j in range(a[i],len(dp)):\n dp[j] = min(dp[j],dp[j-a_] + 1)\n\nprint(dp[int(input())])\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s143387310', 's822998686', 's926753698', 's650302261']
[4576.0, 26228.0, 3064.0, 7064.0]
[597.0, 2105.0, 232.0, 578.0]
[1184, 784, 1186, 370]
p03329
u036104576
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\nN = int(input())\n\ncoins = [(9 ** i) for i in range(1, 7)] + [(6 ** i) for i in range(1, 8)] + [1]\nprint(coins)\ndp = [INF] * (N + 1)\ndp[0] = 0\nfor i in range(len(coins)):\n for j in range(N + 1):\n if j + coins[i] > N:\n continue\n dp[j + coins[i]] = min(dp[j + coins[i]], dp[j] + 1)\nprint(dp[N])\n', 'import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\nN = int(input())\n\ncoins = [(9 ** i) for i in range(1, 7)] + [(6 ** i) for i in range(1, 8)] + [1]\ndp = [INF] * (N + 1)\ndp[0] = 0\nfor i in range(len(coins)):\n for j in range(N + 1):\n if j + coins[i] > N:\n continue\n dp[j + coins[i]] = min(dp[j + coins[i]], dp[j] + 1)\nprint(dp[N])\n']
['Wrong Answer', 'Accepted']
['s632981777', 's192683682']
[10320.0, 10008.0]
[572.0, 614.0]
[642, 629]
p03329
u039623862
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
["n = int(input())\n\nmin_cnt = float('inf')\nfor i in range(n//6+1):\n cnt = 0\n t = i\n while t>6:\n\tcnt += t%6\n \tt //= 6\n cnt += t\n \n for j in range((n-6*i)//9+1):\n t = j\n while t>9:\n cnt += t%9\n t //= 9\n cnt += t\n cnt += (n-6*i-9*j)\n if cnt < min_cnt:\n min_cnt = cnt\nprint(min_cnt)\n", "n = int(input())\n\nmin_cnt = float('inf')\nfor i in range(0, n+1, 9):\n cnt = 0\n t = i\n while t >= 9:\n cnt += t % 9\n t //= 9\n cnt += t\n\n t = (n-i)\n while t >= 1:\n cnt += t % 6\n t //= 6\n cnt += t\n\n if cnt < min_cnt:\n min_cnt = cnt\nprint(min_cnt)\n"]
['Runtime Error', 'Accepted']
['s451613929', 's544802651']
[2940.0, 3316.0]
[17.0, 57.0]
[314, 301]
p03329
u047023156
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\nn = ni()\n\nres = n\nfor i in range(n+1):\n cash = 0\n t = i\n while t > 0: \n cash += t % 6\n t //= 6\n t = n - i\n while t > 0: \n cc += t % 9\n t //= 9\n if res > cash: \n res = cash\n\nprint(res)', 'import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\nn = ni()\n\nres = n\nfor i in range(n+1):\n cash = 0\n t = i\n while t > 0: \n cash += t % 6\n t //= 6\n t = n - i\n while t > 0: \n cash += t % 9\n t //= 9\n if res > cash: \n res = cash\n\nprint(res)']
['Runtime Error', 'Accepted']
['s407013825', 's068445567']
[3680.0, 3680.0]
[24.0, 363.0]
[762, 764]
p03329
u050428930
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['n=int(input())\ns=[]\nt=[]\np=0\ndef f9(n,p):\n while n>=9:\n n//=9\n p+=1\n f9(n,p)\n return p\ndef f6(n,p):\n while n>=6:\n n//=6\n p+=1\n f6(n,p)\n return p \ns.append((n,0))\nwhile s:\n print(s)\n a=s[0][0]\n b=s[0][1]\n if a<6:\n t.append(b+a)\n else:\n p=0\n s.append((a-9**f9(a,p),b+1))\n p=0\n s.append((a-6**f6(a,p),b+1))\n s.pop(0) \nprint(min(t))\n\n\n', 'a=int(input())\np=0\ndef f9(n,b):\n while n>=9:\n n//=9\n b+=1\n return f9(n,b)\n return b\ndef f6(n,b):\n while n>=6:\n n//=6\n b+=1\n return f6(n,b)\n return b\nwhile a:\n b,c=0,0\n s=max(1,9**f9(a,b),6**f6(a,c))\n print(s,a)\n a-=s\n p+=1\nprint(p) \n \n ', 'n=int(input())\ns=[]\nt=1000\np=0\ndef f9(n,p):\n while n>=9:\n n//=9\n p+=1\n f9(n,p)\n return p\ndef f6(n,p):\n while n>=6:\n n//=6\n p+=1\n f6(n,p)\n return p \ns.append((n,0))\nwhile s:\n a=s[0][0]\n b=s[0][1]\n if a<6:\n t=min(t,b+a)\n if t>=b+1:\n p=0\n s.append((a-9**f9(a,p),b+1))\n p=0\n s.append((a-6**f6(a,p),b+1))\n s.pop(0) \nprint(t)\n\n\n', 'N=int(input())\ndp=[0]*(N+1)\ndef f(n):\n p=0\n q=0\n m=n\n while n>=1:\n n//=9\n p+=1\n while m>=1:\n m//=6\n q+=1\n s=[]\n for i in range(p):\n s.append(9**i)\n for j in range(q): \n s.append(6**j)\n s.pop(0) \n return s\nfor i in range(1,N+1):\n dp[i]=dp[i-1]+1\n for j in f(i):\n dp[i]=min(dp[i-j]+1,dp[i])\nprint(dp[N]) \n ']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s285017783', 's683841984', 's888880398', 's578606592']
[66920.0, 3064.0, 2940.0, 3828.0]
[2104.0, 17.0, 17.0, 1007.0]
[444, 314, 428, 409]
p03329
u055007876
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['N = int(input())\n\ndef num_withdraw_ll(N):\n dp = [N] * (N + 1)\n dp[0] = 0\n for n in range(1, N):\n dp[n + 1] = min(dp[n + 1], dp[n] + 1)\n coin = 6\n while coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 6\n coin = 9\n while coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 9\n return dp[N] \n\nprint(num_withdraw_ll(N))', 'N = int(input())\n\nef num_withdraw_ll(N):\n dp = [N] * (N + 1)\n dp[0] = 0\n for n in range(0, N):\n dp[n + 1] = min(dp[n + 1], dp[n] + 1)\n coin = 6\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 6\n coin = 9\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 9\n return dp[N]\n\nprint(num_withdraw_ll(N))', 'N = int(input())\n\ndef num_withdraw_ll(N):\n dp = [N] * (N + 1)\n dp[0] = 0\n for n in range(1, N):\n dp[n + 1] = min(dp[n + 1], dp[n] + 1)\n coin = 6\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 6\n coin = 9\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 9\n return dp[N] \n\nprint(num_withdraw_ll(N))', 'N = int(input())\n\ndef num_withdraw_ll(N):\n dp = [N] * (N + 1)\n dp[0] = 0\n for n in range(0, N):\n dp[n + 1] = min(dp[n + 1], dp[n] + 1)\n coin = 6\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 6\n coin = 9\n while n + coin <= N:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\n coin *= 9\n return dp[N]\n\nprint(num_withdraw_ll(N))\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s245550988', 's704179689', 's725325715', 's362781559']
[3828.0, 2940.0, 3828.0, 3828.0]
[209.0, 17.0, 479.0, 453.0]
[438, 441, 446, 443]
p03329
u059210959
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['#encoding utf-8\n\nn = int(input())\n\nwithdraw_list = []\nwithdraw_list.append(1)\n# 6\ncount = 0\nwhile (1):\n count += 1\n if 6**count <=10**5:\n withdraw_list.append(6**count)\n else:\n break\ncount = 0\nwhile (1):\n count += 1\n if 9**count <=10**5:\n withdraw_list.append(9**count)\n else:\n break\nwithdraw_list.sort()\nwithdraw_list.reverse()\nprint(withdraw_list)\n\nwi_cou = 0\nwhile (1):\n for i in range(len(withdraw_list)):\n if withdraw_list[i] <= n:\n n -= withdraw_list[i]\n wi_cou += 1\n # print(withdraw_list[i])\n break\n\n if n == 0:\n break\n\nprint(wi_cou)\n', "# encoding:utf-8\nimport copy\nimport numpy as np\nimport random\nimport queue\n\nn = int(input())\n\nwithdraws = [1]\nprice = 1\nwhile True:\n price *= 6\n if price <= 10**5 and price <= n:\n withdraws.append(price)\n else:\n break\n\nprice = 1\nwhile True:\n price *= 9\n if price <= 10**5 and price <= n:\n withdraws.append(price)\n else:\n break\n\n\nwithdraws.sort()\n# print(withdraws)\nmoney = 0\ncount = 0\n\n\n\n'''\nque = queue.Queue()\n\nque.put((0,0))\nmemory = []\nwhile not(que.empty()):\n money,count = que.get()\n print(money,count)\n if money > n:\n pass\n else:\n for withdraw in withdraws:\n if money+withdraw == n:\n print(count+1)\n exit()\n\n elif money+withdraw in memory:\n pass\n else:\n memory.append(money+withdraw)\n next = (money+withdraw,count+1)\n que.put(next)\n'''\n'''\n# 分割\n\nans = 10**10\nif n < 6:\n ans = n\nfor i in range(n+1):\n t = i\n count = 0\n while t>0:\n count += t%6\n t = t//6\n t = n - i\n while t>0:\n count += t%9\n t = t//9\n # print(ans)\n ans =min(ans,count)\n\nprint(ans)\n\n'''\n\nmax_num = 10**5\ndp = [99999999]*(n+1)\ndp[0] = 0\nfor i in range(1,n+1):\n # print(dp)\n dp[i] = dp[i-1]+1\n k = 6\n while i>=k:\n dp[i] = min(dp[i],dp[i-k]+1)\n k *= 6\n k = 9\n while i>=k:\n dp[i] = min(dp[i],dp[i-k]+1)\n k *= 9\n\n\n\nprint(dp[n])\n"]
['Wrong Answer', 'Accepted']
['s019594580', 's724023168']
[3064.0, 14452.0]
[17.0, 722.0]
[652, 1509]
p03329
u062147869
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['from collections import defaultdict\nN,C = map(int,input().split())\nD=[[int(i) for i in input().split()] for j in range(C)]\nco=[[int(i) for i in input().split()] for j in range(N)]\nd0= defaultdict(int)\nd1= defaultdict(int)\nd2= defaultdict(int)\nfor i in range(N):\n for j in range(N):\n if (j+i) %3==0:\n d0[co[j][i]] +=1\n elif (j+i)%3==1:\n d1[co[j][i]] +=1\n else:\n d2[co[j][i]] +=1\nA0=[]\nA1=[]\nA2=[]\nfor i in range(C):\n iwa =0\n for s in d0.keys():\n iwa += D[s-1][i-1]*d0[s] \n A0.append([iwa,i])\nfor i in range(C):\n iwa =0\n for s in d1.keys():\n iwa += D[s-1][i-1]*d1[s] \n A1.append([iwa,i])\nfor i in range(C):\n iwa =0\n for s in d2.keys():\n iwa += D[s-1][i-1]*d2[s] \n A2.append([iwa,i])\n\nA0.sort()\nA1.sort()\nA2.sort()\nB=[[] for i in range(3)]\nfor i in range(3):\n B[0].append(A0[i])\nfor i in range(3):\n B[1].append(A1[i])\nfor i in range(3):\n B[2].append(A2[i])\nans =[]\nfor i in range(3):\n for j in range(3):\n for k in range(3):\n if B[0][i][1] ==B[1][j][1]:\n continue\n if B[0][i][1] ==B[2][k][1]:\n continue\n if B[1][j][1] ==B[2][k][1]:\n continue\n ans.append(B[0][i][0]+B[1][j][0]+B[2][k][0])\nprint(min(ans))\n', 'N = int(input())\ndef shin(n,q):\n s = n\n a = 0\n while(s>0):\n t=s%q\n a +=t\n s=(s-t)//q\n return a\nans = N\nfor i in range(N+1):\n c=shin(i,6)+shin(N-i,9)\n ans = min(ans,c)\nprint(ans)']
['Runtime Error', 'Accepted']
['s836831060', 's713214916']
[3316.0, 3060.0]
[21.0, 291.0]
[1351, 216]
p03329
u063896676
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['# coding: utf-8\n\n\n# 15:00-\n\n\ndef main():\n N = int(input())\n\n ans = 0\n\n while True:\n if N < 6:\n ans += N\n return ans\n\n n = 0\n while 9**(n+1) <= N:\n n += 1\n \n m = 0\n while 6**(m+1) <= N:\n m += 1\n \n print(N, -9**n, -6**m)\n N -= max(9**n, 6**m)\n ans += 1\n\n\nprint(main())\n', '# coding: utf-8\n\n\n# 15:00-\n\n\ndef main():\n N = int(input())\n INF = 10**6\n\n moneys = [1]\n\n n = 1\n while 9**n <= N:\n moneys.append(9**n)\n n += 1\n\n n = 1\n while 6**n <= N:\n moneys.append(6**n)\n n += 1\n\n dp = [[INF] * (N+1) for _ in range(len(moneys))]\n for i in range(len(dp)):\n dp[i][0] = 0\n \n for i in range(len(dp)):\n for j in range(N+1):\n if j + moneys[i] <= N:\n dp[i][j+moneys[i]] = min(dp[i][j]+1, dp[i][j+moneys[i]])\n if i+1 < len(dp):\n dp[i+1][j+moneys[i]] = min(dp[i][j]+1, dp[i+1][j+moneys[i]])\n if i+1 < len(dp):\n dp[i+1][j] = min(dp[i][j], dp[i+1][j])\n \n return dp[-1][-1]\n\n\nprint(main())\n']
['Wrong Answer', 'Accepted']
['s782211028', 's552155636']
[3060.0, 21204.0]
[18.0, 1526.0]
[432, 806]
p03329
u073775598
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['#ABC099C\nN=int(input())\n#1:6 2:36 3:216 4:1296 5:7776 6:46656 7:9 8:81 9:729 10:6561 11:59049\n#dv=[6,36,216,1296,7776,46656,9,81,729,6561,59049]\nlm=[6, 6, 6, 6, 6, 3, 9, 9, 9, 9, 2]\n#ans=[0]*11\nans=0\nsums=0\nfor i in range(lm[0]):\n for j in range(lm[1]):\n for k in range(lm[2]):\n for l in range(lm[3]):\n for m in range(lm[4]):\n for n in range(lm[5]):\n for o in range(lm[6]):\n for p in range(lm[7]):\n for q in range(lm[8]):\n for r in range(lm[9]):\n for s in range(lm[10]):\n sums=i*6+j*36+k*216+l*1296+m*7776+n*46656+o*9+p*81+q*729+r*6561+s*59049\n if N-sums>=0:\n ans_tmp=N-sums+i+j+k+l+m+n+o+p+q+r+s\n if ans_tmp<ans:\n ans=ans_tmp\nprint(ans)', '#ABC099C\nN=int(input())\ni=0\nt=0\nans=N\nfor i in range(N+1):\n nine = 0\n six = 0\n t=i\n while (t>0):\n nine+=t%9\n t//=9\n t=N-i\n while (t>0):\n six+=t%6\n t//=6\n if ans>nine+six:\n ans=nine+six\nprint(ans)\n']
['Time Limit Exceeded', 'Accepted']
['s407029261', 's541135799']
[3064.0, 3060.0]
[2104.0, 328.0]
[1078, 252]
p03329
u075012704
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
["N = int(input())\ndp = [float('inf')] * (10**5+1)\ndp[0] = 0\n\nfor i in range(1, N+1):\n dp[i] = min(dp[i-1], dp[i-6], dp[i-6**2], dp[i-6**3], dp[i-6**4], dp[i-6**5], dp[i-6**7],\n dp[i-9], dp[i-9**2], dp[i-9**3], dp[i-9**4], dp[i-9**5]) + 1\n\nprint(dp[N])\n", "N = int(input())\ndp = [float('inf')] * (2*10**5+1)\ndp[0] = 0\n\nfor i in range(1, N+1):\n dp[i] = min(dp[i-1], dp[i-6], dp[i-6**2], dp[i-6**3], dp[i-6**4], dp[i-6**5], dp[i-6**7],\n dp[i-9], dp[i-9**2], dp[i-9**3], dp[i-9**4], dp[i-9**5]) + 1\n\nprint(dp[N])\n", "N = int(input())\n\n\ndp = [float('inf')] * (N + 1)\ndp[0] = 0\noperates = sorted([1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049])\nfor i in range(N):\n for ope in operates:\n if i + ope > N:\n break\n dp[i + ope] = min(dp[i + ope], dp[i] + 1)\n\nprint(dp[N])\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s633307911', 's891956226', 's973318895']
[3956.0, 4596.0, 9520.0]
[20.0, 20.0, 516.0]
[269, 271, 348]
p03329
u091051505
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['def calc(money, count):\n if money == n:\n return count\n if money > n:\n return inf\n a = [calc(money+i, count+1) for i in num]\n return min(a)\nimport bisect\ninf = 10 ** 10\nnum = [6 ** i for i in range(7)] + [9 ** i for i in range(1, 6)]\nn = int(input())\nnum = num[:bisect.bisect_left(num, n)]\ncalc(0, 0)', 'n = int(input())\ninf = 10 ** 9\ndp = [inf] * (n+1)\ndp[0] = 0\nfor i in range(n):\n dp[i+1] = min(dp[i]+1, dp[i+1])\n j, k = 1, 1\n while (i + 6**j) <= n:\n dp[i + 6**j] = min(dp[i]+1, dp[i + 6**j])\n j += 1\n while (i + 9**k) <= n:\n dp[i + 9**k] = min(dp[i]+1, dp[i + 9**k])\n k += 1\nprint(dp[-1])']
['Runtime Error', 'Accepted']
['s419955881', 's351929345']
[4248.0, 3828.0]
[2104.0, 1351.0]
[325, 328]
p03329
u095426154
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['n=int(input())\ndp=[i for i in range(n+1)]\nk=0\nlw=[6,9]\nfor w in lw:\n while w**k<=n:\n k+=1\n q=w**k\n for j in range(n+1-q):\n dp[j+q]=min(dp[j]+1,dp[j+q])\n if j==q*w:\n break\nprint(dp[n])', 'n=int(input())\ndp=[i for i in range(n+1)]\nk=0\nlw=[6,9]\nfor w in lw:\n while w**k<=n:\n k+=1\n q=w**k\n for j in range(n+1-q):\n dp[j+q]=min(dp[j]+1,dp[j+q])\n if j==q*(w-1):\n break\nprint(dp[n])', 'n=int(input())\ndp=[i for i in range(n+1)]\nlw=[6,9]\nfor w in lw:\n k=1\n while w**k<=n:\n q=w**k\n for j in range(n+1-q):\n dp[j+q]=min(dp[j]+1,dp[j+q])\n k+=1\nprint(dp[n])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s229471550', 's247600064', 's883477330']
[7064.0, 7064.0, 7064.0]
[81.0, 81.0, 488.0]
[244, 248, 203]
p03329
u102902647
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['# -*- coding: utf-8 -*-\n"""\nCreated on Mon Aug 6 17:34:40 2018\n\n@author: Yuki\n"""\n\n#N = int(input())\nN = 44852\n#candidates = [1, 6, 36, 216, 1296, 7776, 46656,\n# 9, 81, 729, 6561, 59049]\ncandidates = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776,\n 46656, 59049]\ncnt = 0\nwhile True:\n if N == 0:\n break\n for i, cand in enumerate(candidates):\n print(N, cand)\n if N-cand < 0:\n now_draw = candidates[i-1]\n candidates = candidates[:i]\n N -= now_draw\n cnt += 1\n break\n if i == len(candidates) - 1:\n now_draw = candidates[-1]\n N -= now_draw\n cnt += 1\n break\n \nprint(cnt)\n\n\n\n\n', '# -*- coding: utf-8 -*-\n"""\nCreated on Mon Aug 6 17:34:40 2018\n\n@author: Yuki\n"""\n\nN = int(input())\n#N = 44852\n#candidates = [1, 6, 36, 216, 1296, 7776, 46656,\n# 9, 81, 729, 6561, 59049]\ncandidates = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776,\n 46656, 59049]\ncnt = 0\nwhile True:\n if N == 0:\n break\n for i, cand in enumerate(candidates):\n print(N, cand)\n if N-cand < 0:\n now_draw = candidates[i-1]\n candidates = candidates[:i]\n N -= now_draw\n cnt += 1\n break\n if i == len(candidates) - 1:\n now_draw = candidates[-1]\n N -= now_draw\n cnt += 1\n break\n \nprint(cnt)\n\n\n\n\n', '# -*- coding: utf-8 -*-\n"""\nCreated on Mon Aug 6 17:34:40 2018\n\n@author: Yuki\n"""\n\nans = [0] * 100100\nans[0] = 0\n\nn = int(input())\n#n = 127\nfor i in range(1,n+1):\n cand1 = ans[i-1]\n cand2 = 100001\n cand3 = 100001\n x = 6\n while (x<=i):\n #cand2 = min(ans[i-x], cand2)\n cand2 = ans[i-x]\n x=6*x\n y = 9\n while (y<=i):\n #cand3 = min(ans[i-y], cand3)\n cand3 = ans[i-y]\n y=9*y\n ans[i] = min(cand1,cand2,cand3) + 1\n\n\nprint(ans[n])\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s834678321', 's959949237', 's561010314']
[3064.0, 3064.0, 3828.0]
[17.0, 17.0, 334.0]
[737, 737, 490]
p03329
u105124953
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
["import math\n#n = int(input())\nn = 44852\ninf = float('inf')\n\ndp = [inf]*(n+10000000)\ndp[0]=0\n#print(dp)\n#print(len(dp))\n\ndef motome(target):\n tmp = []\n a = int(math.log(target,9))\n b = int(math.log(target,6))\n for i in range(a+1):\n tmp.append(6**i)\n for j in range(b+1):\n tmp.append(9**j)\n #print(tmp) [1, 6, 36, 1, 9, 81]\n #print(dp)\n for k in range(1,target+1):\n for t in sorted(list(set(tmp))):\n if k-t>=0:\n dp[k] = min(dp[k],1 + dp[k-t])\n '''\n try:\n dp[k] = min(dp[k],1 + min([dp[k-t] for t in tmp]))\n except:\n print(len(dp),dp[k-t],dp[k])\n pass\n '''\n #print(k)\n #print([t for t in tmp])\n #print([dp[k-t] for t in tmp])\n\nmotome(n)\n#print(dp[n-1])\nprint(dp[n])", "n = int(input())\ninf = float('inf')\ndp = [inf]*(n+1)\ndp[0] = 0\na = 1\nb = 6\nc = 9\nfor i in range(1,n+1):\n if i>=b*6:\n b*=6\n if i>=c*9:\n c*=9\n if i<6:\n dp[i] = i\n elif i<9:\n dp[i] = min(dp[i],dp[i-b]+1)\n else:\n dp[i] = min(dp[i],dp[i-b]+1,dp[i-c]+1)\nprint(dp[n])"]
['Wrong Answer', 'Accepted']
['s970138607', 's201841752']
[81524.0, 3828.0]
[394.0, 100.0]
[871, 310]
p03329
u118642796
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['num = [i for i in range(0,100001)]\n\nfor j in range(1,100001):\n num[j] = j//6 + num[j%6]\n\nfor j in range(1,100001):\n num[j] = min(num[j],j//9+num[j%9])\n\nfor j in range(1,100001):\n num[j] = min(num[j],j//36+num[j%36])\n\nfor j in range(81,324):\n num[j] = min(num[j],1+num[j-81])\nfor j in range(162,324):\n num[j] = min(num[j],2+num[j-162])\nfor j in range(243,324):\n num[j] = min(num[j],3+num[j-243])\nfor j in range(324,100001):\n num[j] = (j//324)*4 + num[j%234]\n\nfor j in range(216,648):\n num[j] = min(num[j],1+num[j-216])\nfor j in range(432,648):\n num[j] = min(num[j],2+num[j-216*2])\nfor j in range(648,100001):\n num[j] = (j//648)*3 + num[j%648]\n\nfor i in range(1,8):\n for j in range(729*i,729*8):\n num[j] = min(num[j],i+num[j-729*i])\nfor j in range(729*8,100001):\n num[j] = (j//(729*8))*8+num[j%(729*8)]\n\nMoneyYouCanGet = [6**4,9**4,6**5,6**6,9**5]\n\nfor i in MoneyYouCanGet:\n for j in range(1,100001):\n k = 1\n while k*i<j:\n num[j] = min(num[j],k+num[j-k*i])\n k += 1\n\nN = int(input())\nprint(num[N])', 'num = [i for i in range(0,100001)]\n\nfor j in range(1,100001):\n num[j] = j//6 + num[j%6]\n\nfor j in range(1,100001):\n num[j] = min(num[j],j//9+num[j%9])\n\nfor j in range(1,100001):\n num[j] = min(num[j],j//36+num[j%36])\n\nfor j in range(81,324):\n num[j] = min(num[j],1+num[j-81])\nfor j in range(162,324):\n num[j] = min(num[j],2+num[j-162])\nfor j in range(243,324):\n num[j] = min(num[j],3+num[j-243])\nfor j in range(324,100001):\n num[j] = min(num[j],(j//324)*4 + num[j%234])\n\nfor j in range(216,648):\n num[j] = min(num[j],1+num[j-216])\nfor j in range(432,648):\n num[j] = min(num[j],2+num[j-216*2])\nfor j in range(648,100001):\n num[j] = min(num[j],(j//648)*3 + num[j%648])\n\nfor i in range(1,8):\n for j in range(729*i,729*8):\n num[j] = min(num[j],i+num[j-729*i])\nfor j in range(729*8,100001):\n num[j] = min(num[j],(j//(729*8))*8+num[j%(729*8)])\n\nfor i in range(1,9):\n for j in range((6**4)*i,(6**4)*9):\n num[j] = min(num[j],i+num[j-(6**4)*i])\nfor j in range((6**4)*9,100001):\n num[j] = min(num[j],(j//((6**4)*9))*9+num[j%((6**4)*9)])\n\nfor i in range(1,2**4):\n for j in range((9**4)*i,(9**4)*(2**4)):\n num[j] = min(num[j],i+num[j-(9**4)*i])\nfor j in range((9**4)*(2**4),100001):\n num[j] = min(num[j],(j//((9**4)*(2**4)))*(2**4)+num[j%((6**4)*(2**4))])\n\nMoneyYouCanGet = [6**5,6**6,9**5]\n\nfor i in MoneyYouCanGet:\n for j in range(1,100001):\n k = 1\n while k*i<j:\n num[j] = min(num[j],k+num[j-k*i])\n k += 1\n\nN = int(input())\nprint(num[N])', 'SixNum = [i for i in range(0,100001)]\nfor i in range(1,7):\n for j in range(1,100001):\n SixNum[j] = min(SixNum[j],j//(6**i) + SixNum[j%(6**i)])\n\nNineNum = [i for i in range(0,100001)]\nfor i in range(1,6):\n for j in range(1,100001):\n NineNum[j] = min(NineNum[j],j//(9**i) + NineNum[j%(9**i)])\n\nN = int(input())\nans = 100001\nfor i in range(0,N+1):\n ans = min(ans,SixNum[i]+NineNum[N-i])\nprint(ans)']
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s782820589', 's786363031', 's567318293']
[7112.0, 7104.0, 7804.0]
[2104.0, 489.0, 1234.0]
[1176, 1666, 445]
p03329
u123896133
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['N=int(input())\nans=N\ndef func1():\n global ans\n for i in range(N+1):\n cnt=0\n t=i\n while(t>0):\n cnt+=t%6\n t/=6\n t=int(t)\n t=N-i\n while(t>0):\n cnt+=t%9\n t/=9\n t=int(t)\n print(cnt)\n if(ans>cnt):\n ans=cnt\n return ans\n\nfunc1()\nprint(ans)', 'N=int(input())\na,b,cnt=0,0,0\ndef nine():\n global a\n for i in range(N):\n if 9**i<=N:\n a=9**i\n else:\n break\ndef six():\n global b\n for i in range(N):\n if 6**i<=N:\n b=6**i\n else:\n break\n\nfor i in range(N):\n nine()\n six()\n N-=max(a,b) \n cnt+=1\n print(N,a,b,cnt)\n if N==0:\n break\nprint(cnt)', 'N=int(input())\nans=N\ndef func1():\n global ans\n for i in range(N+1):\n cnt=0\n t=i\n while(t>0):\n cnt+=t%6\n t/=6\n t=int(t)\n t=N-i\n while(t>0):\n cnt+=t%9\n t/=9\n t=int(t)\n if(ans>cnt):\n ans=cnt\n return ans\n\nfunc1()\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s275840784', 's554124242', 's654706753']
[3784.0, 3064.0, 3064.0]
[402.0, 20.0, 329.0]
[366, 400, 347]
p03329
u127499732
2,000
262,144
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw exactly N yen in total? It is not allowed to re-deposit the money you withdrew.
['n = int(input())\nc9 = 0\nm = n\nwhile(m>1):\n m = m//9\n if m !== 0: \n \tpass\n else:\n c9 += 1\nm = n - 9**c9\n\nc6 = 0\nwhile(m>1):\n m = m//9\n if m !== 0: \n \tpass\n else:\n c6 += 1\n \nc1 = n - (9**c9+c6**c6)\nprint(c9+c6+c1) ', 'n = int(input())\nl9 = [9**i for i in range(0,6)]\nl6 = [6**i for i in range(0,6)]\nl = sorted(l9+l6,reverse=True)\nprint(l)\ni = 0\nans = 0\nwhile(n>0):\n if n - l[i] < 0:\n i += 1\n n = n\n else:\n ans+=1\n #print(n,"-",l[i],"=",n-l[i],"ans=",ans)\n n = n - l[i]\n \nprint(ans)', "def main():\n import bisect\n n = int(input())\n m = [10 ** 5 for _ in range(n + 1)]\n m[0] = 0\n a = [6 ** i for i in range(7)]\n b = [9 ** i for i in range(6)]\n c = sorted(a + b)\n for i in range(1, n + 1):\n j = bisect.bisect_right(c, i)\n k = [1 + m[i - x] for l, x in enumerate(c) if l < j]\n m[i] = min(k)\n\n print(m[-1])\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s184703189', 's542419147', 's273502306']
[2940.0, 3064.0, 3864.0]
[17.0, 18.0, 290.0]
[229, 283, 405]