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

Fixed submission:
#! env/bin/local python3

s, t = input().split()
a, b = map(int, input().split())
u = input()

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print('{} {}'.format(balls[s], balls[t]))

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3

s, t = input().split()
a, b = map(int, input().split())
u = input()

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print(f'{balls[s]} {balls[t]}')

Buggy submission (verdict: Runtime Error):
#! env/bin/local python3

s, t = input().split()
a, b = map(int, input().split())
u = int(input())

balls = {
    s: a,
    t: b
}

balls[u] -= 1

print(f'{balls[s]} {balls[t]}')
Problem p03127 (python)

Fixed submission:
#! -*- coding: utf -*-

import fractions

n = int(input())
monsters = list(map(int, input().split()))

for i in range(n-1):
    monsters[i + 1] = fractions.gcd(monsters[i], monsters[i + 1])

print(monsters[-1])

Buggy submission (verdict: Runtime Error):
#! -*- coding: utf -*-

import math

n = int(input())
monsters = list(map(int, input().split()))

for i in range(n-1):
    monsters[i + 1] = math.gcd(monsters[i], monsters[i + 1])

print(monsters[-1])
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def dfs(v, p):
    for u in link[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

N, Q = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)

ans = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x

dfs(0, -1)

print(*ans)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = [0] * M
for i in range(M):
    a[i] = int(input())

mod = 10 ** 9 + 7

dp = [0] * 100010

j = 0
dp[0] = 1
if M > 0:
    if a[0] == 1:
        dp[1] = 0
        j += 1
    else:
        dp[1] = 1
else:
    dp[1] = 1

a += [-1]
for i in range(2, N+1):
    if M > 0:
        if i == a[j]:
            dp[i] = 0
            j += 1
            continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[N] % mod)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [0] * M
for i in range(M):
    a[i] = int(input())

mod = 10 ** 9 + 7

dp = [0] * 100010

j = 0
dp[0] = 1
if a[0] == 1:
    dp[1] = 0
    j += 1
else:
    dp[1] = 1

a += [-1]
for i in range(2, N+1):
    if i == a[j]:
        dp[i] = 0
        j += 1
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod

print(dp[N] % mod)
Problem p03017 (python)

Fixed submission:
N, A, B, C, D = map(int, input().split())
S = input()

flag = True
if "##" in S[A:max(C, D)]:
    flag = False
if C > D:
    if "..." not in S[B-2:D+1]:
        flag = False

if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = input()

c1 = [0] * len(S)
c2 = [0] * len(S)
cnt1 = 0
cnt2 = 0
for i in range(len(S)):
    if '.' == S[i]:
        c2[i] = cnt2
        cnt2 = 0
        cnt1 += 1
    else:
        c1[i] = cnt1
        cnt1 = 0
        cnt2 += 1

c1[-1] = cnt1
c2[-1] = cnt2

index2 = []
index1 = []
for i in range(N):
    if c2[i] >= 2:
        index2.append(i)
    if c1[i] >= 3:
        index1.append(i)

flag = True
for i in index2:
    if A < i - c2[i] + 1 < C or B < i - c2[i] + 1 < D:
        flag = False

if C > D and flag:
    flag = False
    for i in index1:
        if B < i < D:
            if D == i - cnt1[i] + 1:
                flag = False
                break
            flag = True

if flag:
    print('Yes')
else:
    print('No')
Problem p03075 (python)

Fixed submission:
a = [int(input()) for i in range(6)]
flag = True

for i in range(6):
  for j in range(i+1, 6):
    if abs(a[i] - a[j]) > a[5]:
      flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
flag = True

for i in range(1, N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay')
else:
  print(':(')
Problem p03286 (python)

Fixed submission:
N = int(input())
str = ''

while(N != 0):
    if N % 2:
        N -= 1
        N //= -2
        str += '1'
    else:
        N //= -2
        str += '0'

if str == '':
    print(0)
else:
    print(str[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
str = ''

while(N != 0):
    if N % 2:
        N -= 1
        N //= -2
        str += '1'
    else:
        N //= -2
        str += '0'
        
if str = '':
    print(0)
else:
    print(str[::-1])
Problem p03806 (python)

Fixed submission:
N, Ma, Mb = map(int, input().split())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())

INF = 10 ** 5
nums = 401

dp = [[[INF for _ in range(nums+100)] for _ in range(nums+100)] for _ in range(N+1)]

dp[0][0][0] = 0

for i in range(N):
    for sum_a in range(nums):
        for sum_b in range(nums):
            #if dp[i][sum_a][sum_b] == INF:
            #    continue
            dp[i+1][sum_a+a[i]][sum_b+b[i]] = min(dp[i+1][sum_a+a[i]][sum_b+b[i]], dp[i][sum_a][sum_b] + c[i])
            dp[i+1][sum_a][sum_b] = min(dp[i+1][sum_a][sum_b], dp[i][sum_a][sum_b])
            #dp[i+1][sum_a+a[i]][sum_b+b[i]] = min(dp[i+1][sum_a+a[i]][sum_b+b[i]], dp[i][sum_a][sum_b] + c[i])
            #print(i, dp[i][sum_a][sum_b], sum_a, sum_b)


res = INF
for i in range(1, nums):
    for j in range(1, nums):
        if i * Mb == j * Ma:
            res = min(res, dp[N][i][j])

if res == INF:
    res = -1

print(res)

Buggy submission (verdict: Runtime Error):
N, Ma, Mb = map(int, input().split())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())

INF = 10 ** 5
nums = 7

dp = [[[INF for _ in range(nums)] for _ in range(nums)] for _ in range(N+1)]

dp[0][0][0] = 0

for i in range(N):
    for sum_a in range(nums):
        for sum_b in range(nums):
            if dp[i][sum_a][sum_b] == INF:
                continue
            dp[i+1][sum_a+a[i]][sum_b+b[i]] = min(dp[i+1][sum_a+a[i]][sum_b+b[i]], dp[i][sum_a][sum_b] + c[i])
            dp[i+1][sum_a][sum_b] = min(dp[i+1][sum_a][sum_b], dp[i][sum_a][sum_b])
            #dp[i+1][sum_a+a[i]][sum_b+b[i]] = min(dp[i+1][sum_a+a[i]][sum_b+b[i]], dp[i][sum_a][sum_b] + c[i])
            #print(i, dp[i][sum_a][sum_b], sum_a, sum_b)


res = INF
for i in range(1, nums):
    for j in range(1, nums):
        if i * Mb == j * Ma:
            res = min(res, dp[N][i][j])

if res == INF:
    res = -1

print(res)
Problem p03127 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


N = int(input())
A = [int(x) for x in input().split()]

ans = A[0]

for i in range(1, N):
    ans = gcd(ans, A[i])

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

N = int(input())
A = [int(x) for x in input().split()]

ans = A[0]

for i in range(1, N):
    ans = gcd(ans, A[i])

print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

a, b = input().split()

a = Decimal(a)
b = Decimal(b)

print(int(a*b))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal

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

a = Decimal(a)
b = Decimal(b)

print(a*b)

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

print(int(a*b/100))
Problem p02726 (python)

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

memo = [0] *(N)

for i in range(1, N):
    for j in range(i, N + 1):
        min_dis = min((j - i), abs(X - i) + 1 + abs(j - Y))
        memo[min_dis] += 1

for k in range(1,N):
    print(memo[k])

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

import numpy as np
from scipy.sparse.csgraph import shortest_path

M = np.zeros((N,N))

for i in range(1,N):
    M[i-1][i] = 1
    M[i][i-1] = 1
    M[X-1][Y-1] = 1
    M[Y-1][X-1] = 1

M_diff = shortest_path(M)

for i in range(1,N):
    ans = 0
    for k in range(0,N):
        for l in range(0,N):
            if int(M_diff[k][l]) == i:
                ans += 1
    print(int(ans/2))
Problem p03013 (python)

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

a = []
for _ in range(m):
    a.append(int(input()))
a.append(n+1)

def solve(a,n,m):
    for i in range(len(a)-1):
        if a[i+1] == a[i] + 1:
            return 0

    a_diff = [a[0]-1]
    for i in range(1, m+1):
        a_diff.append(a[i] - a[i-1] - 2)
    ans = 1
    for y in a_diff:
        if y == 0 or y == 1:
            continue
        ans *= count_way(y)
    return ans

def count_way(n):
    memo = [0]*(n+1)
    memo[0] = 1
    memo[1] = 1
    for j in range(n-1):
        memo[j+2] = memo[j+1] + memo[j]
    return memo[n]

print(solve(a,n,m)%1000000007)

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

a = []
for _ in range(m):
    a.append(int(input()))
a.append(n+1)

def solve(a,n,m):
    for i in range(len(a)-1):
        if a[i+1] == a[i] + 1:
            return 0

    a_diff = [a[0]-1]
    for i in range(1, m+1):
        a_diff.append(a[i] - a[i-1] - 2)
    ans = 1
    for y in a_diff:
        ans *= count_way(y)
    return ans

def count_way(n):
    memo = [0]*(n+1)
    memo[0] = 1
    memo[1] = 1
    for j in range(n+1):
        memo[j] = memo[j-1] + memo[j-2]
    return memo[n]

print(solve(a,n,m)%1000000007)

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

a = []
for _ in range(m):
    a.append(int(input()))
a.append(n+1)

def solve(a,n,m):
    for i in range(len(a)-1):
        if a[i+1] == a[i] + 1:
            return 0

    a_diff = [a[0]-1]
    for i in range(1, m+1):
        a_diff.append(a[i] - a[i-1] - 2)
    ans = 1
    for y in a_diff:
        ans *= count_way(y)
    return ans

def count_way(n):
    memo = [0]*(n+1)
    memo[0] = 1
    memo[1] = 1
    for j in range(n+1):
        memo[j] = memo[j-1] + memo[j-2]
    return memo[n]

print(solve(a,n,m)/1000000007)

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

a = []
for _ in range(m):
    a.append(int(input()))
a.append(n+1)

def solve(a,n,m):
    for i in range(len(a)-1):
        if a[i+1] == a[i] + 1:
            return 0

    a_diff = [a[0]-1]
    for i in range(1, m+1):
        a_diff.append(a[i] - a[i-1] - 2)
    ans = 1
    for y in a_diff:
        ans *= count_way(y)
    return ans

def count_way(n):
    memo = [0]*(n+1)
    memo[0] = 1
    memo[1] = 1
    for j in range(n+1):
        memo[j] = memo[j-1] + memo[j-2]
    return memo[n]

print(solve(a,n,m))
Problem p02598 (python)

Fixed submission:
import math

def cut(l,A,K):
    counter = 0
    i = N - 1
    if l == 0:
        return False
    while i >= 0:
        c = math.ceil(A[i] / l) - 1
        if c == 0:
            break
        else:
            counter += c
            i -= 1
    if counter <= K:
        return True
    else:
        return False
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    A = [float(a) for a in input().split()]
    A.sort()
    left = 0
    right = math.ceil(A[-1])
    while left <= right:
        middle = (left + right) // 2
        if cut(middle,A,K):
            if not cut(middle-1,A,K):
                break
            else:
                right = middle - 1
        else:
            left = middle + 1
    print(middle)

Buggy submission (verdict: Runtime Error):
import math

def cut(l,A,K):
    counter = 0
    i = N - 1
    while i >= 0:
        c = A[i] // l
        if c == 0:
            break
        else:
            counter += c
            i -= 1
    if counter <= K:
        return True
    else:
        return False
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    A = [float(a) for a in input().split()]
    A.sort()
    left = 2
    right = math.ceil(A[-1])
    while left <= right:
        middle = (left + right) // 2
        if not cut(middle,A,K):
            left = middle + 1
        else:
            if not cut(middle-1,A,K):
                break
            else:
                right = middle - 1
    print(middle)

Buggy submission (verdict: Runtime Error):
import math

def cut(l,A,K):
    counter = 0
    i = N - 1
    while i >= 0:
        c = A[i] // l
        if c == 0:
            break
        else:
            counter += c
            i -= 1
    if counter <= K:
        return True
    else:
        return False
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    A = [float(a) for a in input().split()]
    A.sort()
    left = 2
    right = math.ceil(A[-1])
    while left <= right:
        middle = (left + right) // 2
        print(left,right,middle)
        if not cut(middle,A,K):
            left = middle + 1
        else:
            if not cut(middle-1,A,K):
                break
            else:
                right = middle - 1
    print(middle)
Problem p02693 (python)

Fixed submission:
K = int(input())
A,B = map(int,input().split())
k = (B // K) * K
if A <= k and k <= B:
    print('OK')
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
for i in range(M):
    print(str(i+1) + ' ' + str(N-i-1))
Problem p02701 (python)

Fixed submission:
import collections

N = int(input())
l = [input() for i in range(N)]
print(len(collections.Counter(l)))

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
for i in range(N):
    x = input()
    if len(l) == 0:
        l.append(x)
    else:
        good = True
        for j in range(len(l)):
            if x == l[j]:
                good = False
                break
        if good:
            l.append(x)
print(c)
Problem p03038 (python)

Fixed submission:
n,m = map(int, input().split())
a_list = [int(a) for a in input().split()]
a_list.sort()
bc_list = [0 for _ in range(m)]
for i in range(m):
    b,c = map(int, input().split())
    bc_list[i] = [b,c]
bc_list.sort(key= lambda x:x[1],reverse=True)
cur = 0
for i in range(m):
    b,c = bc_list[i][0],bc_list[i][1]
    for j in range(b):
        if cur >= n:
            break
        if a_list[cur]>=c:
            break
        else:
            a_list[cur] = c
            cur += 1
    else:
        continue
    break
print(sum(a_list))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a_list = [int(a) for a in input().split()]
a_list.sort()
bc_list = [0 for _ in range(m)]
for i in range(m):
    b,c = map(int, input().split())
    bc_list[i] = [b,c]
bc_list.sort(key= lambda x:x[1],reverse=True)
cur = 0
for i in range(m):
    b,c = bc_list[i][0],bc_list[i][1]
    for j in range(b):
        if a_list[cur]>=c or cur>=n:
            break
        else:
            a_list[cur] = c
            cur += 1
    else:
        continue
    break
print(sum(a_list))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a_list = [int(a) for a in input().split()]
a_list.sort()
bc_list = [0 for _ in range(m)]
for i in range(m):
    b,c = map(int, input().split())
    bc_list[i] = [b,c]
bc_list.sort(key= lambda x:x[1],reverse=True)
cur = 0
for i in range(m):
    b,c = bc_list[i][0],bc_list[i][1]
    for j in range(b):
        if a_list[cur]>=c:
            break
        else:
            a_list[cur] = c
            cur += 1
    else:
        continue
    break
print(sum(a_list))
Problem p03075 (python)

Fixed submission:
a = int(input())
_ = int(input())
_ = int(input())
_ = int(input())
b = int(input())
k = int(input())
if b-a<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)
total_list = [0 for _ in range(min(106307,X*Y*Z))]
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) <= K:
                total_list[i*(Z*Y)+j*Z+k] = (a_list[i] + b_list[j] + c_list[k])
            else:
                break
total_list =  sorted(total_list, reverse = True)
for i in range(K):
    print(total_list[i])
Problem p03077 (python)

Fixed submission:
N,A,B,C,D,E = [int(input()) for _ in range(6)]
times = [A,B,C,D,E]
for i in range(4):
    if times[i] < times[i+1]:
        times[i+1] = times[i]
A,B,C,D,E = times
l = -(-N//A)
m = -(-(N - (l-1)*B)//B)
n = -(-(N - (l+m-2)*C)//C)
p = -(-(N - (l+m+n-3)*D)//D)
q = -(-(N - (l+m+n+p-4)*E)//E)
print(l+m+n+p+q)

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)
total_list = [0 for _ in range(min(106307,X*Y*Z))]
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) <= K:
                total_list[i*(Z*Y)+j*Z+k] = (a_list[i] + b_list[j] + c_list[k])
            else:
                break
total_list =  sorted(total_list, reverse = True)
for i in range(K):
    print(total_list[i])

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
a_b_total = [0 for _ in range(X*Y)]
for i in range(X):
    for j in range(Y):
        a_b_total[i*Y+j] = a_list[i] + b_list[j]
a_b_total.sort(reverse = True)
a_b_c_total = [0 for _ in range(min(K,X*Y)*Z)]
for i in range(min(K,X*Y)):
    for j in range(Z):
        a_b_c_total[i*Z+j] = a_b_total[i] + c_list[j]
a_b_c_total.sort(reverse = True)
for i in range(K):
    print(a_b_c_total[i])
Problem p03107 (python)

Fixed submission:
S = input()
print(2*min(S.count("1"),S.count("0")))

Buggy submission (verdict: Runtime Error):
s = input()
a = 0
for i in s:
  a += i
print(2 * min(a, len(s)-a))
Problem p03250 (python)

Fixed submission:
n = [int(i) for i in input().split()]
n.sort()
print(n[2]*10 + n[1] + n[0])

Buggy submission (verdict: Runtime Error):
n = map(int, input().split())
n.sort()
print(n[2]*10 + n[1] + n[0])
Problem p03317 (python)

Fixed submission:
N,K = map(int, input().split())
input()
judge = (N-1)%(K-1) == 0
if judge:
    print(int((N-1)/(K-1)))
else:
    print(int((N-1)//(K-1)+1))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
input()
judge = (N-1)%(K-1) == 0
if judge:
    print(int((N-1)/(K-1))
else:
    print(int((N-1)//(K-1)+1)
Problem p02595 (python)

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

X = [0] * N
Y = [0] * N

for i in range(N):
    X[i], Y[i] = map(int, input().split())

count = 0

for i in range(N):
    if(D**2 >= X[i]**2 + Y[i]**2):
        count += 1

print(count)

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

X = [0] * N
Y = [0] * N

for i in range(N):
    X[i], Y[i] = map(int, input.split())

count = 0

for i in range(N):
    if(D**2 >= X[i]**2 + Y[i]**2):
        count += 1

print(count)
Problem p02594 (python)

Fixed submission:
n=int(input())
if n>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,d=[int(i) for i in input().strip().split(" ")]
ans=0
for _ in range(n):
  x,y=[int(i) for i in input().strip().split(" ")]
  if x*x+y*y==d*d:
    ans+=1
print(ans)
Problem p02595 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 24 12:23:05 2020

@author: vivek
"""

n,d=[int(i) for i in input().strip().split(" ")]
ans=0
for _ in range(n):
  x,y=[int(i) for i in input().strip().split(" ")]
  if x*x+y*y<=d*d:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,d=[int(i) for i in input().strip().split(" ")]
ans=0
for _ in range(n):
  x,y=[int(i) for i in input().strip().split(" ")]
  if x*x+y*y=d*d:
    ans+=1
print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n, k = map(int, input().split())

for i in range(1,k+1):
    if i <= n-k+1:
        print((combinations_count(n-k+1,i)%(10**9+7)) * combinations_count(k-1,i-1) %(10**9+7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n, k = map(int, input().split())

for i in range(1,k+1):
    print((combinations_count(n-k+1,i) * combinations_count(k-1,i-1))%(10**9+7))
Problem p03127 (python)

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

def gcd(a, b):
    while b:
	    a, b = b, a % b
    return a

for i in range(1,n):
    monster[i] = gcd(monster[0], monster[i])

print(min(monster))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
monster = sorted(list(map(int, input().split())))

for i in range(1,n):
    monster[i] = math.gcd(monster[0], monster[i])

print(min(monster))
Problem p02596 (python)

Fixed submission:
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 7
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 7
      ans %= k

  print(cnt)

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 7 == 0:
  k /= k7

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 1
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 1
      ans %= k

  print(cnt)

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 7 == 0:
  k = k/7

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 1
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 1

  print(cnt)
Problem p02753 (python)

Fixed submission:
s = input()
if s[0] == s[1] and s[0] == s[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s = inputu()
if s[0] == s[1] and s[0] = s[2] and s[1] == s[2]:
  print("No")
else:
  print("Yes")
Problem p02831 (python)

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

c = a
d = b
r = c // d
m = c % d

while True:
    if m == 0:
        break
    else:
        c = d
        d = m
        m = c % d

print(int(a * b / d))

Buggy submission (verdict: Runtime Error):

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

print(int(a * b / math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b / math.gcd(a, b))
Problem p02881 (python)

Fixed submission:
import numpy as np

A = int(input())

tmp = int(np.floor(np.sqrt(A)))
for i in range(tmp):
    if A % (tmp - i) == 0:
        base1 = tmp - i
        break
base2 = A // base1

print(base1 + base2 - 2)

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

A = int(input())

candidates = np.arange(A // 2) + 1
candidates = candidates[A % candidates == 0]

distances = (A // candidates) - 1 + candidates - 1

print(np.min(distances))