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
s213547597
p00193
u647766105
1394984468
Python
Python
py
Runtime Error
0
0
1232
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: continue ...
s663745440
p00193
u647766105
1394984759
Python
Python
py
Runtime Error
0
0
1161
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: continue ...
s465131873
p00193
u647766105
1394984839
Python
Python
py
Runtime Error
0
0
1256
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0 and len(q) <= (10 ** 5): y, x, step = q.pop(0) if cover[y][x] >= 0: ...
s938521084
p00193
u647766105
1394984896
Python
Python
py
Runtime Error
0
0
1256
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0 and len(q) <= (10 ** 3): y, x, step = q.pop(0) if cover[y][x] >= 0: ...
s430958620
p00193
u647766105
1394984921
Python
Python
py
Runtime Error
0
0
1249
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] return cover while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: ...
s111522687
p00193
u647766105
1394984999
Python
Python
py
Runtime Error
0
0
1268
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] return cover while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: ...
s633746211
p00193
u647766105
1394985141
Python
Python
py
Runtime Error
0
0
1259
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] return cover while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: ...
s340393940
p00193
u647766105
1394985502
Python
Python
py
Runtime Error
0
0
1240
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: continue ...
s897709501
p00193
u647766105
1394985919
Python
Python
py
Runtime Error
0
0
1278
#Deven-Eleven: import re p = re.compile("\d+\s\d+") D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y]...
s070521774
p00193
u647766105
1394985973
Python
Python
py
Runtime Error
0
0
1251
#Deven-Eleven: import re D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: conti...
s500031220
p00193
u647766105
1394986019
Python
Python
py
Runtime Error
0
0
1238
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: continue ...
s120287770
p00193
u647766105
1394986064
Python
Python
py
Runtime Error
0
0
1234
#Deven-Eleven: D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0))) def func(y, x): q = [(y, x, 0)] cover = [[-1] * m for _ in xrange(n)] while len(q) != 0: y, x, step = q.pop(0) if cover[y][x] >= 0: continue ...
s448673627
p00195
u140201022
1464795827
Python
Python
py
Runtime Error
0
0
184
l=[] while 1: n,k=map(int,raw_input().split()) cnt+=1 if n==k==0: break l.append(n+k) if cnt%5==0: print chr(l.index(max(l))+65),max(l) l=[]
s718142771
p00196
u567380442
1427370442
Python
Python3
py
Runtime Error
0
0
333
import sys f = sys.stdin while True: n = int(f.readline()) if n == 0: break teams = [f.readline().split() for i in range(n)] teams = [(t[0], -t.count('0'), t.count('1'), i) for i, t in enumerate(teams)] teams.sort(key=operator.itemgetter(1,2,3)) print('\n'.join([t[0] for ...
s172392892
p00199
u871745100
1368972046
Python
Python
py
Runtime Error
0
0
1515
def downA(chair): for i in range(1,n+1): if chair[i]=="#": chair[i]="A" return def downB(chair): for i in range(n,0,-1): if chair[i]=="#" and chair[i-1]!="A" and chair[i+1]!="A": chair[i]="B" return else: chair[chair.index("#")]="B" d...
s283817305
p00200
u580607517
1422714335
Python
Python
py
Runtime Error
0
0
939
inf = 0x10101010 def solve(A, strt): cost = [inf]*m visited = [False]*m cost[strt] = 0 while 1: min = inf next = -1 visited[strt] = True for i in range(m): if visited[i]: continue if A[strt][i]: d = cost[strt] + A[strt][i] if d < cost[i]: cost[i] = d if cost[i] < min: ...
s531352564
p00200
u879226672
1424264144
Python
Python
py
Runtime Error
0
0
2041
# -*- coding: utf-8 -*- def MakeRouteList(ite,start,end): '''make all routes list from start to end station''' ite.sort() output = [] # 1個め for k in range(len(ite)): # from start route = [] if ite[k][0]==start: route = [ite[k]] output.append(route...
s445098430
p00200
u879226672
1424264217
Python
Python
py
Runtime Error
0
0
2084
# -*- coding: utf-8 -*- def MakeRouteList(ite,start,end): '''make all routes list from start to end station''' ite.sort() output = [] # 1個め for k in range(len(ite)): # from start route = [] if ite[k][0]==start: route = [ite[k]] output.append(route...
s224882666
p00200
u879226672
1424264314
Python
Python
py
Runtime Error
0
0
1734
# -*- coding: utf-8 -*- def MakeRouteList(ite,start,end): '''make all routes list from start to end station''' ite.sort() output = [] # for k in range(len(ite)): # from start route = [] if ite[k][0]==start: route = [ite[k]] output.append(route) ...
s102863486
p00200
u879226672
1424264369
Python
Python
py
Runtime Error
0
0
2096
# -*- coding: utf-8 -*- def MakeRouteList(ite,start,end): '''make all routes list from start to end station''' ite.sort() output = [] # 1個め for k in range(len(ite)): # from start route = [] if ite[k][0]==start: route = [ite[k]] output.append(route...
s684599226
p00200
u879226672
1424264630
Python
Python
py
Runtime Error
0
0
2097
# -*- coding: utf-8 -*- def MakeRouteList(ite,start,end): '''make all routes list from start to end station''' ite.sort() output = [] # 1個め for k in range(len(ite)): # from start route = [] if ite[k][0]==start: route = [ite[k]] output.append(route...
s681212582
p00200
u685815919
1473837709
Python
Python
py
Runtime Error
0
0
1074
import sys def dijkstra(m, start, goal, matrix): defnode = [False] * (m+1) cost = [sys.maxint] * (m+1) cost[start] = 0 node = start while True: defnode[node] = True minnode = sys.maxint mincost = sys.maxint for i in xrange(1, m+1): if defnode[i]: continue if matrix[node][i...
s852521135
p00200
u589276934
1500362222
Python
Python3
py
Runtime Error
0
0
1810
# coding: utf-8 import queue class Route: def __init__(self, station_number, price, time): self.station_number = station_number self.price = price self.time = time class Station: def __init__(self): self.routes = [] def addRoute(self,route): self.routes.append(route...
s260545712
p00200
u589276934
1500362622
Python
Python3
py
Runtime Error
0
0
1789
# coding: utf-8 class Route: def __init__(self, station_number, price, time): self.station_number = station_number self.price = price self.time = time class Station: def __init__(self): self.routes = [] def addRoute(self,route): self.routes.append(route) class Path:...
s960986632
p00200
u589276934
1500365117
Python
Python3
py
Runtime Error
0
0
1699
# coding: utf-8 class Route: def __init__(self, next_station, need_price, need_time): self.next_station = next_station self.need_price = need_price self.need_time = need_time class Station: def __init__(self): self.routes = [] def addRoute(self,route): self.routes.ap...
s598236590
p00200
u754367965
1508502108
Python
Python
py
Runtime Error
0
0
860
while True: n, m = list(map(int,input().split())) if n == 0 and m == 0: break # ??°????????\??? cost = [[10000000 for i in range(m+1)] for j in range(m+1)] time = [[10000000 for i in range(m+1)] for j in range(m+1)] for i in range(n): a, b, c, t = list(map(int, input().split())...
s387474998
p00200
u742505495
1528254260
Python
Python3
py
Runtime Error
0
0
1388
import queue def Dijkstra_mode(vertex,edges,start,end,mode): weight = [0 if i==start else float("inf") for i in range(vertex)] Q = queue.PriorityQueue() Q.put((weight[start],start)) while(not Q.empty()): cur = Q.get() if weight[cur[1]] < cur[0]: continue if mode =...
s513694327
p00200
u742505495
1528254417
Python
Python3
py
Runtime Error
0
0
1390
import queue def Dijkstra_mode(vertex,edges,start,end,mode): weight = [0 if i==start else float("inf") for i in range(vertex)] Q = queue.PriorityQueue() Q.put((weight[start],start)) while(not Q.empty()): cur = Q.get() if weight[cur[1]] < cur[0]: continue if mode =...
s830170991
p00200
u180584272
1381664093
Python
Python
py
Runtime Error
0
0
1174
n,m = map(int,raw_input().split()) #n = the number of lines, m = the numer of stations err = 100000 drcs = [] #the seq of direct route and cost drts = [] #the seq of direct route and time for i in xrange(n): a,b,cost,time = map(int,raw_input().split()) a,b = a-1,b-1 drcs.append((a,b,cost)) drts.appen...
s587789722
p00200
u647766105
1388034359
Python
Python
py
Runtime Error
0
0
87
6 5 1 2 200 10 1 4 400 15 1 3 250 25 2 4 100 10 4 5 150 20 3 5 300 20 2 1 5 0 1 5 1 0 0
s805727230
p00200
u621997536
1388512612
Python
Python
py
Runtime Error
0
0
782
import numpy INF = 1000000000 def dj(s, e, r): d = [INF] * 100 done = [0] * 100 d[s] = 0 while True: v = -1 for i in range(V): if not done[i] and (v == -1 or d[i] < d[v]): v = i if v == e: return d[e] done[v] = True for i in range(V): d[i] = min(d[i], d[v] + cost[...
s761075157
p00200
u621997536
1388540288
Python
Python
py
Runtime Error
0
0
1097
import sys import math def subsolve(ofs,range,array,data,dofs,mode,target): ret = [] if range == 0: if data[ofs][array[0]][mode] == -1: return [] ref = dofs+data[ofs][array[i]][mode] ret.append(ref) return ret for i in xrange(range): if data[ofs][array[i]][mode] == -1: continue ref = dofs+data[ofs]...
s799142415
p00200
u621997536
1388540786
Python
Python
py
Runtime Error
0
0
1153
import sys import math def subsolve(ofs,range,array,data,dofs,mode,target): ret = [] if range == 0: if data[ofs][array[0]][mode] == -1: return [] ref = dofs+data[ofs][array[i]][mode] ret.append(ref) return ret for i in xrange(range): if data[ofs][array[i]][mode] == -1: continue ref = dofs+data[ofs]...
s588544733
p00200
u350508326
1398874938
Python
Python
py
Runtime Error
0
0
1708
cost_ans = [] time_ans = [] def set_ans(cost , time): cost_ans.append(cost) time_ans.append(time) class Sta(object): """station""" def __init__(self, station_name): super(Sta, self).__init__() self.station_name = station_name self.route = [] def add_route(self, route): ...
s872280509
p00200
u350508326
1398875328
Python
Python
py
Runtime Error
0
0
1782
cost_ans = [] time_ans = [] def set_ans(cost , time): cost_ans.append(cost) time_ans.append(time) def reset_ans(): global cost_ans global time_ans cost_ans = [] time_ans = [] class Sta(object): """station""" def __init__(self, station_name): super(Sta, self).__init__() ...
s740804791
p00200
u350508326
1398875364
Python
Python
py
Runtime Error
0
0
1779
cost_ans = [] time_ans = [] def set_ans(cost , time): cost_ans.append(cost) time_ans.append(time) def reset_ans(): global cost_ans global time_ans cost_ans = [] time_ans = [] class Sta(object): """station""" def __init__(self, station_name): super(Sta, self).__init__() ...
s555749045
p00200
u557208833
1402150072
Python
Python
py
Runtime Error
0
0
1042
import sys import math def readnums(): return map(int,raw_input().rstrip().split()) def makingpath(network,param='cost'): N = len(network) path = [[float("inf") for j in range(0,N)] for i in range(0,N)] for i in range(1,N): for j in range(i+1,N): if j in network[i]: ...
s617058812
p00200
u557208833
1402150445
Python
Python
py
Runtime Error
0
0
1033
import sys import math def readnums(): return map(int,raw_input().split()) def makingpath(network,param='cost'): N = len(network) path = [[float("inf") for j in range(0,N)] for i in range(0,N)] for i in range(1,N): for j in range(i+1,N): if j in network[i]: path[i][...
s998426014
p00200
u557208833
1402150745
Python
Python
py
Runtime Error
0
0
1017
def readnums(): return map(int,raw_input().split()) def makingpath(network,param='cost'): N = len(network) path = [[float("inf") for j in range(0,N)] for i in range(0,N)] for i in range(1,N): for j in range(i+1,N): if j in network[i]: path[i][j] = path[j][i] = networ...
s832187705
p00201
u567380442
1427434925
Python
Python3
py
Runtime Error
0
0
587
def price(target, item, recipe): ret = [] if target in recipe: ret.append(sum(price(r,item, recipe) for r in recipe[target])) if target in item: ret.append(item[target]) return min(ret) import sys f = sys.stdin while True: n = int(f.readline()) if n == 0: break ...
s620406058
p00201
u567380442
1427436754
Python
Python3
py
Runtime Error
0
0
601
def price(target, item, recipe): ret = [] if target in recipe: ret.append(sum(price(r,item, recipe) for r in recipe[target])) if target in item: ret.append(item[target]) return min(ret) import sys f = sys.stdin while True: n = int(f.readline()) if n == 0: br...
s891562176
p00201
u567380442
1427437023
Python
Python3
py
Runtime Error
0
0
608
def price(target, item, recipe): ret = [] if target in recipe: ret.append(sum(price(r,item, recipe) for r in recipe[target])) if target in item: ret.append(item[target]) return min(ret) import sys f = sys.stdin while True: n = int(f.readline()) if n == 0: break ...
s484625629
p00201
u379499530
1432704782
Python
Python
py
Runtime Error
0
0
703
def check(item): price = 0 for i in recipe[item[-1]]: if recipe.has_key(i) == False: price += pricelist[i] else: item.append(i) price += min(check(item), pricelist[item[-1]]) item.pop() return price while True: pricelist = {} recipe = ...
s671063428
p00201
u460331583
1346922392
Python
Python
py
Runtime Error
0
0
742
while True: count =int(input()) if count == 0:break thing1,money1=[],[] for i in range(count): hoge = map(str,raw_input().split()) thing1.append(hoge[0]) a = int(hoge[1]) money1.append(a) count2 = int(input()) if count2 == 0: a = map(str,raw_input()) a = ''.join(a) ...
s172874944
p00201
u460331583
1346922521
Python
Python
py
Runtime Error
0
0
732
while True: count =int(input()) if count == 0:break thing1,money1=[],[] for i in range(count): hoge = map(str,raw_input().split()) thing1.append(hoge[0]) a = int(hoge[1]) money1.append(a) count2 = int(input()) if count2 == 0: a = map(str,raw_input()) a = ''.join(a) b = thi...
s676390875
p00201
u460331583
1347031679
Python
Python
py
Runtime Error
0
0
678
while True: count = int(input()) if count == 0: break thing1,thing2,money=[],[],[] for i in range(count): hoge = map(str,raw_input().split()) q = int(hoge[1]) thing1.append(hoge[0]) money.append(q) count = int(input()) if count == 0 : hoge = raw_input() ans=thing1.index(hoge) pri...
s886220912
p00201
u460331583
1347031925
Python
Python
py
Runtime Error
0
0
702
while True: count = int(input()) if count == 0: break thing1,thing2,money=[],[],[] for i in range(count): hoge = map(str,raw_input().split()) q = int(hoge[1]) thing1.append(hoge[0]) money.append(q) count = int(input()) if count == 0 : hoge = raw_input() ans=thing1.index(hoge) pri...
s805226758
p00201
u460331583
1347075357
Python
Python
py
Runtime Error
0
0
613
while True: count = int(input()) if count == 0: break thing,money = [],[] for i in range(count): hoge= map(str,raw_input().split()) q = int(hoge[1]) thing.append(hoge[0]) money.append(q) count2 = int(input()) if count2 == 0: hoge= raw_input() kz = thing.index(hoge) print money[kz] else: for j...
s727639560
p00201
u460331583
1347523793
Python
Python
py
Runtime Error
0
1008
678
while True: count = int(input()) if count == 0: break money,thing = [],[] for i in range(count): hoge = map(str,raw_input().split()) t = int(hoge[1]) money.append(t) thing.append(hoge[0]) count = int(input()) if count == 0: hoge = raw_input() t = thing.index(hoge) print money[t] ...
s016501955
p00201
u460331583
1347610688
Python
Python
py
Runtime Error
0
0
744
while True: count = int(input()) if count == 0: break thing,money=[],[] for i in range(count): hoge = map(str,raw_input().split()) t = int(hoge[1]) thing.append(hoge[0]) money.append(t) count = int(input()) if count == 0: hoge = raw_input() if hoge not in thing: print 0 ...
s118501528
p00201
u460331583
1347610834
Python
Python
py
Runtime Error
0
0
761
while True: count = int(input()) if count == 0: break thing,money=[],[] for i in range(count): hoge = map(str,raw_input().split()) t = int(hoge[1]) thing.append(hoge[0]) money.append(t) count = int(input()) if count == 0: hoge = raw_input() if hoge not in thing: print 0 ...
s933642927
p00201
u147801965
1364009650
Python
Python
py
Runtime Error
0
0
492
while True: things = {} count = input() if count == 0: break for i in range(count): fuga = raw_input().split() things[fuga[0]] = int(fuga[1]) for i in range(input()): fuga = raw_input().split() money =0 for j in range(int(fuga[1])): money+= things[...
s784126119
p00201
u147801965
1364438934
Python
Python
py
Runtime Error
0
0
858
while True: &#160;&#160;&#160;&#160;ts={} &#160;&#160;&#160;&#160;c=input() &#160;&#160;&#160;&#160;if c==0: break &#160;&#160;&#160;&#160;for i in range(c): &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;f=raw_input().split() &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ts[f[0]]=int(f[1]) &#160;&#160;&#160;&#160;f...
s510808683
p00201
u599161451
1375197053
Python
Python
py
Runtime Error
0
0
1509
#!/usr/bin/python import sys class Alchemey(object): def __init__(self): self.prices = {} self.recipes = {} def add_to_price_list(self, line): name, price = line.split() self.prices[name] = int(price) def add_to_recipe_list(self, line): xs = line.split() ...
s841830188
p00201
u599161451
1375197187
Python
Python
py
Runtime Error
0
0
1505
#!/usr/bin/python import sys class Alchemey(object): def __init__(self): self.prices = {} self.recipes = {} def add_to_price_list(self, line): name, price = line.split() self.prices[name] = int(price) def add_to_recipe_list(self, line): xs = line.split() d...
s576437827
p00201
u147801965
1380904102
Python
Python
py
Runtime Error
0
0
252
q,w,e=range,input,raw_input while True: n=w() if n==0:break d={} for i in q(n): o=e().split() d[o[0]]=int(o[1]) for j in q(w()): t=e().split() a=sum([d[i] for i in t[2:]]) d[t[0]]=a if a<d[t[0]] else d[t[0]] print d[e()]
s699171988
p00201
u647766105
1388151163
Python
Python
py
Runtime Error
0
0
338
while True: n = input() if n == 0: break dic = {} for _ in xrange(n): name, cost = raw_input().split() dic[name] = int(cost) for _ in xrange(input()): items = raw_input().split() dic[items[0]] = min(dic[items[0]], sum(map(lambda x:dic[x], items[2:]))) prin...
s480452056
p00201
u647766105
1388151281
Python
Python
py
Runtime Error
0
0
385
while True: n = input() if n == 0: break dic = {} for _ in xrange(n): name, cost = raw_input().split() dic[name] = int(cost) for _ in xrange(input()): items = raw_input().split() if items[1] == 0: continue dic[items[0]] = min(dic[items[0]],...
s730113808
p00201
u647766105
1388151429
Python
Python
py
Runtime Error
0
0
500
while True: n = input() if n == 0: break dic = {} for _ in xrange(n): name, cost = raw_input().split() dic[name] = int(cost) for _ in xrange(input()): items = raw_input().split() if items[1] == 0: continue if items[0] not in dic: ...
s148616566
p00201
u647766105
1388152634
Python
Python
py
Runtime Error
0
0
505
while True: n = input() if n == 0: break dic = {} for _ in xrange(n): name, cost = raw_input().split() dic[name] = int(cost) m = input() recipe = [] for _ in xrange(m): data = raw_input().split() recipe.append([data[0]]+data[2:]) for _ in xrange(m)...
s305973862
p00201
u647766105
1388153399
Python
Python
py
Runtime Error
0
0
570
while True: n = input() if n == 0: break dic = {} for _ in xrange(n): name, cost = raw_input().split() dic[name] = int(cost) m = input() recipe = [] for _ in xrange(m): data = raw_input().split() if data[1] <= 0: m -= 1 continue...
s733997063
p00201
u104911888
1389234325
Python
Python
py
Runtime Error
0
0
496
def rec(name): if name not in combs: return items[name] s = 0 for nm in combs[name]: s += rec(nm) return min(s, items[name]) while True: items = {} combs = {} n = input() if n == 0: break for i in range(n): name, cost = raw_input().split() ite...
s412959058
p00201
u266872031
1396538844
Python
Python
py
Runtime Error
0
0
821
import sys def cheaperprice(item): rawprice=rawprices[item] if item not in menus: return rawprice else: indegrients=menus[item] combinedprice=0 for i in indegrients: combinedprice+=cheaperprice(i) return min(combinedprice,rawprice) n=0 #how many numbers...
s760892829
p00201
u266872031
1396539599
Python
Python
py
Runtime Error
0
0
852
import sys sys.setrecursionlimit(10000) def cheaperprice(item): rawprice=rawprices[item] if item not in menus: return rawprice else: indegrients=menus[item] combinedprice=0 for i in indegrients: combinedprice+=cheaperprice(i) return min(combinedprice,ra...
s176677071
p00201
u266872031
1396539629
Python
Python
py
Runtime Error
0
0
856
import sys sys.setrecursionlimit(1024*1024) def cheaperprice(item): rawprice=rawprices[item] if item not in menus: return rawprice else: indegrients=menus[item] combinedprice=0 for i in indegrients: combinedprice+=cheaperprice(i) return min(combinedpric...
s298242859
p00201
u266872031
1396541180
Python
Python
py
Runtime Error
0
0
942
import sys def cheaperprice(item): rawprice=rawprices[item] if item not in menus or item in checkloop: checkloop.append(item) return rawprice else: checkloop.append(item) indegrients=menus[item] combinedprice=0 for i in indegrients: combinedprice+...
s844063132
p00201
u266872031
1396541393
Python
Python
py
Runtime Error
0
0
972
import sys def cheaperprice(item): rawprice=rawprices[item] if item in checkloop: return rawprice elif item not in menus checkloop.append(item) return rawprice else: checkloop.append(item) indegrients=menus[item] combinedprice=0 for i in indegrie...
s635363101
p00201
u266872031
1396541753
Python
Python
py
Runtime Error
0
0
972
import sys def cheaperprice(item): rawprice=rawprices[item] if item in checkloop: return rawprice elif item not in menus: checkloop.append(item) return rawprice else: checkloop.append(item) indegrients=menus[item] combinedprice=0 for i in indegrie...
s056737105
p00201
u266872031
1396541914
Python
Python
py
Runtime Error
0
0
1108
import sys def cheaperprice(item): rawprice=rawprices[item] if item in checkloop: return rawprice elif item not in menus: checkloop.append(item) return rawprice else: checkloop.append(item) indegrients=menus[item] combinedprice=0 for i in indegrie...
s182859125
p00201
u266872031
1397021947
Python
Python
py
Runtime Error
0
0
1186
import sys def cheaperprice(item,checkloop,rawprices,menus): rawprice=rawprices[item] if item in checkloop: return rawprice elif item not in menus: checkloop.append(item) return rawprice else: checkloop.append(item) indegrients=menus[item] combinedprice=0...
s132945927
p00201
u633068244
1399299717
Python
Python
py
Runtime Error
0
0
424
while 1: n = input() if n == 0: break item = {} for i in range(n): n,c = map(str,raw_input().split()) item[n] = int(c) m = input() recipes = [map(str,raw_input().split()) for i in range(m)] recipes = sorted(recipes, key = lambda x:item[x[0]]) for recipe in recipes: needs = recipe[2:] cost = 0 for need...
s275822702
p00201
u633068244
1399299998
Python
Python
py
Runtime Error
0
0
427
while 1: n = input() if n == 0: break item = {} for i in range(n): name,cost = raw_input().split() item[name] = int(cost) m = input() recipes = [raw_input().split() for i in range(m)] recipes = sorted(recipes, key = lambda x:item[x[0]]) for recipe in recipes: name = recipe[0] needs = recipe[2:] cost =...
s323207854
p00201
u633068244
1399300240
Python
Python
py
Runtime Error
0
0
481
while 1: n = input() if n == 0: break item = {} for i in range(n): name,cost = raw_input().split() item[name] = int(cost) m = input() recipes = [raw_input().split() for i in range(m)] recipes = sorted(recipes, key = lambda x: item[x[0]] if x[0] in item else 2<<31) for recipe in recipes: name = recipe[0] ...
s260622368
p00201
u633068244
1399300547
Python
Python
py
Runtime Error
0
0
507
while 1: n = input() if n == 0: break item = {} for i in range(n): name,cost = raw_input().split() item[name] = int(cost) m = input() recipes = [raw_input().split() for i in range(m)] for recipe in recipes: if recipe[0] not in item: item[recipe[0]] = 2<<31 recipes = sorted(recipes, key = lambda x: item...
s605671686
p00201
u633068244
1399300718
Python
Python
py
Runtime Error
0
0
357
while 1: n = input() if n == 0: break item = {} for i in range(n): name,cost = raw_input().split() item[name] = int(cost) m = input() recipes = [raw_input().split() for i in range(m)] for recipe in recipes: name = recipe[0] cost = 0 for need in recipe[2:]: cost += item[need] item[name] = min(cost,...
s600644842
p00202
u352394527
1531034284
Python
Python3
py
Runtime Error
0
0
533
def main(): tf = [True] * 1000001 tf[0] = tf[1] = False for i in range(2, 1001): if tf[i]: for j in range(i ** 2 , 1000001, i): tf[j] = False while True: n, x = map(int, input().split()) if n == 0: break can = [False] * (x + 1) can[0] = True for _ in range(n): ...
s447173515
p00202
u352394527
1531034554
Python
Python3
py
Runtime Error
0
0
633
def main(): tf = [True] * 1000001 tf[0] = tf[1] = False for i in range(2, 1001): if tf[i]: for j in range(i ** 2 , 1000001, i): tf[j] = False primes = [i for i in range(1000001) if tf[i]] while True: n, x = map(int, input().split()) if n == 0: break can = [False] * (x + ...
s179013328
p00202
u352394527
1531035969
Python
Python3
py
Runtime Error
0
0
706
from bisect import bisect_left as bl def main(): tf = [True] * 1000004 tf[0] = tf[1] = False for i in range(2, 1001): if tf[i]: for j in range(i ** 2 , 1000004, i): tf[j] = False primes = [i for i in range(1000004) if tf[i]] while True: n, x = map(int, input().split()) if n == 0: ...
s602649456
p00202
u352394527
1531036298
Python
Python3
py
Runtime Error
0
0
626
from bisect import bisect_left as bl def main(): tf = [True] * 1000004 tf[0] = tf[1] = False for i in range(2, 1001): if tf[i]: for j in range(i ** 2 , 1000004, i): tf[j] = False primes = [i for i in range(1000004) if tf[i]] while True: n, x = map(int, input().split()) if n == 0: ...
s297141770
p00202
u567380442
1427456605
Python
Python3
py
Runtime Error
19930
112284
761
def sieve(): n = 10000001 p = [1] * n p[0] = p[1] = 0 for i in range(int(n ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) for i in range(0,len(num),menu[0]): ...
s931509058
p00202
u567380442
1427457038
Python
Python3
py
Runtime Error
19920
41976
759
def sieve(): n = 1000001 p = [1] * n p[0] = p[1] = 0 for i in range(int(n ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) for i in range(0,len(num),menu[0]): ...
s567163114
p00202
u567380442
1427457664
Python
Python3
py
Runtime Error
19930
28432
790
def sieve(): n = 1000001 p = [1] * n p[0] = p[1] = 0 for i in range(int(n ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p def solve(p, menu, x): menu.sort(reverse=True) num = [0] * (x + 1) for i in range(0,len(num),men...
s444445106
p00202
u567380442
1427462179
Python
Python3
py
Runtime Error
19930
28436
778
def sieve(): p = [1] * 1000001 p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i): p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) for i in range(0,len(num),menu[0]): num[i] = 1 ...
s253001370
p00202
u567380442
1427496975
Python
Python3
py
Runtime Error
19930
28364
708
def sieve(): p = [1] * 1000001 p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i): p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) num[0] = 1 for mi in menu: for i in range(...
s181531444
p00202
u567380442
1427510732
Python
Python3
py
Runtime Error
19930
43736
701
def sieve(): p = [1] * 1000001;p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i):p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (max(menu) + x + 1);num[0] = 1 for i in range(x + 1): for mi in menu: ...
s716846282
p00202
u567380442
1427512173
Python
Python3
py
Runtime Error
0
0
760
def sieve(): p = [1] * 1000001;p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i):p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) num[0] = 1 for mi in menu: if num[mi]: continue ...
s495561015
p00202
u567380442
1427512442
Python
Python3
py
Runtime Error
0
0
760
def sieve(): p = [1] * 1000001;p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i):p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (x + 1) num[0] = 1 for mi in menu: if num[mi]: continue ...
s016245537
p00202
u567380442
1427518516
Python
Python3
py
Runtime Error
19930
43756
911
def sieve(): p = [1] * 1000001;p[0] = p[1] = 0 for i in range(1000): if p[i]: for j in range(i * i, 1000001, i):p[j] = 0 return p def solve(p, menu, x): menu.sort() num = [0] * (max(menu) + x + 1);num[0] = 1 cnt = 0 for i in range(x + 1): if p[i]: ...
s433666708
p00202
u567380442
1429013333
Python
Python3
py
Runtime Error
19920
28500
806
from sys import stdin readline = stdin.readline import math def sieve(n): p = [1] * (n + 1) p[0] = p[1] = 0 for i in range(math.ceil((n + 1) ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p prime = sieve(1000000) def solve(price, x): ...
s110138120
p00202
u567380442
1429013628
Python
Python3
py
Runtime Error
19930
28516
933
from sys import stdin readline = stdin.readline import math def sieve(n): p = [1] * (n + 1) p[0] = p[1] = 0 for i in range(math.ceil((n + 1) ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p prime = sieve(1000000) def solve(price, x): ...
s475710077
p00202
u567380442
1429013897
Python
Python3
py
Runtime Error
19930
28584
937
from sys import stdin readline = stdin.readline import math def sieve(n): p = [1] * (n + 1) p[0] = p[1] = 0 for i in range(math.ceil((n + 1) ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p prime = sieve(1000000) def solve(price, x): ...
s214870376
p00202
u567380442
1429015623
Python
Python3
py
Runtime Error
19930
28536
1104
from sys import stdin readline = stdin.readline import math def sieve(n): p = [1] * (n + 1) p[0] = p[1] = 0 for i in range(math.ceil((n + 1) ** 0.5)): if p[i]: for j in range(2 * i, len(p), i): p[j] = 0 return p prime = sieve(1000000) def solve(price, x): ...
s751097858
p00202
u162387221
1431777819
Python
Python
py
Runtime Error
19930
63364
575
while True: n, x = map(int, raw_input().split()) if n == x == 0: break p, ls = [1] * x, [0]*x p[0] = p[1] = 0 ls[0] = 1 m, s = [], 0 for i in range(2, int(x**0.5)+1): if p[i]: for j in range(i*2, x, i): p[j] = 0 for i in range(n): m.append(inp...
s404812267
p00202
u162387221
1431778338
Python
Python
py
Runtime Error
19930
63364
576
while True: n, x = map(int, raw_input().split()) if n == x == 0: break x += 1 p, ls, m = [1] * x, [0]*x, [] p[0] = p[1] = 0 ls[0] = 1 for i in range(2, int(x**0.5)+1): if p[i]: for j in range(i*2, x, i): p[j] = 0 for i in range(n): m.append(in...
s963285813
p00202
u316268279
1432205995
Python
Python
py
Runtime Error
19930
58952
1049
#!/usr/bin/env python # -*- coding: utf-8 -*- import math #must import library 'math' def sieve_of_erastosthenes(num): input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True ...
s442961381
p00202
u408260374
1432208664
Python
Python
py
Runtime Error
19930
63868
653
from math import sqrt prime = [1 for _ in xrange(10**6+1)] prime[1] = 0 prime[0] = 0 for i in xrange(2, int(sqrt(10**6+1))+1): if prime[i] == 1: for j in xrange(i+i, 10**6+1, i): prime[j] = 0 while True: N, X = map(int, raw_input().split()) if (N, X) == (0, 0): break price = [input()...
s583304336
p00202
u408260374
1432208764
Python
Python
py
Runtime Error
19930
35412
654
from math import sqrt prime = [1 for _ in xrange(10**6+1)] prime[1] = 0 prime[0] = 0 for i in xrange(2, int(sqrt(10**6+1))+1): if prime[i] == 1: for j in xrange(i+i, 10**6+1, i): prime[j] = 0 while True: N, X = map(int, raw_input().split()) if (N, X) == (0, 0): break price = [input()...
s193584839
p00202
u408260374
1432216165
Python
Python
py
Runtime Error
19930
35668
664
from math import sqrt prime = [1 for _ in xrange(10**6+1)] prime[1] = 0 prime[0] = 0 for i in xrange(2, int(sqrt(10**6+1))+1): if prime[i] == 1: for j in xrange(i+i, 10**6+1, i): prime[j] = 0 while True: N, X = map(int, raw_input().split()) if (N, X) == (0, 0): break price = [input()...
s381919517
p00202
u408260374
1432218970
Python
Python3
py
Runtime Error
19920
33712
1052
from math import sqrt class Prime: """ make prime numbers lists """ def __init__(self, n): self.is_prime = [True for _ in range(n+1)] self.primeList = [] self.is_prime[0] = False self.is_prime[1] = False for i in range(2, int(pow(n, 0.5))+1): if self.is_prime...
s612737745
p00202
u032662562
1519307433
Python
Python3
py
Runtime Error
0
0
2406
# -*- coding: utf-8 -*- import pdb import sys,math,time #Debug=True Debug=False nmax=1000000 #unit_cost = [500,305,260,129] #total_cost = 15000 #unit_cost = [12,9,5] #total_cost = 200909 unit_cost = [] total_cost=0 primes=[] pmax=-1 def ip(f,g): s=0 for i in zip(f,g): s += i[0]*i[1] return(s) ...