Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
split = math.floor(n ** (1/2))
ans = 0
for i in range(1, split):
    m = n / (split - i)
    if m.is_integer():
        ans = m
        break
print((int(m) - 1) + (int(n / m) - 1))

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
divisors = []
def make_divisors(n):
    for i in range(1, int(math.sqrt(n)) + 1):
        a, b = 0, 0
        if n % i == 0:
            a = i
            b = n // i
            divisors.append([a, b])

make_divisors(N)

ans = float('inf')
for i in divisors:
    a, b = i
    ans = min(ans, a + b - 2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
l = list(map(int, input().split()))
counter = 0
for v in itertools.combinations(l, 3):
     if 2 * max(v) < sum(v):
         counter += 1
print(counter)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int, input().split())))
counter = 0
for i in range(n):
    for j in range(i + 1, n):
        counter += (bisect.bisect_left(l, l[i] + l[j]) - j - 1)
print(counter)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

n, q = map(int, input().split())
dist = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    dist[a - 1].append(b - 1)
value = []
cnt = [0 for i in range(n)]
for i in range(q):
    p, x = map(int, input().split())
    value.append([p - 1, x])

def dfs(pos, addvalue):
    cnt[pos] += addvalue
    for i in dist[pos]:
        dfs(i, addvalue)

for i in value:
    dfs(i[0], i[1])

for i in cnt:
    print(i, end = " ")

Fixed submission:
from collections import deque

n, q = map(int, input().split())
dist = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    dist[a - 1].append(b - 1)
    # aftercontest対策
    dist[b - 1].append(a - 1)
value = [0 for i in range(n)]

# 1つ目の[1, 10]と2つ目の[1, 10]混ぜても問題なし
for i in range(q):
    p, x = map(int, input().split())
    value[p - 1] += x
#  重複を防ぐ
ignore = [0] * n
ignore[0] = 1

pos = deque([0])
# 上から順に自身のvalueの値を子のvalueに加算していく
# value [100, 10, 1, 0]
# pos.popleft() = 1 → [100, 10 + 100, 1 + 100, 0 + 100]
# pos.popleft() = 2 → [100, 110, 101 + 10, 100 + 10]
while len(pos) > 0:
    u = pos.popleft()
    for i in dist[u]:
        if ignore[i] == 0:
            ignore[i] = 1
            value[i] += value[u]
            pos.append(i)
# 覚える
print(*value)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
s = [collections.Counter(input()) for i in range(n)]
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            ans += 1
print(ans)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

from itertools import permutations
from math import factorial, hypot

#############
# Main Code #
#############

N = getN()
S = [''.join(sorted(list(input()))) for i in range(N)]
ans = 0
for i in Counter(S).items():
    ans += i[1] * (i[1] - 1) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
if L <= 2019 <= R:
    print(0)
else:
    lista = []
    int1 = min(L % 2019, 2019 - (L % 2019))
    int2 = min(R % 2019, 2019 - (R % 2019))
    lista.append(int1)
    lista.append(int2)
    lista.append(int1 + 1)
    lista.append(int2 + 1)
    lista.sort()
print(lista[0] * lista[1])

Fixed submission:
L, R = map(int, input().split())
lista = []
for i in range(L, min(R + 1, L + 2019)):
    lista.append(i % 2019)
ans = float('inf')
for i in range(len(lista)):
    for j in range(i + 1, len(lista)):
        ans = min(ans, lista[i] * lista[j] % 2019)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = ''
t1, t2 = [], []

for i in range(n):
    t1.append(a[i])
    t2.append(a[n-1-i])
    if sorted(t1) == sorted(t2):
        ans += str(i+1) + ' '
print(ans[:-1])



Fixed submission:
from collections import Counter

n = int(input())
a = input().split()
# a = list(map(int, input().split()))
ans = ''
# t1, t2 = [], []
t1, t2 = Counter(), Counter()
for i in range(n):
    t1.update(a[i])
    t2.update(a[n-1-i])
    t3 = t1 & t2
    t1 -= t3
    t2 -= t3
    if t1 == t2:
        ans += str(i+1) + ' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = ''
t1, t2 = [], []

for i in range(n):
    t1.append(a[i])
    t2.append(a[n-1-i])
    if Counter(t1) == Counter(t2):
        ans += str(i+1) + ' '
print(ans[:-1])



Fixed submission:
from collections import Counter

n = int(input())
a = input().split()
# a = list(map(int, input().split()))
ans = ''
# t1, t2 = [], []
t1, t2 = Counter(), Counter()
for i in range(n):
    t1.update(a[i])
    t2.update(a[n-1-i])
    t3 = t1 & t2
    t1 -= t3
    t2 -= t3
    if t1 == t2:
        ans += str(i+1) + ' '
print(ans[:-1])
Buggy python submission (verdict: Runtime Error):
x=input()
n=int(x)**3
print(n)
​


Fixed submission:


x=input()
n=int(x)**3
print(n)
Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
print(r, l)
r=a*b
l=2*(a+b)


Fixed submission:
a, b=map(int, input().split())

r=a*b
l=2*(a+b)

print(r,l)

Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
print(r, l)
r=a*b
l=2*(a+b)


Fixed submission:
a, b=map(int, input().split())

r=a*b
l=2*(a+b)

print(r,l)

Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
print(r, l)
r=a*b
l=2*(a+b)


Fixed submission:
a, b=map(int, input().split())

r=a*b
l=2*(a+b)

print(r,l)
Buggy python submission (verdict: Runtime Error):
s = input()
h = s/3600
s = s%3600
m = s/60
s = s%60

print str(h) + ":" + str(m) + ":" + str(s)


Fixed submission:
s = int(input())
h = s//3600
s = s%3600
m = s//60
s = s%60

print(h,':',m,':',s,  sep='')

Buggy python submission (verdict: Runtime Error):
s = input()
h = s/3600
s = s%3600
m = s/60
s = s%60

print(h,':',m,':',s,sep='')


Fixed submission:
s = int(input())
h = s//3600
s = s%3600
m = s//60
s = s%60

print(h,':',m,':',s,  sep='')
Buggy python submission (verdict: Runtime Error):

     x=int(input())
    int i=0;
    while(1){
        scanf("%d", &x);
        if(x==0)break;
        printf("Case %d: %d\n", ++i, x);
    


Fixed submission:
num = 1
while True:
    x = int(input())
    if x == 0: break
    print ("Case {0}: {1}".format(num,x))
    num += 1
Buggy python submission (verdict: Runtime Error):
while True:
    x,y = map(int,raw_input().split(" "))
    if (x,y) == (0,0): 
        break
    elif (x < y):
        print x, y
    else :
        print y, x


Fixed submission:
while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x > y:
        x,y = y,x
    print("%d %d" %(x,y))
Buggy python submission (verdict: Runtime Error):
mport sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
NUM = 20005
 
table = [""]*NUM
 
 
while True:
 
    T = str(input())
    if T == '-':
        break
 
    left = 0
    right = 0
    #長い配列にパターン文字列を転記
    for i in range(len(T)):
        # print(T[right])
        table[left+right] = T[right]
        right += 1
 
    num_suffle = int(input())
 
    for loop in range(num_suffle):
        pick_num = int(input())
        #先頭からpick_num文字を末尾に転記し、論理削除
        for i in range(pick_num):
            table[right+i] = table[left+i]
        left += pick_num
        right += pick_num
 
    for i in range(left,right):
        print("%s"%(table[i]),end = "")
    print()


Fixed submission:
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
NUM = 20005
 
table = [""]*NUM
 
 
while True:
 
    T = str(input())
    if T == '-':
        break
 
    left = 0
    right = 0
    #長い配列にパターン文字列を転記
    for i in range(len(T)):
        # print(T[right])
        table[left+right] = T[right]
        right += 1
 
    num_suffle = int(input())
 
    for loop in range(num_suffle):
        pick_num = int(input())
        #先頭からpick_num文字を末尾に転記し、論理削除
        for i in range(pick_num):
            table[right+i] = table[left+i]
        left += pick_num
        right += pick_num
 
    for i in range(left,right):
        print("%s"%(table[i]),end = "")
    print()

Buggy python submission (verdict: Runtime Error):
mport sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
NUM = 20005
 
table = [""]*NUM
 
 
while True:
 
    T = str(input())
    if T == '-':
        break
 
    left = 0
    right = 0
    #長い配列にパターン文字列を転記
    for i in range(len(T)):
        # print(T[right])
        table[left+right] = T[right]
        right += 1
 
    num_suffle = int(input())
 
    for loop in range(num_suffle):
        pick_num = int(input())
        #先頭からpick_num文字を末尾に転記し、論理削除
        for i in range(pick_num):
            table[right+i] = table[left+i]
        left += pick_num
        right += pick_num
 
    for i in range(left,right):
        print("%s"%(table[i]),end = "")
    print()


Fixed submission:
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
NUM = 20005
 
table = [""]*NUM
 
 
while True:
 
    T = str(input())
    if T == '-':
        break
 
    left = 0
    right = 0
    #長い配列にパターン文字列を転記
    for i in range(len(T)):
        # print(T[right])
        table[left+right] = T[right]
        right += 1
 
    num_suffle = int(input())
 
    for loop in range(num_suffle):
        pick_num = int(input())
        #先頭からpick_num文字を末尾に転記し、論理削除
        for i in range(pick_num):
            table[right+i] = table[left+i]
        left += pick_num
        right += pick_num
 
    for i in range(left,right):
        print("%s"%(table[i]),end = "")
    print()
Buggy python submission (verdict: Runtime Error):
for line in sys.stdin:
    a, b = map(int, line.split())
    print(len(str(a + b)))

Fixed submission:
import sys

for line in sys.stdin:
    a, b = map(int, line.split())
    print(len(str(a + b)))

Buggy python submission (verdict: Runtime Error):
import sys,math

inputs = list()

for n in sys.stdin:
    inputs.append(list(map(int,n.split())))

for n in inputs:
    print(math.floor(math.log10(n[0]*n[1]))+1)

Fixed submission:
import sys

for line in sys.stdin:
    a, b = map(int, line.split())
    print(len(str(a + b)))
Buggy python submission (verdict: Runtime Error):
while True:
    cou = 0
    n,x = map(int,intput().split())
    if n==0 and x==0:
        break
    for i in range(1,x):
        for j in range(j,x):
            k = x - i - j
            if i<=n and j<=n and k<=n:
                cou += 1
    print(cou)
                


Fixed submission:
while True:
    cou = 0
    n,x = map(int,input().split())
    if n==0 and x==0:
        break
    for i in range(1,x//2):
        for j in range(i+1,x//2):
            k = x - i - j
            if i<=n and j<=n and k<=n and k>j:
                cou += 1
    print(cou)

Buggy python submission (verdict: Runtime Error):
while True:
    cou = 0
    n,x = map(int,input().split())
    if n==0 and x==0:
        break
    for i in range(1,x):
        for j in range(j,x):
            k = x - i - j
            if i<=n and j<=n and k<=n:
                cou += 1
    print(cou)
                


Fixed submission:
while True:
    cou = 0
    n,x = map(int,input().split())
    if n==0 and x==0:
        break
    for i in range(1,x//2):
        for j in range(i+1,x//2):
            k = x - i - j
            if i<=n and j<=n and k<=n and k>j:
                cou += 1
    print(cou)
Buggy python submission (verdict: Runtime Error):
from django.template.defaultfilters import first

while True:
    N = int(input())
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N):
        for group, members in d.items():
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print(len(first_group_menbers))

Fixed submission:
while True:
    N = int(input())
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N-2):
        for group, members in d.items():
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print(len(first_group_menbers))

Buggy python submission (verdict: Runtime Error):
from django.template.defaultfilters import first

while True:
    N = int(input())
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N):
        for group, members in d.items():
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print(len(first_group_menbers))

Fixed submission:
while True:
    N = int(input())
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N-2):
        for group, members in d.items():
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print(len(first_group_menbers))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=a*b
d=(a+b)*2
print c+" "+d

Fixed submission:
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print str(c)+" "+str(d)

Buggy python submission (verdict: Runtime Error):
a,b=input()
c=a*b
d=(a+b)*2
print c+" "+d

Fixed submission:
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print str(c)+" "+str(d)

Buggy python submission (verdict: Runtime Error):
l=raw_input().split()
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print c+" "+d

Fixed submission:
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print str(c)+" "+str(d)

Buggy python submission (verdict: Runtime Error):
l=map(int,raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print c+" "+d

Fixed submission:
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print str(c)+" "+str(d)

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print c+" "+d

Fixed submission:
l = map(int, raw_input().split())
a=l[0]
b=l[1]
c=a*b
d=(a+b)*2
print str(c)+" "+str(d)

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(str(a*b) + ' ' + (a+b) * 2)

Fixed submission:
a,b = map(int, input().split())
print(str(a*b) + ' ' + str((a+b) * 2))
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a,b=(int(i) for i in input().split())
        print(len(str(a+b)))
    except EOFError:

Fixed submission:
while True:
    try:
        a,b=(int(i) for i in input().split())
        print(len(str(a+b)))
    except EOFError:
        break
Buggy python submission (verdict: Runtime Error):
#grab
e=int(input())
while e>0:
    z=0
    while z**3<=e 
        z+=1
    z-=1
    e-=z**3
    y=0
    while y*y<=e:
        y+=1
    y-=1
    e-=y*y
    e+=y+z
    print(e)
    e=int(input())

Fixed submission:
# your code goes here
#grab
import math
e=int(input())
#e=1250
while e>0:
    z=0
    t=z**3
    f=e-t
    q=math.sqrt(f)
    y=int(q)
    if q-y>0.999999:
        y+=1
    x=y*y
    x=f-x
    m=x+y+z
    while t<=e:
        f=e-t
        q=math.sqrt(f)
        y=int(q)
        if q-y>0.999999:
            y+=1
        x=y*y
        x=f-x
        l=x+y+z
        if l<m:
            m=l
        z+=1
        t=z**3
    print(m)
    e=int(input())
Buggy python submission (verdict: Runtime Error):
#times volume24 2424
Q=int(input())
for i in range(Q):
    N=str(input())
    c=0
    while len(N)>1 and c<15:
        M=0
        for j in range(1,len(N)):
  #          print(N[:j])
            l=int(N[:j])
            r=int(N[j:])
            l*=r
            if M<l:
                M=l
        #    print(M)
        N=str(M)
        c+=1
    if c>=15:
        d=[int(N)]
        while c>=0 and c<50:
            while len(N)>1 and c<50:
                M=0
                for j in range(1,len(N)):
  #          print(N[:j])
                    l=int(N[:j])
                    r=int(N[j:])
                    l*=r
                    if M<l:
                        M=l
        #    print(M)
                k=0
                while k<len(d) and M<d[k]:
                    k+=1
                if M==d[k]:
                    c=-1
                else:
                    d.insert(j,M)
                N=str(N)
    print(c)

Fixed submission:
# your code goes here
#times volume24 2424
Q=int(input())
for i in range(Q):
    N=str(input())
    c=0
    while len(N)>1 and c<15:
        M=0
        for j in range(1,len(N)):
    #        print(N[:j])
            l=int(N[:j])
            r=int(N[j:])
            l*=r
            if M<l:
                M=l
      #      print(M)
        N=str(M)
        c+=1
  #  print(N)
    if c>=15:
        d=[int(N)]
        while len(N)>1 and c>=0 and c<50:
            M=0
        #    print(d)
            for j in range(1,len(N)):
        #        print(N[:j])
                l=int(N[:j])
                r=int(N[j:])
                l*=r
                if M<l:
                    M=l
      #          print(M)
            k=0
            while k<len(d) and M>d[k]:
                k+=1
         #   print(k)
            if k>=len(d):
                k=-1
            elif M==d[k]:
                c=-1
            d.insert(k,M)
            N=str(M)
            c+=1
        #    print(k)
    print(c)
Buggy python submission (verdict: Runtime Error):
   #depth first
N=int(input())
V=[]
a=[0]
for i in range(N):
    V.append([int(i) for i in input().split()])
    w=V[i][2:]
    w.sort()
    V[i]=V[i][:2]+w
    a.append(0)
V=sorted(V,key=lambda x:x[0])
c=1
t=1
i=0
r=[1]
a[1]=1
p=[[1,t]]
q=[]
while t<N*2-1:
    j=2
    while t<N*2-1 and j-2<V[i][1] and V[i][1]>0 and a[V[i][j]]==1:
        j+=1
    t+=1
    if j-2<V[i][1]:
        a[V[i][j]]=1
        c+=1
        r.append(V[i][j])
        p.append([V[i][j],t])
        i=V[i][j]-1
    else:
        q.append(p[-1]+[t])
#end time immediately case?
        r.pop(-1)
        p.pop(-1)
        i=r[-1]-1
       # print(q)
q.append([1,1,N*2])
q=sorted(q,key=lambda x:x[0])
for i in range(N):
    for j in range(3):
        q[i][j]=str(q[i][j])
    print(" ".join(q[i]))

Fixed submission:
   #depth first
N=int(input())
V=[]
a=[0]
for i in range(N):
    V.append([int(i) for i in input().split()])
    w=V[i][2:]
    w.sort()
    V[i]=V[i][:2]+w
    a.append(0)
V=sorted(V,key=lambda x:x[0])
c=1
t=1
i=0
r=[1]
a[1]=1
p=[[1,t]]
q=[]
while t<N*2:
    j=2
    while t<N*2 and j-2<V[i][1] and V[i][1]>0 and a[V[i][j]]==1:
        j+=1
    t+=1
    if j-2<V[i][1]:
        a[V[i][j]]=1
        c+=1
        r.append(V[i][j])
        p.append([V[i][j],t])
        i=V[i][j]-1
    else:
        q.append(p[-1]+[t])
        r.pop(-1)
        p.pop(-1)
        if len(r)>0:
            i=r[-1]-1
        else:
            j=1
            while j<N and a[j]==1:
                j+=1
            if j<N:
                t+=1
                i=j-1
                r.append(j)
                p.append([j,t])
q=sorted(q,key=lambda x:x[0])
for i in range(N):
    for j in range(3):
        q[i][j]=str(q[i][j])
    print(" ".join(q[i]))
Buggy python submission (verdict: Runtime Error):
# 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])

Fixed submission:
# 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)
    else:
        S.append(int(F[i]))
    i+=1
print(S[0])