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
s389291881
p00352
u584779197
1514005408
Python
Python
py
Runtime Error
0
0
48
a,b=map(int,input().split()) print(int((a+b)/2))
s885956860
p00352
u480716860
1525006643
Python
Python
py
Runtime Error
0
0
52
a = int(input()) b = int(input()) print((a + b)//2)
s896198681
p00352
u480716860
1525008150
Python
Python
py
Runtime Error
0
0
51
a, b = map(int, input().split()) print((a + b)//2)
s273674375
p00352
u480716860
1525008225
Python
Python
py
Runtime Error
0
0
51
a, b = map(int, input().split()) print((a + b)//2)
s110231524
p00352
u480716860
1525008233
Python
Python
py
Runtime Error
0
0
50
a, b = map(int, input().split()) print((a + b)/2)
s860237524
p00353
u737311644
1516350227
Python
Python
py
Runtime Error
0
0
113
m,f,b=map(int,input().split()) ans=0 if m>b: ans=0 elif m<b: ans=b-m elif m+f<b: ans="NA" print(ans)
s876191554
p00354
u814278309
1559221774
Python
Python3
py
Runtime Error
0
0
391
while True: for i in range(1,31): n=int(input()) if i%7==0: print('{}'.format('thu')) elif i%7==1: print('{}'.format('fri')) elif i%7==2: print('{}'.format('sat')) elif i%7==3: print('{}'.format('san')) elif i%7==4: print('{}'.format('mon')) elif i%7==5: print('{}'.format('tue')) else: print('{}'.format('wed'))
s231879964
p00354
u814278309
1559222113
Python
Python3
py
Runtime Error
0
0
391
while True: for i in range(1,31): n=int(input()) if n%7==0: print('{}'.format('thu')) elif n%7==1: print('{}'.format('fri')) elif n%7==2: print('{}'.format('sat')) elif n%7==3: print('{}'.format('san')) elif n%7==4: print('{}'.format('mon')) elif n%7==5: print('{}'.format('tue')) else: print('{}'.format('wed'))
s168890227
p00354
u814278309
1559222260
Python
Python3
py
Runtime Error
0
0
337
while True: n=int(input()) if n%7==0: print('{}'.format('thu')) elif n%7==1: print('{}'.format('fri')) elif n%7==2: print('{}'.format('sat')) elif n%7==3: print('{}'.format('san')) elif n%7==4: print('{}'.format('mon')) elif n%7==5: print('{}'.format('tue')) else: print('{}'.format('wed'))
s383979458
p00354
u814278309
1559222459
Python
Python3
py
Runtime Error
0
0
337
while True: n=int(input()) if n%7==0: print('{}'.format('thu')) elif n%7==1: print('{}'.format('fri')) elif n%7==2: print('{}'.format('sat')) elif n%7==3: print('{}'.format('sun')) elif n%7==4: print('{}'.format('mon')) elif n%7==5: print('{}'.format('tue')) else: print('{}'.format('wed'))
s657585087
p00354
u737311644
1516351692
Python
Python3
py
Runtime Error
0
0
210
a=int(input()) if a%7==1: print("fri") if a%7==2: print("sat") if a%7==3: print("sun") if a%7==4: print("mon") if a%7==5: print("tue") if a%7==6: print("wed") if a%==7: print("thu")
s894974834
p00354
u737311644
1516351724
Python
Python3
py
Runtime Error
0
0
210
a=int(input()) if a%7==1: print("fri") if a%7==2: print("sat") if a%7==3: print("sun") if a%7==4: print("mon") if a%7==5: print("tue") if a%7==6: print("wed") if a%==0: print("thu")
s149201584
p00355
u843508808
1534744164
Python
Python3
py
Runtime Error
0
0
297
import numpy a, b = map(int, input().split()) n = int(input()) l = sorted([list(map(int, input().split())) for _ in range(n)]) line = [0]*(max(l)[1]+2) line[a] += 1 line[b] -= 1 for a, b in l: line[a] += 1 line[b] -= 1 if list(numpy.cumsum(line)).count(2): print(1) else: print(0)
s686774148
p00355
u843508808
1534744350
Python
Python3
py
Runtime Error
20
5608
318
a, b = map(int, input().split()) n = int(input()) l = sorted([list(map(int, input().split())) for _ in range(n)]) line = [0]*(max(l)[1]+2) line[a] += 1 line[b] -= 1 for a, b in l: line[a] += 1 line[b] -= 1 for i in range(len(line)-1): line[i+1] += line[i] if line.count(2): print(1) else: print(0)
s201943525
p00355
u855989123
1513680780
Python
Python
py
Runtime Error
0
0
20
s = input() print(s)
s079706394
p00355
u781622789
1523976339
Python
Python3
py
Runtime Error
0
0
295
a,b = map(int,list(input().split(" "))) n = int(input()) c = [0 for i in range(1002)] ans = 0 c[a]+=1 c[b]-=1 for i in range(n): s,f = map(int,list(input().split(" "))) c[s]+=1 c[f]-=1 for i in range(1002): c[i+1] += c[i] if(c[i]>1): ans = 1 print(ans)
s291049018
p00356
u388552965
1534829583
Python
Python3
py
Runtime Error
0
0
134
print((lambda x,y : x + y + 1 - (lambda *x, f=lambda f, x, y: f(f, y, x % y) if y else x: f(f, *x))(x,y))(int(input()),int(input())))
s551522664
p00356
u388552965
1534829598
Python
Python
py
Runtime Error
0
0
134
print((lambda x,y : x + y + 1 - (lambda *x, f=lambda f, x, y: f(f, y, x % y) if y else x: f(f, *x))(x,y))(int(input()),int(input())))
s383749273
p00357
u320316900
1523337441
Python
Python3
py
Runtime Error
20
5600
474
fi = int(input()) tramp = [int(input()) for i in range(fi)] is_reachable = [0 for i in range(fi)] def jump(n): is_reachable[n] = 1 if n == fi: return for j in range(min(tramp[n] // 10, fi-n-1)): if not is_reachable[n+j+1]: jump(n+j+1) jump(0) if not is_reachable[-1]: print("no") exit() tramp = tramp[::-1] is_reachable = [0 for i in range(fi)] jump(0) if not is_reachable[-1]: print("no") exit() print("yes")
s190847235
p00358
u724548524
1525552404
Python
Python3
py
Runtime Error
0
0
926
h, n = map(int, input().split()) c = {i:set() for i in range(h + 1)} for i in range(n): a, b = map(int, input().split()) c[b].add(a) c[h] = set([1, 2]) count = 0 for i in range(h - 1): l = c[i] | c[i + 1] p = None if l == set(): count += 2 c[i + 1].add(1) c[i + 1].add(2) elif 0 not in l and 1 not in l: p = 1 elif 2 not in l and 3 not in l: p = 3 elif 1 not in l and 2 not in l: p = 2 if p: j = 0 while i + j + 1 < h: if c[i + j + 1] == set(): j += 1 else: break if p != 2 and 3 - p not in c[i + j + 2] and 4 - p not in c[i + j + 2]: count += 1 c[i + 1].add(p - 1) c[i + 1].add(p) continue if j % 2 or j < 2: count += 1 c[i + 1].add(p - 1) c[i + 1].add(p) print(count)
s005527749
p00358
u724548524
1525553510
Python
Python3
py
Runtime Error
0
0
972
h, n = map(int, input().split()) c = [set() for i in range(h + 1)] for i in range(n): a, b = map(int, input().split()) c[b].add(a) c[h] = set([1, 2]) count = 0 for i in range(h - 1): l = c[i] | c[i + 1] p = None if l == set(): count += 2 c[i + 1].add(1) c[i + 1].add(2) elif 0 not in l and 1 not in l: p = 1 elif 2 not in l and 3 not in l: p = 3 elif 1 not in l and 2 not in l: p = 2 if p: j = 0 while i + j + 1 < h + 1: if c[i + j + 1] | c[i + j + 1] == set(): j += 1 else: j += 1 break if p != 2 and 3 - p not in c[i + j + 1] and 4 - p not in c[i + j + 1]: count += 1 c[i + 1].add(p - 1) c[i + 1].add(p) continue if (j - 1) % 2 or j < 2: count += 1 c[i + 1].add(p - 1) c[i + 1].add(p) print(count)
s080367529
p00360
u133119785
1518189508
Python
Python3
py
Runtime Error
60
10140
438
def solve(k,s): if k == 0: return s elif s == []: return [] else: ss = s[0:k+1] min_c = min(ss) min_i = ss.index(min_c) if min_i == 0: ss = s[1:len(s)] return [s[0]] + solve(k,ss) else: s.pop(min_i) k -= min_i return [min_c] + solve(k,s) s = list(input()) k = int(input()) o = solve(k,s) print("".join(o))
s008140321
p00360
u724548524
1526403108
Python
Python3
py
Runtime Error
20
5592
229
s = list(input()) k = int(input()) j = 0 while True: i = s[j:j + k + 1].index(min(s[j:j + k + 1])) s = s[:j] + [s[j + i]] + s[j :j + i] + s[j + i + 1:] j += 1 k -= i if k == 0: break print("".join(s))
s369516380
p00360
u724548524
1526403170
Python
Python3
py
Runtime Error
20
5600
248
s = list(input()) k = int(input()) j = 0 while True: i = s[j:j + k + 1].index(min(s[j:j + k + 1])) s = s[:j] + [s[j + i]] + s[j :j + i] + s[j + i + 1:] j += 1 k -= i if k == 0 or j == len(s) - 1: break print("".join(s))
s032703592
p00376
u069727578
1551529779
Python
Python3
py
Runtime Error
0
0
37
a,b=map(int,split()) print(abs(a-b))
s578542760
p00377
u552594238
1545487109
Python
Python3
py
Runtime Error
0
0
258
friends=input() friends.split('') friends_all=friends[0] friends_cake=friends[1] cakes=input() cakes.split('') cakes_amount(sum(cakes)) one_person=cakes_amount//friends if cakes_amount%friends==0: pass else: one_person+=1 preint(one_person)
s506688810
p00377
u552594238
1545487192
Python
Python3
py
Runtime Error
0
0
266
friends=input() friends.split('') friends_all=friends[0] friends_cake=friends[1] cakes=input() cakes.split('') cakes_amount(sum(cakes)) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 preint(one_person)
s819936577
p00377
u552594238
1545487255
Python
Python3
py
Runtime Error
0
0
262
friends=input() friends.split(' ') friends_all=friends[0] friends_cake=friends[1] cakes=input() cakes_amount(sum(cakes.split(' '))) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 preint(one_person)
s316127262
p00377
u552594238
1545487319
Python
Python3
py
Runtime Error
0
0
238
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes_amount(sum(cakes.split(' '))) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 preint(one_person)
s107250795
p00377
u552594238
1545487353
Python
Python3
py
Runtime Error
0
0
247
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes_amount(sum(cakes.split(' '))) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 preint(one_person)
s849680416
p00377
u552594238
1545487410
Python
Python3
py
Runtime Error
0
0
254
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes.split(' ') cakes_amount=(sum(cakes)) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 preint(one_person)
s163864924
p00377
u552594238
1545487423
Python
Python3
py
Runtime Error
0
0
253
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes.split(' ') cakes_amount=(sum(cakes)) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 print(one_person)
s899649299
p00377
u552594238
1545487430
Python
Python3
py
Runtime Error
0
0
253
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes.split(' ') cakes_amount=(sum(cakes)) one_person=cakes_amount//friends_all if cakes_amount%friends_all==0: pass else: one_person+=1 print(one_person)
s466474050
p00377
u552594238
1545487530
Python
Python3
py
Runtime Error
0
0
244
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes.split(' ') cakes_amount=(sum(cakes)) one_person=cakes_amount//friends_all if cakes_amount%friends_all!=0: one_person=+1 else: pass print(one_person)
s250103049
p00377
u552594238
1545487736
Python
Python3
py
Runtime Error
0
0
249
friends=input() friends.split('') friends_all=friends[0] cakes=input() cakes.split('') cakes_amount(sum(cakes)) person=friends+1 one_person=cakes_amount//person if cakes_amount%person==0: pass else: one_person+=1 preint(one_person)
s590944528
p00377
u552594238
1545487749
Python
Python3
py
Runtime Error
0
0
248
friends=input() friends.split('') friends_all=friends[0] cakes=input() cakes.split('') cakes_amount(sum(cakes)) person=friends+1 one_person=cakes_amount//person if cakes_amount%person==0: pass else: one_person+=1 print(one_person)
s919983270
p00377
u552594238
1545487782
Python
Python3
py
Runtime Error
0
0
250
friends=input() friends.split(' ') friends_all=friends[0] cakes=input() cakes.split(' ') cakes_amount(sum(cakes)) person=friends+1 one_person=cakes_amount//person if cakes_amount%person==0: pass else: one_person+=1 print(one_person)
s753692782
p00377
u552594238
1545488062
Python
Python3
py
Runtime Error
0
0
306
friends=input() friends.split(' ') friends_all=friends[0] friends_cakes=friends[1] cakes=input() cakes.split(' ') cakes_amount=0 for a in cakes: cakes_amount+=a person=friends+1 one_person=cakes_amount//person if cakes_amount%person==0: pass else: one_person+=1 print(one_person)
s542121766
p00377
u552594238
1545489073
Python
Python3
py
Runtime Error
0
0
312
friends=input() friends.split('') friends_all=friends[0] friends_cakes=friends[1] person=int(friends_all)+1 cakes=input() cakes_amount=0 for a in cakes.split(''): cakes_amount+=int(a) one_person=cakes_amount//person if cakes_amount%person!=0: one_person+=1 else: pass print(one_person)
s728396243
p00423
u051394180
1531287617
Python
Python
py
Runtime Error
0
0
432
import sys while(True): N = raw_input() if N == '': sys.exit() else: a_score = 0 b_score = 0 for i in range(int(N)): x, y = raw_input().split(' ') if x > y: a_score += (x + y) elif x < y: b_score += (x + y) elif x == y: a_score += x b_score += y print a_score,b_score
s861082006
p00423
u051394180
1531287787
Python
Python
py
Runtime Error
0
0
450
import sys while(True): N = raw_input() if N == '': sys.exit() else: a_score = 0 b_score = 0 for i in range(int(N)): x, y = [int(x) for x in raw_input().split(' ')] if x > y: a_score += (x + y) elif x < y: b_score += (x + y) elif x == y: a_score += x b_score += y print a_score,b_score
s800380251
p00423
u158338651
1532188970
Python
Python3
py
Runtime Error
0
0
302
n = input() a_cnt = 0 b_cnt = 0 for i in range(n) : arr = input().split(" ") num = [int(n) for n in arr] if num[0] > num[1] : a_cnt += sum(num) elif num[1] > num[0] : b_cnt += sum(num) else : a_cnt += num[0] b_cnt += num[0] print(f"{a_cnt} {b_cnt}")
s367158542
p00423
u158338651
1532189024
Python
Python3
py
Runtime Error
0
0
302
n = input() a_cnt = 0 b_cnt = 0 for i in range(n) : arr = input().split(" ") num = [int(m) for m in arr] if num[0] > num[1] : a_cnt += sum(num) elif num[1] > num[0] : b_cnt += sum(num) else : a_cnt += num[0] b_cnt += num[0] print(f"{a_cnt} {b_cnt}")
s876277793
p00423
u158338651
1532189224
Python
Python3
py
Runtime Error
0
0
303
n = input() a_cnt = 0 b_cnt = 0 for i in range(n) : arr = input().split(" ") num = [int(m) for m in arr] if num[0] > num[1] : a_cnt += sum(num) elif num[1] > num[0] : b_cnt += sum(num) else : a_cnt += num[0] b_cnt += num[0] print(f"{a_cnt} {b_cnt}")
s480073576
p00423
u745360181
1534924137
Python
Python3
py
Runtime Error
0
0
514
def main(): while 1: n = input() if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b)) if __name__ == "__main__": main()
s042093695
p00423
u745360181
1534924380
Python
Python3
py
Runtime Error
0
0
514
def main(): while 1: n = input() if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b)) if __name__ == "__main__": main()
s715430311
p00423
u745360181
1534925507
Python
Python3
py
Runtime Error
0
0
401
while 1: n = input() if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b))
s787799562
p00423
u745360181
1534925574
Python
Python3
py
Runtime Error
0
0
406
while 1: n = int(input()) if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b))
s334389477
p00423
u745360181
1534925650
Python
Python3
py
Runtime Error
0
0
409
while True: n = int(input()) if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b))
s364077424
p00423
u745360181
1534925755
Python
Python3
py
Runtime Error
0
0
398
while True: n = int(input()) if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print(sum_a,sum_b)
s967294201
p00423
u745360181
1534925895
Python
Python3
py
Runtime Error
0
0
319
while True: n = int(input()) if n == 0:break sum_a = sum_b = 0 for i in range(n): a,b = map(int, raw_input().split()) if a > b:sum_a = sum_a + a + b elif a < b:sum_b = sum_b + a + b else: sum_a = sum_a + a sum_b = sum_b + b print(sum_a,sum_b)
s778208007
p00423
u745360181
1534926066
Python
Python3
py
Runtime Error
0
0
397
while 1: n = input() if n == 0: break sum_a = 0 sum_b = 0 for i in range(n): a,b = map(int, input().split()) if a > b: sum_a = sum_a + a + b elif a < b: sum_b = sum_b + a + b elif a == b: sum_a = sum_a + a sum_b = sum_b + b print("%s %s" %(sum_a,sum_b))
s910981303
p00423
u396445852
1556039534
Python
Python3
py
Runtime Error
0
0
421
x = int(input()) score_A = 0 score_B = 0 ans = [] while x: for i in range(x): y = [int(i) for i in input().split()] if y[0] > y[1]: score_A += sum(y) elif y[0] < y[1]: score_B += sum(y) else: score_A += y[0] score_B += y[1] ans.append([score_A,score_B]) score_A = 0 ; score_B = 0 x = int(input() for i in ans: print(*i)
s360466547
p00423
u150414576
1408030685
Python
Python
py
Runtime Error
0
0
414
def run(infile, outfile): n = int(infile.readline()) if n == 0: break foo(infile,outfile,n) def foo(infile, outfile, n): ax = 0 #a's point bx = 0 for i in range(n): a , b = infile.readline().split() a = int(a) b = int(b) if a > b: ax += (a + b) elif b > a: bx += (a + b) else: assert False print >> outfile, ax , bx if __name__ == "__main__": import sys run(sys.stdin, sys.stdout)
s152751544
p00423
u607831289
1421943911
Python
Python
py
Runtime Error
0
0
358
# coding: utf8 while True: n = int(raw_input()) a_score, b_score = 0, 0 for i in range(n): a, b = map(int, raw_input().split()) if a > b: a_score += (a+b) elif a < b: b_score += (a+b) else: a_score += a b_score += b print a_score, b_score
s960574573
p00423
u110278902
1455716365
Python
Python
py
Runtime Error
0
0
401
a_score, b_score = 0, 0 while(True): input_list = map(int, raw_input(), split()) if len(input_list) == 1 and input_list[0] == 0: break elif len(input_list) == 1: print a_score, b_score a_score, b_score = 0, 0 elif len(input_list) == 2: a, b = input_list if a > b: a_score += a + b elif b > a: b_score += a + b else: a_score += a b_score += b
s779624392
p00423
u110278902
1455735232
Python
Python
py
Runtime Error
0
0
456
a_score, b_score = 0, 0 while(True): input_list = map(int, raw_input().split()) if len(input_list) == 1 and input_list == 0: break elif len(input_list) == 1 and input_list != 0: if a_score != 0 or b_score != 0: print a_score, b_score a_score, b_score = 0, 0 elif len(input_list) == 2: a, b = input_list if a > b: a_score += a + b elif b > a: b_score += a + b else: a_score += a b_score += b
s026637823
p00423
u529340193
1456304505
Python
Python
py
Runtime Error
0
0
349
import sys for i in sys.stdin: n = int(raw_input()) num_a = 0 num_b = 0 for j in range(n): ta, tb = map(int,raw_input().split()) if ta > tb: num_a += (ta+tb) elif ta < tb: num_b += (ta+tb) else: num_a += ta num_b += tb print "%d %d" % (num_a, num_b)
s412988201
p00423
u529340193
1456304544
Python
Python
py
Runtime Error
0
0
339
import sys for i in sys.stdin: n = int(i) num_a = 0 num_b = 0 for j in range(n): ta, tb = map(int,raw_input().split()) if ta > tb: num_a += (ta+tb) elif ta < tb: num_b += (ta+tb) else: num_a += ta num_b += tb print "%d %d" % (num_a, num_b)
s667658999
p00423
u073685357
1456812193
Python
Python
py
Runtime Error
0
0
1151
__Author__ = 'Anomino' # coding:UTF-8 def AskUser(number) : player_A, player_B = [], [] for value in range(0, number) : answer = raw_input() answer = answer.split( ) player_A.append(int(answer[0])) player_B.append(int(answer[1])) return player_A, player_B def CalcScore(player_A, player_B) : score_A, score_B = 0, 0 for value in range(0, len(player_A)) : if player_A[value] < player_B[value] : score_B = score_B + player_A[value] + player_B[value] elif player_A[value] > player_B[value] : score_A = score_A + player_A[value] + player_B[value] else : score_A = score_A + player_A[value] score_B = score_B + player_B[value] return score_A, score_B if __name__ == '__main__' : total_A, total_B = [], [] while (number = int(raw_input())) != 0 : player_A, player_B = AskUser(number) score_A, score_B = CalcScore(player_A, player_B) total_A.append(score_A) total_B.append(score_B) for value in range(0, len(total_A)) : print total_A[value], total_B[value]
s071045867
p00423
u894114233
1457500732
Python
Python
py
Runtime Error
0
0
631
a=[0]*10000 b=[0]*10000 ct=0 a_scores=[] b_scores=[] while True: a_score=0 b_score=0 n=input() if n==0: break else : for i in xrange(n): a[ct+i],b[ct+i]=map(int,raw_input().split()) if a[ct+i]>b[ct+i]: a_score+=a[ct+i]+b[ct+i] elif a[ct+i]==b[ct+i]: a_score+=a[ct+i] b_score+=b[ct+i] else: b_score+=b[ct+i]+a[ct+i] a_scores.append(a_score) b_scores.append(b_score) ct+=n for i in xrange(len(a_scores)): print a_scores[i],b_scores[i]
s371575983
p00423
u894114233
1457500980
Python
Python
py
Runtime Error
0
0
613
a=[0]*10000 b=[0]*10000 ct=0 a_scores=[] b_scores=[] while True: a_score=0 b_score=0 n=input() if n==0: break else : for i in xrange(n): a[ct+i],b[ct+i]=map(int,raw_input().split()) if a[ct+i]>b[ct+i]: a_score+=a[ct+i]+b[ct+i] elif a[ct+i]==b[ct+i]: a_score+=a[ct+i] b_score+=b[ct+i] else: b_score+=b[ct+i]+a[ct+i] a_scores.append(a_score) b_scores.append(b_score) ct+=n for i in xrange(len(a_scores)): print a_scores[i],b_scores[i]
s937968165
p00423
u894114233
1457501391
Python
Python
py
Runtime Error
0
0
506
a=[0]*10000 b=[0]*10000 ct=0 a_scores=[] b_scores=[] while True: a_score=0 b_score=0 n=input() if n==0: break else : for i in xrange(n): a[ct+i],b[ct+i]=map(int,raw_input().split()) if a[ct+i]>b[ct+i]: a_score+=a[ct+i]+b[ct+i] elif a[ct+i]==b[ct+i]: a_score+=a[ct+i] b_score+=b[ct+i] else: b_score+=b[ct+i]+a[ct+i] print a_score,b_score ct+=n
s121818328
p00423
u801346721
1479908794
Python
Python3
py
Runtime Error
0
0
232
n = int(input()) while n != 0: A = 0 B = 0 for i in range(n): a, b = map(int, input().split()) if a > b: A += a + b elif a < b: B += a + b else: A += a B += b print("{0} {1}".format(A, B)) n = int(input())
s909790603
p00423
u950411088
1482845415
Python
Python
py
Runtime Error
0
0
533
def main(): while True: n = int(input()) if n: aa,ba = 0,0 a,b = [None]*n,[None]*n for i in range(n): a[i],b[i] = map(int, input().split()) if a[i] > b[i]: aa += (a[i]+b[i]) elif a[i] < b[i]: ba += (a[i]+b[i]) else: aa += a[i] ba += b[i] print(aa,ba) else: break if __name__ == '__main__': main()
s966992814
p00423
u379499530
1487922761
Python
Python
py
Runtime Error
0
0
294
while true: n = input() if == 0: break score_a, score_b = 0, 0 for i in xrange(n): a, b = map(int, raw_input().split(" ")) if a > b: score_a += a + b elif a < b: score_b += a + b else: score_a += a score_b += b print "%d %d", (score_a, score_b)
s385054327
p00423
u546285759
1514507613
Python
Python
py
Runtime Error
0
0
255
while True: n = int(input()) if n == 0: break score = [0, 0] for _ in range(n): A, B = map(int, input().split()) if A == B: score += [A, B] else: score[A > B] += A+B print(*score)
s868439738
p00423
u150984829
1516999877
Python
Python3
py
Runtime Error
0
0
154
while 1: a=b=0;n=int(input()) if n: for i in[0]*n: s,t=map(int,input().split()) if s>t:a+=s+t elif s<t:b+=s+t else:a+=s;b+=t print(a,b)
s513295074
p00423
u150984829
1517000252
Python
Python3
py
Runtime Error
0
0
153
while 1: a=b=0;n=int(input()) if n==0:break for i in[0]*n: s,t=map(int,input().split()) b+=s if s<t else a+=s a+=t if s>t else b+=t print(a,b)
s807037710
p00423
u150984829
1517000994
Python
Python3
py
Runtime Error
0
0
173
import sys e=iter(sys.stdin) while 1: a=b=0;n=int(e) if n==0:break for i in[0]*n: s,t=map(int,e.split()) if s>t:a+=s+t elif s<t:b+=s+t else:a+=s;b+=t print(a,b)
s510735774
p00423
u600263347
1521104719
Python
Python3
py
Runtime Error
0
0
343
while True: n = int(input()) if n == 0: break a_score = 0 b_score = 0 for i in range(0,3): a,b = map(int,input().split()) if a > b : a_score += a+b elif a < b : b_score += a+b else: a_score += a b_score += a print(a_score,b_score)
s646705739
p00423
u575065019
1344867406
Python
Python
py
Runtime Error
0
0
490
import string a = 0 b = 0 while True: n = input() i = 0 if n != 0: while i != n: set = raw_input().split() set[0] = int(set[0]) set[1] = int(set[1]) if set[0] == set[1]: a += set[0] b += set[1] elif set[0] > set[1]: a += ( set[0] + set[1] ) else: b += ( set[0] + set[1] ) i += 1 print a,b else: n=0
s280233777
p00423
u575065019
1344867443
Python
Python
py
Runtime Error
0
0
476
a = 0 b = 0 while True: n = input() i = 0 if n != 0: while i != n: set = raw_input().split() set[0] = int(set[0]) set[1] = int(set[1]) if set[0] == set[1]: a += set[0] b += set[1] elif set[0] > set[1]: a += ( set[0] + set[1] ) else: b += ( set[0] + set[1] ) i += 1 print a,b else: n=0
s125743489
p00423
u779627195
1352280193
Python
Python
py
Runtime Error
0
0
399
while 1: n = input() a,b = (0,0) for i in range(n): x = map(int, raw_input().split()) if x[0] > x[1]: a += x[0] + x[1] elif x[0] < x[1]: b += x[0] + x[1] else: a += x[0] b += x[0] print str(a) + ' ' + str(b)
s222769937
p00423
u475051830
1372240786
Python
Python
py
Runtime Error
0
0
518
#include <stdio.h> int main(){ int a[1000], b[1000]; int sumA=0, sumB=0; int n; int i; while(1){ scanf("%d", &n); if(n==0) break; for(i=0; i<n; i++){ scanf("%d %d", &a[i], &b[i]); } /* for(i=0; i<n; i++){ printf("%d %d\n", a[i], b[i]); } */ for(i=0;i<n;i++){ if(a[i] > b[i]) sumA += a[i]+b[i]; if(a[i] < b[i]) sumB += a[i]+b[i]; if(a[i] == b[i]){ sumA += a[i]; sumB += b[i]; } } printf("%d %d\n", sumA, sumB); sumA = 0; sumB = 0; }; }
s933116844
p00423
u475051830
1372240871
Python
Python
py
Runtime Error
0
0
522
#include <stdio.h> int main(void){ int a[1000], b[1000]; int sumA=0, sumB=0; int n; int i; while(1){ scanf("%d", &n); if(n==0) break; for(i=0; i<n; i++){ scanf("%d %d", &a[i], &b[i]); } /* for(i=0; i<n; i++){ printf("%d %d\n", a[i], b[i]); } */ for(i=0;i<n;i++){ if(a[i] > b[i]) sumA += a[i]+b[i]; if(a[i] < b[i]) sumB += a[i]+b[i]; if(a[i] == b[i]){ sumA += a[i]; sumB += b[i]; } } printf("%d %d\n", sumA, sumB); sumA = 0; sumB = 0; }; }
s429048535
p00423
u966364923
1387230893
Python
Python
py
Runtime Error
0
0
352
def solve(): while 1: n = int(input()) if n==0: break score_a=0 score_b=0 while n>0: (a,b)=map(int, input().split()) if a>b: score_a = score_a + a + b elif a<b: score_b = score_b + a + b else: score_a = score_a + a score_b = score_b + b n = n-1 print(score_a, score_b) if __name__ == '__main__': solve()
s493703802
p00423
u229085388
1396355090
Python
Python
py
Runtime Error
0
0
262
n = 1 while n!=0: A = 0 B = 0 n = int(input()) if n == 0: break for i in range(n): [a, b] = map(int, input().split(' ')) if a > b: A += a+b elif a < b: B += a+b else: A += a B += b print('%d%s%d'%(A,' ',B))
s328871688
p00423
u229085388
1396355582
Python
Python
py
Runtime Error
0
0
238
while True: A, B = 0, 0 n = int(input()) if n==0 : break for i in range(n): a, b= map(int, input().split()) if a > b: A += a+b elif a < b: B += a+b else: A += a B += b print('%d %d'%(A,B))
s786085522
p00424
u150414576
1408035300
Python
Python
py
Runtime Error
0
0
608
def input_num(infile,outfile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline() x = dict.get(x,x) outfile.write(x) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin,sys.stdout) if n == 0: break dict = makedict(infile,outfile,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin,sys.stdout) replace(infile,outfile,dict,m)
s142295365
p00424
u150414576
1408035405
Python
Python
py
Runtime Error
0
0
617
def input_num(infile,outfile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline().sprit()[0] x = dict.get(x,x) outfile.write(x) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin,sys.stdout) if n == 0: break dict = makedict(infile,outfile,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin,sys.stdout) replace(infile,outfile,dict,m)
s427342344
p00424
u150414576
1408035632
Python
Python
py
Runtime Error
0
0
629
def input_num(infile,outfile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline().sprit()[0] x = dict.get(x,x) outfile.write(x) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin,sys.stdout) if n == 0: break dictionary = makedict(infile,outfile,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin,sys.stdout) replace(infile,outfile,dictionary,m)
s351367291
p00424
u150414576
1408035768
Python
Python
py
Runtime Error
0
0
635
def input_num(infile,outfile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline().sprit()[0] x = dict.get(x,x) outfile.write(x) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin,sys.stdout) if n == 0: break dictionary = makedict(infile,outfile,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin,sys.stdout) replace(sys.stdin,sys.stdout,dictionary,m)
s352968965
p00424
u150414576
1408035806
Python
Python
py
Runtime Error
0
0
641
def input_num(infile,outfile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline().sprit()[0] x = dict.get(x,x) outfile.write(x) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin,sys.stdout) if n == 0: break dictionary = makedict(sys.stdin,sys.stdout,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin,sys.stdout) replace(sys.stdin,sys.stdout,dictionary,m)
s617811194
p00424
u150414576
1408036436
Python
Python
py
Runtime Error
0
0
603
def input_num(infile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val return dict def replace(infile,outfile,dict,m): for i in range(m): x = infile.readline().sprit()[0] outfile.write(dict.get(x,x)) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin) if n == 0: break dictionary = makedict(sys.stdin,sys.stdout,n) # dict.update(makedict(infile,outfile,n)) m = input_num(sys.stdin) replace(sys.stdin,sys.stdout,dictionary,m)
s969319510
p00424
u150414576
1408036575
Python
Python
py
Runtime Error
0
0
463
def input_num(infile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val m = input_num(sys.stdin) for j in range(m): x = infile.readline().sprit()[0] outfile.write(dict.get(x,x)) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin) if n == 0: break dictionary = makedict(sys.stdin,sys.stdout,n)
s631925207
p00424
u150414576
1408036628
Python
Python
py
Runtime Error
0
0
450
def input_num(infile): num = int(infile.readline()) return num def makedict(infile,outfile,n): dict = {} for i in range(n): key,val = infile.readline().split() dict[key] = val m = input_num(sys.stdin) for j in range(m): x = infile.readline().sprit()[0] outfile.write(dict.get(x,x)) print >> outfile if __name__ == "__main__" import sys while True: n = input_num(sys.stdin) if n == 0: break makedict(sys.stdin,sys.stdout,n)
s933387622
p00424
u071744613
1431837079
Python
Python
py
Runtime Error
0
0
306
while True: n=input() if n==0: break else: listb=[] listc=[] for a in range(1, n+1): b,c=map(int,raw_input().split()) listb.append(b) listc.append(c) m=input() for d in range(1,m+1): e=input() if e in listb: f=listb.index(e) print listc[f] else: print e
s395202124
p00424
u071744613
1431838128
Python
Python
py
Runtime Error
0
0
380
while True: n=input() if n==0: break else: listb=[] listc=[] for a in range(1, n+1): b,c=map(int,raw_input().split()) listb.append(b) listc.append(c) m=input() listA=[] for d in range(1,m+1): e=input() if e in listb: f=listb.index(e) listA.append(listc[f]) else: listA.append(e) Answer = "".join(map(str, listA)) print Answer
s634940587
p00424
u071744613
1431838672
Python
Python
py
Runtime Error
0
0
380
while True: n=input() if n==0: break else: listb=[] listc=[] for a in range(1, n+1): b,c=map(int,raw_input().split()) listb.append(b) listc.append(c) m=input() listA=[] for d in range(1,m+1): e=input() if e in listb: f=listb.index(e) listA.append(listc[f]) else: listA.append(e) Answer = "".join(map(str, listA)) print Answer
s782362577
p00424
u071744613
1431840051
Python
Python
py
Runtime Error
0
0
317
while True: n=input() if n==0: break else: dic={} for a in range(1, n+1): b,c=map(int,raw_input().split()) dic[b]=c m=input() listA=[] for d in range(1,m+1): e=input() if e in dic: listA.append(dic[e]) else: listA.append(e) Answer = "".join(map(str, listA)) print Answer
s517945652
p00424
u071744613
1431840285
Python
Python
py
Runtime Error
0
0
293
while True: n=input() if n==0: break else: dic={} for a in range(1, n+1): b,c=map(int,raw_input().split()) dic[b]=c listA=[] for d in range(1,input()+1): e=input() if e in dic: listA.append(dic[e]) else: listA.append(e) print "".join(map(str, listA))
s427218113
p00424
u110278902
1456569957
Python
Python
py
Runtime Error
0
0
348
while(1): table, output = [], [] table_number = input() string = '' for i in table_number: table.append(raw_input().split()) string_number = input() for i in string_number: string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s987356365
p00424
u110278902
1456569966
Python
Python
py
Runtime Error
0
0
348
while(1): table, output = [], [] table_number = input() string = '' for i in table_number: table.append(raw_input().split()) string_number = input() for i in string_number: string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s259855061
p00424
u110278902
1456570455
Python
Python
py
Runtime Error
0
0
382
while(1): table, output = [], [] table_number = input() string = '' if table_number == 0: break for i in table_number: table.append(raw_input().split()) string_number = input() for i in string_number: string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s263482955
p00424
u110278902
1456570511
Python
Python
py
Runtime Error
0
0
370
while(1): table = {} output = '' table_number = input() if table_number == 0: break for i in table_number: table.append(raw_input().split()) string_number = input() for i in string_number: string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s867966492
p00424
u110278902
1456570516
Python
Python
py
Runtime Error
0
0
370
while(1): table = {} output = '' table_number = input() if table_number == 0: break for i in table_number: table.append(raw_input().split()) string_number = input() for i in string_number: string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s517700751
p00424
u110278902
1456570611
Python
Python
py
Runtime Error
0
0
389
while(1): table = {} output = '' table_number = input() if table_number == 0: break for i in range(table_number): a, b = raw_input().split() table[a] = b string_number = input() for i in (string_number): string = input() for table_element in table: if tabole_element[0] == string: string =table_element[1] output += string print output
s195946636
p00424
u110278902
1456570721
Python
Python
py
Runtime Error
0
0
352
while(1): table = {} output = '' table_number = input() if table_number == 0: break for i in range(table_number): a, b = raw_input().split() table[a] = b string_number = input() for i in (string_number): string = input() if string in table: output += table[string] else: output += string print output
s366051677
p00424
u110278902
1456570787
Python
Python
py
Runtime Error
0
0
362
while(1): table = {} output = '' table_number = int(input()) if table_number == 0: break for i in range(table_number): a, b = raw_input().split() table[a] = b string_number = int(input()) for i in (string_number): string = input() if string in table: output += table[string] else: output += string print output