s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s759687004
p00064
u350064373
1501550344
Python
Python3
py
Runtime Error
0
0
209
import re try: ls = num = [] result = 0 while True: ls.append(input()) except: for i in ls: for s in range(re.findall(r'\d+', i)): result += int(s) print(result)
s773401650
p00064
u724606305
1513743520
Python
Python3
py
Runtime Error
0
0
242
ans = "" while True: try: memo = input() except: break for m in memo: if m.isdigit()==True: ans = ans+m else: ans = ans+"???" ans=ans.split() ans=sum(map(int,ans)) print(ans)
s445368454
p00064
u471115210
1374738366
Python
Python
py
Runtime Error
0
0
556
#include<iostream> #include<algorithm> #include<queue> #include<map> #include<string.h> #include<math.h> using namespace std; int main(){ string in; int num=0; while(cin>>in){ bool flag=false; int temp = 0; for(int i=0; i<in.length(); i++){ if('0'<=in[i]&&in[i]<='9'){...
s528257667
p00064
u865312527
1378313698
Python
Python
py
Runtime Error
0
0
75
import re print sum(map(int,re.sub("\w+"," ",raw_input()).strip().split()))
s703828572
p00064
u865312527
1378313826
Python
Python
py
Runtime Error
0
0
94
import re, sys print sum(map(int,re.sub("\w+|\s+"," ",sys.stdin.readlines()).strip().split()))
s082088469
p00064
u865312527
1378313919
Python
Python
py
Runtime Error
0
0
93
import re, sys print sum(map(int,re.sub("[^\d]+"," ",sys.stdin.readlines()).strip().split()))
s709045297
p00064
u912237403
1389971803
Python
Python
py
Runtime Error
0
0
90
s="".join([s for s in sys.stdin]) p=re.compile('\d+') x=p.findall(s) print sum(map(int,x))
s194814412
p00064
u912237403
1389993145
Python
Python
py
Runtime Error
0
0
263
#include <iostream> #include <string> int main(){ std::string s,x=""; while(std::cin>>s)x+=s; s=""; int a=0,i=0; for (;i<(int)x.size();i++) if (isdigit(x[i])) s+=x[i]; else if (!s.empty()){ a+=atoi(s.c_str()); s=""; } std::cout<<a<<"\n"; }
s312990584
p00065
u537067968
1551598525
Python
Python3
py
Runtime Error
0
0
483
#import math listc = [] listd = {} answer = [] n = 0 while True: s = input() if not s: break else: n += 1 c,d = map(int,s.split(',')) if c in listc: listd[c] += 1 else: listc.append(c) listd[c] = 1 while n > 0: n -= 1 c,d = map(int,input().s...
s670717915
p00065
u193025715
1408890427
Python
Python3
py
Runtime Error
0
0
400
old = [] new = [] ans = [] t = True while True: n = input().split(',')[0] if n == '': if t: t = False else: break if t: old.append(n) else: new.append(n) for o in set(old): if o in new: s = old.count(o) + new.count(o) ans.app...
s130270805
p00065
u489809100
1446204102
Python
Python
py
Runtime Error
0
0
456
dict1 = {} dict2 = {} while True: str = raw_input().split(",") if len(str[0]) == 0: break if dict1.has_key(str[0]): dict1[str[0]] = dict1[str[0]] + 1 else: dict1[str[0]] = 1 while True: str = raw_input().split(",") if len(str[0]) == 0: break if dict2.has_key(str[0]): dict2[str[0]] = dict2[st...
s620539317
p00065
u489809100
1446205356
Python
Python
py
Runtime Error
0
0
472
dict1 = {} dict2 = {} while True: str = raw_input().split(",") if len(str[0]) == 0: break if dict1.has_key(str[0]): dict1[str[0]] = dict1[str[0]] + 1 else: dict1[str[0]] = 1 while True: str = raw_input().split(",") if len(str[0]) == 0: break if dict2.has_key(str[0]): dict2[str[0]] = dict2[st...
s713411525
p00065
u489809100
1446205793
Python
Python
py
Runtime Error
0
0
472
dict1 = {} dict2 = {} while True: str = raw_input().split(",") if len(str[0]) == 0: break if dict1.has_key(str[0]): dict1[str[0]] = dict1[str[0]] + 1 else: dict1[str[0]] = 1 while True: try: str = raw_input().split(",") if dict2.has_key(str[0]): dict2[str[0]] = dict2[str[0]] + 1 else: d...
s999070412
p00065
u489809100
1446207109
Python
Python
py
Runtime Error
0
0
508
dict1 = {} dict2 = {} while True: str = raw_input() if len(str[0]) == 0: break str.split(",") if dict1.has_key(str[0]): dict1[str[0]] = dict1[str[0]] + 1 else: dict1[str[0]] = 1 while True: try: str = raw_input().split(",") if dict2.has_key(str[0]): dict2[str[0]] = dict2[str[0]] + 1 else: ...
s259250933
p00065
u489809100
1446387528
Python
Python
py
Runtime Error
0
0
475
dict1 = {} dict2 = {} while True: log = raw_input() if len(log) == 0: break log = log.split(",")[0] if log in dict1: dict1[log] = dict1[log] + 1 else: dict1[log] = 1 while True: try: log = raw_input() log = log.split(",")[0] if log in dict2: dict2[log] = dict2[log] + 1 else: dict...
s545583108
p00065
u661290476
1484473327
Python
Python3
py
Runtime Error
0
0
358
flag = False cli = [0] * 1000 sen = set() kon = set() while True: try: c, d = map(int, input().split(",")) except: if flag: break flag = True continue if flag: kon.add(c) else: sen.add(c) cli[c] += 1 for i in range(1,1001): if i in sen...
s707966913
p00065
u546285759
1491996343
Python
Python3
py
Runtime Error
0
0
378
dt = {} def loop(): while True: line = input() if line == '': break try: c, d = map(int, line.split(',')) dt[c] = [d] if c not in dt else dt[c]+[d] except: break loop() loop() for ab in sorted(dt.items(), key=lambda x: x[0]): a, b ...
s284399112
p00065
u546285759
1491996457
Python
Python3
py
Runtime Error
0
0
380
dt = {} def loop(): while True: line = input() if line == '\n': break try: c, d = map(int, line.split(',')) dt[c] = [d] if c not in dt else dt[c]+[d] except: break loop() loop() for ab in sorted(dt.items(), key=lambda x: x[0]): a, ...
s885995716
p00065
u150984829
1519391044
Python
Python3
py
Runtime Error
0
0
190
import sys b=0 a=[{},{}] for e in sys.stdin: if'\n'==e:b=1 else:c=int(e.split(',')[0]) if c in a[b]:a[b][c]+=1 else:a[b][c]=1 for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])
s247578694
p00065
u150984829
1519391131
Python
Python3
py
Runtime Error
0
0
180
import sys b=0 a=[{},{}] for e in sys.stdin: if'\n'==e:b=1 else:c=int(e.split(',')[0]);a[b][c]=1+[0,a[b][c]][c in a[b]] for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])
s545753386
p00065
u150984829
1519391542
Python
Python3
py
Runtime Error
0
0
181
import sys b=0 a=[{},{}] for e in sys.stdin: if'\n'==e:b=1 else:c_=e.split(',');c=int(c);a[b].setdefault(c,0);a[b][c]+=1 for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])
s096815864
p00065
u912237403
1390000001
Python
Python
py
Runtime Error
0
0
255
import sys C=range(1000) f=0 d=[[0 for i in C] for j in range(2)] for s in sys.stdin.readlines(): if s=="\n":f+=1 else: a,b=map(int,s.split(',')) d[f][a]+=1 for i in C: a=d[0][i] b=d[1][i] if a!=0 and b!=0: print i, a+b
s827520448
p00065
u912237403
1390000223
Python
Python
py
Runtime Error
0
0
253
import sys C=range(1000) m=0 d=[[0 for i in C] for j in range(2)] for s in sys.stdin.readlines(): if s=="\n":m+=1 else: a,b=map(int,s.split(',')) d[m][a]+=1 for i in C: a=d[0][i] b=d[1][i] if a!=0 and b!=0:print i,a+b
s882419932
p00065
u491763171
1400472384
Python
Python
py
Runtime Error
0
0
325
from collections import Counter cnt = 0 trade = Counter() while 1: line = raw_input() if not line: break cnt += 1 a, b = map(int, line.split(',')) trade[a] += 1 for i in xrange(cnt): a, b = map(int, raw_input().split(',')) trade[a] += 1 for k, v in sorted(trade.items()): print...
s282729449
p00066
u647694976
1558944166
Python
Python3
py
Runtime Error
0
0
292
def marubatu(): N=list(input()) for koma in ["o","x"]: for i in range(3): if N[i:9:3].count(koma)==3 or N[3*i:3*i+3].count(koma)==3:return koma if N[0:9:4].count(koma)==3 or N[2:7:2].count(koma)==3:return koma return "d" while 1: print(marubatu())
s099537838
p00066
u567380442
1423130945
Python
Python3
py
Runtime Error
0
0
285
import sys f = sys.stdin vlines = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] for line in f: result = 'd' for v in vlines: if 's' != a and line[v[0]]== line[v[1]] == line[v[2]]: result = line[v[0]] break print(result)
s070590442
p00066
u661290476
1484478702
Python
Python3
py
Runtime Error
0
0
561
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break maru = [] batu = [] for i in range(9): if s[i] == 'o': maru.append(i) elif s[i] == 'x': batu.append(i) print(maru, batu) ...
s375226972
p00066
u661290476
1484478793
Python
Python3
py
Runtime Error
0
0
539
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break maru = [] batu = [] for i in range(9): if s[i] == 'o': maru.append(i) elif s[i] == 'x': batu.append(i) flag = False for ...
s057371703
p00066
u661290476
1484478889
Python
Python3
py
Runtime Error
0
0
548
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break maru = [] batu = [] for i in range(9): if s[i] == 'o': maru.append(i) elif s[i] == 'x': batu.append(i) flag = False for ...
s168091562
p00066
u661290476
1484480017
Python
Python3
py
Runtime Error
0
0
567
ok = [{0,4,8}, {2,4,6}, {0,1,2}, {3,4,5}, {6,7,8}, {0,3,6}, {1,4,7}, {2,5,8}] while True: s = input() if len(s) == 0: break maru = set() batu = set() for i in range(9): if s[i] == 'o': maru.add(i) elif s[i] == 'x': batu.add(i) flag = False for ...
s039830187
p00066
u661290476
1484480461
Python
Python3
py
Runtime Error
0
0
311
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break flag = False for i in ok: if s[i[0]] == s[i[1]] == s[i[2]]: print(s[i[0]]) flag = True if flag: continue print("d")
s310296365
p00066
u661290476
1484480761
Python
Python3
py
Runtime Error
0
0
329
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break flag = False for i in ok: if s[i[0]] == s[i[1]] == s[i[2]]: print(s[i[0]]) flag = True break if flag: continue p...
s968137324
p00066
u661290476
1484480989
Python
Python3
py
Runtime Error
0
0
348
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break flag = False for i in ok: if s[i[0]] == s[i[1]] == s[i[2]] and s[i[0]] != 's': print(s[i[0]]) flag = True break if flag: ...
s712616891
p00066
u661290476
1484481241
Python
Python3
py
Runtime Error
0
0
348
ok = [[0,4,8], [2,4,6], [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8]] while True: s = input() if len(s) == 0: break flag = False for i in ok: if s[i[0]] == s[i[1]] == s[i[2]] and s[i[0]] != 's': print(s[i[0]]) flag = True break if flag: ...
s951007491
p00066
u484327129
1518911626
Python
Python3
py
Runtime Error
0
0
1231
import sys board = [] board_list = [] result = [] while 1: line = input() if not line == "": board.append(x) else: break def check(num): if board_list[num][0] == board_list[num][1] == board_list[num][2]: if board_list[num][0] == 'o': return 'o' elif board_li...
s542407341
p00066
u484327129
1518911686
Python
Python3
py
Runtime Error
0
0
1258
import sys board = [] board_list = [] result = [] while 1: line = input() if not line == "": board.append(x) else: break except EOFError: pass def check(num): if board_list[num][0] == board_list[num][1] == board_list[num][2]: if board_list[num][0] == 'o': retur...
s084165865
p00066
u484327129
1518911751
Python
Python3
py
Runtime Error
0
0
1286
import sys board = [] board_list = [] result = [] try: while 1: line = input() if not line == "": board.append(x) else: break except EOFError: pass def check(num): if board_list[num][0] == board_list[num][1] == board_list[num][2]: if board_list[num][...
s669382530
p00066
u484327129
1518911758
Python
Python3
py
Runtime Error
0
0
1286
import sys board = [] board_list = [] result = [] try: while 1: line = input() if not line == "": board.append(x) else: break except EOFError: pass def check(num): if board_list[num][0] == board_list[num][1] == board_list[num][2]: if board_list[num][...
s559180362
p00066
u293019826
1530669684
Python
Python3
py
Runtime Error
0
0
500
d=0 while True: d+=1 if d==51: break s=str(input()) if s[0]==s[1]==s[2] and s[0] != "s": print(s[0]) elif s[3]==s[4]==s[5] and s[3] != "s": print(s[3]) elif s[6]==s[7]==s[8] and s[6] != "s": print(s[6]) elif s[0]==s[4]==s[8] and s[0] != "s": print(s[0]) elif s[2]==s[4]==s[6] and s[2] != "s": print(s[2])...
s725179476
p00066
u633068244
1393694210
Python
Python
py
Runtime Error
0
0
433
ls = ["o","x"] while True: try: a = raw_input() for c in ls if a[::4] == c*3 or a[2:8:2] == c*3: print c else: for i in range(3): if a[3*i:3*(i+1)] == c*3 or a[i::3] == c*3: print c ...
s853637698
p00067
u266872031
1427645943
Python
Python
py
Runtime Error
0
0
731
def isearch(field,dir1,dir2,I,J,Q): field[I][J]=0 for d in dir1: if field[min(11,I+d[0])][min(11,J+d[1])]: Q.append([I+d[0],J+d[1]]) for d in dir2: if field[max(0,I+d[0])][max(0,J+d[1])]: Q.append([I+d[0],J+d[1]]) if len(Q)!=0: [i,j]=Q.pop(0) isear...
s186879297
p00067
u266872031
1427646044
Python
Python
py
Runtime Error
0
0
736
def isearch(field,dir1,dir2,I,J,Q): field[I][J]=0 for d in dir1: if field[min(11,I+d[0])][min(11,J+d[1])]: Q.append([I+d[0],J+d[1]]) for d in dir2: if field[max(0,I+d[0])][max(0,J+d[1])]: Q.append([I+d[0],J+d[1]]) if len(Q)!=0: [i,j]=Q.pop(0) isear...
s847225643
p00067
u176428250
1433661885
Python
Python
py
Runtime Error
0
0
608
import sys sys.setrecursionlimit(10000000) M, N = map(int, raw_input().split()) field = [[0] * (M + 2)] for i in range(N): row = [0] row.extend(map(int, raw_input().split())) row.append(0) field.append(row) field.append([0] * (M + 2)) def search(row, column): global field if field[row][colum...
s380686097
p00067
u873482706
1434940092
Python
Python
py
Runtime Error
0
0
957
import sys def quartet(h, w): global flag if 0 <= h <= 11 and 0 <= w <= 11: if mapp[h][w] == '1': mapp[h][w] = '$' flag = True bigbang(h, w) elif mapp[h][w] == '0' or mapp[h][w] == '$': return else: return def bigbang(h, w): quart...
s257019218
p00067
u873482706
1434940154
Python
Python
py
Runtime Error
0
0
984
import sys def quartet(h, w): global flag if 0 <= h <= 11 and 0 <= w <= 11: if mapp[h][w] == '1': mapp[h][w] = '$' flag = True bigbang(h, w) elif mapp[h][w] == '0' or mapp[h][w] == '$': return else: return def bigbang(h, w): quart...
s003322971
p00067
u087002048
1482051663
Python
Python3
py
Runtime Error
0
0
1340
class Depth_First_Search_stack: def __init__(self, map): self.map = map self.num_island = 0 self.stack = [] self.start_point = None def get_start_point(self): get_start = False for i in range(12): for j in range(12): if self.map[i][j] ...
s816876003
p00067
u087002048
1482051843
Python
Python3
py
Runtime Error
0
0
1476
class Depth_First_Search_stack: def __init__(self, map): self.map = map self.num_island = 0 self.stack = [] self.start_point = None def get_start_point(self): get_start = False for i in range(12): for j in range(12): if self.map[i][j] ...
s123953638
p00067
u087002048
1482051934
Python
Python3
py
Runtime Error
0
0
1487
class Depth_First_Search_stack: def __init__(self, map): self.map = map self.num_island = 0 self.stack = [] self.start_point = None def get_start_point(self): get_start = False for i in range(12): for j in range(12): if self.map[i][j] ...
s080202026
p00067
u087002048
1482052200
Python
Python3
py
Runtime Error
0
0
1487
class Depth_First_Search_stack: def __init__(self, map): self.map = map self.num_island = 0 self.stack = [] self.start_point = None def get_start_point(self): get_start = False for i in range(12): for j in range(12): if self.map[i][j] ...
s416351115
p00067
u087002048
1482052777
Python
Python3
py
Runtime Error
0
0
1549
class Depth_First_Search_stack: def __init__(self, map): self.map = map self.num_island = 0 self.stack = [] self.start_point = None def get_start_point(self): get_start = False for i in range(12): for j in range(12): if self.map[i][j] ...
s413056961
p00067
u661290476
1484497891
Python
Python3
py
Runtime Error
0
0
728
mx = [0, 1, 0, -1] my = [-1, 0, 1, 0] while True: try: board = [[int(i) for i in input()] for j in range(12)] except: break cnt = 0 for y in range(12): for x in range(12): if board[y][x] == 1: cnt += 1 q = [(y, x)] whi...
s758898354
p00067
u661290476
1484497914
Python
Python3
py
Runtime Error
0
0
737
mx = [0, 1, 0, -1] my = [-1, 0, 1, 0] while True: try: board = [[int(i) for i in input()] for j in range(12)] except EOFError: break cnt = 0 for y in range(12): for x in range(12): if board[y][x] == 1: cnt += 1 q = [(y, x)] ...
s850835773
p00067
u661290476
1484498246
Python
Python3
py
Runtime Error
0
0
801
mx = [0, 1, 0, -1] my = [-1, 0, 1, 0] while True: try: board = [[int(i) for i in input()] for j in range(12)] cnt = 0 for y in range(12): for x in range(12): if board[y][x] == 1: cnt += 1 q = [(y, x)] w...
s179717416
p00067
u661290476
1484498610
Python
Python3
py
Runtime Error
0
0
753
mx = [0, 1, 0, -1] my = [-1, 0, 1, 0] while True: try: board = [[int(i) for i in input()] for j in range(12)] except EOFError: break cnt = 0 for y in range(12): for x in range(12): if board[y][x] == 1: cnt += 1 q = [(y, x)] ...
s969746033
p00067
u661290476
1484499287
Python
Python3
py
Runtime Error
0
0
774
mx = [0, 1, 0, -1] my = [-1, 0, 1, 0] while True: try: board = [[int(i) for i in input()] for j in range(12)] except EOFError: break cnt = 0 for y in range(12): for x in range(12): if board[y][x] == 1: cnt += 1 q = [(y, x)] ...
s205439834
p00067
u227162786
1490005063
Python
Python3
py
Runtime Error
0
0
593
def dfs(i, j, m): ''' m[i][j]??¨????????£??????????????°???????????????????????? ''' m[i][j] = 0 for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]: ni = i + di nj = j + dj if ni in range(12) and nj in range(12) and m[ni][nj] == 1: dfs(ni, nj, m) wh...
s029238061
p00067
u227162786
1490005134
Python
Python3
py
Runtime Error
0
0
605
def dfs(i, j, m): ''' m[i][j]??¨????????£??????????????°???????????????????????? ''' m[i][j] = 0 for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]: ni = i + di nj = j + dj if ni in range(12) and nj in range(12) and m[ni][nj] == 1: dfs(ni, nj, m) wh...
s493705834
p00067
u510797278
1504495822
Python
Python3
py
Runtime Error
0
0
824
dx = [0, 0, -1, 1] dy = [1, -1, 0, 0] def main(): while True: map = [] count = 0 try: for i in range(12): map.append([x for x in input()]) for i in range(12): for j in range(12): if map[i][j] == '1': ...
s789054113
p00067
u672443148
1515307054
Python
Python3
py
Runtime Error
0
0
708
ID=0 def dfs(row,col): global ID if islands[row][col]==1: islandsID[row][col]==ID if row<11: dfs(row+1,col) if row>0: dfs(row-1,col) if col<11: dfs(row,col+1) if col>0: dfs(row,col-1) while True: c=0 islands=[] ...
s297156639
p00067
u886729200
1523408793
Python
Python3
py
Runtime Error
0
0
726
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(is_data): return ...
s924460573
p00067
u886729200
1523409744
Python
Python3
py
Runtime Error
0
0
846
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(is_data): return ...
s218144481
p00067
u886729200
1523410933
Python
Python3
py
Runtime Error
0
0
761
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(is_data): return ...
s885759970
p00067
u886729200
1523411575
Python
Python3
py
Runtime Error
0
0
793
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(is_data): return ...
s162436347
p00067
u886729200
1523413244
Python
Python3
py
Runtime Error
0
0
860
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら print(x,y) dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(i...
s777441329
p00067
u886729200
1523413244
Python
Python3
py
Runtime Error
0
0
860
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら print(x,y) dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(i...
s443338208
p00067
u886729200
1523413249
Python
Python3
py
Runtime Error
0
0
860
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら print(x,y) dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(i...
s211707870
p00067
u886729200
1523413522
Python
Python3
py
Runtime Error
0
0
629
def get_map(): map = [] while True: try: tmp = list(raw_input()) if len(tmp) != 12: break map.append(tmp) except: break return map def remove_island(x, y, map): map[x][y] = 0 move = [[1, 0], [0, 1], [-1, 0], [0, -1]] for i, j in move: if 0 <= x + i <= 11 and 0 <= y + j <=...
s573217574
p00067
u886729200
1523414716
Python
Python3
py
Runtime Error
0
0
881
def counter():#島の数をカウントする count=0 #12*12個の値をひとつずつ調べる for x in range(12): for y in range(12): if is_data[x][y] == 1:#島が発見されたら print(x,y) dfs(x,y) count+=1 return count def dfs(x,y): if x<0 or x == len(is_data[x]) or y<0 or y == len(i...
s783650929
p00067
u563075864
1526227134
Python
Python3
py
Runtime Error
0
0
509
import numpy as np while 1: global a,c c = np.array([[0]*14]*14) a = np.array([[0]*14]*14) a[1:-1,1:-1] = [list(map(int,list(input()))) for i in range(12)] def dfs(x,y,n): if c[x][y] == 0 and a[x][y] == 1: c[x][y] = n [dfs(x+i, y+j, n) for i,j in [(-1,0),(1,0),(0,-1...
s151295421
p00067
u563075864
1526227252
Python
Python3
py
Runtime Error
0
0
510
import numpy as np while 1: global a,c c = np.array([[0]*14]*14) a = np.array([[0]*14]*14) a[1:-1,1:-1] = [list(map(int,list(input()))) for i in range(12)] def dfs(x,y,n): if c[x][y] == 0 and a[x][y] == 1: c[x][y] = n [dfs(x+i, y+j, n) for i,j in [(-1,0),(1,0),(0,-1...
s702727904
p00067
u912237403
1390087547
Python
Python
py
Runtime Error
0
0
933
import sys def f(y,x): f=0 if m[y][x]==1: m[y][x]=c f=1 return f def LR(y,x,dx): P=[] x+=dx while 0<=x<12 and m[y][x]!=0: if f(y,x):P+=[(y,x)] x+=dx return P def UD(y,x,dy): P=[] y+=dy while 0<=y<12 and m[y][x]!=0: if f(y,x):P+=[(y,x)] ...
s854528678
p00067
u633068244
1394731952
Python
Python
py
Runtime Error
0
0
642
l = 12 def island(f,x,y,m): rf = f[:][:] if rf[y][x] == 1: rf[y][x] = m for i in [-1,1]: if 0 <= x+i <= l-1: rf = island(rf,x+i,y,m) if 0 <= y+i <= l-1: rf = island(rf,x,y+i,m) return rf while True: f = [] for i in range(l): ...
s076408919
p00067
u633068244
1394733435
Python
Python
py
Runtime Error
0
0
712
File Edit Options Buffers Tools Python Help def island(f,x,y,m): if f[y][x] == 1: f[y][x] = m for i in [-1,1]: if 0 <= x+i <= 11: f = island(f,x+i,y,m) if 0 <= y+i <= 11: f = island(f,x,y+i,m) return f while True: f = []; m = 2 for ...
s017818627
p00067
u260980560
1397984976
Python
Python
py
Runtime Error
0
0
830
dx, dy = [-1, 0, 1, 0], [0, -1, 0, 1] while True: ans = 0 try: m = ['0'*14] + ['0'+raw_input()+'0' for i in xrange(12)] + ['0'*14] f = [[False for i in xrange(14)] for j in xrange(14)] for y in xrange(1, 13): for x in xrange(1, 13): if m[y][x]=='1' and f[y][x]...
s619501160
p00067
u708217907
1399935974
Python
Python
py
Runtime Error
0
0
870
#include <iostream> using namespace std; int m[12][12]; bool valid(int y, int x){ if(0 <= y && y < 12){ if(0 <= x && x < 12){ if(m[y][x] == 1) return true; } } return false; } void remove_island(int y, int x) { int nx, ny; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; m[y][x]...
s935667015
p00068
u408260374
1430298232
Python
Python3
py
Runtime Error
0
0
594
upper_hull = get_bounds(ps) ps.reverse() lower_hull = get_bounds(ps) del upper_hull[-1] del lower_hull[-1] upper_hull.extend(lower_hull) return upper_hull def get_bounds(ps): qs = [] for p in ps: while len(qs) > 1 and (qs[-1] - qs[-2]).det(p - qs[-1]) <= 0: del q...
s464683478
p00068
u140201022
1451293681
Python
Python
py
Runtime Error
0
0
613
def a(v1,v2): if v1[0]!=v2[0]: return (v2[1]-v1[1])/(v2[0]-v1[0]) else: return (v2[1]-v1[1])*(10**10) def dlt(p,v,sign): while len(p)>2: if sign*(a(v[p[-3]],v[p[-2]])-a(v[p[-2]],v[p[-1]]))<0: del p[-2] else: break return p def convex(v,n): d,...
s124577525
p00068
u912237403
1390221731
Python
Python
py
Runtime Error
0
0
442
import sys def side(p1,p2): global D y1,x1=p1 y2,x2=p2 dy=y2-y1 dx=x2-x1 for p3 in D[::-1]: if p1==p3 or p2==p3:pass y3,x3=p3 elif (x3-x1)*dy-dx*(y3-y1)<0:return 0 else:return 1 while 1: n=input() if n==0:break D=sorted([list(input()) for i in range(n)]) p=p1=D[0] D1=D[:] while Tr...
s136260872
p00068
u633068244
1395063063
Python
Python
py
Runtime Error
0
0
865
def f(x,y,x1,y1,x2,y2): if x1 <= x2: return (x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1 else: return -((x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1) def DC(a): if len(a) > 3: # Divide la = a[:len(a)/2] ra = a[len(a)/2:] la,ra = DC(la),DC(ra) # Conquer if len(la) == 1 ...
s604389454
p00068
u633068244
1395063077
Python
Python
py
Runtime Error
0
0
865
def f(x,y,x1,y1,x2,y2): if x1 <= x2: return (x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1 else: return -((x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1) def DC(a): if len(a) > 3: # Divide la = a[:len(a)/2] ra = a[len(a)/2:] la,ra = DC(la),DC(ra) # Conquer if len(la) == 1 ...
s037797140
p00068
u633068244
1395063371
Python
Python
py
Runtime Error
0
0
797
def f(x,y,x1,y1,x2,y2): if x1 <= x2: return (x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1 else: return -((x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1) def DC(a): if len(a) > 3: # Divide la = a[:len(a)/2] ra = a[len(a)/2:] # Conquer la,ra = DC(la),DC(ra) while f(ra[1][0]...
s492407254
p00068
u633068244
1395063394
Python
Python
py
Runtime Error
0
0
797
def f(x,y,x1,y1,x2,y2): if x1 <= x2: return (x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1 else: return -((x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1) def DC(a): if len(a) > 3: # Divide la = a[:len(a)/2] ra = a[len(a)/2:] # Conquer la,ra = DC(la),DC(ra) while f(ra[1][0]...
s789352828
p00069
u352394527
1527547035
Python
Python3
py
Runtime Error
0
0
1032
while True: n = int(input()) if not n: break start = int(input()) - 1 #開始の位置 goal = int(input()) - 1 #あたりの位置 d = int(input()) nums = [[i for i in range(n)]] #各段での数字の並び bars = [] #横棒リスト for i in range(d): s = input() bars.append(s) new = nums[-1][:] for j in range(n - 1): ...
s957027232
p00069
u847467233
1530176787
Python
Python3
py
Runtime Error
0
0
827
# AOJ 0069: Drawing Lots II # Python3 2018.6.28 bal4u while True: n = int(input()) if n == 0: break m, p, d = [int(input()) for i in range(3)] a = [[0 for j in range(10)] for i in range(32)] for i in range(1, d+1): a[i] = [0] + list(map(int, input())) + [0] s = [[0 for j in range(10)] for i in range(32)] for i ...
s117478207
p00069
u647766105
1356965531
Python
Python
py
Runtime Error
0
0
873
while True: n=input() if n==0: break m,goal,d=input(),input(),input() step=[""]*d for i in xrange(d): step[i]=raw_input() raw=range(1,n+1) for i in xrange(d): for j in xrange(n-1): if step[i][j]=="1": raw[j],raw[j+1]=raw[j+1],raw[j] ans...
s801120737
p00069
u647766105
1357005923
Python
Python
py
Runtime Error
0
0
912
while True: n=input() if n==0: break m,goal,d=input(),input(),input() step=[""]*d for i in xrange(d): step[i]="0"+raw_input()+"0" raw=range(n+2) for i in xrange(d): for j in xrange(1,n+1): if step[i][j]=="1": raw[j],raw[j+1]=raw[j+1],raw[j]...
s826547726
p00069
u912237403
1390741222
Python
Python
py
Runtime Error
0
0
471
import copy def amida(A,x): for e in A: if e[x]==1:x+=1 elif e[x-1]==1:x-=1 return x def f(): for i in range(d): for j in range(1,n): if A[i][j]==0: B=copy.deepcopy(A) B[i][j]=1 if amida(B,m)==p: print i+1,j return print 1 return import sys n=inp...
s286281304
p00069
u912237403
1390742765
Python
Python
py
Runtime Error
0
0
462
import copy,sys def amida(A,x): for e in A: if e[x]==1:x+=1 elif e[x-1]==1:x-=1 return x def f(): for i in range(d): for j in range(1,n): if A[i][j]==0: B=copy.deepcopy(A) B[i][j]=1 if amida(B,m)==p: print i+1,j return print 1 return n=input() m=in...
s387352035
p00069
u912237403
1390743235
Python
Python
py
Runtime Error
0
0
465
import copy,sys def amida(A,x): for e in A: if e[x]==1:x+=1 elif e[x-1]==1:x-=1 return x def f(): for i in range(d): for j in range(1,n+1): if A[i][j]==0: B=copy.deepcopy(A) B[i][j]=1 if amida(B,m)==p: print i+1,j return print 1 return n=input() m...
s746083024
p00069
u912237403
1391024443
Python
Python
py
Runtime Error
0
0
459
import sys def amida(A,x): for e in A: if e[x]==1:x+=1 elif e[x-1]==1:x-=1 return x def f(): for i in range(d): for j in range(1,n): if A[i][j]==0: B=[e[:] for e in A] B[i][j]=1 if amida(B,m)==p: print i+1,j return print 1 return n=input() m=input...
s201018967
p00069
u633068244
1394808750
Python
Python
py
Runtime Error
0
0
1047
while True: n = int(raw_input()) if n == 0: break m = int(raw_input())-1 x = int(raw_input())-1 d = int(raw_input()) amida = [] for i in range(d): amida.append(map(int, raw_input())) rroot = [] for i in range(d-1,-1,-1): if x > 0: if amida[i][x-1] ...
s607491650
p00069
u633068244
1394809213
Python
Python
py
Runtime Error
0
0
1355
while True: n = int(raw_input()) if n == 0: break m = int(raw_input())-1 x = int(raw_input())-1 d = int(raw_input()) amida = [] for i in range(d): amida.append(map(int, raw_input())) rroot = [] for i in range(d-1,-1,-1): if x > 0: if amida[i][x-1] ...
s447534731
p00069
u633068244
1394809280
Python
Python
py
Runtime Error
0
0
1354
while True: n = int(raw_input()) if n == 0: break m = int(raw_input())-1 x = int(raw_input())-1 d = int(raw_input()) amida = [] for i in range(d): amida.append(map(int, raw_input())) rroot = [] for i in range(d-1,-1,-1): if x > 0: if amida[i][x-1] ...
s104772410
p00069
u633068244
1394809511
Python
Python
py
Runtime Error
0
0
1354
while True: n = int(raw_input()) if n == 0: break m = int(raw_input())-1 x = int(raw_input())-1 d = int(raw_input()) amida = [] for i in range(d): amida.append(map(int, raw_input())) rroot = [] for i in range(d-1,-1,-1): if x > 0: if amida[i][x-1] ...
s176024776
p00069
u633068244
1394809570
Python
Python
py
Runtime Error
0
0
1354
while True: n = int(raw_input()) if n == 0: break m = int(raw_input())-1 x = int(raw_input())-1 d = int(raw_input()) amida = [] for i in range(d): amida.append(map(int, raw_input())) rroot = [] for i in range(d-1,-1,-1): if x > 0: if amida[i][x-1] ...
s468119581
p00069
u633068244
1394809954
Python
Python
py
Runtime Error
0
0
935
while True: n = int(raw_input()) if n == 0: break m,x,d = int(raw_input())-1,int(raw_input())-1,int(raw_input()) amida = [] for i in range(d): amida[i] = "0" + raw_input() + "0" rroot = [] for i in range(d-1,-1,-1): if amida[i][x-1] == "1": x -= 1 ...
s473150211
p00069
u633068244
1394809982
Python
Python
py
Runtime Error
0
0
931
while True: n = int(raw_input()) if n == 0: break m,x,d = int(raw_input())-1,int(raw_input())-1,int(raw_input()) amida = [] for i in range(d): amida[i] = "0" + raw_input() + "0" rroot = [] for i in range(d-1,-1,-1): if amida[i][x-1] == "1": x -= 1 ...
s838209379
p00070
u197615397
1531730567
Python
Python3
py
Runtime Error
0
0
606
from itertools import combinations import sys # dp[n][使った数字(bit)][合計] = count dp = [[[0]*331 for _ in [0]*2048] for _ in [0]*11] for i in range(11): dp[1][2**i][i] = 1 for i in range(2, 11): for used in (sum(comb) for comb in combinations([2**n for n in range(10)], i-1)): for j in filter(lambda x: use...
s323397782
p00070
u041086527
1416062412
Python
Python
py
Runtime Error
0
0
779
def is_prime2(q,k=100): q = abs(q) if q == 2: return True if q < 2 or q&1 == 0: return False for i in xrange(3,k): x,y = q,i while y: x, y = y, x % y if x != 1: continue if pow(i, q-1, q) != 1: return False return True if __name__ == "__main_...
s219358194
p00070
u041086527
1416062467
Python
Python
py
Runtime Error
0
0
743
def is_prime2(q,k=100): q = abs(q) if q == 2: return True if q < 2 or q&1 == 0: return False for i in xrange(3,k): x,y = q,i while y: x, y = y, x % y if x != 1: continue if pow(i, q-1, q) != 1: return False return True if __name__ == "__main_...