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

Fixed submission:
N = int(input())
lA = list(str(N))
flag = 0
for i in range(3):
    if lA[i] == '7':
        flag += 1
if flag != 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
lA = list(str(N))
flag = 0
for _ in range(3):
  lA[i] == '7':
    flag += 1
if flag != 0:
  print('Yes')
else:
  print('No')
Problem p02712 (python)

Fixed submission:
N = int(input())
ln = [i for i in range(1,N+1)]

for i in range(N):
  if ln[i] % 3 == 0:
    ln[i] = 0
  elif ln[i] % 5 == 0:
    ln[i] = 0
  elif ln[i] % 15 == 0:
    ln[i] = 0
print(sum(ln))

Buggy submission (verdict: Runtime Error):
N = int(input())
ln = [i for i in range(1,N+1)]
for i in range(N):
  if ln[i] % 3 == 0:
    nl.pop(i)
  elif ln[i] % 5 == 0:
    nl.pop(i)
  elif ln[i] % 15 == 0:
    nl.pop(i)
print(sum(nl))
Problem p02725 (python)

Fixed submission:
K, N = list(map(int,input().split()))
A = list(map(int,input().split()))
d = [A[i+1]-A[i] for i in range(N-1)]
de = K - A[N-1] + A[0]
d.append(de)
D = sorted(d)
dis = 0
for i in range(N-1):
  dis += D[i]
print(dis)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
d = [A[i+1]-A[i] for i in range(N-1)]
de = K - A[N-1] + A[0]
dis = 0
for i in range(N-2):
  dis += d[i]
if d[N-2] <= de:
  dis += d[N-2]
else:
  dis += de
print(dis)
Problem p02729 (python)

Fixed submission:
N, M = map(int,input().split())
a = N * (N - 1) / 2 + M * (M - 1) / 2
print(int(a))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, readlines().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)
Problem p02753 (python)

Fixed submission:
s = input()
if s.count('B') == 3 or s.count('A') == 3:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if S = 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S = input()
if S = 'AAA' or 'BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
  if S=='AAA':
    print('No')
  elif S=='BBB':
    print('No')
  else:
    print('Yes')
Problem p02754 (python)

Fixed submission:
N, A, B = list(map(int,input().split()))
if A == 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print((N//(A+B))*A + min(A,N % (A+B)))

Buggy submission (verdict: Runtime Error):
N, A, B = list(map(int,input().split()))
if A = 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print(N - B)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().split())
if a > n:
  print(n)
else:
  if a + b > n:
    print(a)
  else:
    print(a + (n % a))

Buggy submission (verdict: Runtime Error):
n, a, b = list(map(int, input().split()))
if int(a) > int(n):
  print(int(n))
else:
  if int(a) + int(b) > int(n):
    print(int(a))
  else:
    print(int(a) + (int(n) % int(a)))
Problem p02777 (python)

Fixed submission:
S, T = input().split(" ")
A, B = [int(i) for i in input().split(" ")]
U = input()
 
if S==U :
  print("{} {}".format(A-1,B))
else:
  print("{} {}".format(A,B-1))

Buggy submission (verdict: Runtime Error):
S, T = input().split()
a, b = int(input.split())
U = input()
if str(S) == str(U):
  print(a-1)
else:
  print(b-1)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
a, b = int(input.split())
U = input()
if list(S) == list(U):
  print(a-1)
else:
  print(b-1)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
a, b = int(input.split())
U = input()
if S == U:
  print(a-1)
else:
  print(b-1)
Problem p02779 (python)

Fixed submission:
n=int(input())
if len(set(map(int,input().split())))==n:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = kist(map(int,input().split()))
a.sorted
i for i in range(n):
  if a[i-1] == a[i] or a[i] == a[i+1]:
print('No')
  else:
print('Yes')
Problem p02785 (python)

Fixed submission:
N, K = list(map(int,input().split()))
k = K - 1
H = list(map(int,input().split()))
Hs = sorted(H,reverse = True)
if K <= N:
  for i in range(0,K):
    Hs[i] = 0
  print(sum(Hs))
if K > N:
  print(0)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
k = K + 1
hp = 0
H = list(map(int,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
for i in range(k,N):
  hp += Hs[i]

Buggy submission (verdict: Runtime Error):
N, K = list(map(int64_t,input().split()))
k = K - 1
H = list(map(int64_t,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
print(sum(Hs))

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
k = K - 1
H = list(map(int,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
print(sum(Hs))
Problem p02831 (python)

Fixed submission:
import fractions

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

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

Buggy submission (verdict: Runtime Error):
A, B = list(map(int,input().split()))
if A % B == 0:
  print(A)
elif B % A = 0:
  print(B)
else:
  print(A * B)
Problem p03208 (python)

Fixed submission:
N, K = list(map(int,input().split()))
h = [None for _ in range(N)]
MIN = float('inf')
for i in range(N):
  h[i] = int(input())
H = sorted(h)
for i in range(N-(K-1)):
  if MIN >= H[i+(K-1)] - H[i]:
    MIN = H[i+(K-1)] - H[i]
print(MIN)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
h = [None for _ in range(N)]
MIN = float('inf')
for i in range(N):
  h[i] = int(input())
H = sorted(h)
for i in range(N-2):
  if MIN >= H[i+(K-1)] - H[i]:
    MIN = H[i+(K-1)] - H[i]
print(MIN)
Problem p03307 (python)

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

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

if N % 2 == 0:
  print(int(N))
else:
  print(int(2*N))

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
print(int(max(A)) - int(min(A)))

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
print(int(max(A)) - int(min(A)))

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
print(int(max(A))-int(min(A)))
Problem p03345 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
print(A - B if K % 2 == 0 else B - A)

Buggy submission (verdict: Runtime Error):
def abs(k):
  if k >= 0:
    return k
  else:
    return -k
  
def main():
  a, b, c ,n = list(map(int,input().split()))
  i for i in range(n):
    a = b + c
    b = c + a 
    c = a + b
  res = a - b
  if abs(res) > 10 ** 18:
    print('Unfair')
  else:
    print(res)

Buggy submission (verdict: Runtime Error):
def abs(k):
  if k >= 0:
    return k
  else:
    return -k

a, b, c ,n = list(map(int,input().split()))
i for i in range(n):
  a = b + c
  b = c + a 
  c = a + b
res = a - b
if abs(res) > 10 ** 18:
  print('Unfair')
else:
  print(res)
Problem p03835 (python)

Fixed submission:
K, S = list(map(int,input().split()))
count = 0
#ZはXとYが決まった時点で自動的に決まる。
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y 
#範囲が条件ないならOK
    if 0 <= Z and Z <= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K, S = list(map(int,input().split()))
count = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if X + Y + Z == S:
        count += 1
print(count)
Problem p02659 (python)

Fixed submission:
a, b = input().split()

a = int(a)
b_unchi = b.split(".")
b_int = int(b_unchi[0])
b_float = int(b_unchi[1])
bbb = b_int * 100 + b_float
s = a * bbb
print(s // 100)

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

a = int(a)
b_unchi = b.split(".")
b_int = int(b_unchi[0])
b_float = int(b_unchi[1])
bbb = b_int * 100 + b_float
s = a * b
print(s // 100)

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

a = int(a)
b_unchi = b.split(".")
b_int = int(b[0])
b_float = int(b[1])
bbb = b_int * 100 + b_float
s = a * b
print(s // 100)

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

print(int(a*b))
Problem p02661 (python)

Fixed submission:
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(kagen)
zz = sorted(zyogen)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[aa]
    y = zz[aa-1] + zz[aa]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(kagen)
zz = sorted(zyogen)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[a]
    y = zz[aa-1] + zz[a]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(k)
zz = sorted(z)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[a]
    y = zz[aa-1] + zz[a]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(k)
zz = sorted(z)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[a]
    y = zz[aa-1] ++ + zz[a]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(k)
zz = sorted(z)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1]
    y = zz[aa]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(k)
zz = sorted(z)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1]
    y = zz[aa]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)
Problem p02676 (python)

Fixed submission:
n = int(input())
s = input()
l = max(len(s)-n, 0)
if(l == 0):
  print(s)
else:
  k = s[:n]
  print(k + "...")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
l = max(len(s)-n, 0)
if(l == 0):
  print(s)
else:
  k = s(:n)
  print(k + "...")
Problem p02707 (python)

Fixed submission:
n = int(input())
s = list(map(int, input().split()))
t = [0 for _ in range(n)]
for i in range(n-1):
  t[s[i]-1] += 1
for i in range(n):
  print(t[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split()))
t = []
cnt = 2
for a in s:
  try:
    t[a-1].append(cnt)
  except IndexError:
    for _ in range(a-len(t)):
      t.append([])
      t[-1].append(cnt)
for i in range(n-1):
  print(len(t[i]))
print(0)
Problem p02847 (python)

Fixed submission:
s = input()
if s == "SAT":
  print(1)
elif s == "FRI":
  print(2)
elif s == "THU":
  print(3)
elif s == "WED":
  print(4)
elif s == "TUE":
  print(5)
elif s == "MON":
  print(6)
else:
  print(7)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "SAT":
  print(1)
elif s == "FRI":
  print(2)
elif s == "THU":
  print(3)
elif s == "WED":
  print(4)
elif s == "TUE":
  print(5)
elif s == "MON:
  print(6)
else:
  print(7)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if(1 <= a <= 9 and 1 <= b <= 9):
  print(a * b)
else
print(-1)
Problem p02916 (python)

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

ans = sum(b)
for i in range(len(a)-1):
  if(a[i+1] == a[i] + 1):
    ans += c[a[i]-1]
print(ans)

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

ans = sum(b)
for i in range(len(a)-1):
  if(a[i+1] == a[i] + 1):
    ans += c[a[i]]
print(ans)
Problem p02987 (python)

Fixed submission:
s = input()
s1 = s[:1]
for i in range(1, 4):
  if(s[i:i+1] != s1):
    s2 = s[i:i+1]
if(s.count(s1) == 2 and s.count(s2) == 2):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
d = {}
for i in range(4):
  t = s[i:i+1]
  try:
    d[t] += 1
  except:
    d[t] = 1
if(len(d) == 2):
  frag = True
  for i in range(2):
    if(d[i] != 2):
      frag = False
  if(frag):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
s1 = s[:1]
for i in range(1, 4):
  if(s[i:i+1] != s1):
    s[i:i+1] = s2
if(s.count(s1) == 2 and s.count(s2) == 2):
  print("Yes")
else:
  print("No")
Problem p03017 (python)

Fixed submission:
n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, max(c, d)):
    if last == "#" and s[i] == "#":
        print("No")
        exit()
    last = s[i]
flag = False
if c > d:
    s[b - 1] = "#"
    for i in range(a, c):
        if last == "#" and s[i] == "#":
            flag = True
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d + 1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = False
        else:
            count = 0
else:
    for i in range(b, d):
        if last == "#" and s[i] == "#":
            flag = True
        last = s[i]
if not flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, a, b, c, d = [int(i) for i in input().split()]
s = input()
t = s.split("#")
cnt = -1
if(s.count('##') > 0):
    frag = 0
elif(c<d):
    frag = 1
else:
    for i in range(len(t)): #cnt...(i個目の#までの文字数),cntがdより小さかったら抜かせる
        if(cnt < d and i > 0):
                if(t[i].count('.') >= 3):
                    frag = 1
        cnt += len(t[i])+1
if(frag == 0):
    frag2 = 0
    frag3 = 0
    frag4 = 0    
    if(s[b] == '.'):
        frag2 = 1
    if(s[d-2] == '.' or s[d] == '.'):
        frag3 = 1
    if(d + 1 < c):
        frag4 = 1
    if(frag2 == 1 and frag3 == 1 and frag4 == 1):
        frag = 1
if(frag == 1):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, a, b, c, d = [int(i) for i in input().split()]
s = input()
t = s.split("#")
cnt = -1
if(s.count('##') > 0):
    frag = 0
elif(c<d):
    frag = 1
else:
    frag = 0
    frag2 = 0
    frag3 = 0
    frag4 = 0
    for i in range(len(t)): #cnt...(i個目の#までの文字数),cntがdより小さかったら抜かせる
        if(cnt < d and i > 0):
                if(t[i].count('.') >= 3):
                    frag = 1
        cnt += len(t[i])+1
if(frag == 0):
    if(s[b] == '.'):
        frag2 = 1
    if(s[d-2] == '.' or s[d] == '.'):
        frag3 = 1
    if(d + 1 < c):
        frag4 = 1
    if(frag2 == 1 and frag3 == 1 and frag4 == 1):
        frag = 1
if(frag == 1):
    print("Yes")
else:
    print("No")
Problem p03075 (python)

Fixed submission:
s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) <= s[5]:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) < k:
  print("Yay!")
else:
  print(":(")
Problem p03127 (python)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(n):
  ans = fractions.gcd(ans, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input()))
ans = a[0]
for i in range(n):
  ans = fractions.gcd(ans, a[i])
print(ans)
Problem p03250 (python)

Fixed submission:
a = list(map(int, input().split()))
b = a.pop(a.index(max(a)))
print(b*10+sum(a))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
b = a.pop(max(a))
print(b*10+sum(a))
Problem p02633 (python)

Fixed submission:
x=int(input())
from math import gcd
g=gcd(x,360)
print(360//g)

Buggy submission (verdict: Runtime Error):
45tokabaguruna
Problem p02792 (python)

Fixed submission:
c={}
for i in range(1,10):
  for j in range(1,10):
    l=str(i)
    r=str(j)
    c[l+r]=0


n=int(input())
for i in range(1,n+1):
  l=str(i)[0]
  r=str(i)[-1]
  try:
    c[l+r]+=1
  except:
    pass
  
      
ans=0
for i in range(1,10):
  for j in range(1,10):
    l=str(i)
    r=str(j)
    ans+=c[l+r]*c[r+l]
    
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=[[0 for i in range(10)] for j in range(n)]

for i in range(1,n+1):
  s=str(i)
  head=int(s[0])
  tail=int(s[-1])
  cnt[head][tail]+=1

ans=0
for h in range(0,10):
  for t in range(0,10):
    ans+=cnt[h][t]*cnt[t][h]
print(ans)

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

c=[[0]*10 for i in range(n)]

for i in range(1,n+1):
    t=str(i)
    c[int(t[0])][int(t[-1])]+=1
    
ans=0
for i in range(10):
    for j in range(10):
        ans+=c[i][j]*c[j][i]
        
print(ans)

Buggy submission (verdict: Runtime Error):
def main(n):
    l=[i for i in range(1,n+1)]
    ans=0
    for i in l:
        for j in l:    
            if str(i)[0]==str(j)[-1] and str(j)[0]==str(i)[-1]:
                # print(i,j)
                ans+=1
                
    print(ans)
n=init(input())
main(n)
Problem p02862 (python)

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

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

if a<0 or b<0:
    print(0)
    exit()

mod=10**9+7

F=[1]
for i in range(1,a+b+1):
    tmp=F[-1]*i
    F.append(tmp%mod)

Ia=pow(F[a],mod-2,mod)
Ib=pow(F[b],mod-2,mod)

ans=F[a+b]*Ia*Ib%mod
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())

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

mod=10**9+7

F=[1]
for i in range(1,a+b+1):
    tmp=F[-1]*i
    F.append(tmp%mod)

Ia=pow(F[a],mod-2,mod)
Ib=pow(F[b],mod-2,mod)

ans=F[a+b]*Ia*Ib%mod
print(ans)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
from heapq import *
def abc144c():
  n,k=map(int,input().split())
  a=sorted(list(map(int,input().split())))
  f=sorted(list(map(int,input().split())))[::-1]
  q=[] 
  for i,j in zip(a,f):
    heappush(q,(-i*j,j))
  kk=min(k,10**12)
  for i in range(k):
    tmp,key=heappop(q)
    heappush(q,(tmp+key,key))
  ans,key=heappop(q)
  print(max(-ans,0))
abc144c()
Problem p02912 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[-_ for _ in a]
import heapq
heapq.heapify(a)
for i in range(m):
  temp=-heapq.heappop(a)
  heapq.heappush(a,-(temp//2))
  
print(-sum(a))

Buggy submission (verdict: Runtime Error):
import numpy
def main():
  n,m=map(int,input().split())
  a=sorted(list(map(int,input().split())))
  for i in range(m):
    a[-1]=a[-1]//2
    a.sort()
  print(sum(a))
main()
Problem p02990 (python)

Fixed submission:
mod=10**9+7
n,k=map(int,input().split())

from scipy.misc import comb

for i in range(1,k+1):
  print(comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)

Buggy submission (verdict: Runtime Error):
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
"def c(t, r):
"  return factorial(t)//factorial(t-r)//factorial(r)
def f(x):
  return factorial(x)


for _ in range(1,k+1):
  a1=f(n-k+1)%a
  a2=f(n-k+1-_)
  a3=f(_)
  a4=f(k-1)%a
  a5=f(k-1-_+1)
  a6=f(_-1)
  ans=a1*a4//(a2*a3*a5*a6)%a
  print(ans)

"  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

Buggy submission (verdict: Runtime Error):
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
def c(t, r):
  return factorial(t)//factorial(t-r)//factorial(r)

for _ in range(1,k+1):
  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

Buggy submission (verdict: Runtime Error):
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
def c(t, r):
    return factorial(t)//factorial(t-r)//factorial(r)

for _ in range(1,k+1):
  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

Buggy submission (verdict: Runtime Error):
a=10**9+7
n,k=map(int,input().split())
from math import factorial 
def c(t, r):
    return factorial(t)//(factorial(t-r)*factorial(r))

for _ in range(1,k+1):
  print((c(n-k+1,_)%a*c(k-1,_-1)%a))

Buggy submission (verdict: Runtime Error):
a=10**9+7
import math 
def combinations_count(t, r):
    return (math.factorial(t%a)) // int((math.factorial(t%a - r%a) * math.factorial(r%a)))

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


for _ in range(1,k+1):
  print(combinations_count((n-k+1),_)%a*combinations_count((k-1),(_-1)))

Buggy submission (verdict: Runtime Error):
a=10**9+7
import math 
def combinations_count(n, r):
    return (math.factorial(n)) // (math.factorial(n - r) * math.factorial(r))

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


for _ in range(1,k+1):
  print(combinations_count((n-k+1)%a,_%a)%a*combinations_count((k-1)%a,(_-1)%a))

Buggy submission (verdict: Runtime Error):
a=10**9+7
import math 
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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


for _ in range(1,k+1):
  print(combinations_count(n-k+1,_)%a*combinations_count(k-1,_-1))
Problem p03053 (python)

Fixed submission:
#copipe
#1次元で格納

def main():
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        a.append(input())

    used = [True]*(h*w)

    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False


    
    res = 0
    while p:
        tank = []
        for e in p:
            if e>w-1 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w > 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e<(h-1)*w and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w<w-1 and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

if __name__ == '__main__':
    main()

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

def main():
  h,w=map(int,input().split())  
  mp=["#"*(w+2)]+["#"+input()+"#" for _ in range(h)]+["#"*(w+2)]
  dist=[-1]*((h+2)*(w+2))
  q=deque()
  
  for i in range(h+2):
    for j in range(w+2):
      if mp[i][j]=="#":
        q.append(i*w+j)
        dist[i*w+j]=0
      else:
        dist[i*w+j]=-1
  #print(q)
 
  while q:
    c=q.popleft()
    x=c//w
    y=c%w
    for i,j in ((1,0),(0,1),(-1,0),(0,-1)):
      xx,yy=x+i,y+j
      tmp=xx*w+yy
      if dist[tmp]==-1:
        dist[tmp]=dist[c]+1
        q.append(tmp)
      
  print(max(dist))
  return

main()

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

def main():


  h,w=map(int,input().split())
  field1=[list("#"*(w+2))]
  field2=[list("#"+input()+"#") for _ in range(h)]

  f=(field1+field2+field1)


  f=np.array(f)
  visited=np.array([[-1000]*(w+2) for _ in range(h+2)])

  slist=[]
  for i in range(1,w+1):
    for j in range(1,h+1):
      if f[i][j]=="#":
        slist.append((i,j))

  def dfs(maze,visited,slist):
    stack=deque([])
    for i,j in slist:
      visited[i][j]=0
      stack.append([i,j])

    while stack:
      x,y=stack.popleft()
      for i,j in ((1,0),(-1,0),(0,1),(0,-1)):
        x_new,y_new=x+i,y+j
        if maze[x_new][y_new]==".":# and visited[x_new][y_new]==-1000:
          visited[x_new][y_new]=visited[x][y]+1
          maze[x_new][y_new]="#"
          stack.append([x_new,y_new])

  dfs(f,visited,slist)      
  #print(f)
  print(visited.max())

main()