Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
l=input().split()
r=int(l[0])
c=int(l[1])

# for yoko
i=0
b=[]
while i<r:
    a=input().split()
    q=0
    su=0
    while q<c:
        b.append(int(a[q]))
        su+=int(a[q])
        q=q+1
    b.append(su)
    i=i+1

# for tate
#x=0
#d=b[0]+b[c+1]+b[2*(c+1)]+b[3*(c+1)]
#x<c+1
x=0
while x<c+1:
    d=0
    d=b[x]+b[x+c+1]+b[x+2*(c+1)]+b[x+3*(c+1)]
    b.append(d)
    x=x+1
# for output
# C=[]
# y=0 (for gyou)
# z=0 (for yoko)
C=[]
y=0
while y<r+1:
    z=0
    Ans=str(b[y*(c+1)+z])
    while z<c:
        z+=1
        Ans=Ans+" "+str(b[y*(c+1)+z])
    C.append(Ans)
    y+=1

for k in C:
    print(k)



Fixed submission:
l=input().split()
r=int(l[0])
c=int(l[1])

# for yoko
i=0
b=[]
while i<r:
    a=input().split()
    q=0
    su=0
    while q<c:
        b.append(int(a[q]))
        su+=int(a[q])
        q=q+1
    b.append(su)
    i=i+1

# for tate
#x=0
#d=b[0]+b[c+1]+b[2*(c+1)]+b[3*(c+1)]
#x<c+1
x=0
while x<c+1:
    d=0
    z=0
    while z<r:
        d+=b[x+z*(c+1)]
        z+=1
    b.append(d)
    x=x+1
# for output
# C=[]
# y=0 (for gyou)
# z=0 (for yoko)
C=[]
y=0
while y<r+1:
    z=0
    Ans=str(b[y*(c+1)+z])
    while z<c:
        z+=1
        Ans=Ans+" "+str(b[y*(c+1)+z])
    C.append(Ans)
    y+=1

for k in C:
    print(k)
Buggy python submission (verdict: Runtime Error):
num = input()
return num ** 3


Fixed submission:
num_str = input()
num = int(num_str)
print(num ** 3)

Buggy python submission (verdict: Runtime Error):
num = input()

print(num ** 3)


Fixed submission:
num_str = input()
num = int(num_str)
print(num ** 3)
Buggy python submission (verdict: Runtime Error):
data_str = input()
data = data_str.split(" ")
print(int(data[0]) * int(data[1]) +' '+2 * (int(data[0])+int(data[1])))


Fixed submission:
data_str = input()
data = data_str.split(" ")
print(int(data[0]) * int(data[1]), 2 * (int(data[0])+int(data[1])))
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print(math.pai * r * r, 4 * math.pai * r * r * r / 3)


Fixed submission:
pai = 3.141592653589793

r = float(input())
s = pai * r ** 2
l = 2 * pai * r
print(s, l)

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

r = int(input())
s = math.pai * r ** 2
l = 4 * math.pai * r ** 3 / 3
print(s, l)



Fixed submission:
pai = 3.141592653589793

r = float(input())
s = pai * r ** 2
l = 2 * pai * r
print(s, l)

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

r = float(input())
s = math.pai * r ** 2
l = 4 * math.pai * r ** 3 / 3
print(s, l)



Fixed submission:
pai = 3.141592653589793

r = float(input())
s = pai * r ** 2
l = 2 * pai * r
print(s, l)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

row, col = map(int, input().split())
spreadsheet = []

for i in range(row):
    val = list(map(int, input().split()))
    val.append(sum(val))
    spreadsheet.append(val)

for r in spreadsheet:
    print(' '.join(map(str, r)))

last_row = []
for j in range(len(spreadsheet[1])):
    col_sum = 0
    for i in range(len(spreadsheet)):
        col_sum += spreadsheet[i][j]
    last_row.append(col_sum)

print(' '.join(map(str, last_row)))



Fixed submission:
# coding: utf-8

row, col = map(int, input().split())
spreadsheet = []

for i in range(row):
    val = list(map(int, input().split()))
    val.append(sum(val))
    spreadsheet.append(val)

for r in spreadsheet:
    print(' '.join(map(str, r)))

last_row = []
for j in range(len(spreadsheet[0])):
    col_sum = 0
    for i in range(len(spreadsheet)):
        col_sum += spreadsheet[i][j]
    last_row.append(col_sum)

print(' '.join(map(str, last_row)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))

dp = [0 for _ in range(n)]
for i in range(n-1):
    dp[i] = data[i][0] * data[i][1] * data[i+1][1]



def mul(i, j):
    if i == j:
        return 0
    elif i == j - 1:
        return dp[i]
    num = 100000
    for k in range(i, j):
        num = min(num, mul(i, k) + mul(k+1, j) + data[i][0] * data[k][1] * data[j][1])
    return num

print(mul(0, n-1))



Fixed submission:
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))

memo = []
for _ in range(n):
    memo.append([-1]*n)


def mul(i, j):
    if i == j:
        return 0
    if memo[i][j] >= 0:
        return memo[i][j]
    num = 100000
    for k in range(i, j):
        num = min(num, mul(i, k) + mul(k+1, j) + data[i][0] * data[k][1] * data[j][1])
    memo[i][j] = num
    return memo[i][j]

print(mul(0, n-1))
Buggy python submission (verdict: Runtime Error):
n, q = [int(i) for i in input().split()]

name = []
time = []

for i in range(n):
    x, y = [i for i in input().split()]
    y = int(y)
    name.append(x)
    time.append(y)

from collections import deque
time = deque(time)
name = deque(name)

count = 0
time_out = []
name_out = []

while len(time) > 0:
    a = time.popleft()
    b = name.popleft()
    if a > q:
        a -= q
        time.append(a)
        name.append(b)
        count += q
    else:
        count += a
        time_out.append(count)
        name_out.append(b)

for i, j in zip(name_out, time_out):
    print(i, j)



Fixed submission:
n, q = [int(i) for i in input().split()]

name = []
time = []

for i in range(n):
    x, y = [i for i in input().split()]
    y = int(y)
    name.append(x)
    time.append(y)

from collections import deque
time = deque(time)
name = deque(name)

count = 0
time_out = []
name_out = []

while len(time) > 0:
    a = time.popleft()
    b = name.popleft()
    if a > q:
        a -= q
        time.append(a)
        name.append(b)
        count += q
    else:
        count += a
        time_out.append(count)
        name_out.append(b)

for i, j in zip(name_out, time_out):
    print(i, j)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))


def countingsort(a, k):
    c = [0 for i in range(k)]
    b = [0 for i in range(n)]

    for j in range(n):
        c[a[j]] += 1

    for i in range(k):
        c[i+1] += c[i]

    for j in reversed(range(n)):
        b[c[a[j]]] = a[j]
        c[a[j]] -= 1
    
    return b

b = countingsort(a, 10001)
print(*b)


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


def countingsort(a, k):
    c = [0 for i in range(k+1)]
    b = [0 for i in range(n)]

    for j in range(n):
        c[a[j]] += 1

    for i in range(k):
        c[i+1] += c[i]

    for j in reversed(range(n)):
        b[c[a[j]]-1] = a[j]
        c[a[j]] -= 1

    return b

b = countingsort(a, 10000)
print(*b)
Buggy python submission (verdict: Time Limit Exceeded):
def insert(a, data):
    a.append(data)
    heapinc(a, len(a)-1)

def heapinc(a, index):
    parent = (index - 1) // 2
    if parent >= 0:
        if a[parent] < a[index]:
            memo = a[parent]
            a[parent] = a[index]
            a[index] = memo
            heapinc(a, parent)

def extract(a):
    root = a[0]
    a[0] = a[-1]
    del a[-1]
    maxheapify(a, 0)
    return root

def maxheapify(a, i):
    l = i*2 + 1
    r = i*2 + 2

    if r < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if a[r] > a[largest]:
            largest = r

        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

    elif l < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

a = []
for i in range(2000000001):
    com = input().split()
    if com[0] == 'insert':
        insert(a, int(com[1]))
    elif com[0] == 'extract':
        print(extract(a))
    else:
        break


Fixed submission:
from heapq import *

a = []
while 1:
    com = input().split()
    if com[0] == 'end':
        break
    elif com[0] == 'insert':
        heappush(a, -int(com[1]))
    else:
        print(-heappop(a))

Buggy python submission (verdict: Time Limit Exceeded):
def insert(a, data):
    a.append(data)
    heapinc(a, len(a)-1)

def heapinc(a, index):
    parent = (index - 1) // 2
    if parent >= 0:
        if a[parent] < a[index]:
            memo = a[parent]
            a[parent] = a[index]
            a[index] = memo
            heapinc(a, parent)

def extract(a):
    root = a[0]
    a[0] = a[-1]
    del a[-1]
    maxheapify(a, 0)
    return root

def maxheapify(a, i):
    l = i*2 + 1
    r = i*2 + 2

    if r < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if a[r] > a[largest]:
            largest = r

        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

    elif l < len(a):
        if a[l] > a[i]:
            largest = l
        else:
            largest = i
        if largest != i:
            memo = a[i]
            a[i] = a[largest]
            a[largest] = memo
            maxheapify(a, largest)

a = []
while 1:
    com = input().split()
    if com[0] == 'insert':
        insert(a, int(com[1]))
    elif com[0] == 'extract':
        print(extract(a))
    else:
        break



Fixed submission:
from heapq import *

a = []
while 1:
    com = input().split()
    if com[0] == 'end':
        break
    elif com[0] == 'insert':
        heappush(a, -int(com[1]))
    else:
        print(-heappop(a))
Buggy python submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.rank = [0]*n
        self.parent = [i for i in range(n)]
    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def merge(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[y] = x
        elif self.rank[x] > self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[x] = y
            self.rank[y] += 1
    
    def same(self, x, y):
        return self.find(x) == self.find(y)

n, q = map(int, input().split())
uf = UnionFind(n)
for i in range(q):
    com, x, y = map(int, input().split())
    
    if com == 0:
        uf.merge(x, y)
    else:
        print(1 if uf.same(x, y) else 0)


Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.rank = [0]*n
        self.parent = [i for i in range(n)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def merge(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        elif self.rank[x] > self.rank[y]:
            self.parent[y] = x
        else:
            self.parent[x] = y
            self.rank[y] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

n, q = map(int, input().split())
uf = UnionFind(n)
for i in range(q):
    com, x, y = map(int, input().split())

    if com == 0:
        uf.merge(x, y)
    else:
        print(1 if uf.same(x, y) else 0)
Buggy python submission (verdict: Runtime Error):
ts = input()
h = ts/3600
ts-= h*3600
m = ts/60
ts -= m*60
text = str(h)+":"+str(m)+":"+str(ts)
print(text)


Fixed submission:
ts = input()
ts = int(ts)
h = int(ts/3600)
ts-= h*3600
m = int(ts/60)
ts -= m*60
text = str(h)+":"+str(m)+":"+str(ts)
print(text)
Buggy python submission (verdict: Runtime Error):
n = input()
n = int(n)
seq = input().split()
sumNum = 0
minNum = 1000000
maxNum = 0
for numT in sew:
 num = int(numT)
 if(num > maxNum):
  maxNum = num
 elif(num < minNum):
  minNum = num
 sumNum+=num
print(minNum,maxNum,sumNum)


Fixed submission:
n = input()
n = int(n)
seq = input().split()
sumNum = 0
minNum = 1000000
maxNum = -1000000
for numT in seq:
 num = int(numT)
 if(num > maxNum):
  maxNum = num
 if(num < minNum):
  minNum = num
 sumNum+=num
print(minNum,maxNum,sumNum)
Buggy python submission (verdict: Runtime Error):
target = input()
text = input()
text = input()
text = input()
text = input()
text = input()
text2 = text.replace('\n',' ')
sentenceList = text2.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)


Fixed submission:
target = input()
total_text = ""
while True:
 text = input()
 if(text=="END_OF_TEXT"):
  break
 total_text+=" "
 total_text+=text
#text2 = text.replace('\n',' ')
sentenceList = total_text.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
target = input()
text = input()
text = input()
text = input()
text = input()
#text = input()
text2 = text.replace('\n',' ')
sentenceList = text2.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)


Fixed submission:
target = input()
total_text = ""
while True:
 text = input()
 if(text=="END_OF_TEXT"):
  break
 total_text+=" "
 total_text+=text
#text2 = text.replace('\n',' ')
sentenceList = total_text.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
in = input()
h=in/3600
m=in/60-60*h
s=in%60
print(str(h)+':'+str(m)+':'+str(s))

Fixed submission:
a =int(input())
h=int(a/3600)
m=int(a/60-60*h)
s=a%60
print(str(h)+':'+str(m)+':'+str(s))

Buggy python submission (verdict: Runtime Error):
in = input()
h=in/3600
m=in/60-60*h
s=in%60
print(str(h)+':'+str(m)+':'+str(s))

Fixed submission:
a =int(input())
h=int(a/3600)
m=int(a/60-60*h)
s=a%60
print(str(h)+':'+str(m)+':'+str(s))

Buggy python submission (verdict: Runtime Error):
in = input()
h=in/3600
m=in/60-60*h
s=in%60
print(str(h)+':'+str(m)+':'+str(s))

Fixed submission:
a =int(input())
h=int(a/3600)
m=int(a/60-60*h)
s=a%60
print(str(h)+':'+str(m)+':'+str(s))

Buggy python submission (verdict: Runtime Error):
in = input()
h=in/3600
m=in/60-60*h
s=in%60
print('a')
print(str(h)+':'+str(m)+':'+str(s))

Fixed submission:
a =int(input())
h=int(a/3600)
m=int(a/60-60*h)
s=a%60
print(str(h)+':'+str(m)+':'+str(s))
Buggy python submission (verdict: Runtime Error):
abc = input().split()
if(int(abc[0])< int(abc[1]) and int(abc[1] < int(abc[2])) ):
    print('Yes')
else:
    print('No')

Fixed submission:
abc = input().split()
if(int(abc[0]) < int(abc[1]) and int(abc[1]) < int(abc[2])):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, W, H = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(n)]

imos_h = [0] * (H + 2)
imos_w = [0] * (W + 2)

for x, y, w in X:
  imos_h[max(0, y - w)] += 1
  imos_h[min(W + 1, y + w + 1)] -= 1
  imos_w[max(0, x - w)] += 1
  imos_w[min(H + 1, x + w + 1)] -= 1
  
for h in range(H):
  imos_h[h + 1] += imos_h[h]
  
for w in range(W):
  imos_w[w + 1] += imos_w[w]

is_w = all(imos_w[w] >= 1 for w in range(W + 1))
is_h = all(imos_h[h] >= 1 for h in range(H + 1))

if is_h or is_w:
  print('Yes')
else:
  print('No')


Fixed submission:
n, W, H = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(n)]

imos_h = [0] * (H + 2)
imos_w = [0] * (W + 2)

for x, y, w in X:
  imos_h[max(0, y - w)] += 1
  imos_h[min(H + 1, y + w)] -= 1
  imos_w[max(0, x - w)] += 1
  imos_w[min(W + 1, x + w)] -= 1
  
for h in range(H):
  imos_h[h + 1] += imos_h[h]
  
for w in range(W):
  imos_w[w + 1] += imos_w[w]

is_w = all(imos_w[w] >= 1 for w in range(W))
is_h = all(imos_h[h] >= 1 for h in range(H))

if is_h or is_w:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n, W, H = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(n)]

imos_h = [0] * (H + 2)
imos_w = [0] * (W + 2)

for x, y, w in X:
  imos_h[max(0, y - w)] += 1
  imos_h[min(W + 1, y + w + 1)] -= 1
  imos_w[max(0, x - w)] += 1
  imos_w[min(H + 1, x + w + 1)] -= 1
  
for h in range(H):
  imos_h[h + 1] += imos_h[h]
  
for w in range(W):
  imos_w[w + 1] += imos_w[w]

is_w = all(imos_w[w] >= 1 for w in range(W + 1))
is_h = all(imos_h[h] >= 1 for h in range(H + 1))

if is_h or is_w:
  print('Yes')
else:
  print('No')


Fixed submission:
n, W, H = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(n)]

imos_h = [0] * (H + 2)
imos_w = [0] * (W + 2)

for x, y, w in X:
  imos_h[max(0, y - w)] += 1
  imos_h[min(H + 1, y + w)] -= 1
  imos_w[max(0, x - w)] += 1
  imos_w[min(W + 1, x + w)] -= 1
  
for h in range(H):
  imos_h[h + 1] += imos_h[h]
  
for w in range(W):
  imos_w[w + 1] += imos_w[w]

is_w = all(imos_w[w] >= 1 for w in range(W))
is_h = all(imos_h[h] >= 1 for h in range(H))

if is_h or is_w:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
#Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成（初期値は0）
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

#print(dp)

#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
    v,w = map(int,input().split())
    value.append(v)
    weight.append(w)

#print(values)
#print(weights)

#アイテムは１個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
    for j in range(W+1):
        if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
            dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N+1][W+1])


Fixed submission:
#Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成（初期値は0）
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

#print(dp)

#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
    v,w = map(int,input().split())
    value.append(v)
    weight.append(w)

#print(values)
#print(weights)

#アイテムは１個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
    for j in range(W+1):
        if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
            dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
row = input().split()
print(row[0] * row[1], 2 * (row[0] + row[1]))



Fixed submission:
row = input().split()
row = [ int(i) for i in row]

print(row[0] * row[1], 2 * (row[0] + row[1]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
datas = [int(input()) for _ in range(N)]
diff = max(datas[1:]) - datas[0]

for i in range(1,N-1):
    new_diff = max(datas[i+1:]) - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = (N-1) - datas[::-1].index(now_max)
now_min = min(datas)
min_index = datas.index(_min)

if max_index > min_index:
    diff = now_max - _min
else:
    diff = now_max - datas[0]
    
    for i in range(1,N-1):
        if i == max_index:
            now_max = max(datas[i+1:])
            max_index = datas.index(now_max,i+1)
        new_diff = now_max - datas[i]
        if diff < new_diff:
            diff = new_diff

print(diff)


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = (N-1) - reversed(datas).index(now_max)
_min = min(datas)
min_index = datas.index(_min)

if max_index > min_index:
    diff = now_max - _min
else:
    diff = now_max - datas[0]
    
    for i in range(1,N-1):
        if i == max_index:
            now_max = max(datas[i+1:])
            max_index = datas.index(now_max,i+1)
        new_diff = now_max - datas[i]
        if diff < new_diff:
            diff = new_diff

print(diff)


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)
Buggy python submission (verdict: Runtime Error):
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()))


Fixed submission:
import re
pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')

def revPolish(f):
    global pat
    f = pat.sub(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()))

Buggy python submission (verdict: Runtime Error):
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()))


Fixed submission:
import re
pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')

def revPolish(f):
    global pat
    f = pat.sub(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()))

Buggy python submission (verdict: Runtime Error):
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()))


Fixed submission:
import re
pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')

def revPolish(f):
    global pat
    f = pat.sub(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()))

Buggy python submission (verdict: Runtime Error):
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()))


Fixed submission:
import re
pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')

def revPolish(f):
    global pat
    f = pat.sub(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()))