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

Fixed submission:
import itertools
n,m = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(m)]
a = [0]*n
for x,y in A:
  a[x-1] |= 1<<(y-1)
  a[y-1] |= 1<<(x-1)

def bitdp(n, a):
  dp = [[0]*n for _ in range(1<<n)]
  dp[1][0] = 1
  
  for bit in range(1<<n):
    for v in range(n):
      if bit & 1<<v:
        sub = bit ^ (1<<v)
        
        for u in range(n):
          if (sub & 1<<u) and (a[v] & 1<<u):
            dp[bit][v] += dp[sub][u]
  ans = sum(dp[(1<<n)-1][u] for u in range(1,n))
  return ans

ans = bitdp(n,a)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(m)]
ab = [[False]*n for _ in range(n)] 
for i in range(n):
  ab[AB[i][0]-1][AB[i][1]-1] = 1
  ab[AB[i][1]-1][AB[i][0]-1] = 1

ans = 0
for que in itertools.permutations(range(n), n):
  if que[0] == 0:
    for k in range(n):
      if k == n-1:
        ans += 1
      else:
        if ab[que[k]][que[k+1]] != 1:
          break
      

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(m)]
ab = [[False]*n for _ in range(n)] 
for i in range(n):
  ab[AB[i][0]-1][AB[i][1]-1] = 1
  ab[AB[i][1]-1][AB[i][0]-1] = 1

ans = 0
for i in itertools.permutations(range(n), n):
  if i[0] == 0:
    que = i
    cnt = 1
    for k in range(n-1):
      if ab[que[k]][que[k+1]] == 1:
        cnt += 1
    if cnt == n:
      ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(m)]
ab = [[] for _ in range(n)] 
for i in range(n):
  ab[AB[i][0]-1].append(AB[i][1]-1)
  ab[AB[i][1]-1].append(AB[i][0]-1)

ans = 0
for i in itertools.permutations(range(n), n):
  if i[0] == 0:
    que = i
    cnt = 1
    for k in range(n-1):
      if que[k+1] in ab[que[k]]:
        cnt += 1
    if cnt == n:
      ans += 1

print(ans)
Problem p03835 (python)

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

def fact(n):
  return sum([x for x in range(1,n+1)])

ans = 0
r = 0
for x in range(k+1):
  for y in range(x,k+1):
    if 0 <= s - (x+y) <= k:
      if (x==y):
          ans += 1
      else:
          ans += 2

print(ans)

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

def est():
  for x in range(k+1):
    for y in range(k+1):
      if s-(x+y) >=0 and s-(x+y) <= k:
        cnt += 1
  return cnt
print(est())
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
a = N-K+1
print(a)
for i in range(1,K):
  a = int(a * (N-K+1-i) * (K-i) // i // (i+1))
  print(a % 1000000007)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
for i in range(1,K+1):
  r = 1
  for j in range(1, i+1):
    r = (r * (N-K+2-j))
  for j in range(1, i+1):
    r = int(r / j)
  for j in range(1, i):
    r = (r * (K-j))
  for j in range(1, i):
    r = int(r / j)
  print(r % 1000000007)
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
BCs = []
for m in range(M):
  B, C = map(int, input().split())
  BCs.append((B, C))
BCs.sort(key=lambda BC: -BC[1])
#print(BCs)

index = 0
for m in range(M):
  B, C = BCs[m]
  for i in range(B):
    if index >= N:
      break
    if As[index] < C:
      As[index] = C
      index += 1
    else:
      break
print(sum(As))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
BCs = []
for m in range(M):
  B, C = map(int, input().split())
  BCs.append((B, C))
BCs.sort(key=lambda BC: -BC[1])
#print(BCs)

index = 0
for m in range(M):
  B, C = BCs[m]
  for i in range(B):
    if As[index] < C:
      As[index] = C
      index += 1
    else:
      break
print(sum(As))
Problem p03108 (python)

Fixed submission:
N, M = map(int, input().split())
ABs = []
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  ABs.append((A, B))
UF = list(range(N))
Ns = [1]*N
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
  Ns[i] = Ns[j] = Ns[i]+Ns[j]
def size(m):
  return Ns[par(m)]
r = N*(N-1)//2
rs = [r]
for A, B in reversed(ABs):
  if par(A) == par(B):
    rs.append(r)
    continue
  sA = size(A)
  sB = size(B)
  unite(A, B)
  r -= sA*sB
  rs.append(r)
rs.pop()
for r in reversed(rs):
  print(r)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ABs = []
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  ABs.append((A, B))
UF = list(range(N))
Ns = [1]*N
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[i] = j
  Ns[j] = Ns[i]+Ns[j]
def size(m):
  return Ns[par(m)]
r = N*(N-1)//2
rs = [r]
for A, B in reversed(ABs):
  if par(A) == par(B):
    rs.append(r)
    continue
  sA = size(A)
  sB = size(B)
  unite(A, B)
  r -= sA*sB
  rs.append(r)
rs.pop()
for r in reversed(rs):
  print(r)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ABs = []
for i in range(M):
  A, B = map(int, input().split())
  A, B = A-1, B-1
  ABs.append((A, B))
UF = list(range(N))
Ns = [1]*N
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[i] = j
  Ns[i] = Ns[j] = Ns[i]+Ns[j]
def size(m):
  return Ns[par(m)]
r = N*(N-1)//2
rs = [r]
for A, B in reversed(ABs):
  if par(A) == par(B):
    rs.append(r)
    continue
  sA = size(A)
  sB = size(B)
  unite(A, B)
  r -= sA*sB
  rs.append(r)
rs.pop()
for r in reversed(rs):
  print(r)
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c <= 21:
	print("win")
else:
	print("bust")

Buggy submission (verdict: Runtime Error):
a,b,c = int(input()).split()
if a+b+c <= 21:
	print("win")
else:
	print("bust")

Buggy submission (verdict: Runtime Error):
a,b,c =split(int(input()))
if a+b+c <= 21:
	print("win")
else:
	print("bust")
Problem p03075 (python)

Fixed submission:
lst=[]
for i in range(5):
	lst.append(int(input()))
k = int(input())
sor = sorted(lst)
if sor[4] - sor[0] > k:
	print(":(")
else:
	print("Yay!")

Buggy submission (verdict: Runtime Error):
lst=[]
for i in 5:
	lst.append(int(input()))
k = int(input())
sor = sorted(lst)
if sor[4] - sor[0] > k:
	print(":(")
else:
	print("Yay!")
Problem p02831 (python)

Fixed submission:
import fractions

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

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


print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(A, B):
    return (A * B) // math.gcd(A, B)


print(lcm(A, B))
Problem p02881 (python)

Fixed submission:
from heapq import heapify, heappush, heappop
N = int(input())
heap = []
heapify(heap)
for i in range(1, int(N**(0.5)) + 1):
    if N % i == 0:
        heappush(heap, i - 1 + N // i - 1)
print(heappop(heap))

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
N = int(input())
heap = []
heapify(heap)
for i in range(1, int(N**(0.5))):
    if N % i == 0:
        heappush(heap, i - 1 + N // i - 1)
print(heappop(heap))
Problem p02912 (python)

Fixed submission:
from heapq import heapify, heappush, heappop
N, M = map(int, input().split())
A = [-int(i) for i in input().split()]
heapify(A)
while M > 0:
    heappush(A, heappop(A) / 2)
    M -= 1
print(-sum(int(i) for i in A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
while M > 0:
    A.sort()
    while A[-1] >= A[-2]:
        A[-1] //= 2
        M -= 1
print(sum(A))
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
print((B + C - A) if (B + C) > A else 0)

Buggy submission (verdict: Runtime Error):
(B + C - A) if (B + C) > A else 0
Problem p02622 (python)

Fixed submission:
S = input()
T = input()

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

num = 0
for ind, s in enumerate(A):
    if  A[ind] != B[ind]:
        num = num + 1
print(num)

Buggy submission (verdict: Runtime Error):
S, T= map(int, input().split())
2 A = list(map(int, input().split()))
3 B = list(map(int, input().split()))

num = 0
for ind, s in enumerate(A):
    if  A[ind] != B[ind]:
        num = num + 1
print(num)

Buggy submission (verdict: Runtime Error):
S, T= input().split()

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)

Buggy submission (verdict: Runtime Error):
S, T= map(string, input().split())

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)

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

num = 0
for ind, s in enumerate(S):
    if  S[ind] != T[ind]:
        num = num + 1
print(num)
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(input()**2)

Buggy submission (verdict: Runtime Error):
print (input()**2)

Buggy submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
  r = line

print r*r

Buggy submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
  r = line

return r*r
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
h = int(N/2)
if S[0:h] == S[h:N]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
h = N/2
if S[0:h] == S[h:N]
	return Yes
return No
Problem p02835 (python)

Fixed submission:

def main():
    a, b, c = map(int, input().split())
    sum = a+b+c

    if (sum <=  21):
        print("win")
    elif(sum >= 22):
        print("bust")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):


def main():
    a, b, c = map(int, input().split())
    sum = a+b+c
    print(sum)

    if (sum <=  21):
        print("win")
    elif(sum >= 22):
        print("bust")

if __name__ == "__main__":
    main()
Problem p03042 (python)

Fixed submission:
def main():
    str = input()
    YY = []
    MM = []
    YYMM_flg = False
    MMYY_flg = False
    AMB_flg = False
    NA_flg = False

    for i in range(2):
    	YY.append(str[i])

    for i in range(2, 4):
    	MM.append(str[i])

    yy = int(''.join(YY))
    mm = int(''.join(MM))

    if (yy >= 1 and yy <= 12) and (mm >= 1 and mm <= 12):
    	AMB_flg = True
    elif (mm >= 1 and mm <= 12) and (yy != 0 or mm != 0):
    	YYMM_flg = True
    elif (yy >= 1 and yy <= 12) and (yy != 0 or mm != 0):
    	MMYY_flg = True
    else:
    	NA_flg = True

    if AMB_flg:
    	print("AMBIGUOUS")
    elif YYMM_flg:
    	print("YYMM")
    elif MMYY_flg:
    	print("MMYY")
    elif NA_flg:
    	print("NA")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
	def main():
	    str = input()
	    YY = []
	    MM = []
	    YYMM_flg = False
	    MMYY_flg = False
	    AMB_flg = False
	    NA_flg = False

	    for i in range(2):
	    	YY.append(str[i])

	    for i in range(2, 4):
	    	MM.append(str[i])

	    yy = int(''.join(YY))
	    mm = int(''.join(MM))

	    if (yy >= 1 and yy <= 12) and (mm >= 1 and mm <= 12):
	    	AMB_flg = True
	    elif (mm >= 1 and mm <= 12) and (yy != 0 or mm != 0):
	    	YYMM_flg = True
	    elif (yy >= 1 and yy <= 12) and (yy != 0 or mm != 0):
	    	MMYY_flg = True
	    else:
	    	NA_flg = True

	    if AMB_flg:
	    	print("AMBIGUOUS")
	    elif YYMM_flg:
	    	print("YYMM")
	    elif MMYY_flg:
	    	print("MMYY")
	    elif NA_flg:
	    	print("NA")


	if __name__ == "__main__":
	    main()
Problem p02622 (python)

Fixed submission:
word1 = list(input())
word2 = list(input())
i = 0
for p, q in zip(word1, word2):
	if p!=q:
		i+=1
print(i)

Buggy submission (verdict: Runtime Error):
word1=list(input())
word2=list(input2())
i = 0
for i, j in word1, word2 :
  if i!=J:
    i++
print(i)
Problem p02676 (python)

Fixed submission:
k = int(input())
s = list(input())

l=[]
if(len(s)<=k):
  word = "".join(s)
  print(word)
else:
  for i in range(k):
    l.append(s[i])
    name = "".join(l)

  print(name + "...")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = list(input())
l=[]
if(len(s)<=k):
  word = "".join(s)
  print(word)
else:
  for i in range(k):
    l.append(s[i])
    name = "".join(l)
print(name + "...")
Problem p02627 (python)

Fixed submission:
import re

alpha = input()

if(re.compile("[A-Z]").search(alpha)):
    print("A")
else:
    print("a")

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

array = list(map(int, input().split()))
array.sort()
total = 0

for i in range(k):
  total+=array[i]
  
print(total)

Buggy submission (verdict: Runtime Error):
import re
import sys

def main():
    args = sys.argv
    alpha = args[1]

    if(re.compile("[A-Z]").search(alpha)):
        print("A")
    else:
        print("a")



if __name__ == '__main__':
    main()
Problem p03042 (python)

Fixed submission:
s = input()
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if(s1 >= 1 and s1 <=12):
  if(s2 >= 1 and s2 <=12):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if(s2 >= 1 and s2 <=12):
    print('YYMM')
  else:
    print('NA')

Buggy submission (verdict: Runtime Error):
s = input()
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if(s1 <= 1 and s1 <=12):
  if(s2 <= and s2 <=12):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if(s2 <= 1 and s2 <=12):
    print('YYMM')
  else:
    print('NA')
Problem p02862 (python)

Fixed submission:
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x, y = map(int, input().split())
if ((x + y) % 3 != 0):
	print("0")
elif (x > 2*y or y > 2*x):
	print("0")
else:
	n_x = (2 * x - y) // 3
	n_y = (2 * y - x) // 3
	n_xy = (x + y) // 3
	print(cmb(n_xy,n_x)%1000000007)

Buggy submission (verdict: Runtime Error):
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x, y = map(int, input().split())
if ((x + y) % 3 != 0):
	print("0")
elif (x > 2*y or y > 2_x):
	print("0")
else:
	n_x = (2 * x - y) // 3
	n_y = (2 * y - x) // 3
	n_xy = (x + y) // 3
	print(cmb(n_xy,n_x)%1000000007)

Buggy submission (verdict: Runtime Error):
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x, y = map(int, input().split())
if ((x + y) % 3 != 0):
	print("0")
elif (x > 2*y || y > 2_x):
	print("0")
else:
	n_x = (2 * x - y) // 3
	n_y = (2 * y - x) // 3
	n_xy = (x + y) // 3
	print(cmb(n_xy,n_x)%1000000007)
Problem p02773 (python)

Fixed submission:
import collections

N = int(input())
vote_list = [input() for i in range(N)]
vote_list.sort()

count = collections.Counter(vote_list)
max_count = count.most_common()[0][1]
ans = []

for alpha, beta in count.items():
    if beta == max_count:
        ans.append(alpha)
ans.sort()
print("\n".join(ans))

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
vote_list = [input() for i in range(N)]
vote_list.sort()

count = collections.Counter(vote_list)
max_count = count.most_common()[0][1]

if max_count == 1:
    for i in vote_list:
        print(i)
else:
    i = 0
    while count.most_common()[i][1] == max_count:
        print(count.most_common()[i][0])
        i = i + 1
Problem p02785 (python)

Fixed submission:
import math

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

H.sort()
if K == 0:
    print(sum(H))
elif K >= N:
    print(0)
else:
    H = H[:-K]
    print(sum(H))

Buggy submission (verdict: Runtime Error):
import math

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

H.sort(reverse=True)
if K == 0:
    print(sum(H))
elif K >= N:
    print(0)
else:
    [H.pop(i) for i in range(K)]
    print(sum(H))

Buggy submission (verdict: Runtime Error):
import math

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

H.sort(reverse=True)
if K >= N:
    print(0)
elif K >= 1:
    [H.pop(i) for i in range(K)]
    print(sum(H))
else:
    print(sum(H))

Buggy submission (verdict: Runtime Error):
import math

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

H.sort(reverse=True)
if K >= N:
    print(0)
elif K >= 1:
    for i in range(K):
        H.pop(i)
    print(sum(H))
else:
    print(sum(H))

Buggy submission (verdict: Runtime Error):
import math

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

H.sort(reverse=True)
if K >= N:
    print(0)
elif K >= 1:
    for i in range(K):
        H.pop(i)
    print(sum(H))
else:
    print(sum(H))
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())


def abc(A, B):
    return (A*B) // fractions.gcd(A, B)


print(abc(A, B))

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


def gcd(A, B):
    return (A*B) // math.gcd(A, B)


print(gcd(A, B))
Problem p02860 (python)

Fixed submission:
N = int(input())
S = list(input())
if N % 2 == 1:
    print('No')
elif S[:N//2] == S[N//2:]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
if N // 2 == 1:
    print('No')
elif:
    S[0:N//2] == S[N//2:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
if N // 2 == 1:
    print('No')
elif:
    S[0:N//2] == S[N//2:-1]:
    print('Yes')
else:
    print('No')
Problem p02622 (python)

Fixed submission:
S=str(input())
T=str(input())
sum=0

for i in range(len(S)):
    if S[i]!=T[i]:
        sum+=1

print(sum)

Buggy submission (verdict: Runtime Error):
S=str(input())
T=str(input())
sum=0

for i in range(len(S)):
    if S[i]!=T[i]:
        sum++

print(sum)
Problem p02627 (python)

Fixed submission:
a=input()

print('A' if a.isupper() else 'a')

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

print('A' if(a.isupper) else 'a')
Problem p02711 (python)

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

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

Fixed submission:
N = int(input())
sum=0
for i in range(1,N+1):
  if ((i%3!=0)and(i%5!=0)):
    sum+=i
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum=0
for i in range( 1, N+1):
  if !(i%5==0) and !(i%3==0):
    sum+=i
print(sum)
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
N,M = input().split()
result = int(N*(N-1)/2) + int(M*(M-1)/2)
print(result)
Problem p02659 (python)

Fixed submission:
def main():
    astr, bstr = input().split()
    a = int(astr)
    b = int(''.join(c for c in bstr if c != '.'))
    trunc = (a * b) // 100
    print(trunc)


main()

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

def main():
    a, b = input().split()
    v = int((Decimal(a) * Decimal(b))
    print(v)

main()
Problem p02693 (python)

Fixed submission:
def main():
    k = int(input())
    a, b = (int(i) for i in input().split())

    for i in range(a, b+1):
        if i % k == 0:
          print('OK')
          return

    print('NG')


main()

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = (int(i) for i in input().split())

for i in range(a, b+1):
  if i % k == 0:
    print('OK')
    return

print('NG')
Problem p02725 (python)

Fixed submission:
def main():
    k, n = (int(i) for i in input().split())
    st = [int(i) for i in input().split()]

    st = sorted(st)
    st.append(st[0] + k)

    diffs = [st[i+1] - st[i] for i in range(n)]

    print(k - max(diffs))

main()

Buggy submission (verdict: Runtime Error):
k, n = (int(i) for i in input().split())
st [int(i) for i in input().split()]

st = sorted(st)
st.append(st[0] + k)

diffs = [st[i+1] - st[i] for i in range(n)]

print(k - max(diffs))
Problem p02754 (python)

Fixed submission:
def main():
    n, a, b = [int(i) for i in input().split()]

    if a + b == 0:
        print(0)
    else:
        c, r = n // (a + b), n % (a + b)
        nblue = c * a + min(a, r)
        print(nblue)

main()

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split]

if a + b == 0:
  print(0)
else:
  c, r = n // (a + b), n % (a + b)
  nblue = c * a + min(a, r)
  print(nblue)
Problem p02990 (python)

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

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

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

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

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

for i in range(1, K + 1):
    b = combinations_count(K - 1, i - 1)
    r = combinations_count(N - K + 1, i)
    print((b * r) % (10 **9 + 7))
Problem p03013 (python)

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

a = []
for _ in range(M):
    a.append(int(input()))

val = [0,1]
for i in range(1, N + 1):
    ans = val[-2] + val[-1]
    val.append(ans)
    if len(a) > 0:
        if i == a[0]:
            val[-1] = 0
            a.pop(0)

print(ans % (10**9 +7))

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

a = []
for _ in range(M):
    a.append(int(input()))

val = [0,1]
j = 0
for i in range(1, N + 1):
    ans = val[0] + val[1]
    val[0] = val[1]
    val[1] = ans
    if i == a[j]:
        val[1] = 0
        if len(a) - 1 != j:
            j += 1

print(ans%(10**9+7))

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

a = []
for _ in range(M):
    a.append(int(input()))

val = [0,1]
j = 0
for i in range(1, N + 1):
    ans = val[0] + val[1]
    val[0] = val[1]
    val[1] = ans
    if i == a[j]:
        val[1] = 0
        if len(a) - 1 > j:
            j += 1

print(ans%(10**9+7))