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

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

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(n) for n in input().split()]
Hd = []
for i in range(N-1):
    Hd.append(H[i]-H[i+1])
ans_list = [0]*N
J =0
for i in range(N-1):
    if i < J:
        continue
    if Hd[i] >= 0:
        candidate = 1
        for j in range(i+1,N-1):
            if Hd[j] >= 0:
                candidate += 1
            else:
                J = j
                break
        ans_list[i] = candidate
print(max((ans_list)))
Problem p03086 (python)

Fixed submission:
S = input()
import re
regex = re.compile(r"[ATGC]+")
mo = regex.findall(S)
l=[]
for item in mo:
    l.append(len(item))
if l ==[]:
    print("0")
else:
    print(max(l))

Buggy submission (verdict: Runtime Error):
S = input()
import re
regex = re.compile(r"[ATGC]+")
mo = regex.findall(S)
l=[]
for item in mo:
    l.append(len(item))
print(max(l))
Problem p03106 (python)

Fixed submission:
A,B,K = map(int, input().split())
List =[]
for num in range(1,A+1):
  if A%num == 0 and B%num == 0:
    List.append(num)
print(List[-K])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
List =[]
if A==1 or B==1:
  print("1")
for num in range(1,A):
  if A%num == 0 and B%num == 0:
    List.append(num)
print(List[-K])
Problem p03110 (python)

Fixed submission:
N = int(input())
x = []
u = []
for i in range(N):
  x1,u1 = input().split()
  x.append(float(x1))
  u.append(str(u1))
otoshidama = 0.0
for i in range(N):
  if u[i] == "JPY":
    otoshidama += x[i]
  else:
    otoshidama += x[i]*380000.0
print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = []
u = []
for i in range(N):
  x1,u1 = input().split()
  x.append(float(x1))
  u.append(str(u1))
otoshidama = 0.0
for i in range(N):
  if u[i] = "JPY":
    otoshidama += x[i]
  else:
    otoshidama += x[i]*380000.0
print(otoshidama)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = []
u = []
for i in range(N):
  x1,u1 = input().split()
  x.append(float(x1))
  u.append(str(u1))
otoshidama = 0.0
for i in range(N):
  if u[i] = "JPY":
    otoshidama += x[i]
  else:
    otoshidama += x[i]*380000.0
print(otoshidama)
Problem p03145 (python)

Fixed submission:
A = [int(n) for n in input().split()]
print(int(A[0]*A[1]/2))

Buggy submission (verdict: Runtime Error):
A = [int(n) for n in input().split())
print(A[0]*A[1]/2)

Buggy submission (verdict: Runtime Error):
A = input().split()
print(A[0]*A[1]/2)
Problem p03146 (python)

Fixed submission:
s = int(input())
def f(n):
  if n%2 == 0:
    return n/2
  else:
    return 3*n+1
a = []
a.append(s)
for i in range(1,1000001):
  if f(a[i-1]) in a:
    print(i+1)
    break
  else:
    a.append(f(a[i-1]))

Buggy submission (verdict: Runtime Error):
s = input()
def f(n):
  if n%2 == 0:
    return n/2
  else:
    return 3*n+1
a = []
a.append(s)
for i in range(1,1000001):
  if f(a[i-1]) in a:
    print(i)
    break
  else:
    a.append(f(a[i-1]))
Problem p03434 (python)

Fixed submission:
N = int(input())
a = [int(n) for n in input().split()]
a.sort(reverse = True)
Alice = 0
Bob = 0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice - Bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(n) for n in input().split()].sort(Reverse = True)
Alice = 0
Bob = 0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice - Bob)
Problem p03470 (python)

Fixed submission:
N = int(input())
d = []
for i in range(N):
  d.append(int(input()))
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
N = int(input())
d = []
for _ in range(N):
  d.append(int(input())
print(len(set(d)))
Problem p03471 (python)

Fixed submission:
N, Y = map(int,input().split())
for i in range(N+1):
  for j in range(N+1):
    if Y == 10000*i + 5000*j + 1000*(N-i-j) and N-i-j >= 0:
      print(i," ",j," ",N-i-j)
      break
  else:
    continue
  break
else:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int,input().split())
for i in range(N+1):
  for j in range(N+1):
    if Y == 10000*i + 5000*j + 1000*(N-i-j):
      print(i," ",j," ",k)
      break
  else:
    continue
  break
else:
  print("-1 -1 -1")
Problem p03624 (python)

Fixed submission:
alphabet = {1:"a",2:"b"}
backet = [0]*26
S = input()
for char in S:
    backet[ord(char)-97] = 1
if backet == [1]*26:
    print("None")
else:
    print(chr(backet.index(0)+97))

Buggy submission (verdict: Runtime Error):
alphabet = {1:"a",2:"b"}
backet = [0]*26
S = input()
for char in S:
    backet[ord(char)-97] = 1
print(chr(backet.index(0)+97))
Problem p03644 (python)

Fixed submission:
N = int(input())
power = [64,32,16,8,4,2,1]
for i in power:
  if N >= i:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
N = int(input())
power = [64,32,16,8,4,2,1]
for i in power:
  if N <= power:
    print(power)
    break
Problem p03944 (python)

Fixed submission:
import numpy as np
W, H, N = map(int,input().split())
Map = np.ones((H, W),dtype = int)
for i in range(N):
    x,y,a = map(int,input().split())
    if a == 1:
        Map[:,:x] = 0
    elif a == 2:
        Map[:,x:] = 0
    elif a == 3:
        Map[:y,:] = 0
    else:
        Map[y:,:] = 0
print(Map.sum())

Buggy submission (verdict: Runtime Error):
W, H, N = map(int,input().split())
Map = np.ones((H, W),dtype = int)
for i in range(N):
    x,y,a = map(int,input().split())
    if a == 1:
        Map[:,:x] = 0
    elif a == 2:
        Map[:,x:] = 0
    elif a == 3:
        Map[:y,:] = 0
    else:
        Map[y:,:] = 0
print(Map.sum())

Buggy submission (verdict: Runtime Error):
W, H, N = map(int,input().split())
Map = np.ones((H, W),dtype = int)
for i in range(N):
    x,y,a = map(int,input().split())
    if a == 1:
        Map[:,:x] = 0
    elif a == 2:
        Map[:,x:] = 0
    elif a == 3:
        Map[:y,:] = 0
    else:
        Map[y:,:] = 0
print(Map.sum())
Problem p02700 (python)

Fixed submission:
a,b,c,d=map(int, input().split())
while a>0 or c>0:
  c-=b
  a-=d
  if c<=0:
    print('Yes')
    exit()
  elif a<=0:
    print('No')
    exit()

Buggy submission (verdict: Runtime Error):
s,w=map(int, input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')
Problem p02706 (python)

Fixed submission:
n,m=map(int, input().split())
A=list(map(int, input().split()))
t=0
for i in range(m):
  t+=A[i]
if t>n:
  print(-1)
else:
  print(n-t)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
A=list(map(int, input(0.split())))
t=0
for i in range(m):
  t+=A[i]
if t>n:
  print(-1)
else:
  print(n-t)
Problem p02741 (python)

Fixed submission:
S=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(S[k-1])

Buggy submission (verdict: Runtime Error):
S=list(map(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51))
k=int(input())
print(S[k-1])

Buggy submission (verdict: Runtime Error):
S=list(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
k=int(input())
print(S[k-1])
Problem p02853 (python)

Fixed submission:
X=list(map(int, input().split()))
t=0
for i in range(len(X)):
  if X[i]==1:
    t+=300000
  elif X[i]==2:
    t+=200000
  elif X[i]==3:
    t+=100000
if X[0]==X[1] and X[0]==1:
  t+=400000
print(t)

Buggy submission (verdict: Runtime Error):
X=list(map(int, input()))
t=0
for i in range(len(X)):
  if X[i]==1:
    t+=300000
  elif X[i]==2:
    t+=200000
  elif X[i]==3:
    t+=100000
if X[0]==X[1] and X[0]==1:
  t+=400000
print(t)
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())
A=[]
A=[int(input()) for i in range(q)]
#print(A)
B=[]
for i in range(n):
    B.append(-q+k)
#print(B)
for i in A:
    B[i-1]+=1
for i in range(n):
    if B[i]<=0:
        B[i]='No'
    else:
        B[i]='Yes'
C="\n".join(B)
print(C)

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
A=[]
A=[int(input()) for i in range(q)]
B=[]
for i in range(q):
    B.append(-q)
for i in A:
    B[i-1]+=1
for i in range(q):
    if B[i]<=0:
        B[i]='No'
    else:
        B[i]='Yes'
C="\n".join(B)
print(C)
Problem p02988 (python)

Fixed submission:
n=int(input())
p=list(map(int, input().split()))
t=0
for i in range(n):
    if i!=0 and i!=n-1:
      l=[p[i-1], p[i], p[i+1]]
      l.sort()
      if l[1]==p[i]:
          t+=1
print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int, input().split()))
t=0
for i in range(n):
  if i!=0 or i!=n-1:
    l=[p[i-1], p[i], p[i+1]]
    l.sort()
    if l[1]==p[i]:
      t+=1
print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int, input().split()))
t=0
for i in range(n):
  if i!=0 or i!=n-1:
    l=list(p[i-1], p[i], p[i+1])
    l.sort()
    if l[1]==p[i]:
      t+=1
print(t)
Problem p02994 (python)

Fixed submission:
n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=i+1
  else:
    t=min(t, abs(l+(i+1)-1))
    if t==abs(l+(i+1)-1):
      c=i+1
#print(c)
g=0
for i in range(n):
  g+=(l+(i+1)-1)
#print(g)
print(g-l-c+1)

Buggy submission (verdict: Runtime Error):
n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=0
  else:
    t=min(t, abs(l+(i+1)-1))
    if t=abs(l+(i+1)-1):
      c=i+1
g=0
for i in range(n):
  g+=(l+(i+1)-1)
print(g-l-c)
Problem p02999 (python)

Fixed submission:
X,A=map(int, input().split())
if X<A:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
X,A=map(int, input().split())
if X<A:
  print(0)
 else:
  print(10)
Problem p03068 (python)

Fixed submission:
N=int(input())
S=str(input())
K=int(input())
s=list(S)
t=s[K-1]
a=''
for i in range(N):
  if s[i]!=t:
    s[i]='*'
  a+=s[i]
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(input())
K=int(input())
s=list(S)
t=s[K]
a=''
for i in range(N):
  if s[i]!=t:
    s[i]='*'
  a+=s[i]
print(a)
Problem p03102 (python)

Fixed submission:
n,m,c=map(int, input().split())
B=list(map(int, input().split()))
g=0
t=0
for i in range(n):
  A=list(map(int, input().split()))
  for i in range(m):
    t+=A[i]*B[i]
  if t+c>0:
    g+=1
  t=0
print(g)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int, input().split())
B=list(map(int, input().split()))
g=0
for i in range(n):
  A=list(map(int, input().split()))
  for i in range(m):
    t+=A[i]*B[i]
  if t+c>0:
    g+=1
  t=0
print(g)
Problem p03110 (python)

Fixed submission:
n=int(input())
t=0
c=0
for i in range(n):
  x,y=input().split()
  if y=='JPY':
    t+=int(x)
  else:
    c+=float(x)
print(t+c*380000)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=0
for i in range(n):
  x,y=input().split()
  if y=='JPN':
    t+=x
  else:
    t+=x*380000
print(t)
Problem p03239 (python)

Fixed submission:
n,T=map(int, input().split())
m=-1
for i in range(n):
  c,t=map(int, input().split())
  if t<=T:
    if m==-1:
      m=c
    else:
      m=min(m,c)
if m==-1:
  print('TLE')
else:
  print(m)

Buggy submission (verdict: Runtime Error):
n,T=map(int, input().split())
m=-1
for i in range(n):
  c,t=map(int, input().split())
  if t<=T:
    if m=-1:
      m=c
    else:
      m=min(m,c)
if m==-1:
  print('TLE')
else:
  print(m)

Buggy submission (verdict: Runtime Error):
n,T=map(int, input().split())'
m=-1
for i in range(n):
  c,t=map(int, input().split())
  if t<=T:
    if m=-1:
      m=c
    else:
      m=min(m,c)
if m==-1:
  print('TLE')
else:
  print(m)
Problem p03292 (python)

Fixed submission:
A=list(map(int, input().split()))
A.sort()
m=abs(A[0]-A[1])
n=abs(A[1]-A[2])
print(m+n)

Buggy submission (verdict: Runtime Error):
A=list(map(int, input().split()))
A.sort()
m=abs(A1-A2)
n=abs(A2-A3)
print(m+n)
Problem p03316 (python)

Fixed submission:
n=int(input())
s=list(str(n))
S=0
for i in range(len(s)):
  S+=int(s[i])
if n%S==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
S=0
for i in range(len(s)):
  S+=int(s[i])
if n%S==0:
  print('Yes')
elsE:
  print('No')
Problem p03370 (python)

Fixed submission:
N,X=map(int, input().split())
m=[int(input()) for i in range(N)]
t=min(m)
#print(t)
for i in range(N):
    X-=m[i]
if X>=t:
    x=X//t
else:
    x=0
print(N+x)

Buggy submission (verdict: Runtime Error):
N,X=map(int, input().split())
m=[input() for i in range(N)]
t=int(min(m))

for i in range(N):
    X-=int(m[i])
if X>=t:
    x=X//t
print(N+x)
Problem p03416 (python)

Fixed submission:
a,b=map(int, input().split())
c=0
while a<=b:
  s=str(a)
  if s==s[::-1]:
    c+=1
  a+=1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
c=0
while a<=b:
  s=str(a)
  if s==s[::-1]:
    c+=1
  a+=1
print(c)
Problem p03424 (python)

Fixed submission:
n=int(input())
C=list(map(str, input().split()))
c=set(C)
if len(c)==4:
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
n=int(input())
C=list(map(int, input().split()))
c=set(C)
if len(c)==4:
  print('Four')
else:
  print('Three')
Problem p03456 (python)

Fixed submission:
a,b=map(str, input().split())
t=int(a+b)
g=1
while g*g<t:
    g+=1
if g*g==t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=map(str, input().split())
t=a+b
g=1
while g*g<t:
  g+=1
if g*g==t:
  print('Yes')
else:
  print('No')
Problem p03469 (python)

Fixed submission:
s=str(input())
S=list(s)
S[3]='8'
s=''.join(S)
print(s)

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

Fixed submission:
n=int(input())
s=list(str(n))
t=0
for i in range(len(s)):
  t+=int(s[i])
if n%t==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
t=0
for i in range(len(s)):
  t+=int(s[i])
if n%s==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
t=0
for i in range(len(s)):
  t+=s[i]
if n%s==0:
  print('Yes')
else:
  print('No')
Problem p03543 (python)

Fixed submission:
n=str(input())
a=set(n)
p=0
if len(a)==1:
  p=1
elif len(a)==2:
  b=n[0]
  if b==n[1] and b==n[2]:
      p=1
  b=n[1]
  if b==n[2] and b==n[3]:
      p=1
if p==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=str(input())
a=set(n)
p=0
if len(a)==1:
  p=1
elif len(a)==2:
  b=n[0]
  if b==n[1]:
    if b==n[2] or b==n[3]:
        p=1
  elif b==n[2] and b==n[3]:
      p=1
if p=1:
    print('Yes')
else:
    print('No')
Problem p03544 (python)

Fixed submission:
n=int(input())
l=[0]*(n+1)
l[0]=2
l[1]=1
for i in range(n+1):
  if i==0 or i==1:
    continue
  else:
    l[i]=l[i-1]+l[i-2]
print(l[n])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0]*n
l[0]=2
l[1]=1
for i in range(n):
  if i==0 or i==1:
    continue
  else:
    l[i]=l[i-1]+l[i-2]
print(l[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0]*n
l[0]=2
l[1]=1
for i in range(n):
  if i==0 or i==1:
    continue
  else:
    l[i]=l[i-1]+l[i-2]
print(l[n])
Problem p03671 (python)

Fixed submission:
a=list(map(int, input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
sort(a)
print(a[0]+a[1])
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a<b:
  print('LESS')
elif a==b:
  print('EQUAL')
else:
  print('GREATER')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a<b:
  print('LESS')
elif a=b:
  print('EQUAL')
else:
  print('GREATER')
Problem p03760 (python)

Fixed submission:
A=str(input())
B=str(input())
a=list(A)
b=list(B)
t=''
for i in range(len(b)):
  t+=a[i]+b[i]
if len(a)>len(b):
  t+=a[len(a)-1]
print(t)

Buggy submission (verdict: Runtime Error):
A=str(input())
B=str(input())
a=list(A)
b=list(B)
t=''
for i in range(len(a)):
  t+=a[i]+b[i]
if len(a)>len(b):
  t+=a[len(a)-1]
print(t)

Buggy submission (verdict: Runtime Error):
A=str(input())
B=str(input())
a=list(A)
b=list(B)
t=''
for i in range(len(a)+len(b)):
  t+=a[i]+b[i]
if len(a)>len(b):
  t+=a[len(a)-1]
print(t)
Problem p03962 (python)

Fixed submission:
a,b,c=map(int, input().split())
s={a,b,c}
print(len(s))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
s=set(a,b,c)
print(len(set))
Problem p02795 (python)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

big = max(h,w)

count = 0
black = 0
while n > black:
  black += big
  count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
 
ans = []
if k % 2 == 1:
  for _ in range(k):
    ans.append(s)
  while n > len(ans):
    if s == 1000000000:
      ans.append(999999999)
    else:
      ans.append(1000000000)
elif k == 0:
  while n > len(ans):
    if s == 1000000000:
      ans.append(999999999)
    else:
      ans.append(1000000000)
else:
  if s % 2 == 0:
    count = 1
    ans.append(s/2)
    ans.append(s/2)
    while n > count:
      ans.append(s/2)
      count += 1
    while n > len(ans):
      if s == 1000000000:
        ans.append(999999999)
      else:
        ans.append(1000000000)
  else:
    count = 1
    ans.append(1)
    ans.append(s-1)
    while n > count:
      ans.append(1)
      count += 1
      if n > count:
        break
      ans.append(s-1)
      count += 1
    while n > len(ans):
      if s == 1000000000:
        ans.append(999999999)
      else:
        ans.append(1000000000)
 
print(' '.join(map(str, ans)))
Problem p02658 (python)

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

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

A.sort()

ans = 1
for a in A:
  ans = ans * a
  if ans > 1000000000000000000:
    print(-1)
    quit()

print(ans)

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

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

A.sort()

ans = 1
for a in A:
  ans = ans * a
  if ans > 1000000000000000000:
    print -1
    quit()

print(ans)
Problem p02678 (python)

Fixed submission:
N, M = map(int, input().split())
root = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    root[A-1].append(B-1)
    root[B-1].append(A-1)
ans = [[-1, -1] for _ in range(N)]

S = [[0, 0, 0]]

while len(S) > 0:
    S_ = []
    for s in S:
        if ans[s[0]][0] == -1 or s[2] < ans[s[0]][0]:
            ans[s[0]][0] = s[2]
            ans[s[0]][1] = s[1]
            for next in root[s[0]]:
                S_.append([next, s[0], s[2]+1])
    S = S_

print("Yes")
for a in ans[1:]:
    print(a[1]+1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
root = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    root[A-1].append(B-1)
    root[B-1].append(A-1)
ans = [[-1, -1] for _ in range(N)]

def dfs(i, ib, l):
    global ans
    if ans[i][0] == -1 or l < ans[i][0]:
        ans[i][0] = l
        ans[i][1] = ib
        for next in root[i]:
            dfs(next, i, l+1)

dfs(0, 0, 0)
print("Yes")
for a in ans[1:]:
    print(a[1]+1)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = [int(n)-1 for n in input().split()]

pos, root, cnt, lst = 0, {}, 0, []
while True:
    if cnt == K:
        ans = pos + 1
        break
    if pos in root:
        ans = lst[root[pos] + (K-root[pos]) % (cnt-root[pos])] + 1
        break
    root[pos] = cnt
    lst.append(pos)
    cnt += 1
    pos = A[pos]

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(n)-1 for n in input().split()]

def step(pos, root, cnt, k, lst):
    if cnt == k:
        return pos
    if pos in root:
        return lst[root[pos] + (K-root[pos]) % (cnt-root[pos])]
    root[pos] = cnt
    lst.append(pos)
    cnt += 1
    return step(A[pos], root, cnt, k, lst)

print(step(0, {}, 0, K, []) + 1)
Problem p03068 (python)

Fixed submission:
import re
N = input()
S = input().strip()
K = int(input())
print(re.sub("[^" + str(S[K - 1]) + "]", "*", S))

Buggy submission (verdict: Runtime Error):
import re
inp = input().split()
print(re.sub("[^" + str(inp[1][int(inp[2]) - 1]) + "]", "*", inp[1]))
Problem p02678 (python)

Fixed submission:

from collections import deque


def bfs(u):
    queue = deque([u])
    d = [None] * N  # uからの距離の初期化
    d[u] = 0  # 自分との距離は0
    ans = [0] * N
    while queue:
        v = queue.popleft()
        for i in g[v]:

            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
                ans[i] = v + 1
    return ans

N, M = map(int, input().split())
g = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = bfs(0)
if 0 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)

Buggy submission (verdict: Runtime Error):

from collections import deque


def bfs(u):
    queue = deque([u])
    d = [None] * N  # uからの距離の初期化
    d[u] = 0  # 自分との距離は0
    ans = [0] * N
    while queue:
        v = queue.popleft()
        for i in g[v]:

            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
                ans[i] = v + 1
    return ans

N, M = map(int, input().split())
g = [[] for _ in range(M)]

for _ in range(M):
    a, b = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = bfs(0)
if 0 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)
Problem p02755 (python)

Fixed submission:
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
    print(-1)

def main():
    A, B = map(int, input().split())

    solve(A, B)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
	print(-1)


def main():
    A, B = map(int, input().split())

    solve(A, B)

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

Fixed submission:

def solve(N, M, A):

    A = [[int(x[0]), x[1]] for x in A]

    Unsolve = [0]*(N+1)
    Solved = set()
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.add(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def solve(N, M, A):

    Unsolve = [0]*(N+1)
    Solved = []
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.append(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1
    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

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

Fixed submission:
N, K = map(int, input().split())
l = list(map(int, input().split()))
ans = [1 if i >= K else 0 for i in l]
print(sum(ans))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = [map(int, input().spilt())]
ans = [i if i >= K for i in l]
print(len(ans))
Problem p02924 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    ans = (N+1)*(N//2)
    ans -= N
    print(ans)
else:
    x = (N+1)//2
    ans = x + x * ((N-1)//2) * 2
    ans -= N
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

x = np.arange(N)

print(np.sum(x))