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
s971234213
p00103
u424041287
1507886427
Python
Python3
py
Runtime Error
0
0
294
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = input().rstrip() if x == ???HIT???: if runner == 3: point += 1 else: runner += 1 elif x == ???HOMERUN???: point = point + runner + 1 runner = 0 else: c += 1 print(point)
s087038211
p00103
u424041287
1507886472
Python
Python3
py
Runtime Error
0
0
286
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = input().rstrip() if x == "HIT": if runner == 3: point += 1 else: runner += 1 elif x == "HOMERUN": point = point + runner + 1 runner = 0 else: c += 1 print(point)
s142480475
p00103
u424041287
1507887220
Python
Python3
py
Runtime Error
0
0
299
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = str(input().rstrip()) if x == ???HIT???: if runner == 3: point += 1 else: runner += 1 elif x == ???HOMERUN???: point = point + runner + 1 runner = 0 else: c += 1 print(point)
s537841875
p00103
u150984829
1517478954
Python
Python3
py
Runtime Error
0
0
170
for _ in[0]*int(input()): r=o=s=0 while 1: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 elif'O'==a:s+=r+1;r=0 else: if r<3:o+=1 else:print(s);break
s902224045
p00104
u585391547
1412884635
Python
Python3
py
Runtime Error
0
0
829
def solve(IsTraveled,data,h,w): IsTraveled[h][w]=True x=data[h][w] if x==".": print(w,h) elif x=="^": if IsTraveled[h-1][w]==True: print("LOOP") else: solve(IsTraveled,data,h-1,w) elif x=="v": if IsTraveled[h+1][w]==True: print("LOOP") else: solve(IsTraveled,data,h+1,w) elif x==">": if IsT...
s215342305
p00104
u585391547
1412885311
Python
Python3
py
Runtime Error
0
0
843
def solve(IsTraveled,data,h,w): IsTraveled[h][w]=True x=data[h][w] if x==".": print(w,h) elif x=="^": if IsTraveled[h-1][w]==True: print("LOOP") else: solve(IsTraveled,data,h-1,w) elif x=="v": if IsTraveled[h+1][w]==True: print("LOOP") else: solve(IsTraveled,data,h+1,w) elif x==">": if IsT...
s562615871
p00104
u912237403
1414590665
Python
Python
py
Runtime Error
0
0
338
def f(): A=[raw_input() for _ in range(h)] x,y=0,0 while 1: A[y]=A[y][0:x]+'x'+A[y][x+1:] if s==">": x+=1 elif s=="<": x-=1 elif s=="v": y+=1 elif s=="^"3: y-=1 elif s==".": return " ".join(map(str,[x,y])) else: return "LOOP" while 1: h,w=map(int,raw_input().split()) if h==w==0:...
s925249403
p00104
u879226672
1424332270
Python
Python
py
Runtime Error
0
0
732
def CurrentPos(ls,h=0,w=0): if ls[h][w] == '>': w +=1 elif ls[h][w] =='<': w -=1 elif ls[h][w] =='^': h -=1 elif ls[h][w] =='v': h +=1 return [h,w] def HasPosReached(pos_list,h,w): for k,j in pos_list: if (h,w) == (k,j): return True ...
s534108532
p00104
u040533857
1426052859
Python
Python3
py
Runtime Error
0
0
296
posX,posY=0,0 H,W=map(int,input()) for i in range(H): spam=input().rstrip() for j in range(W): if posX==j: if spam[j]=='>': posX+=1 elif spam[j]=='<': posX-=1 elif spam[j]=='v': posY+=1 elif spam[j]=='^': posY-=1 else: break
s922474922
p00104
u040533857
1426055809
Python
Python3
py
Runtime Error
0
0
659
posX,posY=0,0 H,W=map(int,input().split()) while not(H==W==0): tile=[[False for i in range(W)] for j in range(H)] tileinfo=[['' for i in range(W)] for j in range(H)] for i in range(H): tileinfo[i]=input().rstrip() while True: if tileinfo[posX][posY]=='>': posX+=1 elif tileinfo[po...
s792529095
p00104
u040533857
1426056264
Python
Python3
py
Runtime Error
0
0
717
posX,posY=0,0 H,W=map(int,input().split()) while not(H==W==0): tile=[[False for i in range(W)] for j in range(H)] tileinfo=[['' for i in range(W)] for j in range(H)] for i in range(H): tileinfo[i]=input().rstrip() while True: if tileinfo[posX][posY]=='>': posX+=1 elif...
s436325472
p00104
u580607517
1427633794
Python
Python
py
Runtime Error
0
0
362
while True: H, W = map(int, raw_input().split()) if H == 0 and W == 0: break array = [[raw_input() for i in range(W)] for j in range(H)] x = y = 0 while True: w = array[x][y] if w == ".": print x, y break if w == ">": x += 1 elif w == "v": y += 1 elif w == "^": y -= 1 elif w == "<": ...
s934431541
p00104
u580607517
1427634131
Python
Python
py
Runtime Error
0
0
381
while True: H, W = map(int, raw_input().split()) if H == 0 and W == 0: break tile = [] for i in range(H): tile.append(list(raw_input())) x = y = 0 while True: a = tile[y][x] tile[y][x] = 0 if w == ".": print x, y break if w == ">": x += 1 elif w == "v": y += 1 elif w == "^": y -= 1...
s517119570
p00104
u580607517
1427634295
Python
Python
py
Runtime Error
0
0
377
while True: H, W = map(int, raw_input().split()) if H == 0 and W == 0: break tile = [] for i in range(H): tile.append(list(raw_input())) x = y = 0 while True: a = tile[y][x] tile[y][x] = 0 if w == ".": print x, y;break elif w == ">": x += 1 elif w == "v": y += 1 elif w == "^": y -= 1 ...
s959422962
p00104
u472944603
1443505819
Python
Python
py
Runtime Error
0
0
711
S = [["0" for i in range(10)] for j in range(10)] while True: check = [[False for i in range(10)] for j in range(10)] x = 0 y = 0 LOOP = False H, W = map(int, raw_input().split()) if (H == 0 and W == 0): break for i in range(H): S[i] = raw_input() whi...
s381838938
p00104
u301729341
1481992287
Python
Python3
py
Runtime Error
0
0
643
def moov(x,y): if (x,y) in Loc: return "LOOP" else: Loc.append((x,y)) if Room[y][x] == ".": return str(x)+" "+str(y) elif Room[y][x] == ">": return moov(x + 1,y) elif Room[y][x] == "<": return moov(x - 1,y) elif Room[y][x] == "^...
s229852198
p00104
u301729341
1481992465
Python
Python3
py
Runtime Error
0
0
631
def moov(x,y): if (x,y) in Loc: return "LOOP" else: Loc.append((x,y)) if Room[y][x] == ".": return str(x)+" "+str(y) elif Room[y][x] == ">": return moov(x + 1,y) elif Room[y][x] == "<": return moov(x - 1,y) elif Room[y][x] == "^...
s963405717
p00104
u742505495
1510221949
Python
Python
py
Runtime Error
0
0
716
import sys import math def decide_move(x,y,tile,check): if tile == '<': x -= 1 check[x][y] += 1 return x,y,check elif tile == '>': x += 1 check[x][y] += 1 return x,y,check elif tile == '^': y -= 1 check[x][y] += 1 return x,y,check else: y += 1 check[x][y] += 1 return x,y,check while True:...
s359300018
p00104
u742505495
1510222513
Python
Python3
py
Runtime Error
0
0
719
import sys import math def decide_move(x,y,tile,check): if tile == '<': x -= 1 check[x][y] += 1 return x,y,check elif tile == '>': x += 1 check[x][y] += 1 return x,y,check elif tile == '^': y -= 1 check[x][y] += 1 return x,y,check else: y += 1 check[x][y] += 1 return x,y,check while True:...
s891679201
p00104
u009288816
1515236065
Python
Python
py
Runtime Error
0
0
975
import sys l = [] for input in sys.stdin: l.append(input.split()) k = 0 res = [] matrix = [] while(k < len(l)): for i in range(k+1,int(l[k][0])+1+k): res.append(l[i][0]) for i in range(0,len(res)): temp = [] for j in range(0,len(res[0])): temp.append(res[i][j]) ...
s412001467
p00104
u759934006
1372594158
Python
Python
py
Runtime Error
0
0
504
DIR = {">": (0, 1), "<": (0, -1), "^": (-1, 0), "v": (1, 0)} while True: w, h = m(int, raw_input().split()) if w == 0 and h == 0: break m = [] for i in range(w): m.append([c for c in raw_input().strip()]) x = 0 y = 0 while m[x][y] != '.': i = m[x][y] if i =...
s241495377
p00104
u759934006
1372594330
Python
Python
py
Runtime Error
0
0
523
DIR = {">": (0, 1), "<": (0, -1), "^": (-1, 0), "v": (1, 0)} while True: w, h = map(int, raw_input().split()) if w == 0 and h == 0: break m = [[] in i for range(w)] for i in range(w): m[i] = [c for c in raw_input().strip()] x = 0 y = 0 while m[x][y] != '.': i = m[x...
s251350554
p00104
u454358619
1377396909
Python
Python
py
Runtime Error
0
0
2489
Last login: Sun Aug 25 10:28:39 on ttys002 -bash: /Users/yanzhao/Library/Enthought/Canopy_32bit/User/bin/activate: No such file or directory yans-iMac:~ yanzhao$ ls #del.py# Movies VirtualBox VMs Desktop Music config.log Documents MyProject.komodoproject del.py Downloads Pictures del.py~ Library Public hp...
s131526475
p00104
u633068244
1394016898
Python
Python
py
Runtime Error
0
0
463
while True: w, h = map(int, raw_input().split()) if w == 0 and h == 0: break tile = [] for i in range(h): tile.append(list(raw_input())) print tile x = y = 0 while True: a = tile[y][x] tile[y][x] = 0 if a == ">": x += 1 elif a == "<": x -= 1 ...
s316247367
p00104
u633068244
1394017024
Python
Python
py
Runtime Error
0
0
467
while True: w, h = map(int, raw_input().split()) if w == 0 and h == 0: break tile = [] for i in range(h): tile.append(list(raw_input())) print tile x = y = 0 while True: a = tile[y][x] tile[y][x] = 0 if a == ">": x += 1 elif a == "<": x -= 1 ...
s990850565
p00104
u633068244
1394017063
Python
Python
py
Runtime Error
0
0
453
while True: w, h = map(int, raw_input().split()) if w == 0 and h == 0: break tile = [] for i in range(h): tile.append(list(raw_input())) print tile x = y = 0 while True: a = tile[y][x] tile[y][x] = 0 if a == ">": x += 1 elif a == "<": x -= 1 ...
s554746896
p00104
u193025715
1398057685
Python
Python
py
Runtime Error
0
0
507
while True: h, w = map(int, raw_input().split()) if h + w == 0: break b = [list(raw_input()) for i in range(h)] direction = {'>':[1,0],'v':[0,1],'<':[-1,0],'^':[0,-1]} f = False for i in range(h): for j in range(w): if b[j][i] != ".": p = [i,j] f = True break if f: break c = 0 while True: t...
s075205373
p00104
u193025715
1398057799
Python
Python
py
Runtime Error
0
0
507
while True: h, w = map(int, raw_input().split()) if h + w == 0: break b = [list(raw_input()) for i in range(h)] direction = {'>':[1,0],'v':[0,1],'<':[-1,0],'^':[0,-1]} f = False for i in range(h): for j in range(w): if b[j][i] != ".": p = [i,j] f = True break if f: break c = 0 while True: t...
s391538847
p00105
u912237403
1414591929
Python
Python
py
Runtime Error
0
0
161
d={} for s in sys.stdin: w,p=s.split() if not w in d: d[w]=[] d[w].append(int(p)) for w in sorted(d.keys()): print w,"\n"," ".join(map(str,sorted(d[w])))
s028932088
p00105
u912237403
1414591973
Python
Python
py
Runtime Error
0
0
169
d={} for s in sys.stdin: w,p=s.split() if not w in d: d[w]=[] d[w].append(int(p)) for w in sorted(d.keys()): print w,"\n" print " ".join(map(str,sorted(d[w])))
s472946762
p00105
u912237403
1414592022
Python
Python
py
Runtime Error
0
0
178
d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=int(p) for w in sorted(d.keys()): print w,"\n" print " ".join(map(str,sorted(d[w])))
s577986019
p00105
u755162050
1468838813
Python
Python3
py
Runtime Error
0
0
452
book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except Exception: ...
s384837652
p00105
u546285759
1479465921
Python
Python3
py
Runtime Error
0
0
285
dic = {} while True: try: word, pgn = input().split() except ValueError: break if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
s370172250
p00105
u546285759
1479466098
Python
Python3
py
Runtime Error
0
0
298
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v)))) break
s425090652
p00105
u546285759
1479466254
Python
Python3
py
Runtime Error
0
0
283
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: break for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
s214109296
p00105
u503263570
1502043766
Python
Python3
py
Runtime Error
0
0
183
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) if c=='18':break for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*b.sort())
s646194241
p00105
u742505495
1510281207
Python
Python3
py
Runtime Error
0
0
408
import sys dic = {} while True: try: a,b = map(str,input(),split()) page = int(b) if a not in dic: dic[a] = [page] else: dic[a].append(page) except EOFError: sorted(dic.keys()) names = list(dic.keys()) for i in range(len(names)): print(names[i]) for j in range(len(dic[i])): if j ==...
s520461083
p00105
u633068244
1394007539
Python
Python
py
Runtime Error
0
0
222
index = {} while True: try: w, p = map(str, raw_input().split()) index.setdefault(w,[]).append(int(p)) index.sort() for i in index: index[i].sort() print i print " ".join(map(int, index[i]))
s942442799
p00106
u811733736
1504448278
Python
Python3
py
Runtime Error
0
0
1217
def solve2(amount): """ ???????¨???????????????¨?????????????????§??? """ packages = [(0, 0), (2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] # 1?¢??????????(100g??????)??¨??????????????¢l # dp??¨???2?¬??????????????¨?????????????(100g??????)?????????????????¨??§??????packages????¨...
s928584706
p00106
u198069342
1511357492
Python
Python3
py
Runtime Error
0
0
220
h={15:2244,12:1870,10:1520,5:850,3:550,2:380} m={0:0} for i in range(50): if i in m: for k,v in h.items(): m[i+k] = min(m.get(i+k,1e9),m[i]+v) while True: n = input() if n == 0 : break print(m[n/100])
s168436260
p00107
u879226672
1424845968
Python
Python
py
Runtime Error
0
0
398
def hantei(A,B,C,R=0): h,t = sorted([A,B,C])[:2] if h**2 + t**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) except EOFError: break for k in range(int(raw_input())): hantei(A,B,C,int(raw_input())) ...
s426729983
p00107
u879226672
1424846252
Python
Python
py
Runtime Error
0
0
398
def hantei(A,B,C,R=0): h,t = sorted([A,B,C])[:2] if h**2 + t**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) except EOFError: break for k in range(int(raw_input())): hantei(A,B,C,int(raw_input())) ...
s998799283
p00107
u919202930
1488019994
Python
Python3
py
Runtime Error
0
0
441
def min_diag(A,B,C): segments=[A,B,C] segments.sort() return (segments[0]**2+segments[1]**2)**(1/2) while True: # input one dataset A,B,C = tuple(map(int,input().split())) if (A,B,C) == (0,0,0): break n = int(input()) R = [None]*n for i in range(n): R[i] = int(input()) # process min_diag...
s105662170
p00107
u919202930
1488020121
Python
Python3
py
Runtime Error
0
0
441
def min_diag(A,B,C): segments=[A,B,C] segments.sort() return (segments[0]**2+segments[1]**2)**(1/2) while True: # input one dataset A,B,C = tuple(map(int,input().split())) if (A,B,C) == (0,0,0): break n = int(input()) R = [None]*n for i in range(n): R[i] = int(input()) # process min_diag...
s405740184
p00107
u919202930
1488020306
Python
Python3
py
Runtime Error
0
0
445
def min_diag(A,B,C): segments=[A,B,C] segments.sort() return (segments[0]**2+segments[1]**2)**(1/2) while True: # input one dataset A,B,C = tuple(map(float,input().split())) if (A,B,C) == (0,0,0): break n = int(input()) R = [None]*n for i in range(n): R[i] = float(input()) # process min_...
s735229368
p00107
u919202930
1488020569
Python
Python3
py
Runtime Error
0
0
443
def min_diag(A,B,C): segments=[A,B,C] segments.sort() return (segments[0]**2+segments[1]**2)**(1/2) while True: # input one dataset A,B,C = tuple(map(float,input().split())) if (A,B,C) == (0,0,0): break n = int(input()) R = [None]*n for i in range(n): R[i] = float(input()) # process min_d...
s350252286
p00107
u960312159
1508917982
Python
Python3
py
Runtime Error
0
0
279
while 1: d, w, h = map(int, raw_input().split()) dmin = min(d**2 + w**2, w**2+h**2, h**2+d**2) if dmin == 0: break n = input() for i in range(n): r = input() if dmin < 2*r**2: print 'OK' else: print 'NA'
s590146039
p00107
u150984829
1517522203
Python
Python3
py
Runtime Error
0
0
170
import sys for a in sys.stdin: if'0'==a:break s=list(map(int,input().split())) c=0 while 1: t=s;s=[t.count(e)for e in t] if t==s:break c+=1 print(c);print(*s)
s834701492
p00107
u847467233
1529191499
Python
Python3
py
Runtime Error
0
0
279
# AOJ 0107 Carry a Cheese # Python3 2018.6.17 bal4u while True: d, w, h = list(map(int, input().split())) if d == 0 and w == 0 and h == 0: break min = min(d*d+w*w, d*d+h*h, w*w+h*h) for _ in range(int(input())): r = int(input()) print('OK' if min < (2*r)**2 else 'NA')
s802909353
p00107
u847467233
1529192118
Python
Python3
py
Runtime Error
0
0
286
# AOJ 0107 Carry a Cheese # Python3 2018.6.17 bal4u while True: d, w, h = list(map(int, input().split())) if d == 0 and w == 0 and h == 0: break min = min(d*d+w*w, d*d+h*h, w*w+h*h) n = int(input()) for i in range(n): r = int(input()) print('OK' if (2*r)**2 > min else 'NA')
s397366641
p00107
u459861655
1353427939
Python
Python
py
Runtime Error
0
5648
438
import math i, size = 0, 0 rs = [] while True: line = raw_input() if line == '0 0 0': for r in rs: if size <= r: print 'OK' else: print 'NA' break else: i += 1 if i == 1: t = [int(n) for n in line.split()] t...
s292204406
p00107
u180584272
1379826760
Python
Python
py
Runtime Error
0
0
242
from math import sqrt cheeze = map(float,raw_input().split()) cheeze.sort() supk = sqrt((cheeze[0]/2)**2 + (cheeze[1]/2)**2) while True: k = raw_input() if k == "0 0 0": break else: k = int(k) if k < supk: print "OK" else: print "NA"
s080246554
p00107
u180584272
1379837567
Python
Python
py
Runtime Error
0
0
278
import sys from math import sqrt nyu = sys.stdin.read() nyu = nyu.split("\n") cheese = map(float,nyu[0].split()) cheese.sort() supk = sqrt((cheese[0]/2)**2 + (cheese[1]/2)**2) nyu = map(int,nyu[2:]) try: for k in nyu: if k < supk: print "OK" else: print "NA" except: pass
s877883129
p00107
u180584272
1379837593
Python
Python
py
Runtime Error
0
0
280
import sys from math import sqrt nyu = sys.stdin.read() nyu = nyu.split("\n") cheese = map(float,nyu[0].split()) cheese.sort() supk = sqrt((cheese[0]/2)**2 + (cheese[1]/2)**2) nyu = map(int,nyu[2:-1]) try: for k in nyu: if k < supk: print "OK" else: print "NA" except: pass
s342575952
p00108
u350804311
1473283493
Python
Python3
py
Runtime Error
0
0
358
while True: n = int(input()) if n == 0: break s = [] s = list(input().split()) while True: t = [] u = 0 v = 0 for i in range(n): for j in range(n): if s[i] == s[j]: u += 1 t.append(u) t_str = list(map(str, t)) u = 0 if s == t: print(str(v)) print(" ".join(t_str...
s836242269
p00108
u500396695
1478579249
Python
Python3
py
Runtime Error
0
0
267
def FOA(a, count): b = a for i in range(len(b)): b[i] = a.count(a[i]) if b == a: print(count) print(" ".join(map(str, b))) break else: return FOA(b, count + 1) while True: n = int(input()) if n == 0: break a = map(int, input().split()) FOA(a, 0)
s026319180
p00108
u742505495
1512640384
Python
Python3
py
Runtime Error
0
0
307
import sys while 1: n=int(input()) if n==0: break s=list(int(input().split())) cont=0 while 1: tmp=[] for i in range(n): tmp[i]=[s.count(s[i])] if s==temp: print(cont) break else: cont+=1 for i in range(n): if i != n-1: sys.stdout('{0} '.format(s[i])) else: print(s[i])
s241947646
p00108
u150984829
1517520990
Python
Python3
py
Runtime Error
0
0
162
while 1: n=int(input()) if n: s=list(map(int,input().split())) c=0 while 1: t=s;s=[t.count(e)for e in t] if t==s:break c+=1 print(c);print(*s)
s722833028
p00109
u471400255
1531277247
Python
Python3
py
Runtime Error
0
0
1941
from collections import deque def eva(l, r, op): if op == "+": return l + r elif op == "-": return l - r elif op == "*": return l * r elif op == "/": return l // r def calc(exp,brac=None): i = 0 # ループカウンタ? num = deque() # 数字をためておく ops = deque() # +-をためておく ...
s263857037
p00109
u471400255
1531277421
Python
Python3
py
Runtime Error
0
0
1942
from collections import deque def eva(l, r, op): if op == "+": return l + r elif op == "-": return l - r elif op == "*": return l * r elif op == "/": return l // r def calc(exp,brac=None): i = 0 # ループカウンタ? num = deque() # 数字をためておく ops = deque() # +-をためておく ...
s018045745
p00109
u471400255
1531278195
Python
Python3
py
Runtime Error
0
0
1942
from collections import deque def eva(l, r, op): if op == "+": return l + r elif op == "-": return l - r elif op == "*": return l * r elif op == "/": return l // r def calc(exp,brac=None): i = 0 # ループカウンタ? num = deque() # 数字をためておく ops = deque() # +-をためておく ...
s540106571
p00109
u471400255
1531278366
Python
Python3
py
Runtime Error
0
0
1951
from collections import deque def eva(l, r, op): if op == "+": return l + r elif op == "-": return l - r elif op == "*": return l * r elif op == "/": return l // r def calc(exp,brac=None): i = 0 # ループカウンタ? num = deque() # 数字をためておく ops = deque() # +-をためておく ...
s366906723
p00109
u858885710
1406319604
Python
Python
py
Runtime Error
0
0
77
for _ in range( int(raw_input()) ): print int(eval( "1.0"+raw_input()[:-1] ))
s841685600
p00109
u912237403
1414795805
Python
Python
py
Runtime Error
0
0
858
def f(s): while 1: b=s.find(")") if b<0: return g(s) a=s[:b].rfind("(") s1=s[a:b+1] s=s.replace(s1,f(s1[1:-1])) def g(s): a="" f=1 x=[] def F(a,b): x.append(a) x.append(b) return 1,"" for c in s: if c=="=": continue elif c in "*/": f,a=F(a,c) elif c in "+-": ...
s585153471
p00109
u633068244
1425019325
Python
Python
py
Runtime Error
0
0
89
N = int(raw_input()) for loop in xrange(N): print eval(raw_input().replace("/","//"))
s331536662
p00109
u379499530
1432280295
Python
Python
py
Runtime Error
0
0
1036
ops = {"+": lambda a, b: b + a, "-": lambda a, b: b - a, "*": lambda a, b: b * a, "/": lambda a, b: b // a} def calc(temp, v): if v in ops: temp.append(ops[v](temp.pop(), temp.pop())) else: temp.append(int(v)) return temp n = input() for i in range(n): porand = [] ...
s481802056
p00109
u379499530
1432280374
Python
Python
py
Runtime Error
0
0
1035
ops = {"+": lambda a, b: b + a, "-": lambda a, b: b - a, "*": lambda a, b: b * a, "/": lambda a, b: b / a} def calc(temp, v): if v in ops: temp.append(ops[v](temp.pop(), temp.pop())) else: temp.append(int(v)) return temp n = input() for i in range(n): porand = [] ...
s920838947
p00109
u379499530
1432281309
Python
Python
py
Runtime Error
0
0
1258
ops = {"+": lambda a, b: b + a, "-": lambda a, b: b - a, "*": lambda a, b: b * a, "/": lambda a, b: b / a, "@": lambda a, b: -(abs(int(1.0*a/b)))} def calc(temp, v): if v in ["+", "-", "*"]: temp.append(ops[v](temp.pop(), temp.pop())) elif v == "/": if temp[-1] < 0 o...
s521814293
p00109
u379499530
1432283288
Python
Python
py
Runtime Error
0
0
1405
ops = {"+": lambda a, b: b + a, "-": lambda a, b: b - a, "*": lambda a, b: b * a, "/": lambda a, b: b / a, "@": lambda a, b: -(abs(int(1.0*b/a)))} def calc(stack, v): if v in ["+", "-", "*"]: stack.append(ops[v](stack.pop(), stack.pop())) elif v == "/": if stack[-1] ...
s333212283
p00109
u873482706
1435238675
Python
Python
py
Runtime Error
0
0
1827
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s446352414
p00109
u873482706
1435239293
Python
Python
py
Runtime Error
0
0
1830
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s687508870
p00109
u873482706
1435240983
Python
Python
py
Runtime Error
0
0
1827
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s393635138
p00109
u873482706
1435242232
Python
Python
py
Runtime Error
0
0
1784
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s438264538
p00109
u873482706
1435243220
Python
Python
py
Runtime Error
0
0
1872
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s986941801
p00109
u873482706
1435244375
Python
Python
py
Runtime Error
0
0
1823
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print int(fx(formula)) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+...
s274467754
p00109
u873482706
1435289194
Python
Python
py
Runtime Error
0
0
1818
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s211180156
p00109
u873482706
1435298924
Python
Python
py
Runtime Error
0
0
1963
def up_to_you(formula): l_p = None r_p = None for i, c in enumerate(formula): if c == '(': l_p = i elif c == ')': r_p = i break else: print fx(formula) return r = fx(formula[l_p+1:r_p]) n_formula = formula[:l_p]+r+formu...
s773755072
p00109
u180584272
1436083796
Python
Python3
py
Runtime Error
0
0
824
def seekBackOperatorInLand(op,s): depth = 0 for i in xrange(len(s)-1,-1,-1): if s[i]==')': depth+=1 if s[i]=='(': depth-=1 if s[i]==op and depth==0: return i return None def calc(s): if all(map(lambda t: t in "0123456789", s)): return int(s) if s[0]=='(' and s[-1]==')' and all(map(lambda t: t!='(' and t!=...
s619365812
p00109
u180584272
1436140323
Python
Python
py
Runtime Error
0
0
738
def seekBackOperatorInLand(op,s): depth = 0 for i in xrange(len(s)-1,-1,-1): if s[i]==')': depth+=1 if s[i]=='(': depth-=1 if s[i]==op and depth==0: return i return None def calc(s): if s=='': return 0 if all(map(lambda t: t in "0123456789", s)): return int(s) p = seekBackOperatorInLand('+',s) if n...
s896865028
p00109
u180584272
1436140692
Python
Python
py
Runtime Error
0
0
775
def seekBackOperatorInLand(op,s): depth = 0 for i in xrange(len(s)-1,-1,-1): if s[i]==')': depth+=1 if s[i]=='(': depth-=1 if s[i]==op and depth==0: return i return None def calc(s): if s=='': return 0 if all(map(lambda t: t in "0123456789", s)): return int(s) p = seekBackOperatorInLand('+',s) if n...
s816895999
p00109
u077582668
1445773691
Python
Python
py
Runtime Error
0
0
2166
import sys #while 1: # (a,b,c) = map(int , raw_input().split()) def isdigit2(n): n = str(n) if(n.isdigit()):return True if(n.startwith("-")): if(len(n)==1):return False if(str(n)[1:].isdigit):return True return False def parse(line): lis = [] ind =0 while(line[ind]!=...
s359850737
p00109
u077582668
1445773939
Python
Python
py
Runtime Error
0
0
1908
def parse(line): lis = [] ind =0 while(line[ind]!="="): a = line[ind] if(a.isdigit()==False): lis.append(a) ind+=1 continue else: s=ind while(line[ind].isdigit()):ind+=1 lis.append(line[s:ind]) contin...
s955459091
p00109
u077582668
1445774292
Python
Python
py
Runtime Error
0
0
2087
def parse(line): lis = [] ind =0 while(line[ind]!="="): a = line[ind] if(ind==0 and a=="-"): s=ind ind += 1 while(line[ind].isdigit()):ind+=1 lis.append(int(line[s:ind])) continue if(a.isdigit()==False): lis.app...
s071894126
p00109
u529386725
1459659805
Python
Python3
py
Runtime Error
0
0
1993
# ????????±?????¬??§??????????????????[l, r)??§?????? def getLR(li): l, r = 0, 0 for i in range(len(li)): if li[i] == "(": l = i if li[i] == ")": r = i + 1 return l, r return l, r # li????¨?????????????????????????(li?????¬??§???????????????) def calc(li)...
s459740174
p00109
u529386725
1459659911
Python
Python3
py
Runtime Error
0
0
1551
def getLR(li): l, r = 0, 0 for i in range(len(li)): if li[i] == "(": l = i if li[i] == ")": r = i + 1 return l, r return l, r def calc(li): # *, / t_li = [] while True: for i in range(len(li) - 2): if li[i + 1] == "*": ...
s827224095
p00109
u873482706
1460424990
Python
Python3
py
Runtime Error
0
0
1425
def f1(line): p = None q = None for i, s in enumerate(line): if s == '(': p = i elif s == ')': q = i if q: break else: return f2(line) before = line[:p] after = line[q + 1:] x = f2(line[p + 1:q]) return f1(before + str(x...
s071474144
p00109
u873482706
1460425047
Python
Python3
py
Runtime Error
0
0
1458
def f1(line): p = None q = None for i, s in enumerate(line): if s == '(': p = i elif s == ')': q = i if q: break else: return f2(line) before = line[:p] after = line[q + 1:] x = f2(line[p + 1:q]) return f1(before + str(x...
s410795361
p00109
u873482706
1460445473
Python
Python3
py
Runtime Error
0
0
1425
def f1(line): p = None q = None for i, s in enumerate(line): if s == '(': p = i elif s == ')': q = i if q: break else: return f2(line) before = line[:p] after = line[q + 1:] x = f2(line[p + 1:q]) return f1(before + str(x...
s538659080
p00109
u630224637
1479208225
Python
Python
py
Runtime Error
0
0
65
n = int(input()) for i in range(n): s = input() print(s)
s544155368
p00109
u919202930
1481684187
Python
Python3
py
Runtime Error
0
0
416
inputs=[] while True: try: inputs.append(input()) except EOFError: break for i in inputs: a,c=i.split("=") a,b=a.split("+") # a+b=c for x in range(0,10): if x==0 and (a[0]=="X" or b[0]=="X" or c[0]=="X"): next A=a.replace("X",str(x)) B=b.replace("X",str(x)) C=c.replace("X",s...
s150138173
p00109
u919202930
1482208951
Python
Python3
py
Runtime Error
0
0
838
def calc(eqt): l = eqt.split("+",maxsplit=1) if len(l) == 2: return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2: return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2: return (calc(l[0])*calc(l[1])) l = eqt.split("/",maxsplit=1) if len(l) == 2: ...
s291368837
p00109
u919202930
1482209219
Python
Python3
py
Runtime Error
0
0
754
def calc(eqt): l = eqt.split("+",maxsplit=1) if len(l) == 2: return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2: return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2: return (calc(l[0])*calc(l[1])) l = eqt.split("/",maxsplit=1) if len(l) == 2: ...
s458525134
p00109
u919202930
1482210923
Python
Python3
py
Runtime Error
0
0
780
def calc(eqt): l = eqt.split("+",maxsplit=1) if len(l) == 2: return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2: return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2: return (calc(l[0])*calc(l[1])) l = eqt.split("/",maxsplit=1) if len(l) == 2: ...
s532557615
p00109
u919202930
1482232962
Python
Python3
py
Runtime Error
0
0
754
def calc(eqt): l = eqt.split("+",maxsplit=1) if len(l) == 2: return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2: return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2: return (calc(l[0])*calc(l[1])) l = eqt.split("/",maxsplit=1) if len(l) == 2: ...
s450391715
p00109
u919202930
1482233571
Python
Python3
py
Runtime Error
0
0
753
def calc(eqt): l = eqt.split("+",maxsplit=1) if len(l) == 2: return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2: return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2: return (calc(l[0])*calc(l[1])) l = eqt.split("/",maxsplit=1) if len(l) == 2: ...
s046379636
p00109
u919202930
1482244457
Python
Python3
py
Runtime Error
0
0
1105
def calc(eqt): # assuming that eqt has no brackets. l = eqt.split("+",maxsplit=1) if len(l) == 2: # if eqt has "+", then return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2:# if eqt has "-", then return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2:# if...
s307389784
p00109
u919202930
1482284226
Python
Python3
py
Runtime Error
0
0
1107
def calc(eqt): # assuming that eqt has no brackets. l = eqt.split("+",maxsplit=1) if len(l) == 2: # if eqt has "+", then return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2:# if eqt has "-", then return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2:# if...
s037737420
p00109
u919202930
1482290224
Python
Python3
py
Runtime Error
0
0
1176
def calc(eqt): # assuming that eqt has no brackets. l = eqt.split("+",maxsplit=1) if len(l) == 2: # if eqt has "+", then return (calc(l[0])+calc(l[1])) l = eqt.split("-",maxsplit=1) if len(l) == 2:# if eqt has "-", then return (calc(l[0])-calc(l[1])) l = eqt.split("*",maxsplit=1) if len(l) == 2:# if...
s866235860
p00109
u371539389
1499681396
Python
Python3
py
Runtime Error
0
0
1343
#n=int(input()) def lastfind(s,x): n=len(s) s_rev=s[::-1] t=s_rev.find(x) return n-t-1 def doublefind(s,x,y): if x in s: p=s.find(x) else: p=len(s)+10 if y in s: q=s.find(y) else: q=len(s)+10 if p<=q and p<len(s)+5: return [p,x] elif ...
s555721813
p00109
u371539389
1499682627
Python
Python3
py
Runtime Error
0
0
1248
#n=int(input()) def lastfind(s,x): n=len(s) s_rev=s[::-1] t=s_rev.find(x) return n-t-1 def doublefind(s,x,y): if x in s: p=s.find(x) else: p=len(s)+10 if y in s: q=s.find(y) else: q=len(s)+10 if p<=q and p<len(s)+5: return [p,x] elif ...