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

Fixed submission:
from fractions import gcd
import copy

n = int(input())
a_list = list(map(int, input().split()))

ans_list = []
l_list = [0]*(n+1)
r_list = [0]*(n+1)

for i in range(n):
    l_list[i+1] = gcd(l_list[i], a_list[i])
    r_list[n-i-1] = gcd(r_list[n-i], a_list[n-i-1])

ans_list = []
for j in range(n):
    ans_list.append(gcd(l_list[j], r_list[j+1]))

#print(ans_list)

print(max(ans_list))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
import copy

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())
a_list = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    tmp_list = copy.copy(a_list)
    tmp_list.pop(i)
    #print(tmp_list)
    tmp = gcd(*tmp_list)
    #print(tmp)
    if tmp > ans:
        ans = tmp
    
print(ans)

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

if N == 2:
    print(max(A))

else:
    pn = primes(max(A))
    ans_num = 0
    ans = 1
    for i in pn:
        count = 0
        for j in range(N):
            if A[j] % i != 0:
                count += 1
        
        if count < N-1:
            ans *= i


    print(str(ans))
Problem p03139 (python)

Fixed submission:
n = input().split()
N = int(n[0])
A = int(n[1])
B = int(n[2])

if A > B:
    a = A
    b = B
elif A < B:
    a = B
    b = A
elif A == B:
    a = A
    b = B

if a != b:
    if a+b <= N:
        print(str(b) + ' ' + str(0))
    elif a+b > N:
        print(str(b) + ' ' + str(a - (N-b)))
elif a+b <= N:
    print(str(a) + ' ' + str(0))
elif a+b > N:
    print(str(a) + ' ' + str(a-(N-b)))

Buggy submission (verdict: Runtime Error):
n = input().split()
N = int(n[0])
A = int(n[1])
B = int(n[2])

if A > B or A == B:
    a = A
    b = B
elif B < A:
    a = B
    b = A

if a != b:
    if a+b < N:
        print(str(b) + ' ' + str(0))
    elif a+b > N:
        print(str(b) + ' ' + str(a - (N-b)))
elif a < N//2:
    print(str(a) + ' ' + str(0))
elif a > N//2:
    print(str(a) + ' ' + str(a-(N-b)))
Problem p03304 (python)

Fixed submission:
N = input().split()

n = float(N[0])
m = float(N[1])
d = float(N[2])

#max_point = m-1
#total = n**m
#total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))

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

n = float(N[0])
m = float(N[1])
d = float(N[2])

max_point = m-1
total = n**m
total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))
Problem p03289 (python)

Fixed submission:
from sys import stdin

S = stdin.readline().rstrip()

cond1 = S[0] == 'A'
cond2 = S.count('C', 2, -1) == 1
cond3 = S.replace('A', '').replace('C', '').islower()

if cond1 and cond2 and cond3:
    print('AC')
else:
    print('WA')

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

if S[0] == 'A' and S[2:-1].count('C') == 1 and sum([c.isupper for c in S]) == 2:
    print('AC')
else:
    print('WA')
Problem p03206 (python)

Fixed submission:
D = int(input())
print('Christmas' + ' Eve' * (25 - D))

Buggy submission (verdict: Runtime Error):
D = int(input)
print('Christmas' + ' Eve' * (25 - D))
Problem p03223 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    global n
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = min(n // 2 + offset, n - 1)
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

def f(a, offset=0):
    ans = 0
    # if len(a) % 2 == 0:
    #     last = a[0]
    # else:
    init = n // 2 + offset
    last = a[init]
    for i in range(n - 1):
        j = i // 2 if i % 2 == 0 else n - 1 - i // 2
        if j == init:
            break
        ans += abs(a[j] - last)
        last = a[j]
    return ans

# print(f(sorted(a)))
# print(f(sorted(a, reverse=True)))
a = sorted(a)
arev = sorted(a, reverse=True)
print(max(
    f(a),
    f(arev),
    f(a, offset = 1),
    f(arev, offset = 1),
))
Problem p03246 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l1 = [li for i, li in enumerate(l) if i % 2 == 0]
l2 = [li for i, li in enumerate(l) if i % 2 == 1]
def cnt(l):
    d = {}
    for li in l:
        if li in d:
            d[li] += 1
        else:
            d[li] = 1
    d = [(li, cnt) for li, cnt in d.items()]
    return sorted(d, key=lambda di: di[1], reverse=True)

k1 = cnt(l1)[:2]
k2 = cnt(l2)[:2]
ans = 10000000
if k1[0][0] != k2[0][0]:
    ans = n - k1[0][1] - k2[0][1]
if len(k1) == 2:
    ans = min(ans, n - k1[1][1] - k2[0][1])
if len(k2) == 2:
    ans = min(ans, n - k1[0][1] - k2[1][1])
if ans == 10000000:
    ans = n - max(k1[0][1], k2[0][1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
l1 = [li for i, li in enumerate(l) if i % 2 == 0]
l2 = [li for i, li in enumerate(l) if i % 2 == 1]
print(l1, l2)
def cnt(l):
    d = {}
    for li in l:
        if li in d:
            d[li] += 1
        else:
            d[li] = 1
    d = [(li, cnt) for li, cnt in d.items()]
    d = sorted(d, key=lambda di: di[0], reversed=True)
    return d

k1 = cnt(l1)[:2]
k2 = cnt(l2)[:2]

ans = 10000000
if k1[0][0] != k2[0][0]:
    ans = n - k1[0][1] - k2[0][1]
else:
    if len(k1) == 2:
        ans = n - k1[1][1] - k2[0][1]
    if len(k2) == 2:
        ans = min(ans, n - k1[0][1] - k2[0][1])
    if ans == 10000000:
        ans = n - max(k1[0][1], k2[0][1])
print(ans)
Problem p03304 (python)

Fixed submission:
n, m, d = map(int, input().split())
if d == 0:
    ans = n * (m - 1) / (n * n)
else:
    ans = 2 * (n - d) * (m - 1) / (n * n)
print('{0:.10f}'.format(ans))

Buggy submission (verdict: Runtime Error):
n, m, d = map(int, input().split())
if d == 0:
    print(f'{n * (m - 1) / (n * n):.10f}')
else:
    print(f'{2 * (n - d) * (m - 1) / (n * n):.10f}')
Problem p03393 (python)

Fixed submission:
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(i + ord('a'))
        if c not in S:
            print(S + c)
            break
else:
    tmp = 26
    for i in range(len(S) - 1, 0, -1):
        if ord(S[i - 1]) < ord(S[i]):
            break
        tmp = i
    tmp -= 1
    if tmp == 0:
        print(-1)
    else:
        c = ord(S[:tmp][-1])
        suf = S[tmp:]
        print(S[:tmp - 1] + chr(min([ord(si) for si in suf if ord(si) > c])))

Buggy submission (verdict: Runtime Error):
S = input()
if len(S) < 26:
    for i in range(26):
        c = chr(i + ord('a'))
        if c not in S:
            print(S + c)
            break
else:
    tmp = 26
    for i in range(len(S) - 1, 0, -1):
        if ord(S[i - 1]) < ord(S[i]):
            break
        tmp = i
    tmp -= 1
    if tmp == 0:
        print(-1)
    c = ord(S[:tmp][-1])
    suf = S[tmp:]
    print(S[:tmp - 1] + chr(min([ord(si) for si in suf if ord(si) > c])))
Problem p03469 (python)

Fixed submission:
s = input()
s = s[0:3] + '8' + s[4:]
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)
Problem p03671 (python)

Fixed submission:
x = [int(i) for i in input().split(" ")]
x.sort()
print(x[0] + x[1])

Buggy submission (verdict: Runtime Error):

N = int(input())
inp = [int (x) for x in input().split(" ")]

refs = [0 for _ in range(N)]
k = len(inp) - 1
rev = True
for i in range(N):
    refs[i] = k
    if k == 1 and rev:
        k = -2
        rev = False
    if k == 0 and rev:
        k = -1
        rev = False
    k = k - 2 if rev else k + 2

#print(" ".join([str(x) for x in refs]))


for i in range(N):
    refs[i] = inp[refs[i]]

print(" ".join([str(x) for x in refs]))
Problem p03729 (python)

Fixed submission:
words = input().split(" ")

shiritori = "YES"

end = None

for word in words:
	if end is not None:
		if end != word[0]:
			shiritori = "NO"
			break
	end = word[-1]

print(shiritori)

Buggy submission (verdict: Runtime Error):
# input
NW = [int(x) for x in input().split(" ")]
N = NW[0]
W = NW[1]

w = []
v = []

for _ in range(N):
	wv = [int(x) for x in input().split(" ")]
	w.append(wv[0])
	v.append(wv[1])

# 品物i-Nまでを使って容量Wのナップサックにいれられる品物の価値の総和の最大値
def rec(i, Wrec):
	if i >= N:
		return 0

	a = -1
	if Wrec - w[i] >= 0:
		a = v[i]+rec(i+1, Wrec-w[i])
	return max(
		a, #品物iを入れる
		rec(i+1, Wrec) #品物iを入れない
		)

print(rec(0,W))

Buggy submission (verdict: Runtime Error):

T = int(input().split(" ")[1])
t = [int(x) for x in input().split(" ")]
t.append(100000000000)

ret = 0

for i in range(len(t)-1):
	ret += min(T,t[i+1] - t[i])

print(ret)
Problem p03738 (python)

Fixed submission:

A = int(input())
B = int(input())


if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")

Buggy submission (verdict: Runtime Error):
inputs = [int(x) for x in input().split(" ")]
A = inputs[0]
B = inputs[1]


if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")
Problem p03759 (python)

Fixed submission:
(A, B, C) = [int(x) for x in input().split(" ")]

if B - A == C - B:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
(A, B, C) = [int(x) for x in input().split(" ")]

if b - a == c - b:
	print("YES")
else:
	print("NO")
Problem p03854 (python)

Fixed submission:
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')

Buggy submission (verdict: Runtime Error):
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) >= 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if len(S) >= 6 and S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    print(S)
print('YES')

Buggy submission (verdict: Runtime Error):
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if len(S) > 8 and S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')

Buggy submission (verdict: Runtime Error):
import sys

S = input()

while S:
    prefix = S[0:5]
    if prefix == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else:
                S = S[7:]
        else:
            S = S[5:]
    elif prefix == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else:
            S = S[5:]
    else:
        print('NO')
        sys.exit(0)
    # print(S)
print('YES')
Problem p02743 (python)

Fixed submission:
import math
a,b,c=map(int, input().split())


if c-a-b<0:
  print('No')

elif 4*b*a<(c-a-b)**2:
  print('Yes')
else:
  print('No')

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

if a+2*math.sqrt(a*b)+b<c:
  print('Yes')
else:
  print('No')
Problem p02787 (python)

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

dp=[10**10]*(H+1)
dp[0]=0
for n in range(N):
  a,b=map(int, input().split())
  A.append(a)
  B.append(b)
    
for h in range(1,H+1):
  for n in range(N):
    if h-A[n]>=0:
      dp[h]=min(dp[h],dp[h-A[n]]+B[n])
    else:
      dp[h]=min(dp[h],B[n])
print(dp[H])

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



MAX=10**4+1
def solve(r,idx):
  if idx==N:
    return MAX
  if r%A[idx][1]==0:
    return (r//A[idx][1])*A[idx][2]
  else:
    return min((r//A[idx][1]+1)*A[idx][2],(r//A[idx][1])*A[idx][2]+solve(r%A[idx][1],idx+1))

def main():
  A=[]
  B=[]
  for i in range(N):
    a,b=map(int, input().split())
    A.append([a/b,a,b])
  if N==1:
    if H%A[0][1]==0:
    	print((H//A[0][1])*A[0][2])
    else:
    	print((H//A[0][1]+1)*A[0][2])
    return
  A=sorted(A)[::-1]

  if H%A[0][1]==0:
    print((H//A[0][1])*A[0][2])
  else:
    ans=min((H//A[0][1]+1)*A[0][2],(H//A[0][1])*A[0][2]+solve(H%A[0][1],1))
    print(ans)

main()

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



MAX=10**4+1
def solve(r,idx):
  if idx==N:
    return MAX
  if r%A[idx][1]==0:
    return (r//A[idx][1])*A[idx][2]
  else:
    return min((r//A[idx][1]+1)*A[idx][2],(r//A[idx][1])*A[idx][2]+solve(r%A[idx][1],idx+1))


A=[]
B=[]
for i in range(N):
  a,b=map(int, input().split())
  A.append([a/b,a,b])
if N==1:
  if H%A[0][1]==0:
  	print((H//A[0][1])*A[0][2])
  else:
 	print((H//A[0][1]+1)*A[0][2])
  return
A=sorted(A)[::-1]

if H%A[0][1]==0:
  print((H//A[0][1])*A[0][2])
else:
  ans=min((H//A[0][1]+1)*A[0][2],(H//A[0][1])*A[0][2]+solve(H%A[0][1],1))
  print(ans)

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



MAX=10**4+1
def solve(r,idx):
  if idx==N:
    return MAX
  if r%A[idx][1]==0:
    return (r//A[idx][1])*A[idx][2]
  else:
    return min((r//A[idx][1]+1)*A[idx][2],(r//A[idx][1])*A[idx][2]+solve(r%A[idx][1],idx+1))

def main():
  A=[]
  B=[]
  for i in range(N):
    a,b=map(int, input().split())
    A.append([a/b,a,b])
  if N==1:
    if H%A[0][1]==0:
    	print((H//A[0][1])*A[0][2])
  	else:
    	print((H//A[0][1]+1)*A[0][2])
    return
  A=sorted(A)[::-1]

  if H%A[0][1]==0:
    print((H//A[0][1])*A[0][2])
  else:
    ans=min((H//A[0][1]+1)*A[0][2],(H//A[0][1])*A[0][2]+solve(H%A[0][1],1))
    print(ans)

main()

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

A=[]
B=[]
for i in range(N):
  a,b=map(int, input().split())
  A.append([a/b,a,b])
A=sorted(A)
a=A[0][1]
b=A[0][2]
B.append([a/b,a,b])
new_N=1
for i in range(1,N):
  if a/b !=A[i][1]/A[i][2]:
    a=A[i][1]
    b=A[i][2]
    B.append([a/b,a,b])
    new_N+=1

A=B[::-1]
MAX=10**4+1
N=new_N
def solve(r,idx):
  if idx==N:
    return MAX
  if r%A[idx][1]==0:
    return (r//A[idx][1])*A[idx][2]
  else:
    return min((r//A[idx][1]+1)*A[idx][2],(r//A[idx][1])*A[idx][2]+solve(r%A[idx][1],idx+1))

if H%A[0][1]==0:
  print((H//A[0][1])*A[0][2])
else:
  ans=min((H//A[0][1]+1)*A[0][2],(H//A[0][1])*A[0][2]+solve(H%A[0][1],1))
  print(ans)
Problem p02813 (python)

Fixed submission:
from itertools import permutations as p
N=int(input())
l=list(p(range(1,N+1)))

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

fa=True
fb=True
for i in range(len(l)):
  if l[i]==A and fa:
    idx_a=i
    fa=False
  if l[i]==B and fb:
    idx_b=i
    fb=False
  if (not fa) and (not fb):
    break
print(abs(idx_a-idx_b))

Buggy submission (verdict: Runtime Error):
from itertools import permutations as p
N=int(input())
l=list(p(range(1,N+1)))

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

fa=True
fb=True
for i in range(len(l)):
  if l[i]==A and fa:
    idx_a=i
    fa=False
  elif l[i]==B and fb:
    idx_b=i
    fb=False
  if (not fa) and (not fb):
    break
print(abs(idx_a-idx_b))
Problem p02861 (python)

Fixed submission:
import os
import math
import itertools
import numpy as np

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)

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

N=int(input())
A=np.zeros((8,2)).astype(int)
for i in range(N):
  temp=list(map(int, input().split()))
  A[i,0]=temp[0]
  A[i,1]=temp[1]


  
def distance(x1,y1,x2,y2):
  return math.sqrt((x1-x2)**2+(y1-y2)**2)



order=list(itertools.permutations(range(N)))

tab=np.zeros((N,N))
for i in range(N):
  for j in range(i+1,N):
    tab[i,j]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    tab[j,i]=distance(A[i,0],A[i,1],A[j,0],A[j,1])
    
ret=0
C=math.factorial(N)      
for i in range(C):
  o=order[i]
  for j in range(1,N):
    ret+=tab[o[j],o[j-1]]
print(ret/C)
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
a=input().split()
sum=0
for i in a:
  sum+=int(int(i)>=k)
print(sum)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a=input().split()
sum=0
for i in a:
  sum+=int(a)>=k
print(sum)
Problem p02909 (python)

Fixed submission:
w=input()

if w=='Sunny':
  print('Cloudy')

elif w=='Cloudy':
  print('Rainy')

else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
if input()=='Sunny':
  print('Cloudy')

elif input()=='Cloudy':
  print('Rainy')

else:
  print('Sunny')
Problem p02910 (python)

Fixed submission:
line=input()

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if not flag:
    break
  if (i+1)%2==1:
    if line[i] not in a:
      flag=False
      print('No')
  else:
    if line[i] not in b:
      flag=False
      print('No')
if flag==True:
  print('Yes')

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

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if (i+1)%2==1:
    if line[i] not in a:
      fline=input()

a=['R','U','D']
b=['L','U','D']
flag=True

for i in range(len(line)):
  if not flag:
    print(flag)
    break
  if (i+1)%2==1:
    if line[i] not in a:
      flag=False
      print('No')
  else:
    if line[i] not in b:
      flag=False
      print('No')
if flag==True:
  print('Yes') lag==False
      print('No')
      break
  else:
    if line[i] not in b:
      flag==False
      print('No')
      break

if flag:
  print('Yes')
Problem p02911 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

p=[-Q]*N

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1

for i in range(N):
  if p[i]+K<1:
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

import numpy as np
p=np.zeros(N).astype(int)+K

for i in range(Q):
  j=int(input())-1
  p[j]=p[j]+1
  p=p-1
  
for i in range(N):
  if p[i]<1:
    print('No')
  else:
    print('Yes')
Problem p03565 (python)

Fixed submission:

def main():
  S_=input()
  T=input()
  ans=''
  if len(S_)<len(T):
    print('UNRESTORABLE')
    return
  for i in range(len(S_)-len(T)+1):
    flag=True
    for j in range(len(T)):
      if S_[i+j]!='?' and S_[i+j]!=T[j]:
        flag=False
        break
    if flag:
      S=['a']*len(S_)
      for k in range(i):
        if S_[k]!='?':
          S[k]=S_[k]
      for k in range(i,i+len(T)):
        S[k]=T[k-i]
      for k in range(i+len(T),len(S_)):
        if S_[k]!='?':
          S[k]=S_[k]
      if ans=='':
        ans=''.join(S)
      elif ans>''.join(S):
        ans=''.join(S)
  if ans=='':
    print('UNRESTORABLE')
  else:
    print(ans)
  return

main()

Buggy submission (verdict: Runtime Error):

def main():
  S_=input()
  T=input()
  U=[]
  if len(S_)<len(T):
    print('UNRESTORABLE')
    return
  for i in range(len(S_)-len(T)+1):
    flag=True
    for j in range(len(T)):
      if S_[i+j]!='?' and S_[i+j]!=T[j]:
        flag=False
        break
    if flag:
      S=['a']*len(S_)
      for k in range(i):
        if S_[k]!='?':
          S[k]=S_[k]
      for k in range(i,i+len(T)):
        S[k]=T[k-i]
      for k in range(i+len(T),len(S_)):
        if S_[k]!='?':
          S[k]=S_[k]
      if ans=='':
        ans=''.join(S)
      elif ans>''.join(S):
        ans=''.join(S)
  if ans=='':
    print('UNRESTORABLE')
  else:
    print(ans)
  return

main()

Buggy submission (verdict: Runtime Error):

def main():
  S_=input()
  T=input()
  U=[]
  if len(S_)<len(T):
    print('UNRESTORABLE')
    return
  for i in range(len(S_)-len(T)+1):
    flag=True
    for j in range(len(T)):
      if S_[i+j]!='?' and S_[i+j]!=T[j]:
        flag=False
        break
    if flag:
      S=['a']*len(S_)
      for k in range(i):
        if S_[k]!='?':
          S[k]=S_[k]
      for k in range(i,i+len(T)):
        S[k]=T[k-i]
      for k in range(i+len(T),len(S_)):
        if S_[k]!='?':
          S[k]=S_[k]
      if ans=='':
        ans=''.join(S)
      elif ans>''.join(S):
        ans=''.join(S)
  if ans=='':
    print('UNRESTORABLE')
  else:
    print(ans)
  return

main()

Buggy submission (verdict: Runtime Error):

def main():
  S_=input()
  T=input()
  U=[]
  if len(S_)<len(T):
    print('UNRESTORABLE')
    return
  for i in range(len(S_)-len(T)+1):
    flag=True
    for j in range(len(T)):
      if S_[i+j]!='?' and S_[i+j]!=T[j]:
        flag=False
        break
    if flag:
      S=['a']*len(S_)
      for k in range(i):
        if S_[k]!='?':
          S[k]=S_[k]
      for k in range(i,i+len(T)):
        S[k]=T[k-i]
      for k in range(i+len(T),len(S_)):
        if S[k]_!='?':
          S[k]=S_[k]
      if ans=='':
        ans=''.join(S)
      elif ans>''.join(S):
        ans=''.join(S)
  if ans=='':
    print('UNRESTORABLE')
  else:
    print(ans)
  return

main()
Problem p02612 (python)

Fixed submission:
N=int(input())
if N%1000>0:
  print(1000-N%1000)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
if 1000-N%1000>0:
  print(1000-N%1000)
else print(0)

Buggy submission (verdict: Runtime Error):
N=int(inpuit())
print(1000-N%1000)
Problem p02612 (python)

Fixed submission:
N = int(input())
if(N%1000==0):
	print("0")
else:
  	print(1000-N%1000)

Buggy submission (verdict: Runtime Error):
AC = 0
WA = 0
TLE = 0
RE = 0
N = int(input())
for i in range(N):
	a = input()
	if(a == "AC"):
		AC = AC + 1
	if(a == "WA"):
 		WA = WA + 1
	if(a == "TLE"):
		TLE = TLE + 1
	if(a=="RE"):
		RE = RE + 1
print("AC x "+ str(AC))
print("WA x "+ str(WA))
print("TLE x "+ str(TLE))
print("RE x "+ str(RE))

Buggy submission (verdict: Runtime Error):
AC = 0
WA = 0
TLE = 0
RE = 0
N = int(input())
for i in range(N):
	a = input()
	if(a == "AC"):
		AC = AC + 1
	if(a == "WA"):
 		WA = WA + 1
	if(a == "TLE"):
		TLE = TLE + 1
	if(a=="RE"):
		RE = RE + 1
print("AC x "+ str(AC))
print("WA x "+ str(WA))
print("TLE x "+ str(TLE))
print("RE x "+ str(RE))