Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations 
h,w = map(int,input().split())
c = [[int(i) for i in input().split()] for _ in range(10)]
a = [[int(i) for i in input().split()] for _ in range(h)]
ans = 0
lst = [int(i) for i in range(10) if i != 1]
mp = [0]*10

for i in lst:
    mp[i] = c[i][1]
    for j in range(1,9):
        for k in permutations(lst,j):
            newlst = list(k)
            cnt = c[i][newlst[0]]
            for l in range(j-1):
                cnt += c[newlst[l]][newlst[l+1]]
            cnt += c[newlst[-1]][1]
            if cnt < mp[i]:
                mp[i] = cnt

for i in range(h):
    for j in range(w):
        if abs(a[i][j]) != 1:
            ans += mp[a[i][j]]

print(ans)


Fixed submission:
from itertools import permutations 
h,w = map(int,input().split())
c = [[int(i) for i in input().split()] for _ in range(10)]
a = [[int(i) for i in input().split()] for _ in range(h)]
ans = 0
lst = [int(i) for i in range(10) if i != 1]
mp = [0]*10

for i in lst:
    mp[i] = c[i][1]
    for j in range(1,9):
        for k in permutations(lst,j):
            newlst = list(k)
            cnt = c[i][newlst[0]]
            for l in range(j-1):
                cnt += c[newlst[l]][newlst[l+1]]
            cnt += c[newlst[-1]][1]
            if cnt < mp[i]:
                mp[i] = cnt

for i in range(h):
    for j in range(w):
        if abs(a[i][j]) != 1:
            ans += mp[a[i][j]]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        d = 4*h*n-N*h-N*n
        if d == 0 or N*h*n%d != 0: continue
        w = N*h*n//d
        if w < 0: continue
        print(h,n,w)
        exit()

Fixed submission:
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        d = 4*h*n-N*h-N*n
        if d == 0 or N*h*n%d != 0: continue
        w = N*h*n//d
        if w < 0: continue
        print(h,n,w)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]

d = [a[i][:] for i in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

ans = 0
for i in range(n):
    for j in range(n):
        if a[i][j] > d[i][j]:
            ans = -2
            break
        for k in range(n):
            if i == k or j == k: continue
            if d[i][j] == d[i][k] + d[k][j]: break
        else:
            ans += d[i][j]
    else:
        continue
    break

ans //= 2
print(ans)

Fixed submission:
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
b = [i[:] for i in a[:]]

for k in range(n):
    for i in range(n):
        for j in range(n):
            b[i][j] = min(b[i][j],b[i][k]+b[k][j])

flag = False
for i in range(n):
    for j in range(n):
        if b[i][j] < a[i][j]:
            ans = -1
            flag = True
            break
        if b[i][j] == a[i][j]:
            for k in range(n):
                if k == i or k == j: continue
                if b[i][j] == b[i][k] + b[k][j]: break
            else:
                ans += b[i][j]
    if flag: break

ans //= 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
b = [i[:] for i in a[:]]

for k in range(n):
    for i in range(n):
        for j in range(n):
            b[i][j] = min(b[i][j],b[i][k]+b[k][j])

flag = False
for i in range(n):
    for j in range(n):
        if b[i][j] < a[i][j]:
            ans = -1
            flag = True
            break
        if b[i][j] == a[i][j]:
            for k in range(n):
                if k == i or k == j: continue
                if b[i][j] == b[i][k] + b[k][j]: break
            else:
                ans += b[i][j]
    if flag: break

ans //= 2
print(ans)

Fixed submission:
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
b = [i[:] for i in a[:]]

for k in range(n):
    for i in range(n):
        for j in range(n):
            b[i][j] = min(b[i][j],b[i][k]+b[k][j])

flag = False
for i in range(n):
    for j in range(n):
        if b[i][j] < a[i][j]:
            ans = -1
            flag = True
            break
        if b[i][j] == a[i][j]:
            for k in range(n):
                if k == i or k == j: continue
                if b[i][j] == b[i][k] + b[k][j]: break
            else:
                ans += b[i][j]
    if flag: break

ans //= 2
print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)

n = int(input())
t = [int(input()) for i in range(n)]

if n == 1:
    ans = t[0]
else:
    lcd = t[0]*t[1]/gcd(t[0],t[1])
    for i in range(2,n):
        lcd = lcd*t[i]/gcd(lcd,t[i])
    ans = lcd
    
print(ans)

Fixed submission:
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)

n = int(input())
t = [int(input()) for i in range(n)]

if n == 1:
    ans = t[0]
else:
    lcd = t[0]*t[1]//gcd(t[0],t[1])
    for i in range(2,n):
        lcd = lcd*t[i]//gcd(lcd,t[i])
    ans = lcd

print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)

n = int(input())
t = [int(input()) for i in range(n)]

lcd = t[0]*t[1]/gcd(t[0],t[1])
for i in range(2,n):
    lcd = lcd*t[i]/gcd(lcd,t[i])

print(lcd)

Fixed submission:
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)

n = int(input())
t = [int(input()) for i in range(n)]

if n == 1:
    ans = t[0]
else:
    lcd = t[0]*t[1]//gcd(t[0],t[1])
    for i in range(2,n):
        lcd = lcd*t[i]//gcd(lcd,t[i])
    ans = lcd

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
G = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

dist = [(0,-1) for _ in range(n)]
def dfs(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        dist[nxt] = (dist[now][0]+1,now)
        dfs(nxt,now)
dfs(0)

color = ["?"]*n
cnt = 0
now = n-1
w = (dist[n-1][0]+1)//2
while now != -1:
    if cnt < w: color[now] = -1
    else: color[now] = 1
    cnt += 1
    now = dist[now][1]

def coloring(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        if color[nxt] != "?" and color[now] != color[nxt]: continue
        color[nxt] = color[now]
        coloring(nxt,now)
coloring(0)
coloring(n-1)
print("Fennec" if sum(color) > 0 else "Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)

n = int(input())
G = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

dist = [(0,-1) for _ in range(n)]
def dfs(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        dist[nxt] = (dist[now][0]+1,now)
        dfs(nxt,now)
dfs(0)

color = ["?"]*n
cnt = 0
now = n-1
w = (dist[n-1][0]+1)//2
while now != -1:
    if cnt < w: color[now] = -1
    else: color[now] = 1
    cnt += 1
    now = dist[now][1]

def coloring(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        if color[nxt] != "?" and color[now] != color[nxt]: continue
        color[nxt] = color[now]
        coloring(nxt,now)
coloring(0)
coloring(n-1)

print("Fennec" if sum(color) > 0 else "Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
b = []

for i in range(n):
    b.append(a[i])
    b.reverse()

for i in range(n):
    if i < n-1:
        print(b[i],end=" ")
    else:
        print(b[i])


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

b = a[n::-2]+a[::2] if n%2 == 0 else a[n::-2]+a[1::2]
for i in range(n):
    if i < n-1:
        print(b[i],end=" ")
    else:
        print(b[i])
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
n,a,b = map(int,input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = 10**18

def f(x):
    res = 0
    for i in range(n): res += ceil(max(0,(h[i]-b*x))/(a-b))
    return res <= x

while l+1 < r:
    m = (l+r)//2
    if f(m): r = m
    else: l = m
print(r)

Fixed submission:
from math import ceil
n,a,b = map(int,input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = max(h)

def f(x):
    res = 0
    for i in range(n): res += ceil(max(0,(h[i]-b*x))/(a-b))
    return res <= x

while l+1 < r:
    m = (l+r)//2
    if f(m): r = m
    else: l = m
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n,W = map(int,input().split())
w = [0]*n
v = [0]*n
for i in range(n): w[i],v[i] = map(int,input().split())
x = w[0]
for i in range(n): w[i] -= x
dp = [[[0]*(4*n+1) for _ in range(n+1)] for _ in range(n+1)]

for i in range(n):
    for j in range(i+1):
        for k in range(4*n+1):
            if (j+1)*x+k <= W and k-w[i] >= 0:
                dp[i+1][j+1][k] = max(dp[i+1][j+1][k],dp[i][j][k-w[i]]+v[i])
            dp[i+1][j][k] = max(dp[i+1][j][k],dp[i][j][k])

"""
for i in range(n+1):
    print(i,"///////////////////////////////////////////////")
    for j in range(n+1):
        print(dp[i][j])
"""
print(max(max(dp[n][j]) for j in range(n+1)))

Fixed submission:
n,W = map(int,input().split())
w = [0]*n
v = [0]*n
for i in range(n): w[i],v[i] = map(int,input().split())
x = w[0]
for i in range(n): w[i] -= x
dp = [[[0]*(4*n+1) for _ in range(n+1)] for _ in range(n+1)]

for i in range(n):
    for j in range(i+1):
        for k in range(4*n+1):
            if (j+1)*x+k <= W and k-w[i] >= 0:
                dp[i+1][j+1][k] = max(dp[i+1][j+1][k],dp[i][j][k-w[i]]+v[i])
            dp[i+1][j][k] = max(dp[i+1][j][k],dp[i][j][k])

"""
for i in range(n+1):
    print(i,"///////////////////////////////////////////////")
    for j in range(n+1):
        print(dp[i][j])
"""
print(max(max(dp[n][j]) for j in range(n+1)))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations as comb
N,K = map(int,input().split())
a = [int(i) for i in input().split()]
ans = float("INF")

for c in comb(range(1,N),K-1):
    cnt = 0
    color = 0
    mh = a[0]
    for i in range(1,N):
        if i == c[color]:
            cnt += max(mh-a[i]+1,0)
            idx += 1
            mh = max(mh+1,a[i])
        if color == K-1: break
    ans = min(cnt ,ans)
print(ans)

Fixed submission:
N,K = map(int,input().split())
a = [int(i) for i in input().split()]
ans = float("INF")
for i in range(1<<N):
    cnt = 0
    tmp = a[:]
    m = tmp[0]
    for j in range(1,N):
        if i >> j & 1 and m >= tmp[j]:
            cnt += m - tmp[j] + 1
            tmp[j] = m + 1
        m = max(m,tmp[j])
    color = 1
    m = tmp[0]
    for j in range(1,N):
        if tmp[j] > m:
            color += 1
            m = tmp[j]
    if color >= K: ans = min(ans,cnt)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
mod = 10**9+7
for i in range(1,n+1):
    ans *= i
    #ans %= mod

print(ans%mod)

Fixed submission:
n = int(input())
ans = 1
mod = 10**9+7
for i in range(1,n+1):
    ans *= i
    ans %= mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ans = 0

if n >= m//2:
    ans = m//2
else:
    while n <= m//2:
        n += 1
        m -= 2
    else:
        ans = n-1

print(ans)


Fixed submission:
n,m = map(int,input().split())
ans = 0

if n >= m//2:
    ans = m//2
else:
    ans = n + (m//2-n)//2

print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
INF = 10**18
d = [[INF]*n for _ in range(n)]
for i in range(n): d[i][i] = 0
a = [0]*m
b = [0]*m
c = [0]*m
for i in range(m):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    a[i] = a
    b[i] = b
    c[i] = c
    d[a][b] = c
    d[b][a] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k]+d[k][j])

ans = 0
for i in range(m):
    if d[a[i]][b[i]] < c[i]: ans += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())
INF = 10**18
d = [[INF]*n for _ in range(n)]
nd = [[INF]*n for _ in range(n)]
for i in range(n):
    d[i][i] = 0
    nd[i][i] = 0
for _ in range(m):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    nd[a][b] = c
    nd[b][a] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            nd[i][j] = min(nd[i][j], nd[i][k]+nd[k][j])

cnt = 0
for i in range(n):
    for j in range(n):
        if d[i][j] == INF: continue
        if nd[i][j] < d[i][j]: cnt += 1
print(cnt//2)
Buggy python submission (verdict: Time Limit Exceeded):
x = input()

for _ in range(len(x)//2+1):
    x = x.replace("ST","")

print(len(x))

Fixed submission:
x = input()
s = 0
t = 0
ans = 0

for c in x:
    if c == "S":
        s += 1
    else:
        if s != 0:
            s -= 1
        else:
            ans += 1
else:
    ans += s

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
x = input()

for _ in range(len(x)//2+1):
    x = x.replace("ST","")

print(len(x))

Fixed submission:
x = input()
s = 0
t = 0
ans = 0

for c in x:
    if c == "S":
        s += 1
    else:
        if s != 0:
            s -= 1
        else:
            ans += 1
else:
    ans += s

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a = map(int,input().split())
x = [int(i) for i in input().split()]
dp = [[[0]*(n+1) for _ in range(n*a+1)] for _ in range(n+1)] 
for k in range(n+1): dp[0][0][k] = 1

for i in range(1,n+1):
    for j in range(1,n*a+1):
        for k in range(1,n+1):
            dp[i][j][k] = dp[i][j][k-1]
            if j - x[k-1] >= 0:
                dp[i][j][k] += dp[i-1][j-x[k-1]][k-1]
ans = 0
for i in range(1,n+1): ans += dp[i][a*i][n]
print(ans)

Fixed submission:
n,a = map(int,input().split())
x = [int(i) for i in input().split()]
dp = [[[0]*(n+1) for _ in range(n*a+1)] for _ in range(n+1)] 
for k in range(n+1): dp[0][0][k] = 1

for i in range(1,n+1):
    for j in range(1,n*a+1):
        for k in range(1,n+1):
            dp[i][j][k] = dp[i][j][k-1]
            if j - x[k-1] >= 0:
                dp[i][j][k] += dp[i-1][j-x[k-1]][k-1]
ans = 0
for i in range(1,n+1): ans += dp[i][a*i][n]
print(ans)
Buggy python submission (verdict: Runtime Error):
s=int(input())
mod=10**9+7
dp=[0]*s


for i in range(4,s+1):
	for j in range(0,(i-3)+1):
		dp[i]+=dp[j]
		dp[i]%=mod
print(dp[s])



Fixed submission:
s=int(input())
mod=10**9+7
dp=[0]*(s+1)
dp[0]=1

for i in range(1,s+1):
	for j in range(0,(i-3)+1):
		dp[i]+=dp[j]
		dp[i]%=mod
print(dp[s])

Buggy python submission (verdict: Runtime Error):
s=int(input())
mod=10**9+7
dp=[0]*s
dp[0]=1

for i in range(0,s+1):
	dp[i]=dp[i-1]+dp[i-3]
	dp[i]%=mod

print(dp[s])



Fixed submission:
s=int(input())
mod=10**9+7
dp=[0]*(s+1)
dp[0]=1

for i in range(1,s+1):
	for j in range(0,(i-3)+1):
		dp[i]+=dp[j]
		dp[i]%=mod
print(dp[s])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
s = input().split()
n = int(s[0]) 
m = int(s[1])
graph = defaultdict(set)
for i in range(m):
    s = input().split(" ")
    graph[int(s[0])].add(int(s[1]))
    graph[int(s[1])].add(int(s[0]))
visited = [False] * (n+1)

def dfs(root):
    visited[root] = True
    for child in graph[root]:
        if not visited[child]:
            dfs(child)

ans  = 0
prev = 0
for i in range(1, n+1):
    if not visited[i]:
        dfs(i)
        temp = 0
        for k in visited:
            if k:
                temp+=1
        ans  = max(ans, temp-prev)
        prev = temp

print(ans)



Fixed submission:
from collections import defaultdict
s = input().split()
n = int(s[0]) 
m = int(s[1])
graph = defaultdict(set)
for i in range(m):
    s = input().split(" ")
    graph[int(s[0])].add(int(s[1]))
    graph[int(s[1])].add(int(s[0]))

visited = [False] * (n+1)

def bfs (node):
    queue = [node]  
    ans = 0
    visited[node] = True
    while queue:
        root = queue.pop()
        ans +=1
        
        for child in graph[root]:
            if not visited[child]:
                queue.append(child)
                visited[child]  =True
    return ans

ans  = 0
for i in range(1, n+1):
    if not visited[i]:
        ans = max(ans, bfs(i))
print( ans)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
s = input().split()
n = int(s[0]) 
m = int(s[1])
graph = defaultdict(list)
for i in range(m):
    s = input().split(" ")
    graph[int(s[0])].append(int(s[1]))
    graph[int(s[1])].append(int(s[0]))
visited = [False] * (n+1)

def dfs(root):
    visited[root] = True
    for child in graph[root]:
        if not visited[child]:
            dfs(child)

ans  = 0
prev = 0
for i in range(1, n+1):
    if not visited[i]:
        dfs(i)
        temp = 0
        for k in visited:
            if k:
                temp+=1
        ans  = max(ans, temp-prev)
        prev = temp

print(ans)



Fixed submission:
from collections import defaultdict
s = input().split()
n = int(s[0]) 
m = int(s[1])
graph = defaultdict(set)
for i in range(m):
    s = input().split(" ")
    graph[int(s[0])].add(int(s[1]))
    graph[int(s[1])].add(int(s[0]))

visited = [False] * (n+1)

def bfs (node):
    queue = [node]  
    ans = 0
    visited[node] = True
    while queue:
        root = queue.pop()
        ans +=1
        
        for child in graph[root]:
            if not visited[child]:
                queue.append(child)
                visited[child]  =True
    return ans

ans  = 0
for i in range(1, n+1):
    if not visited[i]:
        ans = max(ans, bfs(i))
print( ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for m in range(n-1):
    d = sum(a[m+1:n])
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
d = sum(a)
for m in range(n-1):
    d = d -a[m]
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for m in range(n-1):
    d = sum(a[m+1:n])
    b = b + a[m]*d
c = b % (10**9+7)
print(c)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
d = sum(a)
for m in range(n-1):
    d = d -a[m]
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for m in range(n-1):
    d = a[m+1:n]
    e = sum(d)
    b = b + a[m]*e
c = b % (10**9+7)
print(c)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
d = sum(a)
for m in range(n-1):
    d = d -a[m]
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for m in range(n-1):
    d = 0
    for o in range(m+1,n):
        d = d+a[o]
    b = b + a[m]*d
c = b % (10**9+7)
print(c)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
d = sum(a)
for m in range(n-1):
    d = d -a[m]
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for m in range(n-1):
    for o in range(m+1,n):
        b = b + a[m]*a[o]
c = b % (10**9+7)
print(c)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
d = sum(a)
for m in range(n-1):
    d = d -a[m]
    b = b + a[m]*d
    if b >= 10**9+7:
        b = b % (10**9+7)
print(b)
Buggy python submission (verdict: Runtime Error):
x,n= map(int,input().split())
u = 100
num_str=input().split()
s=list(map(int, num_str))
m  = list(range(-100, 100)) 
for k in s:
    m.remove(k)
for l in m:
    a = l - x
    if abs(u) > abs(a):
        u = a
print(u+x)

Fixed submission:
x,n= map(int,input().split())
u = 100
num_str=input().split()
s=list(map(int, num_str))
m  = list(range(-100,200)) 
for k in s:
    m.remove(k)
for l in m:
    a = l - x
    if abs(u) > abs(a):
        u = a
print(u+x)

Buggy python submission (verdict: Runtime Error):
x,n= map(int,input().split())
u = 100
num_str=input().split()
s=list(map(int, num_str))
m  = list(range(-100, 100)) 
for k in s:
    m.remove(k)
for l in m:
    a = l - x
    if abs(u) > abs(a):
        u = a
print(u+x)

Fixed submission:
x,n= map(int,input().split())
u = 100
num_str=input().split()
s=list(map(int, num_str))
m  = list(range(-100,200)) 
for k in s:
    m.remove(k)
for l in m:
    a = l - x
    if abs(u) > abs(a):
        u = a
print(u+x)
Buggy python submission (verdict: Runtime Error):
a,b = map(Decimal,input().split())
c = int(a*b)
print(c)

Fixed submission:
from decimal import Decimal
a,b = map(Decimal,input().split())
c = int(a*b)
print(c)
Buggy python submission (verdict: Runtime Error):
s = str(input())
if s is ABC:
    print("ARC")
else:
    print("ABC")

Fixed submission:
s = str(input())
if s == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
n = 0
for x in range(10**12):
    c = int(a*x/b)
    d = int(x/b)
    if c - a*d >= n:
        n = c-d
print(n)

Fixed submission:
a,b,n = map(int,input().split())
if b <= n:
    k = b-1
else:
    k = n
m = int(k*a/b) - a*int(k/b)
print(m)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

x = a*c

if a*c < a*d:
    x=a*d
elif a*d < b*c:
    x=b*c
elif b*c < b*d:
    x=b*d

print(x)

Fixed submission:
x=int(input())

if x == 1:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def num_divisors(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1

    return num

n = int(input())
c = 0
for i in range(1, n):
    c += num_divisors(i)
print(c)

Fixed submission:
n = int(input())
def num_divisor(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table
print(sum(num_divisor(n-1)))
Buggy python submission (verdict: Time Limit Exceeded):
from queue import Queue
INF = 99999999999999999


H, W = map(int, input().split())
S = [input() for x in range(H)]


def m_distance(si, sj):
    if (S[si][sj] == '#'):
        return -INF
    
    q = Queue()
    q.put((si, sj, 0))
    done = [[False] * W for x in range(H)]

    m = 0
    unit = ((1, 0), (-1, 0), (0, 1), (0, -1))
    while not q.empty():
        i, j, w = q.get()
        done[i][j] = True
        

        for u in unit:
            nexti = i + u[0]
            nextj = j + u[1]
            if nexti >= 0 and nexti < H and nextj >= 0 and nextj < W and S[nexti][nextj] == '.' and (not done[nexti][nextj]):
                q.put((nexti, nextj, w+1))
                m = max(m, w+1)

    return m

m = 0
for i in range(H):
    for j in range(W):
        m = max(m, m_distance(i, j))
print(m)

Fixed submission:
from queue import Queue
INF = 999999


H, W = map(int, input().split())
S = [input() for x in range(H)]

m = 0
for si in range(H):
    for sj in range(W):
        if S[si][sj] == '#':
            continue
        
        q = Queue()
        q.put((si, sj, 0))
        done = [None] * H
        for i in range(H):
            done[i] = [False] * W
        done[si][sj] = True

        unit = ((1, 0), (-1, 0), (0, 1), (0, -1))
        while not q.empty():
            i, j, w = q.get()

            for u in unit:
                nexti = i + u[0]
                nextj = j + u[1]
                if nexti >= 0 and nexti < H and nextj >= 0 and nextj < W and S[nexti][nextj] == '.' and (not done[nexti][nextj]):
                    q.put((nexti, nextj, w+1))
                    m = max(m, w + 1)
                    done[nexti][nextj] = True
print(m)