s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s577168772 | p04000 | u842689614 | 1566795428 | Python | Python (3.4.3) | py | Runtime Error | 827 | 58896 | 4434 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
r_b.append(N)
ab=[ab[r_b[i]:r_b[i+1]] for i in range(len(r_b)-1)]
checked=[[[[False]*3 for k in range(3)] for j in range(len(ab[i]))] for i in range(min(3,len(ab)))]
area_n=[0 for i in range(1,10)]
if N is 0:
ab=[]
for r_n in range(len(ab)/2):
if r_n!=0:
checked[0]=checked[1]
if len(checked)>=3:
checked[1]=checked[2]
if r_n<len(ab)-2 and len(checked)==3:
checked[2]=[[[False]*3 for k in range(3)] for j in range(len(ab[r_n+2]))]
row=ab[r_n][0][0]
ch_list_min_add=[0,0]
for c_n in range(len(ab[r_n])):
col=ab[r_n][c_n][1]
if row<=2:
for box_r in range(3-row):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if row>=H-1:
for box_r in range(H+1-row,3):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if col<=2:
for box_r in range(3):
for box_c in range(3-col):
checked[0][c_n][box_r][box_c]=True
if col>=W-1:
for box_r in range(3):
for box_c in range(W+1-col,3):
checked[0][c_n][box_r][box_c]=True
ch_p_rc=[[],[]]
min_flag=[True,True]
ch_start_add=ch_list_min_add[:]
for ch_r in range(row,min(row+3,H+1)):
if ch_r==row:
ch_c=min(col+1,W)
while(ch_c <min(col+min(3,len(ab[r_n])-c_n),W+1)):
for j in range(min(c_n+1,len(ab[r_n])-1),min(c_n+3,len(ab[r_n]))):
if ch_c<ab[r_n][j][1]:
ch_c=ab[r_n][j][1]
break
if ab[r_n][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n,j])
ch_c+=1
break
if j==min(c_n+3,len(ab[r_n]))-1:
ch_c=min(col+3,W+1)
elif ch_r==row+1 and (ab[r_n+1][0][0]==row+1 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+1][0][0]==row+2 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+2][0][0]==row+2 if r_n<len(ab)-2 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[1],len(ab[r_n+2])):
if ch_c<ab[r_n+2][j][1]:
ch_c=ab[r_n+2][j][1]
ch_start_add[1]=j
if min_flag[1]:
min_flag[1]=False
ch_list_min_add[1]=j
break
if ab[r_n+2][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+2,j])
ch_c+=1
ch_start_add[1]=min(j+1,len(ab[r_n+2])-1)
if min_flag[1] and ch_c>col-2:
min_flag[1]=False
ch_list_min_add[1]=j
break
if j==len(ab[r_n+2])-1:
ch_c=min(col+3,W+1) |
s731808450 | p04000 | u842689614 | 1566794814 | Python | Python (3.4.3) | py | Runtime Error | 3158 | 58972 | 5013 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
r_b.append(N)
ab=[ab[r_b[i]:r_b[i+1]] for i in range(len(r_b)-1)]
if N is 0:
ab=[]
checked=[[[[False]*3 for k in range(3)] for j in range(len(ab[i]))] for i in range(3)]
area_n=[0 for i in range(1,10)]
for r_n in range(len(ab)):
if r_n!=0:
checked[0]=checked[1]
checked[1]=checked[2]
if r_n<len(ab)-2:
checked[2]=[[[False]*3 for k in range(3)] for j in range(len(ab[r_n+2]))]
row=ab[r_n][0][0]
ch_list_min_add=[0,0]
for c_n in range(len(ab[r_n])):
col=ab[r_n][c_n][1]
if row<=2:
for box_r in range(3-row):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if row>=H-1:
for box_r in range(H+1-row,3):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if col<=2:
for box_r in range(3):
for box_c in range(3-col):
checked[0][c_n][box_r][box_c]=True
if col>=W-1:
for box_r in range(3):
for box_c in range(W+1-col,3):
checked[0][c_n][box_r][box_c]=True
ch_p_rc=[[],[]]
min_flag=[True,True]
ch_start_add=ch_list_min_add[:]
for ch_r in range(row,min(row+3,H+1)):
if ch_r==row:
ch_c=min(col+1,W)
while(ch_c <min(col+min(3,len(ab[r_n])-c_n),W+1)):
for j in range(min(c_n+1,len(ab[r_n])-1),min(c_n+3,len(ab[r_n]))):
if ch_c<ab[r_n][j][1]:
ch_c=ab[r_n][j][1]
break
if ab[r_n][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n,j])
ch_c+=1
break
if j==min(c_n+3,len(ab[r_n]))-1:
ch_c=min(col+3,W+1)
elif ch_r==row+1 and (ab[r_n+1][0][0]==row+1 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+1][0][0]==row+2 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+2][0][0]==row+2 if r_n<len(ab)-2 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[1],len(ab[r_n+2])):
if ch_c<ab[r_n+2][j][1]:
ch_c=ab[r_n+2][j][1]
ch_start_add[1]=j
if min_flag[1]:
min_flag[1]=False
ch_list_min_add[1]=j
break
if ab[r_n+2][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+2,j])
ch_c+=1
ch_start_add[1]=min(j+1,len(ab[r_n+2])-1)
if min_flag[1] and ch_c>col-2:
min_flag[1]=False
ch_list_min_add[1]=j
break
if j==len(ab[r_n+2])-1:
ch_c=min(col+3,W+1)
for box_r in range(3):
for box_c in range(3):
if not checked[0][c_n][box_r][box_c]:
checked[0][c_n][box_r][box_c]=True
count=1
for ch_r in range(row,row+box_r+1):
for ch_c in range(col+box_c-2 if ch_r!=row else col+1,col+box_c+1):
if [ch_r,ch_c] in ch_p_rc[0]:
add=ch_p_rc[1][ch_p_rc[0].index([ch_r,ch_c])]
checked[add[0]-r_n][add[1]][box_r+row-ch_r][box_c+col-ch_c]=True
count+=1
area_n[count-1]+=1
print((H-2)*(W-2)-sum(area_n))
for i in range(9):
print(area_n[i])
|
s182699017 | p04000 | u842689614 | 1566794392 | Python | Python (3.4.3) | py | Runtime Error | 3157 | 58932 | 4471 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
r_b.append(N)
max_r_n=0
for i in range(1,len(r_b)):
if max_r_n<r_b[i]-r_b[i-1]:
max_r_n=r_b[i]-r_b[i-1]
ab=[ab[r_b[i]:r_b[i+1]] for i in range(len(r_b)-1)]
if N is 0:
ab=[]
checked=[[[[False]*3 for k in range(3)] for j in range(len(ab[i]))] for i in range(3)]
area_n=[0 for i in range(1,10)]
for r_n in range(len(ab)):
if r_n!=0:
checked[0]=checked[1]
checked[1]=checked[2]
if r_n<len(ab)-2:
checked[2]=[[[False]*3 for k in range(3)] for j in range(len(ab[r_n+2]))]
row=ab[r_n][0][0]
ch_list_min_add=[0,0]
for c_n in range(len(ab[r_n])):
col=ab[r_n][c_n][1]
if row<=2:
for box_r in range(3-row):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if row>=H-1:
for box_r in range(H+1-row,3):
for box_c in range(3):
checked[0][c_n][box_r][box_c]=True
if col<=2:
for box_r in range(3):
for box_c in range(3-col):
checked[0][c_n][box_r][box_c]=True
if col>=W-1:
for box_r in range(3):
for box_c in range(W+1-col,3):
checked[0][c_n][box_r][box_c]=True
ch_p_rc=[[],[]]
min_flag=[True,True]
ch_start_add=ch_list_min_add[:]
for ch_r in range(row,min(row+3,H+1)):
if ch_r==row:
ch_c=min(col+1,W)
while(ch_c <min(col+min(3,len(ab[r_n])-c_n),W+1)):
for j in range(min(c_n+1,len(ab[r_n])-1),min(c_n+3,len(ab[r_n]))):
if ch_c<ab[r_n][j][1]:
ch_c=ab[r_n][j][1]
break
if ab[r_n][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n,j])
ch_c+=1
break
if j==min(c_n+3,len(ab[r_n]))-1:
ch_c=min(col+3,W+1)
elif ch_r==row+1 and (ab[r_n+1][0][0]==row+1 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+1][0][0]==row+2 if r_n<len(ab)-1 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[0],len(ab[r_n+1])):
if ch_c<ab[r_n+1][j][1]:
ch_c=ab[r_n+1][j][1]
ch_start_add[0]=j
if min_flag[0]:
min_flag[0]=False
ch_list_min_add[0]=j
break
if ab[r_n+1][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+1,j])
ch_c+=1
ch_start_add[0]=min(j+1,len(ab[r_n+1])-1)
if min_flag[0] and ch_c>col-2:
min_flag[0]=False
ch_list_min_add[0]=j
break
if j==len(ab[r_n+1])-1:
ch_c=min(col+3,W+1)
elif ch_r==row+2 and (ab[r_n+2][0][0]==row+2 if r_n<len(ab)-2 else False):
ch_c=max(col-2,1)
while(ch_c<min(col+3,W+1)):
for j in range(ch_start_add[1],len(ab[r_n+2])):
if ch_c<ab[r_n+2][j][1]:
ch_c=ab[r_n+2][j][1]
ch_start_add[1]=j
if min_flag[1]:
min_flag[1]=False
ch_list_min_add[1]=j
break
if ab[r_n+2][j]==[ch_r,ch_c]:
ch_p_rc[0].append([ch_r,ch_c])
ch_p_rc[1].append([r_n+2,j])
ch_c+=1
ch_start_add[1]=min(j+1,len(ab[r_n+2])-1)
if min_flag[1] and ch_c>col-2:
min_flag[1]=False
ch_list_min_add[1]=j
break
if j==len(ab[r_n+2])-1:
ch_c=min(col+3,W+1) |
s952968802 | p04000 | u842689614 | 1566793181 | Python | Python (3.4.3) | py | Runtime Error | 599 | 39156 | 481 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
r_b.append(N)
max_r_n=0
for i in range(1,len(r_b)):
if max_r_n<r_b[i]-r_b[i-1]:
max_r_n=r_b[i]-r_b[i-1]
ab=[ab[r_b[i]:r_b[i+1]] for i in range(len(r_b)-1)]
if N is 0:
ab=[]
checked=[[[[False]*3 for k in range(3)] for j in range(len(ab[i]))] for i in range(ab)]
area_n=[0 for i in range(1,10)] |
s045358458 | p04000 | u842689614 | 1566792952 | Python | Python (3.4.3) | py | Runtime Error | 834 | 58796 | 480 | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab.sort()
r_b=[0]
for i in range(1,N):
if ab[i][0]!=ab[i-1][0]:
r_b.append(i)
r_b.append(N)
max_r_n=0
for i in range(1,len(r_b)):
if max_r_n<r_b[i]-r_b[i-1]:
max_r_n=r_b[i]-r_b[i-1]
ab=[ab[r_b[i]:r_b[i+1]] for i in range(len(r_b)-1)]
if N is 0:
ab=[]
checked=[[[[False]*3 for k in range(3)] for j in range(len(ab[i]))] for i in range(3)]
area_n=[0 for i in range(1,10)] |
s054980372 | p04000 | u619819312 | 1566716401 | Python | Python (3.4.3) | py | Runtime Error | 3167 | 322892 | 650 | from collections import defaultdict as de
h,w,n=map(int,input().split())
s=[0]*10
c=de(int)
d=[]
for i in range(n):
a,b=map(int,input().split())
c[(a,b)]=1
d.append([a,b])
for e,f in d:
for i in range(3):
for j in range(3):
if 0<=e-i and e+2-i<h:
if 0<=f-j and f+2-j<w:
p=0
for t in range(e-i,e+3-i):
for u in range(f-j,f+3-j):
p+=c[(t,u)]
else:
s[p]+=1
else:
s=s[0]+[s[i]//i for i in range(1,10)]
s[0]=(h-8)*(w-8)-sum(s)
for i in s:
print(i) |
s776044459 | p04000 | u200785298 | 1564715190 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3243 | 998944 | 1411 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)
def solve(W: int, H: int, N: int, a: "List[int]", b: "List[int]"):
ret = [0] * 10
grid = [[False] * W for _ in range(H)]
ret[0] = (H - 2) * (W - 2)
for i in range(N):
lx = max(0, a[i] - 3)
rx = min(W - 2, a[i])
ly = max(0, b[i] - 3)
ry = min(H - 2, b[i])
for bx in range(lx, rx):
for by in range(ly, ry):
cnt = 0
for x in range(0, 3):
for y in range(0, 3):
#print(a[i] - 1, b[i] - 1, bx + x, by + y)
if grid[by + y][bx + x]:
cnt += 1
ret[cnt] -= 1
ret[cnt + 1] += 1
#print(b[i] - 1, a[i] - 1, H, W)
grid[b[i] - 1][a[i] - 1] = True
for r in ret:
print(r)
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
H = int(next(tokens)) # type: int
W = int(next(tokens)) # type: int
N = int(next(tokens)) # type: int
a = [int()] * (N) # type: "List[int]"
b = [int()] * (N) # type: "List[int]"
for i in range(N):
a[i] = int(next(tokens))
b[i] = int(next(tokens))
solve(H, W, N, a, b)
if __name__ == '__main__':
main()
|
s623424437 | p04000 | u310678820 | 1564186915 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 819 | import numpy as np
H, W, N = map(int, input().split())
d = 10**9+1
L = []
S = set()
for _ in range(N):
a, b = map(int, input().split())
S.add((a, b))
Map = np.zeros([5, 5], dtype = 'int')
ans = [0]*10
for i in S:
a, b = i
for i in range(-2, 3):
for j in range(-2, 3):
a1, b1 = a+i, b+j"""
if (1<=a1<=H) and (1<=b1<=W):
if (a1, b1) in S:
Map[i+2, j+2] = 1
else:
Map[i+2, j+2] = 0
else:
Map[i+2, j+2] = -100
for i in range(-1, 2):
for j in range(-1, 2):
k = 1#Map[i+1:i+4, j+1:j+4].sum()
if k>=0:
ans[k]+=1
for i in range(1, 10)[::-1]:
ans[i] //=i
ans[0] = (W-2)*(H-2)-sum(ans)
for i in ans:
print(i)"""
|
s501867165 | p04000 | u393512980 | 1563075928 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38424 | 638 | import sys
def input():
return sys.stdin.readline()[:-1]
from collections import defaultdict
H, W, N = map(int, input().split())
square = set()
dot = defaultdict(lambda : 0)
for i in range(N):
a, b = map(lambda x: int(x)-1, input().split())
dot[[a, b]] = 1
for y in range(a-2, a+1):
for x in range(b-2, b+1):
if 0 <= y < H-2 and 0 <= x < W-2:
square.add([y, x])
ans = [0] * 10
for y, x in square:
c = 0
for i in range(y, y+3):
for j in range(x, x+3):
c += dot[[i, j]]
ans[c] += 1
ans[0] += ans[0] + (H-2) * (W-2) - len(square)
for i in ans:
print(i)
|
s463478101 | p04000 | u123756661 | 1562469350 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3391 | 1360060 | 506 | import sys
input=sys.stdin.readline
h,w,n=map(int,input().split())
d=[[0]*(w+1) for i in range(h+1)]
t=[[0]*(w+1) for i in range(h+1)]
for i in range(n):
y,x=map(int,input().split())
d[y][x]=1
for i in range(1,h+1):
for j in range(1,w+1):
t[i][j]=t[i][j-1]
if d[i][j]==1:
t[i][j]+=1
ans=[0]*10
for i in range(3,h+1):
for j in range(3,w+1):
p=(t[i][j]-t[i][j-3])+(t[i-1][j]-t[i-1][j-3])+(t[i-2][j]-t[i-2][j-3])
ans[p]+=1
for i in ans:
print(i) |
s097340093 | p04000 | u454557108 | 1560372196 | Python | Python (3.4.3) | py | Runtime Error | 3312 | 1250664 | 564 | import numpy as np
h,w,n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
a[i],b[i] = map(int, input().split())
a[i] -= 1; b[i] -= 1
## 左上のマスを(0,0)とする
## 正方形の左上のマスを(j,i)とする
sq = [[0]*(w-2) for i in range(h-2)]
for x in range(n):
for k in range(3):
for l in range(3):
i = a[x]-k ; j = b[x]-l
if i<0 or i+3>h or j<0 or j+3>w:
continue
sq[i][j] += 1
sq = np.array(sq)
for j in range(10):
print(np.count_nonzero(sq == j)) |
s460129160 | p04000 | u272557899 | 1558213026 | Python | Python (3.4.3) | py | Runtime Error | 1842 | 147388 | 1459 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque
from heapq import heappush, heappop
sys.setrecursionlimit(10 ** 7)
ans = 0
tmp = 0
inf = 10 ** 20
INF = float("INF")
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
ddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]
"""for dx, dy in dd:
nx = j + dx; ny = i + dy
if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
h, w, n = wi()
c = mip(n)
d = collections.defaultdict(int)
for i in range(n):
for dx, dy in ddn9:
nx = c[i][1] + dx;
ny = c[i][0] + dy
if 0 < nx < w - 1 and 0 < ny < h - 1:
d[str(ny) + str(nx)] += 1
ansli = [0] * 10
for i in d:
ansli[d[i]] += 1
ansli[0] = (h - 2) * (w - 2) - sum(ansli)
for i in ansli:
print(i) |
s133278061 | p04000 | u315485238 | 1556761151 | Python | Python (3.4.3) | py | Runtime Error | 330 | 27428 | 667 | H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
from itertools import product
S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)
for a,b in AB:
for x,y in product([-1,0,1], repeat=2):
X = a+x-1
Y = b+y-1
if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
continue
for i in range(10):
if (X, Y) in S[i]:
S[i].remove((X, Y))
S[i+1].add((X, Y))
N[i] -=1
N[i+1] +=1
break
else:
S[1].add((X, Y))
N[1] +=1
N[0] -=1
L = [len(s) for s in S[1:]]
print((H-2)*(W-2) - sum(L))
for l in L:
print(l) |
s207428143 | p04000 | u189575640 | 1556484617 | Python | Python (3.4.3) | py | Runtime Error | 2264 | 127068 | 583 | from collections import defaultdict
H,W,N = [int(n) for n in input().split()]
# N = int(input())
dxy = [[0,0],[1,0],[0,1],
[-1,0],[0,-1],[1,1],
[-1,-1], [1,-1], [-1,1]]
effdic = defaultdict(int)
for i in range(N):
a,b = [int(n)-1 for n in input().split()]
for d in dxy:
ta, tb = a+d[0], b+d[1]
if(1 <= ta < H-1 and 1 <= tb < W-1):
s = str(ta) + str(tb)
effdic[s] += 1
ans = {0:(H-2)*(W-2), 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0}
for k in effdic.keys():
ans[effdic[k]]+=1
ans[0]-=1
for k in ans.keys():
print(ans[k])
|
s230226136 | p04000 | u189575640 | 1556484072 | Python | Python (3.4.3) | py | Runtime Error | 2024 | 126796 | 696 | from sys import exit
H,W,N = [int(n) for n in input().split()]
# N = int(input())
dxy = [[0,0],[1,0],[0,1],
[-1,0],[0,-1],[1,1],
[-1,-1], [1,-1], [-1,1]]
effdic = {}
for i in range(N):
a,b = [int(n)-1 for n in input().split()]
for d in dxy:
ta, tb = a+d[0], b+d[1]
if(1 <= ta < H-1 and 1 <= tb < W-1):
s = str(ta) + str(tb)
if(s in effdic):
effdic[s] += 1
else:
effdic[s] = 1
ans = {0:(H-2)*(W-2), 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0}
for k in effdic.keys():
ans[effdic[k]]+=1
ans[0]-=1
for k in ans.keys():
print(ans[k])
# S = str(input())
# L = len(S)
# T = str(input())
# exit()
|
s751648017 | p04000 | u189575640 | 1553442008 | Python | Python (3.4.3) | py | Runtime Error | 2512 | 126788 | 995 | from sys import exit
H,W,N = [int(n) for n in input().split()]
dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,-1],[-1,1],[1,1],[-1,-1],[0,0]]
# ansdic = {0:(H-2)*(W-2),1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0}
ansdic = {}
# memo = [[0 for _ in range(W-1)] for __ in range(H-1)]
# print(memo)
for i in range(N):
ab = [int(n) for n in input().split()]
ab[0]-=1
ab[1]-=1
for d in dxy:
per = [ab[0] + d[0],ab[1] + d[1]]
if(1 <= per[0] <= H-2 and 1 <= per[1] <= W-2):
rep = "".join([str(per[0]),str(per[1])])
if not rep in ansdic:
ansdic[rep] = 1
else:
ansdic[rep] +=1
# ansdic[memo[per[0]][per[1]]]-=1
# memo[per[0]][per[1]]+=1
# ansdic[memo[per[0]][per[1]]]+=1
ans = {0:(H-2)*(W-2),1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0}
for k in ansdic.keys():
ans[ansdic[k]]+=1
ans[0]-=1
for k in ans.keys():
print(ans[k])
# S = str(input())
# L = len(S)
# T = str(input())
exit()
|
s344695956 | p04000 | u794173881 | 1553320306 | Python | Python (3.4.3) | py | Runtime Error | 2051 | 167124 | 631 | h,w,n = map(int,input().split())
coord = [list(map(int,input().split())) for i in range(n)]
num = {}
for i in range(n):
for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:
if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):
continue
if not coord[i][0]+j in num:
num[coord[i][0]+j] = {}
if not coord[i][1]+k in num[coord[i][0]+j]:
num[coord[i][0]+j][coord[i][1]+k] = 1
else:
num[coord[i][0]+j][coord[i][1]+k] += 1
ans = [0]*9
for i in num:
for value in num[i].values():
ans[value] +=1
print((h-2)*(w-2)-sum(ans))
for i in range(1,9):
print(ans[i]) |
s178687519 | p04000 | u643840641 | 1552753803 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 804 | #include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef pair<int, int> P;
int main(){
int h, w, n; cin >> h >> w >> n;
map<P, int> mp;
int dx[3] = {-1, 0, 1};
int dy[3] = {-1, 0, 1};
rep(i, n){
int a, b; cin >> a >> b;
rep(j, 3)rep(k, 3){
int nx = a + dx[j]; int ny = b + dy[k];
if(1<nx && nx<h && 1<ny && ny<w) mp[P(nx, ny)]++;
}
}
long cnt[10]; rep(i, 10) cnt[i] = 0;
for(auto itr=mp.begin(); itr!=mp.end(); itr++) cnt[itr->second]++;
cnt[0] = (h-2) * (w-2);
For(i, 1, 10) cnt[0] -= cnt[i];
rep(i, 10) cout << cnt[i] << endl;
} |
s657408962 | p04000 | u367130284 | 1549836161 | Python | Python (3.4.3) | py | Runtime Error | 1556 | 21988 | 337 | from collections import defaultdict
import numpy as np
d=defaultdict(dict)
h,w,n=map(int,input().split())
for s in range(1,11):
d[s]=0
A=np.zeros((h,w))
for s in range(n):
a,b=map(int,input().split())
A[a-1][b-1]=1
for s in range(h-2):
for t in range(w-2):
d[int(np.sum(A[s:s+3,t:t+3]))]+=1
for k,v in d.items():
print(v)
|
s816586107 | p04000 | u883048396 | 1539401731 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1261 | import sys
def 解()
iH,iW,iN = [int(_) for _ in input().split()]
aD = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
iMax = (iH - 2) * (iW -2)
#print (iMax)
dC={}
for i in range(10):
dC[i]=0
#愚直 無理 つらい
#for i in range(1,iH -1):
# for j in range(1,iW-1):
# tmp = 0
# for a in aD:
# if j<= a[1] <=j+2 and i<= a[0] <= i+2:
# tmp +=1
# dC[tmp] +=1
#なんというか、面倒くさくなって解法みても
#面倒くさがらずやれとしか書いてなくてつらい
dM = {}
for a in aD:
y=a[0]
x=a[1]
for aP in [(y-2,x-2),(y-2,x-1),(y-2,x),(y-1,x-2),(y-1,x-1),(y-1,x),(y,x-2),(y,x-1),(y,x)]:
if 0< aP[0]<iH-1 and 0 < aP[1] < iW-1:
iP = aP[0]*iW + aP[1]
if iP in dM: #もう最初から足したったらええんや
dM[iP] += 1
else:
dM[iP] = 1
for i in dM:
dC[dM[i]]+=1
iAllBM=0
for i in range(1,10):
iAllBM+=dC[i]
dC[0] = iMax -iAllBM #点のないマス0は引き算で出せる
for i in range(10):
print(dC[i])
解()
|
s825312878 | p04000 | u118605645 | 1531992794 | Python | Python (3.4.3) | py | Runtime Error | 1977 | 180032 | 556 | H, W, N = (int(i) for i in input().split())
P = []
for i in range(N):
pa, pb = input().split()
P.append((int(pa)-1, int(pb)-1))
Q = {}
for pa, pb in P:
for i in range(3):
for j in range(3):
if (pa - i >= 0) and (pb - j >= 0) and (pa - i <= H - 3) and (pb - j <= W - 3):
if (pa - i, pb - j) in Q:
Q[(pa - i, pb - j)] += 1
else:
Q[(pa - i, pb - j)] = 1
cnt = [0] * 9
for k, v in Q.items():
cnt[v] += 1
cnt[0] = (H - 2) * (W - 2) - len(Q)
print(cnt) |
s377133963 | p04000 | u006657459 | 1531797673 | Python | Python (3.4.3) | py | Runtime Error | 3197 | 30052 | 481 | import numpy as np
from scipy.sparse import lil_matrix
from collections import defaultdict
n_rows, n_cols, N = map(int, input().split())
matrix = lil_matrix((n_rows, n_cols), dtype=np.int8)
for i in range(N):
xi, yi = map(int, input().split())
matrix[xi-1, yi-1] = 1
ret = [0]*10
for row in range(0, n_rows-2):
for col in range(0, n_cols-2):
mat = matrix[row:row+3, col:col+3]
n_block = np.sum(mat)
ret[n_black] += 1
for r in ret:
print(r) |
s273259273 | p04000 | u006657459 | 1531796154 | Python | Python (3.4.3) | py | Runtime Error | 3195 | 29984 | 603 | import numpy as np
from scipy.sparse import lil_matrix
from collections import defaultdict
n_rows, n_cols, N = map(int, input().split())
matrix = lil_matrix((n_rows, n_cols), dtype=np.int8)
for i in range(N):
xi, yi = map(int, input().split())
matrix[xi-1, yi-1] = 1
def count_black(row, col):
if row + 2 >= n_rows or col + 2 >= n_cols:
return -1
mat = matrix[row:row+3, col:col+3]
return np.sum(mat)
ret = [0]*10
for row in range(0, n_rows-2):
for col in range(0, n_cols-2):
n_black = count_black(row, col)
ret[n_black] += 1
for r in ret:
print(r) |
s337924498 | p04000 | u268793453 | 1528414491 | Python | Python (3.4.3) | py | Runtime Error | 3328 | 1444404 | 541 | h, w, n = [int(i) for i in input().split()]
if n == 0:
for i in range(10):
print(0)
exit(0)
a, b = zip(*
[[int(i) for i in input().split()] for j in range(n)])
board = [[0]*(w+1) for i in range(h+1)]
ans = [0] * 10
ans[0] = min(0, (h-2)) * min(0, (w-2))
for a, b in zip(a, b):
for i in range(max(2, a-1), min(h, a+2)):
for j in range(max(2, b-1), min(w, b+2)):
try:
ans[board[i][j]] -= 1
board[i][j] += 1
ans[board[i][j]] += 1
except:
pass
for i in range(10):
print(ans[i]) |
s263332463 | p04000 | u268793453 | 1528414075 | Python | Python (3.4.3) | py | Runtime Error | 3338 | 1444404 | 470 | h, w, n = [int(i) for i in input().split()]
a, b = zip(*
[[int(i) for i in input().split()] for j in range(n)])
board = [[0]*(w+1) for i in range(h+1)]
ans = [0] * 10
ans[0] = (h-2) * (w-2)
for a, b in zip(a, b):
for i in range(max(2, a-1), min(h, a+2)):
for j in range(max(2, b-1), min(w, b+2)):
try:
ans[board[i][j]] -= 1
board[i][j] += 1
ans[board[i][j]] += 1
except:
pass
for i in range(0, 10):
print(ans[i]) |
s289139767 | p04000 | u268793453 | 1528413922 | Python | Python (3.4.3) | py | Runtime Error | 3339 | 1444404 | 468 | h, w, n = [int(i) for i in input().split()]
a, b = zip(*
[[int(i) for i in input().split()] for j in range(n)])
board = [[0]*(w+1) for i in range(h+1)]
ans = [0] * 9
ans[0] = (h-2) * (w-2)
for a, b in zip(a, b):
for i in range(max(2, a-1), min(h, a+2)):
for j in range(max(2, b-1), min(w, b+2)):
try:
ans[board[i][j]] -= 1
board[i][j] += 1
ans[board[i][j]] += 1
except:
pass
for i in range(0, 9):
print(ans[i]) |
s913880047 | p04000 | u018679195 | 1524339063 | Python | PyPy2 (5.6.0) | py | Runtime Error | 34 | 27500 | 560 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int w, h, n;
cin >> w >> h >> n;
map<pair<int, int>, int> cnt;
while (n--) {
int x, y;
cin >> x >> y;
for (int i = x - 3; i < x; i++)
for (int j = y - 3; j < y; j++)
if (i >= 0 && j >= 0 && i + 2 < w && j + 2 < h)
cnt[make_pair(i, j)]++;
}
vector<long long> res(10, 0);
res[0] = (long long) (w - 2) * (h - 2);
for (auto &it:cnt)
res[it.second]++, res[0]--;
for (auto &x:res)
cout << x << endl;
return 0;
} |
s184969682 | p04000 | u621935300 | 1521766806 | Python | Python (2.7.6) | py | Runtime Error | 3188 | 524324 | 454 | import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())
A=[ [None for i in range(W+1) ] for j in range(H+1)]
for i in range(N):
a,b=map(int, raw_input().split())
A[a][b]=1
d=[-1,0,1]
D=list(itertools.product(d,d))
l=defaultdict(lambda: 0)
for x in range(2,H):
for y in range(2,W):
cnt=0
for i,j in D:
#print x+i,y+j,A[x+i][y+j]
if A[x+i][y+j]==1:
cnt+=1
l[cnt]+=1
for i in range(10):
print l[i]
|
s964423132 | p04000 | u621935300 | 1521766701 | Python | Python (2.7.6) | py | Runtime Error | 3192 | 537764 | 462 | import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())
A=[ [None for i in range(W+1) ] for j in range(H+1)]
for i in range(N):
a,b=map(int, raw_input().split())
A[a][b]=1
d=[-1,0,1]
D=list(itertools.product(d,d))
l=defaultdict(lambda: 0)
for x in range(2,H):
for y in range(2,W):
cnt=0
for i,j in D:
#print x+i,y+j,A[x+i][y+j]
if A[x+i][y+j]==1:
cnt+=1
l[cnt]+=1
print l
for i in range(10):
print l[i]
|
s059133366 | p04000 | u764600134 | 1518414093 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1593 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc045/tasks/arc061_b
"""
import sys
from sys import stdin
input = stdin.readline
def solve(H, W, N, points):
ans = [0] * 10 # 3x3のうちマスがi個だけ黒いパタンの数
checked = set()
dx = [-2, -1, 0]
dy = [-2, -1, 0]
for x, y in points:
for xx in dx:
for yy in dy:
lbx = x + xx
lby = y + yy
if (lbx, lby) not in checked:
checked.add((lbx, lby))
if 1 <= lbx <= W and lbx+2 <= W and 1 <= lby <= H and lby+2 <= H:
res = 0
for ddx in [0, 1, 2]:
t = points[lbx + ddx]
if (lbx + ddx, lby) in t:
res += 1
if (lbx + ddx, lby + 1) in t:
res += 1
if (lbx + ddx, lby + 2) in t:
res += 1
ans[res] += 1
total = (W-2) * (H-2) # 3x3の正方形の全パタン
ans[0] = total - sum(ans[1:]) # 1マスも塗られていないのは、全パタン数-一つでも塗ってあるパタン数
return ans
def main(args):
points = dict()
H, W, N = map(int, input().split())
for _ in range(N):
y, x = map(int, input().split())
points[x].add((x, y))
ans = solve(H, W, N, points)
print(*ans, sep='\n')
if __name__ == '__main__':
main(sys.argv[1:])
|
s876524329 | p04000 | u252805217 | 1487631197 | Python | Python (3.4.3) | py | Runtime Error | 3286 | 1690100 | 484 | from itertools import product as prod
h, w, n = map(int, input().split())
can = [[0] * w for _ in range(h)]
for _ in range(n):
ai, bi = map(int, input().split())
a, b = ai - 1, bi - 1
can[a][b] = 1
ans = [0] * 10
for i, j in prod(range(h-2), range(w-2)):
idx = sum(can[i][j:j+3]) + sum(can[i+1][j:j+3]) + sum(can[i+2][j:j+3])
ans[idx] += 1
# print(can[i][j:j+3])
# print(can[i+1][j:j+3])
# print(can[i+2][j:j+3])
# print()
print(*ans, sep="\n") |
s373275966 | p04000 | u252805217 | 1487630982 | Python | Python (3.4.3) | py | Runtime Error | 3283 | 1690100 | 483 | from itertools import product as prod
h, w, n = map(int, input().split())
can = [[0] * w for _ in range(h)]
for _ in range(n):
ai, bi = map(int, input().split())
a, b = ai - 1, bi - 1
can[a][b] = 1
ans = [0] * 9
for i, j in prod(range(h-2), range(w-2)):
idx = sum(can[i][j:j+3]) + sum(can[i+1][j:j+3]) + sum(can[i+2][j:j+3])
ans[idx] += 1
# print(can[i][j:j+3])
# print(can[i+1][j:j+3])
# print(can[i+2][j:j+3])
# print()
print(*ans, sep="\n") |
s316966817 | p04000 | u830390742 | 1473789388 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 610 | H, W, N = map(int, raw_input().split())
dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
dy = [-1, -1, -1, 0, 0, 0, 1, 1, 1]
board = {}
for i in xrange(N):
a, b = map(int, raw_input().split())
for j in xrange(9):
x, y = a+dx[j], b+dy[j]
if x <= 1 or x >= H or y <= 1 or y >= W:
continue
if (x, y) in board:
board[(x, y)] += 1
else:
board[(x, y)] = 1
ans = [0] * 10
for v in board.values():
ans[v] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
for a in ans:
print a |
s722696793 | p04000 | u091855288 | 1473703265 | Python | Python (3.4.3) | py | Runtime Error | 1248 | 95484 | 842 | import numpy as np
H, W, N = list(map(int,input().split()))
counts = np.zeros(10,dtype=int)
if N == 0:
counts[0] = (H-2)*(W-2)
for jdx in range(10):
print( counts[jdx] )
quit()
A = [0] * N
B = [0] * N
M = np.zeros((H,W), dtype=int)
for idx in range(N):
A[idx], B[idx] = list(map(int,input().split()))
M[A[idx]-1,B[idx]-1] = 1
tmp1 = M[0:H-2].copy()
tmp2 = M[1:H-1].copy()
tmp3 = M[2:H].copy()
M2 = tmp1[0:tmp3.shape[0]] + tmp2[0:tmp3.shape[0]] + tmp3[0:tmp3.shape[0]]
M3 = M2.T.copy()
tmp1 = M3[0:W-2].copy()
tmp2 = M3[1:W-1].copy()
tmp3 = M3[2:W].copy()
M4 = tmp1[0:tmp3.shape[0]] + tmp2[0:tmp3.shape[0]] + tmp3[0:tmp3.shape[0]]
M5 = M4.ravel()
remain = (H-2)*(W-2)
for jdx in range(10):
M5 = M5[M5>jdx]
counts[jdx] = remain - M5.size
remain = M5.size
for jdx in range(10):
print( counts[jdx] ) |
s480068330 | p04000 | u601018334 | 1473647610 | Python | Python (3.4.3) | py | Runtime Error | 37 | 3064 | 432 | def solve():
H, W, N = list(map(int, input().split()))
a = []
for i in range(N):
a.append(list(map(int, input().split())))
board = np.zeros((H,W))
for x in a:
board[x[0]-1][x[1]-1] = 1
print(ans)
count = [0]*10
for i in range(1:H-1):
for j in range(1:W-1):
count(int(np.sum(board[i-1:j-1,i+1:j+1]))) += 1
for i in range(10):
print(count[i])
solve()
|
s411426831 | p04000 | u866746776 | 1473645266 | Python | Python (3.4.3) | py | Runtime Error | 2977 | 119952 | 465 | from collections import Counter
h, w, n = [int(i) for i in input().split()]
vs = []
for i in range(-1, 2):
for j in range(-1, 2):
vs.append((i,j))
cnt = []
for _ in range(n):
a, b = [int(i) for i in input().split()]
for v in vs:
aa = a + v[0]
bb = b + v[1]
if 2<=aa<=h-1 and 2<=bb<=w-1:
cnt.append(aa*h+bb)
cnt = Counter(cnt)
cnt2 = [0] * 10
cnt2[0] = (h-2)*(w-2)
for k in cnt:
c = cnt[k]
cnt2[c] += 1
cnt2[0] -= 1
for i in cnt2:
print(i)
|
s728454734 | p04001 | u611090896 | 1600130964 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8936 | 228 | s = input()
n = len(s-1)
total=0
for i in range(2**n):
pl=['']*n
ans=''
for j in range(n):
if ((i>>j)&1):
pl[n-1-j] = '+'
for k in range(n):
ans += s[k]+pl[k]
ans+=s[-1]
total += eval(ans)
print(total) |
s794484063 | p04001 | u956836108 | 1597878234 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9188 | 349 | # -*- coding: utf-8 -*-
s = int(input())
n = len(s) - 1
answer = 0
for i in range(2 ** n):
operation = [""] * n
for j in range(n):
if (i >> j) & 1:
operation[n - 1 -j] = "+"
formula = ""
for p_n, p_o in zip(s, operation + [""]):
formula += (p_n + p_o)
answer += eval(formula)
print(answer) |
s056278173 | p04001 | u418826171 | 1597870028 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8872 | 1 | a |
s584466912 | p04001 | u521271655 | 1597435282 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8924 | 260 | s = input()
for i in range(2**(len(s)-1)):
plus = [""]*(len(s))
fomula = ""
for j in range(len(s)-1):
if(i >> j & 1):
plus[j] = "+"
for k in range(len(s)):
fomula += s[k] + plus[k]
ans += eval(fomula)
print(ans) |
s532178637 | p04001 | u192165179 | 1597433378 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9100 | 252 | from sys import stdin
input = stdin.readline
S = input()
n = len(S)
tot = 0
for i in range(2**(n-1)):
f = S[0]
for j in range(n-1):
if ((i >> j) & 1):
f += " "
f += S[j+1]
tot += sum(map(int, f.split(" ")))
print(tot) |
s344116638 | p04001 | u473433753 | 1596896659 | Python | Python (3.8.2) | py | Runtime Error | 31 | 8984 | 357 | n = [int(x) for x in input()]
op_cnt = len(n) - 1
out=0
for i in range(2 ** op_cnt):
op = ["+"] * op_cnt
for j in range(op_cnt):
if ((i >> j) & 1):
op[op_cnt - 1 - j] = ""
box=""
for a,b in zip(n,op+[""]):
box+=(str(a)+b)
box=box.split('+')
ou=0
for k in box:
out+=int(k)
print(out) |
s992572904 | p04001 | u313403396 | 1594951691 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9096 | 755 | #!/usr/bin/env python3
# from typing import *
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def mystoi(S):
num = 0;
for i in range(len(S)-1, 0, -1):
num += int(S[i]) * (10**(len(S)-1-i));
return num;
S = input()
N = len(S)
ans = 0
for bit in range(2**N):
j = 0
for i in range(N):
if bit & (1<<i):
ans += mystoi(S[j:(i-j)])
j = i+1
ans += mystoi(S[j:])
print(ans)
'''
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/test_py.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/etest_py.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/submit_py.sh
'''
|
s849414166 | p04001 | u313403396 | 1594951570 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9044 | 870 | #!/usr/bin/env python3
# from typing import *
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def mystoi(S):
num = 0;
for i in range(len(S)-1, 0, -1):
num += int(S[i]) * (10**(len(S)-1-i));
return num;
def solve(S):
N = len(S)
ans = 0
for bit in range(2**N):
j = 0
for i in range(N):
if bit & (1<<i):
ans += mystoi(S[j:(i-j)])
j = i+1
ans += mystoi(S[j:])
print(ans)
def main():
S = input()
solve(S)
if __name__ == '__main__':
main()
'''
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/test_py.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/etest_py.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/submit_py.sh
'''
|
s514796426 | p04001 | u557792847 | 1594776912 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9060 | 259 | S = input()
total = 0
for p in (product((0, 1), repeat=len(S)-1)):
ns = S[0]
for i, pp in enumerate(p, 1):
if pp == 0:
ns += S[i]
else:
total += int(ns)
ns = S[i]
total += int(ns)
print(total)
|
s370079550 | p04001 | u746627216 | 1594650495 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9172 | 249 |
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
LR = [0] * M
for i in range(M):
L[i], R[i] = map(int, input().split())
ans = min(R) - max(L)
if ans >=0:
print(ans + 1)
else:
print(0)
#print(max(L))
#print(min(R)) |
s213516320 | p04001 | u114099505 | 1594249779 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8892 | 223 |
def a(t,i):
if i= len(s)-1:
return sum(map(int,t.split('+')))
return a(t+s[i+1],i+1) + a(t+'+'+s[i+1],i+1) #関数の中に入れると最後の項でまとめて処理できる
s = input()
print(a(s[0],0)) |
s151544855 | p04001 | u114099505 | 1594249753 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8924 | 256 | #入力
#関数へ
#関数
#
def a(t,i):
if j = len(s)-1:
return sum(map(int,t.split('+')))
return a(t+s[i+1],i+1) + a(t+'+'+s[i+1],i+1) #関数の中に入れると最後の項でまとめて処理できる
s = input()
print(a(s[0],0)) |
s634005364 | p04001 | u114099505 | 1593404106 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9136 | 161 | def a(t,i):
if i == n-1:
return sum(map(int,t.split()))
return a(t+s[i+1],i+1)+ a(t+"+"+s[i+1],i+1)
s = input()
n = len(s)
i=0
print(a(s[0],0))
|
s727949249 | p04001 | u114099505 | 1593404066 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9140 | 153 | def a(t,i):
if i == n-1:
return sum(map(int,t.split()))
return a(t+s[i+1],i+1)+ a(t+"+"+s[i+1])
s = input()
n = len(s)
print(a(s[0],0))
|
s559968736 | p04001 | u114099505 | 1593404000 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9144 | 163 | def a(s,i):
if i == n-1:
return sum(map(int,s.split()))
return a(s[i]+s[i+1],i+1)+ a(s[i]+"+"+s[i+1])
s = input()
n = len(s)
i=0
print(a(s[0],0))
|
s406069541 | p04001 | u114099505 | 1593403922 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9096 | 146 | def a(s,i):
if i == n-1:
return eval(s)
return a(s[i]+s[i+1],i+1)+ a(s[i]+"+"+s[i+1])
s = input()
n = len(s)
i=0
print(a(s[0],0)) |
s677309252 | p04001 | u114099505 | 1592676798 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9032 | 157 | def a(s,i):
if i == l-1:
return sum(map(int,s.split("+")))
return a(s+s[i+1],i+1)+a(s+"+"+s[i+1],i+1)
s = input()
l = len(s)
print(a(s[0],0)) |
s460663719 | p04001 | u730769327 | 1592353473 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38256 | 388 | s=input()
m=len(s)
sm=0
for i in range(2**(m-1)):
a=list(str(bin(i)))[::-1]
b=list(s)
for j in range(len(a)):
if a[j]==1:
b.insert(-j-1,'+')
sm+=eval(''.join(b))
print(sm)s=input()
m=len(s)
sm=0
for i in range(2**(m-1)):
a=list(str(bin(i)))[::-1]
b=list(s)
for j in range(len(a)-1,-1,-1):
if a[j]=='1':
b.insert(-j-1,'+')
sm+=eval(''.join(b))
print(sm) |
s108343773 | p04001 | u996996256 | 1592059021 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 261 | s = input()
total = 0
for i in product('01', repeat=len(s)-1):
buf = s[0]
for j in range(len(s)-1):
if i[j] == '1':
total += int(buf)
buf = s[j+1]
else:
buf += s[j+1]
total += int(buf)
print(total) |
s948450759 | p04001 | u996996256 | 1592058967 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 261 | s = input()
total = 0
for i in product('01', repeat=len(s)-1):
buf = s[0]
for j in range(len(s)-1):
if i[j] == '1':
total += int(buf)
buf = s[j+1]
else:
buf += s[j+1]
total += int(buf)
print(total) |
s988022229 | p04001 | u169678167 | 1591927356 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 739 | s = input()
k = len(s)
# def dfs(i, f) :
# """
# argument i : どこから始めるか
# f : 最初の数
# returen : falese or ture(作れるならtrue)
# """
# if i == k-1:
# return sum(list(map(int, f.split('+'))))
# return dfs(i+1, f + s[ i +1 ]) + \
# dfs(i+1, f + '+' + s[ i +1 ])
# print(dfs(0, s[0]))
#bit木を書いていきます
ans = 0
for bit in range(1 << (k-1)):
f = s[0]
for i in range(k-1):
# if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい
if bit & (1 << i):
f += '+'
f += f[i + 1]
ans += sum(list(map(int, f.split('+'))))
print(ans) |
s793285241 | p04001 | u169678167 | 1591927238 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 737 | s = input()
k = len(s)
# def dfs(i, f) :
# """
# argument i : どこから始めるか
# f : 最初の数
# returen : falese or ture(作れるならtrue)
# """
# if i == k-1:
# return sum(list(map(int, f.split('+'))))
# return dfs(i+1, f + s[ i +1 ]) + \
# dfs(i+1, f + '+' + s[ i +1 ])
# print(dfs(0, s[0]))
#bit木を書いていきます
ans = 0
for bit in range(1 << k-1):
f = s[0]
for i in range(k-1):
# if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい
if bit & (1 << i):
f += '+'
f += f[i + 1]
ans += sum(list(map(int, f.split('+'))))
print(ans) |
s429378011 | p04001 | u169678167 | 1591927187 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 364 | s = input()
k = len(s)
ans = 0
for bit in range(1 << k-1):
f = s[0]
for i in range(k-1):
# if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい
if bit & (1 << i):
f += '+'
f += f[i + 1]
ans += sum(list(map(int, f.split('+'))))
print(ans) |
s653720314 | p04001 | u101350975 | 1591896518 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 228 | from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
if i = n-1:
return sum(list(map(int, f.split('+'))))
return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' + s[i-1])
print(dfs(0, S[0]))
|
s681538750 | p04001 | u101350975 | 1591896459 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 226 | from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
if i = n-1:
return sum(list(map(int, f.split('+'))))
return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' s[i-1])
print(dfs(0, S[0]))
|
s030320851 | p04001 | u101350975 | 1591896437 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 264 | from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
if i = n-1:
return sum(list(map(int, f.split('+'))))
return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' s[i-1])
#最初が+なし、次が+あり
print(dfs(0, S[0]))
|
s476094493 | p04001 | u101350975 | 1591896361 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 264 | from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
if i = n-1:
return sum(list(map(int, f.split('+'))))
return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' s[i-1])
#最初が+なし、次が+あり
print(def(0, S[0]))
|
s671611464 | p04001 | u101350975 | 1591896333 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 264 | from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
if i = n-1:
return sum(list(map(int, f.split('+'))))
return dfs(i+1, f + S[i + 1]) + dfs(i + 1, f + '+' s[i-1])
#最初が+なし、次が+あり
print(def(0, s[0]))
|
s333317695 | p04001 | u582614471 | 1591712282 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 275 | aqqn = list(input())
ans = 0
for i in range(2**(len(n)-1)):
plus = [""]*(len(n))
fomula = ""
for j in range(len(n)-1):
if(i>>j & 1):
plus[j] = "+"
for i in range(len(n)):
fomula += n[i] + plus[i]
ans += eval(fomula)
print(ans)
|
s044792795 | p04001 | u041351774 | 1591557530 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 266 | s=input()
ans=0
for i in range(1 << len(s)-1):
l=[]
for j in range(len(s)-1):
if (i>>j)&1==1:
l.append(s[j])
l.append("+")
else:
l.append(s[j])
l.append(s[len(s)-1])
sum+=eval(''.join(l))
print(sum) |
s607311448 | p04001 | u041351774 | 1591557481 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38256 | 266 | s=input()
ans=0
for i in range(1 << len(s)-1):
l=[]
for j in range(len(s)-1):
if (i>>j)&1==1:
l.append(s[j])
l.append("+")
else:
l.append(S[j])
l.append(s[len(s)-1])
sum+=eval(''.join(l))
print(sum) |
s053714000 | p04001 | u541017633 | 1591337527 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 490 | // https://atcoder.jp/contests/arc061/tasks/arc061_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string S;
cin >> S;
ll ans = 0;
int m = S.size() - 1;
rep(bit, 1 << m) {
ll cur = S[0] - '0';
rep(i, m) {
if (bit & (1 << i)) {
ans += cur;
cur = 0;
}
cur = cur * 10 + S[i + 1] - '0';
}
ans += cur;
}
cout << ans << endl;
return 0;
}
|
s167356373 | p04001 | u868982936 | 1591313768 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 280 | from itertools import *
A = list(map(int, list(input()))
ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
now = A[0]
for i in range(N):
if p[i] == 0:
now = now*10 + A[i+1]
else:
ans += now
now = A[i+1]
ans += now
print(ans)
|
s693084327 | p04001 | u868982936 | 1591313705 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 277 | from itertools import *
A = list(map(int, list(input()))
ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
now = A[0]
for i in range(N):
if p[i] == 0:
now = now*10 + A[i+1]
else:
ans += now
now = A[i+1]
ans += now
print(ans)
|
s289765373 | p04001 | u868982936 | 1591313655 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 273 | import itertools
A = list(map(int, list(input()))
ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
now = A[0]
for i in range(N):
if p[i] == 0:
now = now*10 + A[i+1]
else:
ans += now
now = A[i+1]
ans += now
print(ans)
|
s235664174 | p04001 | u868982936 | 1591313418 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 279 | from itertools import *
A = list(map(int, list(input()))
ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
now = A[0]
for i in range(N):
if p[i] == 0:
now = now*10 + A[i+1]
else:
ans += now
now = A[i+1]
ans += now
print(ans) |
s747039565 | p04001 | u154059173 | 1591238814 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3064 | 309 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = str(number[0])
for i in range(N-1):
if (bit&(1<<i)):
f = f+'+'+str(number[i+1])
else:
f = f+str(number[i+1])
ans = ans + eval(f)
print(ans) |
s290529005 | p04001 | u154059173 | 1591238686 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3064 | 309 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = str(number[0])
for i in range(N-1):
if (bit&(1<<i)):
f = f+'+'+str(number[i+1])
else:
f = f+str(number[i+1])
ans = ans + eval(f)
print(ans) |
s470147537 | p04001 | u154059173 | 1591238393 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 294 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = number[0]
for i in range(N-1):
if (bit&(1<<i)):
f = f+'+'+number[i+1]
else:
f = f+number[i+1]
ans = ans + eval(f)
print(ans) |
s512308020 | p04001 | u154059173 | 1591238307 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3064 | 292 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = number[0]
for i in range(N-1):
if bit&(1<<i):
f = f+'+'+number[i+1]
else:
f = f+number[i+1]
ans = ans + eval(f)
print(ans) |
s405613837 | p04001 | u154059173 | 1591238184 | Python | Python (3.4.3) | py | Runtime Error | 27 | 3060 | 293 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = number[0]
for i in range(N-1):
if bit&(1<<i):
f = f+'+'+number[i+1]
else:
f = f+number[i+1]
ans = ans + eval(f)
print(ans)
|
s190034342 | p04001 | u154059173 | 1591238115 | Python | Python (3.4.3) | py | Runtime Error | 27 | 3064 | 292 | import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)
ans = 0
for bit in range(1<<(N-1)):
f = number[0]
for i in range(N-1):
if bit&(1<<i):
f = f+'+'+number[i+1]
else:
f = f+number[i+1]
ans = ans + eval(f)
print(ans) |
s985660137 | p04001 | u600261652 | 1590941195 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 178 | S = int(input())
N = len(S)
for i in range(2**(N-1)):
list = []
for j in range(N):
if ((i >> j) & 1):
list.attend(S[j:])
list.attend(S[:j])
print(sum(list)) |
s841401910 | p04001 | u600261652 | 1590941031 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 158 | S = int(input())
N = len(S)
for i in range(2**(N-1)):
list = []
for j in range(N):
if ((i >> j) & 1):
list.attend(item[j][0])
print(sum(list)) |
s718952008 | p04001 | u600261652 | 1590940923 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 156 | S = int(input())
N = len(S)
for i in range(2**(N-1)):
list = []
for j in range(N):
if ((i >> j) & 1):
list.attend(item[j][0])
print(sum(list)) |
s943145950 | p04001 | u696444274 | 1589938263 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 523 | s = input()
n = len(s)-1
ans = 0
for i in range(2**n):
data = []
for j in range(n):
if((i >> j) & 1):
data.append(1)
else:
data.append(0)
num = s[0]
x = []
for i in range(n-1):
if data[i] == 1:
x.append(int(num))
num = s[i+1]
else:
num += s[i+1]
if data[-1] == 0:
num += s[-1]
x.append(int(num))
else:
x.append(int(num))
x.append(int(s[-1]))
ans += sum(x)
print(ans)
|
s890846939 | p04001 | u780475861 | 1589832136 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 520 | def powerset(iterable):
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
def s_to_num(s):
numlst = list(map(int, s))
res = 0
for i in numlst:
res *= 10
res += i
return res
s = input()
length = len(s)
res = 0
for i in powerset(range(1, length)):
if not i:
res += int(s)
else:
jlst = [0] + list(i) + [length]
for j in range(len(jlst) - 1):
res += s_to_num(s[jlst[j]:jlst[j + 1]])
print(res) |
s653716487 | p04001 | u257265865 | 1589329457 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 157 | S=input()
n=len(S)-1
ans=0
def dfs(i,f):
if i==n:
return sum(map(int,f.split("+")))
return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])
print(dfs(0,S[0])
|
s347877556 | p04001 | u257265865 | 1589329439 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38256 | 157 | S=input()
n=len(S)-1
ans=0
dfs dfs(i,f):
if i==n:
return sum(map(int,f.split("+")))
return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])
print(def(0,S[0])
|
s733009195 | p04001 | u257265865 | 1589329382 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38256 | 157 | S=input()
n=len(S)-1
ans=0
def dfs(i,f):
if i==n:
return sum(map(int,f.split("+")))
return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])
print(def(0,S[0])
|
s643490861 | p04001 | u257265865 | 1589260160 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38256 | 188 | S=input()
n=len(S)
ans=0
f=S[0]
for bit in range(1<<(n-1)):
for i in range(n-1):
if bit & (1<<i):
f+="+"
f+=s[i+1]
ans+=sum(map(int,f.split("+")))
print(ans)
|
s679330107 | p04001 | u257265865 | 1589260105 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 189 | S=input()
n=len(S)-1
ans=0
f=S[0]
for bit in range(1<<(n-1)):
for i in range(n-1):
if bit & (1<<i):
f+="+"
f+=s[i+1]
ans+=sum(map(int,f.split("+")))
print(ans)
|
s261051712 | p04001 | u453623947 | 1589256701 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 345 | s = list(input())
n = len(s)
ans = 0
for i in range(2**(n-1)) :
wa = 0
kou = s[0]
for j in range(n-1):
if i>>j & 1 :
wa += int(kou)
kou = s[j+1]
else :
kou += s[j+1]
if j == n-2 :
wa += int(kou)
ans += wa
if n == 1 :
print(int(s))
else :
print(ans) |
s013963656 | p04001 | u057993957 | 1589211046 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 203 | s = list(input())
n = len(s)-1
ans = 0
for x in list(product(["", "+"], repeat=n)):
x = list(x)
x.append("")
strs = [i+j for i, j in zip(s, x)]
ans += eval("".join(strs))
print(ans) |
s348896935 | p04001 | u916662650 | 1589128855 | Python | Python (3.4.3) | py | Runtime Error | 45 | 3064 | 439 | s = input()
sum = 0
l = ["+"] * (len(s) - 1)
n = 2 ** (len(s) - 1)
for i in range(n):
l = ["+"] * (len(s) - 1)
for j in range(len(l)):
ls = list(s)
if (i >> j) & 1:
l[j] = ""
for x in range(len(l)):
ls.insert(2*x+1,l[x])
maped_list = map(str, ls)
mojiretu = ''.join(maped_list)
sum = sum + eval(mojiretu)
print(sum)
|
s803241875 | p04001 | u034418163 | 1588833269 | Python | Python (3.4.3) | py | Runtime Error | 77 | 3936 | 316 | S = input()
def dfs(a,s,n): #a:今まで計算した分、s:数字(文字)、n:左から何番目の位置に+を入れるか入れないか
if(len(s) == n+1):
return int(s[len(s)-1]) + int(s[:len(s)-1]) + int(s) + 2*a
else:
return dfs(a,s,n+1) + dfs(a+int(s[:n]),s[n:],1)
print(dfs(0,S,1)) |
s489860525 | p04001 | u114099505 | 1588641496 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 155 | def a(t,i):
if i==l-1:
return sum(map(int,t.split('+'))))
return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)
s=input()
l = len(s)
print(a(s[0],0))
|
s706451344 | p04001 | u114099505 | 1588640272 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 163 |
def a(t,i):
if i==l-1:
print(sum(map(int,t.split('+'))))
exit()
return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)
s=input()
a(s[0],0)
l = len(s) |
s485772715 | p04001 | u114099505 | 1588640199 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 164 |
def a(t,i):
if i==l-1:
print(sum(map(int,t.split('+'))))
exit()
return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)
s=input()
a(s[0],0)
l = s.len() |
s105866767 | p04001 | u114099505 | 1588640072 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 149 |
def a(t,i):
if i==l-1:
print(sum(map(int,t.split('+'))))
exit()
a(t+s[i+1])+a(t+'+'+s(i+1))
s=input()
a(s[0],0)
l = s.len() |
s991380522 | p04001 | u114099505 | 1588640021 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 146 |
def a(t,i):
if i==l-1:
print(sum(int(t.split('+'))))
exit()
a(t+s[i+1])+a(t+'+'+s(i+1))
s=input()
a(s[0],0)
l = s.len() |
s632422318 | p04001 | u114099505 | 1588639899 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 143 | def a(t,i):
if i=l-1:
print(sum(int(t.split('+'))))
exit()
a(t+s[i+1])+a(t+'+'+s(i+1))
s=input()
a(s[0],0)
l = s.len() |
s243117841 | p04001 | u209426189 | 1588456588 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38256 | 368 | from collection import deque
import copy
def main():
s = deque(list(input()))
s2 = copy.deepcopy(s)
n = len(s)
ans = 0
for i in range(2**n):
op = [None]*n-1
for j in range(n):
tmp_str = ''
if ((i<<j)&0):
tmp_str += s.popleft
else:
ans += int(tmp_str)
tmp_str = ''
if __name__ == '__main__':
main() |
s441520648 | p04001 | u112315075 | 1588215113 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 374 | import sys
S = list(map(int, sys.stdin.readline()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
sum_ = S[len_S - 1]
cursor = len_S - 1
power = 0
pattern = i
while cursor > 0:
cursor -= 1
if pattern % 2 == 1:
power += 1
else:
power = 0
sum_ += S[cursor] * (10 ** power)
pattern = pattern // 2
ans += sum_
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.