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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s408375639 | p00431 | u599161451 | 1360392663 | Python | Python | py | Runtime Error | 19930 | 4296 | 1026 | def foo(nw, visited):
last = visited[-1]
r = 0
for k in nw[last]:
if k not in visited:
v = foo(nw, visited + (k,))
else:
v = len(visited)
if r < v:
r = v
return r
def findlongetstpath(nw):
return max([foo(nw, (k,)) for k in nw.keys()])
... |
s300252241 | p00431 | u599161451 | 1360392856 | Python | Python | py | Runtime Error | 19930 | 4296 | 1042 | #!/usr/bin/python
def foo(nw, visited):
last = visited[-1]
r = 0
for k in nw[last]:
if k not in visited:
v = foo(nw, visited + (k,))
else:
v = len(visited)
if r < v:
r = v
return r
def findlongetstpath(nw):
return max([foo(nw, (k,)) for k... |
s803655381 | p00431 | u604412493 | 1378276626 | Python | Python | py | Runtime Error | 0 | 0 | 922 | import sys
from copy import deepcopy
#fp = open("input.txt", "r")
fp = sys.stdin
def countLength(chain, start, prev):
node = chain[start][:]
if not node:
return 0
chain[start] = []
max_len = 0
for i in node:
if i == prev:
continue
cloned = deepcopy(chain)
... |
s614180489 | p00431 | u604412493 | 1378276722 | Python | Python | py | Runtime Error | 0 | 0 | 942 | import sys
#fp = open("input.txt", "r")
fp = sys.stdin
def deepcopy(li):
return [i for i in li]
def countLength(chain, start, prev):
node = chain[start][:]
if not node:
return 0
chain[start] = []
max_len = 0
for i in node:
if i == prev:
continue
cloned = de... |
s461681137 | p00431 | u604412493 | 1378276924 | Python | Python | py | Runtime Error | 0 | 0 | 945 | import sys
#fp = open("input.txt", "r")
fp = sys.stdin
def deepcopy(li):
return [i for i in li]
def countLength(chain, start, prev):
node = chain[start][:]
if not node:
return 0
chain[start] = []
max_len = 0
for i in node:
if i == prev:
continue
cloned = de... |
s513184950 | p00431 | u604412493 | 1378277008 | Python | Python | py | Runtime Error | 0 | 0 | 342 | import sys
#fp = open("input.txt", "r")
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
chain = [[] for i in xrange(n)]
for i in xrange(n):
string = map(int , fp.readline()[:-1].split(" "))
chain[string[0]-1].append(string[1]-1)
chain[string[1]-... |
s662529535 | p00431 | u604412493 | 1378277231 | Python | Python | py | Runtime Error | 0 | 0 | 330 | import sys
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
chain = [[] for i in xrange(n)]
for i in xrange(n):
string = map(int , fp.readline()[:-1].split(" "))
chain[string[0]-1].append(string[1]-1)
chain[string[1]-1].append(string[0]-1)
pr... |
s103399316 | p00431 | u604412493 | 1378277277 | Python | Python | py | Runtime Error | 0 | 0 | 304 | import sys
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
cha = [[] for i in xrange(n)]
for i in xrange(n):
st = map(int , fp.readline()[:-1].split(" "))
cha[st[0]-1].append(st[1]-1)
cha[st[1]-1].append(st[0]-1)
print 'hoge' |
s822001992 | p00431 | u604412493 | 1378277341 | Python | Python | py | Runtime Error | 0 | 0 | 317 | import sys
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
hoge = [[] for i in xrange(n)]
for i in xrange(n):
fuga = map(int , fp.readline()[:-1].split(" "))
hoge[fuga[0]-1].append(fuga[1]-1)
hoge[fuga[1]-1].append(fuga[0]-1)
print 'hoge' |
s872762646 | p00431 | u604412493 | 1378277428 | Python | Python | py | Runtime Error | 0 | 0 | 357 | import sys
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
chain = []
for i in xrange(n):
chain.append([])
for i in xrange(n):
string = map(int , fp.readline()[:-1].split(" "))
chain[string[0]-1].append(string[1]-1)
chain[string[1]-1]... |
s968647875 | p00432 | u352394527 | 1531143083 | Python | Python3 | py | Runtime Error | 0 | 0 | 1184 | def main():
while True:
n, r = map(int, input().split())
if n == 0:
break
plst = []
minx = miny = 20000
maxx = maxy = 0
for _ in range(n):
x1, y1, x2, y2 = map(int, input().split())
minx = min(minx, x1)
miny = min(miny, y1)
maxx = max(maxx, x2)
maxy = max(ma... |
s354496116 | p00432 | u898097781 | 1467373196 | Python | Python | py | Runtime Error | 0 | 0 | 495 | import numpy as np
import csv
area = np.zeros([10002,10002])
fw = open('output.txt', 'w')
with open('input.txt') as f:
data = [line for line in csv.reader(f, delimiter=' ')]
n, r = data[0]
for i in range(1, n+1):
area[data[i][0]:data[i][2]+1,data[i][1]:data[i][3]+1] = 1
menseki = len(np.nonzero(area)[0])
fw.writ... |
s096748458 | p00432 | u898097781 | 1467373564 | Python | Python | py | Runtime Error | 0 | 0 | 467 | import numpy as np
import csv
area = np.zeros([10002,10002])
while (line=raw_input()):
n, r = map(int, line.split(' '))
for i in xrange(n):
line = raw_input()
data = map(int, line.split(' '))
area[data[0]:data[2]+1,data[1]:data[3]+1] = 1
menseki = len(np.nonzero(area)[0])
print '{}\n'.format(menseki)
... |
s087314575 | p00432 | u898097781 | 1467374317 | Python | Python | py | Runtime Error | 0 | 0 | 634 | import numpy as np
import csv
while 1:
line=raw_input()
n, r = map(int, line.split(' '))
if n == 0:
break
data = []
for i in xrange(n):
line = raw_input()
data.append(map(int, line.split(' ')))
data = np.array(data)
X = np.max(data[:,2])
Y = np.max(data[:,3])
area = np.zeros([X,Y])
for d in da... |
s853372972 | p00432 | u898097781 | 1467374393 | Python | Python | py | Runtime Error | 0 | 0 | 742 | import numpy as np
import csv
while 1:
line=raw_input()
n, r = map(int, line.split(' '))
if n == 0:
break
data = []
for i in xrange(n):
line = raw_input()
data.append(map(int, line.split(' ')))
data = np.array(data)
X = np.max(data[:,2])
Y = np.max(dat... |
s330907972 | p00432 | u898097781 | 1467374515 | Python | Python | py | Runtime Error | 0 | 0 | 738 | import numpy as np
import csv
while 1:
line=raw_input()
n, r = map(int, line.split(' '))
if n == 0:
break
data = []
for i in xrange(n):
line = raw_input()
data.append(map(int, line.split(' ')))
data = np.array(data)
X = np.max(data[:,2])
Y = np.max(dat... |
s125920835 | p00432 | u898097781 | 1467374652 | Python | Python | py | Runtime Error | 0 | 0 | 749 | import numpy as np
import csv
while 1:
line=raw_input()
n, r = map(int, line.split(' '))
if n == 0 and r == 0:
break
data = []
for i in xrange(n):
line = raw_input()
data.append(map(int, line.split(' ')))
data = np.array(data)
X = np.max(data[:,2])
Y =... |
s316020388 | p00432 | u898097781 | 1467374667 | Python | Python | py | Runtime Error | 0 | 0 | 18 | import numpy as np |
s422231041 | p00432 | u898097781 | 1467376485 | Python | Python | py | Runtime Error | 0 | 0 | 911 | import numpy
import csv
while 1:
line=raw_input()
n, r = map(int, line.split(' '))
if n == 0 and r == 0:
break
data = []
for i in xrange(n):
line = raw_input()
data.append(map(int, line.split(' ')))
X = max(map(lambda x:x[2],data))
Y = max(map(lambda x:x[3],data))
area = [[0 for x in xrange(X+2)] ... |
s791075335 | p00432 | u898097781 | 1467376645 | Python | Python | py | Runtime Error | 0 | 0 | 19 | from numpy import * |
s486957006 | p00432 | u662488567 | 1480422275 | Python | Python3 | py | Runtime Error | 0 | 0 | 1790 |
from itertools import chain
with 0 as efafe:
max_size = 10002
while 1:
n, r = (int(i) for i in input().strip().split())
if n == r == 0:
break
flag = False if r == 2 else True
sheets = dict()
max_size = 0
for i in range(n):
points = tuple(int(i) + 1 for i in input().strip().sp... |
s429466156 | p00432 | u662488567 | 1480422319 | Python | Python3 | py | Runtime Error | 0 | 0 | 1654 | max_size = 10002
while 1:
n, r = (int(i) for i in input().strip().split())
if n == r == 0:
break
flag = False if r == 2 else True
sheets = dict()
max_size = 0
for i in range(n):
points = tuple(int(i) + 1 for i in input().strip().split())
max_size = max(max_size, max(points))
sheets[points[0... |
s969199506 | p00432 | u368408684 | 1514081695 | Python | Python3 | py | Runtime Error | 0 | 0 | 3606 | class All_Column:
def __init__(self, rec_num):
self.rec_num = rec_num
self.x_stack = []
self.y_stack = [0 for i in range(10002)]
def add(self, x, up, down):
if self.y_stack[x+1] == 0:
self.x_stack.append(x)
self.y_stack[x+1] = One_Column(x, up, down)
else:
self.y_stack[x+1].add(up, down)
d... |
s359742594 | p00432 | u846136461 | 1514197262 | Python | Python | py | Runtime Error | 0 | 0 | 516 | # coding: utf-8
field = []
for i in range(99):
line = []
for j in range(99):
line.append(0)
field.append(line)
while True:
n, r = map(int, raw_input().split())
if n == 0:
break
else:
for _ in range(n):
data = map(int, raw_input().split())
x_start = data[0]
y_start = data[1]
x_end = data[2]
... |
s391148490 | p00432 | u599161451 | 1362030742 | Python | Python | py | Runtime Error | 19920 | 211212 | 1608 | #!/usr/bin/python
def readints(line):
return map(int, line.split())
def mark(d, p):
m = d.get(p, 0)
d[p] = m + 1
def chunker(f):
while True:
line = f.readline()
n, r = readints(line)
if n == 0 and r == 0:
raise StopIteration
tiles = set()
v_test = ... |
s457581368 | p00433 | u814278309 | 1559224779 | Python | Python3 | py | Runtime Error | 0 | 0 | 150 | while True:
a,b,c,d=map(int,input().split())
e,f,g,h=map(int,input().split())
x=a+b+c+d
y=e+f+g+h
if x<y:
print(y)
else:
print(x)
|
s876651820 | p00433 | u814278309 | 1559224812 | Python | Python3 | py | Runtime Error | 0 | 0 | 151 | while True:
a,b,c,d=map(int,input().split())
e,f,g,h=map(int,input().split())
x=a+b+c+d
y=e+f+g+h
if x<=y:
print(y)
else:
print(x)
|
s011850113 | p00433 | u340500592 | 1499407104 | Python | Python3 | py | Runtime Error | 0 | 0 | 98 | A = list(map(input().split())
B = list(map(input().split())
max = max([max(A), max(B)])
print(max) |
s025754458 | p00433 | u340500592 | 1499407143 | Python | Python3 | py | Runtime Error | 0 | 0 | 100 | A = list(map(input().split()))
B = list(map(input().split()))
max = max([max(A), max(B)])
print(max) |
s148029152 | p00433 | u256256172 | 1508404461 | Python | Python3 | py | Runtime Error | 0 | 0 | 80 | a = map(int, input().split())
b = map(int, input().split())
print(max(sum(a,b))) |
s031809613 | p00433 | u915761101 | 1357141530 | Python | Python | py | Runtime Error | 0 | 0 | 170 | magro = 0
saba = []
saba=map(int,raw_input().split(‘ ‘))
#print(“ika”)
ika=map(int,raw_input().split(‘ ‘))
print(max(sum(saba), sum(ika)))
neko = 0
hage = 90 |
s681868785 | p00433 | u604412493 | 1377610160 | Python | Python | py | Runtime Error | 0 | 0 | 449 | <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//$fp = fopen("input.txt", "r");
$fp = fopen("php://stdin", "r");
$str = explode(" ", rtrim(fgets($fp)));
$sum_a = 0;
for($i = 0; $i < 4; $i++) {
$sum_a += (int)($str[$i]);
}
$str = explode(" ", rtrim(fgets($... |
s399389804 | p00433 | u180584272 | 1379908308 | Python | Python | py | Runtime Error | 0 | 0 | 104 | from sys import stdin
print max(map(sum,map(lambda s: map(int,s.split(' ')), stdin.read().split('\n')))) |
s506265126 | p00433 | u229085388 | 1391313053 | Python | Python | py | Runtime Error | 0 | 0 | 125 | a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
print (max(a,b)) |
s131634179 | p00433 | u633068244 | 1395076924 | Python | Python | py | Runtime Error | 0 | 0 | 90 | s = sum(map(int, raw_input().split())
t = sum(map(int, raw_input().split())
print max(s,t) |
s915608709 | p00434 | u811773570 | 1475423262 | Python | Python3 | py | Runtime Error | 0 | 0 | 150 | a = [False for i in range(31)]
for i in range(30):
x = int(input())
a[x] = True
for i in range(1, 30):
if a[i] == False:
print(i) |
s602690473 | p00434 | u662488567 | 1480607875 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | students = list(range(30))
[students.remove(int(input())) for _ in range(28)]
[print(student) for student in students] |
s516427086 | p00434 | u147801965 | 1375165948 | Python | Python | py | Runtime Error | 0 | 0 | 98 | c=0
for i,j in enumerate(sorted([input() for i in range(30)])):
c+=1
if c!=j:print c ;c+=1 |
s157381340 | p00434 | u350508326 | 1392653129 | Python | Python | py | Runtime Error | 0 | 0 | 162 | data = [x + 1 for x in xrange(30)]
# print(data)
for i in xrange(30):
a = int(raw_input())
data.remove(a)
# print(data)
for i in data:
print(i) |
s561461607 | p00434 | u633068244 | 1395077246 | Python | Python | py | Runtime Error | 0 | 0 | 121 | ref = set[i for i in range(1,31)]
for i in range(28):
ls.append(i)
print "".join(map(str, sorted(list(ref-set(ls))))) |
s619496977 | p00434 | u633068244 | 1395077684 | Python | Python | py | Runtime Error | 0 | 0 | 108 | ref = [i for i in range(1,31)]
for i in range(28):
ref.pop(int(raw_input())-1)
for i in ref:
print i |
s079789536 | p00435 | u436259757 | 1540874948 | Python | Python3 | py | Runtime Error | 0 | 0 | 203 | x = input()
str_list = list(x)
dict_ = {
}
for a in str_list:
if ord(a) - 3 < 65:
print(chr(90 - 65 - ord(a) - 3) ,end = "")
else:
print(chr(ord(a) - 3) ,end = "")
print()
|
s400174153 | p00435 | u855694108 | 1506840483 | Python | Python3 | py | Runtime Error | 0 | 0 | 347 | def main():
d = list(input())
alp = [chr(i) for i in range(65, 65 + 26)]
for x in range(len(d)):
idx = alp.index(d[x]) - 3
if idx < 0:
idx = 26 - idx
else:
pass
d[x] = alp[idx]
ans = ""
for x in d:
ans += x
print(ans)
if __name_... |
s709109573 | p00435 | u855694108 | 1506840584 | Python | Python3 | py | Runtime Error | 0 | 0 | 347 | def main():
d = list(input())
alp = [chr(i) for i in range(65, 65 + 26)]
for x in range(len(d)):
idx = alp.index(d[x]) - 3
if idx < 0:
idx = 26 - idx
else:
pass
d[x] = alp[idx]
ans = ""
for x in d:
ans += x
print(ans)
if __name_... |
s552226413 | p00435 | u633068244 | 1397317793 | Python | Python | py | Runtime Error | 0 | 0 | 116 | dic="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
code=raw_input()
ans=""
for w in code:
ans+=dic[(dic.index(w)+24)%27]
print ans
|
s027047566 | p00436 | u545973195 | 1475153439 | Python | Python3 | py | Runtime Error | 0 | 0 | 289 | import copy
n=int(input())
m=int(input())
card=[i for i in range(2n+1)]
sub=[]
for i in range(m):
move=int(input())
if move!=0:
sub+=card[k:]
sub+=card[:k]
else:
for i in range(n+1):
sub+=card[i]
sub+=card[n+i]
card=copy.deepcopy(sub)
for i in range(2n+1):
print(card[i]) |
s042965869 | p00436 | u545973195 | 1475153619 | Python | Python3 | py | Runtime Error | 0 | 0 | 287 | import copy
n=int(input())
m=int(input())
card=[i for i in range(1,2n+1)]
sub=[]
for i in range(m):
move=int(input())
if move!=0:
sub+=card[k:]
sub+=card[:k]
else:
for j in range(n):
sub+=card[j]
sub+=card[n+j]
card=copy.deepcopy(sub)
for i in range(2n):
print(card[i]) |
s031462071 | p00436 | u545973195 | 1475153794 | Python | Python3 | py | Runtime Error | 0 | 0 | 323 | import copy
n=int(input())
m=int(input())
card=[i for i in range(1,2n+1)]
sub=[]
for i in range(m):
move=int(input())
if move!=0:
sub.append(card[k:])
sub.append(card[:k])
else:
for j in range(n):
sub.append(card[j])
sub.append(card[n+j])
card=copy.deepcopy(sub)
sub=[]
for i in range(2n):
print(card[... |
s407324175 | p00436 | u633068244 | 1395078493 | Python | Python | py | Runtime Error | 0 | 0 | 317 | n = int(raw_input())
deck = [i for i in range(1,2*n+1)]
m = int(raw_input())
for i in range(m):
k = int(raw_input())
if k == 0:
deck1 = []
for j in range(n):
deck1 += deck[i]+deck[n+i]
deck = deck1
elif:
deck = deck[k+1:]+deck[:k+1]
for i in deck:
print deck |
s624432675 | p00437 | u811434779 | 1440132709 | Python | Python | py | Runtime Error | 0 | 0 | 770 | while True:
l = map(int, raw_input().split())
if l[0]==0 and l[1]==0 and l[2]==0: break
n = l[0]+l[1]+l[2]
s = [] #????¨????
a = set(range(n)) #??????
b = set() #?£????
c = set() #??£???
for i in range(input()):
x, y, z, r = map(int, raw_input().split())
x-=1;y-=1;z-=1;
... |
s574281187 | p00437 | u811434779 | 1440133712 | Python | Python | py | Runtime Error | 0 | 0 | 786 | while True:
l = map(int, raw_input().split())
if l[0]==0 and l[1]==0 and l[2]==0: break
n = l[0]+l[1]+l[2]
s = [] #????¨????
a = set(range(n)) #??????
b = set() #?£????
c = set() #??£???
for i in range(input()):
x, y, z, r = map(int, raw_input().split())
x-=1;y-=1;z-=1;
... |
s285244364 | p00437 | u797673668 | 1477043063 | Python | Python3 | py | Runtime Error | 0 | 0 | 652 | while True:
m = sum(map(int, input().split()))
n = int(input())
fixed = [2] * m
failures = []
for _ in range(n):
i, j, k, r = map(int, input().split())
i, j, k = (x - 1 for x in (i, j, k))
if r:
fixed[i] = fixed[j] = fixed[k] = 1
else:
failures... |
s027212428 | p00438 | u835866094 | 1412110722 | Python | Python | py | Runtime Error | 0 | 0 | 1221 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#t
field = [int(n) for n in line.split()]
# *&
num = int(sys.stdin.readline())
data... |
s550345253 | p00438 | u835866094 | 1412139640 | Python | Python | py | Runtime Error | 0 | 0 | 1231 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#t
field = [int(n) for n in line.split()]
# *&
num = int(sys.stdin.readline())
... |
s697916746 | p00438 | u835866094 | 1412410078 | Python | Python | py | Runtime Error | 0 | 0 | 1231 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#t
field = [int(n) for n in line.split()]
# *&
num = int(sys.stdin.readline())
... |
s267288604 | p00438 | u260980560 | 1385397377 | Python | Python | py | Runtime Error | 0 | 0 | 490 | p = [[0 for i in xrange(16)] for j in xrange(16)]
while 1:
a,b = map(int, raw_input().split())
if a==b==0: break
n = input()
for i in xrange(b):
for j in xrange(a):
p[i][j] = 0
for i in xrange(n):
x,y = map(int, raw_input().split())
p[y-1][x-1] = -10**6
p[0][0... |
s563912364 | p00439 | u921038488 | 1555836116 | Python | Python3 | py | Runtime Error | 0 | 0 | 386 | from itertools import accumulate
# 区間[N-k, N) の総和の最大値
while True:
n, k = map(int, input().split(" "))
if n == 0:
break
a_n = [int(input()) for _ in range(n)]
_ = input()
a_n = list(accumulate(a_n))
# print(a_n)
result = -99999999999999
for i in range(n-k):
val = a_n[k+i] - a_n[i]
if res... |
s036247740 | p00439 | u921038488 | 1555836180 | Python | Python3 | py | Runtime Error | 0 | 0 | 383 | from itertools import accumulate
# 区間[N-k, N) の総和の最大値
while True:
n, k = map(int, input().split())
if n == 0:
break
a_n = [int(input()) for _ in range(n)]
_ = input()
a_n = list(accumulate(a_n))
# print(a_n)
result = -99999999999999
for i in range(n-k):
val = a_n[k+i] - a_n[i]
if result... |
s801955022 | p00439 | u094029895 | 1555857974 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | n = int(input())
k = int(input())
l = list(map(int, input().split()))
L=[]
for i in range(n):
if(i == 0):
L.append(0)
L.append(l[i])
else:
L.append(L[i]+l[i])
ans=0
for i in range(n-k+1):
tmp = L[i+k] - L[i]
ans = max(ans, tmp)
print(ans)
|
s413887028 | p00439 | u060839454 | 1556534261 | Python | Python | py | Runtime Error | 0 | 0 | 351 | while True:
a, b = map(int, input().split(" "))
if a == 0 & b == 0:
break
li1 = []
for i in range(0, a):
li1.append(int(input()))
max = 0
for n in range(0, a + 1 - b):
sum = 0
for n1 in range(n, n + b):
sum = sum + li1[n1]
if max < sum:
... |
s516223765 | p00439 | u134812425 | 1559175670 | Python | Python3 | py | Runtime Error | 0 | 0 | 1417 | #!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile
def read(
*shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
def read_word():
w = lambda c: c in whitespaces
nw = lambda c: c not in whitespaces
return ... |
s527754153 | p00439 | u476702877 | 1559176787 | Python | Python3 | py | Runtime Error | 0 | 0 | 354 | def func(n,k):
A = []
ans = 0
for i in range(n):
A.append(int(input()))
for i in range(k-1):
SUM += A[i]
for i in range(k,len(a)):
ans = max(ans,SUM+a[i]-a[i-k])
print(ans)
for i in range(100):
n,k = [int(s) for s in input().split()]
if n == 0 and k ==0:
... |
s456141895 | p00439 | u476702877 | 1559176911 | Python | Python3 | py | Runtime Error | 0 | 0 | 366 | def func(n,k):
A = []
ans = 0
SUM = 0
for i in range(n):
A.append(int(input()))
for i in range(k-1):
SUM += A[i]
for i in range(k,len(a)):
ans = max(ans,SUM+a[i]-a[i-k])
print(ans)
for i in range(100):
n,k = [int(s) for s in input().split()]
if n == 0 and k =... |
s934489431 | p00439 | u476702877 | 1559177387 | Python | Python3 | py | Runtime Error | 0 | 0 | 342 | def func(n,k):
SUM = 0
A = [int(input()) for _ in range(n)]
for i in range(k-1):
SUM += A[i]
ans = SUM
for i in range(k,len(A)):
ans = max(ans,SUM+A[i]-A[i-k])
print(ans)
for _ in range(10)
n,k = [int(s) for s in input().split()]
if n == 0 and k ==0:
break
el... |
s221122542 | p00439 | u476702877 | 1559177468 | Python | Python3 | py | Runtime Error | 0 | 0 | 370 | def func(n,k):
SUM = 0
ans = 0
A = [int(input()) for _ in range(n)]
for i in range(k-1):
SUM += A[i]
for i in range(k,len(A)):
ans = max(ans,SUM+A[i]-A[i-k])
SUM = SUM+A[i]-A[i-k]
print(ans)
for _ in range(10)
n,k = [int(s) for s in input().split()]
if n == 0 and... |
s248963734 | p00439 | u662488567 | 1480610577 | Python | Python3 | py | Runtime Error | 0 | 0 | 689 | while 1:
n, k = (int(x) for x in input().split())
if n == 0:
break
max_num = -30001
queue = list()
for _ in range(k): ... |
s642077639 | p00439 | u662488567 | 1480610636 | Python | Python3 | py | Runtime Error | 0 | 0 | 689 | while 1:
n, k = (int(x) for x in input().split())
if n == 0:
break
max_num = -30001
queue = list()
for _ in range(k): ... |
s281521384 | p00439 | u563075864 | 1526220375 | Python | Python3 | py | Runtime Error | 0 | 0 | 296 | while 1:
n,k = [int(i) for i in input().split()]
if not n and k:
break
a = [int(input()) for i in range(n)]
b = [0]*len(a)
for i in range(n):
b[i] = b[i-1] + a[i]
b = b + [0]
c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)]
print(max(c))
|
s607792502 | p00439 | u104911888 | 1367649853 | Python | Python | py | Runtime Error | 0 | 0 | 309 | #include <stdio.h>
int main(){
int i,n,k,s;
while (1){
int ma=0;
scanf("%d %d",&n,&k);
if (n==0 && k==0)break;
int a[n];
for (i=0;i<n;i++)
scanf("%d",&a[i]);
for (i=0;i<n-2;i++){
s=a[i]+a[i+1]+a[i+2];
if (s>ma) ma=s;
}
printf("%d\n",ma);
}
return 0;
} |
s162002008 | p00439 | u238820099 | 1386399073 | Python | Python | py | Runtime Error | 0 | 0 | 232 | L = [x for x in open('input.txt', 'r')]
n = int(L[0].split(' ')[0])
k = int(L[0].split(' ')[1])
L = map(int, L[1:])
max = 0
for x in range(1,n-(k-1)):
if max < sum(L[x:x+k]):
max = sum(L[x:x+3])
print max |
s566093507 | p00439 | u238820099 | 1386400291 | Python | Python | py | Runtime Error | 0 | 0 | 425 | import sys
f = open('input.txt','w')
while 1:
line = raw_input()
if line == '0 0':
break
f.write(line)
f.write('\n')
f.close()
L = [x for x in open('input.txt', 'r') if x != "0 0"]
n = int(L[0].split(' ')[0])
k = int(L[0].split(' ')[1])
L = map(int, L[1:])
max = 0
... |
s785175827 | p00439 | u238820099 | 1386400766 | Python | Python | py | Runtime Error | 0 | 0 | 469 | import sys
f = open('input.txt','w')
while 1:
line = raw_input()
if line == '0 0':
f.write(line)
break
f.write(line)
f.write('\n')
f.close()
L = [x for x in open('input.txt', 'r')]
L[0].split(' ')
n = int(L[0].split(' ')[0])
k = int(L[0].split(' ')[1... |
s224692267 | p00439 | u238820099 | 1386401274 | Python | Python | py | Runtime Error | 0 | 0 | 457 | f = open('input.txt','w')
while 1:
line = raw_input()
if line == '0 0':
f.write(line)
break
f.write(line)
f.write('\n')
f.close()
L = [x for x in open('input.txt', 'r')]
L[0].split(' ')
n = int(L[0].split(' ')[0])
k = int(L[0].split(' ')[1])
L = L[:-... |
s532137928 | p00440 | u316268279 | 1430136373 | Python | Python | py | Runtime Error | 0 | 0 | 795 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N,K = map(int,raw_input().split())
A = sorted([int(rraw_input()) for i in range(0,K)])
if (N,K) == (0,0):
break
if A[0] == 0:
flag = True
A = A[1:]
K -= 1
else:
flag = False
diff = []
ans = ... |
s443604798 | p00440 | u847467233 | 1530313695 | Python | Python3 | py | Runtime Error | 0 | 0 | 424 | # AOJ 0517: Longest Steps
# Python3 2018.6.30 bal4u
while True:
n, k = map(int, input().split())
if n == 0: break
c = [0]*(n+1)
f = 0;
for i in range(k):
a = int(input())
if a == 0: f = 1
else: c[a] = 1
ans = w0 = w = 0
for i in range(1, n+1):
if c[i]: w += 1
elif w > 0:
if w0 + w + f > ans: ans = ... |
s053887838 | p00440 | u633068244 | 1399240376 | Python | Python | py | Runtime Error | 0 | 0 | 323 | while 1:
n,k = map(int,raw_input().split())
if n == 0: break
s = [0]*(n+1)
c = sorted([int(raw_input()) for i in range(k)])
p = min(0,C[0])
pre = 0
for i in c[p:]:
s[i] = s[i-1] + 1
if p and s[i-1] == 0:
if s[i-2]:
s[i] += s[i-2] + 1 - pre
pre = s[i-2] + 1
if s[i-2] == 0:
pre = 0
print max... |
s752628273 | p00441 | u352394527 | 1526289204 | Python | Python3 | py | Runtime Error | 0 | 0 | 486 | points = [[False for i in range(5001)] for j in range(5001)]
ps = []
for i in range(n):
x, y = map(int,input().split())
points[x][y] = True
ps.append((x,y))
ans = 0
for i in range(n):
for j in range(n):
p1 = ps[i]
p2 = ps[j]
vx = p2[0] - p1[0]
vy = p2[1] - p1[1]
... |
s649994467 | p00441 | u352394527 | 1526289531 | Python | Python3 | py | Runtime Error | 0 | 0 | 699 | def main():
while True:
n = int(input())
if not n:
break
points = [[False for i in range(5001)] for j in range(5001)]
ps = []
for i in range(n):
x, y = map(int,input().split())
points[x][y] = True
ps.append((x,y))
ans = 0
for i in range(n):
for j in r... |
s275835153 | p00441 | u352394527 | 1526289724 | Python | Python3 | py | Runtime Error | 0 | 0 | 699 | def main():
while True:
n = int(input())
if not n:
break
points = [[False for i in range(5001)] for j in range(5001)]
ps = []
for i in range(n):
x, y = map(int,input().split())
points[x][y] = True
ps.append((x,y))
ans = 0
for i in range(n):
for j in r... |
s137514954 | p00441 | u352394527 | 1526289726 | Python | Python3 | py | Runtime Error | 0 | 0 | 699 | def main():
while True:
n = int(input())
if not n:
break
points = [[False for i in range(5001)] for j in range(5001)]
ps = []
for i in range(n):
x, y = map(int,input().split())
points[x][y] = True
ps.append((x,y))
ans = 0
for i in range(n):
for j in r... |
s620747055 | p00441 | u352394527 | 1526289944 | Python | Python3 | py | Runtime Error | 0 | 0 | 748 | def main():
points = [[False for i in range(5001)] for j in range(5001)]
while True:
n = int(input())
if not n:
break
ps = []
for i in range(n):
x, y = map(int,input().split())
points[x][y] = True
ps.append((x,y))
ans = 0
for i in range(n):
for j in range... |
s096050512 | p00441 | u604412493 | 1378127427 | Python | Python | py | Runtime Error | 20000 | 7064 | 910 | import sys
from copy import deepcopy
#fp = open("input.txt", "r")
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
li = []
for i in xrange(n):
element = map(int, fp.readline()[:-1].split(" "))
li.append(element)
ret = 0
for i in xrange(n):
... |
s490866206 | p00441 | u604412493 | 1378127579 | Python | Python | py | Runtime Error | 20000 | 5752 | 912 | import sys
#fp = open("input.txt", "r")
fp = sys.stdin
while True:
n = int(fp.readline()[:-1])
if n == 0:
break
li = []
for i in xrange(n):
element = map(int, fp.readline()[:-1].split(" "))
li.append(element)
ret = 0
for i in xrange(n):
element = li.pop(0)
... |
s643700253 | p00441 | u633068244 | 1399293235 | Python | Python | py | Runtime Error | 0 | 0 | 468 | p = 50
while 1:
n = input()
if n == 0: break
xy = sorted([map(int,raw_input().split()) for i in range(n)])
x1,y1 = xy[0]
xy = sorted(xy, key = lambda XY:(XY[0]-x1)**2 + (XY[1]-y11)**2)
ans = 0
for j in range(n-3,0,-1):
x2,y2 = xy[j]
dx,dy = x2-x1,y2-y1
if [x1-dy,y1-dx] in xy[j+1:j+p] and [x2+dy,y2-dx] in x... |
s607233169 | p00441 | u633068244 | 1399295877 | Python | Python | py | Runtime Error | 0 | 0 | 337 | while 1:
n = input()
if n == 0: break
xy = [map(int,raw_input().split()) for i in range(n)]
S = set(map(tuple,xy))
ans = 0
for i in range(n):
x1,y1 = xy[i]
for j in range(n-1,i,-1):
x2,y2 = xy[j]
a = (x2-y2+y1,y2+x2-x1)
b = (x1-y2+y1,y1+x2-x1)
if a in S and b in S:
ans = max((x1-x2)**2 + (y1-y... |
s516049953 | p00442 | u072053884 | 1524553221 | Python | Python3 | py | Runtime Error | 20 | 5620 | 643 | import sys
file_input = sys.stdin
n = int(file_input.readline())
m = int(file_input.readline())
adj_list = [[] for i in range(n + 1)]
for line in file_input:
i, j = map(int, line.split())
adj_list[i].append(j)
unvisited = [True] * (n + 1)
ans = []
def dfs(u):
unvisited[u] = False
for v in adj_lis... |
s681167086 | p00442 | u352394527 | 1526566850 | Python | Python3 | py | Runtime Error | 20 | 5624 | 534 | V, E = int(input()), int(input())
L = []
visited = [0 for i in range(V)]
edges = [[] for i in range(V)]
#flag = 0
def visit(x):
# if visited[x] == 1:
# flag = 1
if not visited[x]:
visited[x] = 1
for e in edges[x]:
visit(e)
L.insert(0,x)
for i in range(E):
s, t = map(int,input().split())
ed... |
s617355658 | p00442 | u352394527 | 1526566932 | Python | Python3 | py | Runtime Error | 0 | 0 | 564 | sys.setrecursionlimit(100000)
V, E = int(input()), int(input())
L = []
visited = [0 for i in range(V)]
edges = [[] for i in range(V)]
#flag = 0
def visit(x):
# if visited[x] == 1:
# flag = 1
if not visited[x]:
visited[x] = 1
for e in edges[x]:
visit(e)
L.insert(0,x)
for i in range(E):
s, t =... |
s796994259 | p00442 | u847467233 | 1529488778 | Python | Python3 | py | Runtime Error | 0 | 0 | 685 | # AOJ 0519: Worst Reporter
# Python3 2018.6.20 bal4u
# トポロジーソート V:総ノード数, to[][]:隣接リスト
def topological_sort(V, to):
cnt = [0]*V
for i in range(V):
for j in to[i]: cnt[j] += 1
Q = []
for i in range(V):
if cnt[i] == 0: Q.append(i)
f = 0
while len(Q) > 0:
f |= len(Q) > 1
i = Q[0]
del Q[0]
print(i+1) #... |
s518732952 | p00443 | u901080241 | 1489042620 | Python | Python3 | py | Runtime Error | 0 | 0 | 1295 | import math
class Mobile:
def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1):
self.weight = 0
self.leftratio = leftratio
self.rightratio = rightratio
self.left = left
self.leftweight = 0
self.right = right
self.rightweight = 0
def calc(self):
... |
s774335012 | p00443 | u901080241 | 1489042719 | Python | Python3 | py | Runtime Error | 0 | 0 | 1373 | import math
class Mobile:
def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1):
self.weight = 0
self.leftratio = leftratio
self.rightratio = rightratio
self.left = left
self.leftweight = 0
self.right = right
self.rightweight = 0
def calc(self):
... |
s920746675 | p00443 | u901080241 | 1489042885 | Python | Python3 | py | Runtime Error | 0 | 0 | 1494 |
def gcd(x,y):
if x<y:
tmp = x
x = y
y = tmp
if x%y == 0:
return y
else:
gcd(y,x%y)
class Mobile:
def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1):
self.weight = 0
self.leftratio = leftratio
self.rightratio = rightratio
... |
s434241720 | p00443 | u352394527 | 1524997782 | Python | Python3 | py | Runtime Error | 0 | 0 | 936 | from math import gcd
def lcm(i,j):
return i * j // gcd(i,j)
def main():
while True:
n = int(input())
if not n: break
lst = [[]]
weight = [-1 for i in range(n + 1)]
def setWeight(n):
p,q,r,b = lst[n]
if weight[n] != -1:pass
elif r == 0 and b == 0:
weight[n] = (p + q) // ... |
s530764103 | p00443 | u352394527 | 1524997809 | Python | Python3 | py | Runtime Error | 0 | 0 | 936 | from math import gcd
def lcm(i,j):
return i * j // gcd(i,j)
def main():
while True:
n = int(input())
if not n: break
lst = [[]]
weight = [-1 for i in range(n + 1)]
def setWeight(n):
p,q,r,b = lst[n]
if weight[n] != -1:pass
elif r == 0 and b == 0:
weight[n] = (p + q) // ... |
s570083063 | p00443 | u352394527 | 1524997980 | Python | Python3 | py | Runtime Error | 0 | 0 | 948 |
from math import gcd
def lcm(i, j):
return i * j // gcd(i, j)
def main():
while True:
n = int(input())
if not n: break
lst = [[]]
weight = [-1 for i in range(n + 1)]
def setWeight(n):
p, q, r, b = lst[n]
if weight[n] != -1: pass
elif r == 0 and b == 0:
weight[n] = (p +... |
s991084201 | p00443 | u352394527 | 1524998018 | Python | Python3 | py | Runtime Error | 0 | 0 | 918 |
from math import gcd
def lcm(i, j):
return i * j // gcd(i, j)
def main():
while True:
n = int(input())
if not n: break
lst = [[]]
weight = [-1 for i in range(n + 1)]
def setWeight(n):
p, q, r, b = lst[n]
if weight[n] != -1: pass
elif r == 0 and b == 0:
weight[n] = (p +... |
s309124358 | p00443 | u467175809 | 1527202910 | Python | Python | py | Runtime Error | 0 | 0 | 1241 | #!/usr/bin/env python
import numpy as np
def GCD(a, b):
dummy1 = max(a, b)
dummy2 = min(a, b)
while True:
dummy = dummy1 % dummy2
dummy1 = dummy2
dummy2 = dummy
if(dummy == 0):
break
return dummy1
while True:
N = input()
if not N:
break
cost = []
E = []
root = N * (N - 1) / 2
for i in range(N... |
s636360965 | p00444 | u811434779 | 1440387195 | Python | Python | py | Runtime Error | 0 | 0 | 185 | while 1:
n = 1000 - input()
if n==0:break
m = [500,100,50,10,5,1]
for i in range(6):
x = n / m[i]; n -= m[i] * x; m[i] = x;
print reduce(lambda a, x: a+x, m) |
s562043202 | p00444 | u150984829 | 1525451707 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | for e in iter(input,'0'):
while 1:
b,c=1000-int(e),0
for i in[500,100,50,10,5]:
d,b=divmod(b,i)
c+=d
print(b+c)
|
s201598239 | p00444 | u894941280 | 1344883384 | Python | Python | py | Runtime Error | 0 | 0 | 422 | while True:
c =0
a = int(input())
me = 1000 -a
while me != 0:
if me >= 500:
me -= 500
c +=1
elif me >= 100:
me -= 100
c +=1
elif me >= 50:
me -= 50
c+=1
elif me >= 10:
me -= 10
c +=1
elif me >= 5:
me -= 5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.