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

Fixed submission:
i = input()

prev = ""
res = 0
index = 0
while index < len(i):
    temp = i[index]
    if temp == prev:
        prev = i[index:index+2]
        if index == len(i)-1:
            res -= 1
        index += 2

    else:
        prev = temp
        index += 1

    res += 1

print(res)

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

prev = ""
res = 0
index = 0
col = []
while index < len(i):
    temp = i[index]
    if temp == prev:
        prev = i[index:index+2]
	if index == len(i)-1:
            res -= 1
	index += 2

    else:
        prev = temp
        index += 1
    col.append(prev)
    res += 1

print(res)
Problem p02952 (python)

Fixed submission:
i = input()

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:

  addition = (int(i[0])-1)*10**(len(i)-1)+1
  if len(i)>1:
    addition += int(i[1:])
  print(acc+addition)

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

acc = 0
for j in range(len(i)//2):
	acc+=9*(10**(2*j))

if len(i)%2==0:
	print(acc)
else:
	addition = int(i[1:])+1 + (int(i[0])-1)*10**(len(i)-1)
	print(acc+addition)

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

if int(i) < 0:
  print("0")
else:

  acc = 0
  for j in range(len(i)//2):
    acc+=9*(10**(2*j))

  if len(i)%2==0:
    print(acc)
  else:
    addition = int(i[1:])+1
    print(acc+addition)

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

if int(i)<0:
 	print("0")
else:
	acc = 0
	for j in range(len(i)//2):
		acc+=9*(10**(2*j))

	if len(i)%2==0:
		print(acc)
	else:
 		addition = int(i[1:])+1
		print(acc+addition)

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

if int(i)<0:
  print("0")
  return

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)

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

if int(i)<0:
  print("0")

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)

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

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)

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

acc_num = 0
for i in range(len(i)//2):
  acc+=9*(10**(2*i))

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)
Problem p03319 (python)

Fixed submission:
import math
def find_min(length, window_size):
    return math.ceil((length-window_size)/(window_size-1)) + 1

args = input().split(" ")
length = int(args[0])
window_size = int(args[1].rstrip())
array = input().split(" ")

print(find_min(length, window_size))

Buggy submission (verdict: Runtime Error):
args = int(input().rstrip())

def snuke(number):
    temp = list(str(number))
    arr = [ int(t) for t in temp] 
    return sum(arr)

def find_snuke(args):
    result = []
    i = 1
    while len(result) < args:
        push = True
        for power in range(0,len(str(i))):
            if((i+10**power)/snuke(i+10**power))<(i/snuke(i)):
                push = False
                break
        if push:
            result.append(i)
        i=i+1
            
    return result

arr = find_snuke(args)
for a in arr:
   print(a)
Problem p03331 (python)

Fixed submission:
a = int(input())

def func(a):
    digits = []
    temp = a
    while temp != 0:
        digits.append(temp%10)
        temp = int(temp/10)
    result = sum(digits)
    if result == 1:
        print('10')
    else:
        print(result)

func(a)

Buggy submission (verdict: Runtime Error):
def func(a):
    result = 0
    
    while a != 0:
        result += a%10
        a = int(a/10)
        
    if result == 1:
        print '10'
    else:
        print result

a=int(input())
func(a)
Problem p02677 (python)

Fixed submission:
import math

A, B, H, M = input().split()
# print(A, B, H, M)

def get_point(radians_theta, r):
    # 0° -> x:0, y=r とみなす
    # radians_theta 0 ~ 360
    # print(radians_theta, r)
    x = r * math.sin(math.radians(radians_theta))
    y = r * math.cos(math.radians(radians_theta))
    return x, y

def calc_rad_big_hand(H, M):
    # 長針
    return H * 30 + M / 2

def calc_rad_little_hand(M):
    # 短針
    return M * 6

def calc_result(A,B,H,M):
    H = int(H)
    M = int(M)
    A = int(A)
    B = int(B)
    big_hand_rad = calc_rad_big_hand(H, M)
    little_hand_rad = calc_rad_little_hand(M)
    big_x, big_y = get_point(big_hand_rad, A)
    little_x, little_y = get_point(little_hand_rad, B)
    return math.sqrt((big_x - little_x)**2 + (big_y-little_y)**2)

print(calc_result(A,B,H,M))

Buggy submission (verdict: Runtime Error):
import math

A, B, H, M = input().split()
# print(A, B, H, M)

def get_point(radians_theta, r):
    # 0° -> x:0, y=r とみなす
    # radians_theta 0 ~ 360
    x = r * math.sin(math.radians(radians_theta))
    y = r * math.cos(math.radians(radians_theta))
    return x, y

def calc_rad_big_hand(H, M):
    # 長針
    return H * 30 + M / 2

def calc_rad_little_hand(M):
    # 短針
    return M * 6

def calc_result(A,B,H,M):
    H = int(H)
    M = int(M)
    big_hand_rad = calc_rad_big_hand(H, M)
    little_hand_rad = calc_rad_little_hand(M)
    big_x, big_y = get_point(big_hand_rad, A)
    little_x, little_y = get_point(little_hand_rad, B)
    return math.sqrt((big_x - little_x)**2 + (big_y-little_y)**2)

print(calc_result(A,B,H,M))

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

def get_point(radians_theta, r):
    # 0° -> x:0, y=r とみなす
    # radians_theta 0 ~ 360
    x = r * math.sin(math.radians(radians_theta))
    y = r * math.cos(math.radians(radians_theta))
    return x, y

def calc_rad_big_hand(H, M):
    # 長針
    return H * 30 + M / 2

def calc_rad_little_hand(M):
    # 短針
    return M * 6

def calc_result(A,B,H,M):
    H = int(H)
    M = int(M)
    big_hand_rad = calc_rad_big_hand(H, M)
    little_hand_rad = calc_rad_little_hand(M)
    big_x, big_y = get_point(big_hand_rad, A)
    little_x, little_y = get_point(little_hand_rad, B)
    return math.sqrt((big_x - little_x)**2 + (big_y-little_y)**2)
  
print(calc_result(A,B,H,M))
Problem p02747 (python)

Fixed submission:
s = input()
if s in ["hi", "hihi", "hihihi", "hihihihi", "hihihihihi"]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s in hi:
  print("Yes")
elif:
  print("No")
Problem p03043 (python)

Fixed submission:
n,k = map(int, input().split())
lis = []
for i in range(1,n+1):
    count = 0
    while i < k:
        i *= 2
        count += 1
    lis.append(count)
result = 0
for i in lis:
    result += 1 / n * 0.5 **i
print(result)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input())
lis = []
for i in range(1, n+1):
    count = 0
    while i < k:
        i *= 2
        count += 1
    lis.append(count)
result = 0
for i in lis:
    result += 1 / n * 0.5 ** i
print(result)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input())
lis = []
for i in range(1,n+1):
    count = 0
    while i < k:
        i *= 2
        count += 1
    lis.append(count)
result = 0
for i in lis:
    result += 1 / n * 0.5 **i
print(result)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input())
lis = []
for i in range(1,N+1):
    count = 0
    while i < k:
        i *= 2
        count += 1
    lis.append(count)
result = 0
for i in lis:
    result += 1/n*0.5**i
print(result)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input())
lis = []
for i in range(1,N+1):
    count = 0
    while i < K:
        i *= 2
        count += 1
    lis.append(count)
result = 0
for i in lis:
    result += 1/n*0.5**i
print(result)
Problem p02641 (python)

Fixed submission:
X, N = input().split()
p = list(map(int, input().split()))
Z = list(range(0, 102))

q = [i for i in Z if i not in p]
t = []

for i in range(0, len(q)):
    t.append(abs(int(X)-q[i]))

print(q[(t.index(min(t)))])

Buggy submission (verdict: Runtime Error):
X, N = input().split()
p = list(map(int, input().split()))
Z = list(range(1, 101))

q = [i for i in Z if i not in p]
t = []

for i in range(0, len(q)):
    t.append(abs(int(X)-q[i]))

print(q[(t.index(min(t)))])
Problem p02681 (python)

Fixed submission:
a = input()
b = input()
 
if (a==b[:len(a)]):
  print("Yes")
else:
  print("No")

#print(b[:len(a)-1])

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

d = 1
b = [d]

for i in range(k):
    d = a[d-1]
    if b[0]==dn:
        break
    else:
        b.append(d)
 
print(b[k%len(b)])

Buggy submission (verdict: Runtime Error):
a = input()
b = inout()
 
if (a==b[:len(a)-1]):
  print("Yes")
else:
  print("No")

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

if (a==b[:len(a)-1]):
  print(`Yes`)
else:
  print(`No`)
Problem p02684 (python)

Fixed submission:
import numpy as np 
import sys 

readline = sys.stdin.readline

N, K = map(int, readline().split())
A = list(map(int, readline().split()))

# 愚直にやると計算量O(K)でTLEになる
# 同じ街にいったら操作打ち切りで配列を完結させる

# Teleport順の配列を作る
teleport = {1: True}
next_town = 1
roop_exist = False
for i in range(K):
    next_town = A[next_town - 1] # next_townがintで与えられる
    try: # 辞書を使用してO[1]で判定する
        teleport[next_town]
        dupulicate_town = next_town
        # 辞書をリストに変換
        teleport = list(teleport.keys())
        dupulicate_index = teleport.index(dupulicate_town)
        dupulicate_list = teleport[dupulicate_index:]
        roop_exist = True
        break
    except KeyError:
        teleport[next_town] = True


# 最後の処理の前にリストに変換してしまう
if not roop_exist:
    teleport = list(teleport.keys())

if len(teleport) - 1 == K:
    print(teleport[-1])
else: # ループに入る場合
    consumption = len(teleport) - 1
    roop_num = K - consumption
    roop_index = roop_num % len(dupulicate_list)
    if roop_index == 0:
        print(dupulicate_list[-1])
    else:
        print(dupulicate_list[roop_index - 1])

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

readline = sys.stdin.readline

N, K = map(int, readline().split())
A = list(map(int, readline().split()))

# 愚直にやると計算量O(K)でTLEになる
# 同じ街にいったら操作打ち切りで配列を完結させる

# Teleport順の配列を作る
teleport = {1: True}
next_town = 1
for i in range(K):
    next_town = A[next_town - 1] # next_townがintで与えられる
    try: # 辞書を使用してO[1]で判定する
        teleport[next_town]
        dupulicate_town = next_town
        # 辞書をリストに変換
        teleport = list(teleport.keys())
        dupulicate_index = teleport.index(dupulicate_town)
        dupulicate_list = teleport[dupulicate_index:]
        break
    except KeyError:
        teleport[next_town] = True


if len(teleport) - 1 == K:
    print(teleport[-1])
else: # ループに入る場合
    consumption = len(teleport) - 1
    roop_num = K - consumption
    roop_index = roop_num % len(dupulicate_list)
    if roop_index == 0:
        print(dupulicate_list[-1])
    else:
        print(dupulicate_list[roop_index - 1])
Problem p02675 (python)

Fixed submission:
n = input()

if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
	print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
	print("pon")
elif n[-1] == "3":
  	print("bon")

Buggy submission (verdict: Runtime Error):
n = input()
  
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9' :
     print("hon")
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8' :
     print("pon")
elif n[-1] == '3':
      fmt.Println("bon")
Problem p02664 (python)

Fixed submission:
T=input()
T2=(T.replace('?', 'D'))

print(T2)

Buggy submission (verdict: Runtime Error):
T=list(input())
T2=(T.replace('?', 'd'))

print(T2)
Problem p02705 (python)

Fixed submission:
import numpy as np

s=int(input())

R=2*s*np.pi
print(R)

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

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

suma=np.sum(A)
remain=N-suma

if remain>=0:
	print(remain)
else:
	print(-1)

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

s=int(input())

R=2*s*np.pi
print(R)

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

s=input()

R=2*s*np.pi
print(R)

Buggy submission (verdict: Runtime Error):

import numpy as np

s=int(input())

R=2*s*np.pi
print(R)

Buggy submission (verdict: Runtime Error):
inport math

s=int(input())

R=2*s*math.pi
print(R)
Problem p02706 (python)

Fixed submission:
import numpy as np

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

suma=np.sum(A)
remain=N-suma

if remain>=0:
	print(remain)
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N,M=map(int, input().split())  
A=list(map(int, input().split())
 
sumA=np.sum(A)
remain=N-sumA
       
if remain>=0:
	print(remain)
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np 
N,M=map(int, input().split())  
A=list(map(int, input().split()) 
suma=np.sum(A)
remain=N-suma       

if remain>=0:
    print(remain)
else:
    print(-1)

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

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

suma=np.sum(A)
remain=N-suma
       
if remain>=0:
       print(remain)
else:
       print(-1)

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

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

suma=np.sum(A)
remain=N-suma
       
if remain>=0:
       print(remain)
else:
       print('-1')
Problem p02718 (python)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
S = sum(A)
if A[M-1] >= S / (4*M):
	print("Yes")
else:
	print("No")

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

A.sort(reverse=True)
if A[M-1] >= S/(4*M):
  print('Yes')
else:
  print('No')
Problem p02719 (python)

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

m=n%k
d=abs(m-k)

if d<m:
    print(d)
else:
    print(m)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split()
#n=7
#k=4

m=n%k
d=abs(m-k)

if m<k:
    print(m)
elif k<m:
    print(k)
else:
    print(k)

Buggy submission (verdict: Runtime Error):
n,k=input().split()


m=n%k
d=abs(m-k)

if m<k:
    print(m)
elif k<m:
    print(k)
else:
    print(k)
Problem p02730 (python)

Fixed submission:
s=list(input())
#s=['l','e','l','v','l','e','l']
L=int((len(s)-1)/2)
f1=0
for i in range(L):
 #   print(s[0+i])
  #  print(s[len(s)-i-1])
    if s[0+i]==s[len(s)-i-1]:
        pass
   #     print('here1')
    else:
        f1+=1
    #    print('here2')

#print(f1)
LL=L//2
f2=0
if f1==0:
    for j in range(LL):
     #   print(s[0+j])
      #  print(s[L-j-1])
        if s[0+j]==s[L-j-1]:
            pass
 #           print('here3')
        else:
            f2+=1
  #          print('here4')
else:
    f2=1

#print(f1)
#print(f2)
if f1==0 and f2==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
#s=['a','b','a','d','a','b','a']
L=int((len(s)-1)/2)
f1=0
for i in range(L-1):
    if s[0+i]==s[len(s)-i]:
    else:
        f1+=1
        
LL=L//2
f2=0
if f1==0:
    for j in range(LL-1):
        if s[0+j]==s[len(L)-i]:
    else:
        f2+=1

if f1==0&f2==0:
    print('Yes')
else:
    print('No')
Problem p02731 (python)

Fixed submission:
L=int(input())

K=L/3
print(K*K*K)

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

K=(L/3)^3
print(K)
Problem p03160 (python)

Fixed submission:
import numpy as np
N=int(input())
h=list(map(int,input().split()))

#N=4
#h=[10,30,40,20]

dp=np.zeros(N)
#print(dp)
dp[1]=abs(h[1]-h[0])
#print(dp)

for i in range(N-2):
  dp[i+2]=min(abs(h[i+2]-h[i])+dp[i],abs(h[i+2]-h[i+1])+dp[i+1])
 # print(dp)
  #dp[2]=min(h[2]-h[0],h[1]-h[0])

#total

print(int(dp[-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
h=list(map(int,input().split()))

#N=4
#h=[10,30,40,20]

dp=np.zeros(N)
print(dp)
dp[1]=abs(h[1]-h[0])
print(dp)

for i in range(N-2):
  dp[i+2]=min(abs(h[i+2]-h[i])+dp[i],abs(h[i+2]-h[i+1])+dp[i+1])
  print(dp)
  #dp[2]=min(h[2]-h[0],h[1]-h[0])

#total

print(dp[-1]
Problem p03606 (python)

Fixed submission:
N=int(input())
K=0
for i in range(N):
    l,r = map(int,input().split())
    K=(r-l+1)+K
print(K)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=0
for i in N:
    l,r = map(int,input().split())
    K=(r-l+1)+K
print(K)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=0
for i in N:
    l[i],r[i] = map(int,input().split())
    K+=(r[i]-l[i]+1)
print(K)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=0
for i in N
    l[i],r[i] = map(int,input().split())
    K+=(r[i]-l[i]+1)
print(K)
Problem p02675 (python)

Fixed submission:
n = input()
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] =='7' or n[-1] == '9':
    print('hon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
n = input()
if n[-1] == '2' or '4' or '5' or '7' or '9':
    print('hon')
elif n[-1] == '0' or '1' or '6' or '8':
    print('pon')
else print('bon'):
    print('bon')
Problem p02706 (python)

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

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

Fixed submission:
S=input()
if S=="ABC":
  print("ARC")
elif S=="ARC":
  print("ABC")

Buggy submission (verdict: Runtime Error):
S=input()
if S="ABC":
  print("ARC")
elif S="ARC":
  print("ABC")
Problem p02818 (python)

Fixed submission:
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  if A+B>=K:
    print("0 "+str(A+B-K))
  else:
    print("0 0")

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-k)+" "+str(B))
else:
  if A+B>=K:
    print("0 "+str(A+B-K))
  else:
    print("0 0")
Problem p02732 (python)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
total = 0
for key in cnt.keys():
    total += cnt[key]*(cnt[key]-1) // 2
for i in a:
    ans = total
    ans -= cnt[i] * (cnt[i]-1) / 2
    ans += (cnt[i]-1) * (cnt[i]-2) / 2
    print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
diff_dict = {}
total_sum = 0
for i in a:
    if i not in diff_dict:
        temp = (count_dict[i])*(count_dict[i]-1)//2
        diff_dict[i] = temp-(count_dict[i]-1)*(count_dict[i]-2)//2
        total_sum += temp
for i in a:
    print(total_sum - diff_dict[i])
Problem p03147 (python)

Fixed submission:
def water(flowers, count):
    if len(flowers) is 0:
        return count
    count = count + min(flowers)
    flowers = [int(e-min(flowers)) for e in flowers]
    while 0 in flowers:
        count = water(flowers[:flowers.index(0)], count)
        flowers = flowers[flowers.index(0)+1: ]
    count = water(flowers, count)
    return count

n = int(input())
flowers = [int(e) for e in input().split()]

count = 0
count = water(flowers, count)
print(count)

Buggy submission (verdict: Runtime Error):
def water(flowers, count):
    print(f'count : {count}')
    print(f'flowers : {flowers}')
    if len(flowers) is 0:
        return count
    count = count + min(flowers)
    flowers = [int(e-min(flowers)) for e in flowers]
    while 0 in flowers:
        count = water(flowers[:flowers.index(0)], count)
        flowers = flowers[flowers.index(0)+1: ]
    count = water(flowers, count)
    return count

n = int(input())
flowers = [int(e) for e in input().split()]

count = 0
print(f'Initialize : {flowers}')
water(flowers, count)
# while flowers.count(0) != 0:
#     print(f'{"="*20} iteration{i}')
#     flowers, count = make_zero(flowers, count)
#     print(f'flowers : {flowers}')
#     print(f'count : {count}')
Problem p03285 (python)

Fixed submission:
import sys


CAKE = 4
DOUNAT = 7


def check_amount(i, j, n):
    return i*4 + j*7 == n


n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
CAKE = 4
DOUNAT = 7

def check_amount(i, j, n):
    return i*4 + j*7 == n

n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')
Problem p03502 (python)

Fixed submission:
import sys


def find_sum_of_digits(n):
    sum_of_digits = 0
    while n>0:
        sum_of_digits = sum_of_digits + n%10
        n = int(n/10)
    return sum_of_digits


n = int(input())
sum_of_digits = find_sum_of_digits(n)
if n % sum_of_digits == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys


def extract_digits(n):
    digits = []
    while n>0:
        digits.append(n%10)
        n = int(n/10)
    return digits


n = int(input())
digits = extract_digits(n)
for i in digits:
    if n % i == 0:
        print('Yes')
        sys.exit()
print('No')
Problem p03611 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
cnt=[0]*(10**5+2)
for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
import sys

n = input()
a = list(map(int, input().split()))
ans_dict = {}
if len(a)==1:
    print(a[0])
    sys.exit()
for X in range(min(a), max(a)):
    ans_dict[str(X)] = 0
    for j in a:
        if X == j or X == j-1 or X == j+1:
            ans_dict[str(X)] = ans_dict[str(X)]+1
print(max(ans_dict.values()))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
ans_dict = {}
for X in range(min(a), max(a)):
    ans_dict[str(X)] = 0
    for j in a:
        if X == j or X == j-1 or X == j+1:
            ans_dict[str(X)] = ans_dict[str(X)]+1
print(max(ans_dict.values()))
Problem p03720 (python)

Fixed submission:
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(n):
    print(map_dict[str(i+1)])

Buggy submission (verdict: Runtime Error):
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(m):
    print(map_dict[str(i+1)])
Problem p04031 (python)

Fixed submission:
n = int(input())
a = [int(e) for e in input().split()]
ans = float("inf")
MIN, MAX = min(a), max(a)
for i in range(MIN, MAX+1):
    cost = 0
    for j in a:
        cost = cost + (i-j)**2
    ans = min(ans, cost)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(e) for e in input().split()]
ans = float("inf")
MIN, MAX = min(a), max(a)
for i in range(MIN, MAX):
    cost = 0
    for j in a:
        cost = cost + (i-j)**2
    ans = min(ans, cost)
print(cost)
Problem p02618 (python)

Fixed submission:
import numpy as np

d = int(input())

c = list(map(int, input().split()))

sd = np.zeros((d, 26), dtype=np.int)
for i in range(d):
  s = list(map(int, input().split()))
  s_array = np.array(s)
  sd[i, :] = s_array
  
for i in range(d):
  print(np.argmax(sd[i, :])+1)

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

c = list(map(int, input().split()))

sd = np.zeros((d, 26), dtype=np.int)
for i in range(d):
  s = list(map(int, input().split()))
  s_array = np.array(s)
  sd[i, :] = s_array

pp = np.zeros(26, dtype=np.int)
  
for i in range(d):
  pp += c
  pp_max = np.argmax(pp)+1
  pp_max_val = np.max(pp)
  print(np.sum(pp), pp_max, pp_max_val)
  sd_max = np.argmax(sd[i,:])+1
  sd_max_val = np.max(sd[i,:])
  print(sd_max, sd_max_val)
  if np.sum(pp) >= sd_max_val:
    t = pp_max
    pp[pp_max-1] = 0
  else:
    t = sd_max
  print(t)