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
s506167374
p00092
u811733736
1503376195
Python
Python3
py
Runtime Error
600
9180
3636
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092 """ import sys def find_square0(data): max_size = 0 lmap = [] # dp??¨???2?¬?????????? # '.'????????????0??????'*'????????????1???????????? for row in data: temp = [] for c in row: if c...
s234463879
p00092
u811733736
1503883301
Python
Python3
py
Runtime Error
0
0
3160
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092 """ import sys def find_square0(data): max_size = 0 dp = [] # dp??¨???2?¬?????????? # '.'????????????1??????'*'????????????0???????????? for row in data: temp = [] for c in row: if c =...
s138758294
p00092
u633068244
1393862635
Python
Python
py
Runtime Error
0
0
467
n = int(raw_input()) s = [[] for i in range(n)] flag = 0 for i in range(n): s[i] = raw_input() for i in range(n,1,-1): for j in range(n-i+1): for k in range(n-i+1): out = "" for l in range(i): for m in range(i): out += s[j+l][k+m] i...
s092216690
p00092
u633068244
1393863082
Python
Python
py
Runtime Error
0
0
662
while True: n = int(raw_input()) if n == 0: break s = [[] for i in range(n)] flag = 0 for i in range(n): s[i] = raw_input() for i in range(n,1,-1): for j in range(n-i+1): for k in range(n-i+1): out = "" for l...
s313148355
p00092
u633068244
1393863566
Python
Python
py
Runtime Error
0
0
656
while True: n = int(raw_input()) if n == 0: break s = [[] for i in range(n)] for i in range(n): s[i] = raw_input() for i in range(n,0,-1): for j in range(n-i+1): for k in range(n-i+1): flag = 0 for l in range(i): ...
s605631808
p00092
u633068244
1396089665
Python
Python
py
Runtime Error
0
0
383
l = {".":1,"*":0} def x(a): m=0 for c in N: p=[0]*n for e in range(c,n): for r in N: p[r]+=l[a[r][e]] m=max(P(p),m) return m def P(a): m = 0 for i in N: m+=l[a[i]] return m while True: n = input() if n == 0: break N = r...
s915596331
p00093
u912237403
1413923869
Python
Python
py
Runtime Error
0
0
221
f=0 while 1: a, b = map(int, raw_input().split()) if a==b==0: break x = [i for i in range(a, b+1) if (i%4 == 0 and (i%100 != 0 or i%400 == 0))] if x==[]: x=["NA"] if f: print for e in x: print e f=1
s788163978
p00093
u647766105
1429611333
Python
Python3
py
Runtime Error
0
0
243
from calendar import isleap f = lambda x: map(str, x) if x else ["NA"] ans = [] while True: a, b = map(int, raw_input().split()) if b == 0: break ans += f(filter(isleap, xrange(a, b+1))) + [""] print("\n".join(ans).strip())
s890180512
p00093
u647766105
1429611358
Python
Python3
py
Runtime Error
0
0
238
from calendar import isleap f = lambda x: map(str, x) if x else ["NA"] ans = [] while True: a, b = map(int, input().split()) if b == 0: break ans += f(filter(isleap, range(a, b+1))) + [""] print("\n".join(ans).strip())
s970388684
p00093
u765849500
1466174916
Python
Python
py
Runtime Error
0
0
275
line = False while True: a,b = map(int, raw_input().split()) if line: print "" line = True count = 0 for i in range(a, b+1): if (i % 4 == 0 and i % 100 != 0) or i % 400 == 0: print i count += 1 if count == 0: print "NA"
s839167615
p00093
u453324819
1478079072
Python
Python3
py
Runtime Error
0
0
353
<?php $jikan = 0; while(true) { $cnt = 0; $stdin = trim(fgets(STDIN)); if($stdin === '0 0') { break; } $years = explode(' ', $stdin); for ($i=$years[0]; $i < $years[1]; $i++) { if($i%4 === 0 && $i%100 !== 0 || $i%400 === 0) { print($i . "\n"); $cnt++; } } if ($cnt == 0){ pri...
s904737371
p00093
u584779197
1495952855
Python
Python
py
Runtime Error
0
0
236
year = input() bb = year.split(' ') a = bb[0] b = bb[1] ans = 0 for i in range(a,b+1): if i%4==0: ans += 1 if 1%100==0: ans -= 1 if 1%400==0: ans += 1 if ans == 0: print('NA') else: print(ans)
s826333919
p00093
u519227872
1497528901
Python
Python3
py
Runtime Error
0
0
329
f = set(range(0,3000,4)) h = set(range(0,3000,100)) fh = set(range(0,3000,400)) lp = (f -h).union(fh) while True: f,l = list(map(int, input().split())) if f == 0 and l == 0: break t = set(range(f,l+1)) it = sorted(list(lp.intersection(t))) for y in t: print(y) if lent(it) == 0: print('NA') pr...
s371606747
p00093
u546285759
1503641644
Python
Python3
py
Runtime Error
0
0
155
from calender import isleap while True: a, b = map(int, input().split()) if a == 0: break print(sum(isleap(i) for i in range(a, b+1)))
s270545103
p00093
u150984829
1522356976
Python
Python3
py
Runtime Error
0
0
165
b=0 for e in iter(input,'0 0'): if b:print() b=u=1 s,t=map(int,e.split()) for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0:print(y);u=0 if u:print('NA')
s124393553
p00093
u150984829
1522357477
Python
Python3
py
Runtime Error
0
0
159
p=print b=0 for e in iter(input,'0 0'): if b:p() b=f=1;s,t=map(int,e.split()) for y in range(s,t+1): if(y%4==0)*(y%100)or y%400==0:p(y);f=0 if u:p('NA')
s185302090
p00093
u735362704
1355888939
Python
Python
py
Runtime Error
0
0
767
[year for year in xrange(2000, 2100 + 1) if (year % 4 ==0) and (year % 100 != 0)] #!/usr/bin/env python # coding: utf-8 import sys def is_bis_year(year): if (year % 4 == 0) and (year % 100 != 0): return True elif (year % 400 == 0): return True return False def main(): params = [] while 1: ...
s162794609
p00093
u776234460
1367475561
Python
Python
py
Runtime Error
0
0
501
import sys a = int(sys.argv[1]) b = int(sys.argv[2]) flag = False if a < 0 or a > b or a > 3000 or b > 3000: print "exit" sys.exit() for y in range(a, b + 1): if y % 4 == 0: if y % 100 == 0 and y % 400 == 0: print y flag = T...
s748798630
p00093
u776234460
1367475587
Python
Python
py
Runtime Error
0
0
500
import sys a = int(sys.argv[1]) b = int(sys.argv[2]) flag = False if a < 0 or a > b or a > 3000 or b > 3000: print "exit" sys.exit() for y in range(a, b + 1): if y % 4 == 0: if y % 100 == 0 and y % 400 == 0: print y flag = T...
s681841792
p00093
u776234460
1367475673
Python
Python
py
Runtime Error
0
0
498
import sys a = int(sys.argv[1]) b = int(sys.argv[2]) flag = False if a < 0 or a > b or a > 3000 or b > 3000: print "exit" sys.exit() for y in range(a, b + 1): if y % 4 == 0: if y % 100 == 0 and y % 400 == 0: print y flag = T...
s523183028
p00094
u442166898
1454569410
Python
Python
py
Runtime Error
0
0
112
if __name__=="__main__": a=int(raw_input()) b=int(raw_input()) a=a*b print a/3.305785
s171527852
p00094
u376883550
1456705629
Python
Python
py
Runtime Error
0
0
47
print eval(raw_input().replace(' ','*')/3.30578
s239458231
p00094
u811773570
1459168943
Python
Python3
py
Runtime Error
0
0
76
#coding:utf-8 a, b = map(int, raw_input(). split()) print(a * b / 3.305785)
s273343005
p00094
u606989659
1490773048
Python
Python3
py
Runtime Error
0
0
56
def tsubo(a,b): return (a * b) / 3.305785 tsubo(a,b)
s657496271
p00094
u606989659
1490773201
Python
Python3
py
Runtime Error
0
0
69
def tsubo(a,b): return (a * b) / 3.305785 S = tsubo(a,b) print(S)
s969249636
p00094
u606989659
1490774345
Python
Python3
py
Runtime Error
0
0
70
def tsubo(x,y): return (x * y) / 3.305785 S = tsubo(a,b) print(S)
s476433268
p00094
u519227872
1498837954
Python
Python3
py
Runtime Error
0
0
65
a,b = map(float,raw_input().split(' ')) print((a * b) / 3.305785)
s124212761
p00094
u230836528
1366800934
Python
Python
py
Runtime Error
0
0
80
#coding: utf-8 A = map(int, input().split()) S = A[0] * A[1] print S / 3.305785
s335119421
p00094
u230836528
1366801140
Python
Python
py
Runtime Error
0
0
102
sA = raw_input() idx = sA.index(" ") a = int(sA[:idx]) b = int(sA[idx+1:] S = a * b print S / 3.305785
s368556064
p00095
u912237403
1413985677
Python
Python
py
Runtime Error
0
0
132
n=input() a0,v0=inf,0 for i in range(n): a,v=map(int,raw_input().split()) if v>v0: a0,v0=a,v elif v=v0: a0=min(a0,a) print a,v
s563357548
p00095
u912237403
1413985713
Python
Python
py
Runtime Error
0
0
130
n=input() a0,v0=n,0 for i in range(n): a,v=map(int,raw_input().split()) if v>v0: a0,v0=a,v elif v=v0: a0=min(a0,a) print a,v
s468696037
p00095
u463990569
1452945480
Python
Python3
py
Runtime Error
0
0
297
from operator import itemgetter from collections import OrderedDict n, q = [int(el) for el in input().split(' ')] data = OrderedDict({i:0 for i in range(n,0,-1)}) for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a] += v print(*max(data.items(), key=itemgetter(1)))
s632842833
p00095
u463990569
1452945760
Python
Python3
py
Runtime Error
0
0
264
from operator import itemgetter from collections import OrderedDict n = int(input()) data = OrderedDict({i:0 for i in range(n,0,-1)}) for _ in range(n): a, v = [int(el) for el in input().split(' ')] data[a] += v print(*max(data.items(), key=itemgetter(1)))
s133594988
p00095
u463990569
1452945992
Python
Python3
py
Runtime Error
0
0
174
n = int(input()) data = [0] * n for _ in range(n): a, v = [int(el) for el in input().split(' ')] data[a-1] += v result = max(data) print(data.index(result)+1, result)
s799083832
p00095
u519227872
1497452381
Python
Python3
py
Runtime Error
0
0
213
from operator import itemgetter n = int(input()) rs = [list(map(int(),input().split())) for i in range(n)] rs = sorted(rs,key=itemgetter(0)) print(' '.join(map(str, sorted(rs, key=itemgetter(1),reverse=True)[0])))
s853249821
p00095
u150984829
1522359154
Python
Python3
py
Runtime Error
0
0
123
d={} for _ in[0]*int(input()): a,v=map(int,input().split()) d[a]=v m=max(d.items(),key=lambda x:x[1]) print(min(d[m]),m)
s312011410
p00095
u150984829
1522359184
Python
Python3
py
Runtime Error
0
0
126
d={} for _ in[0]*int(input()): a,v=map(int,input().split()) d[a]=v m=max(d.items(),key=lambda x:x[1])[0] print(m,min(d[m]))
s252953182
p00095
u230836528
1366801766
Python
Python
py
Runtime Error
0
0
310
# coding: utf-8 n = input() A = [] for i in xrange(n): A.append( map(int, raw_input().split()) ) Max = -1 Maxidx = -1 for i in xrange(n): if Max < A[i][1]: Max = A[i][1] Maxidx = i elif Max = A[i][1] and A[Maxidx][0] > A[i][0]: Maxidx = i print A[Maxidx][0], A[Maxidx][1]
s536115046
p00095
u491763171
1396405374
Python
Python
py
Runtime Error
0
0
132
L = [] for i in range(input()): L.append(map(int, raw_input().split())) print "%d %d" % sorted(L, key=lambda a:(-a[1], a[0]))[0]
s320637656
p00096
u912237403
1414032213
Python
Python
py
Runtime Error
20
4240
148
import sys n=1001 a=range(1,n) a+=[n]+a[::-1] for n in map(int,sys.stdin): x=0 for i in range(max(0,n-2000),n+1): x+=a[i]*a[n-i] print x
s485033425
p00096
u912237403
1414066101
Python
Python
py
Runtime Error
20
4244
148
import sys n=1001 a=range(1,n) a+=[n]+a[::-1] for n in map(int,sys.stdin): x=0 for i in range(max(0,n-2000),n+1): x+=a[i]*a[n-i] print x
s128145265
p00096
u912237403
1414095451
Python
Python
py
Runtime Error
0
0
145
n=1001 a=range(1,n) a+=[n]+a[::-1] for n in map(int,sys.stdin): x=0 for i in range(max(0,n-2000),min(n,2000)+1): x+=a[i]*a[n-i] print x
s954669243
p00096
u462831976
1493491114
Python
Python3
py
Runtime Error
4030
7732
343
# -*- coding: utf-8 -*- import sys import os import math for s in sys.stdin: n = int(s) T = [0] * 2001 for a in range(1001): for b in range(1001): T[a+b] += 1 sum_n_num = 0 for a_b_sum in range(0, n+1): c_d_sum = n - a_b_sum sum_n_num += T[a_b_sum] * T[c_d_sum...
s039915514
p00096
u462831976
1493491520
Python
Python
py
Runtime Error
0
0
336
for s in sys.stdin: n = int(s) T = [0] * 2001 for a in range(1001): for b in range(1001): T[a+b] += 1 sum_n_num = 0 for a_b_sum in range(0, n+1): c_d_sum = n - a_b_sum if a_b_sum <= 2000 and c_d_sum <= 2000: sum_n_num += T[a_b_sum] * T[c_d_sum] ...
s425358622
p00096
u352394527
1527627028
Python
Python3
py
Runtime Error
20
5792
243
two_dict = {} for i in range(2001): two_dict[i] = min(i, 2000 - i) + 1 while True: try: n = int(input()) ans = 0 for i in range(n + 1): ans += two_dict[i] * two_dict[n - i] print(ans) except EOFError: break
s836351514
p00096
u136916346
1528808757
Python
Python3
py
Runtime Error
20
5668
129
import sys,math f=lambda x:math.factorial(x) [print(i) for i in [int(f(int(l[:-1])+3)/f(3)/f(int(l[:-1]))) for l in sys.stdin]]
s196221988
p00096
u136916346
1528809980
Python
Python3
py
Runtime Error
20
5672
129
import sys,math f=lambda x:math.factorial(x) [print(i) for i in [int(f(int(l[:-1])+3)/f(3)/f(int(l[:-1]))) for l in sys.stdin]]
s078627188
p00096
u230836528
1366802394
Python
Python
py
Runtime Error
0
0
273
# coding: utf-8 def nCr(n, r): ret = 1 for i in xrange(r): ret *= (n-i) ret /= (i+1) return ret A = [] while True: sA = raw_input() if not sA: break A.append( int(sA) ) for i in xrange( len(A) ): print nCr( A[i]+3, 3 )
s908651306
p00096
u230836528
1366802540
Python
Python
py
Runtime Error
0
0
282
# coding: utf-8 def nCr(n, r): ret = 1 for i in xrange(r): ret *= (n-i) ret /= (i+1) return ret A = [] for i in xrange(50): sA = raw_input() if not sA: break A.append( int(sA) ) for i in xrange( len(A) ): print nCr( A[i]+3, 3 )
s596501927
p00096
u633068244
1393956827
Python
Python
py
Runtime Error
0
0
11
while True:
s285589176
p00096
u633068244
1394000909
Python
Python
py
Runtime Error
0
0
273
import sys def N(n): return (n+1)*(n+2)*(n+3)/6 for n in sys.stdin: n = int(raw_input()) if n > 2000: n = 4000 - n if n < 1001: print N(n) else: m = n - 1000 print N(n) - (N(2*m) - m - 1)/2
s538090778
p00097
u879226672
1425442789
Python
Python
py
Runtime Error
0
0
611
while True: try: n,s = map(int,raw_input().split()) except EOFError: break if (n,s) == (0,0): break if s == 0 or s == 1 or s == 2: else: ls = set([]) for k in range(s): for l in range(1,s): if k + l > s: ...
s714805597
p00097
u489809100
1447774291
Python
Python
py
Runtime Error
0
0
231
import itertools while True: n,s = map(int,raw_input().split()) if n == 0 and s == 0: break num = list(itertools.combinations(xrange(101), n)) count = 0 for var in num: if sum(var) == s: count += 1 print count
s153456725
p00097
u813384600
1383746355
Python
Python
py
Runtime Error
0
0
252
dp = [[0] * 1001 for i in range(11)] dp[0][0] = 1 for i in range(101): for j in range(9, -1, -1): for k in range(0, 1001 - i): dp[j + 1][k + i] += dp[j][k] while True: n, s = map(int, raw_input().split()) print dp[n][s]
s322379196
p00097
u260980560
1397481488
Python
Python
py
Runtime Error
0
0
499
memo = [[[-1 for i in xrange(101)] for j in xrange(10)] for k in xrange(1001)] def dfs(rest, now, cnt): if rest==0 and now==0: return 1 if now==0 or cnt==-1: return 0 if memo[rest][now][cnt]!=-1: return memo[rest][now][cnt] memo[rest][now][cnt] = 0 for i in xrange(min(cnt, re...
s203531064
p00099
u260980560
1443601213
Python
Python
py
Runtime Error
0
0
689
class SegmentTree: def __init__(self, n): n_ = 1 while n_ < n: n_ *= 2 self.n = n_ self.data = [[0, -n_] for i in xrange(2*n_)] def add(self, k, a): idx = k + (self.n-1) data = self.data data[idx] = [data[idx][0] + a, -k] print data, idx, data[idx...
s476148805
p00099
u260980560
1443601469
Python
Python
py
Runtime Error
0
0
610
class SegmentTree: def __init__(self, n): n_ = 1 while n_ < n: n_ *= 2 self.n = n_ self.data = [(0, -n_-1)] * (2*n_) def add(self, k, a): idx = k + (self.n-1) data = self.data data[idx] = (data[idx][0] + a, -k) while idx: idx = (idx - ...
s249199137
p00099
u766477342
1444141145
Python
Python3
py
Runtime Error
0
0
573
n, q = list(map(int, input().split())) cnt = [0 for _ in range(n + 1)] cnt[0] = -1 mx = [0, -1] for _ in range(q): a, v = list(map(int, input().split())) cnt[a] += v if mx[0] == a and v > 0: mx[1] += v elif mx[0] == a and v < 0: def spam(): max_v = max(cnt) idx =...
s319946515
p00099
u766477342
1444141453
Python
Python3
py
Runtime Error
0
0
543
n, q = list(map(int, input().split())) cnt = [0 for _ in range(n + 1)] cnt[0] = -1 mx = [0, -1] def spam(): max_v = max(cnt) idx = min([i for i, value in enumerate(cnt) if value == max_v]) return idx, max_v for _ in range(q): a, v = list(map(int, input().split())) cnt[a] += v if mx[0] == a an...
s566254758
p00099
u766477342
1444141859
Python
Python3
py
Runtime Error
0
0
561
n, q = list(map(int, input().split())) cnt = [0 for _ in range(n + 1)] cnt[0] = -1 mx = [0, -1] def spam(): # max_v = max(cnt) # idx = min([i for i, value in enumerate(cnt) if value == max_v]) # return idx, max_v return 1,1 for _ in range(q): a, v = list(map(int, input().split())) cnt[a] += v ...
s218060094
p00099
u463990569
1452947133
Python
Python
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s601747195
p00099
u463990569
1452947151
Python
Python
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s076078959
p00099
u463990569
1452947271
Python
Python
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s667386160
p00099
u463990569
1452947291
Python
Python
py
Runtime Error
0
0
248
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v result = max(data) print(data.index(result)+1, result) ex_result = result
s343338720
p00099
u463990569
1452947309
Python
Python3
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s282460228
p00099
u463990569
1452947312
Python
Python3
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s258184935
p00099
u463990569
1452947391
Python
Python3
py
Runtime Error
0
0
303
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v < 0: result = ex_result else: result = max(data) print(data.index(result)+1, result) ex_result = result
s553904387
p00099
u463990569
1452949311
Python
Python3
py
Runtime Error
0
0
537
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result, exx_result = 0,0 ex_index = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if ex_index != a: if v < 0: result = ex_result else: result = max(ex_result, data[a-1]) elif ex_index == a...
s490399122
p00099
u463990569
1452949529
Python
Python3
py
Runtime Error
0
0
537
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result, exx_result = 0,0 ex_index = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if ex_index != a: if v < 0: result = ex_result else: result = max(ex_result, data[a-1]) elif ex_index == a...
s026405578
p00099
u463990569
1452949607
Python
Python3
py
Runtime Error
0
0
536
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result,exx_result = 0,0 ex_index = 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if ex_index != a: if v < 0: result = ex_result else: result = max(ex_result, data[a-1]) elif ex_index == a:...
s625375989
p00099
u463990569
1452950001
Python
Python3
py
Runtime Error
30
7772
634
n, q = [int(el) for el in input().split(' ')] data = [0] * n ex_result, exx_result = 0, 0 ex_index, exx_index = 0, 0 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if ex_index != a: if v < 0: result = ex_result else: result = max(ex_result, data[a-1]) el...
s110207452
p00099
u027872723
1476705317
Python
Python3
py
Runtime Error
0
0
289
#-*- coding: utf_8 -*- a = [int(x) for x in input().split()] n, q = a[0], a[1] memo = [0] * n for i in range(q): debug(memo) nq = [int(x) for x in input().split()] a, v = nq[0] - 1, nq[1] memo[a] += v mx = max(memo) print(str(memo.index(mx) + 1) + " " + str(mx))
s848386417
p00099
u266872031
1482677247
Python
Python
py
Runtime Error
10
6464
419
import bisect from math import modf [n,q]=map(int,raw_input().split()) decp=1./(n+2) A=[0 for i in range(n+1)] B=[1-decp*(i+1) for i in range(n)] for i in range(q): [a,v]=map(int,raw_input().split()) pp=A[a]+ (1-decp*(a+1)) A[a]+=v remind=bisect.bisect_left(B,pp) B.pop(remind) bisect.insort(B,...
s038553195
p00099
u266872031
1482677689
Python
Python
py
Runtime Error
10
6468
431
import bisect from math import modf [n,q]=map(int,raw_input().split()) decp=1./(n+2) A=[0 for i in range(n+1)] B=[1-decp*(i+1) for i in range(1,n+1)] B.sort() for i in range(q): [a,v]=map(int,raw_input().split()) pp=A[a]+ (1-decp*(a+1)) A[a]+=v remind=bisect.bisect_left(B,pp) B.pop(remind) bise...
s896104521
p00099
u266872031
1482677966
Python
Python
py
Runtime Error
10
6468
431
import bisect from math import modf [n,q]=map(int,raw_input().split()) decp=1./(n+2) A=[0 for i in range(n+1)] B=[1-decp*(i+1) for i in range(1,n+1)] B.sort() for i in range(q): [a,v]=map(int,raw_input().split()) pp=A[a]+ (1-decp*(a+1)) A[a]+=v remind=bisect.bisect_left(B,pp) B.pop(remind) bise...
s765578406
p00099
u546285759
1492841702
Python
Python3
py
Runtime Error
0
0
348
n, q = map(int, input().split()) n = [0]*(n+1) maxv = winner = 0 for _ in range(q): a, v = map(int, input().split()) n[a] += v if v < 0: maxv, winner = max(n), n.index(maxv) else: if n[a] > maxv: maxv, winner = n[a], a elif n[a] == maxv: winner = n.index(m...
s131132109
p00099
u868716420
1496969662
Python
Python3
py
Runtime Error
0
0
250
from collections import deque n, q = [int(_) for _ in input().split()] book = deque() for _ in range(n+1) : book.append(0) for _ in range(q) : a, v = [int(_2) for _2 in input().split()] book[a] += v print(book.index(max(book)), max(book))
s354738212
p00099
u868716420
1496969777
Python
Python3
py
Runtime Error
0
0
250
from collections import deque n, q = [int(_) for _ in input().split()] book = deque() for _ in range(n+1) : book.append(0) for _ in range(q) : a, v = [int(_2) for _2 in input().split()] book[a] += v print(book.index(max(book)), max(book))
s954450917
p00099
u868716420
1496990162
Python
Python3
py
Runtime Error
30
7684
223
from array import array n, q = [int(_) for _ in input().split()] book = array('b', [0] * (n+1)) for _ in range(q) : a, v = [int(_2) for _2 in input().split()] book[a] += v print(book.index(max(book)), max(book))
s428094323
p00099
u868716420
1496991490
Python
Python3
py
Runtime Error
20
7672
453
from array import array n, q = [int(_) for _ in input().split()] book = array('b', [0] * (n+1)) max_per, max_val = n, 0 for _ in range(q) : a, v = [int(_2) for _2 in input().split()] book[a] += v if 0 <= v : if max_val < book[a] : max_per, max_val = a, book[a] elif max_val == book[a] and a <...
s869901623
p00099
u868716420
1497012887
Python
Python3
py
Runtime Error
20
7700
648
from sys import stdin n = [int(_) for _ in input().split()] book = [0]*(n[0]+1) max_per, max_val = [int(_) for _ in input().split()] book[max_per] += max_val print(max_per, max_val) for _ in stdin.read().splitlines() : a = [int(_2) for _2 in _.split()] book[a[0]] += a[1] if a[1] < 0 : for _2 in [N...
s612191459
p00099
u868716420
1497013189
Python
Python3
py
Runtime Error
20
7696
651
from sys import stdin n = [int(_) for _ in input().split()] book = [0]*(n[0]+1) max_per, max_val = [int(_) for _ in input().split()] book[max_per] += max_val print(max_per, max_val) for _ in stdin.read().splitlines() : a = [int(_2) for _2 in _.split()] book[a[0]] += a[1] if a[1] < 0 : for _2 in [N...
s073100777
p00099
u868716420
1497013696
Python
Python3
py
Runtime Error
30
7716
645
from sys import stdin n = [int(_) for _ in input().split()] book = [0]*(n[0]+1) max_per, max_val = [int(_) for _ in input().split()] book[max_per] += max_val print(max_per, max_val) for _ in stdin.read().splitlines() : a = [int(_2) for _2 in _.split()] book[a[0]] += a[1] if a[1] < 0 : for _2 in [N...
s691756483
p00099
u150984829
1522364687
Python
Python3
py
Runtime Error
0
0
205
n,q=map(int,input().split()) s=[0]*-~n w=m=0 for _ in[0]*q: a,v=map(int,input().split()) s[a]+=v if v<0 and a==w:m=max(s),w=s.index(m) elif s[a]>maxv:w,m=a,s[a] elif s[a]==maxv:w=min(w,a) print(w,m)
s113965153
p00099
u150984829
1522364711
Python
Python3
py
Runtime Error
0
0
205
n,q=map(int,input().split()) s=[0]*-~n w=m=0 for _ in[0]*q: a,v=map(int,input().split()) s[a]+=v if v<0 and a==w:m=max(s);w=s.index(m) elif s[a]>maxv:w,m=a,s[a] elif s[a]==maxv:w=min(w,a) print(w,m)
s814583547
p00099
u782850731
1382185767
Python
Python
py
Runtime Error
20
4616
651
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit from collections import Counter def keyfunc(data): return (data[1], -data[0]) def main(readline=stdin.readline): n, q = (int(s) for s in readline().split()) base = tuple([i+1, 0] for i in range(n)) mid...
s038599327
p00099
u782850731
1382190360
Python
Python
py
Runtime Error
20
4300
1066
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit, maxsize def main(readline=stdin.readline): n, q = (int(s) for s in readline().split()) base = [0] * n midway = [(1, -maxsize)] * (n//100 + 1) last = [(1, -maxsize)] * (n//10000 + 1) for _ in range(...
s559478438
p00099
u782850731
1382192249
Python
Python
py
Runtime Error
20
4264
798
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit, maxsize def main(readline=stdin.readline): n, q = (int(s) for s in readline().split()) base = [0] * n midway = [0] * (n//1000 + 1) for _ in range(q): a, v = (int(s) for s in readline().split())...
s483336810
p00099
u633068244
1395930771
Python
Python
py
Runtime Error
0
0
183
n, q = map(int, raw_input().split()) s = [0 for i in range(n)] a = [map(int, raw_input().split()) for i in range(q)] for r in a: s[r[0]] += r[1] mx = max(s) print s.index(mx)+1, mx
s258278632
p00100
u912237403
1414916584
Python
Python
py
Runtime Error
0
0
258
while 1: n=input() if n==0: break D={} A=[] for _ in range(n): a,b,c=map(int, raw_input().split(' ')) if a in D: D[a]+=b*c else: D[a]=b*c A.append(a) B=[i for i in A: if D[i]>=1e6] if B=[]: B=["NA"] for e in B: print e
s207204737
p00100
u672822075
1419152103
Python
Python3
py
Runtime Error
0
0
324
while True: n=int(input()) if n: a=[list(map(int,input().split())) for _ in range(n)] b={} for i in range(n): if a[i][0] in b: b[a[i][0]]+=a[i][1]*a[i][2] else: b[a[i][0]]=a[i][1]*a[i][2] for k in b.keys(): if b[k]>=1000000: print(k) if max(k.values())<1000000: print("NA") else: b...
s714337273
p00100
u672822075
1419283248
Python
Python3
py
Runtime Error
0
0
273
while True: n=int(input()) if n==0: break l=[] d={} for i in range(n): i,p,q=list(map(int,input().split())) if a in d: d[a]+=b*c else: d[a]=b*c l.append(a) if max(d.values())<1000000: print("NA") else: for k in l: if d[k]>=1000000: print(k)
s160121553
p00100
u580607517
1427627863
Python
Python
py
Runtime Error
0
0
122
n = int(raw_input()) for i in range(n): x, y, z = map(int, raw_input()) if y*z >= 1000000: print x else: print "NA"
s722027193
p00100
u580607517
1427628054
Python
Python
py
Runtime Error
0
0
158
while 1: n = int(raw_input()) if n == 0: break for i in range(n): x, y, z = map(int, raw_input()) if y*z >= 1000000: print x else: print "NA"
s093588090
p00100
u580607517
1427628153
Python
Python
py
Runtime Error
0
0
55
1001 2000 520 1002 1800 450 1003 1600 625 1001 200 1220
s189267746
p00100
u534550471
1434410274
Python
Python
py
Runtime Error
0
0
505
import sys import math while 1: para = map(int, raw_input()) if (para == 0): break ans = 0 l = [0 for i in range(4000)] num = [] check = 0 for j in range(para): data = map(int, raw_input().split()) l[data[0]] = l[data[0]]+data[1]*data[2] if(data[0] not in nu...
s273343191
p00100
u873482706
1451557117
Python
Python3
py
Runtime Error
0
0
477
while True: N = int(input()) if N == 0: break d = {} for n in range(N): num, p, q = map(int, input().split()) if num in d: d[num][1] += (p*q) else: d[num] = [n, p*q] else: fla = False for k, v in sorted(d.items(), key=lambda x[...
s787261798
p00100
u609881501
1453801047
Python
Python3
py
Runtime Error
0
0
723
#!/usr/bin/env python3 import sys input_lines = sys.stdin.readlines() cnt = 0 dataset = [] for i in input_lines: if not(' ' in i): dataset.append([int(i)]) cnt += 1 else:dataset[cnt-1].append(list(map(int, i.split(' ')))) for d in dataset: if d == [0]:break shain = [[x[0], x[1]*x[2...
s287750973
p00100
u609881501
1453801067
Python
Python3
py
Runtime Error
0
0
723
#!/usr/bin/env python3 import sys input_lines = sys.stdin.readlines() cnt = 0 dataset = [] for i in input_lines: if not(' ' in i): dataset.append([int(i)]) cnt += 1 else:dataset[cnt-1].append(list(map(int, i.split(' ')))) for d in dataset: if d == [0]:break shain = [[x[0], x[1]*x[2...
s162189754
p00100
u609881501
1453801139
Python
Python3
py
Runtime Error
0
0
723
#!/usr/bin/env python3 import sys input_lines = sys.stdin.readlines() cnt = 0 dataset = [] for i in input_lines: if not(' ' in i): dataset.append([int(i)]) cnt += 1 else:dataset[cnt-1].append(list(map(int, i.split(' ')))) for d in dataset: if d == [0]:break shain = [[x[0], x[1]*x[2...