ZhenlongDai/ACPR huggingface dataset:
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def cal(ope,a,b):
    if ope=="+":
        x=a+b
    elif ope=="-":
        x=a-b
    elif ope=="*":
        x=a*b
    return x

lst=input().split()
stack=[]
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
    else:
        lst[i]=int(lst[i])
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": 
        a=stack.pop()
        b=stack.pop()
        c=cal(lst[i],a,b)
        stack.append(c)
    else:
        stack.append(lst[i])
print(stack[0])


Failing test case input:
0 0 + 6 21 - +

Expected output:
-15


Actual output:
15


Fixed submission (verdict: Accepted):
def cal(ope,a,b):
    if ope=="+":
        x=a+b
    elif ope=="-":
        x=a-b
    elif ope=="*":
        x=a*b
    return x

lst=input().split()
stack=[]
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
    else:
        lst[i]=int(lst[i])
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": 
        a=stack.pop()
        b=stack.pop()
        c=cal(lst[i],b,a)
        stack.append(c)
    else:
        stack.append(lst[i])
print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
s=[i for i in input().split()]
k=[]

for i in range(len(s)):
    if s[i]=="+":
        a=k.pop()
        b=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        a=k.pop()
        b=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        a=k.pop()
        b=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i])

print(k[0])


Failing test case input:
1 4 + 3 8 - *

Expected output:
-25


Actual output:
25


Fixed submission (verdict: Accepted):
s=[i for i in input().split()]
k=[]

for i in range(len(s)):
    if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i])

print(k[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):


import functools
N = input().split()
stack=[]

for i in N:
    if i.isdigit():
        stack.append(int(i))
        
    else:
        key=0
        if i=="+":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1+p2)
        elif i=="-":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1-p2)
        elif i=="*":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1*p2)
print(stack)

Failing test case input:
1 7 + 3 8 - *

Expected output:
-40


Actual output:
[-40]


Fixed submission (verdict: Accepted):


import functools
N = input().split()
stack=[]

for i in N:
    if i.isdigit():
        stack.append(int(i))
        
    else:
        key=0
        if i=="+":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1+p2)
        elif i=="-":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1-p2)
        elif i=="*":
            p2=stack.pop()
            p1=stack.pop()
            stack.append(p1*p2)
print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
expr = input().split()
my_stack = []

def push(stack, item):
    return stack.append(item)

def pop(stack):
    return stack[:-1], stack[-1]

for item in expr:
    if item.isdigit():
        push(my_stack, int(item))
    elif item == '+':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a + b)
    elif item == '-':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a - b)
    elif item == '*':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a * b)
print(my_stack[0])

Failing test case input:
2 4 * 4 0 - *

Expected output:
32


Actual output:
-32


Fixed submission (verdict: Accepted):
expr = input().split()
my_stack = []
def push(stack, item):
    return stack.append(item)

def pop(stack):
    return stack[:-1], stack[-1]

for item in expr:
    if item.isdigit():
        push(my_stack, int(item))
    elif item == '+':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a + b)
    elif item == '-':
        
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, b - a)
    elif item == '*':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a * b)

print(my_stack[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(str(result[0]))


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Failing test case input:
2 4 + 5 0 - *

Expected output:
30


Actual output:
['2', '4', '+', '5', '0', '-', '*']
30


Fixed submission (verdict: Accepted):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def cal(ope,a,b):
    if ope=="+":
        x=a+b
    elif ope=="-":
        x=a-b
    elif ope=="*":
        x=a*b
    return x

lst=input().split()
stack=[]
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
    else:
        lst[i]=int(lst[i])
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": 
        a=stack.pop()
        b=stack.pop()
        c=cal(lst[i],b,a)
        print(c)
        stack.append(c)
    else:
        stack.append(lst[i])
print(stack[0])




Failing test case input:
44 1 +

Expected output:
45


Actual output:
45
45


Fixed submission (verdict: Accepted):
def cal(ope,a,b):
    if ope=="+":
        x=a+b
    elif ope=="-":
        x=a-b
    elif ope=="*":
        x=a*b
    return x

lst=input().split()
stack=[]
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
    else:
        lst[i]=int(lst[i])
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": 
        a=stack.pop()
        b=stack.pop()
        c=cal(lst[i],b,a)
        stack.append(c)
    else:
        stack.append(lst[i])
print(stack[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):

Stack = []

A = [i for i in input().split()]

for inputData in A:
    if inputData == "+":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x+y)

    elif inputData == "-":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x-y)

    elif inputData == "*":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x*y)

    else:
        Stack.append(int(inputData))
        
print(Stack.pop())


Failing test case input:
1 1 + 5 11 - *

Expected output:
-12


Actual output:
12


Fixed submission (verdict: Accepted):

Stack = []

A = [i for i in input().split()]

for inputData in A:
    if inputData == "+":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x+y)

    elif inputData == "-":
        y = Stack.pop()
        x = Stack.pop()
        Stack.append(x-y)

    elif inputData == "*":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x*y)

    else:
        Stack.append(int(inputData))

print(Stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
box = []
elem = input().split()
print(elem)
for i in elem:
    if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i)

print (box[0])

Failing test case input:
0 0 +

Expected output:
0


Actual output:
['0', '0', '+']
0


Fixed submission (verdict: Accepted):
box = []
elem = input().split()
for i in elem:
    if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i)
print (box[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
shiki = input().split(' ')
stack = [];

for i in shiki:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(stack.pop() - stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print(stack.pop())

Failing test case input:
1 11 + 0 5 - *

Expected output:
-60


Actual output:
60


Fixed submission (verdict: Accepted):
shiki = input().split(' ')
stack = [];

for i in shiki:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(- stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print(stack.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
l=list(input().split())  
stack=[]

for x in l:
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        t+=x+r
        stack+=[int(eval(t))] 
    else:
        stack+=[int(x)] 

print(stack.pop())


Failing test case input:
2 4 * 3 1 - +

Expected output:
10


Actual output:
6


Fixed submission (verdict: Accepted):
l=list(input().split())  
stack=[]

for x in l: 
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        c=r+x+t
        stack+=[int(eval(c))] 

    else:
        stack+=[int(x)] 

print(stack.pop())

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
arguments = input().split()
print(arguments)

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1-s2)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))

print(array.pop())

Failing test case input:
23 4 +

Expected output:
27


Actual output:
['23', '4', '+']
27


Fixed submission (verdict: Accepted):
arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))


print(array.pop())

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))


Failing test case input:
1 8 + 1 4 - *

Expected output:
-27


Actual output:

Fixed submission (verdict: Accepted):
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))

print(calc_reverse_polish_notation(A))
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
import sys
str = ""
for line in sys.stdin:
	str = line

numbers = str.split()

answer = 0
stackList = []

for number in numbers :

    if number == '+' :
        answer = int(stackList.pop()) + int(stackList.pop())
        stackList.append(answer)
        print('+')
        print(answer)
    elif number == '-' :
        x = int(stackList.pop())
        y = int(stackList.pop())
        answer = y - x
        stackList.append(answer)
        print('-')
        print(answer)
    elif number == '*' :
        answer = int(stackList.pop()) * int(stackList.pop())
        stackList.append(answer)
        print('*')
        print(answer)
    else :
        stackList.append(number)

print(answer)


Failing test case input:
2 4 * 5 0 - +

Expected output:
13


Actual output:
*
8
-
5
+
13
13


Fixed submission (verdict: Accepted):
import sys
str = ""
for line in sys.stdin:
	str = line

numbers = str.split()

answer = 0
stackList = []

for number in numbers :

    if number == '+' :
        answer = int(stackList.pop()) + int(stackList.pop())
        stackList.append(answer)
    elif number == '-' :
        x = int(stackList.pop())
        y = int(stackList.pop())
        answer = y - x
        stackList.append(answer)
    elif number == '*' :
        answer = int(stackList.pop()) * int(stackList.pop())
        stackList.append(answer)
    else :
        stackList.append(number)

print(answer)

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
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 = []
        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 (stack[0])
        return (stack[0])

if __name__ == '__main__':
        import sys
        RPN(input().split(" "))

Failing test case input:
0 1 +

Expected output:
1


Actual output:
[0]
[0, 1]
1


Fixed submission (verdict: Accepted):
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 = []
        for index, z in enumerate(states):
                if z not in operator.keys ():
                        stack.append(int(z))
                        continue
                y = stack.pop()
                x = stack.pop()
                stack.append(operator[z](x,y))
        print (stack[0])
        return (stack[0])

if __name__ == '__main__':
        import sys
        RPN(input().split(" "))
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def kei(a,i,x,y):
	if a[i]=="+":
		st=x+y
		print("+")
	elif a[i]=="-":
		st=y-x
		print("-")
	elif a[i]=="*":
		st=x*y
		print("*") 
	return st


a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
	if a[i].isdigit():
		stac.append(int(a[i]))
		
	else:
		x=stac.pop()
		y=stac.pop()
		stac.append(kei(a,i,x,y))
		
print(stac[0])
		



Failing test case input:
2 17 *

Expected output:
34


Actual output:
*
34


Fixed submission (verdict: Accepted):
def kei(a,i,x,y):
	if a[i]=="+":
		st=x+y
		
	elif a[i]=="-":
		st=y-x
		
	elif a[i]=="*":
		st=x*y
		
	return st


a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
	if a[i].isdigit():
		stac.append(int(a[i]))
		
	else:
		x=stac.pop()
		y=stac.pop()
		stac.append(kei(a,i,x,y))
		
print(stac[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def calc(stack, s):
	a = stack.pop()
	b = stack.pop()
	if s=='+':
		stack.append(a+b)
	elif s=='-':
		stack.append(a-b)
	elif s=='*':
		stack.append(a*b)

		

S = list(input().split())

stack = []
for s in S:
	if s in ['+', '-', '*']:
		calc(stack, s)
	else:
		stack.append(int(s))

print(stack[0])


Failing test case input:
2 4 * 5 0 - +

Expected output:
13


Actual output:
3


Fixed submission (verdict: Accepted):
def calc(stack, s):
	a = stack.pop()
	b = stack.pop()
	if s=='+':
		stack.append(b+a)
	elif s=='-':
		stack.append(b-a)
	elif s=='*':
		stack.append(b*a)

		

S = list(input().split())

stack = []
for s in S:
	if s in ['+', '-', '*']:
		calc(stack, s)
	else:
		stack.append(int(s))

print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        l = stack.pop()
        r = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)

print (stack[0])

Failing test case input:
1 4 + 5 0 - *

Expected output:
25


Actual output:
-25


Fixed submission (verdict: Accepted):
i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)
print (stack[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
S = list(input())
a = []


kazu = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]

for i in range(len(S)):
    if S[i] in kazu:
        S[i] = int(S[i])
        a.append(S[i])

    elif S[i] == "+":
        x = a.pop()
        y = a.pop()
        a.append(x+y)

    elif S[i] == "-":
        x = a.pop()
        y = a.pop()
        a.append(y-x)

    elif S[i] == "*":
        x = a.pop()
        y = a.pop()
        a.append(x*y)

print(a[0])



Failing test case input:
0 0 + 6 13 - +

Expected output:
-7


Actual output:
0


Fixed submission (verdict: Accepted):
S = list(input().split())
a = []

kazu = []
for i in range(1+10**6):
    kazu.append(str(i))


for i in range(len(S)):
    if S[i] in kazu:
        a.append(int(S[i]))

    elif S[i] == "+":
        x = a.pop()
        y = a.pop()
        a.append(x+y)
    
    elif S[i] == "-":
        x = a.pop()
        y = a.pop()
        a.append(y-x)

    elif S[i] == "*":
        x = a.pop()
        y = a.pop()
        a.append(x*y)
        
print(a[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def kei(a,i,x,y):
	if a[i]=="+":
		st=x+y
		
	elif a[i]=="-":
		st=x-y
		
	elif a[i]=="*":
		st=x*y
		
	return st


a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
	if a[i].isdigit():
		stac.append(int(a[i]))
		
	else:
		x=stac.pop()
		y=stac.pop()
		stac.append(kei(a,i,x,y))
		
print(stac[0])
		



Failing test case input:
2 4 * 6 0 - +

Expected output:
14


Actual output:
2


Fixed submission (verdict: Accepted):
def kei(a,i,x,y):
	if a[i]=="+":
		st=x+y
		
	elif a[i]=="-":
		st=y-x
		
	elif a[i]=="*":
		st=x*y
		
	return st


a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
	if a[i].isdigit():
		stac.append(int(a[i]))
		
	else:
		x=stac.pop()
		y=stac.pop()
		stac.append(kei(a,i,x,y))
		
print(stac[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
l=list(input().split())  
stack=[]

for x in l: 
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        c=r+x+t
        stack+=[int(eval(c))] 
        print(stack)
    else:
        stack+=[int(x)] 
        print(stack)
print(stack.pop())



Failing test case input:
1 3 * 3 4 - *

Expected output:
-3


Actual output:
[1]
[1, 3]
[3]
[3, 3]
[3, 3, 4]
[3, -1]
[-3]
-3


Fixed submission (verdict: Accepted):
l=list(input().split())  
stack=[]

for x in l: 
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        c=r+x+t
        stack+=[int(eval(c))] 

    else:
        stack+=[int(x)] 

print(stack.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
inputs = input().split(" ")
stack = []

for str in inputs:
  if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
      print(stack)
    elif str == '-':
      stack.append(a - b)
      print(stack)
    elif str == '*':
      stack.append(a * b)
      print(stack)

print(stack.pop())


Failing test case input:
1 1 + 5 7 - *

Expected output:
-4


Actual output:
[2]
[2, -2]
[-4]
-4


Fixed submission (verdict: Accepted):
inputs = input().split(" ")
stack = []

for str in inputs:
  if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b)

print(stack.pop())

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
fig = input()
symbol = fig.split(' ')
stack = []

for i in symbol:
    try:
        stack.append(int(i))
    except ValueError:
       if i == "+": stack.append(stack.pop()+stack.pop())
       elif i == "-": stack.append(-(stack.pop()-stack.pop()))
       elif i == "*": stack.append(stack.pop()*stack.pop())
    print(stack)

print(stack[0])

Failing test case input:
1 11 + 2 6 - *

Expected output:
-48


Actual output:
[1]
[1, 11]
[12]
[12, 2]
[12, 2, 6]
[12, -4]
[-48]
-48


Fixed submission (verdict: Accepted):
fig = input()
symbol = fig.split(' ')
stack = []

for i in symbol:
    try:
        stack.append(int(i))
    except ValueError:
       if i == "+": stack.append(stack.pop()+stack.pop())
       elif i == "-": stack.append(-(stack.pop()-stack.pop()))
       elif i == "*": stack.append(stack.pop()*stack.pop())

print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
inList = input().split()
stack = []
for i in inList:
    if i in ['+', '-', '*']:
        b, a = stack.pop(), stack.pop()
        if i == '+':
            stack.append(b + a)
        if i == '-':
            stack.append(b - a)
        if i == '*':
            stack.append(b * a)
    else:
        stack.append(int(i))
print(stack.pop())

Failing test case input:
1 7 * 8 0 - +

Expected output:
15


Actual output:
-1


Fixed submission (verdict: Accepted):
x = input().split()
A = []
for i in x:
    try:
        A.append(int(i))
    except:
        b = A.pop()
        a = A.pop()
        if i == '+':
            A.append(a + b)
        if i == '-':
            A.append(a - b)
        if i == '*':
            A.append(a * b)
print(A.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):

Stack = []

A = [i for i in input().split()]

for inputData in A:
    if inputData == "+":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x+y)

    elif inputData == "-":
        y = Stack.pop()
        x = Stack.pop()
        Stack.append(x-y)

    elif inputData == "*":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x*y)

    else:
        Stack.append(int(inputData))

print(Stack)


Failing test case input:
2 58 *

Expected output:
116


Actual output:
[116]


Fixed submission (verdict: Accepted):

Stack = []

A = [i for i in input().split()]

for inputData in A:
    if inputData == "+":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x+y)

    elif inputData == "-":
        y = Stack.pop()
        x = Stack.pop()
        Stack.append(x-y)

    elif inputData == "*":
        x = Stack.pop()
        y = Stack.pop()
        Stack.append(x*y)

    else:
        Stack.append(int(inputData))

print(Stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))

calc_reverse_polish_notation(A)


Failing test case input:
1 58 *

Expected output:
58


Actual output:

Fixed submission (verdict: Accepted):
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))

print(calc_reverse_polish_notation(A))

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
import operator

func = {'+':operator.add, '-':operator.sub, '*':operator.mul}

stack  = []
for symbol in input().split():
    if symbol.isdigit():
        stack.append(int(symbol))
    else:
        stack.append(func[symbol](stack.pop(), stack.pop()))
        
print(stack[0])

Failing test case input:
1 4 * 3 8 - *

Expected output:
-20


Actual output:
20


Fixed submission (verdict: Accepted):
import operator

func = {'+':operator.add, '-':operator.sub, '*':operator.mul}

stack  = []
for symbol in input().split():
    if symbol.isdigit():
        stack.append(int(symbol))
    else:
        a = stack.pop()
        b = stack.pop()
        stack.append(func[symbol](b, a))
        
print(stack[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
fig = input()
symbol = fig.split(' ')
stack = []

for i in symbol:
    try:
        stack.append(int(i))
    except ValueError:
       if i == "+": stack.append(stack.pop()+stack.pop())
       elif i == "-": stack.append(stack.pop()-stack.pop())
       elif i == "*": stack.append(stack.pop()*stack.pop())

print(stack[0])

Failing test case input:
1 12 + 3 8 - *

Expected output:
-65


Actual output:
65


Fixed submission (verdict: Accepted):
fig = input()
symbol = fig.split(' ')
stack = []

for i in symbol:
    try:
        stack.append(int(i))
    except ValueError:
       if i == "+": stack.append(stack.pop()+stack.pop())
       elif i == "-": stack.append(-(stack.pop()-stack.pop()))
       elif i == "*": stack.append(stack.pop()*stack.pop())

print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
if __name__=="__main__":
    a = list(input().split())
    print(a)
    b = []
    for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
    print(b[0])

Failing test case input:
12 4 +

Expected output:
16


Actual output:
['12', '4', '+']
16


Fixed submission (verdict: Accepted):
if __name__=="__main__":
    a = list(input().split())
    b = []
    for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
    print(b[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
arr = input().split()
stack = list()
for el in arr:
    if el.isdigit():
        stack.append(int(el))
        continue
    elif el == "*":
        stack.append(stack.pop() * stack.pop())
        continue
    elif el == "+":
        stack.append(stack.pop() + stack.pop())
        continue
    elif el == "-":
        stack.append(stack.pop() - stack.pop())
        continue
print(stack.pop())


Failing test case input:
1 0 + 5 7 - *

Expected output:
-2


Actual output:
2


Fixed submission (verdict: Accepted):
arr = input().split()
stack = list()
for el in arr:
    if el.isdigit():
        stack.append(int(el))
        continue
    elif el == "*":
        stack.append(stack.pop() * stack.pop())
        continue
    elif el == "+":
        stack.append(stack.pop() + stack.pop())
        continue
    elif el == "-":
        stack.append(-stack.pop() + stack.pop())
        continue
print(stack.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):

A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        print(A)
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            print(A)
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])

Failing test case input:
2 17 *

Expected output:
34


Actual output:
['2', '17', '*']
['2', '17', '*']
['2', '17', '*']
['2', '17', '*']
34


Fixed submission (verdict: Accepted):

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-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
input_line = input().split()
stack = []
for i in input_line:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i =='*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))
print(stack)




Failing test case input:
1 4 * 3 1 - *

Expected output:
8


Actual output:
[8]


Fixed submission (verdict: Accepted):
input_line = input().split()
stack = []
for i in input_line:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i =='*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))
print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
n=input().split()
c=0
while len(n)!=1:
	if n[c]=='+':
		n[c-2]=int(n[c-2])+int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='-':
		n[c-2]=int(n[c-2])-int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='*':
		n[c-2]=int(n[c-2])*int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='/':
		n[c-2]=int(n[c-2])/int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	c+=1
print(n)


Failing test case input:
1 4 * 5 0 - *

Expected output:
20


Actual output:
[20]


Fixed submission (verdict: Accepted):
n=input().split()
c=0
while len(n)!=1:
	if n[c]=='+':
		n[c-2]=int(n[c-2])+int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='-':
		n[c-2]=int(n[c-2])-int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='*':
		n[c-2]=int(n[c-2])*int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	elif n[c]=='/':
		n[c-2]=int(n[c-2])/int(n[c-1])
		del n[c-1]
		del n[c-1]
		c=0
	c+=1
a=int(n[0])
print(a)
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
import re

data = input().split()
stack = []

for elem in data:
    if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a)
    print(elem, stack)
print(stack[0])

Failing test case input:
0 0 *

Expected output:
0


Actual output:
0 [0]
0 [0, 0]
* [0]
0


Fixed submission (verdict: Accepted):
import re

data = input().split()
stack = []

for elem in data:
    if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a)

print(stack[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
a = input().split()
b = []
for i in a:
    if i.isdigit():
        b.append(i)
    else:
        c = b.pop()
        d = b.pop()
        ans = eval(str(d)+i+str(c))
        b.append(ans)
print(b)



Failing test case input:
2 4 * 4 0 - *

Expected output:
32


Actual output:
[32]


Fixed submission (verdict: Accepted):
a = input().split()
b = []
for i in a:
    if i.isdigit():
        b.append(i)
    else:
        c = b.pop()
        d = b.pop()
        ans = eval(str(d)+i+str(c))
        b.append(ans)
print(b[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
arguments = input().split()
print(arguments)

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1-s2)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))

print(str(array.pop()))

Failing test case input:
1 1 + 5 4 - *

Expected output:
2


Actual output:
['1', '1', '+', '5', '4', '-', '*']
-2


Fixed submission (verdict: Accepted):
arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))


print(array.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
l=list(input().split())  
stack=[]

for x in l: 
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        t+=x+r
        stack+=[int(eval(t))] 
    else:
        stack+=[int(x)] 

print(stack.pop())


Failing test case input:
0 0 + 6 13 - +

Expected output:
-7


Actual output:
7


Fixed submission (verdict: Accepted):
l=list(input().split())  
stack=[]

for x in l: 
    if x in ['+','-','*']: 
        t=str(stack.pop()) 
        r=str(stack.pop())
        c=r+x+t
        stack+=[int(eval(c))] 

    else:
        stack+=[int(x)] 

print(stack.pop())

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1-s2)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))

print(array.pop())

Failing test case input:
1 4 * 3 1 - +

Expected output:
6


Actual output:
2


Fixed submission (verdict: Accepted):
arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))


print(array.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        result = [str(i) for i in result]
        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Failing test case input:
22 1 +

Expected output:
23


Actual output:
['22', '1', '+']
23


Fixed submission (verdict: Accepted):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):

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-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            print(A)
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])

Failing test case input:
1 4 + 3 4 - *

Expected output:
-5


Actual output:
[5, -1, '*']
-5


Fixed submission (verdict: Accepted):

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-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
q = []
for e in input().strip().split():
    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(e))

Failing test case input:
1 6 + 1 4 - *

Expected output:
-21


Actual output:

Fixed submission (verdict: Accepted):
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(e))

print(q[0])

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
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))

    

Failing test case input:
12 4 +

Expected output:
16


Actual output:
1 6


Fixed submission (verdict: Accepted):
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=list(input().split())

print(*r_poland(s))

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):


formula = input().split()
stack = []
for char in formula:
    if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans)
    print(stack)
print(stack.pop())

Failing test case input:
13 3 *

Expected output:
39


Actual output:
['13']
['13', '3']
['39']
39


Fixed submission (verdict: Accepted):


formula = input().split()
stack = []
for char in formula:
    if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans)
print(stack.pop())
Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Failing test case input:
2 4 * 3 1 - +

Expected output:
10


Actual output:
['2', '4', '*', '3', '1', '-', '+']
10


Fixed submission (verdict: Accepted):




class Solution:
    @staticmethod
    def stack_polish_calc():
        
        
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()

Problem: p02263
Buggy submission (Python3, verdict: Wrong Answer):
class Stack:
    MAX = 100

    def __init__(self):
        self.S = [None] * self.__class__.MAX
        self.top = 0

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.__class__.MAX - 1

    def push(self, x):
        self.top += 1
        self.S[self.top] = x

    def pop(self):
        self.top -= 1
        return self.S[self.top + 1]


arr = [str(s) for s in input().split()]
stack = Stack()
for s in arr:
    if s in ["+", "-", "*", "/"]:
        stack.push(eval(str(stack.pop()) + s + str(stack.pop())))
    else:
        stack.push(int(s))

print(stack.pop())



Failing test case input:
1 4 + 5 0 - *

Expected output:
25


Actual output:
-25


Fixed submission (verdict: Accepted):
class Stack:
    MAX = 101

    def __init__(self):
        self.S = [None] * self.__class__.MAX
        self.top = 0

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.__class__.MAX - 1

    def push(self, x):
        self.top += 1
        self.S[self.top] = x

    def pop(self):
        self.top -= 1
        return self.S[self.top + 1]


arr = [str(s) for s in input().split()]
stack = Stack()
for s in arr:
    if s in ["+", "-", "*"]:
        stack.push(
            eval("".join(map(str, [stack.pop(), s, stack.pop()][::-1]))))
    else:
        stack.push(int(s))

print(stack.pop())
Problem: p03607
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
t = l[0]
ans = 0
for i in range(1, n):
  if t == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
    t = l[i]
if n == 1:
  ans = 1
print(ans)

Failing test case input:
3
0
0
10

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)

Problem: p03607
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = []

for i in range(n):
    a.append(int(input()))

a = sorted(a)

hoge = 0
foo = 0
ans = 0

for i in range(n):
    if i == 0:
        foo = a[i]
        hoge = 1
    elif foo == a[i]:
        hoge = 1-hoge
    else:
        if hoge == 1:
            ans += 1
        foo = a[i]
        hoge = 1

print(ans)


Failing test case input:
4
-5
2
4
0

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
a = []

for i in range(n):
    a.append(int(input()))

a = sorted(a)

hoge = 0
foo = 0
ans = 0

for i in range(n):
    if i == 0:
        foo = a[i]
        hoge = 1
    elif i == n-1:
        if foo != a[i]:
            if hoge == 1:
                ans += 1
            ans += 1
        else:
            if hoge == 0:
                ans += 1
    elif foo == a[i]:
        hoge = 1-hoge
    else:
        if hoge == 1:
            ans += 1
        foo = a[i]
        hoge = 1

print(ans)

Problem: p03607
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A = []

for i in range(N):
    new = int(input())
    A.append(new)

A.sort()
A.append(0)

start=A[0]
cnt=1
anscnt=0

for i in range(1,len(A)):

    if A[i]==start:
        cnt+=1
    elif A[i]!=start:
        if cnt%2==0:
            anscnt+=cnt
        cnt=1
        start=A[i]
    

print(N-anscnt)


Failing test case input:
4
0
0
6
0

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
N=int(input())
A = []

for i in range(N):
    new = int(input())
    A.append(new)

A.sort()
A.append(0)

start=A[0]
cnt=1
anscnt=0

for i in range(1,len(A)):

    if A[i]==start:
        cnt+=1
    elif A[i]!=start:
        if cnt%2==0:
            anscnt+=cnt
        elif cnt%2!=0:
            anscnt+=cnt-1    
        cnt=1
        start=A[i]


print(N-anscnt)

Problem: p03607
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
list = []
for i in range(N):
    number = int(input())
    if not number in list:
        list.append(number)
    else:
        break
print(len(list))

Failing test case input:
4
-1
0
2
0

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
Result = set()
for i in range(N):
    number = int(input())
    if  number in Result:
        Result.remove(number)
    else:
        Result.add(number)
print(len(Result))