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

Fixed submission:
N = list(input())
n = 0

S = 0
for i in range(len(N)):
    S = S + int(N[i])
    n = (int(N[i]) * (10 ** (len(N) - i - 1))) + n
    
if n % S == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = list(input())
n = 0

S = 0
for i in range(len(N)):
    S = S + int(N[i])
    n = (int(N[i])999999999 * (10 ** (len(N) - i - 1))) + n
    
if n % S == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = list(input())
n = 0

S = 0
for i in range(len(N)):
    S = S + int(N[i])
    n = (int(N[i])999999999 * (10 ** (len(N) - i - 1))) + n
    
if n % S == 0:
    print('Yes')
else:
    print('No')
Problem p02772 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
A = map(int, input().split())

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        print("DENIED")
        exit()
print("APPROVED")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = map(int, input().split())

success =
for a in A:
    if a % 2  == 0 and (a % 3 == 0 or a % 5 ==0):
        print("DENIED")

print("APPROVED")
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
if N!=0:
    p=list(map(int,input().split()))
    checkNum=[0 for j in range(102)]
    for i in range(len(p)):
        checkNum[p[i]]=1
    i=0
    while(X-i>=0 or X+i<=101):
        if X-i>=0:
            if checkNum[X-i]==0:
                print(X-i)
                break
        if X+i<=101:
            if checkNum[X+i]==0:
                print(X+i)
                break
        i+=1
else:
    print(X)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N!=0:
    p=list(map(int,input().split()))
    checkNum=[0 for j in range(101)]
    for i in range(len(p)):
        checkNum[p[i]]=1
    i=0
    while(X-i>=0 or X+1<101):
        if checkNum[X-i]==0:
            print(X-i)
            break
        if checkNum[X+i]==0:
            print(X+i)
            break
        i+=1
else:
    print(X)
Problem p02696 (python)

Fixed submission:
import math
A, B, N = map(int, input().split())
x=N
if N>B-1:
    x=B-1
print(math.floor(A*x/B)-A*math.floor(x/B))

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
if math.floor(N/B)>math.floor(N/(B-1)):
    print(math.floor(A*N/B)-A*math.floor(N/(B-1)))
else:
    print(math.floor(A*N/B)-A*math.floor(N/B))
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
41 59 31
Problem p02756 (python)

Fixed submission:
Query=list(input())
Q=int(input())
flag = True
strF=[]
strB=[]
for i in range(Q):
  S2=input()
  if S2=="1":
    flag = not flag
  else:
    x=S2.split()
    if flag:
      if x[1]=="1":
        strF.append(x[2])
      else:
        strB.append(x[2])
    else:
      if x[1]=="1":
        strB.append(x[2])
      else:
        strF.append(x[2])

if flag:
  strF.reverse()
  Query=strF+Query+strB
else:
  strB.reverse()
  Query.reverse()
  Query=strB+Query+strF
 
print("".join(Query))

Buggy submission (verdict: Runtime Error):
Query=list(input())
Q=int(input())
flag = True
strF=[]
strB=[]
for i in range(Q):
  S2=input()
  if S2=="1":
    flag = not flag
  else:
    x=S2.split()
    if flag:
      if x[1]=="1":
        strF.append(x[2])
      else:
        strB.append(x[2])
    else:
      if x[1]=="1":
        strB.append(x[2])
      else:
        strF.append(x[2])

if flag:
  strF.reverse()
  Query=strF+Query+strB
else:
  strB.reverse()
  Query=strB+Query.reverse()+strF
 
print("".join(Query))

Buggy submission (verdict: Runtime Error):
S = input()
Q=int(input())
Query=[S]
flag = True
strF=[]
strB=[]
for i in range(Q):
  S2=input()
  if S2=="1":
    flag = not flag
  else:
    x=S2.split()
    if flag:
      if x[1]=="1":
        strF.append(x[2])
      else:
        strB.append(x[2])
    else:
      if x[1]=="1":
        strB.append(x[2])
      else:
        strF.append(x[2])

if flag:
  strF.reverse()
  Query=strF+Query+strB
else:
  strB.reverse()
  Query=strB+Query.reverse()+strF
 
print("".join(Query))

Buggy submission (verdict: Runtime Error):
S = input()
Q=int(input())
Query=S
flag = True
for i in range(Q):
  S2=input()
  if S2=="1":
    flag = not flag
  else:
    x=S2.split()
    if flag:
      if x[1]=="1":
        Query=x[2]+Query
      else:
        Query=Query+x[2]
    else:
      if x[1]=="1":
        Query=Query+x[2]
      else:
        Query=x[2]+Query
if flag==False:
  Query.reverse()

print(Query)
Problem p02772 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
flag=True
for i in range(N):
    if A[i]%2==0:
        if (A[i]%3==0 or A[i]%5==0)==False:
            flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A==B==C:
  print("No")
elif A!=B!=C:
  print("No")
else:
  print("Yes")
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
S=[[0, ""] for j in range(M)]
ACcheck=[False for j in range(N)]
AC=0
WA=[0 for j in range(N)]
WA2 = 0
for i in range(M):
  ps = input().split()
  S[i][0]=int(ps[0])
  S[i][1]=ps[1]
for i in range(M):
  if S[i][1]=="AC":
    if ACcheck[S[i][0]-1]==False:
      AC+=1
      ACcheck[S[i][0]-1]=True
      WA2+=WA[S[i][0]-1]
  else:
    if ACcheck[S[i][0]-1]==False:
      WA[S[i][0]-1]+=1

print(AC, WA2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S=[[0, ""] for j in range(M)]
ACcheck=[False for j in range(N)]
AC=0
WA=[0 for j in range(N)]
WA2 = 0
for i in range(M):
  ps = input().split()
  S[i][0]=int(ps[0])
  S[i][1]=ps[1]
for i in range(M):
  if S[i][1]=="AC":
    if ACcheck[S[i][0]-1]==False:
      AC+=1
      ACcheck[S[i][0]-1]=True
      WA2+=WA[S[i][0]]
  else:
    if ACcheck[S[i][0]-1]==False:
      WA[S[i][0]]+=1

print(AC, WA2)
Problem p03076 (python)

Fixed submission:
a=list()
for i in range(5):
  a.append(int(input()))
flag=True
count2=0
for i in range(5):
  if a[i]%10==0:
    count2+=a[i]
  else:
    flag=False
if flag==False:
  max=10
  count=0
  for i in range(5):
    if a[i]%10<max and a[i]%10!=0:
      max=a[i]%10
      maxI=i
  for i in range(5):
    if i!=maxI:
      count+=a[i]
      if a[i]%10!=0:
        count+=(10-a[i]%10)
  count+=a[maxI]
  print(count)
else:
  print(count2)

Buggy submission (verdict: Runtime Error):
a=list()
for i in range(5):
  a.append(int(input()))
max=10
count=0
for i in range(5):
  if a[i]%10<max and a[i]%10!=0:
    max=a[i]%10
    maxI=i
for i in range(5):
  if i!=maxI:
    count+=a[i]
    if a[i]%10!=0:
      count+=(10-a[i]%10)
count+=a[maxI]
print(count)
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S=list(input())
Snum=list()
Snum.append(0)
Snum.append(0)
for i in range(1,N):
  if S[i]=="C" and S[i-1]=="A":
    Snum.append(Snum[i]+1)
  else:
    Snum.append(Snum[i])
for i in range(Q):
  L,R=map(int, input().split())
  print(Snum[R]-Snum[L])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S=input()
l=list()
r=list()
for i in range(Q):
  L,R=map(int, input().split())
  S2=S[L-1:R].split("AC")
  print(S[L-1:R])
  print(len(S2)-1)
Problem p03407 (python)

Fixed submission:
a, b, c = map(int, input().split())
if(a+b>=c):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if(a+b>c): print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if a+b>c: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if(a+b>c) print("Yes")
else print("No")

Buggy submission (verdict: Runtime Error):
a=int(input());
b=int(input());
c=int(input());
if(a+b>c) print("Yes");
else print("No");
Problem p02553 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
xmx = max([a, b])
xmin = min([a, b])
#xabsmx = max([a, b], key = abs)
#xabsmin = min([a, b],key = abs)
ymx = max([c, d])
ymin = min([c, d])
#yabsmx = max([c,d], key = abs)
#yabsmin = min([c, d],key = abs)
if xmin >= 0:#all X plus
    if ymx <= 0:#all Y minas
        print(xmin * ymx)
    else:
        print(xmx * ymx)

elif xmx <= 0:#all X minas
    if ymin >= 0:#all Y plus
        print(xmx * ymin)
    else:
        print(xmin * ymin)
else:#X plus and minas
    if ymx <= 0:#all Y minas
        print(xmin * ymin)
    elif ymin >= 0:#all Y plus
        print(xmx * ymx)
    else:#Y plus and minas
        if xmx * ymx > xmin * ymin:
            print(xmx * ymx)
        else:
            print(xmin * ymin)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split)
xmx = max([a, b])
xmin = min([a, b])
#xabsmx = max([a, b], key = abs)
#xabsmin = min([a, b],key = abs)
ymx = max([c, d])
ymin = min([c, d])
#yabsmx = max([c,d], key = abs)
#yabsmin = min([c, d],key = abs)
if xmin >= 0:#all X plus
    if ymx <= 0:#all Y minas
        print(xmin * ymx)
    else:
        print(xmx * ymx)

if xmx <= 0:#all X minas
    if ymin >= 0:#all Y plus
        print(xmx * ymin)
    else:
        print(xmin * ymin)
else:#X plus and minas
    if ymx <= 0:#all Y minas
        print(xmin * ymx)
    else:
        print(xmx * ymx)
Problem p02614 (python)

Fixed submission:
h, w, n = map(int, input().split())
test = [input() for i in range(h)]
ans = 0
for binh in range(2 ** h):
	for binw in range(2 ** w):
		tmp = 0
		for l in range(h):
			for m in range(w):
				if ((binh >> l) & 1) == 0  and ((binw >> m) & 1) == 0 and test[l][m] == "#":
					tmp += 1
		if tmp == n:
			ans += 1	
print(ans)

Buggy submission (verdict: Runtime Error):
hlst10 = [j for j in range(2 ** h)]
hlst2 = [format(k, '0{}b'.format(h)) for k in hlst10]
#print(hlst2)

wlst10 = [l for l in range(2 ** w)]
wlst2 = [format(m, '0{}b'.format(w)) for m in wlst10]
#print(wlst2)

ans = 0
for o in hlst10:
	for p in wlst10:
		black = 0
		nowhlst = hlst2[o]
		nowwlst = wlst2[p]
		for q in range(h):
			for r in range(w):
				if nowhlst[q] == '0' and nowwlst[r] == '0' and test[q][r] == "#":
					black += 1
		if black == n:
			ans += 1 
print(ans)
Problem p02780 (python)

Fixed submission:
# -*- coding: utf-8 -*-

#def f(x):
#    if x == 1:
#        return 1
#    else:
#        return f(x-1) + x

[N, K] = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

max_index = 0
now_sum = sum(P[:K])
max_sum = now_sum
for i in range(1, len(P)-(K-1)):
    now_sum -= P[i-1]
    now_sum += P[i+K-1]
    #sum_P = sum(P[i:i+K])
    if now_sum > max_sum:
        max_sum = now_sum
        max_index = i

#print(max_sum)
#print(max_index)

# 隣接したK個のリスト
kk = P[max_index:max_index+K]

# kの期待値を計算
max_kk = max(kk)
dp = [0]
for i in range(1, max_kk+1):
    dp.append(dp[i-1] + i)
#print(dp)

ans = 0
for k in kk:
    ans += dp[k]/k

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def f(x):
    if x == 1:
        return 1
    else:
        return f(x-1) + x

[N, K] = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

max_index = 0
max_sum = 0
for i in range(len(P)-(K-1)):
    sum_P = sum(P[i:i+K])
    if sum_P > max_sum:
        max_sum = sum_P
        max_index = i

#print(max_sum)
#print(max_index)

# 隣接したK個のリスト
kk = P[max_index:max_index+K]

# kの期待値を計算
#max_kk = max(kk)
#dp = [0]
#for i in range(1, max_kk+1):
#    dp.append(dp[i-1] + i)
#print(dp)

ans = 0
for k in kk:
    ans += f(k)/k

print(ans)
Problem p02982 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
import math

def calculate_distance(in1, in2):
    list1 = np.array(in1) 
    list2 = np.array(in2) 
    sub_list = list1 - list2
    pow_list = np.power(sub_list, 2)
    sum_number = sum(pow_list)
    distance = math.sqrt(sum_number)

    return distance

[N, D] = [int(i) for i in input().split()]

X = []
for n in range(N):
    X.append([int(i) for i in input().split()])

number = 0
for n in range(N):
    for nn in range(n+1, N):
        distance = calculate_distance(X[n], X[nn])
        if distance.is_integer() is True:
            number += 1

print(number)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
import math

def calculate_distance(in1, in2):
    list1 = np.array(in1) 
    list2 = np.array(in2) 
    sub_list = list1 - list2
    pow_list = np.power(sub_list, 2)
    sum_number = sum(pow_list)
    distance = math.sqrt(sum_number)

    return distance

[N, D] = [int(i) for i in input().split()]

X = []
for n in range(N):
    X.append([int(i) for i in input().split()])

number = 0
for n in range(N):
    for nn in range(n+1, N):
        distance = calculate_distance(X[n], X[nn])
        if distance.is_integer() is True:
            number += 1

print(number)
Problem p02993 (python)

Fixed submission:
# -*- coding: utf-8 -*-

S = input()

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print('Bad')
        break
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

S = input()

for i in range(len(S)):
    if S[i] == S[i+1]:
        print('Bad')
        break
else:
    print('Good')
Problem p03106 (python)

Fixed submission:
import math
import fractions
a,b,k= [int(i) for i in input().split()]

g=fractions.gcd(a,b)

cd=list()
i=1
while i<=g:
    if g % i == 0:
        cd.append(i)
    i+=1
print (cd[ -1 * k ])

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

g=math.gcd(a,b)

cd=list()
i=1
while i<=g:
    if g%i==0:
        cd.append(i)
    i+=1
print (cd[-1*k])
Problem p02783 (python)

Fixed submission:
D = list(map(int, input().split()))
H,A = D[0], D[1]

if( H%A == 0):
    print(H//A)
else:
    print(H//A + 1)

Buggy submission (verdict: Runtime Error):
H = int(input())
A = int(input())
if H % A == 0:
  print(H//A)
else:
  print(H//A + 1)
return
Problem p02553 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
p=a*c
q=a*d
r=b*c
s=b*d
print(max(p,q,r,s))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().spit())
p=a*c
q=a*d
r=b*c
s=b*d
print(max(p,q,r,s))
Problem p02584 (python)

Fixed submission:
import math
X,K,D=map(int,input().split())
count=0
#Xが初期値
#Dが移動量（+or-）
#K回移動後の最小の座標
#X/D＞Kの場合、K*D＋Xが答え

Y = 0
#X>0 D>0 の場合
if X / D > K and X / D > 0:
    Y = abs(X - D * K)
elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K)
else:
    #X/D<Kの場合、X mod D
    L = abs(X) % D
    M = math.floor(abs(X) / D)
    if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D)

print(Y)

Buggy submission (verdict: Runtime Error):
X,K,D=map(int,input().split())
count=0

result=X
target=int(X/D)
if (D-target)%2=0:
  if abs(result-D*target)>abs(result+D*target):
    result=result+D*target
  else:
    result=result-D*target
else:
  if abs(result-(D+1)target)>abs(result+(D+1)*target):
    result=result+(D+1)*target
  else:
    result=result-(D+1)*target
  
print(str(abs(result)))
Problem p02639 (python)

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

for i in range(len(x)):
    if x[i] == 0:
        print(i+1)

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

for i in range(len(x)):
    if x[i] == 0:
Problem p02732 (python)

Fixed submission:
import collections

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

cnt = collections.Counter(num_list)
ttl = 0
for v in cnt.values():
    ttl += v*(v-1)//2
for a in num_list:
    print(ttl - (cnt[a] - 1))

Buggy submission (verdict: Runtime Error):
import collections
from scipy import special

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

for i in range(0, n):
    target_list = num_list[0:i] + num_list[i+1:]
    target_items = collections.Counter(target_list).items()
    ans = 0

    for item in target_items:
        if item[1] > 1:
            ans += special.comb(item[1], 2, True)

    print(ans)

Buggy submission (verdict: Runtime Error):
import collections
from scipy import special

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

for i in range(0, n):
    target_list = num_list[0:i] + num_list[i+1:]
    target_items = collections.Counter(target_list).items()
    ans = 0

    for item in target_items:
        if item[1] > 1:
            ans += special.comb(item[1], 2, True)

    print(ans)
Problem p02748 (python)

Fixed submission:
a, b, m = map(int, input().split())
a_s = list(map(int, input().split()))
b_s = list(map(int, input().split()))
m_s =[]

for _ in range(m):
    m_s.append(list(map(int, input().split())))

mini = min(a_s) + min(b_s)

for am, bm, sale in m_s:
    mini = min(mini, a_s[am-1]+b_s[bm-1]-sale)

print(mini)

Buggy submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
a_s = list(map(int, input().split()))
b_s = list(map(int, input().split()))
m_s =[]

for _ in range(m):
    m_s.append(list(map(int, input().split())))

mini = min(a_s) + min(b_s)

for am, bm, sale in m_s:
    mini = min(mini, a_s[am]+b_s[bm]-sale)

print(mini)
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
rules = [list(map(int, input().split())) for _ in range(m)]

def get_ans():
    if m == 0:
        return(10**(n-1)*int(bool(1<n)))
        
    for i in range(10**(n-1)*int(bool(1<n)), 10**n):
        for j, rule in enumerate(rules):
            
            if int(str(i)[rule[0]-1]) == rule[1]:
                if j == len(rules)-1:
                    return(i)
                else:
                    continue
            else:
                break
                
    return(-1)


print(get_ans())

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
rules = []

for x in range(m):
  rules.append(list(map(int, input().split())

def get_ans():
  if m == 0:
      return(10**(n-1)*int(bool(1<n)))

  for i in range(10**(n-1)*int(bool(1<n)), 10**n):
      for j, rule in enumerate(rules):

          if int(str(i)[rule[0]-1]) == rule[1]:
              if j == len(rules)-1:
                  return(i)
              else:
                  continue
          else:
              break
      return(-1)


print(get_ans())
Problem p02806 (python)

Fixed submission:
music_num = int(input())
music_list = []

for i in range(music_num):
    music_list.append(input().split(' '))

sleep_timing_music = input()
flag = False
sleep_time = 0

for j in music_list:
    if flag == True:
        sleep_time += int(j[1])
        
    if j[0] == sleep_timing_music:
        flag = True

print(sleep_time)

Buggy submission (verdict: Runtime Error):
n = int(input())
playlists = []

for _ in range(n):
    title, playtime = input().split()
    playlists.append([title, int(playtime)])

lastmusic = input()

print(sum([x[1] for x in playlists[playlists[0].index(lastmusic) + 1:]]))
Problem p02861 (python)

Fixed submission:
def kyori(a, b, c, d):
    x = (int(a) - int(b)) ** 2
    y = (int(c) - int(d)) ** 2
    z = (x + y) ** 0.5
    return z

n = int(input())
city_list = [0]*n
total_kyori = 0.0

for i in range(n):
  city_list[i] = input().split(' ')

for j in range(n):
  for k in range(n):
    ret_kyori = kyori(city_list[j][0], city_list[k][0], city_list[j][1], city_list[k][1])
    total_kyori += ret_kyori

ret_value = total_kyori / n
print(ret_value)

Buggy submission (verdict: Runtime Error):
def kyori(a,b,c,d):
    x = (int(a) - int(b)) ** 0.5
    y = (int(c) - int(d)) ** 0.5
    z = x + y
    return z

n = int(input())
city_list = [0]*n
total_kyori = 0.0

for i in range(n):
  city_list[i] = input().split()

for j in range(n):
  for k in range(n):
    total_kyori += kyori(j[0], k[0], j[1], k[1])

print(total_kyori/n*(n-1))
Problem p02971 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
import copy

a = int(input())
nums = [0]*a

for i in range(a):
    nums[i] = int(input())
    
maxnum = max(nums)
maxenum = [i for i, x in enumerate(nums) if x == maxnum]
maxquant = len(maxenum)


if maxquant != 1:
    for j in range(a):
        print(maxnum)
else:
    for j in range(a):
        if nums[j] != maxnum:
            print(maxnum)
        else:
            copylist = copy.deepcopy(nums)
            copylist[maxenum[0]] = 0
            print(max(copylist))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())

for i in range(a):
  nums[i] = int(input())

for j in range(a):
  thisnums = nums
  thisnums[j] = 0
  print(max(thisnums))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
strs = []

for i in range(n):
    strs.append(input())

strs.sort()
print(''.join(strs))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
strs = []

for i in range(l):
    strs.append(input())

strs.sort()
print(''.join(strs))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
strs = []

for i in range(l):
    strs.append(input())

strs.sort()
print(''.join(strs[:n]))
Problem p02687 (python)

Fixed submission:
s = input()
print("ABC") if s[1] == "R" else print("ARC")

Buggy submission (verdict: Runtime Error):
s = input()
print("ABC") if a[1] == "R" else print("ARC")
Problem p02706 (python)

Fixed submission:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
total = 0
for i in a:
  total += i
if n < total:
  print(-1)
else:
  print(n - total)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
total = 0
for i in a:
  total += a
if n < total:
  print(-1)
else:
  print(n - total)
Problem p02718 (python)

Fixed submission:
n ,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
total = 0
for i in a:
  total += i
ok = 0
for i in range(1, m + 1):
  if a[-i] >= total / (4 * m):
    ok += 1

if ok != m:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n ,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort().reverse()
total = 0
for i in a:
  total += i
ok = 0
for i in range(m):
  if a[i] >= total / (4 * m):
    ok += 1
 
if ok != m:
  print("No")
else:
  print("Yes")
Problem p02730 (python)

Fixed submission:
s = input()
s_len = len(s)
 
def judge(start=0, end=s_len):
  for i in range(start, end):
    if s[i] == s[end-1-i]:
      continue
    else:
      return 0
  return 1
 
if judge() and judge(end=(s_len-1)//2) and judge(start=(s_len+3)//2-1):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)

def judge(start=0, end=s_len)
  for i in range(start, end):
    if s[start+i] == s[end-1-i]:
      continue
    else:
      return 1
  return 0

if not judge() and not judge(end=(s_len-1)//2) and not judge(start=(s_len+3)//2-1):
  print("Yes")
else:
  print("No")
Problem p02747 (python)

Fixed submission:
s = input()
s_len = len(s)
if s_len % 2:
  print("No")
else:
  prev = 0
  count = 0
  for i in range(1, (s_len//2)+1):
    if s[prev*2:i*2] != "hi":
      print("No")
      break
    else:
      count += 1
      prev = i
  if count == s_len // 2:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)
if s_len % 2:
  print("No")
else:
  prev = 0
  count = 0
  for i in range(1, (s_len//2)+1):
    if [prev:i*2] != "hi":
      print("No")
      break
    else:
      count += 1
      prev = i * 2
  if count == s_len:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)
if s_len % 2:
  print("No")
else:
  prev = 0
  count = 0
  for i in range(1, (s_len//2)+1):
    if [prev:i*2] != "hi":
      print("No")
      break
    else:
      count += 1
  if count == s_len:
    print("Yes")