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

Fixed submission:
s=input();l = len;p = print
if (s[0]==s[-1] and l(s)%2==0) or (s[0]!=s[-1] and l(s)%2==1):
    p("First")
else:
    p("Second")

Buggy submission (verdict: Runtime Error):
s=input();l = len;p = print
if (s[0]==s[-1] * l(s)%2==0) + (s[0]!=s[-1] * l(s)%2==1):
    p("First")
else:
    p("Second")
s=input();l = len;p = print
if (s[0]==s[-1] * l(s)%2==0) + (s[0]!=s[-1] * l(s)%2==1):
    p("First")
else:
    p("Second")
Problem p03943 (python)

Fixed submission:
# -*- config: utf-8 -*-
 
 
 
 
a,b,c = map(int,raw_input().split())
j = 0
 
 
if a + b == c or a + c == b or b + c== a:
    j=1
 
if(j == 1):
    print 'Yes'
else:
    print 'No'

Buggy submission (verdict: Runtime Error):
# -*- config: utf-8 -*-
 
 
 
while(1):
    a,b,c = map(int,raw_input().split())
    j = 0
 
 
    if a + b == c or a + c == b or b + c== a:
        j=1
 
    if(j == 1):
        print 'Yes'
    else:
        print 'No'

Buggy submission (verdict: Runtime Error):
# -*- config: utf-8 -*-
 
 
 
for i in range(10):
    a,b,c = map(int,raw_input().split())
    j = 0
 
 
    if a + b == c or a + c == b or b + c== a:
        j=1
 
    if(j == 1):
        print 'Yes'
    else:
        print 'No'

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



for i in range(10):
    a,b,c = map(int,raw_input().split())
    j = 0


    if a + b == c or a + c == b or b + c== a:
        j=1

    if(j == 1):
        print 'YES'
    else:
        print 'NO'

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



while(1):
    a,b,c = map(int,raw_input().split())
    j = 0


    if a + b == c or a + c == b or b + c== a:
        j=1

    if(j == 1):
        print 'YES'
    else:
        print 'NO'

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


a = 0
b = 0
c = 0

a = input('>>>')
b = input('>>>')
c = input('>>>')

if a+b == c:
    j=1
if a+c == b:
    j=1
if b+c == a:
    j=1

if(j == 1):
    print 'YES'
else:
    print 'NO'

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


a = 0
b = 0
c = 0

a = input('>>>')
b = input('>>>')
c = input('>>>')

if a+b == c:
    j=1
if a+c == b:
    j=1
if b+c == a:
    j=1

if(j == 1):
    print 'YES'
else:
    print 'NO'
Problem p03962 (python)

Fixed submission:
item_list = [0]*101
cnt = 0
a = map(int, input().split())
for i in a:
    if not item_list[i]:
        item_list[i] = 1
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
item_list = [0]*100
cnt = 0
a = map(int, input().split())
for i in a:
    if not item_list[i]:
        item_list[i] = 1
        cnt += 1
print(cnt)
Problem p03862 (python)

Fixed submission:
def candy():
    n = []
    n = input().split()
    N = int(n[0])
    x = int(n[1])
    alist = [int(i) for i in input().split()]

    s = 0
    for i in range(0, N - 1):
        c = int(alist[i])
        d = int(alist[i + 1])
        if int( alist[i] + alist[i + 1] ) > x:
            if int( alist[i] ) >= x:
                alist[i] = x
                alist[i + 1] = 0
            else :
                alist[i + 1] = int(x - alist[i] )
            s += c - int(alist[i]) + d - int(alist[i + 1])
        """
        if int(alist[i]) > x:
            s = s + int(alist[i+1])
            alist[i+1] = 0

        if int(alist[i+1]) + int(alist[i]) > x:
            s = s + (int(alist[i+1]) + int(alist[i]) - x)
            alist[i+1] = x - int(alist[i])
        """
    print(s)
candy()

Buggy submission (verdict: Runtime Error):
def candy():
    n = input().split()
    N = int(n[0])
    x = int(n[1])
    alist = [int(i) for i in input().split()]

    s = 0
    for i in range(0, N - 1):
        c = alist[i] , d = alist[i + 1]
        if int( alist[i] + alist[i + 1] ) > x:
            if int( alist[i] ) >= x:
                alist[i] = x
                alist[i + 1] = 0
            else :
                alist[i + 1] = x - a[i] 
            s += c - alist[i] + d - alist[i + 1]
        /*  
        if int(alist[i]) > x:
            s = s + int(alist[i+1])
            alist[i+1] = 0

        if int(alist[i+1]) + int(alist[i]) > x:
            s = s + (int(alist[i+1]) + int(alist[i]) - x)
            alist[i+1] = x - int(alist[i])
        */
    print(s)
candy()

Buggy submission (verdict: Runtime Error):
def candy():
    boxNum, x = [int(i) for i in input().split()]
    ain = input()
    alist = ain.split(' ')

    s = 0
    for i in range(0, boxNum-1):
        c = alist[i] , d = alist[i + 1]
        if int( alist[i] + alist[i + 1] ) > x:
            if int( alist[i] ) >= x:
                alist[i] = x
                alist[i + 1] = 0
            else :
                alist[i + 1] = x - a[i] 
            s += c - alist[i] + d - alist[i + 1]
        /*  
        if int(alist[i]) > x:
            s = s + int(alist[i+1])
            alist[i+1] = 0

        if int(alist[i+1]) + int(alist[i]) > x:
            s = s + (int(alist[i+1]) + int(alist[i]) - x)
            alist[i+1] = x - int(alist[i])
        */
    print(s)
candy()
Problem p03944 (python)

Fixed submission:
def coloring():
    line = input()
    words = line.split()
    W = int(words[0])
    H = int(words[1])
    N = int(words[2])

    x = 0
    y = 0
    w = W
    h = H

    grid = []

    for i in range(h):
        for j in range(w):
            grid.append(0)

    for i in range(N):
        s = input()
        ws = s.split()
        x = int(ws[0])
        y = int(ws[1])
        a = int(ws[2])
        if a == 1:
            #rect = x * whole
            for i in range(h):
                for j in range(x):
                    grid[j + w * i] = 1

        if a == 2:
            #rect = (w - x) * whole
            for i in range(h):
                for j in range(x,w):
                    grid[j + w*i] = 1

        if a==3:
            #rect = whole * y
            for i in range(y):
                for j in range(w):
                    grid[j + w * i] = 1
        
        if a == 4:
            #rect = whole * (h - y)
            for i in range(y,h):
                for j in range(w):
                    grid[j + w*i] = 1

        
    print(grid.count(0))


coloring()

Buggy submission (verdict: Runtime Error):
def p_grid(w, h):
	for i in range(h):
		for j in range(w):
			print(grid[j + w*i], end='')
		print()

def coloring():
    line = input()
    words = line.split()
    W = int(words[0])
    H = int(words[1])
    N = int(words[2])

    x = 0
    y = 0
    w = W
    h = H

    grid = []

    for i in range(h):
        for j in range(w):
            grid.append(0)

    for i in range(N):
      s = input()
      ws = s.split()
      x = int(ws[0])
      y = int(ws[1])
      a = int(ws[2])
      if a == 1 or a==3:
        #rect = x * y
        for i in range(y):
            for j in range(x):
                grid[j + w * i] = 1

        for i in range(h):
		    for j in range(w):
			    print(grid[j + w*i], end='')
		    print()

      if a == 2:
        #rect = (w - x) * y
        for i in range(y):
            for j in range(x,w):
                grid[j + w*i] = 1

        for i in range(h):
		    for j in range(w):
			    print(grid[j + w*i], end='')
		    print()

      if a == 4:
        #rect = x * (h - y)
        for i in range(y,h):
            for j in range(x):
                grid[j + w*i] = 1

        for i in range(h):
		    for j in range(w):
			    print(grid[j + w*i], end='')
		    print()
        
    print(grid.count(0))




coloring()
Problem p03962 (python)

Fixed submission:
def paint():
    s = input()
    slist = s.split(' ')

    a = int(slist[0])
    b = int(slist[1])
    c = int(slist[2])
    count = 1
    if a != b:
        count += 1
    if a != c and b != c:
        count += 1

    print(count)

paint()

Buggy submission (verdict: Runtime Error):
def paint():
    a = int(input())
    b = int(input())
    c = int(input())
    count = 1
    if a != b:
        count += 1
    if a != c and b != c:
        count += 1

    print(count)

paint()

Buggy submission (verdict: Runtime Error):
def paint():
    a = int(input())
    b = int(input())
    c = int(input())
    count = 1
    if a != b:
        count += 1
    if a != c and b != c:
        count += 1

    

    print(count)

paint()

Buggy submission (verdict: Runtime Error):
def paint():
    a = int(input())
    b = int(input())
    c = int(input())
    count = 3

    if a == b:
        count -= 1
    if a == c:
        count -= 1
    if b == c:
        count -= 1

    print(count)

paint()
Problem p04043 (python)

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

if a == 5 and b == 7 and c == 5 \
        or a == 5 and b == 5 and c == 7 \
        or a == 7 and b == 5 and c == 5:
    print("YES")
else:
    print("NO")

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

if a == 5 and b == 7 and c == 5 \
        or a == 5 and b == 5 and c == 7 \
        or a == 7 and b == 5 and c == 5:
    print("YES")
else:
    print("NO")
Problem p03861 (python)

Fixed submission:
from decimal import Decimal
# round=lambda x:(x*2+1)//2
a,b,c=[int(i) for i in input().split()]
num1=(Decimal(b)/Decimal(c))
if(a%c==0):
    num2=int(Decimal(a)/Decimal(c))-1
else:
    num2=int(Decimal(a)/Decimal(c))

print(int(num1-num2))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
round=lambda x:(x*2+1)//2
a,b,c=[int(i) for i in input().split()]
num1=round(Decimal(b)/Decimal(c))
if(a%c==0):
    num2=round(a/c)-1
else:
    num2=round(a/c)

print(num1-num2)
Problem p03862 (python)

Fixed submission:
def minCandies(boxes,limit):
    out = 0
    for i in range(len(boxes) - 1):
        total = boxes[i] + boxes[i + 1]
        if total > limit:
            out += total - limit
            boxes[i + 1] = boxes[i + 1] - (total - limit)
            if boxes[i + 1] < 0:
                boxes[i + 1] = 0
    return out

num_of_boxes, limit = map(int,input().split())
boxes = list(map(int,input().split()))

if limit == 0:
    print(sum(boxes))
elif max([a + b for (a,b) in zip(boxes[:-1],boxes[1:])]) <= limit:
    print(0)
else:
    print(minCandies(boxes,limit))

Buggy submission (verdict: Runtime Error):
def minCandies(boxes,limit):
    out = 0
    for i in range(len(boxes) - 1):
        total = boxes[i] + boxes[i + 1]
        if total > limit:
            out += total - limit
            boxes[i + 1] = boxes[i + 1] - (total - limit)
            if boxes[i + 1] < 0:
                boxes[i + 1] = 0
    return out
    
num_of_boxes, limit = map(int,input().split())
boxes = list(map(int,input().split()))

if limit == 0:
    return sum(boxes)
elif max([a + b for (a,b) in zip(boxes[:-1],boxes[1:])) <= limit:
    return 0
else:
    return minCandies(boxes,limit)
Problem p03864 (python)

Fixed submission:
N,x =map(int, input().split())
candy = list(map(int, input().split()))
eat = 0

for i in range(N - 1):
    if(candy[i] + candy[i + 1] > x):
        ex = candy[i] + candy[i + 1] - x
        eat += ex
        if(candy[i + 1] >= ex):
            candy[i + 1] -= ex
        else:
            candy[i] -= ex - candy[i + 1]
            candy[i + 1] = 0
print(eat)

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

for i in range(N - 1):
    if(candy[i] + candy[i + 1] > x):
        ex = candy[i] + candy[i + 1] - x
        eat += ex
        if(candy[i + 1] >= ex):
            candy[i + 1] -= ex
        else:
            candy[i] -= ex - cndy[i + 1]
            candy[i + 1] = 0
print(eat)
Problem p04044 (python)

Fixed submission:
data = list(map(int, input().split()))
strings = [input() for _ in range(data[0])]
strings.sort()
s = ''
for x in strings:
    s += x
print(s)

Buggy submission (verdict: Runtime Error):
data = list(map(lambda x: int(x), input().split()))
strings = [input() for _ in range(data[1])]
strings.sort()
s = ''
for x in strings:
    s += x
print(s)
Problem p03881 (python)

Fixed submission:
a = [int(i) for i in raw_input().split()]
b = [int(i) for i in raw_input().split()]
c = [(a[i]/100.0,b[i]/100.0,(a[i]+b[i])/100.0,a[i]*1.0/(a[i]+b[i])) for i in range(len(a)) if a[i]+b[i]>0]
n = len(c)
c.sort(key=lambda item: item[3], reverse=True)
u = [0] * n
res = 1
for i in range(n):
    du = min(res / (c[i][2]), 1)
    u[i] = du
    res -= du * c[i][2]
    if res <=0:
        break
ans = 0
for i in range(n):
    ans += c[i][0] * u[i]

print ans

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in raw_input().split()]
b = [int(i) for i in raw_input().split()]
n = len(a)
c = [(a[i]/100.0,b[i]/100.0,(a[i]+b[i])/100.0,a[i]*1.0/(a[i]+b[i]+1e-10)) for i in range(n)]
c.sort(key=lambda item: item[3], reverse=True)
u = [0] * n
res = 1
for i in range(n):
    du = min(res / (c[i][2]), 1)
    u[i] = du
    res -= du * c[i][2]
    if res <=0:
        break
ans = 0
for i in range(n):
    ans += c[i][0] * u[i]

print ans

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in raw_input().split()]
b = [int(i) for i in raw_input().split()]
n = len(a)
c = [(a[i]/100.0,b[i]/100.0,(a[i]+b[i])/100.0,a[i]*1.0/(a[i]+b[i])) for i in range(n)]
c.sort(key=lambda item: item[3], reverse=True)
u = [0] * n
res = 1
for i in range(n):
    du = min(res / (c[i][2]), 1)
    u[i] = du
    res -= du * c[i][2]
    if res <=0:
        break
ans = 0
for i in range(n):
    ans += c[i][0] * u[i]

print ans
Problem p03891 (python)

Fixed submission:
# A B c
# d E f
# g h i

a = int(input())
b = int(input())
e = int(input())
g = a + b - e
h = a + e - g
t = b + e + h
c = t - a - b
d = t - a - g
f = t - d - e
i = t - g - h
print("{} {} {}".format(a,b,c))
print("{} {} {}".format(d,e,f))
print("{} {} {}".format(g,h,i))

Buggy submission (verdict: Runtime Error):

c = t - a - b
d = t - a - g
f = t - d - e
i = t - g - h

print("{} {} {}".format(a,b,c))
print("{} {} {}".format(d,e,f))
print("{} {} {}".format(g,h,i))
Problem p03909 (python)

Fixed submission:
H,W=map(int,input().split())
S=[input().split() for i in range(H)]
columns="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for h in range(H):
    for w in range(W):
        if S[h][w]=="snuke":
            print(columns[w]+str(h+1))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input().split() for i in range(H)]
columns=["A","B","C","D","E","F","G","H","I","J"]
for h in range(H):
    for w in range(W):
        if S[h][w]=="snuke":
            print(columns[w]+str(h+1))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input().split() for i in range(H)]
columns=["A","B","C","D","E","F","G","H"]
for h in range(H):
    for w in range(W):
        if S[h][w]=="snuke":
            print(columns[w]+str(h+1))
Problem p03911 (python)

Fixed submission:
from numpy import*
from scipy.sparse import*
(n,m),*p=[map(int,o.split())for o in open(0)]
e=array([(i,j+n-1,1)for i,q in enumerate(p)for j in list(q)[1:]]).T
print("NO"if 1 in csgraph.connected_components(csr_matrix(((e[2],e[:2])),[n+m]*2))[1][:n]else"YES")

Buggy submission (verdict: Runtime Error):
from numpy import*;from scipy.sparse import*;(n,m),*p=[map(int,o.split())for o in open(0)];e,*f=array([(i,j+n-1,1)for i,q in enumerate(p)for j in list(q)[1:]]).T[:3];print("YNEOS"[1in csgraph.connected_components(csr_matrix(((f,e)),[n+m]*2))[1][:n]::2])
Problem p03909 (python)

Fixed submission:
h,w = map(int, input().split())
s = [list(input().split()) for _ in range(h)]
i = 0
65
for v in s:
  i+=1
  if "snuke" in v:
    print(chr(v.index("snuke")+65)+str(i))

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = [list(input().split()) for _ in range(h)]
al = list("ABCDEFGHIJ")
i = -1
for v in s:
  i+=1
  if "snuke" in v:
    print(al[s[i].index("snuke")]+str(i+1))
    exit()
Problem p03910 (python)

Fixed submission:
N = int(input())
cnt = 0
for i in range(1, N+1):
  if i * (1 + i) // 2 >= N:
    cnt = i
    break
for i in range(cnt, 0, -1):
  if i <= N:
    print(i)
    N -= i

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
n = round((N//2) ** 0.5)
a,b = n+2, n+3
if a*(a+1)//2 > abs(a*(a+1)//2 - N):
    number = abs(a*(a+1)//2 - N)
    n = a
elif b*(b+1)//2 >= abs(b*(b+1)//2 - N):
    number = abs(b*(b+1)//2 - N)
    n = b

for i in range(1, n+1):
    if i == number: continue
    print(i)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
n = round((N//2) ** 0.5)
a,b = n+2, n+3
if a*(a+1)//2 > abs(a*(a+1)//2 - N):
    number = abs(a*(a+1)//2 - N)
    n = a
elif b*(b+1)//2 > abs(b*(b+1)//2 - N):
    number = abs(b*(b+1)//2 - N)
    n = b

for i in range(1, n+1):
    if i == number: continue
    print(i)
Problem p03910 (python)

Fixed submission:
n=int(input())
s=0
l=[]
for i in range(1,n+1):
 s+=i
 l.append(i)
 if s>=n:
  for j in l:
   if j!=s-n:
    print(j)
  break

Buggy submission (verdict: Runtime Error):
n=int(input())
s=0
l=[]
for i in　range(1,n+1):
 s+=i
 l.append(i)
 if s>=n:
  for j in l:
   if j!=s-n:
    print(j)
  break
Problem p03909 (python)

Fixed submission:
h,w=map(int,input().split())
a=[[i for i in input().split()] for j in range(h)]
p=[chr(i) for i in range(65,91)]
for r in range(h):
    for c in range(w):
        if a[r][c]=="snuke":
            print(p[c]+str(r+1))
            break

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[[i for i in input().split()] for j in range(h)]
p=[chr(i) for i in range(65,75)]
for r in range(h):
    for c in range(w):
        if a[r][c]=="snuke":
            print(p[c]+str(r+1))
            break
Problem p03909 (python)

Fixed submission:
H, W = map(int, input().split())
M = [input().split() for _ in range(H)]
for i, r in enumerate(M):
  for j, c in enumerate(r):
    if c == 'snuke':
      print("%s%d" %(chr(ord('A')+j), i+1))

Buggy submission (verdict: Runtime Error):
H, W = map(int, intput().split())
M = [input().split() for _ in range(H)]
for i, r in enumerate(M):
  for j, c in enumerate(r):
    if c == 'snuke':
      print("%s%d" %(chr(ord('A')+j), i))
Problem p03909 (python)

Fixed submission:
H,W = map(int,input().split())
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(H):
  for j,s in enumerate(input().split()):
    if s == 'snuke':
      print(alp[j]+str(i+1))
      exit()

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
alp = 'ABCDEFGHIJ'
for i in range(H):
  for j,s in enumerate(input().split()):
    if s == 'snuke':
      print(alp[j]+str(i+1))
      exit()
Problem p03909 (python)

Fixed submission:
a,b=map(int,input().split())
ls = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
x = [list(input().split()) for i in range(a)]
for i in range(a):
  for j in range(b):
    if x[i][j] == "snuke":
      print(ls[j]+str(i+1))
      break

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ls = ["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
x = [list(input().split()) for i in range(a)]
for i in range(a):
  for j in range(b):
    if x[a][b] == "snuke":
      print(ls[a]+str(b+1))
      break
Problem p03910 (python)

Fixed submission:
n = int(input())
for i in range(1,n+2):
  if i*(i+1)//2 > n:
    x = i
    y = i*(i+1)//2 - n
    break
for i in range(1,x+1):
  if i != y:
    print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(1,n):
  if i*(i+1)//2 > n:
    x = i
    y = i*(i+1)//2 - n
    break
for i in range(1,x+1):
  if i != y:
    print(i)
Problem p03912 (python)

Fixed submission:
from collections import Counter
n,m = map(int, input().split())
a = list(map(int, input().split()))
amax = max(a)
c = [0]*(amax+1)
b = [a[i]%m for i in range(n)]
rem = [0]*m
for i in range(n):
    rem[b[i]] += 1
    c[a[i]] += 1
ans = 0
for i in range(m//2+1):
    if i == 0 or i*2 == m:
        ans += rem[i]//2
        rem[i] -= rem[i]//2*2
        continue
    less = min(rem[i],rem[m-i])
    ans += less
    rem[i] -= less
    rem[m-i] -= less
for j in range(amax//m+1):
    for i in range(m):
        if m*j+i<=amax:
            if rem[i] >= c[m*j+i]:
                ans += c[m*j+i]//2
                rem[i] -= c[m*j+i]//2*2
            else:
                ans += rem[i]//2
                rem[i] -= rem[i]//2*2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n,m = map(int, input().split())
a = list(map(int, input().split()))
c = [0]*100001
b = [a[i]%m for i in range(n)]
rem = [0]*m
for i in range(n):
    rem[b[i]] += 1
    c[a[i]] += 1
ans = 0
for i in range(m//2+1):
    if i == 0 or i*2 == m:
        ans += rem[i]//2
        rem[i] -= rem[i]//2*2
        continue
    less = min(rem[i],rem[m-i])
    ans += less
    rem[i] -= less
    rem[m-i] -= less
for j in range(n//m+1):
    for i in range(m):
        if rem[i] >= c[m*j+i]:
            ans += c[m*j+i]//2
            rem[i] -= c[m*j+i]//2
        else:
            ans += rem[i]//2
            rem[i] -= rem[i]//2
print(ans)
Problem p03913 (python)

Fixed submission:
n,a = map(int,input().split())
if n == 1:
  print(1)
  exit()
if n <= a:
  print(n)
  exit()
#n <= x**(k-i)*(x-1)**iのk-iを返す
def border(x,k):
  L = 0
  R = k
  while L+1 < R:
    M = (L+R)//2
    if x**(k-M)*(x-1)**(M) < n:
      R = M
    else:
      L = M
  return k-L
def sec(k):
  y = int(n**(1/k))+1
  if (y-1)**k < n <= y**k:
    x = y
  elif y**k < n <= (y+1)**k:
    x = y+1
  elif (y-2)**k < n <= (y-1)**k:
    x = y-1
  b = border(x,k)
  return (x+a)*k-(k-b)
ansls = []
for i in range(1,51):
  ansls.append(sec(i))
print(min(ansls)-a)

Buggy submission (verdict: Runtime Error):
n,a = map(int,input().split())
if n == 1:
  print(1)
  exit()
l = -1
r = 10**12+1
#n <= x**(k-i)*(x-1)**iのk-iを返す
def border(x,k):
  if k >= 40:
    return (n-1).bit_length()
  else:
    L = 0
    R = k
    while L+1 < R:
      M = (L+R)//2
      if x**(k-M)*(x-1)**(M) < n:
        R = M
      else:
        L = M
    return k-L
def sec(k):
  if k >= 40:
    x = 2
  else:
    y = int(n**(1/k))+1
    if (y-1)**k < n <= y**k:
      x = y
    elif y**k < n <= (y+1)**k:
      x = y+1
    elif (y-2)**k < n <= (y-1)**k:
      x = y-1
  b = border(x,k)
  return (x+a)*k-(k-b)

while l+2 < r:
  ml = (l*2+r)//3
  mr = (l+r*2)//3
  if sec(ml) < sec(mr):
    r = mr
  else:
    l = ml
print(sec(l+1)-a)
Problem p03909 (python)

Fixed submission:
from string import ascii_uppercase
H, W = [int(i) for i in input().split()]
S = [input().split() for _ in range(H)]
for h in range(H):
    for w in range(W):
        if S[h][w] == "snuke":
            print("{}{}".format(ascii_uppercase[w], h+1))

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
X = [0] * (10 ** 5)
# X = [0] * (10)
for i in map(int, input().split()):
    X[i] += 1
Y = [sum(X[i::M]) for i in range(M)]
ans = Y[0] // 2
Y[0] = 0
for i in range(1, M//2+M%2):
    j = M - i
    tmp = min(Y[i], Y[j])
    ans += tmp
    Y[i] -= tmp
    Y[j] -= tmp
for i, n in enumerate(X):
    j = i % M
    if Y[j] < 2 or n < 2:
        continue
    tmp = min(Y[j]-Y[j]%2, n-n%2)
    ans += tmp // 2
    Y[j] -= tmp
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
S = tuple(map(lambda x: (x**2+x)//2, range(5000)))
while N > 0:
    i = bisect.bisect_left(S, N)
    N -= i
    #print(i, N, S)
    print(i)