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

Fixed submission:
N = int(input())
S = ""
while N != 0:
    if N % 2 != 0:
        N -= 1
        S = "1" + S
    else:
        S = "0" + S
    N //= (-2)
print(S if S != "" else "0")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = ""
while N:
     S = chr(N % (-2)) + S
     N /= (-2)
print(S)
Problem p03774 (python)

Fixed submission:
N, M = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist.index(min(dist))+1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = [list(input().split()) for _ in range(N)]
C = [list(input().split()) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist[dist.index(min(dist))])
Problem p03775 (python)

Fixed submission:
import math
N = int(input())
ans = N
for i in range(1, 1+math.floor(math.sqrt(N))):
    if N % i == 0:
        ans = min(ans, len(str(N//i)))
print(ans)

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

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
ans = math.inf
for i in range(1, 1+math.floor(math.sqrt(N))):
    if N % i == 0:
        ans = min(ans, len(str(N/i)))
print(ans)
Problem p02915 (python)

Fixed submission:
n = int(input())

print(n * n * n)

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

print(n * n * n)
Problem p02951 (python)

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

aa = C - (A - B)

if aa > 0:
  print(aa)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
ans = 0
 
for i in range(1,N+1):
    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)
Problem p02707 (python)

Fixed submission:
n=int(input())
A = list(map(int, input().split()))
list=[0]*(n+2)

for i in range(n-1):
  list[A[i]]+=1
for i in range(1,n+1):
  print(list[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
A = [int(x) for x in input().split()]
list=[]*(n+2)

for i in range(n-1):
  list[A[i]]+=1
for i in range(n+1):
  print(list[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
A = [int(x) for x in input().split()]
list=[]
for i in range(n):
  list.append(0)
for i in range(n-1):
  list[A(i)]+=1
for i in range(n):
  print(list[i])
Problem p02729 (python)

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

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

if N !=0 and N != 1:
    a = combinations_count(N, 2)
else:
    a = 0

if M !=0 and M != 1:
    b = combinations_count(M, 2)
else:
    b = 0

print(a+b)

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

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

if N !=0 and N != 1:
    a = combinations_count(N, 2)
else:
    a = 0

if M !=0 and M != 0:
    b = combinations_count(M, 2)
else:
    b = 0

print(a+b)

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

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

if N !=0 and N != 1:
    a = combinations_count(N, 2)
else:
    a = 0

if M !=0 and M != 0:
    b = combinations_count(M, 2)
else:
    b = 0

print(a+b)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
if A+B == 3:
    print(3)
elif A+B == 4:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if A+B == 3:
    print(3)
elif A+B == 4:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if (A==1) and (B==2):
    print(3)
elif (A==2) and (B==3):
    print(1)
else:
    print(2)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if (A==1) and (B==2):
    print(3)
if (A==2) and (B==3):
    print(1)
if (A==3) and (B==1):
    print(2)
Problem p02832 (python)

Fixed submission:
# そのまま入力文字列の入力
n = int(input())

# 空白区切りの数値をリスト化
an = list(map(int, input().split()))

ans = 0

target = 1
has_ans = False
for i in range(0, n):
    if an[i] == target:
        has_ans = True
        target += 1
    else:
        ans += 1

print(ans if has_ans else "-1")

Buggy submission (verdict: Runtime Error):
# そのまま入力文字列の入力
n = int(input())

# 空白区切りの数値をリスト化
an = list(map(int, input().split()))

ans = 0


def search_and_break(blocks, target):
    global  ans
    position = 0
    if len(blocks) == 0:
        return ans

    for i in range(0, len(blocks)):
        if blocks[i] == target:
            return search_and_break(blocks[(position+1):], target + 1)
        else:
            ans += 1
            position += 1

    return -1


print(search_and_break(an, 1))
Problem p03013 (python)

Fixed submission:
import sys
import heapq

N, M = map(int,input().split())
a_lists = []

if N == 1:
    if M == 0:
        print (1)
        sys.exit()
    else:
        print(0)
        sys.exit()

for m in range (M):
    temp = int(input())
    a_lists.append(temp-1)

a_lists.append(10**6)

datas = [0]*N
if 0 in a_lists:
    datas[0] = 0
    heapq.heappop(a_lists) 
    
else:
    datas[0]=1

if 1 in a_lists:
    datas[1] = 0
    heapq.heappop(a_lists) 
else:
    datas[1]= datas[0]+1
    
heapq.heapify(a_lists)
    
for i in range (2,N):
    if i == a_lists[0]:
        datas[i] =0
        heapq.heappop(a_lists) 
    else:
        datas[i] = datas[i-1] + datas[i -2]

print(datas[-1]%1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
a_lists = []
for m in range (M):
    temp = int(input())
    a_lists.append(temp-1)
    
datas = [0]*N
if 0 in a_lists:
    datas[0] = 0
else:
    datas[0]=1

if 1 in a_lists:
    datas[1] = 0
else:
    datas[1]= datas[0]+1
for i in range (2,N):
    if i in a_lists:
        datas[i] =0
    else:
        datas[i] = datas[i-1] + datas[i -2]

print(datas[-1]%1000000007)
Problem p03127 (python)

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

gcd_result=M[0]
for i in range (N-1):
    before = fractions.gcd(gcd_result,M[i+1])
    gcd_result=before
print(gcd_result)

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

gcd_result=M[0]
for i in range (N-1):
    before = math.gcd(gcd_result,M[i+1])
    gcd_result=before
print(gcd_result)
Problem p03135 (python)

Fixed submission:
T, X = map(int,input().split())
print(T/X)

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

N, K = map(int,input().split())
A = list(map(int,input().split()))
zero_padding = len(bin(max(A))[2:])
add = np.array([0]*zero_padding)
for i in range(len(A)):
    n = i
    n =bin(n)[2:]
    num = list(map(int, str(n)))
    num = [0]*(zero_padding-len(n)) +num
    add = add + np.array(num)
result = [1]*len(bin(9)[2:])
length = min(len(result),len(add))
for j in range (1,length+1):
    if add[-j] <= N//2:
        result[-j] =0 
best = int(''.join(map(str, result)),2)
ans = 0
for i in range (len(A)):
    ans +=int(bin(best ^ A[i]),2)
print(ans)
Problem p03207 (python)

Fixed submission:
N = int(input())
ans = 0
p_max = 0
for i in range(N):
    p = int(input())
    if p > p_max:
        print
        p_max = p
    ans+=p
print(ans-p_max//2)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
p_max = 0
for i in range(N):
    p = int(input())
    if p > p_min:
        print
        p_min = p
    ans+=p
print(ans-p_min//2)
Problem p03315 (python)

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

Buggy submission (verdict: Runtime Error):
S=input()
count=0
for i in range (len(S)):
    count+=int(S[i])
 
if int(S)%count==0:
    print ("Yes")
else:
    print ("No")
Problem p02777 (python)

Fixed submission:
s,t = map(str, input().split())
a,b = map(int, input().split())
u = str(input())

if u == s:
  a = a - 1
elif u == t:
  b = b - 1

print(str(a) + ' ' + str(b))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
 
e = []
 
for i in range(len(p)):
	e.append((1 + p[i]) / 2)

tmp = 0
l = 0
 
while True:
  res = 0
  j = 0
  for j in range(k):
    res = res + e[l + j]
  if tmp < res:
    tmp = res
  l = l + 1
  if l + k > len(e):
    break

print(tmp)
Problem p03426 (python)

Fixed submission:
H, W, D = map(int, input().split())
 
A = [list(map(int, input().split())) for i in range(H)]
rA = [[0 for j in range(2)] for i in range(H * W + 1)]
S = [0 for i in range(H * W + 1)]
for i in range(H):
	for j in range(W):
		rA[A[i][j]][0] = i
		rA[A[i][j]][1] = j
 
Q = int(input())
for i in range(Q):
	L, R = map(int, input().split())
	ans = 0
	for j in range(H * W) [L::D]:
		if j + D > H * W:
			break
		if S[j]:
			ans += S[j]
			break
		S[j] -= ans
		ans += abs(rA[j + D][1] - rA[j][1]) + abs(rA[j + D][0] - rA[j][0])
	for j in range(H * W)[L::D]:
		if S[j] > 0:
			break
		if j + D > H * W:
			break
		S[j] += ans
	print(S[L] - S[R])

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

A = [list(map(int, input().split())) for i in range(H)]
rA = [[0 for j in range(2)] for i in range(H * W + 1)]
S = [0 for i in range(H * W + 1)]
for i in range(H):
	for j in range(W):
		rA[A[i][j]][0] = i
		rA[A[i][j]][1] = j

Q = int(input())
for i in range(Q):
	L, R = map(int, input().split())
	ans = 0
	for j in range(H * W) [L::D]:
		if j == R:
			break
		if S[j]:
			ans += S[j]
			break
		S[j] -= ans
		ans += abs(rA[j + D][1] - rA[j][1]) + abs(rA[j + D][0] - rA[j][0])
	for j in range(H * W)[L::D]:
		if S[j] > 0:
			break
		if j == R
			break
		S[j] += ans
	print (ans)
Problem p02688 (python)

Fixed submission:
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  nlist = [a for a in A if a not in nlist]
print(len(nlist))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

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

nlist = [i for i in range(N)]

for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))
Problem p02689 (python)

Fixed submission:
N,M = map(int,input().split())
H = list(map(int,input().split()))
 
rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1,M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)
  
for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)

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

rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1.M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)

for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)
Problem p02712 (python)

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

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

total = sum([i for i in range(1,N+1) if i%3!=0 and i%5!=0]
print(total)
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):
import sys
S = sys.argv
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
Problem p02689 (python)

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

A = []
B = []
cmb = {}
cnt = 0
flag = 1
ma = [0]*N

for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(i, [])
	cmb.setdefault(a-1, []).append(b-1)
	cmb.setdefault(b-1, []).append(a-1)

	ma[a-1] = max(ma[a-1], H[b-1])
	ma[b-1] = max(ma[b-1], H[a-1])
# print(cmb)

for j in range(N):
	# # print("展望台:", j)
	# k = list(set(cmb[j]))
	# # print(k)
	# if len(cmb[j])==0:
	# 	# print('正しく分岐')
	# 	cnt +=1
	# else:
	# 	# print(H[j], '>', ma[j])

	if H[j] > ma[j]:
		# print('GOOD')
		cnt += 1
print(cnt)

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

A = []
B = []
cmb = {}
cnt = 0
flag = 1
ma = [0]*N

for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(i, [])
	cmb.setdefault(a-1, []).append(b-1)
	cmb.setdefault(b-1, []).append(a-1)

	ma[a-1] = max(ma[a-1], H[b-1])
	ma[b-1] = max(ma[b-1], H[a-1])
# print(cmb)

for j in range(N):
	# print("展望台:", j)
	k = list(set(cmb[j]))
	# print(k)
	if len(cmb[j])==0:
		# print('正しく分岐')
		cnt+=1
	else:
		# print(H[j], '>', ma[j])

		if H[j] > ma[j]:
			# print('GOOD')
			cnt += 1
print(cnt)

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

A = []
B = []
cmb = {}
cnt = 0
flag = 1

for i in range(1, M+1):
	cmb.setdefault(i, [])


for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(a, []).append(b)
	cmb.setdefault(b, []).append(a)

for j in range(1,N+1):
	if len(cmb[j])==0:
		cnt  += 1
	else:
		k = list(set(cmb[j]))
		flag = 1
		for i in range(len(k)):
			if H[j-1] <= H[k[i]]:
				flag = 0
				break;

		if flag  == 1:
			cnt += 1
print(cnt-1)

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

A = []
B = []
cmb = {}
cnt = 0
flag = 1

for i in range(1, M+1):
	cmb.setdefault(i, [])


for i in range(M):
	a,b = map(int,input().split())

	cmb.setdefault(a, []).append(b)
	cmb.setdefault(b, []).append(a)

for j in range(1,N+1):
	if len(cmb[j])==0:
		cnt  += 1
	else:
		k = list(set(cmb[j]))
		flag = 1
		for i in range(len(k)):
			print(j)
			if H[j-1] <= H[k[i]]:
				flag = 0
				break;

		if flag  == 1:
			cnt += 1
print(cnt-1)
Problem p02693 (python)

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

sa = B - A 
flag = 0

for i in range(sa+1):
	if (A+i)%K==0:
		flag = 1
		break

if flag==1:
	print('OK')
else:
	print('NG')

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

sa = B - A 
flag = 0

for i in range(sa+1):
	if (A+i)%K==0:
		flag = 1
		break

if flag==1:
	print('OK')
else:
	print('NG')
Problem p02771 (python)

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

if s[0] == s[1] == s[2]: 
	print("No")
elif s[0] != s[1] != s[2] != s[0]:
	print("No")
else:
	print("Yes")

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

if s[0] == s[1] and s[1] == [2] and s[2] == s[0]: 
	print("No")
else if s[0] != s[1] and s[1] != [2] and s[2] != s[0]:
	print("No")
else:
	print("Yes")
Problem p02773 (python)

Fixed submission:
import collections
S_print = []
N=int(input())
S=[input() for i in range(N)]
S = collections.Counter(S)

S_common = S.most_common()

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

S_print_new = sorted(S_print)
#print(S_print_new)
for i in range(len(S_print_new)):
	print(S_print_new[i])

Buggy submission (verdict: Runtime Error):
import collections

N=int(input())
S=[input() for i in range(N)]
S = sorted(collections.Counter(S))

print_list = []
count = []
S_max = 0

S_common = S.most_common()
#print(S_common)

values, counts = zip(*S_common)
#print(counts[0])

for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])
Problem p02777 (python)

Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
#print(s,t)
#print(a,b)
u = input()
#print(u)

if s == u :
	a = a - 1
elif t == u:
	b = b - 1

print(a, b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')
Problem p02779 (python)

Fixed submission:
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N-1):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')
Problem p02847 (python)

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

Buggy submission (verdict: Runtime Error):
A,B,X = map(int,input().split())
#print(A,B,X)
out=0
for i in range(X):
	num = i
	price = A*num+B*len(str(num)) #Nの金額
	if price < X:
		out = num
	else:
		break

print(out)
Problem p02773 (python)

Fixed submission:
def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1
    max_val = 0
    results = []
    for i in words.keys():
        if words[i] > max_val:
            max_val = words[i]
            results = []
            results.append(i)
        elif words[i] == max_val:
            results.append(i)

            # results = [key
            #            for key in words.keys() if words[key] == max(words.values())]
            # results.sort()
    results.sort()
    print('\n'.join(map(str, results)))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1

    max_val = max(words.values())
    # words_sorted = sorted(words.items(), key=lambda x: x[0])
    for key, value in sorted(words):
        if value != max_val:
            continue
        else:
            print(key)
            # key valueを両方printするとき
            # print('{}:{}'.format(key, value))


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

Fixed submission:
n=input().split()
n=[int(i) for i in n]
h=[0]*n[0]
for i in range(n[0]):
    h[i]=int(input())
h.sort()
q=-1
for i in range(0,len(h)-n[1]+1):
    a=h[i+n[1]-1]-h[i]
    if q==-1 or q>a:
        q=a
print(q)

Buggy submission (verdict: Runtime Error):
n=input().split()
n=[int(i) for i in n]
h=[0]*n[0]
for i in range(n[0]):
    #h.append(int(input()))
    h[i]=int(input())
h.sort()

q=-1
for i in range(len(h)):
    a=h[i+n[1]-1]-h[i]
    if q==-1 or q>a:
        q=a
    if q==0:
        break
print(q)

Buggy submission (verdict: Runtime Error):
=input().split()
n=[int(i) for i in n]
h=[n[1]]
for i in range(n[0]):
    h[i]=int(input())
h.sort()

q=-1
for i in range(len(h)):
    a=h[i+n[1]-1]-h[i]
    if q==-1 or q>a:
        q=a
    if q==0:
        break
print(q)

Buggy submission (verdict: Runtime Error):
n=input().split()
n=[int(i) for i in n]
h=[]
for i in range(n[0]):
    h.append(int(input()))
h.sort()

q=-1
for i in range(len(h)):
    a=h[i+n[1]-1]-h[i]
    if q==-1 or q>a:
        q=a
    if q==0:
        break
print(q)

Buggy submission (verdict: Runtime Error):
n=input().split()
n=[int(i) for i in n]
h=[]
for i in range(n[0]):
    h.append(int(input()))
h.sort()

q=-1
for i in range(len(h)):
    if q==-1 or q>h[i+n[1]-1]-h[i]:
        q=h[i+n[1]-1]-h[i]
    if q==0:
        break
print(q)
Problem p02970 (python)

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

if N % (2*D+1) == 0:
    print(N // (2*D+1))
else:
    print(N// (2*D+1) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = int(input())
if N % (2*D+1) == 0:
    print(N // (2*D+1))
else:
    print(N// (2*D+1) + 1)
Problem p02987 (python)

Fixed submission:
S = list(input())
for i in range(4):
    if not S.count(S[i]) == 2:
        print('No')
        exit()

print('Yes')

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

C = N-K+1
D = 1
for i in range(1, K+1):
    if N-K+1 < i:
        print(0)
    else:
        ans = (C*D)%(10**9+7)
        print(ans)
    #print(C,D)
    C = C*(N-K-i+1)//(i+1)
    D = D*(K-i)//i
Problem p02990 (python)

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

C = N-K+1
D = 1
for i in range(1, K+1):
    if N-K+1 < i:
        print(0)
    else:
        ans = (C*D)%(10**9+7)
        print(ans)
    #print(C,D)
    C = C*(N-K-i+1)//(i+1)
    D = D*(K-i)//i

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

C = N-K+1
D = 1
for i in range(1, K+1):
    if N-K+1 < i:
        print(0)
    else:
        ans = (int(C*D))%(10**9+7)
        print(ans)
    #print(C,D)
    C = C*(N-K-i+1)/(i+1)
    D = D*(K-i)/i
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())
print(min(P+Q, Q+R, R+P))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
status = [True]*(N+2)
for _ in range(M):
    status[int(input())] = False

dp = [0]*(N+2)
dp[0] = 1
for i in range(N):
    if status[i+1]:
        dp[i+1] += dp[i]
    if status[i+2]:
        dp[i+2] += dp[i]
print(dp[N])