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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s963134606 | p00118 | u350804311 | 1473921276 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | while True:
H, W = list(map(int, input().split()))
if H == 0 and W == 0:
break
field = []
for i in range(H):
field.append(list(input()))
ans = 0
def field_count(x, y):
fruit = field[x][y]
field[x][y] = "."
for dx in [-1, 0, 1]:
nx = x + dx
if 0 <= nx < H and field[nx][y] == fruit:
field_count(nx, y)
for dy in [-1, 0, 1]:
ny = y + dy
if 0 <= ny < W and field[x][ny] == fruit:
field_count(x, ny)
for i in range(H):
for j in range(W):
if field[i][j] != ".":
field_count(i, j)
ans += 1
print(str(ans)) | Traceback (most recent call last):
File "/tmp/tmp55mvlw_i/tmpb7kjmbbt.py", line 2, in <module>
H, W = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s425578255 | p00118 | u227162786 | 1490011544 | Python | Python3 | py | Runtime Error | 0 | 0 | 765 | def dfs(h, w, m, v, H, W):
'''
m[h][w]?????????????????????????¨???????(v???True?????????)
'''
v[h][w] = True
for dh, dw in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
nh = h + dh
nw = w + dw
if nh in range(H) and nw in range(W) and m[nh][nw] == m[h][w] and v[nh][nw] == False:
dfs(nh, nw, m, v, H, W)
while True:
H, W = map(int, input().split())
if H == 0 and W == 0:
break
else:
m = [list(input()) for _ in range(H)]
v = [[False for _ in range(W)] for __ in range(H)]
count = 0
for h in range(H):
for w in range(W):
if v[h][w] == False:
count += 1
dfs(h, w, m, v, H, W)
print(count) | Traceback (most recent call last):
File "/tmp/tmpqraozhv2/tmpusy_6pme.py", line 14, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s827509767 | p00118 | u227162786 | 1490014345 | Python | Python3 | py | Runtime Error | 0 | 0 | 719 | def dfs(h, w, m, v, H, W):
'''
m[h][w]?????????????????????????¨???????(v???True?????????)
'''
v[h][w] = True
for dh, dw in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
nh = h + dh
nw = w + dw
if nh in range(H) and nw in range(W) and m[nh][nw] == m[h][w] and v[nh][nw] == False:
dfs(nh, nw, m, v, H, W)
while True:
H, W = list(map(int, input().split()))
if H == 0 and W == 0:
break
m = [input() for _ in range(H)]
v = [[False for _ in range(W)] for __ in range(H)]
count = 0
for h in range(H):
for w in range(W):
if v[h][w] == False:
count += 1
dfs(h, w, m, v, H, W)
print(count) | Traceback (most recent call last):
File "/tmp/tmp5x9g2e8w/tmpn_0q04b6.py", line 13, in <module>
H, W = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s874971731 | p00118 | u227162786 | 1490014780 | Python | Python3 | py | Runtime Error | 0 | 0 | 827 | def dfs(h, w, m, v, H, W):
'''
m[h][w]?????????????????????????¨???????(v???True?????????)
'''
v[h][w] = True
for dh, dw in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
nh = h + dh
nw = w + dw
if nh in range(H) and nw in range(W) and m[nh][nw] == m[h][w] and v[nh][nw] == False:
dfs(nh, nw, m, v, H, W)
ms, Hs, Ws = [], [], []
while True:
H, W = list(map(int, input().split()))
if H == 0 and W == 0:
break
Hs.append(H)
Ws.append(W)
m = [input() for _ in range(H)]
ms.append(m)
for m, H, W in zip(ms, Hs, Ws):
v = [[False for _ in range(W)] for __ in range(H)]
count = 0
for h in range(H):
for w in range(W):
if v[h][w] == False:
count += 1
dfs(h, w, m, v, H, W)
print(count) | Traceback (most recent call last):
File "/tmp/tmprmgwk4qr/tmpt31d4fjx.py", line 14, in <module>
H, W = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s430461085 | p00118 | u577311000 | 1493288529 | Python | Python3 | py | Runtime Error | 0 | 0 | 773 | def solve(values,hp=0,vp=0,stamp=0):
if hp==0:
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
values[hp-1][vp]=stamp
solve(values,hp-1,vp,stamp)
if hp!=len(values) and values[hp+1][vp]==values[hp][vp]:
values[hp+1][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=0 and values[hp][vp-1]==values[hp][vp]:
values[hp][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=len(values[hp] and) values[hp][vp+1]==values[hp][vp]:
values[hp][vp+1]=stamp
solve(values,hp-1,vp,stamp)
values[hp][vp]=stamp
for i in range(values):
for j in range(values[i]):
if values[i][j] in ['@','#','*']:
stamp+=1
solve(values,i,j,stamp)
return stamp
H,W = raw_input().split(' ')
values = list()
for _ in range(H):
values.append(raw_input().split())
print(solve(values)) | File "/tmp/tmp5fx3afbu/tmp6s7vhces.py", line 3
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
^
IndentationError: expected an indented block after 'if' statement on line 2
| |
s250587489 | p00118 | u577311000 | 1493288580 | Python | Python3 | py | Runtime Error | 0 | 0 | 773 | def solve(values,hp=0,vp=0,stamp=0):
if hp==0:
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
values[hp-1][vp]=stamp
solve(values,hp-1,vp,stamp)
if hp!=len(values) and values[hp+1][vp]==values[hp][vp]:
values[hp+1][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=0 and values[hp][vp-1]==values[hp][vp]:
values[hp][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=len(values[hp] and) values[hp][vp+1]==values[hp][vp]:
values[hp][vp+1]=stamp
solve(values,hp-1,vp,stamp)
values[hp][vp]=stamp
for i in range(values):
for j in range(values[i]):
if values[i][j] in ['@','#','*']:
stamp+=1
solve(values,i,j,stamp)
return stamp
H,W = raw_input().split(' ')
values = list()
for _ in range(H):
values.append(raw_input().split())
print(solve(values)) | File "/tmp/tmp0o_37l1i/tmpnqgzrz43.py", line 3
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
^
IndentationError: expected an indented block after 'if' statement on line 2
| |
s840156147 | p00118 | u577311000 | 1493288626 | Python | Python3 | py | Runtime Error | 0 | 0 | 773 | def solve(values,hp=0,vp=0,stamp=0):
if hp==0:
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
values[hp-1][vp]=stamp
solve(values,hp-1,vp,stamp)
if hp!=len(values) and values[hp+1][vp]==values[hp][vp]:
values[hp+1][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=0 and values[hp][vp-1]==values[hp][vp]:
values[hp][vp]=stamp
solve(values,hp-1,vp,stamp)
if vp!=len(values[hp] and) values[hp][vp+1]==values[hp][vp]:
values[hp][vp+1]=stamp
solve(values,hp-1,vp,stamp)
values[hp][vp]=stamp
for i in range(values):
for j in range(values[i]):
if values[i][j] in ['@','#','*']:
stamp+=1
solve(values,i,j,stamp)
return stamp
H,W = raw_input().split(' ')
values = list()
for _ in range(H):
values.append(raw_input().split())
print(solve(values)) | File "/tmp/tmp_gxj6lwz/tmp4v7_w0eo.py", line 3
if hp!=0 and values[hp-1][vp]==values[hp][vp]:
^
IndentationError: expected an indented block after 'if' statement on line 2
| |
s607731383 | p00118 | u577311000 | 1493289860 | Python | Python3 | py | Runtime Error | 0 | 0 | 708 | #! -*- coding:utf-8 -*-
def search(values,hp=0,vp=0,stamp=0,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[0])): return
if fruit!=values[hp][vp]: return
fruit,values[hp][vp]=values[hp][vp],stamp
search(values,hp-1,vp,stamp,fruit)
search(values,hp+1,vp,stamp,fruit)
search(values,hp,vp-1,stamp,fruit)
search(values,hp,vp+1,stamp,fruit)
def solve(values):
stamp=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,stamp+1,values[i][j])
stamp+=1
return stamp
H,W = list(map(int,input().split(' ')))
values = list()
for _ in range(H):
values.append([x for x in input().strip()])
print(solve(values)) | File "/tmp/tmpmpk73m2_/tmp6q33_bwi.py", line 3
def search(values,hp=0,vp=0,stamp=0,fruit):
^^^^^
SyntaxError: non-default argument follows default argument
| |
s157997220 | p00118 | u577311000 | 1493289876 | Python | Python | py | Runtime Error | 0 | 0 | 708 | #! -*- coding:utf-8 -*-
def search(values,hp=0,vp=0,stamp=0,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[0])): return
if fruit!=values[hp][vp]: return
fruit,values[hp][vp]=values[hp][vp],stamp
search(values,hp-1,vp,stamp,fruit)
search(values,hp+1,vp,stamp,fruit)
search(values,hp,vp-1,stamp,fruit)
search(values,hp,vp+1,stamp,fruit)
def solve(values):
stamp=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,stamp+1,values[i][j])
stamp+=1
return stamp
H,W = list(map(int,input().split(' ')))
values = list()
for _ in range(H):
values.append([x for x in input().strip()])
print(solve(values)) | File "/tmp/tmpc24entca/tmpz53fkxer.py", line 3
def search(values,hp=0,vp=0,stamp=0,fruit):
^^^^^
SyntaxError: non-default argument follows default argument
| |
s341019480 | p00118 | u577311000 | 1493290839 | Python | Python | py | Runtime Error | 0 | 0 | 819 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,stamp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[0])): return
if fruit!=values[hp][vp]: return
fruit,values[hp][vp]=values[hp][vp],stamp
search(values,hp-1,vp,stamp,fruit)
search(values,hp+1,vp,stamp,fruit)
search(values,hp,vp-1,stamp,fruit)
search(values,hp,vp+1,stamp,fruit)
def solve(values):
stamp=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,stamp,values[i][j])
stamp+=1
return stamp
if __name__=='__main__':
H,W = list(map(int,input().split(' ')))
values = list()
for _ in range(H):
values.append([x for x in input().strip()])
print(solve(values)) | Traceback (most recent call last):
File "/tmp/tmpug9jk2ud/tmpio5tc_fw.py", line 23, in <module>
H,W = list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s320321375 | p00118 | u683968848 | 1493291231 | Python | Python | py | Runtime Error | 0 | 0 | 1259 | import sys
process()
def process():
data = get_data()
integer = data[0].split()
H = int(integer[0])
W = int(integer[1])
data = data[1: -1]
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()] | File "/tmp/tmp992m_bxv/tmptmqqmo1w.py", line 15
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s016392104 | p00118 | u577311000 | 1493291492 | Python | Python3 | py | Runtime Error | 0 | 0 | 816 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
if __name__=='__main__':
line=input()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
values = list()
for _ in range(H):
values.append([x for x in input().strip()])
print(solve(values)) | Traceback (most recent call last):
File "/tmp/tmp7v6neyce/tmpf3jw1u7l.py", line 23, in <module>
line=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s056952302 | p00118 | u577311000 | 1493291582 | Python | Python3 | py | Runtime Error | 0 | 0 | 881 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line=input()
values=list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
for value in values:
print(solve(value))
if __name__=='__main__':
main(): | File "/tmp/tmpqwiwk4fn/tmpbkicazuu.py", line 34
main():
^
SyntaxError: invalid syntax
| |
s407186960 | p00118 | u577311000 | 1493291630 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
for value in values:
print(solve(value))
if __name__=='__main__':
main(): | File "/tmp/tmpcphh6erh/tmp6jtylyoe.py", line 34
main():
^
SyntaxError: invalid syntax
| |
s946090713 | p00118 | u577311000 | 1493291655 | Python | Python3 | py | Runtime Error | 0 | 0 | 910 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
for value in values:
print(solve(value))
if __name__=='__main__':
main(): | File "/tmp/tmp69tbiydi/tmpcez6icz3.py", line 34
main():
^
SyntaxError: invalid syntax
| |
s361423782 | p00118 | u577311000 | 1493291673 | Python | Python3 | py | Runtime Error | 0 | 0 | 906 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
for value in values:
print(solve(value))
if __name__=='__main__':
main(): | File "/tmp/tmpfporbis0/tmpqrl1w7uv.py", line 34
main():
^
SyntaxError: invalid syntax
| |
s484421033 | p00118 | u577311000 | 1493291760 | Python | Python3 | py | Runtime Error | 0 | 0 | 928 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpenxjn_yu/tmpif92obuu.py", line 35, in <module>
main()
File "/tmp/tmpenxjn_yu/tmpif92obuu.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s689978348 | p00118 | u683968848 | 1493291838 | Python | Python | py | Runtime Error | 0 | 0 | 1503 | def process():
data = []
for line in get_data():
if ' ' in line:
integer = line.split()
if integer[0] == integer[1] == 0:
data = []
continue
H = int(integer[0])
W = int(integer[1])
else:
data.append(line)
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
if __name__ == '__main__':
process() | File "/tmp/tmpozn5n6q0/tmpva36zslb.py", line 16
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s581835568 | p00118 | u577311000 | 1493291983 | Python | Python3 | py | Runtime Error | 0 | 0 | 977 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
print(line)
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(value)
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp3zjqnss4/tmpvx373oy3.py", line 37, in <module>
main()
File "/tmp/tmp3zjqnss4/tmpvx373oy3.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s828884586 | p00118 | u577311000 | 1493291999 | Python | Python3 | py | Runtime Error | 0 | 0 | 936 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpgyk9_nk3/tmpprzq4ib9.py", line 35, in <module>
main()
File "/tmp/tmpgyk9_nk3/tmpprzq4ib9.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s403196635 | p00118 | u577311000 | 1493292069 | Python | Python3 | py | Runtime Error | 0 | 0 | 807 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpsptwkdi8/tmpnvyossfd.py", line 35, in <module>
main()
File "/tmp/tmpsptwkdi8/tmpnvyossfd.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s946238273 | p00118 | u683968848 | 1493292185 | Python | Python | py | Runtime Error | 0 | 0 | 1549 | def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
if __name__ == '__main__':
process() | File "/tmp/tmp1ir3q9r_/tmp2rlhap8n.py", line 17
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s043419788 | p00118 | u577311000 | 1493292219 | Python | Python3 | py | Runtime Error | 0 | 0 | 807 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpnwivof7x/tmpoqj_bhks.py", line 35, in <module>
main()
File "/tmp/tmpnwivof7x/tmpoqj_bhks.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s523336980 | p00118 | u683968848 | 1493292224 | Python | Python | py | Runtime Error | 0 | 0 | 1562 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
if __name__ == '__main__':
process() | File "/tmp/tmpbxz0m5pd/tmp5_0hj0u3.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s184497001 | p00118 | u577311000 | 1493292242 | Python | Python3 | py | Runtime Error | 0 | 0 | 806 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[0])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmporrky_9t/tmpbzqsmug7.py", line 35, in <module>
main()
File "/tmp/tmporrky_9t/tmpbzqsmug7.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s578194472 | p00118 | u683968848 | 1493292244 | Python | Python | py | Runtime Error | 0 | 0 | 1531 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmp_qzzn7rf/tmp3ue36yva.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s108168080 | p00118 | u683968848 | 1493292324 | Python | Python | py | Runtime Error | 0 | 0 | 1531 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
search2(i, j, H, W, data[i][j], data, field)
count += 1
return count
def search2(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
search2(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmplzewtr0r/tmp8g3spfgy.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s070873088 | p00118 | u577311000 | 1493292345 | Python | Python3 | py | Runtime Error | 0 | 0 | 807 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[0])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
# search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpjewyg5yh/tmpfw_jpp4a.py", line 35, in <module>
main()
File "/tmp/tmpjewyg5yh/tmpfw_jpp4a.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s032326504 | p00118 | u683968848 | 1493292363 | Python | Python | py | Runtime Error | 0 | 0 | 1531 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmpnum14iba/tmpq2dyk2rw.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s976266956 | p00118 | u577311000 | 1493292375 | Python | Python3 | py | Runtime Error | 0 | 0 | 807 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=0
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpdm4m59n5/tmpa1ffqcfb.py", line 35, in <module>
main()
File "/tmp/tmpdm4m59n5/tmpa1ffqcfb.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s763722206 | p00118 | u683968848 | 1493292416 | Python | Python | py | Runtime Error | 0 | 0 | 1587 | import sys
def main():
process()
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
if __name__ == '__main__':
main() | File "/tmp/tmpr_j6cu7k/tmpprqsu79u.py", line 24
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s752759999 | p00118 | u964207033 | 1493292429 | Python | Python3 | py | Runtime Error | 0 | 0 | 1351 | # coding: utf-8
# @????????? #?????? *?????????
import sys
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
# for dy in range(-1,1):
# ny = y + dy
# # if 0 <= ny and ny < W and field[x][ny] == fru:
# if field[x][ny] == fru:
# dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
# H,W=[int(i) for i in input().split()]
# H, W = int(input()).split()
while(True):
H, W = map(int, input().split())
if H == 0 and W == 0:
sys.exit()
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W) | Traceback (most recent call last):
File "/tmp/tmpz4evwe8g/tmp3rgy594i.py", line 45, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s728429249 | p00118 | u964207033 | 1493292481 | Python | Python3 | py | Runtime Error | 0 | 0 | 872 | # coding: utf-8
import sys
def dfs(x, y, fru):
field[x][y] = '.'
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
while(True):
H, W = map(int, input().split())
if H == 0 and W == 0:
sys.exit()
field = []
for i in range(H):
field.append(list(input()))
solv(H,W) | Traceback (most recent call last):
File "/tmp/tmp7kail7jh/tmpd19jlgub.py", line 32, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s230591609 | p00118 | u577311000 | 1493292502 | Python | Python3 | py | Runtime Error | 0 | 0 | 810 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if fruit!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp5zdefofu/tmpeeafs7i7.py", line 35, in <module>
main()
File "/tmp/tmp5zdefofu/tmpeeafs7i7.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s951660911 | p00118 | u964207033 | 1493292524 | Python | Python3 | py | Runtime Error | 0 | 0 | 870 | # coding: utf-8
import sys
def dfs(x, y, fru):
field[x][y] = '.'
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
while(True):
H, W = map(int, input().split())
if H == 0 and W == 0:
sys.exit()
field = []
for i in range(H):
field.append(list(input()))
solv(H,W) | Traceback (most recent call last):
File "/tmp/tmp42qxog0s/tmpfs2aw7v3.py", line 30, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s528002841 | p00118 | u683968848 | 1493292557 | Python | Python | py | Runtime Error | 0 | 0 | 1531 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmp7v4erp67/tmp78s0iuyg.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s709697982 | p00118 | u683968848 | 1493292620 | Python | Python | py | Runtime Error | 0 | 0 | 1525 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmpsnpvzxzw/tmpzbpexpya.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s327853829 | p00118 | u577311000 | 1493292672 | Python | Python3 | py | Runtime Error | 0 | 0 | 858 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,fruit):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if values[hp][vp] not in ['@','#','*']: return
if fruit!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,fruit)
search(values,hp+1,vp,fruit)
search(values,hp,vp-1,fruit)
search(values,hp,vp+1,fruit)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpyxhptro5/tmp9xkbb5gg.py", line 36, in <module>
main()
File "/tmp/tmpyxhptro5/tmp9xkbb5gg.py", line 24, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s973093024 | p00118 | u683968848 | 1493292730 | Python | Python | py | Runtime Error | 0 | 0 | 1536 | import sys
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
return
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in sys.stdin.readlines()]
process() | File "/tmp/tmpdqg4v1ow/tmptycilge6.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s551753572 | p00118 | u577311000 | 1493292755 | Python | Python | py | Runtime Error | 0 | 0 | 803 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print solve(value)
if __name__=='__main__':
main() | File "/tmp/tmp9fwhmr9p/tmpdkyznjss.py", line 32
print solve(value)
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s168604361 | p00118 | u577311000 | 1493292768 | Python | Python | py | Runtime Error | 0 | 0 | 804 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
# search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print solve(value)
if __name__=='__main__':
main() | File "/tmp/tmp35hyx650/tmpglrmw2wb.py", line 32
print solve(value)
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s780667964 | p00118 | u577311000 | 1493292785 | Python | Python | py | Runtime Error | 0 | 0 | 815 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=raw_input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in raw_input().strip()])
values.append(value)
line = raw_input()
for value in values:
print solve(value)
if __name__=='__main__':
main() | File "/tmp/tmp19ggokmi/tmpirxzrpsx.py", line 32
print solve(value)
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s492676594 | p00118 | u964207033 | 1493292797 | Python | Python3 | py | Runtime Error | 0 | 0 | 1086 | # coding: utf-8
# @????????? #?????? *?????????
import sys
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < W and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < H and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
while(True):
H, W = map(int, input().split())
if H == 0 and W == 0:
sys.exit()
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W) | Traceback (most recent call last):
File "/tmp/tmp_1bp6z0u/tmpbgohhdvc.py", line 35, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s623516100 | p00118 | u683968848 | 1493292827 | Python | Python | py | Runtime Error | 0 | 0 | 1519 | import sys
def process(dataset):
data = []
for line in dataset:
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | File "/tmp/tmp6cnwy_hr/tmpussetj9f.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s404745340 | p00118 | u577311000 | 1493292857 | Python | Python3 | py | Runtime Error | 0 | 0 | 804 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpf8or402q/tmpxgrv4_2b.py", line 35, in <module>
main()
File "/tmp/tmpf8or402q/tmpxgrv4_2b.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s387666294 | p00118 | u683968848 | 1493292863 | Python | Python | py | Runtime Error | 0 | 0 | 1553 | import sys
def process(dataset):
data = []
for line in dataset:
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
if __name__ == '__main__':
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | File "/tmp/tmppq68jlim/tmp8af_kzep.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s297963084 | p00118 | u577311000 | 1493292920 | Python | Python3 | py | Runtime Error | 0 | 0 | 804 | #! -*- coding:utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append([x for x in input().strip()])
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpq0l3fu5_/tmp470q08me.py", line 35, in <module>
main()
File "/tmp/tmpq0l3fu5_/tmp470q08me.py", line 23, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s116281818 | p00118 | u577311000 | 1493293011 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp8ymw2xp2/tmpa7u8biq1.py", line 33, in <module>
main()
File "/tmp/tmp8ymw2xp2/tmpa7u8biq1.py", line 21, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s623709416 | p00118 | u964207033 | 1493293024 | Python | Python3 | py | Runtime Error | 0 | 0 | 1098 | # coding: utf-8
# @????????? #?????? *?????????
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
f=0
while(f==0):
H, W = map(int, input().split())
if H != 0 and W != 0:
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W)
else:
f=1 | Traceback (most recent call last):
File "/tmp/tmpzx15os9d/tmpvz3s_hu8.py", line 35, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s387759946 | p00118 | u577311000 | 1493293079 | Python | Python3 | py | Runtime Error | 0 | 0 | 787 | def visiting(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
visiting(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpe5whxf_9/tmplidh_te5.py", line 33, in <module>
main()
File "/tmp/tmpe5whxf_9/tmplidh_te5.py", line 21, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s194734801 | p00118 | u577311000 | 1493293094 | Python | Python3 | py | Runtime Error | 0 | 0 | 795 | def visiting(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
visiting(values,hp-1,vp,item)
visiting(values,hp+1,vp,item)
visiting(values,hp,vp-1,item)
visiting(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
visiting(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpeh9n0u_h/tmpckezhqt6.py", line 33, in <module>
main()
File "/tmp/tmpeh9n0u_h/tmpckezhqt6.py", line 21, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s289755407 | p00118 | u683968848 | 1493293097 | Python | Python | py | Runtime Error | 0 | 0 | 1553 | import sys
def process(dataset):
data = []
for line in dataset:
line = line.split()
if len(line) == 2:
if line[0] == line[1] == "0":
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
if __name__ == "__main__":
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | File "/tmp/tmptu07_7gp/tmpg93kaa_l.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s754834731 | p00118 | u577311000 | 1493293112 | Python | Python3 | py | Runtime Error | 0 | 0 | 842 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def visiting(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
visiting(values,hp-1,vp,item)
visiting(values,hp+1,vp,item)
visiting(values,hp,vp-1,item)
visiting(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
visiting(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpmkw5_96s/tmpeoa3m36k.py", line 36, in <module>
main()
File "/tmp/tmpmkw5_96s/tmpeoa3m36k.py", line 24, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s663711527 | p00118 | u683968848 | 1493293115 | Python | Python | py | Runtime Error | 0 | 0 | 1553 | import sys
def process(dataset):
data = []
for line in dataset:
line = line.split()
if len(line) == 2:
if line[0] == line[1] == "0":
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
if __name__ == "__main__":
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | File "/tmp/tmp4pfum755/tmp6t7zqenc.py", line 19
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s635760795 | p00118 | u577311000 | 1493293138 | Python | Python3 | py | Runtime Error | 0 | 0 | 830 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input(),list()
while line!='0 0':
H,W = list(map(int,line.strip().split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpaguraz26/tmpwqlhpp7n.py", line 36, in <module>
main()
File "/tmp/tmpaguraz26/tmpwqlhpp7n.py", line 24, in main
line,values=input(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s199076847 | p00118 | u683968848 | 1493293195 | Python | Python | py | Runtime Error | 0 | 0 | 111 |
if __name__ == "__main__":
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | Traceback (most recent call last):
File "/tmp/tmpyfe497l6/tmpmad34l40.py", line 3, in <module>
dataset = [line.strip() for line in sys.stdin.readlines()]
^^^
NameError: name 'sys' is not defined
| |
s287933637 | p00118 | u683968848 | 1493293218 | Python | Python | py | Runtime Error | 0 | 0 | 122 | import sys
if __name__ == "__main__":
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | Traceback (most recent call last):
File "/tmp/tmpupsj921g/tmp51g99dcv.py", line 5, in <module>
process(dataset)
^^^^^^^
NameError: name 'process' is not defined
| |
s414057735 | p00118 | u683968848 | 1493293223 | Python | Python | py | Runtime Error | 0 | 0 | 122 | import sys
if __name__ == "__main__":
dataset = [line.strip() for line in sys.stdin.readlines()]
process(dataset) | Traceback (most recent call last):
File "/tmp/tmpwhtk7n95/tmpjsro8b7z.py", line 5, in <module>
process(dataset)
^^^^^^^
NameError: name 'process' is not defined
| |
s070493151 | p00118 | u683968848 | 1493293280 | Python | Python | py | Runtime Error | 0 | 0 | 112 | import sys
if __name__ == "__main__":
dataset = [line.strip() for line in raw_input()]
process(dataset) | Traceback (most recent call last):
File "/tmp/tmpdlzw4r7f/tmp2vubxzy4.py", line 4, in <module>
dataset = [line.strip() for line in raw_input()]
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s768055136 | p00118 | u577311000 | 1493293324 | Python | Python3 | py | Runtime Error | 0 | 0 | 838 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input().strip(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input().strip()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp6pj013e5/tmphtnkhibh.py", line 36, in <module>
main()
File "/tmp/tmp6pj013e5/tmphtnkhibh.py", line 24, in main
line,values=input().strip(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s926238228 | p00118 | u577311000 | 1493293341 | Python | Python3 | py | Runtime Error | 0 | 0 | 816 | # -*- coding: utf-8 -*-
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count=0
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in ['@','#','*']:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input().strip(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
values.append(value)
line = input().strip()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpfewcn4_g/tmpg669e45w.py", line 35, in <module>
main()
File "/tmp/tmpfewcn4_g/tmpg669e45w.py", line 23, in main
line,values=input().strip(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s053874982 | p00118 | u683968848 | 1493293403 | Python | Python | py | Runtime Error | 0 | 0 | 1539 | def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
if __name__ == "__main__":
process() | File "/tmp/tmplthcgbcg/tmpdy0qho4l.py", line 17
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s667973400 | p00118 | u683968848 | 1493293544 | Python | Python | py | Runtime Error | 0 | 0 | 1581 | import sys
sys.setrecursionlimit(100000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
if __name__ == "__main__":
process() | File "/tmp/tmpxd5s6lmk/tmpzkmzucx0.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s711708727 | p00118 | u964207033 | 1493293546 | Python | Python3 | py | Runtime Error | 0 | 0 | 1136 | # coding: utf-8
# @????????? #?????? *?????????
import sys
sys.setrecursionlimit(1500)
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
f=0
while(f==0):
H, W = map(int, input().split())
if H != 0 and W != 0:
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W)
else:
f=1 | Traceback (most recent call last):
File "/tmp/tmp0mr4s2mo/tmpl81b79oi.py", line 36, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s469653004 | p00118 | u683968848 | 1493293580 | Python | Python | py | Runtime Error | 0 | 0 | 1550 | import sys
sys.setrecursionlimit(1000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmpypba9vwn/tmp8gn39bi5.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s663905613 | p00118 | u964207033 | 1493293581 | Python | Python3 | py | Runtime Error | 0 | 0 | 1137 | # coding: utf-8
# @????????? #?????? *?????????
import sys
sys.setrecursionlimit(2000)
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
f=0
while(f==0):
H, W = map(int, input().split())
if H != 0 and W != 0:
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W)
else:
f=1 | Traceback (most recent call last):
File "/tmp/tmp57sn6anr/tmphiy7ef5d.py", line 37, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s382934967 | p00118 | u683968848 | 1493293605 | Python | Python | py | Runtime Error | 0 | 0 | 1556 | import sys
sys.setrecursionlimit(1000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp9s81bhkp/tmpesi8ycbt.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s691696176 | p00118 | u964207033 | 1493293612 | Python | Python3 | py | Runtime Error | 0 | 0 | 1138 | # coding: utf-8
# @????????? #?????? *?????????
import sys
sys.setrecursionlimit(10000)
def dfs(x, y, fru):
# ???????????¨?????????.???????????????
field[x][y] = '.'
# 4??????????????????
for dx in [-1,0,1]:
nx = x + dx
if 0 <= nx and nx < H and field[nx][y] == fru:
dfs(nx,y,fru)
for dy in [-1,0,1]:
ny = y + dy
if 0 <= ny and ny < W and field[x][ny] == fru:
dfs(x,ny,fru)
def solv(H,W):
count = 0
for i in range(H):
for j in range(W):
if field[i][j] == '@':
dfs(i,j,'@')
count+=1
elif field[i][j] == '#':
dfs(i,j,'#')
count+=1
elif field[i][j] == '*':
dfs(i,j,'*')
count+=1
print(count)
#x,y??§2??¶?????°???1?????§??\????????????????????\???????????°?????§????????¨???
f=0
while(f==0):
H, W = map(int, input().split())
if H != 0 and W != 0:
field = [] # ????¨??????¨??????
for i in range(H):
field.append(list(input()))
solv(H,W)
else:
f=1 | Traceback (most recent call last):
File "/tmp/tmp4v4ko4g9/tmpr7za5rmh.py", line 37, in <module>
H, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s015354148 | p00118 | u683968848 | 1493293648 | Python | Python | py | Runtime Error | 0 | 0 | 1573 | import sys
sys.setrecursionlimit(100000000000000000000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp7cr51p2z/tmpqlrz6lxj.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s070214841 | p00118 | u683968848 | 1493293660 | Python | Python | py | Runtime Error | 0 | 0 | 1615 | import sys
sys.setrecursionlimit(100000000000000000000000000000000000000000000000000000000000000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmpbqkwqpml/tmpgqbhvpii.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s706635884 | p00118 | u683968848 | 1493293760 | Python | Python | py | Runtime Error | 0 | 0 | 1518 | import sys
sys.setrecursionlimit(10000000000000000000000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmpq1w75ada/tmp957adcf4.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s714862964 | p00118 | u683968848 | 1493293799 | Python | Python | py | Runtime Error | 0 | 0 | 1556 | import sys
sys.setrecursionlimit(1000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp0v71ys_d/tmp96y9e4gx.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s344621886 | p00118 | u683968848 | 1493293813 | Python | Python | py | Runtime Error | 0 | 0 | 1557 | import sys
sys.setrecursionlimit(1000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
print 'fw' | File "/tmp/tmphsbwei6f/tmpzxtdldsq.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s165750097 | p00118 | u683968848 | 1493293831 | Python | Python | py | Runtime Error | 0 | 0 | 1557 | import sys
sys.setrecursionlimit(1000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
print 'fw' | File "/tmp/tmpymxxlo7m/tmpfhh5pm5z.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s899618437 | p00118 | u683968848 | 1493293894 | Python | Python | py | Runtime Error | 0 | 0 | 1487 | import sys
sys.setrecursionlimit(1000000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
print 0 | File "/tmp/tmpxwpotjtc/tmpgfepsmd7.py", line 20
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s628144427 | p00118 | u683968848 | 1493293917 | Python | Python | py | Runtime Error | 0 | 0 | 1008 | import sys
sys.setrecursionlimit(1000000000000)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
print 0 | File "/tmp/tmp1k6gr_r7/tmppk2zlt1j.py", line 49
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s068856538 | p00118 | u683968848 | 1493293933 | Python | Python | py | Runtime Error | 0 | 0 | 237 | import sys
sys.setrecursionlimit(1000000000000)
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
print 0 | File "/tmp/tmpfs797fnl/tmp789sk0mf.py", line 16
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s911032622 | p00118 | u683968848 | 1493293943 | Python | Python | py | Runtime Error | 0 | 0 | 57 | import sys
sys.setrecursionlimit(1000000000000)
print 0 | File "/tmp/tmp45_pergj/tmp6hwqqwmb.py", line 5
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s237860325 | p00118 | u683968848 | 1493294056 | Python | Python | py | Runtime Error | 0 | 0 | 1547 | import sys
sys.setrecursionlimit(100000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print(search(H, W, data, field))
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in input()]
process() | Traceback (most recent call last):
File "/tmp/tmpnjrez5d8/tmpgxibf338.py", line 71, in <module>
process()
File "/tmp/tmpnjrez5d8/tmpgxibf338.py", line 7, in process
for line in get_data():
^^^^^^^^^^
File "/tmp/tmpnjrez5d8/tmpgxibf338.py", line 69, in get_data
return [line.strip() for line in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s366695699 | p00118 | u683968848 | 1493294066 | Python | Python3 | py | Runtime Error | 0 | 0 | 1547 | import sys
sys.setrecursionlimit(100000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print(search(H, W, data, field))
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in input()]
process() | Traceback (most recent call last):
File "/tmp/tmpjl3r90dv/tmpmde0j7qx.py", line 71, in <module>
process()
File "/tmp/tmpjl3r90dv/tmpmde0j7qx.py", line 7, in process
for line in get_data():
^^^^^^^^^^
File "/tmp/tmpjl3r90dv/tmpmde0j7qx.py", line 69, in get_data
return [line.strip() for line in input()]
^^^^^^^
EOFError: EOF when reading a line
| |
s102053711 | p00118 | u683968848 | 1493294078 | Python | Python3 | py | Runtime Error | 0 | 0 | 1552 | import sys
sys.setrecursionlimit(10000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print(search(H, W, data, field))
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in input()]
process() | Traceback (most recent call last):
File "/tmp/tmp0kzgr353/tmptlrtxts0.py", line 2, in <module>
sys.setrecursionlimit(10000000000)
OverflowError: Python int too large to convert to C int
| |
s121355717 | p00118 | u577311000 | 1493294377 | Python | Python3 | py | Runtime Error | 0 | 0 | 872 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000000)
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count,valid_items=0,set(['@','#','*'])
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in valid_items:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input().strip(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append(input().strip())
values.append(value)
line = input().strip()
for value in values:
print(solve(value))
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmp174st76y/tmp9p3ykpxx.py", line 38, in <module>
main()
File "/tmp/tmp174st76y/tmp9p3ykpxx.py", line 26, in main
line,values=input().strip(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s618825331 | p00118 | u683968848 | 1493294452 | Python | Python3 | py | Runtime Error | 0 | 0 | 1649 | import sys
sys.setrecursionlimit(10000000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print(search(H, W, data, field))
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
line = input().rstrip()
u = line.split()
H = int(u[0])
data = []
for i in xrange(H):
data.append(input().rstrip())
process() | Traceback (most recent call last):
File "/tmp/tmpwk7acch_/tmpadi_0z8y.py", line 2, in <module>
sys.setrecursionlimit(10000000000)
OverflowError: Python int too large to convert to C int
| |
s010162921 | p00118 | u683968848 | 1493294485 | Python | Python3 | py | Runtime Error | 0 | 0 | 1554 | import sys
sys.setrecursionlimit(100000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp5iadzgqp/tmp6c66prch.py", line 21
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s240218823 | p00118 | u683968848 | 1493294504 | Python | Python3 | py | Runtime Error | 0 | 0 | 1551 | import sys
sys.setrecursionlimit(100000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp7_rrh4pc/tmphiimtak6.py", line 21
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s218562256 | p00118 | u683968848 | 1493294516 | Python | Python | py | Runtime Error | 0 | 0 | 1551 | import sys
sys.setrecursionlimit(100000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmp4zc52bss/tmp59mr07ju.py", line 21
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s539893677 | p00118 | u683968848 | 1493294528 | Python | Python | py | Runtime Error | 0 | 0 | 1552 | import sys
sys.setrecursionlimit(1000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmpfuknafe0/tmp9p0_w5_1.py", line 21
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s817701009 | p00118 | u683968848 | 1493294537 | Python | Python | py | Runtime Error | 0 | 0 | 1553 | import sys
sys.setrecursionlimit(10000000)
def process():
data = []
for line in get_data():
line = line.split()
if len(line) == 2:
if line[0] == line[1] == '0':
data = []
continue
H = int(line[0])
W = int(line[1])
elif len(line) == 0:
pass
else:
data.append(line[0])
if len(data) == H:
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_data():
return [line.strip() for line in raw_input()]
process() | File "/tmp/tmpuz_h49r1/tmpe8nvof2w.py", line 21
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s289359795 | p00118 | u683968848 | 1493295368 | Python | Python | py | Runtime Error | 0 | 0 | 1581 | import sys
sys.setrecursionlimit(10000000)
def main():
process()
def process():
for data in get_dataset():
H = int(data)
W = int(data[0])
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_dataset():
dataset = []
while True:
data = get_data()
if data:
dataset.append(data)
else:
break
return dataset
def get_data():
line = raw_input().rstrip().split()
H = int(line[0])
data = []
for i in xrange(H):
data.append(raw_input().rstrip())
zero = raw_input()
return data
process() | File "/tmp/tmp6rvysrv9/tmp0d4_s33t.py", line 14
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s586203917 | p00118 | u683968848 | 1493295392 | Python | Python | py | Runtime Error | 0 | 0 | 1580 | import sys
sys.setrecursionlimit(1000000)
def main():
process()
def process():
for data in get_dataset():
H = int(data)
W = int(data[0])
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_dataset():
dataset = []
while True:
data = get_data()
if data:
dataset.append(data)
else:
break
return dataset
def get_data():
line = raw_input().rstrip().split()
H = int(line[0])
data = []
for i in xrange(H):
data.append(raw_input().rstrip())
zero = raw_input()
return data
process() | File "/tmp/tmpll8pxzce/tmp9qamyrei.py", line 14
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s535501023 | p00118 | u683968848 | 1493295418 | Python | Python | py | Runtime Error | 0 | 0 | 1551 | import sys
sys.setrecursionlimit(100000)
def process():
for data in get_dataset():
H = int(data)
W = int(data[0])
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_dataset():
dataset = []
while True:
data = get_data()
if data:
dataset.append(data)
else:
break
return dataset
def get_data():
line = raw_input().rstrip().split()
H = int(line[0])
data = []
for i in xrange(H):
data.append(raw_input().rstrip())
zero = raw_input()
return data
process() | File "/tmp/tmp8m7bv70v/tmp1e_bj6lp.py", line 10
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s717103279 | p00118 | u683968848 | 1493296595 | Python | Python | py | Runtime Error | 0 | 0 | 1443 | import sys
def process():
for data in get_dataset():
H = len(data)
W = len(data[0])
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_dataset():
dataset = []
while True:
line = raw_input().rstrip().split()
H = int(line[0])
if H == 0:
break
data = []
for i in xrange(H):
data.append(raw_input().rstrip())
dataset.append(data)
return dataset
process() | File "/tmp/tmpmicy5xv8/tmp9ydm4jpo.py", line 9
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s015925300 | p00118 | u683968848 | 1493296606 | Python | Python | py | Runtime Error | 0 | 0 | 1472 | import sys
sys.setrecursionlimit(10000)
def process():
for data in get_dataset():
H = len(data)
W = len(data[0])
field = create_field(H, W)
print search(H, W, data, field)
def search(H, W, data, field):
count = 0
for i in xrange(H):
for j in xrange(W):
if field[i][j] == 0:
continue
_search(i, j, H, W, data[i][j], data, field)
count += 1
return count
def _search(i, j, H, W, cell, data, field):
field[i][j] = 0
for a in xrange(i-1, i+2):
if -1 < a < H:
pass
else:
continue
for b in xrange(j-1, j+2):
if -1 < b < W:
pass
else:
continue
if a != i and b != j:
continue
if field[a][b] == 0:
continue
if cell == data[a][b]:
_search(a, b, H, W, cell, data, field)
return
def create_field(H, W):
field = []
for i in xrange(H):
raw = []
for j in xrange(W):
raw.append(1)
field.append(raw)
return field
def get_dataset():
dataset = []
while True:
line = raw_input().rstrip().split()
H = int(line[0])
if H == 0:
break
data = []
for i in xrange(H):
data.append(raw_input().rstrip())
dataset.append(data)
return dataset
process() | File "/tmp/tmpnd1znymz/tmpa02hlty7.py", line 10
print search(H, W, data, field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s485911056 | p00118 | u577311000 | 1493299374 | Python | Python3 | py | Runtime Error | 0 | 0 | 840 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10*6)
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
search(values,hp-1,vp,item)
search(values,hp+1,vp,item)
search(values,hp,vp-1,item)
search(values,hp,vp+1,item)
def solve(values):
count,valid_items=0,set(['@','#','*'])
for i in range(len(values)):
for j in range(len(values[i])):
if values[i][j] in valid_items:
search(values,i,j,values[i][j])
count+=1
return count
def main():
line,values=input().strip(),list()
while line!='0 0':
H,W = list(map(int,line.split(' ')))
value = list()
for _ in range(H):
value.append(list(x for x in input().strip()))
print(solve(value))
line = input().strip()
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpleg4odtv/tmptra4h8o3.py", line 36, in <module>
main()
File "/tmp/tmpleg4odtv/tmptra4h8o3.py", line 26, in main
line,values=input().strip(),list()
^^^^^^^
EOFError: EOF when reading a line
| |
s512413676 | p00118 | u284851373 | 1493299850 | Python | Python | py | Runtime Error | 0 | 0 | 1394 | Last login: Thu Apr 27 19:24:49 on ttys001
[@toshiki-s ~ 20:56:20]
$cd Desktop/
.DS_Store Mendeley Desktop.app/ OTHER/
.localized NAIST/ Readme.webloc
[@toshiki-s ~ 20:56:20]
$cd Desktop/NAIST/
.DS_Store advancedCource/ procon/
[@toshiki-s ~ 20:56:20]
$cd Desktop/NAIST/procon/
[@toshiki-s ~/Desktop/NAIST/procon 20:56:35]
$vim aoj0118.py
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(100000)
def dfs(x, y, sym):
field[x][y] = '.'
for dx in range(-1,2):
if dx==-1 or dx==1:
nx = x + dx
ny = y
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
| File "/tmp/tmps9z_40s3/tmproy80kn0.py", line 1
Last login: Thu Apr 27 19:24:49 on ttys001
^^^^^
SyntaxError: invalid syntax
| |
s563675844 | p00118 | u284851373 | 1493299967 | Python | Python | py | Runtime Error | 0 | 0 | 1401 | Last login: Thu Apr 27 19:24:49 on ttys001
[@toshiki-s ~ 20:56:20]
$cd Desktop/
.DS_Store Mendeley Desktop.app/ OTHER/
.localized NAIST/ Readme.webloc
[@toshiki-s ~ 20:56:20]
$cd Desktop/NAIST/
.DS_Store advancedCource/ procon/
[@toshiki-s ~ 20:56:20]
$cd Desktop/NAIST/procon/
[@toshiki-s ~/Desktop/NAIST/procon 20:56:35]
$vim aoj0118.py
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
while True:
datas = sys.stdin.readlines()
data = datas[0].split(' ')
N = int(data[0])
M = int(data[1])
if N==0 or M==0:
break
field = [[0 for i in range(N) ]for j in range(M)]
for i in range(M):
field[i] = list(datas[i+1])[0:-1]
solve() | File "/tmp/tmp_sn4dwni/tmpazv39qe8.py", line 1
Last login: Thu Apr 27 19:24:49 on ttys001
^^^^^
SyntaxError: invalid syntax
| |
s576024216 | p00118 | u284851373 | 1493300052 | Python | Python | py | Runtime Error | 0 | 0 | 963 | # -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10000000000)
def dfs(x, y, sym):
field[x][y] = '.'
for dx in range(-1,2):
if dx==-1 or dx==1:
nx = x + dx
ny = y
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
| Traceback (most recent call last):
File "/tmp/tmp1cmfh7hl/tmpi5bfr2ac.py", line 4, in <module>
sys.setrecursionlimit(10000000000)
OverflowError: Python int too large to convert to C int
| |
s672700602 | p00118 | u284851373 | 1493301175 | Python | Python | py | Runtime Error | 0 | 0 | 1361 | # -*- cod:utf-8 -*-
import sys
sys.setrecursionlimit(100000000)
def dfs(x, y, sym):
field[x][y] = '.'
for dx in range(-1,2):
if dx==-1 or dx==1:
nx = x + dx
ny = y
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
while True:
datas = sys.stdin.readlines()
data = datas[0].split(' ')
N = int(data[0])
M = int(data[1])
if ' ' in data[-1]:
data2 = datas[-1].split(' ')
L = int(data2[0])
K = int(data2[1])
if L==0 and K==0:
break
field = [[0 for i in range(N) ]for j in range(M)]
for i in range(M):
field[i] = list(datas[i+1])[0:-1]
solve() | Traceback (most recent call last):
File "/tmp/tmpgqy_dezx/tmpr_kce2uy.py", line 40, in <module>
data = datas[0].split(' ')
~~~~~^^^
IndexError: list index out of range
| |
s909684031 | p00118 | u284851373 | 1493301309 | Python | Python | py | Runtime Error | 0 | 0 | 1359 | # -*- cod:utf-8 -*-
import sys
sys.setrecursionlimit(1000000)
def dfs(x, y, sym):
field[x][y] = '.'
for dx in range(-1,2):
if dx==-1 or dx==1:
nx = x + dx
ny = y
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
while True:
datas = sys.stdin.readlines()
data = datas[0].split(' ')
N = int(data[0])
M = int(data[1])
if ' ' in data[-1]:
data2 = datas[-1].split(' ')
L = int(data2[0])
K = int(data2[1])
if L==0 and K==0:
break
field = [[0 for i in range(N) ]for j in range(M)]
for i in range(M):
field[i] = list(datas[i+1])[0:-1]
solve() | Traceback (most recent call last):
File "/tmp/tmpdjeorh3v/tmp1acrjibq.py", line 40, in <module>
data = datas[0].split(' ')
~~~~~^^^
IndexError: list index out of range
| |
s606764504 | p00118 | u284851373 | 1493301377 | Python | Python | py | Runtime Error | 0 | 0 | 1358 | # -*- cod:utf-8 -*-
import sys
sys.setrecursionlimit(100000)
def dfs(x, y, sym):
field[x][y] = '.'
for dx in range(-1,2):
if dx==-1 or dx==1:
nx = x + dx
ny = y
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
else:
nx = x
for dy in [-1,1]:
ny = y + dy
if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
dfs(nx, ny, sym)
def solve():
res = 0
flg=0
for i in range(N):
for j in range(M):
if not field[i][j] == '.':
if field[i][j] == '@':
dfs(i, j, '@')
res += 1
elif field[i][j] == '#':
dfs(i, j, '#')
res += 1
else:
dfs(i, j, '*')
res += 1
print(res)
while True:
datas = sys.stdin.readlines()
data = datas[0].split(' ')
N = int(data[0])
M = int(data[1])
if ' ' in data[-1]:
data2 = datas[-1].split(' ')
L = int(data2[0])
K = int(data2[1])
if L==0 and K==0:
break
field = [[0 for i in range(N) ]for j in range(M)]
for i in range(M):
field[i] = list(datas[i+1])[0:-1]
solve() | Traceback (most recent call last):
File "/tmp/tmpsnso89ba/tmpn71psw6r.py", line 40, in <module>
data = datas[0].split(' ')
~~~~~^^^
IndexError: list index out of range
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.