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

Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    print((a+b)%24)
    return

#B
def B():
    n, m = LI()
    ab = LIR(n)
    cd = LIR(m)
    for a, b in ab:
        ans = inf
        an = 0
        for num, cdi in enumerate(cd):
            c, d = cdi
            if ans > abs(a - c) + abs(b - d):
                ans = abs(a - c) + abs(b - d)
                an = num
        print(an+1) 
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    print((a+b)%24)
    return

#B
def B():
    n, m = LI()
    ab = LIR(n)
    cd = LIR(m)
    for a, b in ab:
        ans = inf
        an = 0
        for num, cdi in cd:
            c, d = cdi
            if ans > abs(a - c) + abs(b - d):
                an = num
        print(an) 
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()
Problem p03834 (python)

Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = input()
    print(" ".join(a.split(",")))
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = input()
    print(" ".join(s.split(",")))
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()
Problem p04008 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(1,n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
def dfs(now):
  res = 0
  for e in edg[now]:
    res = max(res, dfs(e)+1)
  if res == k - 1 and a[now] != 0:
    ans[now] = 1
    res = -1
  return res
      
dfs(0)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(1,n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
def dfs(now):
  res = 0
  for e in edg[now]:
    res = max(res, dfs(e))
  if res == k - 1 and a[e] != 0 and e != 0:
    ans[e] = 1
    res = 1
  return res + 1
      
dfs(0)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
c = [1] * n
def dfs(now, rank):
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if rank == k:
        ans[e] = 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 1)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import sys
sys.recursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
c = [1] * n
def dfs(now, time):
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans[e] = 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
c = [1] * n
def dfs(now, time):
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans[e] = 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = a[0] != 0
c = [1] * n
def dfs(now, time):
  global ans
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans += 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = a[0] != 0
c = [1] * n
def dfs(now, time):
  global ans
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans += 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(ans)
Problem p04037 (python)

Fixed submission:
n=int(input())
a=sorted(map(int,input().split()))[::-1]
i=0
while i<n and a[i]>i:i+=1
j=i
while j<n and a[j]>=i:j+=1
print('SFeicrosntd'[(a[i-1]-i)&1 or (j-i)&1::2])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(map(int,input().split()))[::-1]
j=i=0
while n:i+=a[i]>i;j+=a[j]>=i,n-=1
print('SFeicrosntd'[(a[i-1]^i|j^i)&1::2])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(map(int,input().split()))[::-1]
j=i=x=0
while x<n:i+=a[i]>i;j+=a[j]>=i,x+=1
print('SFeicrosntd'[(a[i-1]^i|j^i)&1::2])
Problem p03011 (python)

Fixed submission:
def smaller(x, y):
	if x < y: return x
	return y

P, Q, R = map(int, input().split())

r1 = P + Q
r2 = Q + R
r3 = R + P

print(smaller(r1, smaller(r2, r3)))

Buggy submission (verdict: Runtime Error):
def smaller(x, y):
	if x < y: return x
	return y

P, Q, R = map(int, input().split())

r1 = P + Q
r2 = Q + R
r3 = R + P

print(smaller(r1, smaller(r2, r3)))
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
 
count = 0
for i in range(len(S)):
	if S[i] != T[i]:
		count = count + 1
 
print(count)

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

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

print(count)
Problem p02627 (python)

Fixed submission:
a = input()

if a.isupper():
	print("A")
else:
	print("a")

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

def bubblesort(l):
    for index in range(len(l)-1, 0, -1):
        for low in range(index):
            if l[low] > l[low+1]:
                tmp = l[low+1]
                l[low+1] = l[low]
                l[low] = tmp
    return l

bubblesort(P)
sum = 0
for i in range(K):
	sum = sum + P[i]
print(sum)

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

if a.isupper():
	print(A)
else:
	print(a)
Problem p02688 (python)

Fixed submission:

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

A = [0] * N
#print(A)
#print(type(A))

for okashi_number in range(k):
	di = int(input())
	D = list(map(int,input().split()))
	for x in range(di):
		A[D[x]-1]= 1
#print(A)
count = 0
for i in range(N):
	if A[i] == 0:
		count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
for okashi_number in range(k):
	di = int(input())
	D = map(int,input().split())
	for x in range(di)
		A[[x]-1] = 1

for i in range(N):
	if A[i] == 0:
	print(A[i])
Problem p02693 (python)

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

flag = 0
for i in range(a ,b + 1, 1):
	if i % k == 0:
		flag = flag + 1
		break

if flag == 0:
	print("NG")
else:
	print("OK")

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

flag = 0
for i in range(a ,b + 1, 1)
	if i % k == 0:
		flag = flag + 1
		break
		print("OK")
elif flag == 0:
	print("NO")
Problem p02711 (python)

Fixed submission:
N = input()

flag = 0
for i in range(len(N)):
	if N[i] == "7":
		flag = 1
		break

if flag == 1:
	print("Yes")
else:
	print("No")

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

flag = 0
for i in range(len(N)):
	if N[i] == "7":
		flag = 1
		break

if flag == 1:
	print("Yes")
else:
	print("No"
Problem p02723 (python)

Fixed submission:
S = input()

if S[2] == S[3] and S [4] == S[5]:
	print("Yes")
else:
	print("No")

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

if S[3] == S[4] and S [5] == S[6]:
	print("Yes")
else:
	print("No")
Problem p02754 (python)

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

c = N//(A + B)

rem = N - c * (A + B)

if rem >= A:
	sum = c * A + A
else:
	sum =c * A + rem

print(sum)

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

number_turn = N //(A + B)
nokori = N % (A + B)

if nokori <= A: #nokoriが全てAの場合
	print((number_turn * A) + nokori)
else:　#nokoriがAとBの両方の場合
	print((number_turn * A) + A)
Problem p02771 (python)

Fixed submission:
A,B,C = map(int,input().split())
 
if A == B and A != C :
	answer = "Yes"
elif A == C and A != B :
	answer = "Yes"
    
elif B == C and B != A :
	answer = "Yes"
else:
	answer = "No"
 
print(answer)

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

if A == B and A != C :
	answer　= "Yes"
    
elif A == C and A != B :
	answer　= "Yes"
    
elif B == C and B != A :
	answer　= "Yes"
else:
	answer = "No"

print(answer)
Problem p02847 (python)

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

Buggy submission (verdict: Runtime Error):
#２分探索
A = [1,5,7,15,26,45,60,256] #データ

x = int(input()) #探索するデータ

li = 0           #探索範囲の左端
ri = len(A) -1   #探索範囲の右端

while (li != ri):       #探索範囲が２つ以上あるかぎり繰り返す
	mi = (li + ri) // 2 #中央のindexの計算
	if A[mi] < x:       #もし中央の値 < x ならば
		li = mi+1       #左半分を消去
	elif A[mi] > x:     #もし中央の値 > x　ならば
		ri = mi-1       #右半分消去
	else:               #xを発見！!(*´꒳`*)!!
		li = mi
		ri = mi
if A[li] == x:
	print("発見！",li)
else:
	print("ないよ！")

Buggy submission (verdict: Runtime Error):
S = input()
if S == "SUN" :
	answer = 7
elif S == "MON" :
	answer = 6
elif S == "THE" :
	answer = 5
elif S == "WED" :
	answer = 4
elif S == "THU" :
	answer = 3
elif S == "FRI" :
	answer = 2
elif S == "SAT" :
	answer = 1

print(answer)
Problem p02951 (python)

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

answer = 0
if A - B <= C:
	answer = C - (A - B )
  
else:
	answer = 0
    
print(answer)

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

answer = 0
if A - B <= C
	answer = C - (A - B )
  
else:
	answer = 0

print(answer)
Problem p03041 (python)

Fixed submission:
N,K =  map(int,input().split())
S = input()
SL = list(S)
 
SL[K - 1] = SL[K - 1].lower()
answer = "".join(SL)
print(answer)

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

SL[K] = SL[K].lower()
answer = "".join(SL)
print(answer)

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

SL[K] = SL[K].lower()
answer = "".join(SL)
print(answer)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
	print(":(")
else:
	print("Yay!")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if e -a > k
	print(":(")
else:
	print("Yay!")
Problem p03272 (python)

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

answer = N - i + 1

print(answer)

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

answer = N - i + 1

print(answer)
Problem p03803 (python)

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

if A > B and B != 1:
	print("Alice")
elif A > B and B == 1:
	print("Bob")

if B > A and A != 1:
	print("Bob")
elif B > A and A == 1:
	print("Alice")

if A == B:
	print("Draw")

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

if A > B and B != 1:
	print("Alice")
elif A == B:
	print("Draw")
elif B > A and A != 1:
	print("Bob")
Problem p02689 (python)

Fixed submission:
n,m = map(int,input().split())
A = [0] + list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(A[e])
    B[e].append(A[s])
ans = 0
for i in range(1,n+1):
    if len(B[i]) == 0:
        ans += 1
    elif max(B[i]) < A[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = [ [] for _ in range(n + 1) ]
for _ in range(m):
    s,e = map(int,input().split())
    B[s].append(e)
    B[e].append(s)
ans = 0
for i in range(1,n+1):
    if max(B[i]) < i:
        ans += 1
print(ans)
Problem p02707 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = Counter(list(map(int,input().split())))
for i in range(1,n+1):
    print(a[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in a:
    ans[a[i]-1] += 1
for i in ans:
    print(i)
Problem p02831 (python)

Fixed submission:
import fractions
a,b = map(int,input().split())
print(int(a * b / fractions.gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b = map(int,input().split())
print(np.lcm(a, b))
Problem p02835 (python)

Fixed submission:
n,m,l = map(int,input().split())
if n+m+l <= 21:
    print("win")
else:
    print("bust")

Buggy submission (verdict: Runtime Error):
n = int(input())
Ans = []
for i in range(n):
    Ai = int(input())
    a = []
    for j in range(Ai):
        x,y = map(int,input().split())
        a.append((x,y))
    Ans.append(a)
Honest = 0
TT = [bin(i)[2:].zfill(n) for i in range(2**n)]
#print(TT)
for truth in TT:
    truth = str(truth)
    people = [-1]*n
    #print("====")
    #print(truth)
    flag = True
    for i in range(n):
        tt = truth[i]
        answers = Ans[i]
        #print(answers)
        if tt == "1":
            #証言は信頼できると仮定
            for x,v in answers:
                #xに対してv
                if v:#x人が正直者という証言
                    if people[x-1] == 0:#xは嘘つきと証言されているとき
                        flag = False
                        #print("A")
                    else:
                        people[x-1] = 1
                else:#xは嘘つきという証言
                    if people[x-1] == 1:
                        flag = False
                        #print("B")
                    else:
                        people[x-1] = 0
        else:
            #証言は嘘と仮定
            for x,v in answers:
                if v == 0:
                    if people[x-1] == 0:#xは嘘つきと証言されているとき
                        flag = False
                        #print("C")
                    else:
                        people[x-1] = 1
                else:#xは嘘つきという証言
                    if people[x-1] == 1:
                        flag = False
                        #print("D")
                    else:
                        people[x-1] = 0
    if flag:
        Flag = True
        for i in range(len(people)):
            if people[i] == -1:
                people[i] = 0
            else:
                if truth[i] != str(people[i]):
                    Flag = False
                    break
        #print(*people)
        
        if Flag:
            Honest = max(Honest,sum(people))
print(Honest)
Problem p02862 (python)

Fixed submission:
X,Y = map(int,input().split())
if (X + Y) % 3 != 0:
    print(0)
    exit()
n = (-X+2*Y)//3
m = (2*X-Y)//3
if n < 0 or m < 0:
    print(0)
    exit()

mod = 10**9+7
mod_inv = [0, 1] + [0] * (max(n,m)+3)
for i in range(2, max(n,m)+5):
    mod_inv[i] = - mod_inv[mod % i] * (mod // i) % mod
def comod(n, r, mod):
    ans = 1
    for i in range(r):
        ans *= (n-i) % mod
        ans *= mod_inv[i+1]
        ans %= mod
    return ans
ans = comod(n+m,n,mod)
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y = map(int,input().split())
if (X + Y) % 3 != 0:
    print(0)
    exit()
n = (-X+2*Y)//3
m = (2*X-Y)//3
if n < 0 or m < 0:
    print(0)
    exit()

mod = 10**9+7
mod_inv = [0, 1] + [0] * (min(n,m)+3)
for i in range(2, min(n,m)+5):
    mod_inv[i] = - mod_inv[mod % i] * (mod // i) % mod
def comod(n, r, mod):
    ans = 1
    for i in range(r):
        ans *= (n-i) % mod
        ans *= mod_inv[i+1]
        ans %= mod
    return ans
ans = comod(n+m,n,mod)
print(ans)
Problem p02912 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

for i in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))

Buggy submission (verdict: Runtime Error):
program D
    implicit none
    integer::n,m,i
    real(8)::ans
    real(8),allocatable::a(:)
    read*,n,m
    allocate(a(n))
    read*,a
    if ( n == 1) then
        ans = a(0) * (0.5) ** m
    else
        do i = 0 , m
            a(maxloc(a,1)) = a(maxloc(a,1)) * 0.5
        end do
        ans = sum(a)
    end if
    print*,ans
end program D
Problem p02987 (python)

Fixed submission:
s = str(input())
j = list(set(list(s)))
c1 = j[0]
try:
    c2 = j[1]
except:
    print("No")
    exit()
if len(j) == 2 and s.count(c1) == 2 and s.count(c2) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = str(input())
j = list(set(list(s)))
c1 = j[0]
c2 = j[1]
if len(j) == 2 and s.count(c1) == 2 and s.count(c2) == 2:
    print("Yes")
else:
    print("No")
Problem p02990 (python)

Fixed submission:
n,k = map(int,input().split())
mod = 10**9+7
a = 1
b = n-k+1
for i in range(k):
    ans = a*b % mod
    print(ans)
    a = a * (k-1-i)//(i+1)
    b = b * (n-k-i)//(i+2)

Buggy submission (verdict: Runtime Error):
from math import factorial
def C(n,k):
    return factorial(n)//(factorial(k)*(factorial(n-k)))
mod = 10e9+7
n,k = map(int,input().split())
for i in range(1,k+1):
    print(C(n-k+1,i) * C(k-1,i-1) % (10**9+7))

Buggy submission (verdict: Runtime Error):
from math import factorial
def C(n,k):
    return factorial(n)//(factorial(k)*factorial(n-k))

n,k = map(int,input().split())
for i in range(1,k+1):
    print(C(n-k+1,i) * C(k-1,i-1))
Problem p03042 (python)

Fixed submission:
s = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")

Buggy submission (verdict: Runtime Error):
s = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(str(input()))
A = int(s[0]+s[1])
B = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")
print(ans)
Problem p03077 (python)

Fixed submission:
n = int(input())
L = [int(input()) for i in range(5)]
ans = -(-n //min(L)) + 4
print(ans)

Buggy submission (verdict: Runtime Error):
from math import*
n = int(input())
L = [int(input()) for i in range(5)]
ans = ceil(n //min(L) + 4
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
L = [int(input()) for i in range(5)]
J = [_ for _ in L if _ != 1]
if min(L) != 1:
    ans = n //min(L) + 5
else:
    ans = n // min(J) + L.count(1)*n
print(ans)
Problem p03272 (python)

Fixed submission:
N,i = map(int, input().split())
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N i = map(int, input().split())
print(N-i+1)
Problem p03286 (python)

Fixed submission:
n=int(input())
s=''
while n != 0:
    s = str( n % 2 ) + s
    n = - ( n // 2 )
print(s*(s != '') or 0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M = map(int, input().split(" "))
A = [int(i) for i in input().split()]
count = 0
for i in range(N):
    for k in range(i,N):
        S = sum(A[i:k+1])
        if S % M ==0:
            count = count +1
 
print(count)