s_id
string
p_id
string
u_id
string
date
string
language
string
original_language
string
filename_ext
string
status
string
cpu_time
string
memory
string
code_size
string
code
string
error
string
stdout
string
s755477275
p04001
u340153434
1566160905
Python
Python (3.4.3)
py
Runtime Error
20
3060
296
S = input() n = len(S)-1 total_num = 0 for i in range(2**n): num = '' for j in range(n): if i & 2**j: num += S[j] total_num += int(num) num = '' else: num += S[j] num += S[j+1] total_num += int(num) print(total_num)
Traceback (most recent call last): File "/tmp/tmpmv17na2m/tmpfrzynwlm.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s242486012
p04001
u102126195
1566047438
Python
PyPy3 (2.4.0)
py
Runtime Error
199
40496
431
S = input() S_len = len(S) - 1 p = [] for i in range(2 ** S_len): tmp = bin(i)[2::] while len(tmp) < S_len: tmp = "0" + tmp p.append(str(tmp)) sum = 0 for i in p: P = list(i) tmp = int(S[0]) cnt = 1 for j in P: if j == "0": tmp *= 10 tmp += int(S[cnt]) else: sum += tmp tmp = int(S[cnt]) cnt += 1 sum += tmp print(sum)
Traceback (most recent call last): File "/tmp/tmpa4clyrpf/tmpd22xncci.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s012193765
p04001
u412255932
1565962874
Python
Python (3.4.3)
py
Runtime Error
20
3060
240
S = int(input()) def dfs(res, depth, path, S): res.append(path) if depth == len(S) - 1: return for i in range(depth + 1, len(S)): dfs(res, i, int(S[depth:i+1]), S) res = [] dfs(res, -1, [], S) print(sum(res))
Traceback (most recent call last): File "/tmp/tmphoen9zlx/tmpa6w09nd_.py", line 1, in <module> S = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s572497347
p04001
u548684908
1565812017
Python
Python (3.4.3)
py
Runtime Error
18
3060
291
s = list(input()) def sum_list(S,stock): if len(S) == 2: return int(S[0]) + int(S[1]) + int(S[0]+S[1]) + stock * 2 else: return sum_list(S[1:],int(S[0])+stock) + sum_list([S[0]+S[1]]+S[2:],stock) print(sum_list(s,0))
Traceback (most recent call last): File "/tmp/tmp2k7y4n1p/tmpv5ftspic.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s374680520
p04001
u537782349
1564588858
Python
Python (3.4.3)
py
Runtime Error
19
3064
476
def clc(a, b, c, p, t): if c == 0: b = a[0] return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t) elif c == len(a)-1: if p: return t + int(b) + int(a[c]) else: return t + int(b + a[c]) else: if p: t += int(b) b = a[c] else: b += a[c] return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t) s = input() print(clc(s, "", 0, True, 0))
Traceback (most recent call last): File "/tmp/tmppml0p0ry/tmpk3v07a4l.py", line 19, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s986933215
p04001
u708255304
1564185701
Python
Python (3.4.3)
py
Runtime Error
17
2940
238
S = str(input()) ans = "" for mask in range(1 << (len(S)-1)): for i in range(len(S)): if ((mask >> i) & 1): ans += f"{S[i]}+" else: ans += f"{S[i]}" ans += "+" print(int(eval(ans[:-1])))
Traceback (most recent call last): File "/tmp/tmpfu6qxva8/tmp2xg0_nki.py", line 1, in <module> S = str(input()) ^^^^^^^ EOFError: EOF when reading a line
s136257407
p04001
u708255304
1564185452
Python
Python (3.4.3)
py
Runtime Error
18
3188
235
S = str(input()) ans = "" for mask in range(1 << (len(S)-1)): for i in range(len(S)): if (mask >> i) & 1: ans += f"{S[i]}+" else: ans += f"{S[i]}" ans += "+" print(int(eval(ans[:-1])))
Traceback (most recent call last): File "/tmp/tmpp_i0nu98/tmp9vkiuv0a.py", line 1, in <module> S = str(input()) ^^^^^^^ EOFError: EOF when reading a line
s771509884
p04001
u708255304
1564185368
Python
Python (3.4.3)
py
Runtime Error
17
2940
230
S = str(input()) ans = "" for mask in range(1 << (len(S)-1)): for i in range(len(S)): if (mask >> i) & 1: ans += f"{S[i]}+" else: ans += f"{S[i]}" ans += "+" print(eval(ans[:-1]))
Traceback (most recent call last): File "/tmp/tmpjbbsxww8/tmpo89xvqjx.py", line 1, in <module> S = str(input()) ^^^^^^^ EOFError: EOF when reading a line
s978627464
p04001
u537782349
1563669323
Python
Python (3.4.3)
py
Runtime Error
17
3064
461
def f(a, b, le, tf): b[le] = tf if le == len(b)-1: t = "" s1 = 0 for i in range(len(b)): t += a[i] if b[i] == 1: s1 += int(t) t = "" t += a[len(b)] s1 += int(t) return s1 else: return f(a, b, le+1, 0) + f(a, b, le+1, 1) aa = input() bb = [0] * (len(aa)-1) if len(a) == 1: print(a) else: print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))
Traceback (most recent call last): File "/tmp/tmpmmygk9qh/tmp5fk058fm.py", line 18, in <module> aa = input() ^^^^^^^ EOFError: EOF when reading a line
s472929045
p04001
u537782349
1563669256
Python
Python (3.4.3)
py
Runtime Error
21
3316
423
def f(a, b, le, tf): b[le] = tf if le == len(b)-1: t = "" s1 = 0 for i in range(len(b)): t += a[i] if b[i] == 1: s1 += int(t) t = "" t += a[len(b)] s1 += int(t) return s1 else: return f(a, b, le+1, 0) + f(a, b, le+1, 1) aa = input() bb = [0] * (len(aa)-1) print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))
Traceback (most recent call last): File "/tmp/tmpmqm28aso/tmpi6g7idpm.py", line 18, in <module> aa = input() ^^^^^^^ EOFError: EOF when reading a line
s086095887
p04001
u836939578
1563564614
Python
Python (3.4.3)
py
Runtime Error
17
3060
298
s = input() op_n = len(s) - 1 ans = 0 for i in range(1 << op_n): sign = [""] * op_n for j in range(op_n): if ((i>>j)&1): sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpg733no2v/tmp180b5dwe.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s260196335
p04001
u836939578
1563564327
Python
Python (3.4.3)
py
Runtime Error
17
3060
295
s=input() op_n=len(s) - 1 ans=0 for i in range(1 << op_n): sign = [""] * op_n for j in range(op_n): if ((i>>j)&1)==1: sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpp6cv_05l/tmp_sthcdsw.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s584974429
p04001
u836939578
1563564274
Python
Python (3.4.3)
py
Runtime Error
17
3060
297
s=input() op_n=len(s) - 1 ans=0 for i in range(1 << len(s)): sign = [""] * op_n for j in range(op_n): if ((i>>j)&1)==1: sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmprpl8xtlm/tmpagof7jp4.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s050608083
p04001
u836939578
1563564191
Python
Python (3.4.3)
py
Runtime Error
18
3064
301
s=input() op_n=len(s) - 1 ans=0 for i in range(1 << len(s)): sign = [""] * op_n for j in range(op_n): if ((i>>j) and 1)==1: sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpoun2jzgl/tmpfx_vx9ae.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s039193208
p04001
u836939578
1563564156
Python
Python (3.4.3)
py
Runtime Error
18
3060
295
s=input() op_n=len(s) - 1 ans=0 for i in range(1 << len(s)): sign = [""] * op_n for j in range(op_n): if ((i>>j)==1): sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpd5g3bs4y/tmpmkg77w4i.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s605514735
p04001
u836939578
1563563736
Python
Python (3.4.3)
py
Runtime Error
17
3060
294
s=input() op_n=len(s) - 1 ans=0 for i in range(1 << len(s)): sign = [""] * op_n for j in range(op_n): if ((i>>j)==1): sign[j] = "+" formula = "" for k in range(op_n): formula += s[k] + sign[k] formula += s[op-n] ans = eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpyuvhnxz5/tmpcjzm89w1.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s968869675
p04001
u135847648
1563048442
Python
Python (3.4.3)
py
Runtime Error
38
3316
369
S = input() print(S[0],S[1]) cnt = len(S) - 1 #数字の間の数 ans = 0 for i in range(2 ** cnt): sign = [""] * cnt for j in range(cnt): if ((i>>j)&1): sign[j] = "+" formula = "" for k in range(cnt): formula += S[k] + sign[k] print(sign) formula += S[cnt] print(formula,i) ans += eval(formula) print(ans)
Traceback (most recent call last): File "/tmp/tmpn35n21lc/tmpd_spd7ks.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s301729557
p04001
u102461423
1562864681
Python
Python (3.4.3)
py
Runtime Error
238
16976
922
import sys input = sys.stdin.readline from scipy.sparse import csr_matrix from scipy.sparse.csgraph import dijkstra """ (駅、会社)を頂点にグラフを持つ。頂点数O(M)。 そのまま辺を貼ると辺が多くなりすぎる。 (駅、会社) -> (駅、無属性) -> (駅、会社) """ N,M = map(int,input().split()) PQC = [[int(x) for x in input().split()] for _ in range(M)] U = 10 ** 6 V = set(range(1,N+1)) V |= set(p + c * U for p,q,c in PQC) V |= set(q + c * U for p,q,c in PQC) V = tuple(V) v_to_i = {v:i for i,v in enumerate(V)} # グラフを作成 rows, cols = [],[] rows += [i for i,pc in enumerate(V) if pc > U] cols += [v_to_i[pc % U] for i,pc in enumerate(V) if pc > U] wt = [1] * len(rows) rows += [v_to_i[p + c * U] for p,q,c in PQC] cols += [v_to_i[q + c * U] for p,q,c in PQC] wt += [0] * M graph = csr_matrix((wt, (rows, cols)), (len(V), len(V))) start = v_to_i[1] goal = v_to_i[N]
Traceback (most recent call last): File "/tmp/tmpfle6jv1e/tmp_o5za2ul.py", line 12, in <module> N,M = map(int,input().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s972042868
p04001
u374051158
1561557634
Python
Python (3.4.3)
py
Runtime Error
17
2940
168
S = input() ans = 0 for p in itertools.product(['', '+'], repeat = len(S) - 1): cmd = ''.join([s + t for s, t in zip(S, p)]) + S[-1] ans += eval(cmd) print(ans)
Traceback (most recent call last): File "/tmp/tmp_3wrwt_6/tmpp3qu0bn6.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s400862312
p04001
u914992391
1560642147
Python
Python (3.4.3)
py
Runtime Error
19
3064
438
from sys import stdin def main(): S=input() andbit = 2**10 -1 ans = 0 length = 2**(len(S) -1) for i in range (length): bitup = andbit & i bitcheck = 1 tmp=0 for j in range(1,len(S),1): if bitup & bitcheck > 0: ans += int(S[tmp:j]) tmp = j bitcheck = bitcheck << 1 ans += int(S[tmp:len(S)]) print(ans) input = lambda: stdin.readline() main()
Traceback (most recent call last): File "/tmp/tmpbgv5j8bv/tmp4wlrh6bg.py", line 22, in <module> main() File "/tmp/tmpbgv5j8bv/tmp4wlrh6bg.py", line 9, in main for i in range (length): ^^^^^^^^^^^^^^ TypeError: 'float' object cannot be interpreted as an integer
s043319306
p04001
u914992391
1560641123
Python
Python (3.4.3)
py
Runtime Error
19
3064
438
from sys import stdin def main(): S=input() andbit = 2**10 -1 ans = 0 length = 2**(len(S) -1) for i in range (length): bitup = andbit & i bitcheck = 1 tmp=0 for j in range(1,len(S),1): if bitup & bitcheck > 0: ans += int(S[tmp:j]) tmp = j bitcheck = bitcheck << 1 ans += int(S[tmp:len(S)]) print(ans) input = lambda: stdin.readline() main()
Traceback (most recent call last): File "/tmp/tmp36olh7yt/tmpu7tesc_0.py", line 22, in <module> main() File "/tmp/tmp36olh7yt/tmpu7tesc_0.py", line 9, in main for i in range (length): ^^^^^^^^^^^^^^ TypeError: 'float' object cannot be interpreted as an integer
s272707119
p04001
u914992391
1560641018
Python
Python (3.4.3)
py
Runtime Error
19
3064
699
from sys import stdin def main(): S=input() andbit = 2**10 -1 ans = 0 length = 2**(len(S) -1) # print("length:{}".format(length)) for i in range (length): bitup = andbit & i # print("bin(bitup):{}".format(bin(bitup))) bitcheck = 1 tmp=0 for j in range(1,len(S),1): # print("bitup & bitcheck:{}".format(bitup & bitcheck)) if bitup & bitcheck > 0: # print("S[tmp:j]:{}".format(S[tmp:j])) ans += int(S[tmp:j]) tmp = j bitcheck = bitcheck << 1 # print("S[tmp:len(S)]:{}".format(S[tmp:len(S)])) ans += int(S[tmp:len(S)]) print(ans) input = lambda: stdin.readline() main()
Traceback (most recent call last): File "/tmp/tmpspv_iz4f/tmp15sv_sxg.py", line 28, in <module> main() File "/tmp/tmpspv_iz4f/tmp15sv_sxg.py", line 10, in main for i in range (length): ^^^^^^^^^^^^^^ TypeError: 'float' object cannot be interpreted as an integer
s400893401
p04001
u825842302
1560464425
Python
Python (3.4.3)
py
Runtime Error
17
2940
287
s = input() n = (len(s) - 1) ans_lst = [] for i in range(2**n): op = ["+"] * n for j in range(n): if ((i >> j) & 1): op[n-j-1] = "" for num,opp in zip(s, op + [""]): formula += (num + opp) ans_lst = ans_lst + [eval(formula)] print(sum(ans_lst))
File "/tmp/tmpb3fnzp86/tmpg7x7jhx7.py", line 6 op = ["+"] * n ^ IndentationError: expected an indented block after 'for' statement on line 5
s015412630
p04001
u977193988
1559941434
Python
Python (3.4.3)
py
Runtime Error
17
2940
185
S=input() n=len(S) ans=0 for i in range(1<<(n-1)): for j in range(n): if 1&(i>>j): ans+=int(S[k:j+1]) k=j+1 ans+=int(S[k:]) print(ans)
Traceback (most recent call last): File "/tmp/tmpdi4kr0xe/tmpw62w5b2u.py", line 1, in <module> S=input() ^^^^^^^ EOFError: EOF when reading a line
s557512350
p04001
u566264434
1559779392
Python
Python (3.4.3)
py
Runtime Error
17
2940
226
S=input() c=0 op_cnt=len(S)-1 for i in range(2**op_cnt): T="" for j in range(2**op_cnt): T += S[j] if ((i>>j) & 1): T += "+" print(j) T += S[op_cnt] c +=eval(T) print(c)
Traceback (most recent call last): File "/tmp/tmp6sb0u4oj/tmpxvvbmuea.py", line 1, in <module> S=input() ^^^^^^^ EOFError: EOF when reading a line
s069392017
p04001
u524039871
1559703532
Python
Python (3.4.3)
py
Runtime Error
29
3064
309
s=input() sl=[] ans=0 for iii in range(2**(len(s)-1)): sind='{:0'+str(len(s)-1)+'b}' astr=sind.format(iii) astr=astr.replace("1","+") astr=astr.replace("0","x") lans=s[0] for jjj in range(len(astr)): lans+=astr[jjj]+s[jjj+1] lans=lans.replace("x","") ans+=int(eval(lans)) print(ans)
Traceback (most recent call last): File "/tmp/tmpibhb8lm0/tmp1uec80y4.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s128293605
p04001
u736524428
1559542630
Python
Python (3.4.3)
py
Runtime Error
17
3060
794
s = input() max_plus = len(s) - 1 numList = [int(c) for c in s] sMax = (1 << max_plus) - 1 ans = 0 for plus_pos in range(sMax + 1): sum = 0 num = numList[0] for i in range(max_plus): if ((plus_pos >> i) & 1) == 1: sum += num num = numList[i + 1] else: num = num * 10 + numList[i + 1] sum += num ans += sum print(ans)s = input() max_plus = len(s) - 1 numList = [int(c) for c in s] sMax = (1 << max_plus) - 1 ans = 0 for plus_pos in range(sMax + 1): sum = 0 num = numList[0] for i in range(max_plus): if ((plus_pos >> i) & 1) == 1: sum += num num = numList[i + 1] else: num = num * 10 + numList[i + 1] sum += num ans += sum print(ans)
File "/tmp/tmpaxpljckm/tmpfh8djmva.py", line 26 print(ans)s = input() ^ SyntaxError: invalid syntax
s772757338
p04001
u638320267
1559446044
Python
Python (3.4.3)
py
Runtime Error
17
3064
426
s = input() sum = 0 for i in range(2**(len(s)-1)): term = 0 for j in range(len(s)-1): term *= 10 if (i//(2**j))%2 == 0: sum += term + int(s[j]) term = 0 if j == len(s)-2: sum += int(s[-1]) else: term += int(s[j]) if j == len(s)-2: sum += term*10 + int(s[-1]) if len(s) = 1: sum = int(s) print(sum)
File "/tmp/tmpcnlwxlis/tmpb4ue51j3.py", line 16 if len(s) = 1: ^^^^^^ SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
s006990767
p04001
u867005447
1559178277
Python
Python (3.4.3)
py
Runtime Error
20
3064
455
num = input() num_array = [i for i in num] splits = len(num) - 1 n = 2 ** splits sum = 0 for i in range(n): bin = format(i, "0{}b".format(splits)) bin_array = [i for i in bin] tmp_num = str(num_array[0]) for index, value in enumerate(bin_array): if value == "0": tmp_num += num_array[index+1] else: sum += int(tmp_num) tmp_num = num_array[index+1] sum += int(tmp_num) print(sum)
Traceback (most recent call last): File "/tmp/tmpaa_cch5y/tmpd35suyfy.py", line 2, in <module> num = input() ^^^^^^^ EOFError: EOF when reading a line
s461238298
p04001
u805403870
1559025599
Python
Python (3.4.3)
py
Runtime Error
21
3064
394
s = input() answer = 0 sumList = [] numStr = "" for i in range(2**(len(s)-1)): bit = "0" + str(len(s) - 1) + "b" iStr = format(i, bit) numStr += s[0] for j in range(len(iStr)): if iStr[j] == "1": sumList.append(int(numStr)) numStr = s[j+1] else: numStr += s[j+1] sumList.append(int(numStr)) numStr = "" answer += sum(sumList) sumList = [] print(answer)
Traceback (most recent call last): File "/tmp/tmp88eih30w/tmpu6o9ltjl.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s471606401
p04001
u537962130
1558441206
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38256
198
N=input() ans=0 l=itertools.product(range(2),repeat=len(N)-1) for i in l: tmp='' for j in range(len(i)): if i[j]==0: tmp+=N[j] else: tmp+=N[j]+'+' tmp+=N[-1] ans+=eval(tmp) print(ans)
Traceback (most recent call last): File "/tmp/tmp6eybd5fp/tmped54cw_e.py", line 1, in <module> N=input() ^^^^^^^ EOFError: EOF when reading a line
s313869625
p04001
u497596438
1558380331
Python
PyPy3 (2.4.0)
py
Runtime Error
184
39792
273
S=input() ans=0 for i in range(2**(len(S)-1)): k=bin(i)[2:].zfill(len(S)-1) l=int(S[0]) for j in range(len(k)): t=int(k[j]) if t==1: ans+=l l=int(S[j+1]) else: l=l*10+int(S[j+1]) ans+=l print(ans)
Traceback (most recent call last): File "/tmp/tmp8c_yfl0_/tmphn5mizy3.py", line 1, in <module> S=input() ^^^^^^^ EOFError: EOF when reading a line
s099252536
p04001
u292810930
1557116813
Python
Python (3.4.3)
py
Runtime Error
18
2940
199
S=list(map(int,list(input()))) def manyformulas(s): if len(s)==1: return s[0] return s[0]*2**(len(s)-2)+manyformulas(s[1:])+manyformulas([s[0]*10+s[1], *s[2:]]) print(manyformulas(S))
Traceback (most recent call last): File "/tmp/tmp0fwwzeh3/tmpvgdso9la.py", line 1, in <module> S=list(map(int,list(input()))) ^^^^^^^ EOFError: EOF when reading a line
s507392584
p04001
u872887731
1556756266
Python
Python (3.4.3)
py
Runtime Error
18
3060
221
from itertools import product S = input() ans = 0 for string in product(["","+"],repeat=len(S) - 1): string = list(string) string.append("") sum_ = [a + b for a,b in zip(S,string)] ans += sum_ print(ans)
Traceback (most recent call last): File "/tmp/tmpp4_eeevz/tmppsrekdkh.py", line 2, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s734991013
p04001
u791050038
1556047040
Python
Python (3.4.3)
py
Runtime Error
17
3060
333
sum = 0 A = list(map(int, input().split)) def makenum(ar): s = 0 for i in range(len(ar)): s += ar[i] * (10 ** (len(ar) - i - 1)) return s for i in range(1 << len(A)): output = [] for j in range(len(A)): if((i >> j) & 1) == 1: output.append(A[j]) sum += makenum(output) print(sum)
Traceback (most recent call last): File "/tmp/tmpbi4mpu_t/tmpeuu7eetn.py", line 2, in <module> A = list(map(int, input().split)) ^^^^^^^ EOFError: EOF when reading a line
s715571191
p04001
u573970531
1555427566
Python
Python (3.4.3)
py
Runtime Error
21
3064
313
#import sys #input=sys.stdin.readline s=input() ans=0 for i in range(2 ** (len(s)-1)): bin_i = bin(i)[2:].rjust(len(s)-1,"0") li=[] n=s[0] for ix,sign in enumerate(bin_i): if sign=="0": n+=s[ix+1] else: li.append(int(n)) n=s[ix+1] li.append(int(n)) ans+=sum(li) print(ans)
Traceback (most recent call last): File "/tmp/tmp4ptoz7oc/tmp9_xaj2km.py", line 4, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s815071690
p04001
u573970531
1555427453
Python
Python (3.4.3)
py
Runtime Error
20
3064
335
#import sys #input=sys.stdin.readline s=input() ans=0 for i in range(2 ** (len(s)-1)): bin_i = bin(i)[2:].rjust(len(s)-1,"0") li=[] n=s[0] #0がなし、1が+ for ix,sign in enumerate(bin_i): if sign=="0": n+=s[ix+1] else: li.append(int(n)) n=s[ix+1] li.append(int(n)) ans+=sum(li) print(ans)
Traceback (most recent call last): File "/tmp/tmp_jhlxnjf/tmp5krw4bav.py", line 4, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s039627399
p04001
u573970531
1555427248
Python
Python (3.4.3)
py
Runtime Error
17
3064
333
import sys input=sys.stdin.readline s=input() ans=0 for i in range(2 ** (len(s)-1)): bin_i = bin(i)[2:].rjust(len(s)-1,"0") li=[] n=s[0] #0がなし、1が+ for ix,sign in enumerate(bin_i): if sign=="0": n+=s[ix+1] else: li.append(int(n)) n=s[ix+1] li.append(int(n)) ans+=sum(li) print(ans)
Traceback (most recent call last): File "/tmp/tmpvx8kc5ov/tmpj0cdreix.py", line 7, in <module> for i in range(2 ** (len(s)-1)): ^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'float' object cannot be interpreted as an integer
s066854928
p04001
u201856486
1554727444
Python
Python (3.4.3)
py
Runtime Error
19
3192
4952
import sys # import bisect # import math # import itertools # import numpy as np # import collections """Template""" class IP: """ 入力を取得するクラス """ def __init__(self): self.input = sys.stdin.readline def I(self): """ 1文字の取得に使います :return: int """ return int(self.input()) def S(self): """ 1文字の取得(str :return: str """ return self.input() def IL(self): """ 1行を空白で区切りリストにします(int :return: リスト """ return list(map(int, self.input().split())) def SL(self): """ 1行の文字列を空白区切りでリストにします :return: リスト """ return list(map(str, self.input().split())) def ILS(self, n): """ 1列丸々取得します(int :param n: 行数 :return: リスト """ return [int(self.input()) for _ in range(n)] def SLS(self, n): """ 1列丸々取得します(str :param n: 行数 :return: リスト """ return [self.input() for _ in range(n)] def SILS(self, n): """ Some Int LineS 横に複数、縦にも複数 :param n: 行数 :return: list """ return [self.IL() for _ in range(n)] def SSLS(self, n): """ Some String LineS :param n: 行数 :return: list """ return [self.SL() for _ in range(n)] class Idea: def __init__(self): pass def HF(self, p): """ Half enumeration 半分全列挙です pの要素の和の組み合わせを作ります。 ソート、重複削除行います :param p: list : 元となるリスト :return: list : 組み合わせられた和のリスト """ return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p)))) def Bfs2(self, a): """ bit_full_search2 bit全探索の改良版 全探索させたら2進数のリストと10進数のリストを返す :return: list2つ : 1個目 2進数(16桁) 2個目 10進数 """ # 参考 # https://blog.rossywhite.com/2018/08/06/bit-search/ # https://atcoder.jp/contests/abc105/submissions/4088632 value = [] for i in range(1 << len(a)): output = [] for j in range(len(a)): if self.bit_o(i, j): """右からj+1番目のiが1かどうか判定""" # output.append(a[j]) output.append(a[j]) value.append([format(i, 'b').zfill(16), sum(output)]) value.sort(key=lambda x: x[1]) bin = [value[k][0] for k in range(len(value))] val = [value[k][1] for k in range(len(value))] return bin, val def S(self, s, r=0, m=-1): """ ソート関係行います。色々な設定あります。 :param s: 元となるリスト :param r: reversするかどうか 0=False 1=True :param m: (2次元配列)何番目のインデックスのソートなのか :return: None """ r = bool(r) if m == -1: s.sort(reverse=r) else: s.sort(reverse=r, key=lambda x: x[m]) def bit_n(self, a, b): """ bit探索で使います。0以上のときにTrue出します 自然数だからn :param a: int :param b: int :return: bool """ return bool((a >> b & 1) > 0) def bit_o(self, a, b): """ bit探索で使います。1のときにTrue出すよ oneで1 :param a: int :param b: int :return: bool """ return bool(((a >> b) & 1) == 1) def ceil(self, x, y): """ Round up 小数点切り上げ割り算 :param x: int :param y: int :return: int """ return -(-x // y) def ave(self, a): """ 平均を求めます :param a: list :return: int """ return sum(a) / len(a) def gcd(self, x, y): if y == 0: return x else: return self.gcd(y, x % y) """ここからメインコード""" def main(): # 1文字に省略 r, e, p = range, enumerate, print ip = IP() id = Idea() mod = 10 ** 9 + 7 """この下から書いてね""" s = ip.S() ans = 0 for i in r(1 << len(s)): output = 0 res = 0 for j in r(len(s)): if (i >> j) & 1: output += int(s[res:j + 1]) res += j + 1 output += int(s[res:]) ans += output p(ans) main()
Traceback (most recent call last): File "/tmp/tmph06kbvvn/tmp1rv_880o.py", line 206, in <module> main() File "/tmp/tmph06kbvvn/tmp1rv_880o.py", line 201, in main output += int(s[res:]) ^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s088719497
p04001
u772614554
1553831198
Python
Python (3.4.3)
py
Runtime Error
17
2940
83
from sys import stdin a = stdin.readline().rstrip() print(a.upper()) print(output)
Traceback (most recent call last): File "/tmp/tmpwmw0qctj/tmpuafryy6i.py", line 5, in <module> print(output) ^^^^^^ NameError: name 'output' is not defined
s801668885
p04001
u569742427
1553818135
Python
Python (3.4.3)
py
Runtime Error
20
3064
466
S = input() N = len(S)-1 sumsum = 0 for i in range(2**N): binary = bin(i) binary = binary[2:].zfill(N) tmps = S[0] for j in range(N): if binary[j] == '0':    #ゼロの時はストックする 12<=3 = 123 tmps = tmps + S[j+1] else : sumsum += int(tmps) tmps = S[j+1] sumsum += int(tmps) if N == 0: #一桁の時対策 sumsum = int(S) print(sumsum)
File "/tmp/tmpl0dzmxkc/tmpznbnwf5t.py", line 13 if binary[j] == '0':    #ゼロの時はストックする 12<=3 = 123 ^ SyntaxError: invalid non-printable character U+3000
s977021170
p04001
u392029857
1553126351
Python
Python (3.4.3)
py
Runtime Error
18
3064
870
s = input() op = ['','+'] if len(s) == 1: print(s) else: s = s + 'X'*(10 -len(s)) ans = [] for a in op: for b in op: for c in op: for d in op: for e in op: for f in op: for g in op: for h in op: for i in op:    ans.append(s[0]+a+s[1]+b+s[2]+c+s[3]+d+s[4]+e+s[5]+f+s[6]+g+s[7]+h+s[8]+i+s[9]) for i in range(len(ans)): for j in range(len(ans[i])): if ans[i][j] == 'X': if ans[i][j-1] == '+': ans[i] = ans[i][:j-1] else: ans[i] = ans[i][:j] break sums = 0 for i in set(ans): sums += eval(i) print(sums)
File "/tmp/tmpysfbt90x/tmp4xggbzr2.py", line 17    ans.append(s[0]+a+s[1]+b+s[2]+c+s[3]+d+s[4]+e+s[5]+f+s[6]+g+s[7]+h+s[8]+i+s[9]) ^ SyntaxError: invalid non-printable character U+3000
s638437609
p04001
u582165344
1552514896
Python
Python (3.4.3)
py
Runtime Error
20
3060
272
s = input().split("") sum = 0 for i in range(2 ** (len(s)-1)) : st = str(s[0]) for j in range(len(s)-1) : if ((i >> j) & 1) : st = st + "+" + str(s[j+1]) else : st = st + str(s[j+1]) for item in st.split('+') : sum += int(item) print(sum)
Traceback (most recent call last): File "/tmp/tmpdey3u72a/tmpxo2bhf09.py", line 1, in <module> s = input().split("") ^^^^^^^ EOFError: EOF when reading a line
s100720491
p04001
u853952087
1551888640
Python
Python (3.4.3)
py
Runtime Error
21
3064
346
s=int(input()) S=str(s) w=len(str(s))-1 l=[] L=[] for i in range(2**w): l.append(format(i, '0{}b'.format(w))) for e in l: q=[] x=int(S[0]) for i in range(len(e)): if e[i]=='0': x=x*10+int(S[i+1]) else: q.append(x) x=int(S[i+1]) q.append(x) L.append(sum(q)) print(sum(L))
Traceback (most recent call last): File "/tmp/tmplzqddzmm/tmpug13p3er.py", line 1, in <module> s=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s055830081
p04001
u853952087
1551888613
Python
Python (3.4.3)
py
Runtime Error
18
3064
345
s=int(input()) S=str(s) w=len(str(s))-1 l=[] L=[] for i in range(2**w): l.append(format(i, '0{}b'.format(w))) for e in l: q=[] x=int(S[0]) for i in range(len(e)): if e[i]=='0': x=x*10+int(S[i+1]) else: q.append(x) x=int(S[i+1]) q.append(x) L.append(sum(q)) print(sum(L)
File "/tmp/tmpjoa8gruk/tmpbcl14ryn.py", line 19 print(sum(L) ^ SyntaxError: '(' was never closed
s622552307
p04001
u594567187
1551244314
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38640
408
target = input() length = len(target) binary = length - 1 target_list = [] answers = 0 for i in range(length): if i: target_list.append("") target_list.append(target[i]) for bit in range(2 ** binary): temp = target_list.copy() for i in range(binary): if bit & (1 << i): temp[1 + 2 * i] = "+" # print(temp, bit) answers += eval("".join(temp)) print(answers)
Traceback (most recent call last): File "/tmp/tmp2uzimhid/tmp9um0q26y.py", line 1, in <module> target = input() ^^^^^^^ EOFError: EOF when reading a line
s431399593
p04001
u171366497
1549410922
Python
Python (3.4.3)
py
Runtime Error
84
7896
684
#2-1-1 #ABC045C s=input() lenth=len(s) kugiri=set() def roop(before,now,kugiri): if now==lenth: kugiri|={before,} return kugiri kugiri = roop(before+(0,),now+1,kugiri) kugiri = roop(before+(1,),now+1,kugiri) return kugiri kugiri = roop((0,),2,kugiri) kugiri = roop((1,),2,kugiri) def calc(ans,kugiri,s): test=s now=test[0] test=test[1:] for i in range(len(s)-1): k=kugiri[i] if k==0: now+=test[0] elif k==1: ans+=int(now) now=test[0] test=test[1:] if i==len(s)-2:ans+=int(now) return ans ans=0 for i in kugiri: ans=calc(ans,i,s) print(ans)
Traceback (most recent call last): File "/tmp/tmpk17kjozt/tmp1bfivzhb.py", line 2, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s270785683
p04001
u220904910
1549314079
Python
Python (3.4.3)
py
Runtime Error
30
3064
315
s=input() l=list(s) b=[] lst=[] # bi=[bin(2**i) for i in range(0,len(s))] for i in range(2**(len(s)-1)): b=list(str(bin(i))[2:].zfill(len(s)-1)) st=l[0] for j in range(len(b)): if int(b[j]): st+=l[j+1] else: st+='+'+l[j+1] lst.append(eval(st)) print(sum(lst))
Traceback (most recent call last): File "/tmp/tmp538pv18k/tmpbj354mg2.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s166435580
p04001
u309039873
1549221240
Python
Python (3.4.3)
py
Runtime Error
27
3064
484
S = input() power = 0 answer = 0 temps = int(S) while True: temps = temps/10 power += 1 if temps < 10: break SS = list(S) for i in range(1 << power): output = [] for j in range(power): if (i>>j)&1 == 1: output.append(SS[j]) output.append('+') else: output.append(SS[j]) output.append(SS[power]) temp_string = ''.join(output) answer += eval(temp_string) output.clear() print(answer)
Traceback (most recent call last): File "/tmp/tmpa2yphfcb/tmp9xnao3jo.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s748462603
p04001
u309039873
1549220969
Python
Python (3.4.3)
py
Runtime Error
28
3064
465
S = input() power = 0 answer = 0 temps = int(S) while True: temps = temps/10 power += 1 if temps < 10: break SS = list(S) for i in range(1 << power): output = [] for j in range(power): if (i>>j)&1 == 1: output.append(SS[j]) output.append('+') else: output.append(SS[j]) output.append(SS[power]) temp_string = ''.join(output) answer += eval(temp_string) print(answer)
Traceback (most recent call last): File "/tmp/tmp4pfibtk_/tmphi40f836.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s174504358
p04001
u077019541
1548927009
Python
Python (3.4.3)
py
Runtime Error
18
2940
1
a
Traceback (most recent call last): File "/tmp/tmp_k9uq4z3/tmpp9yco7by.py", line 1, in <module> a NameError: name 'a' is not defined
s405848051
p04001
u375616706
1548704593
Python
Python (3.4.3)
py
Runtime Error
19
3188
653
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*W for _ in range(H)] for h in range(H): cnt = 0 if mat[h][0] == 1: dp[h][0] = 1 for w in range(1, W): if mat[h][w] == 1: dp[h][w] += 1 dp[h][w] += dp[h][w-1] ans = [0]*10 for i in range(10): tmp = 0 for h in range(H-3): for w in range(W-3): s = 0 for k in range(3): s += dp[h+k][w+2]-dp[h+k][w] if s == i: tmp += 1 ans[i] = tmp for i in ans: print(i)
Traceback (most recent call last): File "/tmp/tmpk2khbwa9/tmpccmct04b.py", line 1, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s183549001
p04001
u669696235
1548352993
Python
Python (3.4.3)
py
Runtime Error
28
3060
219
N=input() slen=len(N)-1 ans=0 for i in range(2<<(slen-1)): k=N ins=0 for j in range(slen): if((i>>j)&1): k=k[:j+1+ins]+"+"+k[j+1+ins:] ins+=1 ans+=eval(k) print(ans)
Traceback (most recent call last): File "/tmp/tmpg7zo76vk/tmp2d0z4j1c.py", line 1, in <module> N=input() ^^^^^^^ EOFError: EOF when reading a line
s046073696
p04001
u876770991
1546751118
Python
Python (3.4.3)
py
Runtime Error
157
12408
394
import numpy as np import itertools S = input() nums = [s for s in S] idxs = np.arange(1, len(nums)) masks = list(itertools.product([False, True], repeat=len(idxs))) ret = 0 for mask in masks: selected_idxs = [0] +list( idxs[ np.array(mask)]) + [len(nums)] for i in range(len(selected_idxs) - 1): ret += (int(''.join(nums[selected_idxs[i]: selected_idxs[i+1]]))) print(ret)
Traceback (most recent call last): File "/tmp/tmp794krx5a/tmptgj9b67n.py", line 4, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s814185140
p04001
u620945921
1543197677
Python
Python (3.4.3)
py
Runtime Error
18
3192
644
#import itertools list1=[k for k in input()] #print(list1) num1=len(list1) #print(num1) list00=[format(int(k), 'b') for k in range(2**(num1-1))] #print(list00) list0=['','+'] list01=[] for count1 in range(num1): x=list00[count1] list01.extend(x) #print(list01) total=0 for step1 in range(2): for step2 in range(2): list2=[list0[step2],list0[step1]] num = min(len(list1), len(list2)) result = [None]*(num*2) result[::2] = list1[:num] result[1::2] = list2[:num] result.extend(list1[num:]) result.extend(list2[num:]) result1 = ''.join(result) # print(result1) total+=eval(result1) print(total) #176
Traceback (most recent call last): File "/tmp/tmpbxggskpb/tmp0g8zs57v.py", line 2, in <module> list1=[k for k in input()] ^^^^^^^ EOFError: EOF when reading a line
s176757702
p04001
u620945921
1543197250
Python
Python (3.4.3)
py
Runtime Error
18
3064
639
#import itertools list1=[k for k in input()] print(list1) num1=len(list1) print(num1) list00=[format(int(k), 'b') for k in range(2**(num1-1))] print(list00) list0=['','+'] list01=[] for count1 in range(num1): x=list00[count1] list01.extend(x) print(list01) total=0 for step1 in range(2): for step2 in range(2): list2=[list0[step2],list0[step1]] num = min(len(list1), len(list2)) result = [None]*(num*2) result[::2] = list1[:num] result[1::2] = list2[:num] result.extend(list1[num:]) result.extend(list2[num:]) result1 = ''.join(result) print(result1) total+=eval(result1) print(total) #176
Traceback (most recent call last): File "/tmp/tmp0w25cq3b/tmpi5bhlehy.py", line 2, in <module> list1=[k for k in input()] ^^^^^^^ EOFError: EOF when reading a line
s188029785
p04001
u209620426
1541886559
Python
Python (3.4.3)
py
Runtime Error
17
3060
241
def search(i,s): if i == n-1: li = [] s = "".join(s) li = list(map(int,s.split("+"))) total.append(sum(li)) return else: search(i+1,s) _s = s[:-(n-i)+1] + ["+"] + s[-(n-i)+1:] search(i+1,_s) search(0,s) print(sum(total))
Traceback (most recent call last): File "/tmp/tmpzy6p29dh/tmpqhclehql.py", line 15, in <module> search(0,s) ^ NameError: name 's' is not defined
s018643908
p04001
u366133198
1541560559
Python
Python (3.4.3)
py
Runtime Error
21
2940
723
#!/usr/bin/python3 import itertools def all_comb(n): comb = [] for i in range(0, n+1): comb.extend(list(itertools.combinations(range(n), i))) return comb if __name__=='__main__': str = input() comb = all_comb(len(str)-1) tail = 0 sum = 0 for plus_positions in comb: head = 0 for plus_position in plus_positions: num = int(str[head:plus_position+1]) sum += num head = plus_position + 1 num = int(str[head:]) sum += num print(sum)
File "/tmp/tmpcqgli8xm/tmpi4rpeo8o.py", line 23 sum += num TabError: inconsistent use of tabs and spaces in indentation
s351182252
p04001
u333768710
1538626745
Python
Python (3.4.3)
py
Runtime Error
26
3060
296
s = input() n = len(s) answer = 0 for i in range(2**(n-1)): calc_str = s[0] operator_maker = str(format(i, 'b')).zfill(n-1) for j, c in enumerate(operator_maker): if c == '1': calc_str += '+' calc_str += s[j+1] answer += eval(calc_str) print(answer)
Traceback (most recent call last): File "/tmp/tmpcj0uexf9/tmp51xv3nmh.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s467471519
p04001
u218843509
1534157213
Python
PyPy3 (2.4.0)
py
Runtime Error
185
40304
429
from collections import Counter h, w, n = map(int, input().split()) dots = [list(map(int, input().split())) for _ in range(n)] c = Counter() for dot in dots: for i in range(-2, 1): for j in range(-2, 1): if 1 <= dot[0] + i < h - 1 and 1 <= dot[1] + j < w - 1: c[(dot[0] + i) * w + dot[1] + j] += 1 ans = [0] * 10 for v in c.values(): ans[v] += 1 ans[0] = (h - 2) * (w - 2) - sum(ans[1:]) for a in ans: print(a)
Traceback (most recent call last): File "/tmp/tmp06m7yr_3/tmpv5yz21k0.py", line 3, in <module> h, w, n = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s893423527
p04001
u144985238
1531103508
Python
Python (3.4.3)
py
Runtime Error
22
3188
1972
# 問題文 # 1 以上 9 以下の数字のみからなる文字列 S が与えられます。 この文字列の中で、あなたはこれら文字と文字の間のうち、いくつかの場所に + を入れることができます。 一つも入れなくてもかまいません。 ただし、+ が連続してはいけません。 # このようにして出来る全ての文字列を数式とみなし、和を計算することができます。 # ありうる全ての数式の値を計算し、その合計を出力してください。 # キーワード # 2n2n 通りを調べる全探索 (bit 全探索) # メモ化再帰が使えそう # 方向性 # 普通に計算すると、+ のありなし * n で2:2 3:4 4:8 2^n-1の通り数がある # 1234 # input = 123 # 間に入れれる通り数をもとめる num_list = list(str(input())) binary_length = len(num_list) - 1 lists = [] # 間に入れれる数分の配列を作る for i in range(2**binary_length): bi_array = [] # 2進数の数字を求める num = i while num >= 1: bi_array.insert(0,int(num % 2) ) num = num // 2 tmp_list = [] for j in range(binary_length): if len(bi_array) > j: tmp_list.insert(0,bi_array[-j-1]) else: tmp_list.insert(0,0) lists.append(tmp_list) result_list = [] # 0なら数字をjoin,1ならjoinしない for bi_list in lists: num_list = list(str(input)) current_num = int(num_list[0]) concat_num_list = [] for i,binary in enumerate(bi_list): if binary == 0: current_num = current_num * 10 + int(num_list[i+1]) else: concat_num_list.append(current_num) current_num = int(num_list[i+1]) if i+1 == len(bi_list): concat_num_list.append(current_num) result_list.append(sum(concat_num_list)) # リストの中身をすべて合算する result = sum(result_list) print(result)
Traceback (most recent call last): File "/tmp/tmp43mjc1e5/tmp0ou0rrbq.py", line 17, in <module> num_list = list(str(input())) ^^^^^^^ EOFError: EOF when reading a line
s133995662
p04001
u180908266
1529801036
Python
Python (3.4.3)
py
Runtime Error
90
3820
1752
from collections import deque N, M = map(int, input().split()) F_C_of_S = [{} for i in range(N)] # Companies of Station C_of_S = {} # def Union-find parent = [-1]*M def root(x): if (parent[x] < 0): return x else: parent[x] = y = root(parent[x]) return y def unite(x, y): px = root(x); py = root(y); if (px == py): return False if (parent[px] > parent[py]): px = root(y); py = root(x); parent[px] += parent[py] parent[py] = px return True # Union-find pqcs = [] for i in range(M): p, q, c = map(int, input().split()) p -= 1; q -= 1; pqcs += [(p, q, c)] # The first if not c in F_C_of_S[p]: F_C_of_S[p][c] = i # else else: unite(F_C_of_S[p][c], i) C_of_S.setdefault(p, set()).add(c) # The first if not (c in F_C_of_S[q]): F_C_of_S[q][c] = i # else else: unite(F_C_of_S[q][c], i) C_of_S.setdefault(q, set()).add(c) # stations of company S_of_C = {} for i in range(M): p, q, c = pqcs[i] c_set = S_of_C.setdefault(root(i), set()) c_set.add(p); c_set.add(q); Q = deque([(0, 0, 0)]) # cost to go to the stations from station_0 dist = [float('inf')] * N dist[0] = 0 gdist = [float('inf')] * M while Q: cost, v, flag = Q.popleft() if not (flag): # (flag == 0) then gdist_update for l in F_C_of_S[v].values(): l = root(l) if (cost < gdist[l]): gdist[l] = cost Q.appendleft((cost, l, 1)) else: # (flag == 1) then dist_update for s in S_of_C[v]: if (cost + 1 < dist[s]): dist[s] = cost + 1 Q.append((cost + 1, s, 0)) print(dist[N - 1] if dist[N - 1] < float('inf') else -1)
Traceback (most recent call last): File "/tmp/tmpm4wakosp/tmpbe1h8mob.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s173457471
p04001
u180908266
1529715237
Python
Python (3.4.3)
py
Runtime Error
21
3316
615
from collections import deque N,M = map(int, input().split()) distance = [[float('inf'), 0]]*N distance[0] = [0, 0] Q = deque([[distance[0], 0]]) edges = [[] for _ in range(N)] for i in range(M): p,q,c = map(int, input().split()) edges[p-1] += [[q-1, c]] edges[q-1] += [[p-1, c]] flag = False while Q: dist,now = Q.popleft() for t, c in edges[now]: if distance[t][0] > dist[0] + (dist[1] != c): distance[t] = [dist[0] + (dist[1] != c), c] if dist[1] == c: Q.appendleft([distance[t], t]) continue Q.append([distance[t], t]) print(distance[N-1][0] if distance[N-1][0] != float('inf') else -1)
Traceback (most recent call last): File "/tmp/tmpbf6elear/tmpue316q6y.py", line 2, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s360315222
p04001
u180908266
1529555426
Python
Python (3.4.3)
py
Runtime Error
17
3064
1346
N,M = map(int, input().split()) if M == 0: print(-1) exit() pqcs = [list(map(int, input().split())) for _ in range(M)] c_max = max(list(map(lambda x: x[2],pqcs))) node_num = (c_max+1)*N unsearached_nodes = list(range(node_num))#0~N-1(n-1)が乗換経由ノード/路線iの駅nは3*i+(n-1)番ノード #opt_nodes = [-1]*node_num distance = [float('inf')]*node_num distance[0] = 0 cost = 0 edges = [[float('inf')]*node_num for _ in range(node_num)] #辺へ重み付け for p,q,c in pqcs: edges[3*c+(p-1)][3*c+(q-1)] = 0 edges[3*c+(q-1)][3*c+(p-1)] = 0 edges[p-1][3*c+(p-1)] = 1 edges[q-1][3*c+(q-1)] = 1 edges[3*c+(p-1)][p-1] = 0 edges[3*c+(q-1)][q-1] = 0 while (distance[N-1] == float('inf')): temp_min_dist = float('inf') for unsearched_ind in unsearached_nodes: if temp_min_dist > distance[unsearched_ind]: temp_min_dist = distance[unsearched_ind] target_min_ind = unsearched_ind unsearached_nodes.remove(target_min_ind) target_node = edges[target_min_ind] for index, rota_dist in enumerate(target_node): if rota_dist != float('inf'): if distance[index] > distance[target_min_ind] + rota_dist: distance[index] = distance[target_min_ind] + rota_dist #opt_nodes[index] = target_min_ind print(distance[N-1])
Traceback (most recent call last): File "/tmp/tmpu7m743a0/tmpwm0m95lz.py", line 1, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s215243534
p04001
u829895669
1527820480
Python
Python (3.4.3)
py
Runtime Error
17
3060
272
S = input() ans = 0 for i in range(1 << (len(S)-1)): eq = S for j in range(len(S)-1): if i & (1 << j): eq = eq[:j+1] + "," + eq[j+1:] else: pass eq = eq.split(",") eq = list(map(int,eq)) ans += sum(eq) print(ans)
Traceback (most recent call last): File "/tmp/tmpt3wqvb8y/tmpcyky338_.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s013979946
p04001
u829895669
1527820387
Python
Python (3.4.3)
py
Runtime Error
17
3060
245
S = input() ans = 0 for i in range(1 << (len(S)-1)): eq = S for j in range(len(S)-1): if i & (1 << j): eq = eq[:j+1] + "," + eq[j+1:] else: pass eq = eq.split(",") ans += sum(eq) print(ans)
Traceback (most recent call last): File "/tmp/tmppjevc0kj/tmpqlda2jd_.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s566535446
p04001
u265939044
1525407527
Python
Python (3.4.3)
py
Runtime Error
27
3064
343
S = input() R = 0 S = list(S) temp = [] if len(S)-1 == 0: R = int(S) for i in range(2**(len(S)-1)): for m in range(len(S)-1): if i+1 & 2**(m) > 0: temp.append(S[m] + "+") else: temp.append(S[m]) temp.append(S[len(S)-1]) temp = "".join(temp) R += eval(temp) temp = [] print(R)
Traceback (most recent call last): File "/tmp/tmp_xqxkztm/tmpqf9dr51i.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s443795622
p04001
u147458211
1524645411
Python
Python (3.4.3)
py
Runtime Error
17
3064
593
nums = map(int, list(input())) all_sum = 0 stack = [[0]*len(nums) -1] print(dfs(0, [0]*len(num) - 1)) def dfs(i, pluses): if i == len(num) - 2: pluses[i] = 0 sum1 = calc(pluses) pluses[i] = 1 sum2 = calc(pluses) return sum1 + sum2 else: i += 1 pluses[i] = 0 sum1 += dfs(i, pluses) pluses[i] = 1 sum2 = dfs(i, pluses) return sum1 + sum2 def calc(pluses): num = 0 sum = 0 for i, elm in enumerate(nums): num += elm if i == len(nums): sum += num elif pluses[i] == 1: sum += num else: num *= 10 return sum
Traceback (most recent call last): File "/tmp/tmphicikpxe/tmp5xknfsb8.py", line 1, in <module> nums = map(int, list(input())) ^^^^^^^ EOFError: EOF when reading a line
s110922021
p04001
u694433776
1524449494
Python
Python (3.4.3)
py
Runtime Error
22
2940
287
s=input() def solve(decided, left, idx): if idx==len(s): return decided+left # 手前に+を入れる ret1 = solve(decided+left,int(s[idx]),idx+1) # 入れない ret2 = solve(decided, left*10int(s[idx]), idx+1) return ret1+ret2 print(solve(0,int(s[0]),1))
/tmp/tmpmhx24vee/tmpw8vkr0vu.py:8: SyntaxWarning: invalid decimal literal ret2 = solve(decided, left*10int(s[idx]), idx+1) File "/tmp/tmpmhx24vee/tmpw8vkr0vu.py", line 8 ret2 = solve(decided, left*10int(s[idx]), idx+1) ^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
s640815495
p04001
u766407523
1523470568
Python
Python (3.4.3)
py
Runtime Error
17
2940
149
def pt(s: list): if len(s) = 1: return eval(s[0]) return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:]) print(pt(list((input()))))
File "/tmp/tmp4djm_n7j/tmpmxapkt4x.py", line 2 if len(s) = 1: ^^^^^^ SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
s306038049
p04001
u766407523
1523468687
Python
Python (3.4.3)
py
Runtime Error
17
3060
152
def search(s): if len(s) <= 1: return eval(s[0]) return search([s[0]+s[1]]+s[2:]) + search([s[0]+'+'+s[1]]+s[2:]) print(search(input()))
Traceback (most recent call last): File "/tmp/tmp0etcwsxn/tmpk57vypz6.py", line 5, in <module> print(search(input())) ^^^^^^^ EOFError: EOF when reading a line
s196549244
p04001
u667024514
1522097528
Python
Python (3.4.3)
py
Runtime Error
20
3316
542
from collections import Counter h, w, num = map(int, input().split()) lis = [] for i in range(num): k, j = map(lambda x: int(x) - 1,input().split()) for a in range(3): for b in range(3): cou1 = k - a cou2 = j - b if cou1 < 0 or cou1 > h - 3: continue if cou2 < 0 or cou2 > w - 3: continue lis.append((cou1, cou2)) lis = Counter(Counter(lis).values()) print((h - 2) * (w - 2) - sum(lis.values())) for i in range(1, 10):print(lis[i])
Traceback (most recent call last): File "/tmp/tmpo46u995v/tmp7nb_958_.py", line 2, in <module> h, w, num = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s287910036
p04001
u165233868
1522095278
Python
Python (2.7.6)
py
Runtime Error
10
2568
450
#s = int(raw_input()) 8 ssl = list(sl) 9 print('ssl',ssl) 10 total = 0 11 ss = sl 12 ss2 = '' 13 print('ss',ss) 14 15 for i in ss: 16 print('i',i,type(i),len(ss),type(len(ss))) 17 ss2 += str(i) 18 if i is str(len(ss)): 19 pass 20 else: 21 ss2 += '+' 22 #total = total + int(i) 23 24 print(eval(ss2)) 25 print('total',total) 26 27 #def disp_num_str(a,b,c,s='text'):
File "/tmp/tmpr5_l_cx5/tmp_8dlo_gk.py", line 2 8 ssl = list(sl) IndentationError: unexpected indent
s222574298
p04001
u319612498
1520727875
Python
Python (3.4.3)
py
Runtime Error
17
2940
502
s=list(map(int,list(input()))) n=len(s) ans=0 for i in range(1<<(n-1)): """ここで既に、n-1個の文字間のうち、どこに+を入れるかが決まる。入れるところにはbitが立ち(その桁が1となる)、入れないところにはbitが立たない(その桁が0となる)""" S=s[0] for j in range(n-1): if i & (1<<j): #bitが立っている時 S+="+"+s[j+1] else: #bitが立っていない時 S+=s[j+1] ans+=eval(S) print(ans)
File "/tmp/tmptr4r5486/tmp9brwon2l.py", line 5 """ここで既に、n-1個の文字間のうち、どこに+を入れるかが決まる。入れるところにはbitが立ち(その桁が1となる)、入れないところにはbitが立たない(その桁が0となる)""" ^ IndentationError: expected an indented block after 'for' statement on line 4
s207233201
p04001
u143492911
1520545992
Python
Python (3.4.3)
py
Runtime Error
17
2940
314
s=input() n=len(s) ans=0 for i in range(1<<n-1):#+を入れるかどうか num=s[0] for j in range(n-1):#+を入れるかどうか if i&(1<<j):#bitで考える,iと1<<jが同じ数字であれば実行 num+="+"+s[j+1] else: num+=s[j+1] ans+=eval(ins) print(ans)
Traceback (most recent call last): File "/tmp/tmpb1o8kl14/tmpmo9xepxk.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s931153026
p04001
u435281580
1519675509
Python
Python (3.4.3)
py
Runtime Error
155
12516
703
import numpy as np N, M = map(int, input().split()) routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i') #print(routes) # i駅まで到達したときの最小コスト(最終電車がjで示される) dp = [{} for _ in range(N + 1)] dp[1][0] = 0 for i in range(2, N + 1): for (f, t, m) in routes: if t != i: continue if m in dp[f]: dp[t][m] = dp[f][m] else: values = [] for k, v in dp[f].items(): if k != m: values.append(v) if len(values) > 0: dp[t][m] = min(values) + 1 if len(dp[N].values()) > 0: print(min(dp[N].values())) else: print(-1)
Traceback (most recent call last): File "/tmp/tmp01kja0zz/tmpnlg7k5wv.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s182175621
p04001
u984351908
1480882517
Python
Python (3.4.3)
py
Runtime Error
23
3184
639
def __main__(): h, w, n = list(map(int, input().split())) grid = [] for i in range(h): row = [] for j in range(w): row.append(0) grid.append(row) for i in range(n): ai, bi = list(map(int, input().split())) grid[ai - 1][bi - 1] = 1 result = [0] * 10 for i in range(h - 2): for j in range(w - 2): black = 0 for i2 in range(3): for j2 in range(3): if grid[i + i2][j + j2] == 1: black += 1 result[black] += 1 for i in range(9): print(result[i]) __main__()
Traceback (most recent call last): File "/tmp/tmpzpr0k9hr/tmpbko6oqhe.py", line 25, in <module> __main__() File "/tmp/tmpzpr0k9hr/tmpbko6oqhe.py", line 2, in __main__ h, w, n = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s829834930
p04001
u272028993
1476752331
Python
PyPy2 (5.6.0)
py
Runtime Error
40
8944
751
from collections import deque def main(): n,m=map(int,raw_input().split()) g=[[] for _ in xrange(n)] gc=[[] for _ in xrange(10**6)] mxc=0 for i in xrange(m): p,q,c=map(int,raw_input().split()) p-=1;q-=1;c-=1 g[p].append(c) g[q].append(c) gc[c].append(p) gc[c].append(q) mxc=max(mxc,c+1) visited=[False]*mxc q=deque([[0,1]]) while len(q)!=0: p,dist=q.popleft() for i in g[p]: if not visited[i]: for j in gc[i]: if j!=p: if j==n-1: print(dist) exit() q.append([j,dist+1]) print(-1) main()
Traceback (most recent call last): File "/tmp/tmpdciaqiib/tmp0ffv5mnk.py", line 32, in <module> main() File "/tmp/tmpdciaqiib/tmp0ffv5mnk.py", line 4, in main n,m=map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s057033465
p04001
u276144769
1474723140
Python
Python (3.4.3)
py
Runtime Error
23
3064
200
dp=["","+"] s=input() su=0 for i in range(2**(len(s)-1)): val="" for j in range(len(s)-1): val+=s[j] val+=dp[int(bin(i)[j+2])] val+=s[len(s)-1] su+=eval(val) print(su)
Traceback (most recent call last): File "/tmp/tmppzngw9d0/tmpqnp4gyaa.py", line 2, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s392828628
p04001
u276144769
1474683128
Python
Python (3.4.3)
py
Runtime Error
22
3064
194
dp=["","+"] s=input() su=0 for i in range(2**(len(s)-1)): val="" for j in range(len(s)-1): val+=s[j] val+=dp[bin(i)[j+2]] val+=s[len(s)-1] su+=eval(val) print(su)
Traceback (most recent call last): File "/tmp/tmph3m0c85c/tmp28w3vu64.py", line 2, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s208269809
p04001
u276144769
1474681563
Python
Python (3.4.3)
py
Runtime Error
22
3064
181
dp=["","+"] s=input() su=0 for i in range(2**(len(s)-1)): val="" for j in range(len(s)-1): val+=s[j]+dp[bin(i)[j+2]] val+=s[len(s)-1] su+=eval(val) print(su)
Traceback (most recent call last): File "/tmp/tmp0k_xdsyc/tmpm0rd_u6l.py", line 2, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s629776672
p04001
u477320129
1474060558
Python
Python (3.4.3)
py
Runtime Error
39
3064
459
from itertools import product H, W, N = list(map(int, input().split())) A = [tuple(map(int, input().split())) for _ in range(N)] count = {} for x, y in A: for xx, yy in product(range(x-1, x+2), range(y-1, y+2)): if not(2 <= xx <= H-1 and 2 <= yy <= W-1): continue count[(xx, yy)] = count.get((xx, yy), 0) + 1 ans = [0] * 10 for k, v in count.items(): ans[v] += 1 ans[0] = (H - 2) * (W - 2) - sum(ans) print(*ans, sep="\n")
Traceback (most recent call last): File "/tmp/tmpg282t6ur/tmpyb2xehsq.py", line 2, in <module> H, W, N = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s386085707
p04001
u393971002
1473889289
Python
Python (3.4.3)
py
Runtime Error
45
3064
544
s = input() l = len(s) - 1 # 各数の間の数 # 書く数の間に'+'を入れるときは1そうでないときは0にして2進数で表す # 全てで 2 ** l = 2 << (l - 1)通りできる total_patterns = 2 << (l - 1) ans = 0 for i in range(total_patterns): num_between = format(i,'b').zfill(l) # 10進数を2進数に変換 tmp = '' for j in range(l): if num_between[j] == '1': tmp += (s[j] + '+') else: tmp += s[j] tmp += s[-1] ans += sum([int(i) for i in tmp.split('+')]) print(ans)
Traceback (most recent call last): File "/tmp/tmpn6y_gvwp/tmpr6nqzl26.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s333923965
p04001
u393971002
1473888963
Python
Python (3.4.3)
py
Runtime Error
40
3064
412
s = input() start = time.time() l = len(s) - 1 # 各数の間の数 total_patterns = 2 << (l) ans = 0 for i in range(total_patterns): num_between = format(i,'b').zfill(l) # 10進数を2進数に変換 tmp = '' for j in range(l): if num_between[j] == '1': tmp += (s[j] + '+') else: tmp += s[j] tmp += s[-1] ans += sum([int(i) for i in tmp.split('+')]) print(ans)
Traceback (most recent call last): File "/tmp/tmpzw18yynn/tmpq__2xh7z.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s677549905
p04001
u393971002
1473884627
Python
Python (3.4.3)
py
Runtime Error
45
3188
522
s = input() int_s = [int(i) for i in s] l = len(int_s) total_patterns = 2 << (l - 2) def calc_sum(s): # '+'を区切りとして和を求める num = s.split('+') return sum(list(map(int, num))) ans = 0 for i in range(total_patterns): between = format(i,'b').zfill(l - 1) # 10進数を2進数に変換 tmp = '' for j in range(len(between)): if between[j] == '1': tmp += (s[j] + '+') else: tmp += s[j] tmp += s[-1] ans += calc_sum(tmp) print(ans)
Traceback (most recent call last): File "/tmp/tmp_fqhmca_/tmp23axdos2.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s695728664
p04001
u707500405
1473658334
Python
Python (2.7.6)
py
Runtime Error
28
2808
542
from collections import defaultdict from itertools import product from sys import stdin def gen_b(x,B): if x < 3: lb = 2 else: lb = x - 1 if x > B-2: ub = B-1 else: ub = x + 1 return xrange(lb,ub+1) def solve(): count = defaultdict(int) ans = [0]*10 L = map(lambda x:map(int,x.split()),stdin.readlines()) H,W,N = L[0] for i in xrange(1,N+1): for x,y in product(gen_b(L[i][0],H),gen_b(L[i][1],W)): count[x+(y<<34)] += 1 for v in count.itervalues():ans[v] += 1 ans[0] = (H-2)*(W-2) - sum(ans[1:]) for c in ans: print c solve()
File "/tmp/tmptp281jxz/tmpto0dvui6.py", line 20 for c in ans: print c ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s961680043
p04001
u707500405
1473657900
Python
Python (2.7.6)
py
Runtime Error
31
2940
575
from collections import defaultdict from sys import stdin def gen_bound(x,B): if x < 3: lb = 2 else: lb = x - 1 if x > B-2: ub = B-1 else: ub = x + 1 return lb,ub+1 def solve(): count = defaultdict(int) ans = [0]*10 L = map(lambda x:map(int,x.split()),stdin.readlines()) H,W,N = L[0] for i in xrange(1,N+1): xlb,xub = gen_bound(L[i][0],H) ylb,yub = gen_bound(L[i][1],W) for x in xrange(xlb,xub): for y in xrange(ylb,yub): count[x+(y<<34)] += 1 for v in count.itervalues():ans[v] += 1 ans[0] = (H-2)*(W-2) - sum(ans[1:]) for c in ans: print c solve()
File "/tmp/tmpg1o9fiq_/tmpz5poq26i.py", line 22 for c in ans: print c ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s204489414
p04001
u765237551
1473648975
Python
Python (3.4.3)
py
Runtime Error
220
3444
454
from collections import defaultdict H, W, N = map(int, input().split()) poss = [list(map(int, input().split())) for _ in range(N)] d = defaultdict(int) for a, b in poss: for i, j in ((i, j) for i in range(a-1, a+2) for j in range(b-1, b+2)): if 1<i<H and 1<j<W: s = str(i)+":"+str(j) d[s] += 1 anss = [0] * 10 for x in d.values(): anss[x] += 1 print((H-2)*(W-2) - sum(anss[1:])) for ans in anss[1:]: print(ans)
Traceback (most recent call last): File "/tmp/tmp7dsp6xdv/tmpqf5pyp60.py", line 2, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s713686428
p04001
u680619771
1473647411
Python
Python (3.4.3)
py
Runtime Error
38
3064
958
import sys grid = [] painted = [] height, width, n = sys.stdin.readline().strip().split() height, width, n = int(height), int(width), int(n) def checkGrid(x, y, grid): count = 0 for col in range(x, x+3): for row in range(y, y+3): if grid[row][col] == 1: count += 1 return count inp = sys.stdin.readline().strip() while inp: a, b = inp.split() grid.append([int(a) - 1, int(b) - 1]) inp = sys.stdin.readline().strip() # Build empty grid for i in range(height): painted.append([]) for j in range(width): if [i, j] in grid: painted[i].append(1) else: painted[i].append(0) # Build painted cells for cell in grid: painted[cell[0]][cell[1]] = 1 for i in range(0, 10): count = 0 for col in range(width - 2): for row in range(height - 2): if checkGrid(col, row, painted) == i: count += 1 print(count)
Traceback (most recent call last): File "/tmp/tmpsgubbffb/tmpbikcn0_3.py", line 5, in <module> height, width, n = sys.stdin.readline().strip().split() ^^^^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s647580783
p04001
u098968285
1473642700
Python
Python (3.4.3)
py
Runtime Error
43
3064
385
# def makelist(n, m): # return [[0 for i in range(m)] for j in range(n)] # n = int(input()) # a, b = map(int, input().split()) # s = input() l = len(s) ans = 0 m = int('1'*(l-1), 2) for i in range(m+1): now = format(i, 'b').zfill(l-1) tmp = s[0] for k in range(l-1): if now[k] == '0': tmp += s[k+1] else: ans += int(tmp) tmp = s[k+1] ans += int(tmp) print(ans)
Traceback (most recent call last): File "/tmp/tmpin_ydcmz/tmpki8bhgwm.py", line 9, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s747733034
p04002
u107601154
1585887784
Python
Python (3.4.3)
py
Runtime Error
3207
780568
607
H,W,N= (int(x) for x in input().split()) a = [0] * N b = [0] * N for i in range(N): a[i],b[i] = (int(x) for x in input().split()) black = [[0 for i in range(W)] for j in range(H)] for i in range(N): black[a[i]-1][b[i]-1] = 1 answer = [0]*9 sum_black = [[0 for i in range(W-2)] for j in range(H-2)] for i in range (H-2): for j in range (W-2): sum_black[i][j] = black[i][j] + black[i][j+1] + black[i][j+2] + black[i+1][j] + black[i+1][j+1] + black[i+1][j+2] + black[i+2][j] + black[i+2][j+1] + black[i+2][j+2] answer[sum_black[i][j]] += 1 for i in range (9): print(answer[i])
Traceback (most recent call last): File "/tmp/tmp1js1w8l0/tmpq35g23nf.py", line 1, in <module> H,W,N= (int(x) for x in input().split()) ^^^^^^^ EOFError: EOF when reading a line
s329161048
p04002
u223904637
1575764071
Python
PyPy3 (2.4.0)
py
Runtime Error
3163
126724
402
h,w,n=map(int,input().split()) p=[] q=[-1,0,1] for i in range(n): a,b=map(int,input().split()) for j in q: for k in q: if 1<=a+j<=h and 1<=b+k<=w: p.append([a+j,b+k]) p.sort() n=len(p) f=1 ans=[0]*10 p.append([-1,-1]) for i in range(n): if p[i]==p[i+1]: f+=1 else: ans[f]+=1 s=sum(ans) ans[0]=(h-2)*(w-2)-s for i in ans: print(i)
Traceback (most recent call last): File "/tmp/tmppmzari2i/tmpr1g2n0zn.py", line 1, in <module> h,w,n=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s452839196
p04002
u627417051
1567920609
Python
PyPy3 (2.4.0)
py
Runtime Error
3163
132856
515
def getlist(): return list(map(int, input().split())) H, W, N = getlist() ans = [0] * 10 ans[0] = (H - 2) * (W - 2) L = [] for i in range(N): a, b = getlist() for j in range(3): for k in range(3): if H - 2 >= a - j and a - j >= 1 and W - 2 >= b - k and b - k >= 1: L.append([a - j, b - k]) L = sorted(L) n = len(L) v = L[0] c = 0 for i in range(n): if v == L[i]: c += 1 else: ans[c] += 1 c = 1 v = L[i] ans[c] += 1 for i in range(1, 10): ans[0] -= ans[i] for i in range(10): print(ans[i])
Traceback (most recent call last): File "/tmp/tmpy_tbp5r8/tmpyu1cv08o.py", line 4, in <module> H, W, N = getlist() ^^^^^^^^^ File "/tmp/tmpy_tbp5r8/tmpyu1cv08o.py", line 2, in getlist return list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s120340420
p04002
u627417051
1567920294
Python
PyPy3 (2.4.0)
py
Runtime Error
3163
145352
517
from fractions import gcd def getlist(): return list(map(int, input().split())) H, W, N = getlist() ans = [0] * 10 ans[0] = (H - 2) * (W - 2) L = [] for i in range(N): a, b = getlist() for j in range(3): for k in range(3): if H - 2 >= a - j and a - j >= 1 and W - 2 >= b - k and b - k >= 1: L.append([a - j, b - k]) L = sorted(L) n = len(L) v = L[0] c = 0 for i in range(n): if v == L[i]: c += 1 else: ans[c] += 1 c = 1 v = L[i] ans[c] += 1 for i in range(1, 10): ans[0] -= ans[i] print(ans)
Traceback (most recent call last): File "/tmp/tmpc7twsmac/tmpjfboq3xc.py", line 1, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s328900091
p04002
u059436995
1558630766
Python
Python (3.4.3)
py
Runtime Error
21
3316
504
from collections import defaultdict import sys h, w, n = int(sys.stdin.readline().split()) m3x3 =defaultdict(list) for _ in range(n): a, b = int(sys.stdin.readline().split()) for i in range(max(0, a - 3),min(h - 2, a)): for j in range(max(0, b - 3),min(w - 2, b)): if (i,j) in m3x3: m3x3[(i,j)] +=1 else: m3x3[(i,j)] =1 v = list(m3x3.values()) k = m3x3.keys() print((w-2)*(h-2)-len(k)) for j in range(1,10): print(v.count(j))
Traceback (most recent call last): File "/tmp/tmpvi1twcm5/tmp9an9lqef.py", line 3, in <module> h, w, n = int(sys.stdin.readline().split()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
s889778736
p04002
u657913472
1551398563
Python
Python (3.4.3)
py
Runtime Error
18
3064
211
f=lambda:map(int,input().split()) h,w,n=f() c=[(h-2)*(w-2),*[0]*9] d={} while n: n-=1;x,y=f() for i in range(9): a=(x+i%3,y+i//3) if h>=x+i%3>2<y+i//3<=w:d[a]=d.get(a,0)+1;c[d[a]-1]-=1;c[d[a]]+=1 print(*c)
Traceback (most recent call last): File "/tmp/tmp2s70hhid/tmp4pcoqmhp.py", line 2, in <module> h,w,n=f() ^^^ File "/tmp/tmp2s70hhid/tmp4pcoqmhp.py", line 1, in <lambda> f=lambda:map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s635665160
p04002
u375616706
1548706665
Python
Python (3.4.3)
py
Runtime Error
3323
1695092
341
H, W, N = map(int, input().split()) mat = [[0]*(W+2) for _ in range(H+2)] for _ in range(N): a, b = map(int, input().split()) for i in range(-1, 2): for j in range(-1, 2): mat[a+i][b+j] += 1 ans = [0]*10 for i in range(H-2): for j in range(W-2): ans[mat[i+2][j+2]] += 1 for a in ans: print(a)
Traceback (most recent call last): File "/tmp/tmp_bdzwpse/tmptaqki265.py", line 1, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s396697767
p04002
u375616706
1548706572
Python
PyPy3 (2.4.0)
py
Runtime Error
3234
1420032
341
H, W, N = map(int, input().split()) mat = [[0]*(W+2) for _ in range(H+2)] for _ in range(N): a, b = map(int, input().split()) for i in range(-1, 2): for j in range(-1, 2): mat[a+i][b+j] += 1 ans = [0]*10 for i in range(H-2): for j in range(W-2): ans[mat[i+2][j+2]] += 1 for a in ans: print(a)
Traceback (most recent call last): File "/tmp/tmpfxjhon4j/tmpmamlxzaw.py", line 1, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s229883346
p04002
u375616706
1548706125
Python
PyPy3 (2.4.0)
py
Runtime Error
4322
1098044
512
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*(W-2) for _ in range(H)] ran = range(W) for h in range(H): for a, b, c in zip(ran, ran[1:], ran[2:]): co = mat[h][a]+mat[h][b]+mat[h][c] dp[h][a] = co ans = [0]*10 for h in range(H-2): for w in range(W-2): tmp = 0 for i in range(3): tmp += dp[h+i][w] ans[0] += 1 for a in ans: print(a)
Traceback (most recent call last): File "/tmp/tmp_ny6bzv7/tmpq4wds8ep.py", line 1, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s561881881
p04002
u375616706
1548706038
Python
PyPy3 (2.4.0)
py
Runtime Error
3402
1282620
514
H, W, N = map(int, input().split()) mat = [[0]*W for _ in range(H)] for _ in range(N): a, b = map(int, input().split()) mat[a-1][b-1] = 1 dp = [[0]*(W-2) for _ in range(H)] ran = range(W) for h in range(H): for a, b, c in zip(ran, ran[1:], ran[2:]): co = mat[h][a]+mat[h][b]+mat[h][c] dp[h][a] = co ans = [0]*10 for h in range(H-2): for w in range(W-2): tmp = 0 for i in range(3): tmp += dp[h+i][w] ans[tmp] += 1 for a in ans: print(a)
Traceback (most recent call last): File "/tmp/tmpi4ahze43/tmpnapwqwfn.py", line 1, in <module> H, W, N = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line