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
s381502199
p01225
u798803522
1470063748
Python
Python3
py
Runtime Error
0
0
1107
trial = int(f.input()) nums,words = [],[] for s in range(trial): nums = [[int(n)] for n in f.input().split(" ")] words = [n for n in f.input().rstrip("\n").split(" ")] for t in range(9): nums[t].append(words[t]) nums = sorted(nums,key=lambda x:(x[1],x[0]),reverse=False) n,color,cnt,samecnt,a...
s528230372
p01225
u104171359
1487387103
Python
Python3
py
Runtime Error
0
0
1557
#!usr/bin/env python3 import sys def main(): WINNING_HANDS = [ '111', '222', '333', '444', '555', '666', '777', '888', '999', '123', '234', '345', '456', '567', '678', '789' ] num_of_datasets = int(sys.stdin.readline().strip('\n')) datasets = [{'R': [], 'G': [...
s217360903
p01225
u104171359
1487387490
Python
Python3
py
Runtime Error
0
0
1616
#!usr/bin/env python3 import sys def main(): WINNING_HANDS = [ '111', '222', '333', '444', '555', '666', '777', '888', '999', '123', '234', '345', '456', '567', '678', '789' ] num_of_datasets = int(sys.stdin.readline().strip('\n')) datasets = [{'R': [], 'G': [...
s596295607
p01225
u886729200
1523251541
Python
Python3
py
Runtime Error
0
0
1098
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append(map(int, input().split())) else: a.append(map(str, input().split())) for i in range(M): #data = [[2,2,2,3,3,3,1,1,1],["R","G","B","R","G","B","R","G","B"]] data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_...
s953963477
p01225
u886729200
1523251686
Python
Python3
py
Runtime Error
0
0
1098
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append(map(int, input().split())) else: a.append(map(str, input().split())) for i in range(M): #data = [[2,2,2,3,3,3,1,1,1],["R","G","B","R","G","B","R","G","B"]] data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_...
s599868568
p01225
u886729200
1523251696
Python
Python3
py
Runtime Error
0
0
1098
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append(map(int, input().split())) else: a.append(map(str, input().split())) for i in range(M): #data = [[2,2,2,3,3,3,1,1,1],["R","G","B","R","G","B","R","G","B"]] data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_...
s689102932
p01225
u886729200
1523251975
Python
Python3
py
Runtime Error
0
0
1102
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append(map(int, input().split())) else: a.append(map(str, input().split())) for i in range(M): data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_df = data_df.sort_values(1,axis=1) #print(i) #print(data_df,"\n"...
s686564074
p01225
u886729200
1523253612
Python
Python3
py
Runtime Error
0
0
1209
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append([int(i) for i in input().split()]) else: a.append([i for i in input().split()]) for i in range(M): data = a[i*2:(i+1)*2] print(data) data_df = pd.DataFrame(data) data_df = data_df.sort_values((i*2)+1,axis=1)#่‰ฒใ‚ฝใƒผใƒˆ...
s699657518
p01225
u886729200
1523253912
Python
Python3
py
Runtime Error
0
0
1127
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append([int(i) for i in input().split()]) else: a.append([i for i in input().split()]) for i in range(M): data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_df = data_df.sort_values(1,axis=1)#่‰ฒใ‚ฝใƒผใƒˆ #print(i) #p...
s814220352
p01225
u886729200
1523253926
Python
Python3
py
Runtime Error
0
0
1127
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append([int(i) for i in input().split()]) else: a.append([i for i in input().split()]) for i in range(M): data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_df = data_df.sort_values(1,axis=1)#่‰ฒใ‚ฝใƒผใƒˆ #print(i) #p...
s511424974
p01225
u886729200
1523253935
Python
Python3
py
Runtime Error
0
0
1127
a = [] M = int(input()) for i in range(M*2): if(i%2==0): a.append([int(i) for i in input().split()]) else: a.append([i for i in input().split()]) for i in range(M): data = a[i*2:(i+1)*2] data_df = pd.DataFrame(data) data_df = data_df.sort_values(1,axis=1)#่‰ฒใ‚ฝใƒผใƒˆ #print(i) #p...
s836373456
p01225
u584093205
1526736454
Python
Python3
py
Runtime Error
0
0
182
5 1 2 3 3 4 5 7 7 7 R R R R R R G G G 1 2 2 3 4 4 4 4 5 R R R R R R R R R 1 2 3 4 4 4 5 5 5 R R B R R R R R R 1 1 1 3 4 5 6 6 6 R R B G G G R R R 2 2 2 3 3 3 1 1 1 R G B R G B R G B
s449410712
p01225
u584093205
1526736962
Python
Python
py
Runtime Error
0
0
883
T = int(input()) for i in range(T): num = list(map(int, input().split())) coler = input().split() groups = [[], [], []] for i, c in enumerate(coler): if c == "R": groups[0].append(num[i]) elif c == "G": groups[1].append(num[i]) else: groups[2]....
s932488474
p01225
u584093205
1526737021
Python
Python
py
Runtime Error
0
0
883
T = int(input()) for i in range(T): num = list(map(int, input().split())) coler = input().split() groups = [[], [], []] for i, c in enumerate(coler): if c == "R": groups[0].append(num[i]) elif c == "G": groups[1].append(num[i]) else: groups[2]....
s112023459
p01227
u925390121
1540204182
Python
Python3
py
Runtime Error
0
0
494
#include <iostream> #include <algorithm> using namespace std; int x[1000000]; int distance[1000000]; int main() { int all_length; cin >> n >> k; for (int i=0; i<n; ++i) { cin >> x[i]; } if (n==1) { cout << 0; } else { all_length = x[n-1] - x[0]; for (int i=0; i<n-1; ++i) { distance...
s848167158
p01227
u025180675
1540206895
Python
Python3
py
Runtime Error
0
0
252
while True: N,K = map(int, input().strip().split(" ")) X = list(map(int,input().strip().split(" "))) L = [X[i+1] - X[i] for i in range(0,N-1)] L.sort() print(L) s = 0 for i in range(0,N-K): s = s + L[i] print(s)
s784442467
p01227
u025180675
1540207055
Python
Python3
py
Runtime Error
0
0
239
while True: N,K = map(int, input().strip().split(" ")) X = list(map(int,input().strip().split(" "))) L = [X[i+1] - X[i] for i in range(0,N-1)] L.sort() s = 0 for i in range(0,N-K): s = s + L[i] print(s)
s273711631
p01227
u698762975
1555928319
Python
Python3
py
Runtime Error
0
0
201
n,k=map(int,input().split()) l=list(map(int,input().split())) l1=[] for i in range(n-1): l1.append(l[i+1]-l[i]) l1=sorted(l1) for i in range(k-1): del l1[-1] s=0 for i in l1: s+=i print(s)
s808070605
p01227
u698762975
1555928385
Python
Python3
py
Runtime Error
0
0
257
t=int(input()) for j in range(t): n,k=map(int,input().split()) l=list(map(int,input().split())) l1=[] for i in range(n-1): l1.append(l[i+1]-l[i]) l1=sorted(l1) for i in range(k-1): del l1[-1] s=0 for i in l1: s+=i print(s)
s092344601
p01227
u026821956
1555929350
Python
Python3
py
Runtime Error
0
0
359
N = int(input()) for i in range(N): n,k = map(int,input().split()) L = list(map(int,input().split())) if n <= k: print(0) else: A = [] for j in range(1,N): A.append(L[i]-L[i-1]) A.sort() A.reverse() S = L[N-1]-L[0] for l in range(k-1): ...
s107154738
p01227
u026821956
1555929569
Python
Python3
py
Runtime Error
0
0
359
N = int(input()) for i in range(N): n,k = map(int,input().split()) L = list(map(int,input().split())) if n <= k: print(0) else: A = [] for j in range(1,n): A.append(L[i]-L[i-1]) A.sort() A.reverse() S = L[n-1]-L[0] for l in range(k-1): ...
s375433342
p01227
u910909659
1555929670
Python
Python3
py
Runtime Error
0
0
296
def croad(): n,k = map(int,input().split()) x = list(map(int,input().split())) y = [] for i in range(n-1): y.append(x[i+1]-x[i]) y.sort() y.reverse() while k>1: y.pop(0) k -= 1 print(sum(y)) a = int(input()) for i in range(a): croad()
s207925274
p01227
u910909659
1555930855
Python
Python3
py
Runtime Error
0
0
386
def croad(): n,k = map(int,input().split()) if n == 1: print(0) else: x = list(map(int,input().split())) y = [] for i in range(n-1): y.append(x[i+1]-x[i]) y.sort() y.reverse() while k>1 and len(y)>0: y.pop(0) k -= 1 ...
s803568850
p01227
u715278210
1555931750
Python
Python3
py
Runtime Error
0
0
547
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1): Y[j] = X[j...
s705815999
p01227
u715278210
1555931792
Python
Python3
py
Runtime Error
0
0
545
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1): Y[j] = X[j...
s847381717
p01227
u797636303
1555931889
Python
Python3
py
Runtime Error
0
0
259
N,K=map(int, input().strip().split()) X=list(map(int, input().strip().split())) X.sort(reverse=True) print(X) Y=[] for i in range(len(X)-1): Y.append(X[i]-X[i+1]) Y.sort(reverse=True) del Y[:K-1] print(Y) a=0 for i in range(len(Y)): a=a+Y[i] print(a)
s431024157
p01227
u715278210
1555932107
Python
Python3
py
Runtime Error
0
0
547
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1): Y[j] = X[j...
s940515672
p01227
u715278210
1555932259
Python
Python3
py
Runtime Error
0
0
547
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1): Y[j] = X[j...
s082017247
p01227
u715278210
1555932419
Python
Python3
py
Runtime Error
0
0
547
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1): Y[j] = X[j...
s710787463
p01227
u715278210
1555932754
Python
Python3
py
Runtime Error
0
0
572
o = int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ if N =< K: K = N for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1...
s445718393
p01227
u772853944
1556084540
Python
Python3
py
Runtime Error
0
0
422
def f(n,k,x): dis = [x[i+1]-x[i] for i in range(n-1)]#้šฃใ‚Šๅˆใ†ๅฎถใฎ่ท้›ขใ‚’่ชฟในใ‚‹ dis.sort()#้›ป็ทšใฎๆ•ฐ-1ใ ใ‘้šฃใ‚Šๅˆใ†ๅฎถๅŒๅฃซใฎ้›ป็ทšใ‚’้…็ฝฎใ—ใชใใฆ่‰ฏใ„ return sum(dis[:n-k])#้šฃใ‚Šๅˆใ†ๅฎถใฎ่ท้›ขใŒๅคงใใ„้ †ใซkใƒผ1ๅ€‹ใฏ้›ป็ทšใ‚’้…็ฝฎใ—ใชใ„ t = int(input()) for i in range(t): n,k = map(int,input().split()) x = list(map(int,input().split())) print(ans)
s633023416
p01227
u715278210
1556593901
Python
Python3
py
Runtime Error
0
0
571
= int(input()) x = 0 while x < o+1: #ๆœ€ๅˆใฎๆ•ฐๅญ—ใฏ้›†ๅˆใฎใฎๆ•ฐ N,K = map(int,input().strip().split(' ')) X = list(map(int,input().strip().split(' ')))#ใƒชใ‚นใƒˆใ‚’ไฝœใ‚‹ if N < K: K = N for i in range(N): X.sort() a = X[N-1] - X[0] #ๅ…จไฝ“ใฎ้•ทใ• Y = [0]*(N-1) #ๅ„ๅฎถใฎ้–“ใฎ่ท้›ขใฎ้›†ๅˆ for j in range(N-1):...
s844888725
p01227
u798803522
1470238746
Python
Python3
py
Runtime Error
0
0
316
trial = int(input()) for t in range(trial): housecnt,elec = (int(n) for n in input().split(" ")) house = [int(n) for n in input().split(" ")] maxlist = [] for h in range(housecnt-1): maxlist.append(house[h+1]-house[h]) for p in range(elec-1): maxlist.pop() print(sum(maxlist))
s112947219
p01227
u798803522
1470238893
Python
Python3
py
Runtime Error
0
0
349
trial = int(input()) for t in range(trial): housecnt,elec = (int(n) for n in input().split(" ")) house = [int(n) for n in input().split(" ")] maxlist = [] for h in range(housecnt-1): maxlist.append(house[h+1]-house[h]) maxlist.sort() for p in range(min(housecnt,elec-1)): maxlist....
s931549460
p01227
u724548524
1525534414
Python
Python3
py
Runtime Error
0
0
424
for i in range(int(input())): n, k = map(int, input().split()) d = list(map(int, input().split())) if k >= n: print(0) elif k == 1: d.sort() print(d[-1] - d[0]) else: k = [0] * (k - 1) d.sort() for i in range(1, n): if d[i] - d[i - 1] > k[0...
s766212331
p01227
u584093205
1526738657
Python
Python3
py
Runtime Error
0
0
311
T = int(input()) for t in range(T): n, k = map(int, input().split()) X = list(map(int, input().split())) mid = [X[i] - X[i - 1] for i in range(1, n)] mid.sort(reverse = True) ans = sum(mid) for i in range(k-1): ans -= mid[i] if ans == 0: break print(ans)
s295219396
p01230
u647766105
1430234309
Python
Python
py
Runtime Error
19930
20224
2036
def main(): while True: N, M, Z = map(int, raw_input().split()) if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] L.sort() mat = Matrix(2*M, 2*M) for i, (pre, cur1) in enu...
s189598790
p01230
u647766105
1430234872
Python
Python
py
Runtime Error
19930
4952
2119
def main(): while True: N, M, Z = map(int, raw_input().split()) if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] L.sort() mat = Matrix(2*M, 2*M) for i, (pre, cur1) in enu...
s533525264
p01230
u647766105
1430235176
Python
Python
py
Runtime Error
19930
4968
2141
def main(): while True: N, M, Z = map(int, raw_input().split()) print N, M, Z if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] L.sort() mat = Matrix(2*M, 2*M) for...
s739942426
p01230
u647766105
1430238021
Python
Python
py
Runtime Error
19930
5040
2211
from itertools import izip as zip def main(): while True: N, M, Z = map(int, raw_input().split()) if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] L.sort() mat = Matrix(2*M, 2*M)...
s836908522
p01230
u647766105
1430239156
Python
Python
py
Runtime Error
19930
5024
2278
from itertools import izip as zip def main(): while True: N, M, Z = map(int, raw_input().split()) if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] #L.sort() mat = Matrix(2*M, 2*M...
s875794745
p01230
u647766105
1430241048
Python
Python
py
Runtime Error
19930
5020
2281
from itertools import izip as zip def main(): while True: N, M, Z = map(int, raw_input().split()) if N == 0: break L = [] for _ in xrange(M): s, d = map(int, raw_input().split()) L += [(s, d), (d, s)] #L.sort() mat = Matrix(2*M, 2*M...
s123644436
p01253
u266872031
1437058113
Python
Python
py
Runtime Error
39870
4520
631
while(1): [N,T]=[int(x) for x in raw_input().split()] if T==0: break else: RB=raw_input() probold=[0 for i in range(N+6)] probnew=[0 for i in range(N+6)] for i in range(N): if RB[i]=='R': probold[i]=1 else: probold[...
s909051601
p01253
u266872031
1437058578
Python
Python
py
Runtime Error
39860
4532
701
while(1): [N,T]=[int(x) for x in raw_input().split()] if T==0: break else: RB=raw_input() probold=[0 for i in range(N+6)] probnew=[0 for i in range(N+6)] for i in range(N): if RB[i]=='R': probold[i]=1 else: probold[...
s621883827
p01255
u266872031
1435599555
Python
Python
py
Runtime Error
0
0
1631
def crosscheck(line1,line2): a1=line1[0] a2=line1[1] b1=line2[0] b2=line2[1] t1=line1[2]-line1[0] t2=line1[3]-line1[1] s1=line2[2]-line2[0] s2=line2[3]-line2[1] if -t1*s2+t2*s1!=0: k=((b1-a1)*-s2+(b2-a2)*s1)*1./(-t1*s2+t2*s1) j=((b1-a1)*-t2+(b2-a2)*t1)*1./(-t1*s2+t2*s...
s987837914
p01267
u383876854
1444130421
Python
Python
py
Runtime Error
0
0
5
fvasg
s722037631
p01267
u633333374
1502717147
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s425125127
p01267
u633333374
1502717159
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s989772791
p01267
u633333374
1502717219
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s499033527
p01267
u633333374
1502717234
Python
Python
py
Runtime Error
0
0
398
while 1: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y[0]...
s854714247
p01267
u633333374
1502717606
Python
Python
py
Runtime Error
0
0
353
N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y[0]: Y.pop(0) if len(Y) ...
s738660747
p01267
u633333374
1502717816
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s732642257
p01267
u633333374
1502717851
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s906218815
p01267
u633333374
1502717856
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s677939083
p01267
u633333374
1502717860
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s463135907
p01267
u633333374
1502717865
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s484167805
p01267
u633333374
1502717868
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s956983026
p01267
u633333374
1502717927
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s253851015
p01267
u633333374
1502718592
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s724604292
p01267
u633333374
1502718655
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s653989589
p01267
u633333374
1502718702
Python
Python
py
Runtime Error
0
0
398
while 1: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y[0]...
s093760567
p01267
u633333374
1502718767
Python
Python
py
Runtime Error
0
0
401
while True: N,A,B,C,X = map(int,raw_input().split()) if N == A == B == C == X == 0:break sum = 0 Z = 0 Y = [int(x) for x in raw_input().split()] if (X in Y) == True: Y.remove(X) while Z == 0: if sum == 10000: sum = -2 Z = 1 sum += 1 X = (A*X+B)%C if X == Y...
s746768889
p01267
u922450532
1529060104
Python
Python3
py
Runtime Error
0
0
608
while True: a = input() a = a.split(" ") b = [] for i in a: b.append(int(i)) if b[0] == 0 and b[1] == 0 and b[2] == 0 and b[3] == 0 and b[4] == 0: break c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if b[4] == d[0]: print(0) ...
s528402281
p01267
u922450532
1529060317
Python
Python3
py
Runtime Error
0
0
607
while True: a = input() a = a.split(" ") b = [] for i in a: b.append(int(i)) if b[0] == 0 and b[1] == 0 and b[2] == 0 and b[3] == 0 and b[4] == 0: break c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if b[4] == d[0]: print(0) ...
s177100691
p01267
u922450532
1529119505
Python
Python3
py
Runtime Error
0
0
521
while True: a = input() if a == "0 0 0 0 0": break a = a.split(" ") b = [] for i in a: b.append(int(i)) c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if b[4] == d[0]: print(0) continue ans = 0 x = b[4] for i i...
s022734444
p01267
u922450532
1529152705
Python
Python3
py
Runtime Error
0
0
522
while True: a = input() if a == "0 0 0 0 0": break a = a.split(" ") b = [] for i in a: b.append(int(i)) c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if b[4] == d[0]: print(0) continue ans = 0 x = b[4] for i i...
s056381519
p01267
u922450532
1529210247
Python
Python3
py
Runtime Error
0
0
605
while True: a = input() # if a == "0 0 0 0 0": # break a = a.split(" ") b = [] sum = 0 for i in a: b.append(int(i)) sum += int(i) print(sum) if sum == 0: break c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if ...
s922100545
p01267
u922450532
1529211006
Python
Python3
py
Runtime Error
0
0
627
while True: a = input() # if a == "0 0 0 0 0": # break a = a.split(" ") b = [] sum = 0 for i in a: b.append(int(i)) sum += int(i) if sum == 0: break c = input() c = c.split(" ") d = [] for i in c: d.append(int(i)) if b[4] == d[0]: ...
s440204937
p01267
u136916346
1530083654
Python
Python3
py
Runtime Error
0
0
374
f=lambda A,x,B,C:(A*x+B)%C while 1: N,A,B,C,X=map(int,raw_input().split()) if not N and not A and not B and not C and not X:break Y=list(map(int,raw_input().split())) T=X c=[[] for _ in range(N)] sl=0 for i in range(10005): if T==Y[sl]: sl+=1 if sl==N:break ...
s293735814
p01267
u621997536
1387288356
Python
Python
py
Runtime Error
0
0
4
null
s254463271
p01268
u731235119
1422008499
Python
Python
py
Runtime Error
0
0
656
import math def sieve (n): prime = [0,0] prime += [1 for i in range(n-1)] ub = math.sqrt(n) + 1 d = 2 while d <= ub: if prime[d] == 0: d += 1 continue prod = 2 while d * prod <= n: prime[d*prod] = 0 prod += 1 d += 1 return prime prime = sieve(2*10**5) while 1: N,P = map(int,raw_input().split...
s006053923
p01268
u685815919
1481253093
Python
Python
py
Runtime Error
40000
6660
643
def getLargePrime(n,k): primes=[2] result=[] if n<2: result.append(2) i=3 while True: isValid=True for e in primes: if i%e==0: isValid=False break if i<e**2: break if isValid: primes.append(i) if isValid and n<i:...
s523227252
p01269
u855199458
1530075814
Python
Python3
py
Runtime Error
0
0
873
# -*- coding: utf-8 -*- from heapq import heappop, heappush from collections import defaultdict def inpl(): return list(map(int, input().split())) N, M, L = inpl() while N: G = [[] for _ in range(N+1)] for _ in range(M): a, b, d, e = inpl() G[a].append([b, d, e]) G[b].append([a, d, e]...
s748965934
p01270
u269391636
1527487416
Python
Python3
py
Runtime Error
0
0
1230
while(True): N = int(input()) if N == 0: quit() data = [] emp = [[0,10**9]] for _____ in range(N): tmp = input().split() if tmp[0] == "W": c,k = int(tmp[1]),int(tmp[2]) while(k): if (emp[0][1]-emp[0][0]) > k: data.ap...
s043623554
p01270
u269391636
1527487620
Python
Python3
py
Runtime Error
0
0
1199
while(True): N = int(input()) if N == 0: quit() data = [] emp = [[0,10**9]] for _____ in range(N): tmp = input().split() if tmp[0] == "W": c,k = int(tmp[1]),int(tmp[2]) while(k): if (emp[0][1]-emp[0][0]) > k: data.ap...
s537791103
p01270
u269391636
1527490481
Python
Python3
py
Runtime Error
0
0
1255
while(True): N = int(input()) if N == 0: quit() data = [] emp = [[0,2 * 10**9]] for _____ in range(N): tmp = input().split() if tmp[0] == "W": c,k = int(tmp[1]),int(tmp[2]) while(k): if (emp[0][1]-emp[0][0]) > k: dat...
s733787994
p01270
u269391636
1527491495
Python
Python3
py
Runtime Error
0
0
1255
while(True): N = int(input()) if N == 0: quit() data = [] emp = [[0,2 * 10**9]] for _____ in range(N): tmp = input().split() if tmp[0] == "W": c,k = int(tmp[1]),int(tmp[2]) while(k): if (emp[0][1]-emp[0][0]) > k: dat...
s969097558
p01271
u633068244
1425051279
Python
Python
py
Runtime Error
19940
126692
1287
dwh = zip([1,0,-1,0,],[0,1,0,-1]) while 1: W,H = map(int,raw_input().split()) if W == 0: break A,B = [],[] for loop in xrange(H): a,b = raw_input().split() A.append(list(a)) B.append(list(b)) for h in xrange(H): for w in xrange(W): if A[h][w] == "L": wl ,...
s170110765
p01271
u633068244
1425051380
Python
Python
py
Runtime Error
19940
127328
1327
from collections import deque dwh = zip([1,0,-1,0,],[0,1,0,-1]) while 1: W,H = map(int,raw_input().split()) if W == 0: break A,B = [],[] for loop in xrange(H): a,b = raw_input().split() A.append(list(a)) B.append(list(b)) for h in xrange(H): for w in xrange(W): ...
s842155172
p01271
u685815919
1479106967
Python
Python
py
Runtime Error
40000
323072
1243
from Queue import Queue def isValid(W,H,x,y): return 0<=x and x<H and 0<=y and y<W def walking(L,R,start): vec=[(1,0,1,0),(-1,0,-1,0),(0,1,0,-1),(0,-1,0,1)] q=Queue() searched={} q.put(startPos) searched[startPos]=True while q.qsize()>0: lx,ly,rx,ry=q.get() for dlx,dly,drx,dry in vec: if n...
s484559449
p01271
u260980560
1482833675
Python
Python
py
Runtime Error
0
0
1439
from collections import deque dd = [(-1, 0), (0, -1), (1, 0), (0, 1)] while 1: w, h = map(int, raw_input().split()) if w==0: break M = [raw_input() for i in xrange(h)] ML = [e[:w] for e in M] MR = [e[w+1:] for e in M] for i in xrange(h): for j in xrange(w): if MR[i][j...
s634796984
p01271
u260980560
1482833995
Python
Python
py
Runtime Error
40000
257904
1466
from collections import deque dd = [(-1, 0), (0, -1), (1, 0), (0, 1)] while 1: w, h = map(int, raw_input().split()) if w==0: break M = [raw_input() for i in xrange(h)] ML = [e[:w] for e in M] MR = [e[w+1:] for e in M] rx = ry = lx = ly = None for i in xrange(h): for j in xran...
s834415286
p01271
u260980560
1482835043
Python
Python
py
Runtime Error
40000
258072
1465
from collections import deque dd = [(-1, 0), (0, -1), (1, 0), (0, 1)] deq = deque() push = deq.append pop = deq.popleft clear = deq.clear while 1: w, h = map(int, raw_input().split()) if w==0: break M = [raw_input() for i in xrange(h)] rx = ry = lx = ly = None for i in xrange(h): e =...
s139628687
p01271
u177389471
1502244722
Python
Python3
py
Runtime Error
40000
147728
1269
from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(" ") q = deque(...
s356978382
p01271
u177389471
1502244831
Python
Python3
py
Runtime Error
40000
95276
1328
from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(" ") q = deque(...
s266158602
p01271
u177389471
1502245084
Python
Python3
py
Runtime Error
40000
92184
1384
from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(" ") q = deque(...
s051706410
p01271
u177389471
1502245350
Python
Python3
py
Runtime Error
40000
92048
1384
from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(" ") q = deque(...
s491683458
p01271
u177389471
1502245361
Python
Python
py
Runtime Error
0
0
1384
from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(" ") q = deque(...
s930745655
p01271
u177389471
1502246297
Python
Python3
py
Runtime Error
0
0
1331
import numpy as np from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(...
s718003659
p01271
u177389471
1502247429
Python
Python3
py
Runtime Error
0
0
12
import numpy
s059212926
p01271
u177389471
1502247471
Python
Python3
py
Runtime Error
0
0
29
import numpy as np print(" ")
s613404466
p01271
u177389471
1502248238
Python
Python3
py
Runtime Error
0
0
1434
import numpy as np from collections import deque while True: w,h=map(int,input().split(" ")) def isrange(p): return 0<=p[0] and p[0]<h and 0<=p[1] and p[1]<w if w==0: break rl=[[str()] for i in range(h)] rr=[[str()] for i in range(h)] for i in range(h): rl[i],rr[i]=input().split(...
s523371001
p01271
u509278866
1529657487
Python
Python3
py
Runtime Error
0
0
2694
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
s423742065
p01271
u509278866
1529666379
Python
Python3
py
Runtime Error
0
0
3186
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
s477416075
p01271
u509278866
1529714672
Python
Python3
py
Runtime Error
0
0
2984
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
s879807290
p01271
u352394527
1529775370
Python
Python3
py
Runtime Error
0
0
1465
from collections import deque direct_l = ((-1, 0), (1, 0), (0, 1), (0, -1)) direct_r = ((1, 0), (-1, 0), (0, 1), (0, -1)) directs = tuple(zip(direct_l, direct_r)) def search(start_l, start_r, mp_l, mp_r): que = deque() que.append((start_l, start_r)) dic = {} dic[(start_l, start_r)] = True while que: pl,...
s750824480
p01271
u352394527
1529776016
Python
Python3
py
Runtime Error
0
0
1598
from collections import deque direct_l = ((-1, 0), (1, 0), (0, 1), (0, -1)) direct_r = ((1, 0), (-1, 0), (0, 1), (0, -1)) directs = tuple(zip(direct_l, direct_r)) def search(start_l, start_r, mp_l, mp_r, dic): que = deque() que.append((start_l, start_r)) dic[start_l[0]][start_l[1]][start_r[0]][start_r[1]] = Tru...
s197609775
p01271
u352394527
1529776569
Python
Python3
py
Runtime Error
0
0
1569
from collections import deque directs = ((-1, 0, 1, 0), (1, 0, -1, 0), (0, 1, 0, 1), (0, -1, 0, -1)) def search(start_l, start_r, mp_l, mp_r, dic): que = deque() que.append((start_l[0], start_l[1], start_r[0], start_r[1])) dic[start_l[0]][start_l[1]][start_r[0]][start_r[1]] = True while que: lx, ly, rx, r...
s926631948
p01271
u352394527
1529777691
Python
Python3
py
Runtime Error
0
0
1625
from collections import deque, defaultdict def main(): directs = ((-1, 0, 1, 0), (1, 0, -1, 0), (0, 1, 0, 1), (0, -1, 0, -1)) while True: w, h = map(int, input().split()) if w == 0: break mp_l = ["#" * (w + 2)] mp_r = ["#" * (w + 2)] for _ in range(h): l, r = input().split() ...
s128593013
p01271
u352394527
1529778274
Python
Python3
py
Runtime Error
0
0
1895
from collections import deque, defaultdict def main(): directs = ((-1, 0, 1, 0), (1, 0, -1, 0), (0, 1, 0, 1), (0, -1, 0, -1)) while True: w, h = map(int, input().split()) if w == 0: break mp_l = ["#" * (w + 2)] mp_r = ["#" * (w + 2)] for _ in range(h): l, r = input().split() ...