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
s850605114
p00109
u371539389
1499683429
Python
Python3
py
Runtime Error
0
0
1238
#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=lastfind(s,x) else: p=-1 if y in s: q=lastfind(s,y) else: q=-1 if p==-1 and q==-1: return 0 elif p<=q: ...
s985912227
p00109
u811733736
1504660135
Python
Python3
py
Runtime Error
0
0
563
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp """ import sys import re def solve(exp): exp = exp.replace('=', '') exp = exp.replace('/', '//') return eval(exp) def solve2(exp): exp = exp.replace('=', '') p = re.compile('(-*\d)/(\d)') return...
s105835618
p00109
u811733736
1504660372
Python
Python3
py
Runtime Error
0
0
561
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp """ import sys import re def solve(exp): exp = exp.replace('=', '') exp = exp.replace('/', '//') return eval(exp) def solve2(exp): exp = exp.replace('=', '') p = re.compile('(\d)/(\d)') return e...
s293855145
p00109
u811733736
1507645753
Python
Python3
py
Runtime Error
0
0
626
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp """ import sys from sys import stdin import re input = stdin.readline class SmartInt(int): def __truediv__(self, other): sign = 1 if self.n < 0: sign = -1 self.n *= -1 ...
s354094464
p00109
u960312159
1508982684
Python
Python
py
Runtime Error
0
0
88
n = int(input()) for i in range(n): eq = input().replace("=","") print(eval(eq))
s982645727
p00109
u960312159
1508989313
Python
Python
py
Runtime Error
0
0
90
n = int(input()) for i in range(n): eq = input().replace("/","//") print(eval(eq))
s998695737
p00109
u960312159
1508989367
Python
Python
py
Runtime Error
0
0
106
n = int(input()) for i in range(n): eq = input().replace("/","//").replace("=","") print(eval(eq))
s922960552
p00109
u742178809
1511775631
Python
Python3
py
Runtime Error
0
0
264
import re #from me.io import dup_file_stdin #@dup_file_stdin def solve(): for _ in range(int(sys.stdin.readline())): expr = sys.stdin.readline()[:-1].strip("=") expr = re.sub(".d+","",expr) print(eval(expr.replace("/","//"))) solve()
s988400481
p00109
u146816547
1512268646
Python
Python
py
Runtime Error
0
0
1445
# coding: utf-8 # Convert String to List def String2List(s): L = []; tmp = "" for i in s: if i.isdigit(): tmp += i else: if tmp != "": L.append(tmp) tmp = "" L.append(i) if tmp != "": L.append(tmp) return L # ...
s378867829
p00109
u146816547
1512268666
Python
Python
py
Runtime Error
0
0
1446
# coding: utf-8 # Convert String to List def String2List(s): L = []; tmp = "" for i in s: if i.isdigit(): tmp += i else: if tmp != "": L.append(tmp) tmp = "" L.append(i) if tmp != "": L.append(tmp) return L # ...
s109811375
p00109
u808429775
1516891730
Python
Python
py
Runtime Error
0
0
1616
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] inputCountent = string[:-1] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while si...
s048420818
p00109
u808429775
1516891782
Python
Python3
py
Runtime Error
0
0
1616
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] inputCountent = string[:-1] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while si...
s609592720
p00109
u808429775
1516897473
Python
Python3
py
Runtime Error
0
0
1588
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while signStack[-1] != "(": ...
s359463605
p00109
u808429775
1516899686
Python
Python3
py
Runtime Error
0
0
1622
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while signStack[-1] != "(": ...
s877131568
p00109
u808429775
1516899743
Python
Python3
py
Runtime Error
0
0
1570
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while signStack[-1] != "(": ...
s727218689
p00109
u808429775
1516900062
Python
Python3
py
Runtime Error
0
0
1605
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while signStack[-1] != "(": ...
s524729517
p00109
u808429775
1516942226
Python
Python3
py
Runtime Error
0
0
1642
def ReversePolishNotation(string): priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2} stack = [] signStack = ["Sentinel"] for item in string[:-1]: if item == "(": signStack.append(item) elif item == ")": while signStack[-1] != "(": ...
s762332256
p00109
u150984829
1518283725
Python
Python3
py
Runtime Error
0
0
446
R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0} for _ in[0]*int(input()): L=[];t='' for e in input()[:-1]: if e.isdigit():t+=e else: if t:L+=[t];t='' L+=e if t:L+=[t] P,S=[],[] for i in L: if"("==i:S+=i elif")"==i: while"("!=S[-1]:P+=S.pop() S.pop() elif i in R: while S and R[S[-1]]>=R[i]:P+=S.pop...
s236138628
p00109
u150984829
1518283743
Python
Python3
py
Runtime Error
0
0
446
R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0} for _ in[0]*int(input()): L=[];t='' for e in input()[:-1]: if e.isdigit():t+=e else: if t:L+=[t];t='' L+=e if t:L+=[t] P,S=[],[] for i in L: if"("==i:S+=i elif")"==i: while"("!=S[-1]:P+=S.pop() S.pop() elif i in R: while S and R[S[-1]]>=R[i]:P+=S.pop...
s147411365
p00109
u855199458
1530508223
Python
Python3
py
Runtime Error
0
0
553
# -*- coding: utf-8 -*- # 写経した import re class Num: def __str__(self): return str(self.x) def __init__(self, value): self.x = value def __add__(self, value): return o(self.x + value.x) def __sub__(self, value): return o(self.x - value.x) def __mul__(self, value): ...
s466199161
p00109
u471400255
1530619876
Python
Python3
py
Runtime Error
0
0
1341
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): print("calculate",exp) i = 0 num = deque() ops = deque() ope = "" w...
s461454373
p00109
u471400255
1530619956
Python
Python3
py
Runtime Error
0
0
1134
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s635276299
p00109
u471400255
1530621530
Python
Python3
py
Runtime Error
0
0
1173
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s461424390
p00109
u471400255
1530621791
Python
Python3
py
Runtime Error
0
0
1461
from collections import deque from sys import stderr from functools import reduce from operator import add def f(): return [int(i) for i in input().split()] def debug(*x, sep=" ", end="\n"): for item in x: stderr.write(repr(item)) stderr.write(sep) stderr.write(end) def eva(l, r, op): if o...
s177245982
p00109
u471400255
1530623317
Python
Python3
py
Runtime Error
0
0
1335
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s742216560
p00109
u471400255
1530623355
Python
Python3
py
Runtime Error
0
0
1483
from collections import deque from sys import stderr 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): stderr.write(exp) i = 0 num = deque() ops = deque()...
s700038898
p00109
u471400255
1530623644
Python
Python3
py
Runtime Error
0
0
1583
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s464216994
p00109
u471400255
1530623769
Python
Python3
py
Runtime Error
0
0
1669
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s139144764
p00109
u471400255
1530623865
Python
Python3
py
Runtime Error
0
0
1610
from collections import deque from sys import stderr 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): stderr.write(exp) i = 0 num = deque() ops = deque()...
s620177567
p00109
u471400255
1530623899
Python
Python3
py
Runtime Error
0
0
1669
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): i = 0 num = deque() ops = deque() ope = "" while i < len(exp): ...
s834694677
p00109
u471400255
1530624070
Python
Python3
py
Runtime Error
0
0
1590
from collections import deque from sys import stderr 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): i = 0 num = deque() ops = deque() ope = "" whil...
s822307560
p00109
u471400255
1530624173
Python
Python3
py
Runtime Error
0
0
1846
from collections import deque from sys import stderr from functools import reduce from operator import add def f(): return [int(i) for i in input().split()] def debug(*x, sep=" ", end="\n"): for item in x: stderr.write(repr(item)) stderr.write(sep) stderr.write(end) def eva(l, r, op): if ...
s242218788
p00109
u104911888
1369194806
Python
Python
py
Runtime Error
0
0
127
for i in range(input()): print int((eval("".join([str(float(i)) if i.isdigit() else i for i in raw_i\ nput() if i!="="]))))
s752250090
p00109
u104911888
1369194856
Python
Python
py
Runtime Error
0
0
125
for i in range(input()): print int((eval("".join([str(float(i)) if i.isdigit() else i for i in raw_input() if i!="="]))))
s801718545
p00109
u104911888
1369489168
Python
Python
py
Runtime Error
0
0
132
for i in range(input()): s=raw_input()[:-1] s="".join(str(float(i)) if i.isdigit() else i for i in s) print int(eval(s))
s808953548
p00109
u104911888
1370963058
Python
Python
py
Runtime Error
0
0
1108
def rank(ch,st): dic={"+":1,"-":1,"*":3,"/":2,"(":0} return dic[ch]<dic[st] for i in range(input()): s=raw_input()[:-1] buf=[] stack=[] for ch in s: if ch.isdigit(): buf.append(ch) elif ch==")": temp=stack.pop() while temp!="(": ...
s359500720
p00109
u104911888
1370964598
Python
Python
py
Runtime Error
0
0
1002
def rank(ch,st): dic={"+":1,"-":1,"*":2,"/":2,"(":0,")":0} return dic[ch]<=dic[st] for i in range(input()): s=raw_input()[:-1] buf=[] stack=[] for ch in s: if ch.isdigit(): buf.append(ch) elif ch=="(": stack.append(ch) elif ch==")": te...
s252968248
p00109
u104911888
1370994366
Python
Python
py
Runtime Error
0
0
257
from __future__ import division for i in range(input()): s=raw_input()[:-1] t="" for ch in s: if ch.isdigit(): t+=str(float(ch)) elif ch=="/": t+="//" else: t+=ch print int(eval(t))
s241930677
p00109
u759934006
1372595628
Python
Python
py
Runtime Error
0
0
134
while True: n = int(raw_input()) if n == 0: break for i in range(n): print eval(raw_input().strip()[:-1])
s733087246
p00109
u759934006
1372596349
Python
Python
py
Runtime Error
0
0
198
import sys while True: line = raw_input() if line == '': break for i in range(int(line)): a = eval(raw_input().replace('/', '//')[:-1]) sys.stderr.writelines(a)
s914478368
p00109
u759934006
1372596384
Python
Python
py
Runtime Error
0
0
193
import sys while True: line = raw_input() if line == '': break for i in range(int(line)): a = eval(raw_input().replace('/', '//')[:-1]) sys.stderr.write(a)
s654373798
p00109
u147801965
1380707323
Python
Python
py
Runtime Error
0
0
894
anb2 = lambda a,b: -(abs(int(1.0*a/b))) def number(begin): global i if begin[i] == "(": i += 1 res = expression(begin) i += 1 return res res = 0 while begin[i].isdigit(): res *= 10 res += int(begin[i]) i+=1 return res def term(begin):# your code goes here global i res = number(begin) ...
s964079119
p00109
u611853667
1381947568
Python
Python
py
Runtime Error
0
0
896
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: return [_src[0]] + _split(_src[1:]) else: return [int(_src[:c])] + _split...
s245891549
p00109
u611853667
1381948473
Python
Python
py
Runtime Error
0
0
987
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(_src[1:]) if tmp != [] and tmp[0] == "-": tmp = ["+" , "(", 0 , "-...
s006209763
p00109
u611853667
1381949126
Python
Python
py
Runtime Error
0
0
1261
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit(0) return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(...
s703828457
p00109
u611853667
1381949325
Python
Python
py
Runtime Error
0
0
1262
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit(0) return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(...
s462809919
p00109
u611853667
1381949353
Python
Python
py
Runtime Error
0
0
1267
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit(0) return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(...
s988130655
p00109
u611853667
1381949573
Python
Python
py
Runtime Error
0
0
1261
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit() return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(_...
s926768218
p00109
u611853667
1381949785
Python
Python
py
Runtime Error
0
0
1155
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit() return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: return [_src[0...
s793684690
p00109
u611853667
1381949847
Python
Python
py
Runtime Error
0
0
1282
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 if x == 0:exit() return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(_...
s345514936
p00109
u611853667
1381950326
Python
Python
py
Runtime Error
0
0
1373
def divide(x, y): s = 1 if(x < 0):s *= -1 if(y < 0):s *= -1 return abs(x) / abs(y) * s def _split(_src): c = 0 l = len(_src) if l == 0: return [] while c < l and ord('0') <= ord(_src[c]) <= ord('9'): c += 1 if c == 0: tmp = _split(_src[1:]) if t...
s852341959
p00109
u093607836
1382327729
Python
Python
py
Runtime Error
0
0
93
for i in xrange(input()): print int(eval(raw_input().strip().strip('=').replace('/','.0/')))
s420509837
p00109
u047988051
1400125368
Python
Python
py
Runtime Error
0
0
65
T = int(input()) for tc in range(0,T) : print input().strip("=")
s375724619
p00109
u703196441
1402071874
Python
Python
py
Runtime Error
0
0
117
import sys for exp in sys.stdin: if exp[-1] == '=': print eval(exp[1:]) else: print eval(exp)
s445015501
p00110
u371539389
1558946669
Python
Python3
py
Runtime Error
0
0
391
import re while True: try: s_origin=input() for X in range(10): s=s_origin.replace("X",str(X)) s=s.split("=") s[0]=re.sub("^0+","",s[0]) s[1]=re.sub("^0+","",s[1]) if eval(s[0])==int(s[1]): print(X) break ...
s721186420
p00110
u912237403
1414812805
Python
Python
py
Runtime Error
0
0
221
X="X" N="0123456789" for s in sys.stdin: i=s.find("=") j=s.find("+") k=s[0]==X or s[i+1]==X or s[j+1]==X f=0 for c in N[k:]: a=s.replace(X,c) if eval(a[:i])==eval(a[i+1:]): f=1; break print ["NA",c][f]
s294830370
p00110
u703196441
1414820439
Python
Python
py
Runtime Error
0
0
274
import re def f(s): for i in range(0,10): t = s.replace("X", str(i)) a, b, c = map(int, re.split(r'\+|\=', t)) if a + b == c and str(a) + "+" + str(b) + "=" + str(c) == t: return i return "NA" while (1): print f(raw_input())
s542287407
p00110
u376883550
1433829219
Python
Python
py
Runtime Error
0
0
491
import sys for s in sys.stdin.readlines(): s = s.replace('=', '==') flag = True for i in range(10): if i == 0: eight = False for t in s.split('X'): if t and (t[-1] == '+' or t[-1] == '='): eight = True break ...
s998834051
p00110
u873482706
1435286979
Python
Python
py
Runtime Error
0
0
897
for line in open('s.txt').readlines(): n = '' lis = [] for c in line.rstrip(): if c.isdigit() or c == 'X': n += c elif c == '+': lis.append(n) n = '' elif c == '=': lis.append(n) n = '' else: lis.append(n) ...
s903185327
p00110
u160041984
1468143277
Python
Python3
py
Runtime Error
0
0
343
import sys def line():return sys.stdin.readline().strip() import re while True: e = re.findall(r"[0-9X]+",line()) ans = -1 for i in range(10): a,b,c = [int(_.replace("X",str(i))) for _ in e] if a + b == c : ans = i break if ans == -1: print("NA") e...
s261087231
p00110
u160041984
1468143326
Python
Python3
py
Runtime Error
0
0
343
import sys import re def line():return sys.stdin.readline().strip() while True: e = re.findall(r"[0-9X]+",line()) ans = -1 for i in range(10): a,b,c = [int(_.replace("X",str(i))) for _ in e] if a + b == c : ans = i break if ans == -1: print("NA") e...
s907938501
p00110
u546285759
1493341007
Python
Python3
py
Runtime Error
0
0
519
while True: try: dataset = input() except: break flag = True for i in range(10): sequence = dataset.replace("=", "+").split("+") if i == 0 and any([True if seq[0]=="X" and len(seq) >= 2 else False for seq in sequence]): continue a, b, c = map(int, [seq...
s080927937
p00110
u922489088
1496291050
Python
Python3
py
Runtime Error
0
0
215
import sys for line in sys.stdin: src = line.strip().replace('=','==') res = "NA" for i in range(10): if eval(src.replace('X',str(i))): res = str(i) break; print(res)
s242400574
p00110
u811733736
1504661389
Python
Python3
py
Runtime Error
0
0
467
# -*- coding: utf-8 -*- """ """ import sys def solve(exp): for i in range(10): modified_exp = exp.replace('X', str(i)) left, right = modified_exp.split('=') left = left.lstrip('0') right = right.lstrip('0') if eval(left) == eval(right): return i return 'NA' ...
s918975342
p00110
u811733736
1504662362
Python
Python3
py
Runtime Error
0
0
606
# -*- coding: utf-8 -*- """ """ import sys import re def solve(exp): p1 = re.compile('^0+') p2 = re.compile('\+0') for i in range(10): modified_exp = exp.replace('X', str(i)) left, right = modified_exp.split('=') left = p1.sub('', left) left = p2.sub('+', left) right...
s962986023
p00110
u811733736
1504672772
Python
Python3
py
Runtime Error
0
0
767
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0110 """ # runtime error import sys import re def solve(exp): p1 = re.compile('^0+') for i in range(10): modified_exp = exp.replace('X', str(i)) left, right = modified_exp.split('=') left1, left2 = left...
s404584531
p00110
u150984829
1517727368
Python
Python3
py
Runtime Error
0
0
212
import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*('+X='not in e)or('=X'in e)*(e[-1]==t):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA')
s940069182
p00110
u150984829
1517727636
Python
Python3
py
Runtime Error
0
0
212
import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*('+'!=e[1])or('+X'in e)*('+X='not in e)or('=X'in e)*(e[-1]==t):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA')
s755093850
p00110
u150984829
1517727702
Python
Python3
py
Runtime Error
0
0
214
import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*('+'!=e[1])or('+X'in e)*('+X='not in e)or('=X'in e)*(e[-2]=='='):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA')
s883970616
p00110
u150984829
1517728171
Python
Python3
py
Runtime Error
0
0
213
import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*not('+X='in e)or('=X'in e)*(e[-2]!='='):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA')
s012080051
p00110
u150984829
1517729541
Python
Python3
py
Runtime Error
0
0
205
import sys t='X' for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*('+X='not in e)or(e[-2:]=='=X'):]: if eval(e.replace(t,i).replace('=','==')):print(i);break else:print('NA')
s125594912
p00110
u150984829
1517735908
Python
Python3
py
Runtime Error
0
0
213
import re for e in sys.stdin: s=any([len(x)>1 and x[0]=='X' for x in re.split('[+=]',e)]) for i in '0123456789'[s:]: if eval(e.replace('X',i).replace('=','==')):print(i);break else:print('NA')
s904401414
p00110
u150984829
1517739679
Python
Python3
py
Runtime Error
0
0
225
import sys for e in sys.stdin: for i in'0123456789'[(e[0]==t)*(e[1]!='+')or('+X'in e)*('+X='not in e)or('=X'in e):]: l,r=e.replace('X',i).split('=') if sum(map(int,l.split('+')))==int(r):print(i);break else:print('NA')
s958767471
p00110
u136916346
1528558629
Python
Python3
py
Runtime Error
0
0
224
import re,sys def chk(t): for i in range(10): if eval(re.sub("X",str(i),t)): return i return 10 l=[chk(i.replace("=","==")) for i in sys.stdin] [print(i) if i != 10 else print("NA") for i in l]
s880043664
p00110
u459861655
1353851177
Python
Python
py
Runtime Error
0
8216
660
def form_check(t): plus = t.index('+') equal = t.index('=') if len(t[:plus]) > 1 or len(t[plus + 1:equal]) > 1 or len(t[equal + 1:] > 1): return False return True def check(t): equal = t.index('=') if eval(t[:equal]) == eval(t[equal + 1:]): return True else: return ...
s766732677
p00110
u647766105
1359020413
Python
Python
py
Runtime Error
0
0
201
import sys for line in sys.stdin.readlines(): a="NA" for i in xrange(10): exp,ans=line.strip().replace("X",str(i)).split("=") if eval(exp)==int(ans): a=i print a
s517205506
p00110
u542421762
1370706166
Python
Python
py
Runtime Error
0
0
303
import sys def solv(s): left, right = s.split('=') for i in range(10): l = left.replace('X', str(i)) r = right.replace('X', str(i)) if eval(l) == int(r): return str(i) else: return 'NA' for line in sys.stdin: print solv(line.rstrip('\n'))
s413839797
p00110
u542421762
1370706706
Python
Python
py
Runtime Error
0
0
303
import sys def solv(s): left, right = s.split('=') for i in range(10): l = left.replace('X', str(i)) r = right.replace('X', str(i)) if eval(l) == int(r): return str(i) else: return 'NA' for line in sys.stdin: print solv(line.rstrip('\n'))
s226353346
p00110
u542421762
1370706938
Python
Python
py
Runtime Error
0
0
406
import sys def solv(s): left, right = s.split('=') for i in range(10): l = left.replace('X', str(i)) r = right.replace('X', str(i)) l1, l2 = l.split('+') if l1[0] == '0' or l2[0] == '0' or r[0] == '0': next if eval(l) == int(r): return str(i) ...
s469685912
p00110
u542421762
1370707091
Python
Python
py
Runtime Error
0
0
410
import sys def solv(s): left, right = s.split('=') for i in range(10): i = str(i) l = left.replace('X', i) r = right.replace('X', i) l1, l2 = l.split('+') if l1[0] == '0' or l2[0] == '0' or r[0] == '0': next if eval(l) == int(r): return ...
s967060422
p00110
u542421762
1370708221
Python
Python
py
Runtime Error
0
0
432
import sys def solv(s): left, right = s.split('=') for i in range(10): i = str(i) l = left.replace('X', i) r = right.replace('X', i) # l1, l2 = l.split('+') # if i == '0' and (l1[0] == '0' or l2[0] == '0' or r[0] == '0'): # continue if eval(l) == int(r...
s130588922
p00111
u912237403
1414834749
Python
Python
py
Runtime Error
0
0
619
import sys def f1(s): return "".join([d0[c] for c in s]) d0={"M":"10010","N":"10011"} a="ABCD"; for i in range(4): d0[a[i]]=format(i,"02b") a="EFGHIJKL" for i in range(8): d0[a[i]]=format(i,"03b") L0="ABCDEFGHIJKLMNOPQRSTUVWXYZ" L1=" ',-.?" L2=" .,-'?" d={} a="J,EE,EH,MF,GF,EF,IJ,NG,BB,AB,K,BF,NH,GE,BD,NE,BC,"\ "A...
s384363516
p00111
u759934006
1426166144
Python
Python3
py
Runtime Error
0
0
1404
table = { 'A': '00000', 'B': '00001', 'C': '00010', 'D': '00011', 'E': '00100', 'F': '00101', 'G': '00110', 'H': '00111', 'I': '01000', 'J': '01001', 'K': '01010', 'L': '01011', 'M': '01111', 'N': '10000', 'O': '10001', 'P': '10010', 'Q': '10011', 'R': '10100', 'S': '10101', 'T': '10111', 'U':...
s863189799
p00111
u759934006
1426166825
Python
Python3
py
Runtime Error
0
0
1371
table = { 'A': '00000', 'B': '00001', 'C': '00010', 'D': '00011', 'E': '00100', 'F': '00101', 'G': '00110', 'H': '00111', 'I': '01000', 'J': '01001', 'K': '01010', 'L': '01011', 'M': '01111', 'N': '10000', 'O': '10001', 'P': '10010', 'Q': '10011', 'R': '10100', 'S': '10101', 'T': '10111', 'U': '110...
s819076645
p00111
u759934006
1426166893
Python
Python3
py
Runtime Error
0
0
1372
table = { 'A': '00000', 'B': '00001', 'C': '00010', 'D': '00011', 'E': '00100', 'F': '00101', 'G': '00110', 'H': '00111', 'I': '01000', 'J': '01001', 'K': '01010', 'L': '01011', 'M': '01111', 'N': '10000', 'O': '10001', 'P': '10010', 'Q': '10011', 'R': '10100', 'S': '10101', 'T': '10111', 'U': '110...
s441209511
p00111
u462831976
1494306505
Python
Python3
py
Runtime Error
0
0
1742
# -*- coding: utf-8 -*- import sys import os import math import re tableA = { "A":"00000", "B":"00001", "C":"00010", "D":"00011", "E":"00100", "F":"00101", "G":"00110", "H":"00111", "I":"01000", "J":"01001", "K":"01010", "...
s199649361
p00111
u462831976
1494315037
Python
Python3
py
Runtime Error
0
0
1754
# -*- coding: utf-8 -*- import sys import os import math import re import random input_text_path = __file__.replace('.py', '.txt') fd = os.open(input_text_path, os.O_RDONLY) os.dup2(fd, sys.stdin.fileno()) tableA = { "A": "00000", "B": "00001", "C": "00010", "D": "00011", "E": "00100", "F": "...
s843945278
p00112
u103916545
1535950958
Python
Python3
py
Runtime Error
0
0
390
while True: n = int(input()) t = [] s = 0 sum = 0 if n == 0: break else: for i in range(n): s = int(input()) if s == 0: break else: t.append(i) t[i] = s t.sort() for m i...
s930952118
p00112
u633068244
1398332422
Python
Python
py
Runtime Error
0
0
153
while 1: n = input() if n == 0: break q = sorted([input() afor i in range(n)]) t = [0]*n for i in range(n-1): t[i + 1] = t[i] + q[i] print sum(t)
s730229990
p00113
u032662562
1491276044
Python
Python3
py
Runtime Error
0
0
859
from decimal import * import re def solve2(m, n): maxreplen = 80 PREC=200 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: #r = r'(.{%d})\1{%d,}' % (rep, int(maxreplen/rep)-1) r = r'(...
s428849944
p00113
u032662562
1491346817
Python
Python3
py
Runtime Error
0
0
822
from decimal import * import re def solve2(m, n): maxlen = 80 # PREC=160 PREC=200 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: r = r'(.{%d})\1{%d,}' % (rep, int(PREC/rep)-1) ...
s421904941
p00113
u032662562
1491348187
Python
Python3
py
Runtime Error
0
0
919
from decimal import * import re def solve2(m, n): maxlen = 85 #maxlen = 160 PREC=200 #PREC=300 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: clip = min(int(PREC/rep),20) #r...
s094393129
p00113
u032662562
1491356402
Python
Python3
py
Runtime Error
0
0
780
from decimal import * import re def solve2(m, n): maxlen = 80 PREC=200 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: r = r'(.{%d})\1{%d,}' % (rep, int((PREC-40)/rep)) #ex. '(.{6})\\1{12,}...
s448925916
p00113
u032662562
1491356532
Python
Python3
py
Runtime Error
0
0
780
from decimal import * import re def solve2(m, n): maxlen = 80 PREC=200 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: r = r'(.{%d})\1{%d,}' % (rep, int((PREC-20)/rep)) #ex. '(.{6})\\1{12,}...
s994216625
p00113
u032662562
1491356673
Python
Python3
py
Runtime Error
0
0
807
from decimal import * import re def solve2(m, n): maxlen = 80 PREC=300 getcontext().prec = PREC x = Decimal(m) / Decimal(n) s = x.to_eng_string() if len(s) < PREC: return(s[2:],'') rep = 1 while True: clip = max(int((PREC-20)/rep),1) r = r'(.{%d})\1{%d,}' % (rep, ...
s910422412
p00113
u621997536
1399812093
Python
Python
py
Runtime Error
0
0
275
while True: mem = {} p, q = map(int, raw_input().split()) a, b, c = "", p % q, 0 while True: b = (b % q) * 10 if b in mem or not b: break mem[b] = len(a) a += str(b // q) print(a) if b != 0: print(" " * mem[b] + "^" * (len(a) - mem[b]))
s326747167
p00114
u266872031
1428593486
Python
Python
py
Runtime Error
50
26708
678
import sys sys.setrecursionlimit(2**16) def getfly(x,a,m,i): if x==1 and i!=0: return i else: return getfly((a*x)%m,a,m,i+1) def getgcd(a,b): #print a,b (a,b)=max(a,b),min(a,b) if a%b==0: return b else: return getgcd(b,a%b) while(1): indata...
s372822574
p00114
u873482706
1435462640
Python
Python
py
Runtime Error
0
0
471
def fly(x, y, z): global count _x = a1*x - m1 * (a1*x / m1) _y = a2*y - m2 * (a2*y / m2) _z = a3*z - m3 * (a3*z / m3) count += 1 if _x == 1 and _y == 1 and _z == 1: print count return else: fly(_x, _y, _z) while True: a1, m1, a2, m2, a3, m3 = map(int, raw_input()...
s898668222
p00114
u462831976
1494415284
Python
Python3
py
Runtime Error
0
0
672
# -*- coding: utf-8 -*- import sys import os import math def lcm(a, b): return (a * b) // math.gcd(a, b) for s in sys.stdin: a1, m1, a2, m2, a3, m3 = map(int, s.split()) if a1 == m1 == a2 == m2 == a3 == m3 == 0: break x = 1 y = 1 z = 1 x_num = 0 while True: x = (a1 *...
s037543031
p00114
u462831976
1494415384
Python
Python3
py
Runtime Error
0
0
672
# -*- coding: utf-8 -*- import sys import os import math def lcm(a, b): return (a * b) // math.gcd(a, b) for s in sys.stdin: a1, m1, a2, m2, a3, m3 = map(int, s.split()) if a1 == m1 == a2 == m2 == a3 == m3 == 0: break x = 1 y = 1 z = 1 x_num = 0 while True: x = (a1 *...