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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s794581975 | p00425 | u813534019 | 1476371069 | Python | Python | py | Runtime Error | 0 | 0 | 1151 | UP=0
SOURTH=1
EAST=2
saikoro = [1,2,3]
def north():
before=[saikoro[0], saikoro[1],saikoro[2]]
saikoro[UP] = before[SOURTH]
saikoro[SOURTH] = 7-before[UP]
def south():
before=[saikoro[0], saikoro[1],saikoro[2]]
saikoro[UP] = 7- before[SOURTH]
saikoro[SOURTH] = before[UP]
def east():
... |
s169478134 | p00425 | u813534019 | 1476372306 | Python | Python | py | Runtime Error | 0 | 0 | 414 | rot = {
"North": (1,5,2,3,0,4),
"East" : (3,1,0,5,4,2),
"West" : (2,1,5,0,4,3),
"South": (4,0,2,3,5,1),
"Right": (0,2,4,1,3,5),
"Left" : (0,3,1,4,2,5)
}
while 1:
n = int(raw_input())
if not n:
break
dice = [1,2,3,4,5,6]
ans = 0
for i in xrange(n):
r = rot[raw_... |
s680587623 | p00425 | u813534019 | 1476372338 | Python | Python | py | Runtime Error | 0 | 0 | 414 | rot = {
"North": (1,5,2,3,0,4),
"East" : (3,1,0,5,4,2),
"West" : (2,1,5,0,4,3),
"South": (4,0,2,3,5,1),
"Right": (0,2,4,1,3,5),
"Left" : (0,3,1,4,2,5)
}
while 1:
n = int(raw_input())
if not n:
break
dice = [1,2,3,4,5,6]
ans = 0
for i in xrange(n):
r = rot[raw_... |
s099323075 | p00425 | u813534019 | 1476372480 | Python | Python | py | Runtime Error | 0 | 0 | 414 | rot = {
"North": (1,5,2,3,0,4),
"East" : (3,1,0,5,4,2),
"West" : (2,1,5,0,4,3),
"South": (4,0,2,3,5,1),
"Right": (0,2,4,1,3,5),
"Left" : (0,3,1,4,2,5)
}
while 1:
n = int(raw_input())
if not n:
break
dice = [1,2,3,4,5,6]
ans = 0
for i in xrange(n):
r = rot[raw_... |
s047762384 | p00425 | u813534019 | 1476372529 | Python | Python | py | Runtime Error | 0 | 0 | 414 | rot = {
"North": (1,5,2,3,0,4),
"East" : (3,1,0,5,4,2),
"West" : (2,1,5,0,4,3),
"South": (4,0,2,3,5,1),
"Right": (0,2,4,1,3,5),
"Left" : (0,3,1,4,2,5)
}
while 1:
n = int(raw_input())
if not n:
break
dice = [1,2,3,4,5,6]
ans = 0
for i in xrange(n):
r = rot[raw_... |
s728571053 | p00425 | u116501200 | 1480680575 | Python | Python3 | py | Runtime Error | 0 | 0 | 553 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s133081481 | p00425 | u116501200 | 1480680647 | Python | Python3 | py | Runtime Error | 0 | 0 | 648 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s539723858 | p00425 | u116501200 | 1480680858 | Python | Python3 | py | Runtime Error | 0 | 0 | 664 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s875216741 | p00425 | u116501200 | 1480681132 | Python | Python3 | py | Runtime Error | 0 | 0 | 653 | def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice[1] = dice[1],7-dice[2]
def main():
dice = [1,2,3]#to... |
s833604015 | p00425 | u116501200 | 1480681343 | Python | Python3 | py | Runtime Error | 0 | 0 | 724 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s747974103 | p00425 | u116501200 | 1480681382 | Python | Python3 | py | Runtime Error | 0 | 0 | 676 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s860622806 | p00425 | u116501200 | 1480681387 | Python | Python | py | Runtime Error | 0 | 0 | 676 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s837049243 | p00425 | u116501200 | 1480682006 | Python | Python3 | py | Runtime Error | 0 | 0 | 661 | def North(dice):
dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],dice... |
s121906055 | p00425 | u116501200 | 1480682032 | Python | Python3 | py | Runtime Error | 0 | 0 | 663 | def North(dice):
??????dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice):
dice[2],di... |
s807067986 | p00425 | u116501200 | 1480682093 | Python | Python3 | py | Runtime Error | 0 | 0 | 680 | # coding: UTF-8
def North(dice):
??????dice[0],dice[1] = dice[1],7-dice[0]
def East(dice):
dice[2],dice[0] = dice[0],7-dice[2]
def West(dice):
dice[0],dice[2] = dice[2],7-dice[0]
def South(dice):
dice[1],dice[0] = dice[0],7-dice[1]
def Right(dice):
dice[1],dice[2] = dice[2],7-dice[1]
def Left(dice... |
s686521996 | p00425 | u252368621 | 1481286407 | Python | Python3 | py | Runtime Error | 0 | 0 | 1112 | class Dice:
def __init__(self):
self.omote=1
self.sita=2
self.migi=3
self.ue=4
self.hidari=5
self.ura=6
def North(self):
self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura
def East(self):
self.omote,self.hidari,self.u... |
s586912671 | p00425 | u252368621 | 1481287132 | Python | Python3 | py | Runtime Error | 0 | 0 | 1112 | class Dice:
def __init__(self):
self.omote=1
self.sita=2
self.migi=3
self.ue=5
self.hidari=4
self.ura=6
def North(self):
self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura
def East(self):
self.omote,self.hidari,self.u... |
s772886870 | p00425 | u252368621 | 1481287258 | Python | Python3 | py | Runtime Error | 0 | 0 | 1128 | import sys
class Dice:
def __init__(self):
self.omote=1
self.sita=2
self.migi=3
self.ue=5
self.hidari=4
self.ura=6
def North(self):
self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura
def East(self):
self.omote,self.hi... |
s932157776 | p00425 | u252368621 | 1481287327 | Python | Python3 | py | Runtime Error | 0 | 0 | 1099 | class Dice:
def __init__(self):
self.omote=1
self.sita=2
self.migi=3
self.ue=5
self.hidari=4
self.ura=6
def North(self):
self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura
def East(self):
self.omote,self.hidari,self.u... |
s117501960 | p00425 | u821897729 | 1488531004 | Python | Python | py | Runtime Error | 0 | 0 | 1693 | import sys
top = 1
north = 5
south = 2
west = 4
east = 3
back = 6
score = 1
def to_right():
global top, north, south, west, east, back
tmp = north
north = west
west = south
south = east
east = tmp
return top
def to_left():
global top, north, south, west, east, back
tmp = north
... |
s933538484 | p00425 | u846136461 | 1514045084 | Python | Python | py | Runtime Error | 0 | 0 | 1795 | def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_dice[1] = dice[1]
new_dice[2] = dice[0]
new_dice[... |
s424508299 | p00425 | u467129921 | 1514046768 | Python | Python3 | py | Runtime Error | 0 | 0 | 1802 | # coding: utf-8
def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_dice[1] = dice[1]
new_dice[2] = d... |
s819179091 | p00425 | u467129921 | 1514047406 | Python | Python3 | py | Runtime Error | 0 | 0 | 1802 | # coding: utf-8
def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_dice[1] = dice[1]
new_dice[2] = d... |
s101881582 | p00425 | u467129921 | 1514047614 | Python | Python3 | py | Runtime Error | 0 | 0 | 1751 | def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_dice[1] = dice[1]
new_dice[2] = dice[0]
new_dice[... |
s221924287 | p00425 | u467129921 | 1514049060 | Python | Python | py | Runtime Error | 0 | 0 | 2210 | # coding: utf-8
def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_d... |
s518998131 | p00425 | u467129921 | 1514049093 | Python | Python | py | Runtime Error | 0 | 0 | 2154 | # coding: utf-8
def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_d... |
s429492371 | p00425 | u467129921 | 1514049172 | Python | Python | py | Runtime Error | 0 | 0 | 2078 | import sys
# coding: utf-8
def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[... |
s224520054 | p00425 | u467129921 | 1514050589 | Python | Python | py | Runtime Error | 0 | 0 | 558 | while 1:
T,U,N,E,W,S=1,6,5,3,4,2
n=int(raw_input())
if n==0: break
ans=T
for i in range(n):
di=raw_input()
if di=="North":
N,T,S,U=T,S,U,N
elif di=="East":
E,U,W,T=T,E,U,W
elif di=="South":
T,S,U,N=N,T,S,U
elif di=="West":
... |
s882547625 | p00425 | u467129921 | 1514050608 | Python | Python | py | Runtime Error | 0 | 0 | 581 | #!/usr/bin/env python
while 1:
T,U,N,E,W,S=1,6,5,3,4,2
n=int(raw_input())
if n==0: break
ans=T
for i in range(n):
di=raw_input()
if di=="North":
N,T,S,U=T,S,U,N
elif di=="East":
E,U,W,T=T,E,U,W
elif di=="South":
T,S,U,N=N,T,S,U
... |
s590841029 | p00425 | u467129921 | 1514050917 | Python | Python | py | Runtime Error | 0 | 0 | 1785 | def North(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[3]
new_dice[1] = dice[0]
new_dice[2] = dice[2]
new_dice[3] = dice[5]
new_dice[4] = dice[4]
new_dice[5] = dice[1]
return new_dice
def East(dice):
new_dice = [0,0,0,0,0,0]
new_dice[0] = dice[4]
new_dice[1] = dice[1]
new_dice[2] = dice[0]
new_dice[... |
s822926374 | p00425 | u467129921 | 1514051870 | Python | Python | py | Runtime Error | 0 | 0 | 750 | while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=int(raw_input())
????????if n==0: break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
????????????... |
s932430355 | p00425 | u467129921 | 1514051879 | Python | Python | py | Runtime Error | 0 | 0 | 642 | while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=int(raw_input())
????????if n==0: break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
????????????... |
s106206025 | p00425 | u467129921 | 1514051889 | Python | Python | py | Runtime Error | 0 | 0 | 633 | while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=input()
????????if n==0: break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
????????????????elif ... |
s980603468 | p00425 | u467129921 | 1514051912 | Python | Python | py | Runtime Error | 0 | 0 | 641 | while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=input()
????????if n==0:
break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
?????????????... |
s263192880 | p00425 | u467129921 | 1514051939 | Python | Python | py | Runtime Error | 0 | 0 | 642 | while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=input()
????????if n==0:
break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
?????????????... |
s009525028 | p00425 | u546285759 | 1515818565 | Python | Python3 | py | Runtime Error | 0 | 0 | 500 | operation = {"North": (1, 5, 2, 3, 0, 4),
"East": (3, 1, 0, 5, 4, 2),
"West": (2, 1, 5, 0, 4, 3),
"South": (4, 0, 2, 3, 5, 1),
"Right": (0, 2, 4, 1, 3, 5),
"Left": (0, 3, 1, 4, 2, 5)}
while True:
n = int(input())
if n == 0:
break
dice... |
s646865519 | p00425 | u150984829 | 1517043689 | Python | Python3 | py | Runtime Error | 0 | 0 | 245 | import sys
s=sys.stdin
while 1:
n=int(s.readline())
if n==0:break
a=1;s='123456'
for _ in[0]*n:
s=[s[int(e)]for e in{'N':"152304",'E':"310542",'W':"215043",'S':"402351",'R':"024135",'L':"031425"}[s.readline()[0]]]
a+=int(s[0])
print(a)
|
s150796175 | p00425 | u847467233 | 1530255532 | Python | Python3 | py | Runtime Error | 0 | 0 | 497 | # AOJ 0502: Dice
# Python3 2018.6.29 bal4u
dir = { "North":1, "East":2, "West":3, "South":4, "Right":5, "Left":6 }
rot = ((0,1,2,3,4,5,6),(0,2,6,3,4,1,5),(0,4,2,1,6,5,3),(0,3,2,6,1,5,4), \
(0,5,1,3,4,6,2),(0,1,3,5,2,4,6),(0,1,4,2,5,3,6))
while True:
n = int(input())
if n == 0: break
dice = [[i for i in ran... |
s066089365 | p00425 | u847467233 | 1530262814 | Python | Python3 | py | Runtime Error | 0 | 0 | 493 | # AOJ 0502: Dice
# Python3 2018.6.29 bal4u
d = { "North":1, "East":2, "West":3, "South":4, "Right":5, "Left":6 }
rot = ((0,1,2,3,4,5,6),(0,2,6,3,4,1,5),(0,4,2,1,6,5,3),(0,3,2,6,1,5,4), \
(0,5,1,3,4,6,2),(0,1,3,5,2,4,6),(0,1,4,2,5,3,6))
while True:
n = int(input())
if n == 0: break
dice = [[i for i in range... |
s453745787 | p00426 | u260980560 | 1540943893 | Python | Python3 | py | Runtime Error | 0 | 0 | 1049 | def dfs(A, B, C, x):
key = tuple(A+[0]+B+[0]+C)
if key in memo or M < x:
return
memo[key] = x
if A:
if not B or B[-1] < A[-1]:
B.append(A.pop())
dfs(A, B, C, x+1)
A.append(B.pop())
if B:
if not A or A[-1] < B[-1]:
A.append(B.pop... |
s595190642 | p00426 | u260980560 | 1540943934 | Python | Python3 | py | Runtime Error | 0 | 0 | 1089 | import sys
sys.setrecursionlimit(10**8)
def dfs(A, B, C, x):
key = tuple(A+[0]+B+[0]+C)
if key in memo or M < x:
return
memo[key] = x
if A:
if not B or B[-1] < A[-1]:
B.append(A.pop())
dfs(A, B, C, x+1)
A.append(B.pop())
if B:
if not A or A... |
s448199735 | p00426 | u931670212 | 1425385409 | Python | Python3 | py | Runtime Error | 0 | 0 | 709 | import itertools
R, C = map(int, raw_input().split())
a = []
for i in range(R):
a.append(map(int, raw_input().split()))
ans = 0
for pat in itertools.product((0, 1), repeat = R):
rev = [[c^p for c in row]
for (row, p) in zip(a, pat)]
cols = zip(*rev)
zeros = [c.count(0) for c in cols]
po... |
s467093893 | p00427 | u847467233 | 1530393961 | Python | Python3 | py | Runtime Error | 0 | 0 | 517 | # AOJ 0504: Card Game II
# Python3 2018.7.1 bal4u
def calc(b, n):
a = 1
for i in range(n+1):
if a >= b:
d[i] += a//b
a %= b
if a == 0: break
a *= 10
ans = ['0']*10005
while True:
n, k, m, r = map(int, input().split())
if n == 0: break
r += 6
d = [0]*10005
calc(n, r)
if m == 1:
for i in range(1, ... |
s024791529 | p00428 | u150414576 | 1409322779 | Python | Python | py | Runtime Error | 0 | 0 | 331 | while True:
students,places = map(int,raw_input().split())
if students=0 and places~0:
break
res = dict(zip(range(places),[0]*places))
for i in range(students):
points = map(int,raw_input().split())
for j in range(places):
res[j] += points[j]
for k,v in sorted(res.items(),key=lambda x:x[1], reverse=True):... |
s386530107 | p00428 | u150414576 | 1409323190 | Python | Python | py | Runtime Error | 0 | 0 | 349 | while True:
students,places = map(int,raw_input().split())
if students == 0 and places =~ 0:
break
res = dict(zip(range(places),[0]*places))
for i in range(students):
points = map(int,raw_input().split())
for j in range(places):
res[j] += points[j]
for k,v in sorted(res.items(),key=lambda x:x[1], reverse=... |
s771536712 | p00428 | u150414576 | 1409323437 | Python | Python | py | Runtime Error | 0 | 0 | 357 | while True:
students,places = map(int,raw_input().split())
if students == 0 and places == 0:
break
res = dict(zip(range(1,places+1),[0]*places))
for i in range(students):
points = map(int,raw_input().split())
for j in range(1,places+1):
res[j] += points[j]
for k,v in sorted(res.items(),key=lambda x:x[1], ... |
s822994964 | p00428 | u110278902 | 1457190335 | Python | Python | py | Runtime Error | 0 | 0 | 482 | N, M = map(int, raw_input().split())
def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = 0
for vote in votes:
... |
s920486235 | p00428 | u110278902 | 1457190339 | Python | Python | py | Runtime Error | 0 | 0 | 482 | N, M = map(int, raw_input().split())
def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = 0
for vote in votes:
... |
s266358296 | p00428 | u110278902 | 1457190343 | Python | Python | py | Runtime Error | 0 | 0 | 482 | N, M = map(int, raw_input().split())
def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = 0
for vote in votes:
... |
s603178764 | p00428 | u110278902 | 1457190353 | Python | Python | py | Runtime Error | 0 | 0 | 482 | N, M = map(int, raw_input().split())
def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = 0
for vote in votes:
... |
s395485842 | p00428 | u110278902 | 1457190438 | Python | Python | py | Runtime Error | 0 | 0 | 508 | def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
N, M = map(int, raw_input().split())
if N ==0, M ==0: break
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = 0
... |
s084332128 | p00428 | u110278902 | 1457190736 | Python | Python | py | Runtime Error | 0 | 0 | 511 | def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
N, M = map(int, raw_input().split())
if N ==0 and M ==0: break
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = ... |
s541096659 | p00428 | u110278902 | 1457202572 | Python | Python | py | Runtime Error | 0 | 0 | 519 | def max_vote(places):
max_index = places.index(max(places))
places[max_index] = -1
return max_index + 1, places
while 1:
N, M = map(int, raw_input().split())
if N ==0 and M ==0: break
places = []
for m in range(M):
places.append(0)
for n in N:
votes = map(int, raw_input().split())
count = ... |
s995016995 | p00428 | u110278902 | 1457457647 | Python | Python | py | Runtime Error | 0 | 0 | 301 | while 1:
n, m = map(int, raw_input())
if n == 0 and m == 0:
break
places = dict(zip(range(m), [0]*m))
for i in range(n):
vote = map(int,raw_input().split())
for j in range(m):
places[j] += vote[j]
for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
print k+1
print |
s235598698 | p00428 | u110278902 | 1457457654 | Python | Python | py | Runtime Error | 0 | 0 | 301 | while 1:
n, m = map(int, raw_input())
if n == 0 and m == 0:
break
places = dict(zip(range(m), [0]*m))
for i in range(n):
vote = map(int,raw_input().split())
for j in range(m):
places[j] += vote[j]
for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
print k+1
print |
s521821349 | p00428 | u110278902 | 1457457676 | Python | Python | py | Runtime Error | 0 | 0 | 309 | while 1:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
places = dict(zip(range(m), [0]*m))
for i in range(n):
vote = map(int,raw_input().split())
for j in range(m):
places[j] += vote[j]
for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
print k+1
print |
s626581025 | p00428 | u110278902 | 1457457697 | Python | Python | py | Runtime Error | 0 | 0 | 314 | while 1:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
places = dict(zip(range(m), [0]*m))
for i in range(n):
vote = map(int,raw_input().split())
for j in range(m):
places[j] += vote[j]
for k, v sorted(places.items,key=lambda x:x[1],reverse=1):
print k+1
print |
s620099775 | p00429 | u110278902 | 1457637373 | Python | Python | py | Runtime Error | 0 | 0 | 488 | def hoge(numbers):
count = 1
answer = []
prev_number = number[0]
for i, number in enumerate(numbers):
if number == numbers[i-1] or count == 0:
count += 1
elif number != numbers[i-1]:
asnwer.append(count)
answer.append(number)
count = 0
return answer
while 1:
N = ... |
s510069027 | p00429 | u779627195 | 1352282751 | Python | Python | py | Runtime Error | 0 | 0 | 549 | while 1:
n = input()
if n == 0: break
for i in range(n):
if i == 0: ns = str(input())
else: pass
temp = ''
count = 1
for i in range(len(ns)-1):
if ns[i] == ns[i+1]:
... |
s620732319 | p00429 | u779627195 | 1352283377 | Python | Python | py | Runtime Error | 0 | 0 | 522 | while 1:
n = input()
if n == 0: break
for i in range(n):
if i == 0: ns = str(input())
temp = ''
count = 1
for i in range(len(ns)-1):
if ns[i] == ns[i+1]:
count += 1
... |
s449279557 | p00429 | u779627195 | 1352283435 | Python | Python | py | Runtime Error | 0 | 0 | 522 | while 1:
n = input()
if n == 0: break
for i in range(n):
if i == 0: ns = str(input())
temp = ''
count = 1
for i in range(len(ns)-1):
if ns[i] == ns[i+1]:
count += 1
... |
s269417610 | p00429 | u779627195 | 1352284219 | Python | Python | py | Runtime Error | 0 | 0 | 522 | while 1:
n = input()
if n == 0: break
for j in range(n):
if j == 0: ns = str(input())
temp = ''
count = 1
for i in range(len(ns)-1):
if ns[i] == ns[i+1]:
count += 1
... |
s645736608 | p00429 | u915761101 | 1352285496 | Python | Python | py | Runtime Error | 0 | 0 | 536 | while 1:
n = input()
if n == 0: break
ns=""
for i in range(n):
if i == 0: ns = str(input())
temp = ''
count = 1
for j in range(len(ns)-1):
if ns[j] == ns[j+1]:
count +=... |
s966271504 | p00429 | u912573907 | 1375183587 | Python | Python | py | Runtime Error | 0 | 0 | 403 | def foo(n):
ret = ""
n = str(n)
cnt = 1
for i in range(1, len(n)):
if n[i - 1] == n[i]:
cnt += 1
continue
else:
ret += str(cnt) + n[i - 1]
cnt = 1
ret += str(cnt) + n[-1]
return long(ret)
while 1:
n = input()
if n == 0:
... |
s443446999 | p00429 | u604412493 | 1378273015 | Python | Python | py | Runtime Error | 0 | 0 | 532 | import sys
fp = open("input.txt", "r")
#fp = sys.stdin
def operate(string):
count = 1
prev = string[0]
ret = ""
for c in string[1:]:
if c == prev:
count += 1
else:
ret += str(count) + prev
count = 1
prev = c
ret += str(count) + prev
#... |
s164714359 | p00430 | u811434779 | 1440041558 | Python | Python | py | Runtime Error | 0 | 0 | 388 | l = [0 for i in range(20)]
pos = goal = 0
def solve(cur,sum):
global pos, goal
if cur == goal:
print " ".join(map(str,l[:pos]))
return
for i in range(sum,0,-1):
if cur + i <= goal:
l[pos] = i
pos += 1
solve(cur+i,i)
pos -= 1
while True:... |
s153760963 | p00430 | u110278902 | 1459278265 | Python | Python | py | Runtime Error | 0 | 0 | 468 | while(1):
l = []
input = int(raw_input())
if input == 0:
break
print input
number = [input - 1, 1]
for n in len(number):
print n,
print
while(1):
if number[1] == 2:
l[0] = number[0] - 1
for i in len(number):
l.append[1]
elif number[1] == 1:
l[0] = number[0] - 1... |
s793863469 | p00430 | u110278902 | 1459278293 | Python | Python | py | Runtime Error | 0 | 0 | 459 | while(1):
l = []
input = input()
if input == 0:
break
print input
number = [input - 1, 1]
for n in len(number):
print n,
print
while(1):
if number[1] == 2:
l[0] = number[0] - 1
for i in len(number):
l.append[1]
elif number[1] == 1:
l[0] = number[0] - 1
l[... |
s972006551 | p00430 | u110278902 | 1460020720 | Python | Python | py | Runtime Error | 0 | 0 | 234 | input = [input()]
if input[0] == 0:
break
while input[0] != 1:
if input[1] == 1:
input[0] -= 1
input[0] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print e,
print |
s277114064 | p00430 | u110278902 | 1460021530 | Python | Python | py | Runtime Error | 0 | 0 | 256 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1:
input[0] -= 1
input[0] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print e,
print |
s400511026 | p00430 | u110278902 | 1460021594 | Python | Python | py | Runtime Error | 0 | 0 | 273 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1 or input[2] == 0:
input[0] -= 1
input[0] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print e,
print |
s415631541 | p00430 | u110278902 | 1460021646 | Python | Python | py | Runtime Error | 0 | 0 | 273 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1 or input[1] == 0:
input[0] -= 1
input[0] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print e,
print |
s758110694 | p00430 | u110278902 | 1460021720 | Python | Python | py | Runtime Error | 0 | 0 | 280 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1 or input[1] == 0:
input[0] -= 1
input[0] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print input[e],
print |
s171179928 | p00430 | u110278902 | 1460021739 | Python | Python | py | Runtime Error | 0 | 0 | 280 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1 or input[1] == 0:
input[0] -= 1
input[1] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print input[e],
print |
s219542328 | p00430 | u110278902 | 1460022387 | Python | Python | py | Runtime Error | 0 | 0 | 283 | input = input()
print input
if input == 0:
break
input = [5, 0]
while input[0] != 1:
if input[1] == 1 or input[1] == 0:
input[0] -= 1
input[1] += 1
elif input[1] == 2:
input[1] -= 1
input.append(1)
for e in range(0, len(input)):
print input[e],
print '' |
s867781232 | p00430 | u110278902 | 1460023477 | Python | Python | py | Runtime Error | 0 | 0 | 265 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
print n[e],
print '' |
s477032911 | p00430 | u110278902 | 1460023977 | Python | Python | py | Runtime Error | 0 | 0 | 332 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
print n[e],
print ''
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
... |
s432872779 | p00430 | u110278902 | 1460024021 | Python | Python | py | Runtime Error | 0 | 0 | 336 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
print n[e],
print ''
n[1] -= 1
input.append(1)
for e in range(0, len(n)... |
s384853702 | p00430 | u110278902 | 1460024289 | Python | Python | py | Runtime Error | 0 | 0 | 376 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1:
if n[0] == 2 and n[1] == 1:
break
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
print n[e],
print ''
n[1] -= 1
... |
s289886791 | p00430 | u110278902 | 1460024330 | Python | Python | py | Runtime Error | 0 | 0 | 378 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1:
if n[0] == 2 and n[1] == 1:
break
elif n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
for e in range(0, len(n)):
print n[e],
print ''
n[1] -= ... |
s621626836 | p00430 | u110278902 | 1460024685 | Python | Python | py | Runtime Error | 0 | 0 | 381 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1 and n[0] >= n[1]:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
if n[0] < n[1]:
break
for e in range(0, len(n)):
print n[e],
print ''
n[0] ... |
s386789799 | p00430 | u110278902 | 1460024707 | Python | Python | py | Runtime Error | 0 | 0 | 377 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1 and n[0] >= n[1]:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
input.append(1)
if n[0] < n[1]:
break
for e in range(0, len(n)):
print n[e],
print ''
n[0] ... |
s186168298 | p00430 | u110278902 | 1460024730 | Python | Python | py | Runtime Error | 0 | 0 | 373 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1 and n[0] >= n[1]:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
n.append(1)
if n[0] < n[1]:
break
for e in range(0, len(n)):
print n[e],
print ''
n[0] -= 1... |
s585448807 | p00430 | u110278902 | 1460024902 | Python | Python | py | Runtime Error | 0 | 0 | 373 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1 and n[0] >= n[1]:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
n.append(1)
if n[0] < n[1]:
break
for e in range(0, len(n)):
print n[e],
print ''
n[1] -= 1... |
s493647522 | p00430 | u110278902 | 1460025924 | Python | Python | py | Runtime Error | 0 | 0 | 383 | input = input()
print input
if input == 0:
break
n = [input, 0]
while n[0] > 1 and n[0] <= input + 1 and n[0] >= n[1]:
if n[1] == 1 or n[1] == 0:
n[0] -= 1
n[1] += 1
elif n[1] == 2:
n[1] -= 1
n.append(1)
if n[0] < n[1]:
break
for e in range(0, len(n)):
print str(n[e]),
print ''
n[1]... |
s424678967 | p00430 | u662488567 | 1480400147 | Python | Python3 | py | Runtime Error | 0 | 0 | 1115 | def generate_square(rest, output=[10000]):
for i in range(rest, 0, -1):
if output[-1] >= i:
yield from generate_square(rest - i, output + [i])
if rest == 0:
yield ... |
s899752375 | p00431 | u797673668 | 1453740341 | Python | Python3 | py | Runtime Error | 40000 | 22612 | 1162 | from itertools import combinations
def connect(history, last):
global links, chains
branched = False
for ring in links[last]:
if ring in history:
continue
history.append(ring)
connect(history, ring)
history.pop()
branched = True
if not branched:
... |
s019581813 | p00431 | u797673668 | 1453740897 | Python | Python3 | py | Runtime Error | 40000 | 285596 | 852 | def connect(history, last):
global links, chains
branched = False
for ring in links[last]:
if ring in history:
continue
history.append(ring)
connect(history, ring)
history.pop()
branched = True
if not branched:
chains.append(set(history))
whi... |
s327677317 | p00431 | u797673668 | 1453742478 | Python | Python3 | py | Runtime Error | 40000 | 7764 | 765 | def connect(history, last):
global links, max_length
branched = False
for ring in links[last]:
if ring in history:
continue
history.append(ring)
connect(history, ring)
history.pop()
branched = True
if not branched:
max_length = max(max_length, ... |
s988940047 | p00431 | u797673668 | 1453747039 | Python | Python3 | py | Runtime Error | 40000 | 7792 | 571 | def connect(last):
global links, used
used[last] = 1
result = max([connect(ring) + 1 for ring in links[last] if not used[ring]], default=0)
used[last] = 0
return result
used = [0] * 101
while True:
n = int(input())
if not n:
break
links = [set() for i in range(101)]
for _... |
s636525024 | p00431 | u797673668 | 1477031752 | Python | Python3 | py | Runtime Error | 0 | 0 | 583 | from queue import deque
def longest(i):
visited = (i,)
q = deque((r, visited) for r in links[i])
while q:
ring, visited = q.popleft()
for r in links[ring]:
if r not in visited:
q.append((r, visited + (ring,)))
return len(visited) + 1
while True:
n = in... |
s858005551 | p00431 | u662488567 | 1480409136 | Python | Python3 | py | Runtime Error | 40000 | 8060 | 4919 | from collections import defaultdict
class GraphChain(): ... |
s061147680 | p00431 | u662488567 | 1480409352 | Python | Python3 | py | Runtime Error | 40000 | 8016 | 4919 | from collections import defaultdict
class GraphChain(): ... |
s592210287 | p00431 | u662488567 | 1480409417 | Python | Python3 | py | Runtime Error | 40000 | 8012 | 1450 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
... |
s637887871 | p00431 | u662488567 | 1480409469 | Python | Python3 | py | Runtime Error | 40000 | 8012 | 1454 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
... |
s334490572 | p00431 | u662488567 | 1480409597 | Python | Python3 | py | Runtime Error | 40000 | 7996 | 1415 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
... |
s614826636 | p00431 | u662488567 | 1480409785 | Python | Python3 | py | Runtime Error | 40000 | 8016 | 1482 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
... |
s719843726 | p00431 | u662488567 | 1480409909 | Python | Python3 | py | Runtime Error | 40000 | 7992 | 1503 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
... |
s571500055 | p00431 | u662488567 | 1480410491 | Python | Python3 | py | Runtime Error | 40000 | 7944 | 1397 | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for point in self.graph[left]:
if se... |
s351836967 | p00431 | u072053884 | 1521425894 | Python | Python3 | py | Runtime Error | 0 | 0 | 986 | def solve():
def dfs(start):
unvisited = [True] * (n + 1)
queue = [(start, 1)]
max_chain_len = 1
while queue:
ring, chain_len = queue.pop()
if unvisited[ring]:
unvisited[ring] = False
max_chain_len = max(max_chain_len, chain_len... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.