Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02880 (python)

Fixed submission:
N = int(input())
_output = False
for n in range(1,10):
  if N % n == 0:
      tmp = N/n
      if tmp <= 9:
          print("Yes")
          _output = True
          break
if not _output:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
_output = False
for n in range(1,10):
  if N % n == 0:
    tmp = N/n
  	if tmp <= 9:
      print("Yes")
      _output = True
      break
if not _output:
  print("No")
Problem p02897 (python)

Fixed submission:
N = int(input())
if N%2 == 0:
  res = int(N/2)
if N%2 == 1:
  res = int(N/2)+1
res /= N
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
res = int(N/2)
if N%2 > 0:
  res += 1
return res
Problem p03013 (python)

Fixed submission:
import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
if M == 0:
    dp[1] = 1
else:
    dp[1] = 0 if a[0] == 1 else 1
ok = [False]*(N+1)
for x in a:
    ok[x] = True
for n in range(2,N+1):
    if ok[n]:
        continue
    dp[n] = (dp[n-1]+dp[n-2])%(10**9+7)
print(int(dp[N]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
	a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
dp[1] = 0 if a[0] == 1 else 1
for n in range(2,N+1):
	if n in a:
		dp[n] = 0
	else:
		dp[n] = (int(dp[n-1])+int(dp[n-2]))%(10**9+7)
print(int(dp[N]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
dp[1] = 0 if a[0] == 1 else 1
for n in range(2,N+1):
    if n in a:
        dp[n] = 0
    else:
        dp[n] = (int(dp[n-1])+int(dp[n-2]))%(10**9+7)
print(int(dp[N]))

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
dp[1] = 0 if a[0] == 1 else 1
for n in range(2,N+1):
    if n in a:
        dp[n] = 0
    else:
        dp[n] = (int(dp[n-1])+int(dp[n-2]))%(math.pow(10,9)+7)
print(int(dp[N]))
Problem p03041 (python)

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

s[k-1] = s[k-1].lower()

print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = list(input())

s[k] = s[k-1].lower()

print("".join(s))
Problem p03207 (python)

Fixed submission:
from sys import stdin

n = int(stdin.readline().rstrip())
data = [int(stdin.readline().rstrip()) for _ in range(n)]
data = sorted(data, reverse=True)
data[0] *= 0.5
data[0] = int(data[0])

print(sum(data))

Buggy submission (verdict: Runtime Error):
n = int(stdin.readline().rstrip())
data = [int(stdin.readline().rstrip()) for _ in range(n)]
data = sorted(data, reverse=True)
data[0] *= 0.5
data[0] = int(data[0])

print(sum(data))

Buggy submission (verdict: Runtime Error):
n = int(stdin.readline().rstrip())
data = [int(stdin.readline().rstrip()) for _ in range(n)]
data = sorted(data, reverse=True)
data[0] *= 0.9
data[0] = int(data[0])

print(sum(data))
Problem p02779 (python)

Fixed submission:
def func():
    return

n = int(input())
# s = input()
# a, b = map(int, input().split())
a = list(map(int, input().split()))
# a = input().split()

ascA = sorted(a)
for i in range(n-1):
    if ascA[i] == ascA[i+1]:
        print("NO")
        exit()

'''
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            print("NO")
            exit()
'''
'''
ans = [0]*(max(a)+1)
for ida in a:
    if ans[ida] > 0:
        print("NO")
        exit()
    ans[ida] += 1
'''

print("YES")

Buggy submission (verdict: Runtime Error):
def func():
    return

n = int(input())
# s = input()
# a, b = map(int, input().split())
a = list(map(int, input().split()))
# a = input().split()

'''
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            print("NO")
            exit()
'''
ans = [0]*(max(a)+1)
for ida in a:
    if ans[ida] > 0:
        print("NO")
        exit()
    ans[ida] += 1

print("YES")

Buggy submission (verdict: Runtime Error):
def func():
    return

n = int(input())
# s = input()
# a, b = map(int, input().split())
a = list(map(int, input().split()))
# a = input().split()

'''
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            print("NO")
            exit()
'''
ans = [False]*(max(a)+1)
for ida in a:
    if ans[ida]:
        print("NO")
        exit()
    ans[ida] = True

print("YES")
Problem p02790 (python)

Fixed submission:
def func():
    return

# n = int(input())
# s = input()
a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = input().split()

ans = ""
if a <= b:
    for i in range(b):
        ans += str(a)
else:
    for j in range(a):
        ans += str(b)

print(ans)

Buggy submission (verdict: Runtime Error):
def func():
    return

# n = int(input())
# s = input()
a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = input().split()

ans = ""
if a <= b:
    for i in b:
        ans += str(a)
else:
    for j in a:
        ans += str(b)

print(ans)
Problem p02862 (python)

Fixed submission:
#組み合わせの計算
def combi(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1

    for i in range(r):
        numer = numer * (n-i) % mod
        denom = denom * (i+1) % mod
    return numer * pow(denom, mod-2, mod) % mod #逆元

x, y = map(int, input().split())
mod  = 10**9+7

n = (-x + 2*y)/3
m = (2*x -  y)/3

if (x+y)%3 != 0:
    print(0)
    exit()

if n < 0 or m < 0:
    print(0)
    exit()

ans = combi(int(n+m), int(n), mod)
print(ans)

Buggy submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return n
    return n*factorial(n-1)

x,y = map(int, input().split())

if (x+y)%3 != 0:
    print(0)

ans = factorial((x+y)/3)/factorial((4*x-2*y)/6)*factorial((4*y-2*x)/6)

print(ans)

Buggy submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return n
    return n*factorial(n-1)

x,y = map(int, input().split())

if (x+y)%3 != 0:
    print(0)

ans = factorial((x+y)/3)/factorial((4*x-2*y)/6)

print(ans)
Problem p03207 (python)

Fixed submission:
N = int(input())
p=[]
max=0
for i in range(N):
    p.append(int(input()))
    if max<=p[i]:
        max=p[i]
sum=0
for i in range(N):
    sum+=p[i]
sum-=max
sum+=max/2
print(int(sum))

Buggy submission (verdict: Runtime Error):
N = input()
p=[]
max=0
for i in range(N):
    p.append(input())
    if max<=p:
        max=p[i]
sum=0
for i in range(N):
    sum+=p[i]
sum-=max
sum+=max/2
print(sum)

Buggy submission (verdict: Runtime Error):
N = input()
p=[]
max=0
for i in range(N):
    p.append(input())
    if max<=p:
        max=p[i]
sum=0
for i in range(N):
    sum+=p[i]
sum-=max
sum+=max/2
print(sum)
Problem p03307 (python)

Fixed submission:
N = int(input())
z = N
if N % 2 != 0:
    z = 2 * N
print(z)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = A[i] - i - 1
A = sorted(A)
medN = N//2
x = 0
for i in range(N):
    x = x + abs(A[i] - A[medN])
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = A[i] - i-1
sorted(A)
halfN = int(N/2)
x = 0
for i in range(N):
    x = x + abs(A[i] - A[halfN])
print(x)
Problem p03041 (python)

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

new_S = S[:K-1] + S[K-1].lower() + S[K:]
print(new_S)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

S = S.replace(S[K-1], S[K-1].lower())
print(S)
Problem p03053 (python)

Fixed submission:
from collections import deque

def penetrate(x, y, count):
    global max_idx
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]

        if 0 <= nx < h and 0 <= ny < w and A[nx][ny] == "." and d[nx][ny] == -1:
            d[nx][ny] = count + 1
            q.append((nx, ny, d[nx][ny]))
            max_idx = max(max_idx, d[nx][ny])


h, w = map(int, input().split())
d = [[-1] * w for _ in range(h)]

A = [[] for i in range(h)]
q = deque()

for i in range(h):
    A[i] = list(input())
    for j in range(w):
        if A[i][j] == "#":
            d[i][j] = 0
            q.append((i, j, d[i][j]))

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
max_idx = 0

while len(q) > 0:
    idx = q.popleft()
    penetrate(idx[0], idx[1], idx[2])

print(max_idx)

Buggy submission (verdict: Runtime Error):
import numpy as np

def penetrate(x, y, idx):
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]

        if 0 <= nx < h and 0 <= ny < w and A[nx][ny] == "." and d[nx][ny] == -1:
            d[nx][ny] = idx + 1


h, w = map(int, input().split())
d = [[-1] * w for _ in range(h)]

A = [[] for i in range(h)]

for i in range(h):
    A[i] = list(input())
    for j in range(w):
        if A[i][j] == "#":
            d[i][j] = 0

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

idx = 0
while True:
    count = 0
    for i in range(h):
        for j in range(w):
            if d[i][j] == idx:
                penetrate(i, j, idx)
            if d[i][j] == -1:
                count += 1
    idx += 1
    if count == 0:
        break

print(np.max(d))
Problem p02831 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a, b = map(int, input().split())

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math as ma


def lcm(x, y):
    return (x * y) // ma.gcd(x, y)


a, b = map(int, input().split())

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math as ma

def lcm(x, y):
    return (x * y) // ma.gcd(x, y)

a, b = map(int, input().split())

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b =map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b =map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p02832 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
k = 0
for a in A:
    if k+1==a:
        k+=1
print(-1 if k==0 else N-k)

Buggy submission (verdict: Runtime Error):
N = int(input())
s =input().split()

cnt = 0
flag = -1
a = 0
for i in range(0,len(s)):

    if i+1 == int(s[i]):
        break
    else:
       s.pop(i)
       cnt = cnt + 1
       flag = 1
       a = a + 1

if flag == 1:
    print(cnt)
else:
    print(flag)

Buggy submission (verdict: Runtime Error):
N = int(input())
s =input().split()

cnt = 0
flag = -1
a = 0
for i in range(0,len(s)):

    if i+1 == int(s[i]):
        continue
    else:
       s.pop(i)
       cnt = cnt + 1
       flag = 1
       a = a + 1

if flag == 1:
    print(cnt)
else:
    print(flag)
Problem p02831 (python)

Fixed submission:
import fractions
def lcm(x,y):
    return x*y/fractions.gcd(x,y)

a,b=map(int, input().split(' '))

print(int(lcm(a,b)))

Buggy submission (verdict: Runtime Error):
import fraction
def lcm(x,y):
    return x*y/math.gcd(x,y)

a,b=map(int, input().split(' '))

print(int(lcm(a,b)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x,y):
    return x*y/math.gcd(x,y)

a,b=map(int, input().split(' '))

print(int(lcm(a,b)))

Buggy submission (verdict: Runtime Error):
import math


def lcm(x,y):
    return x*y/math.gcd(x,y)

a,b=map(int, input().split(' '))

print(int(lcm(a,b)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x,y):
    return x*y/math.gcd(x,y)

a,b=map(int, input().split(' '))
print(int(lcm(a,b)))
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
S.W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
Problem p02785 (python)

Fixed submission:
def f(h,k):
    N=len(h)
    t=0
    h.sort()
    for i in range(N-k):
        t+=h[i]
    return t
N,k=map(int,input().split())
h=list(map(int,input().split()))
print(f(h,k))

Buggy submission (verdict: Runtime Error):
def f(h,k):
    N=len(h)
    t=0
    h.sort()
    for i in range(k-1):
        t+=h[i]
    return sum(h)-t
N,k=map(int,input().split())
h=list(map(int,input().split()))
print(f(h,k))
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if N < 2 and M < 2:
  a = 0
elif N < 2:
  a = cmb(M,2)
elif M < 2:
  a = cmb(N,2)
elif N > 1 and M > 1:
  a = cmb(N,2) + cmb(M,2)

print(int(a))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if N < 2:
  a = cmb(M,2)
elif M < 2:
  a = cmb(N,2)
elif N > 1 and M > 1:
  a = cmb(N,2) + cmb(M,2)
else:
  a = 0

print(int(a))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if N < 2:
  a = cmb(M,2)
elif M < 2:
  a = cmb(N,2)
else:
  a = cmb(N,2) + cmb(M,2)

print(int(a))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

id N == 0:
  a = cmb(M,2)
elif M == 0:
  a = cmb(N,2)
else:
  a = cmb(N,2) + cmb(M,2)

print(int(a))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

a = cmb(N,2) + cmb(M,2)

print(int(a))
Problem p02711 (python)

Fixed submission:
N = list(input())
if '7' in N:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = list(input())
if N in '7':
	print('Yes')
else:
	print('No')
Problem p02959 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  ans += min(A[i]+A[i+1],B[i])
  A[i+1] -= max(0,min(A[i+1],B[i]-A[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  ans += min(a[i]+a[i+1],b[i])
  A[i+1] -= max(0,min(A[i+1],B[i]-A[i]))
print(ans)
Problem p02990 (python)

Fixed submission:
import math
N,K = map(int,input().split())
blue = K
red = N-K
def combinations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  if i > N-K+1:
    print(0)
  else:
    ans = (combinations(red+1, i)*combinations(K-1, i-1))%(10**9+7)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
blue = K
red = N-K
def combinations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  ans = (combinations(red+1, i)*combinations(K-1, i-1))%(10**9+7)
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
blue = K
red = N-K
def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  ans = (combinations(red+1, i)*combinations(K-1, i-1))%(10**9+7)
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
blue = K
red = N-K
def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  ans = combinations(red+1, i)*combinations(K-1, i-1)
  print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
blue = K
red = N-K
def permutations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // math.factorial(n - r)

for i in range(1,K+1):
  ans = permutations(red+1,i)
  print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,input().split())
blue = K
red = N-K
def permutations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // math.factorial(n - r)

for i in range(1,K+1):
  ans = permutations(red+1,i)
  print(ans)
Problem p03127 (python)

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

A_tmp=A[0]
for i in A[1:]:
  if i%A_tmp != 0:
    A_tmp = i%A_tmp
    
while(1):
  tmp = [x%A_tmp for x in A if x%A_tmp != 0]
  if sum(tmp) != 0:
    A_tmp = min(tmp)
  else:
    break
print(A_tmp)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
A_ = []
tmp = A[1]-A[0]
A_1 = [i for i in A]
A_1 = [i%A[0] for i in A_1]
A_2 = [2*i for i in A]
A_2 = [i%A[0] for i in A_2]
A_3 = [i for i in A]
A_3 = [i%tmp for i in A_3]
A_ = A_1 + A_2 + A_3 
A_ = sorted(set(A_))
if A_ == [0]*len(A_):
  print(A[0])
else:
  print(A_[1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
A_ = []
A_1 = [i for i in A]
A_1 = [i%A[0] for i in A_1]
A_2 = [2*i for i in A]
A_2 = [i%A[0] for i in A_2]
A_3 = [i for i in A]
A_3 = [i%(A[1]-A[0]) for i in A_3]
A_ = A_1 + A_2 + A_3 
A_ = sorted(set(A_))
if A_ == [0]*len(A_):
  print(A[0])
else:
  print(A_[1])
Problem p03137 (python)

Fixed submission:
import numpy as np
N,M = map(int,input().split())
X = list(map(int,input().split()))

if N < M:
  X = sorted(X,reverse = True)
  X_ = abs(np.array(X[1:]) - np.array(X[:M-1]))
  X_ = sorted(X_,reverse = True)
  print(sum(X_[N-1:]))
else:
  print('0')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
A_ = [2*i for i in A]
A_ = [i%A[0] for i in A_]
A_ = sorted(set(A_))
if A_ == [0]*len(A_):
  print(A[0])
else:
  print(A_[1])
Problem p03208 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
list = []
for i in range(N):
 list.append(int(input()))
list = sorted(list);
print(min(list[i+K-1] - list[i] for i in range(N-K+1)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
list = []
for i in range(N):
 list.append(int(input()))
list = sorted(list);
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
list = []
list_tmp = [0]*(K-1)
for i in range(N):
 list.append(int(input()))
 if i < N-K:
  list_tmp.append(list[i])
list = sorted(list);
list_tmp = sorted(list_tmp);
tmp = list[-K:];
tmp_list =  list_tmp[K:]
tmp = np.array(tmp)
tmp_list = np.array(tmp_list)
print(min(tmp - tmp_list))
Problem p03221 (python)

Fixed submission:
N,M = map(int,input().split())
city_list = sorted([[list(map(int,input().split())),i] for i in range(M)])
ID = city_list[0][0]
num = 0
ans = []
for i in range(M):
  if ID != city_list[i][0][0]:
    ID = city_list[i][0][0]
    num = 0
  num += 1
  ans.append([city_list[i][1],'{0:06d}'.format(ID)+'{0:06d}'.format(num)])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i][1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
P = []
Y = []
index = range(1,M+1)
for i in range(M):
 a,b= map(int,input().split())
 P.append(a)
 Y.append(b)
print(P)
print(Y)
for i in range(1,N+1):
 a = [j for j, x in enumerate(P) if x == i]
 for p in range(1,len(a)+1):
  print({0:04d}.format(i){0:04d}".format(p))
Problem p03327 (python)

Fixed submission:
N = int(input())

if N<=999:print('ABC')
else:print('ABD')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split());print(sum(range(b-a))-a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split()) print(sum(range(b-a))-a)
Problem p03705 (python)

Fixed submission:
N,A,B = map(int,input().split())
if A>B:
  print('0')
elif N == 1:
  if A!=B:
    print('0')
  else:
    print('1')
else:
  print((B-A)*(N-2)+1)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
data = range(A,B+1)
if N-2>=0:
  print( (B − A)(N − 2) + 1)
elif N == 1:
  if A!=B:
    print('0')
  else:
    print('1')
else:
  print('0')

Buggy submission (verdict: Runtime Error):
import itertools
N,A,B = map(int,input().split())
data = range(A,B+1)
if N-2>=0:
  tmp = list(itertools.combinations_with_replacement(data,N-2))
  ans = []
  for i in range(len(tmp)):
    ans.append(sum(tmp[i]))
  print(len(set(ans)))
elif N == 1:
  print('1')
else:
  print('0')

Buggy submission (verdict: Runtime Error):
import itertools
N,A,B = map(int,input().split())
data = range(A,B+1)
if N-2>=0:
  tmp = list(itertools.combinations_with_replacement(data,N-2))
  ans = []
  for i in range(len(tmp)):
    ans.append(tmp[i][0]+tmp[i][1])
  print(len(set(ans)))
else:
  print('0')
Problem p02793 (python)

Fixed submission:
import fractions
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
l = list(map(int, input().split(" ")))
 
p = lcm_list(l)
c = 0
for i in l:
  c += p // i
print(c % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
from functools import reduce

def gcd(x, y):
    y, x = sorted([x, y])
    while True:
        r = x % y
        if r == 0:
            print(x, y, r)
            return r
        else:
            print(x, y, r)
            x, y = y, r

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
l = list(map(int, input().split(" ")))

p = lcm_list(l)
c = 0
z = 10 ** 9 + 7
for i in l:
  c += p // i
print(c % z)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
N = int(input())
l = list(map(int, input().split(" ")))
 
p = gcd(l)

c = 0
for i in l:
  c += i // p
print(c // (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
N = int(input())
l = list(map(int, input().split(" ")))
 
p = gcd(l)
 
n = reduce(lambda a, b: a * b, l) / (p ** N) / (10 ** 9 + 7)
print(n)

Buggy submission (verdict: Runtime Error):
import math
from fractions import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N = int(input())
l = list(map(int, input().split(" ")))

p = gcd(l)

n = reduce(lambda a, b: a * b, l) / (p ** N) / (10 ** 9 + 7)
print(n)
Problem p02836 (python)

Fixed submission:
S = input()
l = len(S)
c = 0
for a, b in zip(S[:l//2+1], S[:l//2-1:-1]):
  if a != b:
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
S = input()

c = 0
for a, b in zip(s, s[-1]):
  if a == b:
    c += 1

print(len(S)-c)