s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s800324011 | p02263 | u806005289 | 1530894057 | Python | Python3 | py | Runtime Error | 0 | 0 | 1016 | while True:
if "-"in inputEnzan or "+"in inputEnzan or "*"in inputEnzan :
index=0
while index <len(inputEnzan):
if inputEnzan[index]=="-" or inputEnzan[index]=="+" or inputEnzan[index]=="*":
if stack!=[]:
if inputEnzan[index]=="-":
inputEnzan[index]=stack[0]-stack[1]
elif inputEnzan[index]=="+":
inputEnzan[index]=stack[0]+stack[1]
else:
inputEnzan[index]=stack[0]*stack[1]
inputEnzan[index-1]="null"
inputEnzan[index-2]="null"
stack.clear()
else:
pass
else:
stack.append(int(inputEnzan[index]))
index+=1
while True:
if not "null" in inputEnzan:
break
inputEnzan.remove("null")
else:
print(inputEnzan[0])
break
| Traceback (most recent call last):
File "/tmp/tmpne2s_nta/tmpvznsa_z7.py", line 2, in <module>
if "-"in inputEnzan or "+"in inputEnzan or "*"in inputEnzan :
^^^^^^^^^^
NameError: name 'inputEnzan' is not defined
| |
s123671733 | p02263 | u806005289 | 1530894099 | Python | Python3 | py | Runtime Error | 20 | 5604 | 1052 | inputEnzan=input().split()
stack=[]
while True:
if "-"in inputEnzan or "+"in inputEnzan or "*"in inputEnzan :
index=0
while index <len(inputEnzan):
if inputEnzan[index]=="-" or inputEnzan[index]=="+" or inputEnzan[index]=="*":
if stack!=[]:
if inputEnzan[index]=="-":
inputEnzan[index]=stack[0]-stack[1]
elif inputEnzan[index]=="+":
inputEnzan[index]=stack[0]+stack[1]
else:
inputEnzan[index]=stack[0]*stack[1]
inputEnzan[index-1]="null"
inputEnzan[index-2]="null"
stack.clear()
else:
pass
else:
stack.append(int(inputEnzan[index]))
index+=1
while True:
if not "null" in inputEnzan:
break
inputEnzan.remove("null")
else:
print(inputEnzan[0])
break
| Traceback (most recent call last):
File "/tmp/tmpjo5f8c7o/tmpxg7lmthn.py", line 1, in <module>
inputEnzan=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s061075238 | p02263 | u806005289 | 1530894800 | Python | Python3 | py | Runtime Error | 20 | 5596 | 1002 | inputEnzan=input().split()
stack=[]
while True:
if "-"in inputEnzan or "+"in inputEnzan or "*"in inputEnzan :
index=0
while index <len(inputEnzan):
if len(inputEnzan)==1:
break
if inputEnzan[index]=="-" or inputEnzan[index]=="+" or inputEnzan[index]=="*":
if stack!=[]:
if inputEnzan[index]=="-":
inputEnzan[index]=stack[0]-stack[1]
elif inputEnzan[index]=="+":
inputEnzan[index]=stack[0]+stack[1]
else:
inputEnzan[index]=stack[0]*stack[1]
del inputEnzan[index-2]
del inputEnzan[index-2]
stack.clear()
index-=1
else:
index+=1
else:
stack.append(int(inputEnzan[index]))
index+=1
else:
print(inputEnzan[0])
break
| Traceback (most recent call last):
File "/tmp/tmpv61kyufl/tmpfhylhpdy.py", line 1, in <module>
inputEnzan=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s293290287 | p02263 | u285980122 | 1531462184 | Python | Python3 | py | Runtime Error | 20 | 5564 | 959 | #逆ポーランド記法(Reverse Polish Notation, RPN)
class RPN():
def __init__(self):
self.top = 0
self.S = []
self.MAX = 99
def isEmpty(self):
return self.top == 0
def isFull(self):
return self.top >= self.MAX - 1
def push(self,x):
if self.isFull():
raise ValueError("オーバーフロー")
self.top+=1
self.S.append(x)
def pop(self):
if self.isEmpty():
raise ValueError("アンダーフロー")
self.top-=1
#print("self.top:{}".format(self.top))
#print("S:{}".format(self.S))
return self.S.pop(self.top)
X = input().split(" ")
rpn = RPN()
for x in X:
#print(x)
if x.isnumeric():
#print("num")
rpn.push(x)
else:
#print("dig")
num_2 =rpn.pop()
num_1 =rpn.pop()
res = eval(str(num_1) + x + str(num_2))
rpn.push(res)
print(rpn.pop())
| Traceback (most recent call last):
File "/tmp/tmpnwfi3_yi/tmpmdg9tkor.py", line 29, in <module>
X = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s087055958 | p02263 | u285980122 | 1532060110 | Python | Python3 | py | Runtime Error | 20 | 5564 | 1046 | # 作業メモ
# 回答提出済み:ラスト1問で Runtime Error が発生する
#逆ポーランド記法(Reverse Polish Notation, RPN)
class RPN():
def __init__(self):
self.top = 0
self.S = []
self.MAX = 99
def isEmpty(self):
return self.top == 0
def isFull(self):
return self.top >= self.MAX - 1
def push(self,x):
if self.isFull():
raise ValueError("オーバーフロー")
self.top+=1
self.S.append(x)
def pop(self):
if self.isEmpty():
raise ValueError("アンダーフロー")
self.top-=1
#print("self.top:{}".format(self.top))
#print("S:{}".format(self.S))
return self.S.pop(self.top)
X = input().split(" ")
rpn = RPN()
for x in X:
#print(x)
if x.isnumeric():
#print("num")
rpn.push(x)
else:
#print("dig")
num_2 =rpn.pop()
num_1 =rpn.pop()
res = eval(str(num_1) + x + str(num_2))
rpn.push(res)
print(rpn.pop())
| Traceback (most recent call last):
File "/tmp/tmp_7sqodae/tmplo6d52eo.py", line 33, in <module>
X = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s499841582 | p02263 | u362520072 | 1535196411 | Python | Python3 | py | Runtime Error | 20 | 5608 | 689 | def init():
global top
top = 0
def isEmpty():
global top
return top == 0
def isFull():
global top, MAX
return top >= MAX
def push(x):
global top, s
if isFull():
return False
s[top] = x
top += 1
def pop():
global top, s
if isEmpty():
return False
s[top + 1]
top -= 1
return s[top]
def calc(i_1, i_2, op):
if op == '+':
return i_1 + i_2
elif op == '-':
return i_1 - i_2
else:
return i_1 * i_2
data = list(map(str, input().split()))
top = 0
MAX = 100
s = [0 for i in range(MAX)]
for i in data:
if i == '+' or i == '*' or i == '-':
a = pop()
b = pop()
push(calc(int(b), int(a), i))
else:
push(i)
print(s[0])
| Traceback (most recent call last):
File "/tmp/tmpiysqlwjk/tmpxxq_7zby.py", line 38, in <module>
data = list(map(str, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s715702263 | p02263 | u771410206 | 1545618474 | Python | Python3 | py | Runtime Error | 20 | 5604 | 585 | A = list(map(str,input().split()))
stack = []
number = [str(i) for i in range(101)]
for item in A:
if item in number:
stack.append(item)
elif item == '+':
v = int(stack[-2]) + int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '-':
v = int(stack[-2]) - int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '*':
v = int(stack[-2]) * int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
print(stack[-1])
| Traceback (most recent call last):
File "/tmp/tmpjlxcs5jh/tmpappuy__b.py", line 1, in <module>
A = list(map(str,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s517313459 | p02263 | u771410206 | 1545618870 | Python | Python3 | py | Runtime Error | 20 | 5604 | 585 | A = list(map(str,input().split()))
stack = []
number = [str(i) for i in range(101)]
for item in A:
if item in number:
stack.append(item)
elif item == '+':
v = int(stack[-2]) + int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '-':
v = int(stack[-2]) - int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '*':
v = int(stack[-2]) * int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
print(stack[-1])
| Traceback (most recent call last):
File "/tmp/tmpsy0for0o/tmpgwurb46i.py", line 1, in <module>
A = list(map(str,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s095033675 | p02263 | u771410206 | 1545618942 | Python | Python3 | py | Runtime Error | 20 | 5604 | 589 | A = list(map(str,input().split()))
stack = []
number = [str(i) for i in range(101)]
for item in A:
if item in number:
stack.append(str(item))
elif item == '+':
v = int(stack[-2]) + int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '-':
v = int(stack[-2]) - int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
elif item == '*':
v = int(stack[-2]) * int(stack[-1])
del stack[-2]
del stack[-1]
stack.append(str(v))
print(stack[-1])
| Traceback (most recent call last):
File "/tmp/tmpc0nfp8z9/tmpfjw4qlab.py", line 1, in <module>
A = list(map(str,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s661859295 | p02263 | u809233245 | 1546352770 | Python | Python3 | py | Runtime Error | 0 | 0 | 350 | inl = list(map(str, input().split()))
stack = []
for n in inl:
if n == '+':
stack.append(stack.pop() + stack.pop())
elif n == '-':
a = stack.pop()
b = stack.pop()
stack.append(b - a)
elif n == '*':
stack.append(stack.pop() * stack.pop())
else:
stack.append(int(n))
print(stack.pop())u
| File "/tmp/tmpa27on1gt/tmptzq8a_a0.py", line 15
print(stack.pop())u
^
SyntaxError: invalid syntax
| |
s047216180 | p02263 | u058202717 | 1551524997 | Python | Python | py | Runtime Error | 0 | 0 | 567 | class Stack:
data_list = []
def push(self, a):
self.data_list.append(a)
def pop(self):
return self.data_list.pop()
data = input()
lines = data.strip().split()
stack = Stack()
for line in lines:
if line == '+':
num = int(stack.pop()) + int(stack.pop())
stack.push(num)
elif line == '-':
num = int(stack.pop()) - int(stack.pop())
stack.push(-1*num)
elif line == '*':
num = int(stack.pop()) * int(stack.pop())
stack.push(num)
else:
stack.push(line)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmpfj46mko5/tmp33xdr2qp.py", line 8, in <module>
data = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s980992048 | p02263 | u805464373 | 1556015402 | Python | Python3 | py | Runtime Error | 0 | 0 | 289 | ls=input().split()
S=[]
m=0
for i in range(2,len(ls)-1):
if ls[i]=="+":
S[m]=int(ls[i-2])+int(ls[i-1])
m+=1
elif ls[i]=="-":
S[m]=int(ls[i-2])-int(ls[i-1])
m+=1
if ls[len(ls)-1]=="*":
for k in range(1,m):
S[k]=S[k]*S[k-1]
print(S[m])
| Traceback (most recent call last):
File "/tmp/tmpvb2p7rly/tmpvv355445.py", line 1, in <module>
ls=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s487489886 | p02263 | u135880652 | 1559476628 | Python | Python3 | py | Runtime Error | 0 | 0 | 485 | arr = list(map(str, input().split()))
i = 0
operand = []
while i < len(arr):
if arr[i] == '+':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b + a)
elif arr[i] == '-':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b - a)
elif arr[i] == '*':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b * a)
else:
operand.append(int(arr[i]))
i += 1
print(operand[0])
| File "/tmp/tmphysejmjo/tmpar_4l14e.py", line 20
else:
^
IndentationError: unindent does not match any outer indentation level
| |
s855950640 | p02263 | u135880652 | 1559476648 | Python | Python3 | py | Runtime Error | 0 | 0 | 485 | arr = list(map(str, input().split()))
i = 0
operand = []
while i < len(arr):
if arr[i] == '+':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b + a)
elif arr[i] == '-':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b - a)
elif arr[i] == '*':
a = operand.pop(-1)
b = operand.pop(-1)
operand.append(b * a)
else:
operand.append(int(arr[i]))
i += 1
print(operand[0])
| File "/tmp/tmpn4dagmv7/tmpxxmjjhm_.py", line 20
else:
^
IndentationError: unindent does not match any outer indentation level
| |
s628777853 | p02263 | u772196646 | 1414476422 | Python | Python | py | Runtime Error | 0 | 0 | 469 | S = []
try:
word = raw_input()
while 1:
if word == "+":
s1 = S.pop()
s2 = S.pop()
S.append(s1 + s2)
elif word == "-":
s1 = S.pop()
s2 = S.pop()
S.append(s2 - s1)
elif word == "*":
s1 = S.pop()
s2 = S.pop()
S.append(s2 * s1)
else:
S.append(int(word))
word = raw_input()
except:
print S.pop() | File "/tmp/tmpg_8ve4ev/tmptyskq93f.py", line 24
print S.pop()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s095509132 | p02263 | u198069342 | 1415000839 | Python | Python | py | Runtime Error | 20 | 4204 | 151 | s=[]
for i in raw_input().split():
if i<"0":
t=s.pop()
s.append("("+s.pop()+i+t+")")
else:
s.append(i)
print eval(s[0]) | File "/tmp/tmpkiq0vjp6/tmpv99souyl.py", line 8
print eval(s[0])
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s505857352 | p02263 | u386372280 | 1442304057 | Python | Python | py | Runtime Error | 0 | 0 | 751 | import sys
class Stack:
def __init__(self, lst):
self.lst = lst
def push(x):
lst.append(x)
def pop():
lst.pop(-1)
def cul(exp):
S = Stack(exp)
for val in exp:
if val in ["+", "-", "*"]:
if val == "+":
x = reduce(lambda a,b:int(a)+int(b), S[-2:])
elif val == "-":
x = reduce(lambda a,b:int(a)-int(b), S[-2:])
elif val == "*":
x = reduce(lambda a,b:int(a)*int(b), S[-2:])
for i in range(2):
S.pop()
S.push(x)
else:
S.push(val)
return S[0]
if __name__ == "__main__":
exp = sys.stdin.read().strip().split(" ")
ans = cul(exp)
print ans | File "/tmp/tmp2_tk7ns0/tmpmfsyukj5.py", line 37
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s965035712 | p02263 | u854228079 | 1442321253 | Python | Python | py | Runtime Error | 20 | 6372 | 887 | class Stack():
def __init__(self):
self.stack = [0 for _ in range(100)]
self.top = 0
def push(self, n):
self.top += 1
self.stack[self.top] = n
def pop(self):
a = self.stack[self.top]
del self.stack[self.top]
self.top -= 1
return a
def lol(self):
return self.stack[self.top]
def main():
input_data = raw_input()
data = input_data.strip().split(" ")
st = Stack()
for l in data:
if l == "+":
a = st.pop()
b = st.pop()
st.push(a + b)
elif l == "-":
a = st.pop()
b = st.pop()
st.push(b - a)
elif l == "*":
a = st.pop()
b = st.pop()
st.push(a * b)
else:
st.push(int(l))
print st.lol()
if __name__ == '__main__':
main() | File "/tmp/tmpekyb93bi/tmpx1o404sr.py", line 43
print st.lol()
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s138624498 | p02263 | u854228079 | 1442321354 | Python | Python | py | Runtime Error | 10 | 6292 | 886 | class Stack():
def __init__(self):
self.stack = [0 for _ in range(10)]
self.top = 0
def push(self, n):
self.top += 1
self.stack[self.top] = n
def pop(self):
a = self.stack[self.top]
del self.stack[self.top]
self.top -= 1
return a
def lol(self):
return self.stack[self.top]
def main():
input_data = raw_input()
data = input_data.strip().split(" ")
st = Stack()
for l in data:
if l == "+":
a = st.pop()
b = st.pop()
st.push(a + b)
elif l == "-":
a = st.pop()
b = st.pop()
st.push(b - a)
elif l == "*":
a = st.pop()
b = st.pop()
st.push(a * b)
else:
st.push(int(l))
print st.lol()
if __name__ == '__main__':
main() | File "/tmp/tmpzovlcnt1/tmpk8ybyhkc.py", line 43
print st.lol()
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s821864423 | p02263 | u885889402 | 1442369981 | Python | Python3 | py | Runtime Error | 0 | 0 | 434 |
s=input()
stk = Stack(None)
stri=""
for i in s:
if(i==" "):
stk.push(stri)
stri=""
elif(i.isdigit()):
stri="".join([stri,i])
elif(i=="+" or i=="-" or i=="*"):
b=stk.pop()
b=int(b)
a=int(stk.pop())
if(i=="+"):
stri=(str(a+b))
elif(i=="-"):
stri=(str(a-b))
else:
stri=(str(a*b))
else:
break
print(stri) | Traceback (most recent call last):
File "/tmp/tmpn7_gq3x4/tmp0lp6tln5.py", line 2, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s202317497 | p02263 | u885889402 | 1442370024 | Python | Python3 | py | Runtime Error | 30 | 7720 | 1470 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_nex(self,n):self.__nex=n
def set_val(self,n):self.__val=n
def get_val(self):return self.__val
class Stack:
member=Trio(None)
def __init__(self,stri):
if(isinstance(stri,str)):
for i,e in enumerate(stri):
if(i==0):
self.member.set_val(e)
else:
self.push(e)
def push(self,n):
if(self.member.get_val()==None):
self.member.set_val(n)
return True
self.member.set_nex(Trio(n,self.member,None))
self.member=self.member.get_nex()
def pop(self):
if(self.member==None):
return None
d=self.member.get_val()
self.member=self.member.get_pre()
return d
s=input()
stk = Stack(None)
stri=""
for i in s:
if(i==" "):
stk.push(stri)
stri=""
elif(i.isdigit()):
stri="".join([stri,i])
elif(i=="+" or i=="-" or i=="*"):
b=stk.pop()
b=int(b)
a=int(stk.pop())
if(i=="+"):
stri=(str(a+b))
elif(i=="-"):
stri=(str(a-b))
else:
stri=(str(a*b))
else:
break
print(stri) | Traceback (most recent call last):
File "/tmp/tmp25ty91nr/tmpy4b9ossz.py", line 45, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s168422479 | p02263 | u885889402 | 1442370506 | Python | Python3 | py | Runtime Error | 20 | 7728 | 1447 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_nex(self,n):self.__nex=n
def set_val(self,n):self.__val=n
def get_val(self):return self.__val
class Stack:
member=Trio(None)
def __init__(self,stri):
if(isinstance(stri,str)):
for i,e in enumerate(stri):
if(i==0):
self.member.set_val(e)
else:
self.push(e)
def push(self,n):
if(self.member.get_val()==None):
self.member.set_val(n)
return True
self.member.set_nex(Trio(n,self.member,None))
self.member=self.member.get_nex()
def pop(self):
if(self.member==None):
return None
d=self.member.get_val()
self.member=self.member.get_pre()
return d
s=input()
stk = Stack(None)
stri=""
for i in s:
if(i==" "):
stk.push(stri)
stri=""
elif(i.isdigit()):
stri="".join([stri,i])
elif(i=="+" or i=="-" or i=="*"):
b=stk.pop()
b=int(b)
a=int(stk.pop())
if(i=="+"):
stri=(str(a+b))
elif(i=="-"):
stri=(str(a-b))
else:
stri=(str(a*b))
print(stri) | Traceback (most recent call last):
File "/tmp/tmphnjrlprv/tmpoae9lfkn.py", line 46, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s984150661 | p02263 | u885889402 | 1442370710 | Python | Python3 | py | Runtime Error | 30 | 7664 | 1447 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_nex(self,n):self.__nex=n
def set_val(self,n):self.__val=n
def get_val(self):return self.__val
class Stack:
member=Trio(None)
def __init__(self,stri):
if(isinstance(stri,str)):
for i,e in enumerate(stri):
if(i==0):
self.member.set_val(e)
else:
self.push(e)
def push(self,n):
if(self.member.get_val()==None):
self.member.set_val(n)
return True
self.member.set_nex(Trio(n,self.member,None))
self.member=self.member.get_nex()
def pop(self):
if(self.member==None):
return None
d=self.member.get_val()
self.member=self.member.get_pre()
return d
s=input()
stk = Stack(None)
stri=""
for i in s:
if(i==" "):
stk.push(stri)
stri=""
elif(i.isdigit()):
stri="".join([stri,i])
elif(i=="+" or i=="-" or i=="*"):
b=stk.pop()
b=int(b)
a=int(stk.pop())
if(i=="+"):
stri=(str(a+b))
elif(i=="-"):
stri=(str(a-b))
else:
stri=(str(a*b))
print(stri) | Traceback (most recent call last):
File "/tmp/tmprn7rsiy8/tmps6ztfaon.py", line 46, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s592383613 | p02263 | u885889402 | 1442371512 | Python | Python3 | py | Runtime Error | 0 | 0 | 1385 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_nex(self,n):self.__nex=n
def set_val(self,n):self.__val=n
def get_val(self):return self.__val
class Stack:
member=Trio(None)
def __init__(self,stri):
if(isinstance(stri,str)):
for i,e in enumerate(stri):
if(i==0):
self.member.set_val(e)
else:
self.push(e)
def push(self,n):
#print("Push: ",n)
self.member.set_nex(Trio(n,self.member,None))
self.member=self.member.get_nex()
def pop(self):
#print("Pop")
if(self.member==None):
return None
d=self.member.get_val()
self.member=self.member.get_pre()
return d
s=input()
stk = Stack(None)
stri=""
for i in s:
if(i==" "):
stk.push(stri)
stri=""
elif(i.isdigit()):
stri="".join([stri,i])
elif(i=="+" or i=="-" or i=="*"):
b=stk.pop()
b=int(b)
a=int(stk.pop())
if(i=="+"):
stri=(str(a+b))
elif(i=="-"):
stri=(str(a-b))
else:
stri=(str(a*b))
p | Traceback (most recent call last):
File "/tmp/tmplvsb4mgg/tmptwymwhiw.py", line 44, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s641028739 | p02263 | u224288634 | 1445646827 | Python | Python | py | Runtime Error | 10 | 6308 | 564 | cul_list=raw_input().split()
cul_process=[]
ope_cnt=0
result=1
l=len(cul_list)
for i in range(l):
if cul_list[i]=='+':
cul_process.append(int(cul_list[i-2])+int(cul_list[i-1]))
ope_cnt+=1
elif cul_list[i]=='-':
cul_process.append(int(cul_list[i-2])-int(cul_list[i-1]))
ope_cnt+=1
elif cul_list[i]=='*':
if cul_list[i-1]=='+' or cul_list[i-1]=='-':
for j in range(ope_cnt):
result*=cul_process[j]
cul_process.append(result)
ope_cnt=0
else:
cul_process.append(int(cul_list[i-1]*int(cul_list[i-2])))
ope_cnt+=1
print(cul_process[-1]) | Traceback (most recent call last):
File "/tmp/tmpp99yvtcj/tmpxq2fer33.py", line 1, in <module>
cul_list=raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s498575345 | p02263 | u488601719 | 1448081070 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | num = []
for p in input().split():
if p.isdisit():
num.append(int(p))
else:
b = num.pop()
a = num.pop()
if p == '*':
num.append(a * b)
elif p == '+':
num.append(a + b)
elif p == '-':
num.append(a - b)
print(num.pop()) | Traceback (most recent call last):
File "/tmp/tmp7lbv3wb5/tmpbexiikwb.py", line 2, in <module>
for p in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s051803133 | p02263 | u488601719 | 1448081256 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | num = []
for p in input().split():
if p.isdisit():
num.append(int(p))
else:
b = num.pop()
a = num.pop()
if p == '*':
num.append(a * b)
elif p == '+':
num.append(a + b)
elif p == '-':
num.append(a - b)
print(num.pop()) | Traceback (most recent call last):
File "/tmp/tmpezmdbdzk/tmpih__7g4h.py", line 2, in <module>
for p in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s249046414 | p02263 | u488601719 | 1448081583 | Python | Python3 | py | Runtime Error | 0 | 0 | 326 | poland = input().split()
num = []
for p in poland:
if p.isdisit():
num.append(int(p))
else:
b = num.pop()
a = num.pop()
if p == '*':
num.append(a * b)
elif p == '+':
num.append(a + b)
elif p == '-':
num.append(a - b)
print(num.pop()) | Traceback (most recent call last):
File "/tmp/tmp9ewagjsv/tmpdi7_mglc.py", line 1, in <module>
poland = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s177741672 | p02263 | u963402991 | 1448346204 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | # -*- conding:utf-8 -*-
tmp = input().strip().split()
stack = []
for i in tmp:
l -= 1
if stack.pop() == "+":
stack.append(stack.pop() + stack.pop())
elif stack.pop() == "-":
stack.append(-stack.pop() + stack.pop())
elif stack.pop() == "*":
stack.append(stack.pop() * stack.pop())
else:
stack.append(int(i))
print (stack[0]) | Traceback (most recent call last):
File "/tmp/tmp8933fiw_/tmpwqwv_2yb.py", line 2, in <module>
tmp = input().strip().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s998910318 | p02263 | u341533698 | 1454738648 | Python | Python | py | Runtime Error | 0 | 0 | 490 | from collections import deque
def main():
S = input().split()
D = deque([])
for s in S:
if s == '+':
b = D.pop()
a = D.pop()
D.append(a+b)
elif s == '-':
b = D.pop()
a = D.pop()
D.append(a-b)
elif s == '*':
b = D.pop()
a = D.pop()
D.append(a*b)
else:
D.append(int(s))
print D
print D.pop()
return 0
main() | File "/tmp/tmpmjfhxe68/tmpj2qu5twk.py", line 21
print D
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s113425114 | p02263 | u224288634 | 1456402608 | Python | Python3 | py | Runtime Error | 0 | 0 | 556 |
Stack=[]
def push(x):
Stack.append(x)
def pop():
return Stack.pop()
def solve():
s_list=raw_input().split()
for i in range(len(s_list)):
if s_list[i]=='+':
b=pop()
a=pop()
push(a+b)
elif s_list[i]=='-':
b=pop()
a=pop()
push(a-b)
elif s_list[i]=='*':
b=pop()
a=pop()
push(a*b)
else:
push(int(s_list[i]))
print(pop())
def main():
if __name__=="__main__":
solve()
main() | Traceback (most recent call last):
File "/tmp/tmporv8y7ep/tmpblpv2sxa.py", line 32, in <module>
main()
File "/tmp/tmporv8y7ep/tmpblpv2sxa.py", line 30, in main
solve()
File "/tmp/tmporv8y7ep/tmpblpv2sxa.py", line 10, in solve
s_list=raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s485729469 | p02263 | u026681847 | 1459341823 | Python | Python3 | py | Runtime Error | 20 | 7692 | 240 | ope = {"+": lambda a, b: b + a,
"-": lambda a, b: b - a,
"*": lambda a, b: b * abs}
stack = []
for c in input().split():
if c in ope:
stack.append(ope[c](stack.pop(), stack.pop()))
else:
stack.append(int(c))
print(stack[-1]) | Traceback (most recent call last):
File "/tmp/tmpdart390k/tmpc0ra4936.py", line 6, in <module>
for c in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s512387850 | p02263 | u026681847 | 1459341836 | Python | Python3 | py | Runtime Error | 20 | 7732 | 240 | ope = {"+": lambda a, b: b + a,
"-": lambda a, b: b - a,
"*": lambda a, b: b * abs}
stack = []
for c in input().split():
if c in ope:
stack.append(ope[c](stack.pop(), stack.pop()))
else:
stack.append(int(c))
print(stack[-1]) | Traceback (most recent call last):
File "/tmp/tmpqt3tv7c1/tmpia8wiurx.py", line 6, in <module>
for c in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s614621127 | p02263 | u390995924 | 1473115975 | Python | Python3 | py | Runtime Error | 0 | 0 | 340 | ts = input().split(" ")
stack = []
for t in ts:
if t not in ("-", "+", "*"):
stack.push(int(t))
else:
n2 = stack.pop()
n1 = stack.pop()
if t == "-":
stack.push(n1 - n2)
elif t == "+":
stack.push(n1 + n2)
else:
stack.push(n1 * n2)
print(stack.pop()) | Traceback (most recent call last):
File "/tmp/tmp7p9zvm9x/tmp4_2h3d0p.py", line 1, in <module>
ts = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s256767966 | p02263 | u756595712 | 1476087962 | Python | Python3 | py | Runtime Error | 0 | 0 | 242 | from collections import deque
_l = deque(input().split(' '))
last = _l.pop()
second = _l.pop()
d = _l.pop()
c = _l.pop()
first = _l.pop()
b = _l.pop()
a = _l.pop()
print(eval("({}{}{}){}({}{}{})".format(a, first, b, last, c, second, d))) | Traceback (most recent call last):
File "/tmp/tmpxgjxxjla/tmp6wy9gs_2.py", line 3, in <module>
_l = deque(input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s052222230 | p02263 | u756595712 | 1476107742 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | import re
stack = []
_l = input().split(' ')
for c in _l:
stack += [c]
if re.match('/(+|-|/|*)/', c):
f = stack.pop()
z = stack.pop()
stack.append(eval("{}{}{}".format(z, c, f)))
print(stack[0]) | Traceback (most recent call last):
File "/tmp/tmpn2wdwonf/tmp6usq51k7.py", line 4, in <module>
_l = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s292045562 | p02263 | u500396695 | 1477369961 | Python | Python3 | py | Runtime Error | 0 | 0 | 1062 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def initialize():
self.top = 0
def isEmpty():
return self.top == 0
def isFull():
return self.top >= self.max - 1
def push(self, value):
if isFull():
raise IndexError('?????????????????????')
else:
self.top += 1
self.stack[self.top] = value
def pop(self):
if isEmpty():
raise IndexError('??¢??????????????????')
else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(100)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmp33ed0moo/tmp3rycuq81.py", line 33, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s601865533 | p02263 | u500396695 | 1477383586 | Python | Python3 | py | Runtime Error | 30 | 7748 | 1084 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def initialize(self):
self.top = 0
def isEmpty(self):
return self.top == 0
def isFull(self):
return self.top >= self.max - 1
def push(self, value):
if self.isFull():
raise IndexError('?????????????????????')
else:
self.top += 1
self.stack[self.top] = value
def pop(self):
if self.isEmpty():
raise IndexError('??¢??????????????????')
else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(100)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmpufycq2qs/tmp2tle2rwn.py", line 33, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s945660839 | p02263 | u500396695 | 1477385152 | Python | Python3 | py | Runtime Error | 50 | 7744 | 1083 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def initialize(self):
self.top = 0
def isEmpty(self):
return self.top == 0
def isFull(self):
return self.top >= self.max - 1
def push(self, value):
if self.isFull():
raise IndexError('?????????????????????')
else:
self.top += 1
self.stack[self.top] = value
def pop(self):
if self.isEmpty():
raise IndexError('??¢??????????????????')
else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(50)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmp0cczyzhh/tmpmj5cj6qy.py", line 33, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s307341123 | p02263 | u500396695 | 1477385187 | Python | Python3 | py | Runtime Error | 20 | 7744 | 1083 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def initialize(self):
self.top = 0
def isEmpty(self):
return self.top == 0
def isFull(self):
return self.top >= self.max - 1
def push(self, value):
if self.isFull():
raise IndexError('?????????????????????')
else:
self.top += 1
self.stack[self.top] = value
def pop(self):
if self.isEmpty():
raise IndexError('??¢??????????????????')
else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(50)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmpux8fzsax/tmpmd6rbnue.py", line 33, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s766132316 | p02263 | u500396695 | 1477385341 | Python | Python3 | py | Runtime Error | 20 | 7748 | 930 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def push(self, value):
if self.top >= self.max - 1:
raise IndexError('?????????????????????')
else:
self.top += 1
self.stack[self.top] = value
def pop(self):
if self.top == 0:
raise IndexError('??¢??????????????????')
else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(100)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmpi12qy89y/tmpwojp5vct.py", line 24, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s669172323 | p02263 | u500396695 | 1477385403 | Python | Python3 | py | Runtime Error | 40 | 7728 | 936 | import sys
class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def push(self, value):
# if self.top >= self.max - 1:
#raise IndexError('?????????????????????')
# else:
self.top += 1
self.stack[self.top] = value
def pop(self):
# if self.top == 0:
# raise IndexError('??¢??????????????????')
# else:
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(100)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmppiag5i_t/tmpa6ykmx8l.py", line 24, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s541302661 | p02263 | u500396695 | 1477385465 | Python | Python3 | py | Runtime Error | 40 | 7744 | 702 | class Stack:
def __init__(self, max):
self.max = max ##max???stack????????§??????
self.stack = list(range(max))
self.top = 0 ##???????????????????????????0
def push(self, value):
self.top += 1
self.stack[self.top] = value
def pop(self):
self.top -= 1
return self.stack[self.top + 1]
expr = input().split()
stack = Stack(100)
for i in expr:
try:
stack.push(int(i))
except:
b = stack.pop()
a = stack.pop()
if i == '*':
stack.push(a * b)
if i == '+':
stack.push(a + b)
if i == '-':
stack.push(a - b)
print(stack.pop())
| Traceback (most recent call last):
File "/tmp/tmpltayyuxk/tmp9d_o04i7.py", line 16, in <module>
expr = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s657031449 | p02263 | u086566114 | 1479892401 | Python | Python | py | Runtime Error | 10 | 6252 | 718 | class MyStack(object):
"""stack class
Attributes:
stack: stack
"""
def __init__(self):
self.stack = []
def pop(self):
"""pop method
Returns:
popped object
"""
return self.stack.pop()
def push(self, value):
""" push method
Args:
value: value to be pushed
"""
self.stack.append(value)
sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
if s in operators:
value1 = stack.pop()
value2 = stack.pop()
stack.push(eval(value1 + operators[s] + value2))
else:
stack.push(s)
print(stack.pop()) | Traceback (most recent call last):
File "/tmp/tmpt8h287c8/tmp99a_frtn.py", line 27, in <module>
sequence = raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s197980726 | p02263 | u811733736 | 1480468632 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | def do_calc(data):
from collections import deque
s = deque() # ??????????????¨??????????????????
while data:
elem = data[0]
data = data[1:]
if elem == '+' or elem == '-' or elem == '*':
try:
a = s.pop()
b = s.pop()
if elem == '+':
s.append(b + a)
elif elem == '-':
s.append(b - a)
elif elem == '*':
s.append(b * a)
except IndexError:
return None
else:
s.append(int(elem))
try:
result = s.pop()
except IndexError:
return None
else:
return result
if __name__ == '__main__':
# ??????????????\???
data = [int(x) for x in input().split(' ')]
# data = ['1', '2', '+', '3', '4', '-', '*']
# ???????????????
result = do_calc(data)
# ???????????????
print(result) | Traceback (most recent call last):
File "/tmp/tmpnsean3t7/tmpafajt1fe.py", line 31, in <module>
data = [int(x) for x in input().split(' ')]
^^^^^^^
EOFError: EOF when reading a line
| |
s961788674 | p02263 | u811733736 | 1480469070 | Python | Python3 | py | Runtime Error | 0 | 0 | 1254 | class Stack(object):
def __init__(self):
self.top = 0
self.data = []
def is_empty(self):
return self.top == 0
def push(self, x):
self.top += 1
self.data.append(x)
def pop(self):
self.top -= 1
item = self.data[-1]
del self.data[-1]
return item
def do_calc(data):
s = Stack() # ??????????????¨??????????????????
while data:
elem = data[0]
data = data[1:]
if elem == '+' or elem == '-' or elem == '*':
try:
a = s.pop()
b = s.pop()
if elem == '+':
s.push(b + a)
elif elem == '-':
s.push(b - a)
elif elem == '*':
s.push(b * a)
except IndexError:
return None
else:
s.push(int(elem))
try:
result = s.pop()
except IndexError:
return None
else:
return result
if __name__ == '__main__':
# ??????????????\???
data = [int(x) for x in input().split(' ')]
# data = ['1', '2', '+', '3', '4', '-', '*']
# ???????????????
result = do_calc(data)
# ???????????????
print(result) | Traceback (most recent call last):
File "/tmp/tmpcyz28eae/tmp4tfpa5yn.py", line 49, in <module>
data = [int(x) for x in input().split(' ')]
^^^^^^^
EOFError: EOF when reading a line
| |
s911282519 | p02263 | u209358977 | 1481470589 | Python | Python3 | py | Runtime Error | 20 | 7676 | 1240 | class MyStack:
def __init__(self, size):
self.stack = [0 for i in range(size)]
self.size = size
self.top = 0
def initialize(self):
self.top = 0
def push(self, elm):
self.top += 1
self.stack[self.top] = elm
return self.stack
def pop(self):
ret = self.stack[self.top]
self.stack[self.top] = 0
self.top -= 1
return ret
def is_empth(self):
if not self.is_full():
return True
return False
def is_full(self):
if self.size-1 is self.top:
return True
return False
def main(expr):
stack = MyStack(100)
for i, elm in enumerate(expr):
if expr[i] is '+':
a = stack.pop()
b = stack.pop()
stack.push(int(a) + int(b))
elif expr[i] is '-':
a = stack.pop()
b = stack.pop()
stack.push(int(b) - int(a))
elif expr[i] is '*':
a = stack.pop()
b = stack.pop()
stack.push(int(a) * int(b))
else:
stack.push(elm)
return stack.pop()
if __name__ == '__main__':
expr = [str(s) for s in input().split()]
print(main(expr)) | /tmp/tmp51jarh1d/tmpwfz_v3u0.py:35: SyntaxWarning: "is" with a literal. Did you mean "=="?
if expr[i] is '+':
/tmp/tmp51jarh1d/tmpwfz_v3u0.py:39: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif expr[i] is '-':
/tmp/tmp51jarh1d/tmpwfz_v3u0.py:43: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif expr[i] is '*':
Traceback (most recent call last):
File "/tmp/tmp51jarh1d/tmpwfz_v3u0.py", line 53, in <module>
expr = [str(s) for s in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s571602440 | p02263 | u895660619 | 1487983679 | Python | Python3 | py | Runtime Error | 0 | 0 | 604 | import numpy as np
N = input().split()
Nsum = list()
op = list()
for i in range(len(N)-1):
if N[i].isdigit():
op.append(float(N[i]))
else:
if N[i] == "+":
Nsum.append(op[0] + op[1])
op = list()
elif N[i] == "-":
Nsum.append(op[0] - op[1])
op = list()
elif N[i] == "*":
Nsum.append(op[0] * op[1])
op = list()
if N[-1] == "+":
print(np.sum(Nsum))
elif N[-1] == "-":
Nsub = Nsum[0]
for n in Nsum[1:]:
Nsub -= n
print(Nsub)
elif N[-1] == "*":
print(np.prod(Nsum)) | Traceback (most recent call last):
File "/tmp/tmprvss6lkc/tmpcs4thnfj.py", line 3, in <module>
N = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s593520537 | p02263 | u895660619 | 1487984310 | Python | Python3 | py | Runtime Error | 0 | 0 | 542 | import numpy as np
N = input().split()
Nsum = list()
op = list()
for i in range(len(N)):
if N[i].isdigit():
op.append(float(N[i]))
else:
if N[i] == "+":
opSum = np.sum(op)
op.clear()
op.append(opSum)
elif N[i] == "-":
sub = op[0]
for n in op[1:]:
sub -= n
op.clear()
op.append(sub)
elif N[i] == "*":
opProd = np.prod(op)
op.clear()
op.append(opProd)
print(op[0]) | Traceback (most recent call last):
File "/tmp/tmp68ov6m3_/tmpb213yzh9.py", line 3, in <module>
N = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s731060569 | p02263 | u895660619 | 1488051507 | Python | Python3 | py | Runtime Error | 0 | 0 | 414 | import numpy as np
o = list()
for s in input().split():
if s.isdigit():
o.insert(0, int(s))
else:
if s is "+":
o.append(o[0]+o[1])
o.pop(0)
o.pop(0)
if s is "-":
o.append(o[1] - o[0])
o.pop(0)
o.pop(0)
if s is "*":
o.append(o[0]*o[1])
o.pop(0)
o.pop(0)
print(o[0]) | /tmp/tmpdg03_4k0/tmpk13lqdjz.py:8: SyntaxWarning: "is" with a literal. Did you mean "=="?
if s is "+":
/tmp/tmpdg03_4k0/tmpk13lqdjz.py:12: SyntaxWarning: "is" with a literal. Did you mean "=="?
if s is "-":
/tmp/tmpdg03_4k0/tmpk13lqdjz.py:16: SyntaxWarning: "is" with a literal. Did you mean "=="?
if s is "*":
Traceback (most recent call last):
File "/tmp/tmpdg03_4k0/tmpk13lqdjz.py", line 4, in <module>
for s in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s378490938 | p02263 | u130834228 | 1490111373 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | ops ??????{"+": lambda a, b: b + a,
"-": lambda a, b: b - a,
"*": lambda a, b: b * a,
"/": lambda a, b: flaot(b)/a}
stack = []
for s in input().split():
if s in ops:
stack.append(ops[s](stack.pop(),stack.pop()))
else:
stack.append(int(s))
print stack[-1] | File "/tmp/tmp9chl0ego/tmpro957el2.py", line 1
ops ??????{"+": lambda a, b: b + a,
^
SyntaxError: invalid syntax
| |
s310211865 | p02263 | u868716420 | 1491340505 | Python | Python3 | py | Runtime Error | 20 | 7576 | 617 | Sum = input().split()
while ('+' in Sum) or ('-' in Sum) or ('*' in Sum) :
for che in 2, 3 :
if Sum[che] == '+' :
Sum.insert((che - 2), (int(Sum.pop(che - 2)) + int(Sum.pop(che - 2))))
del Sum[che - 1]
elif Sum[che] == '-' :
Sum.insert((che - 2), (int(Sum.pop(che - 2)) - int(Sum.pop(che - 2))))
del Sum[che - 1]
elif Sum[che] == '*' :
Sum.insert((che - 2), (int(Sum.pop(che - 2)) * int(Sum.pop(che - 2))))
del Sum[che - 1]
if ('+' not in Sum) and ('-' not in Sum) and ('*' not in Sum) : break
print(Sum[0]) | Traceback (most recent call last):
File "/tmp/tmpm4zvcj13/tmp3q432k1s.py", line 1, in <module>
Sum = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s857094970 | p02263 | u217534902 | 1492415565 | Python | Python | py | Runtime Error | 0 | 0 | 423 | # N = input()
operand = []
for x in raw_input().split():
if x.isdigit():
operand.append(int(x))
else:
a1 = operand[len(operand)-1]
operand.pop()
a2 = operand[len(operand)-1]
operand.pop()
operand.append(a2 + a1)
if x == '+' :
operand.append(a2 + a1)
elif x == '-':
operand.append(a2 - a1)
elif x == '*':
operand.append(a2 * a1)
print operand[0]
| File "/tmp/tmpqk2r0v3t/tmpdtaskmbr.py", line 12
if x == '+' :
IndentationError: unexpected indent
| |
s736474653 | p02263 | u217534902 | 1492415634 | Python | Python | py | Runtime Error | 0 | 0 | 381 | operand = []
for x in raw_input().split():
if x.isdigit():
operand.append(int(x))
else:
a1 = operand[len(operand)-1]
operand.pop()
a2 = operand[len(operand)-1]
operand.pop()
if x == '+' :
operand.append(a2 + a1)
elif x == '-':
operand.append(a2 - a1)
elif x == '*':
operand.append(a2 * a1)
print operand[0]
| File "/tmp/tmpub9bjopx/tmpqc73lt3m.py", line 10
if x == '+' :
IndentationError: unexpected indent
| |
s539994524 | p02263 | u796784914 | 1493453808 | Python | Python | py | Runtime Error | 0 | 0 | 622 | stack =[]
for item in raw_input().split():
stack.append(item)
def Cal(sym,n1,n2):
n1 = int(n1)
n2 = int(n2)
if sym == '+':
ans = n1 + n2
elif sym == '-':
ans = n1 - n2
else:
ans = n1 * n2
return ans
sym_stack = []
ans_stack = []
while len(stack)>0:
m = stack.pop()
if not m.isdigit():
sym_stack.append(m)
else:
n2 = m
n1 = stack.pop()
sym = sym_stack.pop()
ans = Cal(sym,n1,n2)
ans_stack.append(ans)
n2 = ans_stack.pop()
n1 = ans_stack.pop()
sym = sym_stack.pop()
Ans = Cal(sym,n1,n2)
print Ans | File "/tmp/tmpmvnnmp8p/tmp1rl1xlpo.py", line 38
print Ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s999785786 | p02263 | u796784914 | 1493454040 | Python | Python | py | Runtime Error | 10 | 6376 | 709 | stack =[]
for item in raw_input().split():
stack.append(item)
def Cal(sym,n1,n2):
n1 = int(n1)
n2 = int(n2)
if sym == '+':
ans = n1 + n2
elif sym == '-':
ans = n1 - n2
else:
ans = n1 * n2
return ans
sym_stack = []
ans_stack = []
while len(stack)>0:
m = stack.pop()
if not m.isdigit():
sym_stack.append(m)
else:
n2 = m
n1 = stack.pop()
sym = sym_stack.pop()
ans = Cal(sym,n1,n2)
ans_stack.append(ans)
while len(sym_stack)>0:
n2 = ans_stack.pop()
n1 = ans_stack.pop()
sym = sym_stack.pop()
ans = Cal(sym,n1,n2)
ans_stack.append(ans)
Ans = ans_stack.pop()
print Ans | File "/tmp/tmpogj95c00/tmpryssuwl5.py", line 40
print Ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s868074500 | p02263 | u371539389 | 1493493047 | Python | Python3 | py | Runtime Error | 30 | 7656 | 519 | operas=input().split(" ")
while len(operas)>1:
i=0
while i<len(operas):
try:
operas[i]=int(operas[i])
except ValueError:
if operas[i]=="+":
operas[i]=int(operas[i-2])+int(operas[i-1])
elif operas[i]=="-":
operas[i]=int(operas[i-2])-int(operas[i-1])
else:
operas[i]=int(operas[i-2])*int(operas[i-1])
operas.pop(i-2)
operas.pop(i-2)
i+=1
print(operas[0])
| Traceback (most recent call last):
File "/tmp/tmp53vb_fpx/tmpf2doj3jg.py", line 1, in <module>
operas=input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s491638968 | p02263 | u300946041 | 1493909366 | Python | Python3 | py | Runtime Error | 20 | 7692 | 394 | # -*- coding: utf-8 -*-
a = [e for e in input().split()]
l = []
i = 0
for x in a:
if x not in ['+', '-', '*']:
x = int(x)
l.append(x)
else:
a = l.pop(i)
b = l.pop(i)
if x == '+':
l.append(a + b)
elif x == '-':
l.append(a - b)
elif x == '*':
l.append(a * b)
i += 1
print(sum(l)) | Traceback (most recent call last):
File "/tmp/tmpuq02d5ac/tmpud1bn3xc.py", line 4, in <module>
a = [e for e in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s792723746 | p02263 | u067677727 | 1494227370 | Python | Python3 | py | Runtime Error | 0 | 0 | 833 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 8 15:36:48 2017
@author: Tomohisa
"""
import sys
def push(a,stack):
stack = stack + [a]
#print(stack)
return stack
def pop(stack):
a = stack[-1]
stack = stack[:-1]
#print(stack)
return a,stack
fname = sys.argv[1]
f = open(fname)
l = f.read().split()
stack = []
for i in range(len(l)):
if l[i] == '+':
b,stack = pop(stack)
a,stack = pop(stack)
stack = push(int(a)+int(b), stack)
elif l[i] == '-':
b,stack = pop(stack)
a,stack = pop(stack)
stack = push(int(a)-int(b), stack)
elif l[i] == '*':
b,stack = pop(stack)
a,stack = pop(stack)
stack = push(int(a)*int(b), stack)
else:
stack = push(l[i], stack)
print(pop(stack)[0]) | Traceback (most recent call last):
File "/tmp/tmp0rg9owv4/tmph7spzah8.py", line 22, in <module>
fname = sys.argv[1]
~~~~~~~~^^^
IndexError: list index out of range
| |
s955288322 | p02263 | u390442262 | 1494227480 | Python | Python3 | py | Runtime Error | 0 | 0 | 779 | def RPN(states):
operator = {
'+' :(lambda x, y: x + y),
'-' :(lambda x, y: x - y),
'*' :(lambda x, y: x * y),
'/' :(lambda x, y: float(x)/y)
}
stack = []
print ('RPN : %s' % states)
for index, z in enumerate(states):
if index > 0:
print stack
if z not in operator.keys ():
stack.append(int(z))
continue
y = stack.pop()
x = stack.pop()
stack.append(operator[z](x,y))
print ('%s %s %s = ' % (x, z, y))
print (stack[0])
return (stack[0])
if __name__ == '__main__':
import sys
RPN(sys.argv[1])
~ | File "/tmp/tmp0u2bw60o/tmpy2apx53i.py", line 13
print stack
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s622370590 | p02263 | u390442262 | 1494227966 | Python | Python3 | py | Runtime Error | 0 | 0 | 775 | def RPN(states):
operator = {
'+' :(lambda x, y: x + y),
'-' :(lambda x, y: x - y),
'*' :(lambda x, y: x * y),
'/' :(lambda x, y: float(x)/y)
}
stack = []
print ('RPN : %s' % states)
for index, z in enumerate(states):
if index > 0:
print stack
if z not in operator.keys ():
stack.append(int(z))
continue
y = stack.pop()
x = stack.pop()
stack.append(operator[z](x,y))
print ('%s %s %s = ' % (x, z, y))
print (stack[0])
return (stack[0])
if __name__ == '__main__':
import sys
RPN(input())
~ | File "/tmp/tmpa1deqkus/tmpdzb5ccrr.py", line 13
print stack
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s457969424 | p02263 | u390442262 | 1494228800 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | def RPN(states):
operator = {
'+' :(lambda x, y: x + y),
'-' :(lambda x, y: x - y),
'*' :(lambda x, y: x * y),
'/' :(lambda x, y: float(x)/y)
}
stack = []
print ('RPN : %s' % states)
for index, z in enumerate(states):
if index > 0:
print stack
if z not in operator.keys ():
stack.append(int(z))
continue
y = stack.pop()
x = stack.pop()
stack.append(operator[z](x,y))
print ('%s %s %s = ' % (x, z, y))
print (stack[0])
return (stack[0])
if __name__ == '__main__':
import sys
RPN(input().split(" ")) | File "/tmp/tmpylvvmkc6/tmpsr78yvjv.py", line 13
print stack
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s314070863 | p02263 | u279605379 | 1495586447 | Python | Python3 | py | Runtime Error | 20 | 7480 | 430 | #ALDS1_3-A Elementary data structures - Stack
A=input().split()
while(len(A)>1):
for i in range(len(A)):
if(A[i]=="+"):
A[i]=int(A[i-2])+int(A[i-1])
A=A[i:]
break
elif(A[i]=="-"):
A[i]=int(A[i-2])-int(A[i-1])
A=A[i:]
break
elif(A[i]=="*"):
A[i]=int(A[i-2])*int(A[i-1])
A=A[i:]
break
print(A[0]) | Traceback (most recent call last):
File "/tmp/tmp15a35d0g/tmpv5wxyfki.py", line 2, in <module>
A=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s860753451 | p02263 | u279605379 | 1495758870 | Python | Python3 | py | Runtime Error | 20 | 7660 | 451 | #ALDS1_3-A Elementary data structures - Stack
A=input().split()
while(len(A)>1):
for i in range(len(A)):
if(A[i]=="+"):
A[i]=int(A[i-2])+int(A[i-1])
A=A[i:]
break
elif(A[i]=="-"):
A[i]=int(A[i-2])-int(A[i-1])
A=A[i:]
break
elif(A[i]=="*"):
print(A)
A[i]=int(A[i-2])*int(A[i-1])
A=A[i:]
break
print(A[0]) | Traceback (most recent call last):
File "/tmp/tmp8d2v2rz4/tmp6zeofcpw.py", line 2, in <module>
A=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s882045566 | p02263 | u650790815 | 1496025889 | Python | Python3 | py | Runtime Error | 0 | 0 | 256 | f = input().strip().split()
q = []
for e in f:
if e =='+':
q.append(q.pop() + q.pop())
elif e == '-':
q.append(-q.pop() + q.pop())
elif e == '*':
q.append(q.pop() * q.pop())
else:
q.append(int(q))
print(q[0]) | Traceback (most recent call last):
File "/tmp/tmp5_zv2_ta/tmp2k4btr7_.py", line 1, in <module>
f = input().strip().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s302812935 | p02263 | u735204496 | 1499003196 | Python | Python | py | Runtime Error | 0 | 0 | 495 | import sys
stack = []
array = sys,stdin.readline().strip().split(" ")
for op in array:
if op.isdigit():
stack.append(int(op))
else:
tmp1 = stack.pop()
tmp2 = stack.pop()
if op == "+":
stack.append(tmp1 + tmp2)
elif op == "-":
stack.append(tmp2 - tmp1)
elif op == "*":
stack.append(tmp1 * tmp2)
elif op == "/":
stack.append(float(tmp2) / tmp1)
res = stack.pop()
print str(int(res)) | File "/tmp/tmpyd3gfiw9/tmpf5ze4w0x.py", line 22
print str(int(res))
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s638870445 | p02263 | u735204496 | 1499003221 | Python | Python | py | Runtime Error | 0 | 0 | 495 | import sys
stack = []
array = sys,stdin.readline().strip().split(" ")
for op in array:
if op.isdigit():
stack.append(int(op))
else:
tmp1 = stack.pop()
tmp2 = stack.pop()
if op == "+":
stack.append(tmp1 + tmp2)
elif op == "-":
stack.append(tmp2 - tmp1)
elif op == "*":
stack.append(tmp1 * tmp2)
elif op == "/":
stack.append(float(tmp2) / tmp1)
res = stack.pop()
print str(int(res)) | File "/tmp/tmphbu9m7ol/tmppuoob3up.py", line 22
print str(int(res))
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s531371206 | p02263 | u914146430 | 1500961251 | Python | Python3 | py | Runtime Error | 0 | 0 | 360 | s=input()
def r_poland(s):
stack=[]
for d in s:
if d.isdigit():
stack.append(int(d))
elif d=="+":
stack[-1]+=stack.pop(-2)
elif d=="-":
stack[-1]=stack.pop(-2)-stack[-1]
elif d=="*":
stack[-1]*=stack.pop(-2)
return stack
s=input()
print(*r_poland(s))
| Traceback (most recent call last):
File "/tmp/tmppqbjulwk/tmphvzt0x9o.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s890296548 | p02263 | u519227872 | 1501682083 | Python | Python3 | py | Runtime Error | 20 | 7412 | 247 | stack = [i for i in input().split()]
op = ['+', '*', '-']
while True:
a = stack.pop()
if a in op:
l = stack.pop()
r = stack.pop()
stack.append(eval(l + a + r))
if len(stack) == 1:
break
print (stack[0]) | Traceback (most recent call last):
File "/tmp/tmpxu62xd01/tmpcq009ph7.py", line 1, in <module>
stack = [i for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s276869947 | p02263 | u659034691 | 1502872152 | Python | Python3 | py | Runtime Error | 20 | 7784 | 605 | # your code goes here
#polland
def nu(x):
if x=="+" or x=="-" or x=="*":
return 0
else:
return 1
def c(a,b,l):
if l=="+":
d=a+b
elif l=="-":
d=a-b
else:
d=a*b
return d
F=[i for i in input().split()]
i=0
S=[]
while i<len(F):
if nu(F[i])==0:
S[-2]=c(S[-2],S[-1],F[i])
S.pop(-1)
i+=1
else:
F[i]=int(F[i])
if nu(F[i+1])==0:
S[-1]=c(S[-1],F[i],F[i+1])
i+=2
else:
F[i+1]=int(F[i+1])
S.append(c(F[i],F[i+1],F[i+2]))
i+=3
print(S[0]) | Traceback (most recent call last):
File "/tmp/tmp9dbmz0ue/tmpaqw4ori7.py", line 16, in <module>
F=[i for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s293422522 | p02263 | u343251190 | 1509196260 | Python | Python3 | py | Runtime Error | 20 | 7828 | 905 | data = input().split()
# ??????????????????????????????????£?
# n : ????????????????????????
# S : ????????????
n = 10
S = [0 for i in range(n)]
def isEmpty():
global top
if (top == 0):
return True
else:
return False
def isFull():
global top, n
return top > n-1
def push(S, x):
global top
if isFull():
print('error: overflow')
return False
top += 1
S[top] = x
def pop(S):
global top
if isEmpty():
print('error: underflow')
return False
top -= 1
return S[top+1]
top = 0
for e in data:
if e.isdigit():
push(S, e)
else:
a = int(pop(S))
b = int(pop(S))
if e == '+':
push(S, b + a)
elif e == '-':
push(S, b - a)
elif e == '*':
push(S, b * a)
else:
print('error: operand')
print(S[top]) | Traceback (most recent call last):
File "/tmp/tmp339yg4y2/tmpgfb92vk_.py", line 1, in <module>
data = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s461550836 | p02263 | u865281338 | 1511911918 | Python | Python3 | py | Runtime Error | 0 | 0 | 523 | def main():
list = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.apped(int(i))
print(stack.pop())
if __name__ = "__main__" :
main() | File "/tmp/tmpilrtsvvx/tmpizzpm198.py", line 27
if __name__ = "__main__" :
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s632246537 | p02263 | u865281338 | 1511911951 | Python | Python3 | py | Runtime Error | 0 | 0 | 522 | def main():
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.apped(int(i))
print(stack.pop())
if __name__ = "__main__" :
main() | File "/tmp/tmp5az5_20a/tmpqp503epu.py", line 27
if __name__ = "__main__" :
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s426596771 | p02263 | u865281338 | 1511911990 | Python | Python3 | py | Runtime Error | 0 | 0 | 523 | def main():
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.append(int(i))
print(stack.pop())
if __name__ = "__main__" :
main() | File "/tmp/tmpzqpnep4o/tmpsyhg2g9_.py", line 27
if __name__ = "__main__" :
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s004650471 | p02263 | u865281338 | 1511912359 | Python | Python3 | py | Runtime Error | 0 | 0 | 522 | def main():
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.append(int(i))
print(stack.pop())
if __name__ = "__main__" :
main() | File "/tmp/tmp8kvvqu6x/tmpteh7isk5.py", line 26
if __name__ = "__main__" :
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s391229107 | p02263 | u865281338 | 1511912437 | Python | Python3 | py | Runtime Error | 0 | 0 | 530 | def main() :
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.append(int(i))
print(stack.pop())
if __name__ == "__main__" :
main()
| Traceback (most recent call last):
File "/tmp/tmp81lwci9i/tmp6jdhk9el.py", line 27, in <module>
main()
File "/tmp/tmp81lwci9i/tmp6jdhk9el.py", line 2, in main
lst = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s481035299 | p02263 | u865281338 | 1511912449 | Python | Python3 | py | Runtime Error | 0 | 0 | 530 | def main() :
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.append(int(i))
print(stack.pop())
if __name__ == "__main__" :
main()
| Traceback (most recent call last):
File "/tmp/tmpx4b6p0lc/tmp7baxh3jk.py", line 27, in <module>
main()
File "/tmp/tmpx4b6p0lc/tmp7baxh3jk.py", line 2, in main
lst = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s584148488 | p02263 | u865281338 | 1511912469 | Python | Python3 | py | Runtime Error | 0 | 0 | 529 | def main() :
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :
x = stack.pop()
y = stack.pop()
stack.append(x * y)
else :
stack.append(int(i))
print(stack.pop())
if __name__ == "__main__" :
main()
| Traceback (most recent call last):
File "/tmp/tmpqllklmum/tmp3gyb9z10.py", line 27, in <module>
main()
File "/tmp/tmpqllklmum/tmp3gyb9z10.py", line 2, in main
lst = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s037651138 | p02263 | u530663965 | 1513501863 | Python | Python3 | py | Runtime Error | 20 | 5648 | 1567 | import sys
ERROR_INPUT = 'input is invalid'
OPERAND = ['+', '-', '*']
BUF = []
def main():
stack = get_input()
ans = calc_stack(stack=stack)
print(ans)
def calc_stack(stack):
if stack[-1] in OPERAND:
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
right_num = int(stack[-1])
stack.pop()
if stack[-1] in OPERAND:
BUF.append(right_num)
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
left_num = int(stack[-1])
stack.pop()
stack.append(calc(left_num, right_num, BUF[-1]))
BUF.pop()
stack.extend(reversed(BUF))
BUF.clear()
if len(stack) == 1:
return stack[0]
else:
return calc_stack(stack=stack)
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
operand_count = (inp.count(OPERAND[0]) + inp.count(OPERAND[1]) + inp.count(OPERAND[2]))
if len(inp) < 2 or len(inp) > 100:
print(ERROR_INPUT)
sys.exit(1)
elif operand_count < 1 or operand_count > 100:
print(ERROR_INPUT)
sys.exit(1)
for l in inp:
if l in OPERAND:
continue
elif int(l) < 0 or int(l) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmpbbnwer7l/tmpfgjqfsir.py", line 71, in <module>
main()
File "/tmp/tmpbbnwer7l/tmpfgjqfsir.py", line 9, in main
stack = get_input()
^^^^^^^^^^^
File "/tmp/tmpbbnwer7l/tmpfgjqfsir.py", line 51, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s124483918 | p02263 | u530663965 | 1513502620 | Python | Python3 | py | Runtime Error | 20 | 5620 | 1202 | import sys
ERROR_INPUT = 'input is invalid'
OPERAND = ['+', '-', '*']
STACK = []
def main():
inp = get_input()
print(calc_stack(li=inp))
def calc_stack(li):
if li[0] in OPERAND:
ans = calc(left=STACK[-2], right=STACK[-1], ope=li[0])
del li[0]
if not li:
return ans
STACK.pop()
STACK.pop()
STACK.append(ans)
return calc_stack(li=li)
else:
STACK.append(int(li[0]))
del li[0]
return calc_stack(li=li)
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
operand_count = (inp.count(OPERAND[0]) + inp.count(OPERAND[1]) + inp.count(OPERAND[2]))
if len(inp) < 2 or len(inp) > 100:
print(ERROR_INPUT)
sys.exit(1)
elif operand_count < 1 or operand_count > 100:
print(ERROR_INPUT)
sys.exit(1)
for l in inp:
if l in OPERAND:
continue
elif int(l) < 0 or int(l) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmp_16e8myn/tmpab0i9m1f.py", line 63, in <module>
main()
File "/tmp/tmp_16e8myn/tmpab0i9m1f.py", line 9, in main
inp = get_input()
^^^^^^^^^^^
File "/tmp/tmp_16e8myn/tmpab0i9m1f.py", line 43, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s401602767 | p02263 | u530663965 | 1513503280 | Python | Python3 | py | Runtime Error | 20 | 5648 | 1567 | import sys
ERROR_INPUT = 'input is invalid'
OPERAND = ['+', '-', '*']
BUF = []
def main():
stack = get_input()
ans = calc_stack(stack=stack)
print(ans)
def calc_stack(stack):
if stack[-1] in OPERAND:
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
right_num = int(stack[-1])
stack.pop()
if stack[-1] in OPERAND:
BUF.append(right_num)
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
left_num = int(stack[-1])
stack.pop()
stack.append(calc(left_num, right_num, BUF[-1]))
BUF.pop()
stack.extend(reversed(BUF))
BUF.clear()
if len(stack) == 1:
return stack[0]
else:
return calc_stack(stack=stack)
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
operand_count = (inp.count(OPERAND[0]) + inp.count(OPERAND[1]) + inp.count(OPERAND[2]))
if len(inp) < 2 or len(inp) > 100:
print(ERROR_INPUT)
sys.exit(1)
elif operand_count < 1 or operand_count > 100:
print(ERROR_INPUT)
sys.exit(1)
for l in inp:
if l in OPERAND:
continue
elif int(l) < 0 or int(l) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmphi1mrq35/tmphtpg3fjq.py", line 71, in <module>
main()
File "/tmp/tmphi1mrq35/tmphtpg3fjq.py", line 9, in main
stack = get_input()
^^^^^^^^^^^
File "/tmp/tmphi1mrq35/tmphtpg3fjq.py", line 51, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s030713151 | p02263 | u530663965 | 1513503320 | Python | Python3 | py | Runtime Error | 20 | 5648 | 1583 | import sys
ERROR_INPUT = 'input is invalid'
OPECODE = ['+', '-', '*']
BUF = []
def main():
stack = get_input()
ans = calc_stack(stack=stack)
print(ans)
def calc_stack(stack):
if stack[-1] in OPECODE:
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
right_num = int(stack[-1])
stack.pop()
if stack[-1] in OPECODE:
BUF.append(right_num)
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
left_num = int(stack[-1])
stack.pop()
stack.append(calc(left_num, right_num, BUF[-1]))
BUF.pop()
stack.extend(reversed(BUF))
BUF.clear()
if len(stack) == 1:
return stack[0]
else:
return calc_stack(stack=stack)
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
opecode_count = 0
OPECODE_count = 0
for i in inp:
if i in OPECODE:
opecode_count += 1
elif int(i) < 0 or int(i) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
else:
OPECODE_count += 1
if opecode_count < 1 or opecode_count > 100:
print(ERROR_INPUT)
sys.exit(1)
if OPECODE_count < 2 or OPECODE_count > 100:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmp25gpnoxd/tmpz977snkh.py", line 75, in <module>
main()
File "/tmp/tmp25gpnoxd/tmpz977snkh.py", line 9, in main
stack = get_input()
^^^^^^^^^^^
File "/tmp/tmp25gpnoxd/tmpz977snkh.py", line 51, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s093353849 | p02263 | u530663965 | 1513503327 | Python | Python3 | py | Runtime Error | 20 | 5652 | 1583 | import sys
ERROR_INPUT = 'input is invalid'
OPECODE = ['+', '-', '*']
BUF = []
def main():
stack = get_input()
ans = calc_stack(stack=stack)
print(ans)
def calc_stack(stack):
if stack[-1] in OPECODE:
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
right_num = int(stack[-1])
stack.pop()
if stack[-1] in OPECODE:
BUF.append(right_num)
BUF.append(stack[-1])
stack.pop()
return calc_stack(stack=stack)
else:
left_num = int(stack[-1])
stack.pop()
stack.append(calc(left_num, right_num, BUF[-1]))
BUF.pop()
stack.extend(reversed(BUF))
BUF.clear()
if len(stack) == 1:
return stack[0]
else:
return calc_stack(stack=stack)
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
opecode_count = 0
OPECODE_count = 0
for i in inp:
if i in OPECODE:
opecode_count += 1
elif int(i) < 0 or int(i) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
else:
OPECODE_count += 1
if opecode_count < 1 or opecode_count > 100:
print(ERROR_INPUT)
sys.exit(1)
if OPECODE_count < 2 or OPECODE_count > 100:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmpgjfhjn8p/tmppojrhjs_.py", line 75, in <module>
main()
File "/tmp/tmpgjfhjn8p/tmppojrhjs_.py", line 9, in main
stack = get_input()
^^^^^^^^^^^
File "/tmp/tmpgjfhjn8p/tmppojrhjs_.py", line 51, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s128450340 | p02263 | u530663965 | 1513503945 | Python | Python3 | py | Runtime Error | 0 | 0 | 1067 | import sys
ERROR_INPUT = 'input is invalid'
OPECODE = ['+', '-', '*']
STACK = []
def main():
inp = get_input()
print(calc_stack(li=inp))
def calc_stack(li):
for l in li:
if li[0] in OPECODE:
STACK.append(calc(right=STACK.pop(), left=STACK.pop(), ope=li[0]))
else:
STACK.append(int(l))
return STACK[0]
def calc(left, right, ope):
if ope == '+':
return left + right
elif ope == '-':
return left - right
elif ope == '*':
return left * right
def get_input():
inp = input().split(' ')
opecode_count = 0
operand_count = 0
for i in inp:
if i in OPECODE:
opecode_count += 1
elif int(i) < 0 or int(i) > 10**6:
print(ERROR_INPUT)
sys.exit(1)
else:
operand_count += 1
if opecode_count < 1 or opecode_count > 100:
print(ERROR_INPUT)
sys.exit(1)
if operand_count < 2 or operand_count > 100:
print(ERROR_INPUT)
sys.exit(1)
return inp
main() | Traceback (most recent call last):
File "/tmp/tmpanobgdnz/tmp2uyhhudw.py", line 58, in <module>
main()
File "/tmp/tmpanobgdnz/tmp2uyhhudw.py", line 9, in main
inp = get_input()
^^^^^^^^^^^
File "/tmp/tmpanobgdnz/tmp2uyhhudw.py", line 34, in get_input
inp = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s297083915 | p02263 | u150984829 | 1516513886 | Python | Python3 | py | Runtime Error | 0 | 0 | 131 | s=[]
for p in input().split():
if p in "+-*":
b=s.pop()
a=s.pop()
s.append(str(eval(a+p+b)))
else:
s.append(c)
print(*s)
| Traceback (most recent call last):
File "/tmp/tmp7lng66a5/tmp0aewysqo.py", line 2, in <module>
for p in input().split():
^^^^^^^
EOFError: EOF when reading a line
| |
s468263299 | p02263 | u011621222 | 1517465060 | Python | Python | py | Runtime Error | 0 | 0 | 1186 | class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(self):
return len(self.items)
s=Stack()
x = []
while next(x,None):
x = input().split( )
for index in range(len(x)):
if x[index]=='+':
second = int(s.pop())
first = int(s.pop())
sum = first + second
s.push(sum)
elif x[index]=='-':
second = int(s.pop())
first = int(s.pop())
sum = first - second
s.push(sum)
elif x[index]=='*':
second = int(s.pop())
first = int(s.pop())
sum = first * second
s.push(sum)
elif x[index]=='/':
second = int(s.pop())
first = int(s.pop())
sum = first / second
s.push(sum)
else:
s.push(x[index])
print(s.peek())
| Traceback (most recent call last):
File "/tmp/tmpbprzzcf7/tmpsmx54o1r.py", line 22, in <module>
while next(x,None):
^^^^^^^^^^^^
TypeError: 'list' object is not an iterator
| |
s478555480 | p02263 | u114628916 | 1519295020 | Python | Python3 | py | Runtime Error | 0 | 0 | 317 | import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
if __name__=='__main__':
print(revPlish(input()))
| Traceback (most recent call last):
File "/tmp/tmp67l9pfpb/tmp4zk39hq5.py", line 13, in <module>
print(revPlish(input()))
^^^^^^^^
NameError: name 'revPlish' is not defined. Did you mean: 'revPolish'?
| |
s910080730 | p02263 | u114628916 | 1519295120 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
print(revPlish(input()))
| Traceback (most recent call last):
File "/tmp/tmpbygnhu_h/tmpw4om3l2h.py", line 12, in <module>
print(revPlish(input()))
^^^^^^^^
NameError: name 'revPlish' is not defined. Did you mean: 'revPolish'?
| |
s913113525 | p02263 | u114628916 | 1519295200 | Python | Python3 | py | Runtime Error | 40 | 6540 | 289 | import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
print(revPolish(input()))
| Traceback (most recent call last):
File "/tmp/tmpcnni6upx/tmpr5uxya6k.py", line 12, in <module>
print(revPolish(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s480784676 | p02263 | u114628916 | 1519303255 | Python | Python3 | py | Runtime Error | 0 | 0 | 322 | import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
if __name__==`__main__`:
print(revPolish(input()))
| File "/tmp/tmpr581k02i/tmpgigyokgp.py", line 12
if __name__==`__main__`:
^
SyntaxError: invalid syntax
| |
s569693785 | p02263 | u646461156 | 1523539231 | Python | Python3 | py | Runtime Error | 20 | 5596 | 249 | s = input().split()
stk = []
for i in s:
if i >= '0' and i <= '9':
stk.append(int(i))
else:
a = stk.pop()
b = stk.pop()
if i == '+':
stk.append(b + a)
elif i == '-':
stk.append(b - a)
else:
stk.append(b * a)
print(stk.pop())
| Traceback (most recent call last):
File "/tmp/tmp5ni1tg6m/tmp2mvlfqyb.py", line 1, in <module>
s = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s344355596 | p02263 | u848218390 | 1524644503 | Python | Python3 | py | Runtime Error | 0 | 0 | 281 | A = input().split()
S = []
for i in A:
if i == '+' or i == '-' or i == '*':
a = pop()
b = pop()
if i == '+': S.append(a+b)
elif i == '-': S.append(a-b)
else: S.append(a*b)
else:
x = int(i)
S.append(x)
print(S[0])
| Traceback (most recent call last):
File "/tmp/tmpiv1yv9p0/tmpaw7csosc.py", line 1, in <module>
A = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s796683040 | p02263 | u609614788 | 1525074053 | Python | Python3 | py | Runtime Error | 0 | 0 | 794 | #include <iostream>
#include <stack>
#include <string>
#include <sstream>
inline int Seisu(std::string s) {
int v;
std::istringstream sin(s);
sin >> v;
return v;
}
int main () {
std::string s;
std::stack<int> st;
while (std::cin >> s) {
if (s[0]>='0' and s[0]<='9') {
st.push(Seisu(s));
}
else {
int a = st.top();
st.pop();
int b = st.top();
st.pop();
switch(s[0]) {
case '+':
st.push(a + b);
break;
case '-':
st.push(b - a);
break;
case '*':
st.push(a * b);
break;
}
}
}
std::cout<<st.top()<<'\n';
return 0;
}
| File "/tmp/tmp3vpk6u8f/tmp8u3w6tnt.py", line 6
inline int Seisu(std::string s) {
^^^
SyntaxError: invalid syntax
| |
s816851520 | p02263 | u772417059 | 1525205189 | Python | Python | py | Runtime Error | 0 | 0 | 326 | a=input().split()
b=[]
for i in range(len(a)):
if a[i]=="+":
b[len(b)-2]=b[len(b)-2]+b[len(b)-1];
del b[len(b)-1]
elif a[i]=="-":
b[len(b)-2]=b[len(b)-2]-b[len(b)-1];
del b[len(b)-1]
elif a[i]=="*":
b[len(b)-2]=b[len(b)-2]*b[len(b)-1];
del b[len(b)-1]
else:
b.append(int(a[i]))
print(b[len(b)-1])
| Traceback (most recent call last):
File "/tmp/tmp4i7qf1h4/tmptbpby8xm.py", line 1, in <module>
a=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s876003010 | p02263 | u772417059 | 1525205290 | Python | Python | py | Runtime Error | 0 | 0 | 326 | a=input().split()
b=[]
for i in range(len(a)):
if a[i]=="+":
b[len(b)-2]=b[len(b)-2]+b[len(b)-1];
del b[len(b)-1]
elif a[i]=="-":
b[len(b)-2]=b[len(b)-2]-b[len(b)-1];
del b[len(b)-1]
elif a[i]=="*":
b[len(b)-2]=b[len(b)-2]*b[len(b)-1];
del b[len(b)-1]
else:
b.append(int(a[i]))
print(b[len(b)-1])
| Traceback (most recent call last):
File "/tmp/tmp7hlkkgc3/tmpoq_8w40s.py", line 1, in <module>
a=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s836017192 | p02263 | u308770067 | 1525753202 | Python | Python3 | py | Runtime Error | 0 | 0 | 755 | #include <iostream>
#include <cstdlib>
using namespace std;
static string tasu = "+";
static string hiku = "-";
static string kakeru = "*";
int top = 0;
int S[200];
void push(int x) {
S[++top] = x;
}
int usiro() {
return S[top--];
}
int main () {
string s;
while (cin >> s) {
if (s == tasu) {
int a = usiro();
int b = usiro();
push(a + b);
} else if (s == hiku) {
int a = usiro();
int b = usiro();
push(b - a);
} else if (s == kakeru) {
int a = usiro();
int b = usiro();
push(a * b);
} else {
push(atoi(s.c_str()));
}
}
cout << usiro() << endl;
return 0;
| File "/tmp/tmpgap2opco/tmp47zv7w07.py", line 3
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s431788107 | p02263 | u909075105 | 1525781192 | Python | Python3 | py | Runtime Error | 0 | 0 | 244 | #16D8101023J 久保田凌弥 kubotarouxxx python3
stak = []
for i in input().split():
if i in "+-*":
a = stak.pop()
b = stak.pop()
stak.append(str(eval(b + i + a)))
else:
stak.append(i)
print(stak.pop())
| File "/tmp/tmpcwxuq9tz/tmpcg_ma9tw.py", line 9
stak.append(str(eval(b + i + a)))
IndentationError: unexpected indent
| |
s333606398 | p02263 | u909075105 | 1525781378 | Python | Python3 | py | Runtime Error | 0 | 0 | 186 | stk = []
for c in input().split():
if c in "+-*":
a = stk.pop()
b = stk.pop()
stk.append(str(eval(b + c + a)))
else:
stk.append(c)
print(stk.pop(
| File "/tmp/tmpybl44n4f/tmpzwqo3x8x.py", line 9
print(stk.pop(
^
SyntaxError: '(' was never closed
| |
s902397976 | p02263 | u728137020 | 1525820480 | Python | Python3 | py | Runtime Error | 0 | 0 | 358 | list=[]
for i in input.split():
if i=='+':
list[len(list)-1]=list[len(list)-1]+list[len(list)]
list.pop()
elif i=='-':
list[len(list)-1]=[len(list)-1]-list[len(list)]
list.pop()
elif i=='*':
list[len(list)-1]=[len(list)-1]*list[len(list)]
list.pop()
else:
list.append()
print(list[0])
| Traceback (most recent call last):
File "/tmp/tmpjztrop3r/tmpu0l5wfsm.py", line 2, in <module>
for i in input.split():
^^^^^^^^^^^
AttributeError: 'builtin_function_or_method' object has no attribute 'split'
| |
s011241938 | p02263 | u573915636 | 1525847771 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | l=[]
c=0
s=input().split()
for i in s:
if i=="+":
l[c-2]=l[c-2]+l[c-1]
c=c-1
elif i=="-":
l[c-2]=l[c-2]-l[c-1]
c=c-1
elif i=="*":
l[c-2]=l[c-2]*l[c-1]
c=c-1
else:
l[c]=int(i)
c=c+1
printl[0]
| Traceback (most recent call last):
File "/tmp/tmpt7nlvh7i/tmp0o2szmti.py", line 3, in <module>
s=input().split()
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.