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

Fixed submission:
n = int(input())

from fractions import Fraction

for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j - n*i - n*j > 0:
            if (i * j * n) % (4*i*j - n*i - n*j) == 0 and (i * j * n) // (4*i*j - n*i - n*j) > 0:
                print(i,j, (i * j * n) // (4*i*j - n*i - n*j))
                import sys
                sys.exit()

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

from fractions import Fraction

for i in range(1,3501):
    for j in range(1,3501):
        if (i * j * n) % (4*i*j - n*i - n*j) == 0 and (i * j * n) // (4*i*j - n*i - n*j) > 0:
            print(i,j)
            print((i * j * n) // (4*i*j - n*i - n*j))
            import sys
            sys.exit()
Problem p03587 (python)

Fixed submission:
s = list(input())

ans = 0

for ss in s:
    ans += int(ss)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())

ans = 0

for ss in s:
    ans += int(s)
print(ans)
Problem p03674 (python)

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

MOD = 10**9 + 7
N = 10**5+1

fact = [1]*(N+1)
rfact = [1]*(N+1)
r = 1
for i in range(1, N+1):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

from collections import defaultdict
dic = defaultdict(int)

for idx, a in enumerate(al):
    if dic[a] == 1:
        e = idx
        v = a
    dic[a] += 1

for idx, a in enumerate(al):
    if a == v:
        s = idx
        break


for i in range(1, n+2):
    ans = comb(n+1, i)
    if s + n - e >= i - 1:
        ans -= comb(s+(n-e), i-1)
    ans %= MOD
    print(ans)

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

MOD = 10**9 + 7
N = 10**5

fact = [1]*(N+1)
rfact = [1]*(N+1)
r = 1
for i in range(1, N+1):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

from collections import defaultdict
dic = defaultdict(int)

v = 0
s = 0
e = 0
for idx, a in enumerate(al):
    if dic[a] == 1:
        e = idx
        v = a
    dic[a] += 1

for idx, a in enumerate(al):
    if a == v:
        s = idx
        break


for i in range(1, n+2):
    ans = comb(n+1, i)
    if s + n - e >= i - 1:
        ans -= comb(s+(n-e), i-1)
    ans %= MOD
    print(ans)

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

MOD = 10**9 + 7
N = 10**5

fact = [1]*(N+1)
rfact = [1]*(N+1)
r = 1
for i in range(1, N+1):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

from collections import defaultdict
dic = defaultdict(int)

for idx, a in enumerate(al):
    if dic[a] == 1:
        e = idx
        v = a
    dic[a] += 1

for idx, a in enumerate(al):
    if a == v:
        s = idx
        break


for i in range(1, n+2):
    ans = comb(n+1, i)
    if s + n - e >= i - 1:
        ans -= comb(s+(n-e), i-1)
    ans %= MOD
    print(ans)
Problem p03695 (python)

Fixed submission:
color = [0 for i in range(8)]

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

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(sum(color) + p)

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

ansl = [0] * 9

for a in al:
    ansl[a//400] += 1

min_ans = 0
for a in ansl[:8]:
    if a > 0:
        min_ans += 1

max_ans = min_ans
if ansl[-1] > 0:
    if min_ans == 0:
        min_ans += 1
        max_ans += ansl[-1]
    else:
        max_ans = min_ans + ansl[-1]

print(min_ans, max_ans)

Buggy submission (verdict: Runtime Error):
color = [0 for i in range(8)]

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

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(min(sum(color) + p))
Problem p03937 (python)

Fixed submission:
h,w = map(int,input().split())

al = []

for _ in range(h):
   a = list(input())
   al.append(a)

i,j = 0,0
while True:
    al[i][j] = "."
    if j + 1 < w and al[i][j+1] == "#":
        al[i][j+1] = "."
        j += 1
    elif i + 1 < h and al[i+1][j] == "#":
        al[i+1][j] = "."
        i += 1
    else:
        print("Impossible")
        exit()
    if j == w-1 and i == h-1:
        break

for i in range(h):
    for j in range(w):
        if al[i][j] == '#':
            print("Impossible")
            exit()
print("Possible")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())

al = []

for _ in range(h):
   a = list(input())
   al.append(a)

i,j = 0,0
while True:
    al[i][j] = "."
    if j + 1 < w and al[i][j+1] == "#":
        al[i][j+1] = "."
        j += 1
    elif i + 1 < h and al[i+1][j] == "#":
        al[i+1][j] = "."
        i += 1
    else:
        print("Impossible")
        exit()
    if j == w-1 and i == h-1:
        break

for i in range(h):
    for j in range(h):
        if al[i][j] == '#':
            print("Impossible")
            exit()
print("Possible")
Problem p03994 (python)

Fixed submission:
sl = list(input())
k = int(input())

for i in range(len(sl)):
    ord_s = ord(sl[i])
    use = 123 - ord_s
    if k - use >= 0 and sl[i] != "a":
        sl[i] = "a"
        k -= use

if k > 0:
    sl[-1] = chr((ord(sl[-1]) + k - 97) % 26 + 97)

print("".join(sl))

Buggy submission (verdict: Runtime Error):
sl = list(input())
k = int(input())

for i in range(len(sl)):
    ord_s = ord(sl[i])
    use = 123 - ord_s
    if k - use >= 0:
        sl[i] = "a"
        k -= use

if k > 0:
    sl[-1] = chr(ord(sl[-1]) + k)

print("".join(sl))
Problem p04015 (python)

Fixed submission:
n,a = map(int,input().split())
xl = list(map(int,input().split()))

# i個のカードまで使って和がjの組み合わせ
dp = [[0 for i in range(50*50+1)] for j in range(51)]
dp[0][0] = 1

for i in range(n):
    for j in range(n-1, -1, -1):
        for k in range(50*50+1):
            if k+xl[i] < 50*50+1:
                dp[j+1][k+xl[i]] += dp[j][k]
ans = 0
for i in range(1,n+1):
    ans += dp[i][i*a]

print(ans)

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

# i個のカードまで使って和がjの組み合わせ
dp = [[0 for i in range(50*50+1)] for j in range(51)]
dp[0][0] = 1

for i in range(n):
    for j in range(n, -1, -1):
        for k in range(50*50+1):
            if k+xl[i] < 50*50+1:
                dp[j+1][k+xl[i]] += dp[j][k]
ans = 0
for i in range(1,n+1):
    ans += dp[i][i*a]

print(ans)
Problem p02675 (python)

Fixed submission:
N= int(input())
N = str(N)
n = N[-1]
if n == "3":
    print("bon")
elif n == "0" or n == "1" or n =="6" or n == "8":
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N= int(input())
N = str(N)
n = N[-1]
f n == "3":
    print("bon")
elif n == "0" or n == "1" or n =="6" or n == "8":
    print("pon")
else:
    print("hon")
Problem p02694 (python)

Fixed submission:
import math
X=int(input())
count = 0
a = 100
while True:
    if a >= X:
        print(count)
        break
    else:
        a  = math.floor(a*1.01)
        count= count+1

Buggy submission (verdict: Runtime Error):
X=int(input())
count = 0
a = 100

while True:
    if a > X:
        print(count)
        break
    else:
        a  = math.floor(a*1.01)
        count= count+1
Problem p02801 (python)

Fixed submission:
c = input()
list=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
l = list.index(c) + 1
c = list[l]
print(c)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
i = input().split() 
i2 = [int(s) for s in i]
score = sum(i2)
aim = int(N) * int(M)
d = aim - score
K = int(K)
if d > K:
    d = -1
elif 0 >=  d:
    d = 0
print(d)
Problem p02811 (python)

Fixed submission:
K,X = list(map(int, input().split()))
A = 500*K 
if A >= X:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input()) 
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
A = list(range(1,N+1))
Alist=[]
import itertools
for v in itertools.permutations(A):
        Alist.append(v)
a_num = Alist.index(P)+1
b_num = Alist.index(Q)+1
print(abs(b_num - a_num))
Problem p02817 (python)

Fixed submission:
s = input().split()
S = s[0]
T = s[1]
W1=T+S
print(W1)

Buggy submission (verdict: Runtime Error):
A, B, K  = list(map(int, input().split()))
for i in range(K):
    if A >= 1:
        A = A-1
    elif B >= 1:
        B = B-1
    elif A == 0 and B == 0:
        break
print(A,B)
Problem p03254 (python)

Fixed submission:
N,X = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
m = sum(a)
count = 0
S=0
if m == X:
    print(N)
elif m < X:
    print(N-1)
elif a[0] > X:
    print(0)
else: 
    for i in a:
        if S <= X:
            S = S + i
            count = count + 1
    else:
        print(count-1)

Buggy submission (verdict: Runtime Error):
N,X = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
m = sum(a)
count = 0
S=0
if m == X:
    print(N)
elif m < X:
    print(N-1)
elif a[0] > X:
    print(0)
else: 
    for i in a:
        if S < X:
            S = S + i
            count = count + 1
    else:
        print(count-1)
N,X = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
m = sum(a)
count = 0
S=0
if m == X:
    print(N)
elif m < X:
    print(N-1)
elif a[0] > X:
    print(0)
else: 
    for i in a:
        if S <= X:
            S = S + i
            count = count + 1
    else:
        print(count-1)
Problem p03456 (python)

Fixed submission:
a,b = input().split()
C = a + b
number_list =list(range(1,1000))
squared_list =[]
for i in number_list:
        D = i * i
        D2 = str(D)
        squared_list.append(D2)
if C in squared_list:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
number_list =list(range(1,1000))
squared_list =[]
for i in number_list:
        D = i * i
        D = str(D)
        squared_list.append(D)
if C in squared_list:
    print("Yes")
else:
    print("No")
Problem p02747 (python)

Fixed submission:
S = input()
hitachi = 'hi'
i = 1
 
while True:
    corect = hitachi * i
    if S == corect:
        print('Yes')
        break
    i += 1
    if i == 20:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
S = input()
hitachi = 'hi'
i = 1
 
while True:
  corect = hitachi * i
  if S == corect:
  	print('Yes')
    break
  i += 1
  if i == 20:
    print('No')
    break

Buggy submission (verdict: Runtime Error):
S = input()
hitachi = 'hi'
i = 1
 
while True:
  corect = hitachi * i
  if S == hitachi:
  	print('Yes')
    break
  i += 1
  if i == 20:
    print('No')
    break

Buggy submission (verdict: Runtime Error):
S = input()
hitachi = 'hi'
i = 1

while True:
  corect = hitachi * i
  if S == hitachi:
  	print('Yes')
    break
  i += 1
  if i == 20:
    print('No')
Problem p03059 (python)

Fixed submission:
a,b,t = map(int, input().split(" "))

total=int(t/a)*b

print(total)

Buggy submission (verdict: Runtime Error):

  a,b,t = map(int, input.split(" "))
  
  total=0
  
  for i in range(1,20):
    if a*i > t:
      break
    else:
      total += b
  
  print(total)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
n = [a, b, c, d, e]

zr = list(filter(lambda x: x % 10 == 0, n))
nz = list(filter(lambda x: x % 10 != 0, n))

nz.sort(key=lambda x: x % 10)

for i in range(1, len(nz)):
    nz[i] = 10 * (nz[i]//10+1)

print(sum(nz)+sum(zr))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
n = list(a, b, c, d, e)

sorted(n, key=lambda x: x % 10)

for i in range(1, 5):
    n[i] = 10 * (n[i]//10+1)

sm = sum(n)
print(sm)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
n = list(a, b, c, d, e)

n.sort(key=lambda x: x % 10)

for i in range(1, 5):
    n[i] = 10 * (n[i]//10+1)

sm = sum(n)
print(sm)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
n = list(a, b, c, d, e)

n.sort(key=lambda x: x % 10)

for i in range(1, 5):
    n[i] = 10 * (n[i]//10+1)

sm = sum([n[i] for i in range(1, 5)])+n[0]
print(sm)
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()
l, r = [], []
for i in range(q):
    ls, rs = map(int, input().split())
    l.append(ls)
    r.append(rs)

c = [0 for i in range(n)]

for i in range(n-1):
    fnd = 0
    if s[i:i+2] == 'AC':
        fnd = 1
    c[i+1] = c[i]+fnd

for i in range(q):
    print(c[r[i]-1]-c[l[i]-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
l, r = [], []
for i in range(q):
    ls, rs = map(int, input().split())
    l.append(ls)
    r.append(rs)

m = []
i = 0
while i < n:
    if s[i] == 'A' and s[i+1] == 'C':
        m.append(i)
    i += 1

ans = 0
for i in range(q):
    lt, gt = l[i]-1, r[i]-1
    for j in m:
        if j >= lt:
            if j+1 <= gt:
                ans += 1

    print(ans)
    ans = 0
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, raw_input().split())
mul = 0
if x*2 == W and y*2 == H:
 mul = 1
A = W * H / 2.0
print '%f %d' % (A, mul)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, raw_input().split())
mul = 0
if x*2 == W and y*2 == H:
    mul = 1
A = W * H / 2.0
print '%f %d' % (A, mul)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, raw_input().split())
int mul = 0
if x*2 == W and y*2 == H:
 mul = 1
A = W * H / 2.0
print '%f %d' % (A, mul)
Problem p02678 (python)

Fixed submission:
from collections import deque

mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    n, m = map(int,raw_input().split())
    
    adj_list = [[] for _ in range(n+5)]
    
    q = deque()
    
    ans = [-1] * (n+5)
    
    failed = False
    
    for _ in range(m):
        a, b = map(int,raw_input().split())    
        adj_list[a].append(b)
        adj_list[b].append(a)
    
    q.append(1)
    
    #print(adj_list)
    
    visited = set()
    
    visited.add(1)
    
    while len(q):
        sz = len(q)
        for _ in range(sz):
            cur = q.popleft()
            for nei in adj_list[cur]:
                if nei not in visited:
                    ans[nei] = cur
                    q.append(nei)
                    visited.add(nei)
    
    
    print('Yes')
    for i in range(2, n+1):
        print(ans[i])
            
            
        
        
    
    

main()

Buggy submission (verdict: Runtime Error):
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    n, m = map(int,raw_input().split())
    
    adj_list = [[] for _ in range(n+5)]
    
    q = []
    
    ans = [-1] * (n+5)
    
    failed = False
    
    for _ in range(m):
        a, b = map(int,raw_input().split())    
        adj_list[a].append(b)
        adj_list[b].append(a)
    
    q.append(1)
    
    #print(adj_list)
    
    visited = set()
    
    visited.add(1)
    
    while len(q):
        sz = len(q)
        for _ in range(sz):
            cur = q.pop(0)
            for nei in adj_list[cur]:
                if nei not in visited:
                    ans[nei] = cur
                    q.append(nei)
                    visited.add(nei)
    
    
    print('Yes')
    for i in range(2, n+1):
        print(ans[i])
            
            
        
        
    
    

main()
Problem p02778 (python)

Fixed submission:
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
  	n = len(raw_input())
  	temp = ['x' for _ in range(n)]
  	#print(temp)
  	print(''.join(temp))
    #ans = ''.join(temp)
	#print(ans)
    

main()

Buggy submission (verdict: Runtime Error):
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
  	n = len(raw_input())
    ans = ''.join(['x' for _ in range(n)])
	print(ans)
    

main()
Problem p02801 (python)

Fixed submission:
ch = raw_input()
print(chr(ord(ch) + 1))

Buggy submission (verdict: Runtime Error):
ch = ord(raw_input())
print(chr(ord(ch) + 1))
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:
    print(x + 1)
Problem p02630 (python)

Fixed submission:
N = int(input())
numbers = list(map(int,input().split()))
numOfOperation = int(input())
dic = {}

for num in numbers:
    if num in dic : dic[num] += 1
    else: dic[num] = 1
    

sums = sum(numbers)
for i in range(numOfOperation):
    B,C = map(int,input().split())
    if (B in dic) : 
        cnt = dic[B]
        dic[B] = 0
        if (C not in dic) : dic[C] = cnt
        else : dic[C] += cnt
        sums += cnt * (C - B)
    print(sums)

Buggy submission (verdict: Runtime Error):
N = int(input())
numbers = list(map(int,input().split()))
numOfOperation = int(input())
dic = {}

for num in numbers:
    if num in dic : dic[num] += 1
    else: dic[num] = 1
    

sums = sum(numbers)
for i in range(numOfOperation):
    B,C = map(int,input().split())
    cnt = dic[B]
    dic[B] = 0
    if (C not in dic) : dic[C] = 1
    else : dic[C] += cnt
    sums += cnt * (C - B)
    print(sums)

Buggy submission (verdict: Runtime Error):
N = int(input())
numbers = list(map(int,input().split()))
numOfOperation = int(input())
dic = {}

for num in numbers:
    if num in dic : dic[num] += 1
    else: dic[num] = 1
    

sums = sum(numbers)
for i in range(numOfOperation):
    B,C = map(int,input().split())
    cnt = dic[B]
    dic[B] = 0
    dic[C] += cnt
    sums += cnt * (C - B)
    print(sums)
Problem p02687 (python)

Fixed submission:
a = input()

if a == 'ABC':
    print('ARC')
elif a == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
a = input()
if a == input():
    print('ARC')
elif a == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
a = input()
if a = input():
    print('ARC')
elif a == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
a = input()
    print('ARC')
elif a == 'ARC':
    print('ABC')
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())

try:
  p = set(map(int, input().split()))
  num = set(range(-100,201))
  mem = []

  ref = sorted(list(num - p))

  for item in ref:
    mem.append(abs(item - X))
  
  print(ref[mem.index(min(mem))])

except EOFError:
  print(X)

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

try:
  p = set(map(int, input().split()))
  num = set(range(1,101))
  mem = []

  ref = sorted(list(num - p))

  for item in ref:
    mem.append(abs(item - X))

  print(ref[mem.index(min(mem))])

except EOFError:
  print(X)

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

try:
  p = set(map(int, input().split()))
  num = set(range(1,101))
  mem = []
  result = -1

  ref = sorted(list(num - p))

  for item in ref:
    mem.append(abs(X - item))

  print(ref[mem.index(min(mem))])

except EOFError:
  print(X)
Problem p02681 (python)

Fixed submission:
old_id=input()
new_id=input()

try:
  result = "Yes" if len(old_id)+1 == len(new_id) and old_id.index(new_id[0]) == 0 and old_id in new_id else "No"
  print(result)
except ValueError:
  print("No")

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

if card[3] <= card[0]:
  result = card[3]
elif card[0] < card[3] and card[3] <= card[1]:
  result = card[0]
else:
  result = card[0] - (card[3] - (card[0] + card[1]))

print(result)

Buggy submission (verdict: Runtime Error):
old_id=input()
new_id=input()

result = "Yes" if len(old_id)+1 == len(new_id) and old_id.index(new_id[0]) == 0 and old_id in new_id else "No"
print(result)
Problem p02765 (python)

Fixed submission:
i = list(map(int, input().split()))
N = i[0]
R = i[1]
 
result = R if N >= 10 else R + 100 * (10 - N)
 
print(result)

Buggy submission (verdict: Runtime Error):
import math
 
i = input().split()
N = int(i[0])
K = int(i[1])
result = 0
 
result = math.log(N, K)
result = 1 + int(result)

 
print(result)

Buggy submission (verdict: Runtime Error):
import math

i = input().split()
N = int(i[0])
K = int(i[1])
result = 0

result = math.log(N, K)
if int(result) != result:
  result = 1 + int(result)
else:
  result = int(result)

print(result)

Buggy submission (verdict: Runtime Error):
import math

i = input().split()
N = int(i[0])
K = int(i[1])
result = 0

result = math.log(N, K)
if int(result) != result:
  result = 1 + int(result)
else:
  result = int(result)

print(result)

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
N = i[0]
R = i[1]
 
result = R if N >= 10 : else 100 * (10 - R)
 
print(result)
Problem p02767 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
ans = []

for i in range(1, max(x)+1):
    p = 0
    for j in x:
        p += (j - i) ** 2
    ans.append(p)

if len(ans) == 0:
    print(0)
    exit()
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
if n == 0:
    print(n)
    exit()
ans = []
for i in range(1, max(x)):
    p = 0
    for j in x:
        p += (j - i)**2
    ans.append(p)
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
ans = []
for i in range(1, max(x)):
    p = 0
    for j in x:
        p += (j - i)**2
    ans.append(p)
print(min(ans))
Problem p02783 (python)

Fixed submission:
h, a = map(int, input().split())
ans = 0
while h>0:
    h -= a
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[:0 if n<=k else n-k]))
Problem p02813 (python)

Fixed submission:
import sys
import itertools

input = sys.stdin.readline
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

l = list(itertools.permutations([i for i in range(1, n+1)], n))
x = sorted([l.index(p)+1, l.index(q)+1], reverse=True)
print(x[0] - x[1])

Buggy submission (verdict: Runtime Error):
import sys
import itertools

input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

l = list(itertools.permutations([i for i in range(1, n+1)], 3))
x = sorted([l.index(p)+1, l.index(q)+1], reverse=True)
print(x[0] - x[1])
Problem p03469 (python)

Fixed submission:
print(input().replace("2017", "2018"))

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

for i in range(n):
    for j in range(n):
        for k in range(n):
            a = i * 10000
            b = j * 5000
            c = k * 1000
            num = i + j + k
            price = a + b + c
            if num == 9 and price == y:
                print(i, j, k)
                exit()
print(-1, -1, -1)
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
ans = "No"
num = [i for i in range(10)]

if len(s) == a+b+1:
    if s[a] == "-":
        s = list(s)
        s.pop(a)
        s = "".join(s)
        if s.isdigit():
            ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
print("Yes" if len(s) == a+b+1 and s[a] == "-" and s[a+1] != "-" and s[a-1] != "-" else "No")