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

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
c=collections.Counter(a)
i=0
ans=0
while i<n:
    h=c[a[i]]
    if h>=a[i]:
        ans+=h-a[i]
    else:
        ans+=h
    i+=h
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
i=0
ans=0
while i<n:
    h=a.count(a[i])
    i+=h
    ans+=abs(h-a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
i=0
ans=0
while i<n:
  h=a.count(a[i])
  i+=h
  ans=ans+h-a[i]
print(ans)
Problem p03565 (python)

Fixed submission:
s=input()
t=input()
if len(s)<len(t):
  print("UNRESTORABLE")
  exit()
n=len(s)
m=len(t)
for i in range(n-m,-1,-1):
  x=s[i:i+m]
  for j in range(m+1): #
    if j==m:
      print((s[:i]+t+s[i+m:]).replace("?","a"))
      exit()
    if x[j]=="?":
      continue
    elif x[j]!=t[j]:
      break
print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
f=1
tmp=0
if len(s)<len(t):
  print("UNRESTORABLE")
  exit()
n=len(s)
m=len(t)
for i in range(n-m+1):
  x=s[i:i+m]
  for j in range(m+1): #
    if j==m:
      print((s[:i]+t+s[i+m:]).replace("?","a"))
    if x[j]=="?":
      continue
    elif x[j]!=t[j]:
      break
print("UNRESTORABLE")
Problem p03575 (python)

Fixed submission:
n, m = map(int, input().split())
graph = [[False for i in range(60)] for _ in range(60)]
A, B = [], []
ans = 0

def dfs(v):
    if vis[v]:
        return
    vis[v] = True
    for i in range(n):
        if graph[v][i]:
            dfs(i)

for i in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    A.append(a)
    B.append(b)
    graph[a][b] = graph[b][a] = True

for i in range(m): #どれが橋か
    graph[A[i]][B[i]] = graph[B[i]][A[i]] = False
    vis = [False] * n
    
    dfs(0)

    f = 0
    for j in range(n):
        if not vis[j]: f = 1
    if f: ans += 1
    
    graph[A[i]][B[i]] = graph[B[i]][A[i]] = True

print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind:
  
    def __init__(self,n):
        #par[x]==xならxというノードが根。xに親がいない
        self.par = [i for i in range(n+1)]
        self.rank = [0]*(n+1) 
    
    def find(self,x): #xの根を検索
        #xが根ならxを返す
        if self.par[x] == x:
            return x
        else:
			self.par[x] = self.find(self.par[x]) #パス圧縮
            return self.par[x]

    def unite(self,x,y):
        #根を探す
        x = self.find(x)
        y = self.find(y)        
        #木の深さを比較し、小さい方を大きい方につなげる
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1 #rankが同じ木を繋げたとき根のランクを一つ上げる
    
    def same_check(self,x,y): #xとyが同じ集合に属しているか
        return self.find(x) == self.find(y)

n, m = map(int,input().split())

A=[list(map(int,input().split())) for i in range(m)]
ans = 0
for i in range(m):
    uf = UnionFind(n) #
    for j in range(m):
        if i != j: #
            uf.unite(A[j][0],A[j][1])
    f = 1
    g = uf.find(1) #
    for j in range(1,n+1):
        if g != uf.find(j): #1~n(iを除く)がすべて同じ集合に属しているか
            f = 0
            break
    if not f:
        ans += 1
print(ans)
Problem p03611 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5)
for i in range(n):
    cnt[a[i]]+=1
for i in range(n):
    tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
    ans=max(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5)
for i in range(n):
    cnt[a[i]]+=1
for i in range(n-1):
    tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
    ans=max(tmp,ans)
print(ans)
Problem p03861 (python)

Fixed submission:
a,b,x=map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print(b//x - a//x +(1 if a%x == 0))
Problem p02658 (python)

Fixed submission:
N = int(input())
given_list = [int(i) for i in input().split()]

limit = 10**18
ans = 1

if 0 in given_list:
    print(0)
else:
    for i in given_list:
        ans *= i
        if ans > limit:
            print('-1')
            break
    if ans <= limit:
        print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
list_A = input().split()
list_A = [int(i) for i in list_A]

temp_sum = 1
flag = False
flag_0 = False

if 0 in list_A:
    flag_0 = True
    break
else:
    for i in range(N):
        temp_sum *= list_A[i]
        if temp_sum >= 10**18:
            flag = True
            break
        else:
            continue

if flag_0:
    print(0)
elif (flag_0 == False) and flag:
    print(-1)
else:
    print(temp_sum)
Problem p02600 (python)

Fixed submission:
n=int(input())
if n>=400 and n<=599:
  print("8")
elif n>=600 and n<=799:
  print("7")
elif n>=800 and n<=999:
  print("6")
elif n>=1000 and n<=1199:
  print("5")
elif n>=1200 and n<=1399:
  print("4")
elif n>=1400 and n<=1599:
  print("3")
elif n>=1600 and n<=1799:
  print("2")
elif n>=1800 and n<=1999:
  print("1")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n>=400 and n<=599:
	print("8")
elif n>=600 and n<=799:
	print("7")
elif n>=800 and n<=999:
	print("6")
elif n>=1000 and n<=1199:
	print("5')
elif n>=1200 and n<=1399:
	print("4")
elif n>=1400 and n<=1599:
    print("3")
elif n>=1600 and n<=1799:
    print("2")
elif n>=1800 and n<=1999:
	print("1")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n>400 and n<=599:
	print("8")
elif n>600 and n<=799:
	print("7")
elif n>800 and n<=999:
	print("6")
elif n>1000 and n<=1199:
	print("5')
elif n>1200 and n<=1399:
	print("4")
elif n>1400 and n<=1599:
    print("3")
elif n>1600 and n<=1799:
    print("2")
elif n>1800 and n<=1999:
	print("1")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n>400 and n<=599:
	print("8")
elif n>600 and n<=799:
	print("7")
elif n>800 and n<=999:
	print("6")
elif n>1000 and n<=1199:
	print("5')
elif n>1200 and n<=1399:
	print("4")
elif n>1400 and n<=1599:
    print("3")
elif n>1600 and n<=1799:
    print("2")
elif n>1800 and n<=1999:
	print("1")
Problem p02612 (python)

Fixed submission:
N = int(input())

ans = []

for i in range(0,11):
  if (1000 * i) - N  >= 0:
    ans.append((1000 * i) - N )
    
print(min(ans))

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

ans = []

for i in range(1,10):
  if (1000 * i) - N  >= 0:
    ans.append((1000 * i) - N )
    
print(min(ans))
Problem p02658 (python)

Fixed submission:
n = int(input())
num = list(map(int,input().split(" ")))
 
zero=num.count(0)
z= 10 **18
if zero != 0:
  print(0)
else:
  s = num[0]
  for i in range(1,n):
    s = s * num[i]
    if s > z:
      s=-1
      break
  print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
num = list(map(int,input().split(" ")))
 
s = num[0]
 
for i range(1,n):
  s = s * num[i] 
 
print(s)

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

s = num[0]

for i range(1,n):
  if len(str(s)) > 16:
    s = -1
    break
  s = s * num[i] 

print(s)

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

sum = num[0]

for i range(1,n):
  if len(str(sum)) > 16:
    sum = -1
    break
  sum = sum * num[i] 

print(sum)
Problem p02765 (python)

Fixed submission:
N,K=map(int,input().split())
 
if N<10:
  print(K+100*(10-N))
else:
  print(K)

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

if N<10:
  print(100*(10−K))
else:
  print(K)
Problem p02784 (python)

Fixed submission:
buf = input().split(" ")
H=int(buf[0])
N=int(buf[1])
 
A = list(map(int, input().split())) 
 
A=sorted(A, reverse=True)
 
for i in range(N):
  if H<=0:
    break
  H=H-A[i]
 
if H<=0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
buf = input().split(" ")
H=int(buf[0])
N=int(buf[1])

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

A=sorted(A, reverse=True)

for i in range(N):
  H=H-A

if H<=0:
  print("Yes")
else:
  print("No")
Problem p02911 (python)

Fixed submission:

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


ans = [K - Q for i in range(N)]


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

for a in ans:
    if a > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int,input().split(" "))
ans=np.full(N, K)


ans = [K - Q for i in range(N)]


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

for a in ans:
    if a > 0:
        print("Yes")
    else:
        print("No")
Problem p02982 (python)

Fixed submission:
import numpy as np
import math

buf=input().split(" ")

N=int(buf[0])
D=int(buf[1])

arr = np.empty((0,D), int)

for i in range(N):
  buf=input().split(" ")
  buf = [int(s) for s in buf]

  arr=np.append(arr, [buf], axis=0)
  

buf=0
c=0

for i in range(N):
  for j in range(N):
    if i<j:
      for k in range(D):
        buf=abs((arr[i,k]-arr[j,k])*(arr[i,k]-arr[j,k]))+buf
      buf=math.sqrt(buf)
      if buf.is_integer() == True:
        c=c+1
      buf=0
          
print(c)

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

buf=input().split(" ")

N=int(buf[0])
D=int(buf[1])

arr = np.empty((0,D), int)

for i in range(N):
  buf=input().split(" ")
  buf = [int(s) for s in buf]

  arr=np.append(arr, [buf], axis=0)
  

buf=0
c=0

for i in range(N):
  for j in range(N):
    if i<j:
      for k in range(D):
        buf=math.sqrt(abs((arr[k:i]-arr[k:j])*(arr[k:i]-arr[k:j])))
        if buf.is_integer() == True:
          c=c+1
          
print(c)
Problem p02600 (python)

Fixed submission:
inp=int(input())
if 400<=inp<=599:
    print(8)
if 600<=inp<=799:
    print(7)
if 800<=inp<=999:
    print(6)
if 1000<=inp<=1199:
    print(5)
if 1200<=inp<=1399:
    print(4)
if 1400<=inp<=1599:
    print(3)
if 1600<=inp<=1799:
    print(2)
if 1800<=inp<=1999:
    print(1)

Buggy submission (verdict: Runtime Error):
card=input().split()
k=int(input())
arr=[]
for i in range(len(card)):
    res=int(card[i])*2
    arr.append(res)
if arr[0]<arr[1]<arr[2]:
    print('Yes')
else:
    print('No')
Problem p02639 (python)

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

for i in range(5):
  if l[i] == 0:
    print(i+1)
    exit()

Buggy submission (verdict: Runtime Error):
l = list(int, input())

for i in range(5):
  if l[i] == 0:
    print(i+1)
    exit()
Problem p03076 (python)

Fixed submission:
d = [int(input()) for _ in range(5)]

ans = 0
r =[]
for i in range(5):
  if d[i]%10!=0:
    r.append(d[i]%10)
    ans += d[i]-(d[i]%10)+10
  else:
    ans += d[i]

if len(r) == 0:
  print(ans)
  exit()
else:
  ans -= 10-min(r)
  print(ans)

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

ans = 0
r =[]
for i in range(5):
  if d[i]%10!=0:
    r.append(d[i]%10)
    ans += d[i]-(d[i]%10)+10
  else:
    ans += d[i]

ans -= 10-min(r)
print(ans)
Problem p02975 (python)

Fixed submission:
import math
n = int(input())
li = list(map(int,input().split()))
flag = "No"
li_uniq = list(set(li))
if(n % 3 == 0):
  if(len(li_uniq) == 3):
    check = li_uniq[0] ^ li_uniq[1]
    if(check == li_uniq[2]):
      a1 = li.count(li_uniq[0])
      a2 = li.count(li_uniq[1])
      a3 = li.count(li_uniq[2])
      if(a1 == a2 == a3):
        flag = "Yes"
  elif(len(li_uniq) == 2):
    bmax = max([li_uniq[0] , li_uniq[1]])
    bmin = min([li_uniq[0] , li_uniq[1]])
    b1 = max([li.count(li_uniq[0]) , li.count(li_uniq[1])])
    b2 = min([li.count(li_uniq[0]) , li.count(li_uniq[1])])
    if(b1 == 2 * b2):
      check2 = bmax ^ bmax
      if(check2 == bmin):
        flag = "Yes"
      
if(len(li_uniq) == 1):
  if(li_uniq[0] == 0):
    flag = "Yes"
print(flag)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
li = list(map(int,input().split()))
flag = "Yes"
if(n % 3 != 0):
  flag = "No"
li_uniq = list(set(li))
if(len(li_uniq) != 3):
  flag = "No"
check = li_uniq[0] ^ li_uniq[1]
if(check != li_uniq[2]):
  flag = "No"
a = li.count(li_uniq[0])
b = li.count(li_uniq[1])
c = li.count(li_uniq[2])
if(not(a == b == c)):
  flag = "No"
print(flag)
Problem p02767 (python)

Fixed submission:
def resolve():
    n = int(input())
    x_list = list(map(int, input().split()))
    mn = 10**9
    for i in range(1, max(x_list)+1):
        sm = 0
        for x in x_list:
            sm += (x-i)**2
        if mn > sm:
            mn = sm  
    print(mn)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    n = int(input())
    x_list = list(map(int, input().split()))
    mn =　10**6
    for i in range(1, max(x_list)+1):
        sm = 0
        for x in x_list:
            sm += (x-i)**2
        if mn > sm:
            mn = sm  
    print(mn)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    n = int(input())
    x_list = list(map(int, input().split()))
    mn =　10**9
    for i in range(1, max(x_list)+1):
        sm = 0
        for x in x_list:
            sm += (x-i)**2
        if mn > sm:
            mn = sm  
    print(mn)
resolve()
Problem p02830 (python)

Fixed submission:
n = int(input())
s, t = map(str, input().split())
ans = ""
for i, j in zip(s,t):
  ans += i
  ans += j
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s, t = map(input().split())
ans = ""
for i, j in zip(s,t):
  ans += i
  ans += j
print(ans)
Problem p02861 (python)

Fixed submission:
def resolve():
    import itertools
    import math
    def distance(i, j):
        return math.sqrt((i[0]-j[0])**2+(i[1]-j[1])**2)

    n = int(input())
    l = list(range(n))
    X_Y = []
    for i in range(n):
        X_Y.append(list(map(int, input().split())))
    p_list = list(itertools.permutations(l, n))
    total = 0
    for p in p_list:
        p_t = 0
        for index in range(n-1):
            p_t += distance(X_Y[p[index]], X_Y[p[index+1]])
        total += p_t
    print(total/len(p_list))
resolve()

Buggy submission (verdict: Runtime Error):
    import itertools
    import math
    def distance(i, j):
        return math.sqrt((i[0]-j[0])**2+(i[1]-j[1])**2)

    n = int(input())
    l = list(range(n))
    X_Y = []
    for i in range(n):
        X_Y.append(list(map(int, input().split())))
    p_list = list(itertools.permutations(l, n))
    total = 0
    for p in p_list:
        p_t = 0
        for index in range(n-1):
            p_t += distance(X_Y[p[index]], X_Y[p[index+1]])
        total += p_t
    print(total/len(p_list))
resolve()
Problem p02945 (python)

Fixed submission:
a, b = map(int, input().split())
print(max(a+b, a-b, a*b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, a-b. a*b))
Problem p03085 (python)

Fixed submission:
b = input()
a = ["A", "T"]
c = ["C", "G"]
if b is a[0]:
  print(a[1])
if b is a[1]:
  print(a[0])
if b is c[0]:
  print(c[1])
if b is c[1]:
  print(c[0])

Buggy submission (verdict: Runtime Error):
b = input()
a = ["A", T"]
c = ["C", "G"]
if b is a[0]:
  print(a[1])
if b is a[1]:
  print(a[0])
if b is c[0]:
  print(c[1])
if b is c[1]:
  print(c[0])

Buggy submission (verdict: Runtime Error):
b = input()
a = ["A, T"]
c = ["C", "G"]
if b is a[0]:
  print(a[1])
if b is a[1]:
  print(a[0])
if b is c[0]:
  print(c[1])
if b is c[1]:
  print(c[0])
Problem p03105 (python)

Fixed submission:
a, b, c = map(int, input().split())
z = b // a
if z >= c:
  print(c)
else:
  print(z)

Buggy submission (verdict: Runtime Error):
a. b, c = map(int, input().split())
z = b // a
if z >= c:
  print(c)
else:
  print(z)
Problem p03109 (python)

Fixed submission:
s = input()
if s[3] == "9":
  if s[5] == 1:
    print("TBD")
  else:
    if int(s[5]) == 1:
      print("TBD")
    else:
      if int(s[6]) > 4:
        print("TBD")
      else:
        print("Heisei")
    
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
s = input()
if s[3] == "9":
  if s[5] == 1:
    print("TBD")
  else:
    if int(s[6]) == 1:
      print("TBD")
    else:
      if int(s[7]) > 4:
        print("TBD")
      else:
        print("Heisei")
    
else:
  print("Heisei")
Problem p03160 (python)

Fixed submission:
def chmin(a, b):
    if a > b:
        return b
    return a
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    dp = [10**10] * n
    dp[0] = 0
    for i in range(n):
        dp[i] = chmin(dp[i], dp[i-1]+abs(h[i]-h[i-1]))
        if i > 1:
            dp[i] = chmin(dp[i], dp[i-2]+abs(h[i]-h[i-2]))
    print(dp[-1])
resolve()

Buggy submission (verdict: Runtime Error):
def chmin(a, b):
    if a > b:
        return b
    return a
#配るDP
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    dp = [10**10] * n
    dp[0] = 0
    for i in range(n):
        dp[i+1] = chmin(dp[i+1], dp[i]+abs(h[i]-h[i+1]))
        if i < n-2:
        	dp[i+2] = chmin(dp[i+2], dp[i]+abs(h[i]-h[i+2]))
    print(dp[-1])
resolve()
Problem p03161 (python)

Fixed submission:
import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())) + [0]*K, dtype=np.int64)
H = np.array(h)
dp = np.full(N + K, 10 ** 10, dtype=np.int64)
dp[0] = 0
for i in range(1, N):
    dp[i:i + K] = np.minimum(dp[i:i + K],
                             np.abs(H[i:i + K] - H[i - 1]) + dp[i - 1])
print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
def chmin(a, b):
    if a > b:
        return b
    else:
        return a

f_inf = float('inf')
dp = [f_inf] * (10**5+10)
dp[0] = 0
for i in range(n-1):
    dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
    # n-2の時は2つ先はない
    if i < n-2:
        dp[i + 2] = chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print(dp[-1])
Problem p03192 (python)

Fixed submission:
print(input().count("2"))

Buggy submission (verdict: Runtime Error):
print(int(input()).count(2))
Problem p03210 (python)

Fixed submission:
n = int(input())
a = [7, 5, 3]
if n in a:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input)
a = [7, 5, 3]
if n in a:
  print("YES")
else:
  print("NO")
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
  print("Hello World")
  quit()
elif n==2:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n == 1:
  print("Hello World")
else:
  print(a+b)
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split()) #n:煎餅, k:人数
if n % k == 0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
if n % k == 0:
  print(0)
else:
  print(abs(n-(n%K)))
Problem p03316 (python)

Fixed submission:
n = int(input())
t = n
sum = 0
while t // 10 != 0:
  sum += t%10
  t //= 10
sum += t%10
if n % sum == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
sum = sum(list(map(int, n)))
if n % sum == 0:
  print("Yes")
else:
  print("No")
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
 
if abs(a-c) <= d:
  print("Yes")
else:
  if abs(a-b) <= d and abs(b-c) <=d:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
 
if abs(a-c) <= d:
  print("Yes")
else:
  if abs(a-b) <= d and abs(b-c) <=d:
    print(Yes)
  else:
    print("No")

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

if ads(a-c) <= d:
  print("Yes")
else:
  if a-b <= d and b-c <=d:
    print(Yes)
  else:
    print("No")
Problem p03352 (python)

Fixed submission:
x = int(input())
l = []
for i in range(1, x+1): #b
  for j in range(2, 11): #p
    bq = i**j
    if bq > x:
      break
    l.append(bq)
print(max(l))

Buggy submission (verdict: Runtime Error):
x = int(input())
l = []
for i in range(1, x+1): #b
  for j in range(2, x+1): #p
    bq = i**j
    if bq > x:
      break
    l.append(bq)
print(max(l))
Problem p03369 (python)

Fixed submission:
s = input()
c = 0
for i in s:
  if i == "o":
    c+= 1
print(700+100*c)

Buggy submission (verdict: Runtime Error):
s = input()
c = 0
for i in s:
  if i == o:
    c+= 1
print(700+100*c)
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
if b-a < k:
  for i in range(a, b+1):
    print(i)
else:
  min_a = [i for i in range(a, a+k)]
  max_b = [i for i in range(b, b-k,-1)]
  r = min_a + max_b
  for i in list(sorted(set(r))):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b , k = map(int, input().split())
l = list(range(a, b+1))
if k > len(l):
  for i in l:
    print(i)
  quit()
result = l[:k] + l[-k:]
for i in sorted(set(result), key=result.index):
  print(i)

Buggy submission (verdict: Runtime Error):
a, b , k = map(int, input().split())
l = list(range(a, b+1))
result = l[:k] + l[-k:]
for i in result:
  print(i)
Problem p03427 (python)

Fixed submission:
def resolve():
    n = input()
    l = len(n)
    if n[1:] == "9" * (l-1): #c9999...99のとき
        print(int(n[0]) + 9*(l-1))
    else:
        print((int(n[0])-1) + (9*(l-1)))
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    n = input()
    l = len(n)
    if n[:1] == "9" * l-1: #c9999...99のとき
        print(int(n[0]) + 9*(l-1))
    else:
        print((int(n[0])-1) + (9*(l-1)))
resolve()
Problem p03434 (python)

Fixed submission:
import numpy as np
n= int(input())
a_list = sorted(list(map(int, input().split())),reverse=True)
a_array = np.array(a_list)
alice = a_array[::2]
bob = a_array[1::2]
print(sum(alice)-sum(bob))

Buggy submission (verdict: Runtime Error):
import numpy as np
n= int(input())
a_list = sorted(list(map(int, input().split())),reverse=True)
a_array = np.array(a_list)
alice = a_array[::2]
bob = a_array[1::2]
print(sum(alice-bob))
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
if s[a] != "-":
  print("No")
  quit()
for i in range(a+b+1):
  if i < a:
    if s[i] == "-":
      print("No")
      quit()
  if a < i:
    if s[i] == "-":
      print("No")
      quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
s = input()
if s[a] == "-" and s.count("-") == 1:
  print("Yes")
else:
  print("No")
Problem p03493 (python)

Fixed submission:
a = input()
c = 0
for i in a:
  if i=="1":
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
a = input()
c = 0
for i in c:
  if i=="1":
    c+=1
print(c)
Problem p03544 (python)

Fixed submission:
n = int(input())
l_i_1 = 2
l_i_2 = 1
if n >= 2:
  while n>=2:
    l_i = l_i_1 + l_i_2
    n -= 1
    l_i_1= l_i_2
    l_i_2 = l_i
  print(l_i)
elif n==1:
  print(1)
else:
  print(2)

Buggy submission (verdict: Runtime Error):
n = int(input())
l_i_1 = 2
l_i_2 = 1
while n>=2:
  l_i = l_i_1 + l_i_2
  n -= 1
  l_i_1= l_i_2
  l_i_2 = l_i
print(l_i)
Problem p03547 (python)

Fixed submission:
x, y = map(str, input().split())
if x == y:
  print("=")
else:
  if x=="A":
    print("<")
  elif x=="B":
    if y=="A":
      print(">")
    else:
      print("<")
  elif x == "C":
    if y=="A" or y=="B":
      print(">")
    else:
      print("<")
  elif x == "D":
    if y=="E" or y=="F":
      print("<")
    else:
      print(">")
  elif x == "E":
    if y == "F":
      print("<")
    else:
      print(">")
  else:
    print(">")

Buggy submission (verdict: Runtime Error):
x, y = map(str, input().split())
if x == y:
  print("=")
else:
  if x==A:
    print(">")
  elif x==B:
    if y==A:
      print("<")
    else:
      print(">")
  elif x == C:
    if y==A or y==B:
      print("<")
    else:
      print(">")