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

Fixed submission:
n, m, k = [int(e) for e in input().split()]
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

i = 0
j = 0

total_max = 0

while i < n:
    if a[i] > k:
        break
    k -= a[i]
    i += 1
    
while j < m:
    if b[j] > k:
        break
    k -= b[j]
    j += 1

total_max = i + j
    
while i > 0 and j < m:
    k += a[i - 1]
    i -= 1
    while j < m:
        if b[j] > k:
            break
        k -= b[j]
        j += 1
    if total_max < i + j:
        total_max = i + j
    
print(total_max)

Buggy submission (verdict: Runtime Error):
from collections import deque

n, m, k = [int(e) for e in input().split()]
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

lena = len(a)
lenb = len(b)
s = deque()
t = deque()

while True:
    lens = len(s)
    if lens >= lena:
        break
    e = a[lens]
    if e > k:
        break
    s.append(e)
    k -= e

while True:
    lent = len(t)
    if lent >= lenb:
        break
    e = b[lent]
    if e > k:
        break
    t.append(e)
    k -= e

while True:
    lent = len(t)
    if lent >= lenb:
        break
    lens = len(s)
    if b[lent] >= s[lens - 1]:
        break
    k += s.pop()
    while True:
        lent = len(t)
        if lent >= lenb:
            break
        e = b[lent]
        if e > k:
              break
        t.append(e)
        k -= e
    

print(len(s) + len(t))
Problem p02688 (python)

Fixed submission:
n,k = map(int,input().split())
mp = [0]*(n+1)
for i in range(k):
  d = int(input())
  a = list(map(int,input().split()))
  for j in a:
    mp[j]+=1
res = 0
for i in range(1,n+1):
  if mp[i]==0:
    res+=1
print(res)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
mp = [0]*(k+1)
for i in range(k):
  a = list(map(int,input().split()))
  for j in a:
    mp[j]+=1
res = 0
for i in range(1,k+1):
  if mp[i]==0:
    res+=1
print(res)
Problem p02597 (python)

Fixed submission:
n=int(input())
c=list(input())
numW=0
numR=c.count("R")
W=n-numR
a=[]
if numR==0 or W==0:
    print(0)
else:
    for i in range(n):
        if c[i]=="W":
            numW+=1
        else:
            numR-=1
        a.append(max(numR,numW))
    print(min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(input())
numW=0
numR=c.count("R")
W=n-numR
a=[]
if numR==0 or W==0:
    print(0)
else:
    for i in range(n):
        if c[i]=="W":
            numW+=1
        else:
            numR-=1
        a.append(max(numR,numW))
print(min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(input())
numW=0
numR=c.count("R")
a=[]
if numR==0:
    print(0)
else:
    for i in range(n):
        if c[i]=="W":
            numW+=1
        else:
            numR-=1
        a.append(max(numR,numW))
print(min(a))
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x,y=[0],[0]
for i in range(n):
    x.append(a[i]+x[i])
for j in range(m):
    y.append(b[j]+y[j])

ans=0
j=m
for i in range(n+1):
    if x[i]>k:
        break
    while y[j]>k-x[i]:
        j-=1
    ans=max(i+j,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x,y=[0],[0]
for i in range(n):
    x.append(a[i]+x[i])
for j in range(m):
    y.append(b[j]+y[j])

ans=0
j=m
for i in range(N+1):
    if x[i]>k:
        break
    while y[j]>k-x[i]:
        j-=1
    ans=max
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=[0]*n
y=[0]*m
x[0]=a[0]
y[0]=b[0]
for i in range(0,n-1):
    x[i+1]=x[i]+a[i+1]
for i in range(0,m-1):
    y[i+1]=y[i]+b[i+1]
ans,j=0,m-1
for i in range(n):
    if x[i]>k:
        break
    while y[j]>k-x[i]:
        j-=1
    ans=max(i+2+j,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=[0]*n
y=[0]*m
x[0]=a[0]
y[0]=b[0]
for i in range(0,n-1):
    x[i+1]=x[i]+a[i+1]
for i in range(0,m-1):
    y[i+1]=y[i]+b[i+1]
ans,j=0,m
for i in range(n):
    if x[i]>k:
        break
    while y[j-1]>k-x[i]:
        j-=1
    ans=max(i+1+j,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=[0]*n
y=[0]*m
x[0]=a[0]
y[0]=b[0]
for i in range(0,n-1):
    x[i+1]=x[i]+a[i+1]
for i in range(0,m-1):
    y[i+1]=y[i]+b[i+1]
print(x)
print(y)
ans,j=0,m
for i in range(n):
    if x[i]>k:
        break
    while y[j-1]>k-x[i]:
        j-=1
    ans=max(i+1+j,ans)
print(ans)
Problem p02688 (python)

Fixed submission:
N,K=list(map(int,input().split()))
h=[]
for k in range(K):
    d_i=int(input())
    a=list(map(int,input().split()))
    for i in range(d_i):
        h.append(a[i])
h2=set(h)
ans=N-len(h2)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
h=[range(1,n+1)]
a=[]
for i in range(k):
    d=int(input())
    b=list(map(int,input().split()))
    a.append(*b)
c=set(a)
ans=n-len(c)
print(ans)
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
l=[1,2,3]
l.remove(a)
l.remove(b)
ans=l[0]
print(ans)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
l=[1,2,3]
l.remove(a)
l.remove(b)
ans=l[0]
print(ans)
Problem p03775 (python)

Fixed submission:
N=int(input())
ans=len(str(N))
for a in range(2,int(N**0.5)+1):
    if N%a==0:
        b=N//a
        ans=min(ans,len(str(b)))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=len(str(N))
for a in range(2,math.sqrt(N)+1):
    if N%a==0:
        b=N//a
        ans=min(ans,len(str(b)))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=len(str(N))
for a in range(2,math.sqrt(N**0.5)+1):
    if N%a==0:
        b=N//a
        ans=min(ans,len(str(b)))
print(ans)
Problem p02862 (python)

Fixed submission:
x, y = [int(_) for _ in input().split(' ')]

M = int(1e9+7)

def modpow(a, n):
    if n == 0:
        return 1
    elif n == 1:
        return a
    elif n % 2 == 0:
        tmp = modpow(a, n // 2)
        return (tmp * tmp) % M
    else:
        tmp = modpow(a, n // 2)
        return (tmp * tmp * a) % M

def modinv(a):
    return modpow(a, M - 2)

if (x + y) % 3 == 0:
    a, b = (-x + 2 * y) // 3, (2 * x - y) // 3

    if a >= 0 and b >= 0:
        f = [1] * (a + b + 1)
        for i in range(1, a + b + 1):
            f[i] = f[i - 1] * i % M

        answer = (f[a + b] * modinv(f[a]) * modinv(f[b])) % M
        print(answer)
    else:
        print(0)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x, y = [int(_) for _ in input().split(' ')]

M = int(1e9+7)

def modpow(a, n):
    if n == 0:
        return 1
    elif n == 1:
        return a
    elif n % 2 == 0:
        tmp = modpow(a, n // 2)
        return (tmp * tmp) % M
    else:
        tmp = modpow(a, n // 2)
        return (tmp * tmp * a) % M

def modinv(a):
    return modpow(a, M - 2)


if (x + y) % 3 == 0:
    a, b = (-x + 2 * y) // 3, (2 * x - y) // 3

    f = [1] * (a + b + 1)
    for i in range(1, a + b + 1):
        f[i] = f[i - 1] * i % M

    answer = (f[a + b] * modinv(f[a]) * modinv(f[b])) % M
    print(answer)
else:
    print(0)
Problem p02550 (python)

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

nxt = X
lst = []
dic = {}

for i in range(M + 1):
    if nxt in dic:
        loop_st = dic[nxt]
        loop_ed = i - 1
        break

    lst.append(nxt)
    dic[nxt] = i

    nxt = (nxt ** 2) % M


v = N - loop_st
q, r = divmod(v, loop_ed - loop_st + 1)

pre_sum = sum(lst[:loop_st])
loop_sum = q * sum(lst[loop_st:])
post_sum = sum(lst[loop_st:loop_st + r])
print(pre_sum + loop_sum + post_sum)

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

nxt = X
lst = []
dic = {}

for i in range(M):
    if nxt in dic:
        loop_st = dic[nxt]
        loop_ed = i - 1
        break

    lst.append(nxt)
    dic[nxt] = i

    nxt = (nxt ** 2) % M


v = N - loop_st
q, r = divmod(v, loop_ed - loop_st + 1)

pre_sum = sum(lst[:loop_st])
loop_sum = q * sum(lst[loop_st:])
post_sum = sum(lst[loop_st:loop_st + r])
print(pre_sum + loop_sum + post_sum)

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

nxt = X
lst = []
dic = {}

for i in range(M):
    if nxt in dic:
        loop_st = dic[nxt]
        loop_ed = i - 1
        break

    lst.append(nxt)
    dic[nxt] = i

    nxt = (nxt ** 2) % M


v = N - loop_st
q, r = divmod(v, loop_ed - loop_st + 1)

pre_sum = sum(lst[:loop_st])
loop_sum = q * sum(lst[loop_st:])
post_sum = sum(lst[loop_st:loop_st + r])
Problem p02623 (python)

Fixed submission:
import bisect

N, M, K = map(int, input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = A.copy()
B_sum = B.copy()

for i in range(1, N):
    A_sum[i] = A_sum[i - 1] + A[i]

A_sum = [0] + A_sum

for i in range(1, M):
    B_sum[i] = B_sum[i - 1] + B[i]


max_ = 0
for i, n in enumerate(A_sum):
    if n > K:
        continue

    target = K - n
    v = bisect.bisect_left(B_sum, target)

    if v != M and B_sum[v] == target:
        v += 1

    max_ = max(max_, i + v)

print(max_)

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

A = list(map(int, input().split()))
B = list(map(int, input().split()))


class X:
    def __init__(self, K, A, B, N, M):
        self.A = A
        self.B = B
        self.K = K
        self.N = N
        self.M = M
        self.ret = 0

    def helper(self, i, j, time, num_a, num_b):
        if time > self.K:
            return

        self.ret = max(self.ret, num_a + num_b)

        if num_a < self.N:
            self.helper(i + 1, j, time + self.A[i], num_a + 1, num_b)

        if num_b < self.M:
            self.helper(i, j + 1, time + self.B[j], num_a, num_b + 1)

        return

    def run(self):
        self.helper(0, 0, 0, 0, 0)

        return self.ret


c = X(K, A, B, N, M)
print(c.run())
Problem p02659 (python)

Fixed submission:
A, B = input().split()

A = int(A)

B = float(B)
B *= 100
B = round(B)

print(int(A * B // 100))

Buggy submission (verdict: Runtime Error):
A, B = input().split()

A = int(A)

B = float(B)
B *= 100
B = round(B)

print(int(A * B // 100))


print(int(res))
Problem p02726 (python)

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


dic = {}

X = X - 1
Y = Y - 1

for i in range(N):
    for j in range(i + 1, N):
        if i <= X and Y <= j:
            v = X - i + 1 + j - Y
        elif (i <= X) and (X <= j and j <= Y):
            v = min(j - i, X - i + 1 + Y - j)
        elif (X <= i and i <= Y) and Y <= j:
            v = min(j - i, i - X + 1 + j - Y)
        elif (X <= i and i <= Y) and (X <= j and j <= Y):
            v = min(j - i, i - X + 1 + Y - j)
        else:
            v = j - i

        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1


for i in range(1, N):
    if i in dic:
        print(dic[i])
    else:
        print(0)

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


dic = {}

X = X - 1
Y = Y - 1

for i in range(N):
    for j in range(i + 1, N):
        if i <= X and Y <= j:
            v = X - i + 1 + j - Y
        elif (i <= X) and (X <= j and j <= Y):
            v = min(j - i, X - i + 1 + Y - j)
        elif (X <= i and i <= Y) and Y <= j:
            v = min(j - i, i - X + 1 + j - Y)
        elif (X <= i and i <= Y) and (X <= j and j <= Y):
            v = min(j - i, i - X + 1 + Y - j)
        else:
            v = j - i

        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1


for i in range(1, N):
    print(dic[i])

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

dic = defaultdict(int)

X = X - 1
Y = Y - 1

for i in range(N):
    for j in range(i + 1, N):
        if i <= X and Y <= j:
            v = X - i + 1 + j - Y
        elif (i <= X) and (X <= j and j <= Y):
            v = min(j - i, X - i + 1 + Y - j)
        elif (X <= i and i <= Y) and Y <= j:
            v = min(j - i, i - X + 1 + j - Y)
        elif (X <= i and i <= Y) and (X <= j and j <= Y):
            v = min(j - i, i - X + 1 + Y - j)
        else:
            v = j - i

        dic[v] += 1


for i in range(1, N):
    print(dic[i])
Problem p02763 (python)

Fixed submission:
import bisect
from collections import defaultdict

N = int(input())
S = list(input())
Q = int(input())

alpha_dic = defaultdict(list)

for i, s in enumerate(S):
    alpha_dic[s].append(i)

for _ in range(Q):
    l, m, n = input().split()

    if l == '1':
        m = int(m) - 1
        c = S[m]

        if c == n:
            continue
        else:
            i = bisect.bisect_left(alpha_dic[c], m)
            del alpha_dic[c][i]

            bisect.insort_left(alpha_dic[n], m)
            S[m] = n
    else:
        m, n = int(m) - 1, int(n) - 1

        cnt = 0
        for _, val in alpha_dic.items():
            if not val:
                continue

            left_idx = bisect.bisect_left(val, m)
            right_idx = bisect.bisect_left(val, n)
            l = len(val)

            if left_idx > right_idx or (left_idx == right_idx and left_idx == l) or (left_idx == right_idx and val[left_idx] != m and val[right_idx] != n):
                continue

            cnt += 1

        print(cnt)

Buggy submission (verdict: Runtime Error):
import bisect
from collections import defaultdict

N = int(input())
S = input()
Q = int(input())


alpha_dic = defaultdict(list)

for i, s in enumerate(S):
    alpha_dic[s].append(i)

for _ in range(Q):
    l, m, n = input().split()

    if l == '1':
        m = int(m) - 1
        c = S[m]

        if c == n:
            continue
        else:
            i = bisect.bisect_left(alpha_dic[c], m)
            del alpha_dic[c][i]

            bisect.insort_left(alpha_dic[n], m)
    else:
        m, n = int(m) - 1, int(n) - 1

        cnt = 0
        for _, val in alpha_dic.items():
            left_idx = bisect.bisect_left(val, m)
            right_idx = bisect.bisect_left(val, n)
            x = len(val)

            if left_idx > right_idx or left_idx == x or (left_idx == 0 and right_idx == 0 and val[0] != m and val[0] != n):
                continue
            else:
                cnt += 1

        print(cnt)
Problem p02781 (python)

Fixed submission:
S = input()
K = int(input())

l = len(S)

MOD = 1000000007

# [桁数][未満][0でない数の合計数]
dp = [[[0] * (l + 1) for _ in range(2)] for _ in range(l + 1)]


# 初期化
dp[0][False][0] = 1

for i in range(l):
    cur = int(S[i])

    for j in range(i + 1):
        # true -> true
        for k in range(10):
            if k == 0:
                dp[i + 1][True][j] += dp[i][True][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][True][j]

        # false -> true
        for k in range(cur):
            if k == 0:
                dp[i + 1][True][j] += dp[i][False][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][False][j]

        # false -> false
        if cur == 0:
            dp[i + 1][False][j] += dp[i][False][j]
        else:
            dp[i + 1][False][j + 1] += dp[i][False][j]

if K > l:
    print(0)
else:
    print(dp[l][True][K] + dp[l][False][K])

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

l = len(S)

MOD = 1000000007

dp = [[[0] * (l + 1) for _ in range(2)] for _ in range(l + 1)]

dp[0][False][0] = 1

for i in range(l):
    cur = int(S[i])

    for j in range(i + 1):
        for k in range(10):
            if k == 0:
                dp[i + 1][True][j] += dp[i][True][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][True][j]
                
        for k in range(cur):
            if k == 0:
                dp[i + 1][True][j] += dp[i][False][j]
            else:
                dp[i + 1][True][j + 1] += dp[i][False][j]

        if cur == 0:
            dp[i + 1][False][j] += dp[i][False][j]
        else:
            dp[i + 1][False][j + 1] += dp[i][False][j]


print(dp[l][True][K] + dp[l][False][K])
Problem p02792 (python)

Fixed submission:
from collections import defaultdict

d = defaultdict(int)
N = int(input())

for n in range(1, N + 1):
    n = str(n)

    a = n[0]
    b = n[-1]

    d[(a, b)] += 1


s = 0
for i in range(10):
    for j in range(10):

        s += d[(str(j), str(i))] * d[(str(i), str(j))]

print(s)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

d = defaultdict(int)

for n in range(N):
    n = str(n)

    a = n[0]
    b = n[-1]

    d[(a, b)] += 1


s = 0
for i in range(1, 10):
    for j in range(10):

        s += d[(str(j), str(i))] * d[(str(i), str(j))]

print(s)
Problem p02831 (python)

Fixed submission:
import fractions

A, B = map(int, input().split())


def get_lcm(a, b):
    return (a * b) // fractions.gcd(a, b)


print(get_lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())


def get_lcm(a, b):
    return (a * b) // math.gcd(a, b)


print(get_lcm(A, B))
Problem p02851 (python)

Fixed submission:
from collections import defaultdict
import bisect

N, K = map(int, input().split())
A = list(map(int, input().split()))

s = 0
S = [0]
for i, a in enumerate(A):
    s += a
    S.append(s % K)

cnt = 0
dic = {}

for i, s in enumerate(S):
    x = (s - i) % K

    if x in dic:
        cnt += dic[x]
        dic[x] += 1
    else:
        dic[x] = 1

    K_prev = i - K + 1

    if K_prev >= 0:
        y = (S[K_prev] - (K_prev)) % K
        dic[y] -= 1


print(cnt)

Buggy submission (verdict: Runtime Error):
s = 0
S = [0]
for i, a in enumerate(A):
    s += a
    S.append(s % K)

cnt = 0
dic = {}

for i, s in enumerate(S):
    x = (s - i) % K

    if x in dic:
        cnt += dic[x]
        dic[x] += 1
    else:
        dic[x] = 1

    K_prev = i - K + 1

    if K_prev >= 0:
        y = (S[K_prev] - (K_prev)) % K
        dic[y] -= 1


print(cnt)
Problem p02862 (python)

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

MOD = 1000000007


def combination(n, r):
    r = min(r, n - r)

    num = 1
    den = 1

    for i in range(1, r + 1):
        num = num * (n + 1 - i) % MOD
        den = den * i % MOD

    return num * pow(den, MOD - 2, MOD) % MOD


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

m = (2 * Y - X) / 3
n = (2 * X - Y) / 3
m = int(m)
n = int(n)

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

print(int(combination(m + n, n)) % MOD)

Buggy submission (verdict: Runtime Error):
import math

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

m = (2 * Y - X) / 3
n = (2 * X - Y) / 3
m = int(m)
n = int(n)

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

num = 1

for x in range(m + n, n, -1):
    num *= x

den = 1
for x in range(1, m + 1):
    den *= x

print(int(num / den) % MOD)

Buggy submission (verdict: Runtime Error):
from collections import deque, defaultdict
# import sys
# sys.setrecursionlimit(1000000)
X, Y = map(int, input().split())

MOD = 1000000007

dp = defaultdict(int)
def search(r, c):
    if (r > X) or (c > Y):
        return 0

    # if dp[r][c] is not None:
    #     return dp[r][c]
    if (r, c) in dp:
        return dp[(r, c)]

    if (r == X) and (c == Y):
        return 1

    ret = search(r + 1, c + 2) + search(r + 2, c + 1)

    # dp[r][c] = ret
    dp[(r, c)] = ret
    return ret
  
print(search(0, 0) % MOD)
Problem p02897 (python)

Fixed submission:
N = int(input())

x = N % 2

if x == 0:
    print(1/2)
else:
    y = N // 2 + 1
    print(y / N)

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

import math


def dv(x1, x2):
    ret = []
    v = int(math.sqrt(min(x1, x2))) + 1

    check = [0] * (v + 1)

    for n in range(2, v):
        if check[n] == 1:
            continue

        if x1 % n == 0 and x2 % n == 0:
            ret.append(n)

            cnt = 1
            while n * cnt <= v:
                check[n * cnt] = 1
                cnt += 1

    return ret


cf = [1] + dv(A, B)
print(len(cf))
Problem p02984 (python)

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

ret_lst = []

S = sum(a)

a_even = a[1::2]

m1 = S - 2 * sum(a_even)
ret_lst.append(m1)

for i in range(1, n):
    next_m = 2 * a[i - 1] - ret_lst[-1]

    ret_lst.append(next_m)

N = [str(n) for n in ret_lst]

print(' '.join(N))

Buggy submission (verdict: Runtime Error):
from numpy.linalg import inv
from numpy import zeros, dot

n = int(input())

x = input().split(' ')

a = [int(v) for v in x]

Z = zeros((n, n))

for i in range(n):
    Z[i, i:i + 1] = 0.5

Z[0, 1] = 0
Z[0, n - 1] = 0.5

N = dot(inv(Z), a).astype('int')

N = [str(p) for p in N]

print(' '.join(N))
Problem p02990 (python)

Fixed submission:
from math import factorial

N, K = list(map(int, input().split()))

x = 1000000007

num = factorial(N - K + 1) * factorial(K - 1)

for i in range(1, K + 1):
    if N - K < i - 1:
        print(0)
    else:
        denom = factorial(i) * factorial(N - K + 1 - i) * factorial(i - 1) * factorial(K - i)
        v = num // denom

        print(v % x)

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

N, K = list(map(int, input().split()))

x = 1000000007

num = factorial(N - K + 1) * factorial(K - 1)

for i in range(1, K + 1):
    if N - K < i - 1:
        print(0)

    denom = factorial(i) * factorial(N - K + 1 - i) * factorial(i - 1) * factorial(K - i)
    v = num // denom

    print(v % x)

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

N, K = list(map(int, input().split()))

x = 1000000007

num = factorial(N - K + 1) * factorial(K - 1)

for i in range(1, K + 1):
    denom = factorial(i) * factorial(N - K + 1 - i) * factorial(i - 1) * factorial(K - i)
    v = num // denom

    print(v % x)

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

N, K = list(map(int, input().split()))

x = 1000000007

num = factorial(N - K + 1) * factorial(K - 1)

for i in range(1, K + 1):
    denom = factorial(i) * factorial(N - K + 1 - i) * factorial(i - 1) * factorial(K - i)
    v = num // denom

    print(int(v % x))

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

N, K = list(map(int, input().split()))

x = 1000000007


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


for i in range(1, K + 1):
    v = com(N - K + 1, i) * com(K - 1, i - 1)
    print(int(v % x))

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

N, K = list(map(int, input().split()))

x = 1000000007


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


for i in range(1, K + 1):
    v = com(N - K + 1, i) * com(K-1, i -1)
    print(int(v % x))
Problem p02596 (python)

Fixed submission:
k=int(input())

if k%2==0 or k%5==0:
    print('-1')

else:
    num=7%k
    ans=1

    while num != 0:

        num=(num*10+7)%k
        ans+=1

    print(ans)

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

if k%2==0 or k%5==0:
    print('-1')

else:
    num=7%k
    ans=1

    while num != 0:

        num=(num*10+7)%k
        ans+=1

print(ans)
Problem p02627 (python)

Fixed submission:
a=str(input())
if a.isupper():
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
N=int(sys.stdin.readline())
A=list(map(int,sys.stdin.readline().split()))
Q=int(sys.stdin.readline())
AA=set(A)
A=np.array(A)
b=[]
c=[]
for _ in range(Q):
  B,C=map(int,sys.stdin.readline().split())
  if B in AA:
    A[A==B]=C
    AA.add(C)
  print(sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
A=np.array(A)
for _ in range(Q):
  B,C=map(int,input().split())
  A[A==B]=C
  print(sum(A))
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B=map(int,input().split())
a=0
for i in range(A,B+1):
    if i%K==0:
        a=1
        print("OK")
        break
if a!=1:
    print("NG")

Buggy submission (verdict: Runtime Error):
A,B,N=map(int,input().split())
if N>=B:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*N/B)-A*int(N/B))