Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
d,n = map(int,input().split())
if d == 0 and n != 100:
    print(n)
elif d == 0 and n == 100:
    print(101)
elif d == 1 and n != 100:
    print(n*100)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n != 100:
    print(n*10000)
elif:
    print(1010000)

Fixed submission:
d,n = map(int,input().split())
if d == 0 and n != 100:
    print(n)
elif d == 0 and n == 100:
    print(101)
elif d == 1 and n != 100:
    print(n*100)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n != 100:
    print(n*10000)
else:
    print(1010000)
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = []
for i in range(2,34):
	n = i**2
	while n <= x:
		a.append(n)
		n = n*i

print(max(a))
    

Fixed submission:
x = int(input())
if x != 1:
  a = []
  for i in range(2,34):
      n = i**2
      while n <= x:
          a.append(n)
          n = n*i

  print(max(a))
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
s = input()
m = int(input())

c = []

if len(s) < 100:

    for i in range(len(s)):
        for k in range(1,len(s)+1):
            c.append(s[i:i+k])

    b = sorted(list(set(c)))

    print(b[m-1])

else:
    po = []
    for i in range(len(s)):
        if s[i] not in po:
            po.append(s[i])

    for i in range(len(s)):
        if s[i:i+2] not in po:
            po.append(s[i:i+2])

    for i in range(len(s)):
        if s[i:i+3] not in po:
            po.append(s[i:i+3])
    print(po[m-1])


Fixed submission:
s = input()
m = int(input())

c = []


for i in range(len(s)):
    for k in range(1,m+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))


print(b[m-1])

Buggy python submission (verdict: Runtime Error):
s = input()
m = int(input())

c = []

if len(s) < 100:

    for i in range(len(s)):
        for k in range(1,len(s)+1):
            c.append(s[i:i+k])

    b = sorted(list(set(c)))

    print(b[m-1])

else:
    po = []
    for i in range(len(s)):
        po.append(s[i])
    po = sorted(set(po))
    print(po[m-1])


Fixed submission:
s = input()
m = int(input())

c = []


for i in range(len(s)):
    for k in range(1,m+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))


print(b[m-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
m = int(input())

c = []

for i in range(len(s)):
    for k in range(1,len(s)+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))

print(b[m-1])


Fixed submission:
s = input()
m = int(input())

c = []


for i in range(len(s)):
    for k in range(1,m+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))


print(b[m-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))

def med(a):
    b = sorted(a)
    num = int((len(b)+1)/2)
    return b[num-1]


for i in range(n):
    temp = x[:]
    temp.remove(x[i])
    print(med(temp))

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

a = len(x)
b = sorted(x)
fa = b[int((a/2)-1)]
se = b[int(a/2)]

for i in range(n):
    if x[i] <= fa:
        print(se)
    else:
        print(fa)
Buggy python submission (verdict: Runtime Error):
S = list(input().split())
if "a" in S and "b" in S and "c" in S:
	print("YES)
else:


Fixed submission:
S =input()
if "a" in S and "b" in S and "c" in S:
	print("Yes")
else:
  	print("No")

Buggy python submission (verdict: Runtime Error):
S = input()
if "a" in S and "b" in S and "c" in S:
	print("YES)
else:
    print("NO")

Fixed submission:
S =input()
if "a" in S and "b" in S and "c" in S:
	print("Yes")
else:
  	print("No")

Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>

int main(){
  string S;
  cin >> S;
  if (s.find("a") != std::string::npos && s.find("b") != std::string::npos && s.find("c") != std::string::npos){
  cout << "YES" << endl;
  }
  else
  cout << "NO" << endl;
}

Fixed submission:
S =input()
if "a" in S and "b" in S and "c" in S:
	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
a = input().split()
n = int(a[0])
m = int(a[1])

x = [-1 for k in range(n)]
ans = "Yes"


for i in range(m):
    b = input().split()
    if i == 0:
        x[int(b[0])-1] = 0
        x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])

    else:
        if (x[int(b[1])-1] != -1) and (x[int(b[1])-1] != (x[int(b[0])-1] + int(b[2]))):
            ans = "No"
            break
        else:
        	x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])
        	

print(ans)
           
          
      
    

Fixed submission:
x = int(input())
a = int(input())
b = int(input())

print((x-a)%b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = n[0]
b = n[1]
c = n[2]
d = n[3]
if a == b and b == c and c == d:
    print("Yes")
elif a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")

Fixed submission:
N = input()
a = N[0]
b = N[1]
c = N[2]
d = N[3]
if a == b and b == c and c == d:
    print("Yes")
elif a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import bisect

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a =sorted(a)
b =sorted(b)
c =sorted(c)

ans = 0
for i in range(n):
    in_in = bisect.bisect_left(b,a[i])
    if a[i] == b[in_in]:
        in_in += 1
    for k in range(in_in,n):
        insert_index = bisect.bisect_left(c,b[k])
        if b[k] == c[insert_index]:
            insert_index += 1
        ans += n-insert_index


print(ans)


Fixed submission:
import bisect

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a =sorted(a)
b =sorted(b)
c =sorted(c)

ans = 0
for i in range(n):
    in_a = bisect.bisect_left(a,b[i])
    in_c = bisect.bisect_right(c,b[i])
    ans += (in_a)*(n-in_c)


print(ans)
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
S =str(input())
a=S.count("1")
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
inf = float("inf")
n,m,r = map(int,input().split())
ra = list(map(int,input().split()))
dist = [[inf for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    a,b,c = map(int,input().split())
    dist[a][b] = c
    dist[b][a] = c

for a in range(n+1):
    for b in range(n+1):
        for c in range(n+1):
            dist[b][c] = min(dist[b][c],dist[b][a]+dist[a][c])

#print("距離行列は以下")
#for i in range(n+1):
    #print(dist[i])

ans = inf
for p in itertools.permutations(ra):
    subt = 0
    for i in range(r-1):
        subt += dist[p[i]][p[i+1]]
    if subt < ans:
        ans = subt
print(ans)


Fixed submission:
import itertools
inf = float("inf")
n,m,r = map(int,input().split())
ra = list(map(int,input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
for i in range(m):
    a,b,c = map(int,input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

for a in range(n):
    for b in range(n):
        for c in range(n):
            dist[b-1][c-1] = min(dist[b-1][c-1],dist[b-1][a-1]+dist[a-1][c-1])

#print("距離行列は以下")
#for i in range(n+1):
    #print(dist[i])

ans = inf
for p in itertools.permutations(ra):
    subt = 0
    for i in range(r-1):
        subt += dist[p[i]-1][p[i+1]-1]
    if subt < ans:
        ans = subt
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b =map(int,input().split())
k = a%3
s = b%3
if k ==s and k != 0:
  print("Impossible)
else:
  print("Possible")

Fixed submission:
a,b =map(int,input().split())
k = a%3
s = b%3
if k == s and k != 0:
  print("Impossible")
else:
  print("Possible")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [[] for i in range(n)]
for i in range(n):
    x,y = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

def dfs(v):
    d = [-1 for i in range(n)]
    q = []
    d[v] = 0
    q.append(v)
    while len(q):
        v = q.pop()
        for i in a[v]:
            if d[i] == -1:
                d[i] = d[v]+1
                q.append(i)
    return d
c1 = dfs(0)
c2 = dfs(n-1)
c = 0
for i in range(n):
    if c1[i]>c2[i]:
        c += 1
if c>= n/2:
    print("Snuke")
else:
    print("Fennec")


Fixed submission:
n = int(input())
a = [[] for i in range(n)]
for i in range(n-1):
    x,y = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

def dfs(v):
    d = [-1 for i in range(n)]
    q = []
    d[v] = 0
    q.append(v)
    while len(q):
        v = q.pop()
        for i in a[v]:
            if d[i] == -1:
                d[i] = d[v]+1
                q.append(i)
    return d
c1 = dfs(0)
c2 = dfs(n-1)
c = 0
for i in range(n):
    if c1[i]>c2[i]:
        c += 1
if c>= n/2:
    print("Snuke")
else:
    print("Fennec")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
a = "SS"
b = "SW"
c = "WS"
d = "WW"

#ox
ans = "-1"

for animals in [a,b,c,d]:
    for say in s:
        if (animals[-1] == "S" and say == "o" ) or (animals[-1] == "W" and say == "x"):
            animals += animals[-2]
        elif (animals[-1] == "S" and say == "x"):
            if animals[-2] == "S":
                animals += "W"
            else:
                animals += "S"
        elif (animals[-1] == "W" and say == "o"):
            if animals[-2] == "S":
                animals += "W"
            else:
                animals += "S"
    if animals[:2] == animals[-2:]:
        ans  =animals[1:-1]
print(ans)


Fixed submission:
n = int(input())
s = input()

#ox
ans = "-1"

for animals in ["SS","SW","WS","WW"]:
    for say in s:
        if (animals[-1] == "S" and say == "o" ) or (animals[-1] == "W" and say == "x"):
            animals += animals[-2]
        elif (animals[-1] == "S" and say == "x"):
            if animals[-2] == "S":
                animals += "W"
            else:
                animals += "S"
        elif (animals[-1] == "W" and say == "o"):
            if animals[-2] == "S":
                animals += "W"
            else:
                animals += "S"
    if animals[:2] == animals[-2:]:
        ans  =animals[1:-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b/gcd(a,b)

L = 1

D = 1000000007
for i in range(N):
    L = lcm(L,A[i]) 
L = L % D

res = 0
for i in range(N):
    res = (res + L * pow(A[i],D-2,D)) % D  
print(int(res))





Fixed submission:
N = int(input())
A = list(map(int,input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)

L = 1

D = 1000000007
for i in range(N):
    L = lcm(L,A[i]) 
L = L % D

res = 0
for i in range(N):
    res = (res + L * pow(A[i],D-2,D)) % D  
print(int(res))
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())

S = input()
l =[0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())

total = 0
for i in range(N):
    total = S.count("AC")

left = [0] * N
right = [0] * N
if S[0:2] == "AC":
    left[1] = 1
if S[N-2:N] == "AC":
    right[N-2] = 1
for i in range(2,N):
    if S[i-1:i+1] == "AC":
        left[i] = left[i-2]+1
    else:
        left[i] = left[i-1]

for i in range(N-3,-1,-1):
    if S[i:i+2] == "AC":
        right[i] = right[i+2]+1
    else:
        right[i] = right[i+1]

left = [0] + left
left.append(0)
right = [0] + right
right.append(0)

for i in range(Q):
    res = total - (left[l[i]-1] + right[r[i]+1])
    if l[i] >= 2 and S[l[i]-2] == "A" and S[l[i]-1] == "C":
        res -= 1
    if r[i] <= N-1 and S[r[i]-1] == "A" and S[r[i]] == "C":
        res -= 1
    print(res)

Fixed submission:
N,Q = map(int, input().split())

S = input()
l =[0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())

left = [0] * N
if S[0:2] == "AC":
    left[1] = 1
for i in range(2,N):
    if S[i-1:i+1] == "AC":
        left[i] = left[i-2]+1
    else:
        left[i] = left[i-1]

for i in range(Q):
    if (l[i] == 1):
        res = left[r[i]-1]
    else:
        res = left[r[i]-1] - left[l[i]-2]
    if l[i] >= 2 and S[l[i]-1] == "C" and S[l[i]-2] == "A":
        res -= 1
    print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())

S = input()
l =[0 for i in range(Q)]
r = [0 for i in range(Q)]
for i in range(Q):
    l[i], r[i] = map(int, input().split())

total = 0
for i in range(N):
    total = S.count("AC")

left = [0 for i in range(N)]
right = [0 for i in range(N)]
if S[0:2] == "AC":
    left[1] = 1
if S[N-2:N] == "AC":
    right[N-2] = 1
for i in range(2,N):
    if S[i-1:i+1] == "AC":
        left[i] = left[i-2]+1
    else:
        left[i] = left[i-1]

for i in range(N-3,-1,-1):
    if S[i:i+2] == "AC":
        right[i] = right[i+2]+1
    else:
        right[i] = right[i+1]

left.insert(0,0)
left.append(0)
right.insert(0,0)
right.append(0)

for i in range(Q):
    res = total - (left[l[i]-1] + right[r[i]+1])
    if l[i] >= 2 and S[l[i]-2] == "A" and S[l[i]-1] == "C":
        res -= 1
    if r[i] <= N-1 and S[r[i]-1] == "A" and S[r[i]] == "C":
        res -= 1
    print(res)

Fixed submission:
N,Q = map(int, input().split())

S = input()
l =[0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())

left = [0] * N
if S[0:2] == "AC":
    left[1] = 1
for i in range(2,N):
    if S[i-1:i+1] == "AC":
        left[i] = left[i-2]+1
    else:
        left[i] = left[i-1]

for i in range(Q):
    if (l[i] == 1):
        res = left[r[i]-1]
    else:
        res = left[r[i]-1] - left[l[i]-2]
    if l[i] >= 2 and S[l[i]-1] == "C" and S[l[i]-2] == "A":
        res -= 1
    print(res)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
def united(stri):
    for a in stri:
        if a != stri[0]:
            return False
    return True

while (not united(s)) and len(s) >= 2:
    k = len(s)
    if k == 2:
        if s[0] != s[1]:
            ans += 2
        break
    for i in range(0,k-1):
        if s[i] != s[i+1]:
            if i == k - 2:
                s = s[:i]
            elif i == 0:
                s = s[i+2:]
            else:
                s = s[:i] + s[i+2:]
            ans += 2
            break
print(ans)

Fixed submission:
s = input()
c_0 = 0
c_1 = 0
for i in s:
    if i == "0":
        c_0 += 1
    elif i == "1":
        c_1 += 1
print(min(c_0,c_1)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
def united(stri):
    for a in stri:
        if a != stri[0]:
            return False
    return True

while (not united(s)) and len(s) >= 2:
    k = len(s)
    if k == 2:
        if s[0] != s[1]:
            ans += 2
        break
    for i in range(0,k-2):
        if s[i] != s[i+1]:
            if i == k - 2:
                s = s[:i]
            elif i == 0:
                s = s[i+2:]
            else:
                s = s[:i] + s[i+2:]
            ans += 2
            break
print(ans)

Fixed submission:
s = input()
c_0 = 0
c_1 = 0
for i in s:
    if i == "0":
        c_0 += 1
    elif i == "1":
        c_1 += 1
print(min(c_0,c_1)*2)
Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int,input().split())
A = list(map(int,input().split()))

num = [0,2,5,5,4,5,6,3,7,6]
minnum = 10

# iけたをj本使ってできる最大値がdp[i][j]
dp = [-1000000000 for _ in range(20000)]
for i in range(1,10):
    if i in A:
        a = i
        dp[num[a]] = max(dp[num[a]],a)
        minnum = min(minnum,num[a])

for i in range(N//minnum+1):
    for j in range(N):
        for a in A:
            dp[j+num[a]] = max(dp[j+num[a]], 10 * dp[j] + a)
print(dp[N])


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

w = [2,5,5,4,5,6,3,7,6]

min_w = 10
for i in a:
    min_w = min(min_w,w[i-1])

dp = [0 for i in range(n+1)]


for i in range(0,n):
    if 1 <= i < min_w:
            dp[i] = -1
    for j in a:
        if i + 1 - w[j-1] >= 0 and dp[i + 1 - w[j-1]] != -1:
            dp[i+1] = max(dp[i+1],dp[i+1-w[j-1]]*10+j)
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
def factor_list(n):
    res = []
    i = 2
    while i <= n:
        tmp = 0
        while n % i == 0:
            n = n // i
            tmp += 1
        if tmp > 0:
            res.append((i,tmp))
        i += 1
    return res

def combination(n,k):
    res = 1
    for i in range(n-k+1,n+1):
        res *= i 
    for i in range(1,k+1):
        res = res // i 
    return res
factors = factor_list(m)
count = 1
for num,cnt in factors:
    count *= combination(cnt+n-1,cnt)
print(count % (10**9+7))

Fixed submission:
N, M = map(int, input().split()) 

def comb(n, r):
    a = 1; b = 1
    for i in range(r):
        a *= (n-i)
        b *= (i+1)
    return a // b 


facts = []

i = 2
m = M
while i * i <= M:
    cnt = 0
    while m % i == 0:
        m //= i
        cnt += 1
    if cnt:
        facts.append(cnt)
    i += 1
if m > 1:
    facts.append(1)
D = 1000000007
res = 1
for f in facts:
    res = (res * comb(f + N - 1, f)) % D 
print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())
w = [""] * n 
result = "Yes"

for i in range(n):
    tmp = input()
    if tmp in w:
        result = "No"
        break
    w[i] = tmp 
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)

Fixed submission:
n = int(input())
w = [""] * n 
result = "Yes"

for i in range(n):
    tmp = input()
    if tmp in w:
        result = "No"
    w[i] = tmp 
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
w = [0] * n 
result = "Yes"

for i in range(n):
    tmp = input()
    if tmp in w:
        result = "No"
        break
    w[i] = tmp 
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)

Fixed submission:
n = int(input())
w = [""] * n 
result = "Yes"

for i in range(n):
    tmp = input()
    if tmp in w:
        result = "No"
    w[i] = tmp 
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
w = [0] * n 
result = "Yes"

for i in range(n):
    w[i] = int(input())
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)

Fixed submission:
n = int(input())
w = [""] * n 
result = "Yes"

for i in range(n):
    tmp = input()
    if tmp in w:
        result = "No"
    w[i] = tmp 
for i in range(n-1):
    if w[i][-1] == w[i+1][0]:
        pass
    else:
        result = "No"
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N,H = input().split()
n = int(N)
h = int(H)
da = 0
db = [0] * n
for i in range(n):
    a,b = tuple(map(int,input().split()))
    da = max(a,da)
    db[i] = b
db.sort()      
#　その都度最大値を持ってくる
#　持ってきたのが2番目の要素なら消す、1番目の要素なら維持する
total = 0 
i = 0
while total < h:
    if len(db) == 0:
        i += math.ceil((h - total)/da)
        break
    elif db[-1] >= da:
        total += db.pop()
    else:
        total += da
    i += 1
print(str(i))

Fixed submission:
import math
N,H = input().split()
n = int(N)
h = int(H)
da = 0
db = [0] * n
for i in range(n):
    a,b = tuple(map(int,input().split()))
    da = max(a,da)
    db[i] = b
db.sort()      
#　その都度最大値を持ってくる
#　持ってきたのが2番目の要素なら消す、1番目の要素なら維持する
total = 0 
i = 0
while total < h:
    if db[-1] >= da:
        total += db.pop()
        if len(db) == 0:
            i += math.ceil((h - total)/da) + 1
            break
    else:
        i += math.ceil((h - total)/da) 
        break
    i += 1
print(str(i))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input.split())))
ans = N
mx = max(ab,key=lambda x:x[1])[0]
ans += mx - 1
mn = min(ab,key=lambda x:x[1])[1]
ans += mn
print(ans)

Fixed submission:
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
mn = min(ab,key=lambda x:x[1])
print(sum(mn))

Buggy python submission (verdict: Runtime Error):
N = int(input())
ab = []
for i in N:
    ab.append(tuple(map(int,input.split())))
ans = N
mx = max(ab,key=lambda x:x[1])[0]
ans += mx - 1
mn = min(ab,key=lambda x:x[1])[1]
ans += mn
print(ans)

Fixed submission:
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
mn = min(ab,key=lambda x:x[1])
print(sum(mn))
Buggy python submission (verdict: Runtime Error):
import math

I=list(map(int,input().split()))
X=(2*I[1]-I[0])//3
Y=(2*I[0]-I[1])//3
n=X+Y
r=X

if ((X<0 or Y<0) or (X+Y)%3!=0):
    print(0):
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

print(cmb(n, r, p))

Fixed submission:
import math

I=list(map(int,input().split()))
X=(2*I[1]-I[0])//3
Y=(2*I[0]-I[1])//3
n=X+Y
r=X

if (X<0 or Y<0 or (I[0]+I[1])%3!=0):
    print(0)
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

print(cmb(n, r, p))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
bool1=False
#print(a,"to",b) a=21 b=1 i=3 j=7 out
if 1<=a and a<=20 and 1<=b and b<=20:
	for i+1 in range(10):
		for j+1 in range(10):
			#print(i)
			if i*j == a*b:
				#print("a")
				bool1=True
				#print(bool1)
				break
			else:
				#print("j={0}".format(j))
				pass
		if bool1==True:
			break
#print(bool1)
if bool1==True:
	print(a*b)
else:
	print(-1)


Fixed submission:
a, b = map(int, input().split())
if a<=9 and b<=9:
	print(a*b)
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
bool1=False
#print(a,"to",b) a=21 b=1 i=3 j=7 out
if 1<=a and a<=20 and 1<=b and b<=20
for i in range(10):
	for j in range(10):
		#print(i)
		if i*j == a*b:
			#print("a")
			bool1=True
			#print(bool1)
			break
		else:
			#print("j={0}".format(j))
			pass
	if bool1==True:
		break
#print(bool1)
if bool1==True:
	print(a*b)
else:
	print(-1)


Fixed submission:
a, b = map(int, input().split())
if a<=9 and b<=9:
	print(a*b)
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
count = 0
for i in range(3):
  if S[3] == T[3]:
    count += 1
print(count)   
  

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
  if S[i] == T[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
s=c-(a-b)
if s>0:
  print(s)
else:
  print('0')

Fixed submission:
A,B = map(int,input().split())
K=(A+B)/2
if K%1==0:
  print(int(K))
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
x,a = map(int,input().split())
if x < a:
  print(0)
else:
  print(10)

Fixed submission:
r = int(input())
print(3*r**2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
a=[h[i+1] for i in range(n-1) if h[i] >= max(h[i:])]
print(len([i for i in a if i >= h[0]])+1)


Fixed submission:
a,b = map(int,input().split())
s = [a,b]
if a!=b:
  print(max(s)*2-1)
else:
  print(max(s)*2)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
if a>=13:
    ans = b
elif 6<=a<=12:
    ans = b//2
print(ans)


Fixed submission:
a,b=map(int, input().split())
if a>=13: ans = b
elif 6<=a<=12: ans = b//2
else: ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
if a>=13:
    ans = b
elif 6 <= a <= 12:
    b//2
print(ans)


Fixed submission:
a,b=map(int, input().split())
if a>=13: ans = b
elif 6<=a<=12: ans = b//2
else: ans = 0
print(ans)