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

Fixed submission:
import math

N, A, B = map(int, input().split())

result = 0

a = math.floor(N / (A + B))
r = N % (A + B)

if r > A:
    ad = A
else:
    ad = r

result = A * a + ad
print(result)

Buggy submission (verdict: Runtime Error):
import math

N, A, B = map(int, input().split())

def make():
    b = [1] * A
    r = [0] * B
    return b + r

a = N / (A + B)
a = math.ceil(a)

result = []
for i in range(a):
    result = result + make()

acc = sum(result[0:N])
print(acc)

Buggy submission (verdict: Runtime Error):
import math

N, A, B = map(int, input().split())

def make():
    b = 'b' * A
    r = 'r' * B
    balls = b + r
    return balls

a = N / (A + B)
a = math.ceil(a)

result = ''
for i in range(a):
    result = result + make()

acc = result[0:N].count('b')

print(acc)
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())

print(max(C - (A - B), 0))

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
print(max(C - (A - B), 0)
Problem p02629 (python)

Fixed submission:
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

N=int(input())
print(num2alpha(N).lower())

Buggy submission (verdict: Runtime Error):
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

N=int(input())
input(num2alpha(N).lower())
Problem p02701 (python)

Fixed submission:
N = int(input())
d = [input() for i in range(N)]
print(len(set(d)))
print()

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
print(len(set(d)))
Problem p02594 (python)

Fixed submission:
x = int(input())

if x >= 30:
  print('Yes')
else:
  print('No')

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

def temp(num):
  if num >= 30:
    print('Yes')
  else:
    print('No')
    
temp(x)

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

if x >= 30:
  print("Yes")
  
else:
  print("No")

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

if x >= 30:
  print("Yes")
 
else:
  print("No")
Problem p02594 (python)

Fixed submission:
x=input() 
x=int(x) 
if x>=30:
  print ('Yes') 
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x=input () 
if x>=30:
  print ('Yes') 
else:
  print('No')
Problem p02595 (python)

Fixed submission:

n,d= input().split(" ")
n=int(n)
d=int(d) 
count=0
for i in range(n):
  x,y= input().split(" ")
  x=int(x)
  y=int(y) 
  dist=((x**2) + (y**2))**0.5
  if dist<=d:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=input()
n=int(n) 
d=input()
d=int(d) 
count=0
for i in range(n):
  x=input()
  y=input()
  x=int(x)
  y=int(y)
  dist=((x**2) + (y**2))**0.5
  if dist<=d:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input()) 
d=int(input())
count=0
for i in range(n):
  x=input()
  y=input()
  x=int(x)
  y=int(y)
  dist=np.sqrt((x**2) + (y**2))
  if dist<=d:
    count+=1
print(count)
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
k, n = map(int,input().split())
a = list(map(int, input().split()))
ans1 = max(a) - min(a)
for i in range (0,n):
    if a[i] >= (k/2):
        a[i] = a[i] - k
ans2 = abs(max(a) - min(a))
print(min(ans1,ans2))
Problem p02753 (python)

Fixed submission:
s = input()
if s == "AAA":
  print("No")
elif s == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
r=-1
for i in range(1001):
    if i*8//100==a and i*10//100==b:
        r=i
        break
print(r)
Problem p02754 (python)

Fixed submission:
n,a,b=map(int,input().split())
ans = n//(a+b)*a + min(n%(a+b),a)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
r=-1
for i in range(1001):
    if i*8//100==a and i*10//100==b:
        r=i
        break
print(r)
Problem p02912 (python)

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Buggy submission (verdict: Runtime Error):
n, m, *a = map(int, open(0).read().split())

a = sorted(a, reverse=True)

for i in range (0,m):
  a[0] = a[0]//2
  if a[0] < a[1]:
    a = sorted(a, reverse=True)
    if a[0] == 0:
      break

print(sum(a))
Problem p02970 (python)

Fixed submission:
N,D = map(int,input().split())
if N % (D*2+1) != 0:
  p = N // (D*2+1) + 1
else:
  p = N // (D*2+1)
  
print(p)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
if N % (D*2+1) != 0:
  p = n // (d*2+1) + 1
else:
  p = n // (d*2+1)
  
print(p)

Buggy submission (verdict: Runtime Error):
import math
N, D = map(int, input().split())
person = math.cell(N / (D*2+1))
print(person)

Buggy submission (verdict: Runtime Error):
import math
N, D = int(input())
person = math.cell(N / (D*2+1))
print(person)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a < 3200:
    print("red")
else:
  	print(s)

Buggy submission (verdict: Runtime Error):
a = int(input())
s = input()
if a < 3200:
    print("red")
else:
  	print(b)
Problem p02711 (python)

Fixed submission:
n = int(input())
if n%10==7:
  print('Yes')
else:
  n=n//10
  if n%10==7:
    print('Yes')
  elif n//10==7:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%10=7:
  print('Yes')
else:
  n=n//10
  if n%10=7:
    print('Yes')
  else if n//10=7:
    print('Yes')
  else:
    print('No')
Problem p02594 (python)

Fixed submission:
if int(input()) >= 30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
temp = input()
if temp > 30:
    print('Yes')
else:
    print('No')
Problem p02659 (python)

Fixed submission:
a,b=input().split()
from decimal import Decimal
ans=Decimal(a)*Decimal(b)
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
from decimal import Decimal
ans=Decimal(a)*Decimal(b)
print(int(ans))a,b=input().split()
from decimal import Decimal
ans=Decimal(a)*Decimal(b)
print(int(ans))
Problem p02679 (python)

Fixed submission:
import functools
MOD=10**9+7

def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)

def gcd(nums):
  return functools.reduce(euclid, nums)

n=int(input())
t=[]
for i in range(n):
    a,b=map(int,input().split())
    t.append((a,b))
z=0
y={}
for i in range(n):
    if t[i][0]==0 and t[i][1]==0:
        z+=1
    else:
        g=abs(gcd([t[i][0],t[i][1]]))
        if t[i][1]==0:
            a=(1,0)
        elif t[i][1]>0:
            a=(t[i][0]//g , t[i][1]//g)
        else:
            a=(-t[i][0]//g , -t[i][1]//g)
        if a not in y:
            y[a]=1
        else:
            y[a]+=1

cnt=0
x=1
for i in y:
    if (-i[1],i[0]) in y:
        x  *= pow(2,y[(-i[1],i[0])],MOD) + pow(2,y[(i[0],i[1])],MOD)-1
        cnt+= y[(-i[1],i[0])] + y[(i[0],i[1])]

ans = pow(2,n-z-cnt,MOD) *x -1
print((ans+z)%MOD)

Buggy submission (verdict: Runtime Error):
MOD=10**9+7
n=int(input())
p=[]
m=[]
for i in range(n):
    a,b=map(int,input().split())
    if a*b<0:
        m.append(a*b)
    else:
        p.append(a*b)
m.sort()
p=sorted(p,reverse=True)
r=0
l=0
cnt=0
while l<len(m) and r<len(p):
    if p[r]+m[l]>0:
        l+=1
    elif p[r]+m[l]<0:
        r+=1
    else:
        print(0)
        cnt+=1
        if len(m)-l<len(p)-r:
            r+=1
        else:
            l+=1
if l==len(m):
    cnt+=p.count(m[-1])
else:
    cnt+=m.count(p[-1])
print(cnt)
ans=(pow(2,n,MOD)-1-pow(2,n-2,MOD)*cnt)%MOD

print(ans)
Problem p02595 (python)

Fixed submission:
import math

p = 0

n,d  = input().split()
n = int(n)
d = int(d)

for i in range(n):
    x,y  = input().split()
    x = int(x)
    y = int(y)

    a = math.sqrt(x*x + y*y)
    
    if a <= d:
        p = p + 1

print(p)

Buggy submission (verdict: Runtime Error):
import math

n ,d  = input().split()
n = int(n)
d = int(d)

for i in range(n):
    x ,y  = input().split()
    x = int(x)
    y = int(y)

    a = math.sqrt(x*x + y*y)
    
    if a <= d:
        nanko += 1

print(nanko)
Problem p02595 (python)

Fixed submission:
n,d=list(map(int,input().split()))
ans=0
for i in range(n):
  x,y=list(map(int,input().split()))
  if (x*x)+(y*y)>d*d:
    
    ans+=1
print(n-ans)

Buggy submission (verdict: Runtime Error):
import math
n,d=list(map(int,input().split()))
ans=0
for i in range(n):
  x,y=list(map(int,input().split()))
  if (math.sqrt((x*x)+(y*y)))//d>=1:
    ans+=1
print(ans)
Problem p02594 (python)

Fixed submission:
if int(input()) >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if input() >= 30:
  print("Yes")
else:
  print("No")
Problem p02659 (python)

Fixed submission:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#n=int(input())
#n,m=input_list()
#a=input_list()
a=input().split()
n=int(a[0])
m=a[1]
ans=0
ans+=n*int(m[0])
ans+=n*int(m[2])//10
ans+=n*int(m[3])//100
mod=0
tmp=int(str(n*int(m[2]))[-1])
if tmp<10:
    tmp*=10
mod+=tmp
#print(mod)
tmp=int(str(n*int(m[3]))[-2:])
mod+=tmp
#print(ans)
#print(mod)
print(ans+mod//100)

Buggy submission (verdict: Runtime Error):

from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#n=int(input())
n,m=input_list()
#a=input_list()

print(math.floor(n*m))
Problem p02701 (python)

Fixed submission:
from collections import defaultdict
n=int(input())
#n,k=list(map(int,input().split()))
ans=defaultdict(int)
for i in range(n):
    s=input()
    ans[s]+=1

print(len(ans.keys()))

Buggy submission (verdict: Runtime Error):
n=int(input())
#n,k=list(map(int,input().split()))
ans=defaultdict(int)
for i in range(n):
    s=input()
    ans[s]+=1

print(len(ans.keys()))
Problem p02781 (python)

Fixed submission:
tmp=input()
n=int(tmp)
l=len(tmp)
k=int(input())
if k==1:
    ans=9*(l-1)
    last=int(tmp[0])
    ans+=last
    print(ans)
    exit()
if k==2:
    c=l-2
    ans=(9**2)*((c*(c+1))//2)
    num=0
    for i in range(1,l):
        for head_i in range(9,0,-1):
            for tail_i in range(9,0,-1):
                cal=str(head_i)
                cal+="0"*len(tmp[1:i])
                cal+=str(tail_i)
                cal+="0"*len(tmp[i+1:])
                if int(cal)<=n:
                    num+=1
    
    ans+=num
    print(ans)
    exit()


c=0
for i in range(3,l):
    c+=(i-1)*(i-2)//2
ans=(9**3)*c
num=0
for i in range(1,l):
    for j in range(i+1,l):
        for f_i in range(1,10):
            if f_i<int(tmp[0]):
                num+=81
                continue
            for s_i in range(1,10):
                for t_i in range(1,10):
                    cal=f_i*(10**(l-1))+s_i*(10**(l-1-i))+t_i*(10**(l-1-j))
                    if cal<=n:
                        num+=1
ans+=num
print(ans)

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

k=int(input())
if k==1:
    ans=9*(l-1)
    last=int(tmp[0])
    ans+=last
    print(ans)
    exit()
if k==2:
    c=l-2
    ans=(9**2)*((c*(c+1))//2)
    num=0
    for i in range(1,l):
        for head_i in range(9,0,-1):
            for tail_i in range(9,0,-1):
                cal=str(head_i)
                cal+="0"*len(tmp[1:i])
                cal+=str(tail_i)
                cal+="0"*len(tmp[i+1:])
                if int(cal)<=n:
                    num+=1
    ans+=num
    print(ans)
    exit()
print(ans)
Problem p02860 (python)

Fixed submission:
n=int(input())
s=input()
if n%2==1:
    print("No")
    exit()
t=s[:int(n/2)]
if t+t==s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if n%2==1:
  print("No")
  exit()
t=s[:n/2]
if t+t==s:
  print("Yes")
else:
  print("No")
Problem p02879 (python)

Fixed submission:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#n=int(input())
n,m=input_list()
#a=input_list()
if n>9 or m>9:
    print(-1)
    exit()

print(n*m)

Buggy submission (verdict: Runtime Error):
#n=int(input())
n,m=input_list()
#a=input_list()
if n>9 or m>9:
    print(-1)
    exit()

print(n*m)
Problem p03017 (python)

Fixed submission:
N,A,B,C,D=list(map(int,input().split()))
S=input()
bS=S[B-1:D]
a=True
if C<D:
    if "##" in bS:
        a=False
    else:
        aS=S[A-1:C]
        if "##" in aS:
            a=False

else:
    if "##" in bS:
        a=False
    else:
        aS=S[A-1:C]
        if "##" in aS:
            a=False
        else:
            tmp=S[:B-1]+"#"+S[B:]
            aS=tmp[A-1:C]
            j1= ("##" in aS)
            tmp=S[:D-1]+"#"+S[D:]
            aS=tmp[A-1:C]
            j2= ("##" in aS)
            if  ((not "..." in bS) and (j1 and j2)):
                a=False
            
        
        
if a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,A,B,C,D=list(map(int,input().split()))
S=input()
bS=S[B-1:D-1]
a=True
if C<D:
    if "##" in bS:
        a=False
    else:
        S=S[:D-1]+"#"+S[D-1:]
        aS=S[A-1:C-1]
        if "##" in aS:
            a=False

else:
    if "##" in bS:
        a=False
    else:
        aS=S[A-1:C-1]
        if "##" in aS:
            a=False
        else:
            if (not "..." in bS) and (aS[D]=="#" or aS[D-2]=="#"):
                a=False
            
        
        
if a:
    print("Yes")
else:
    print("No")
Problem p03038 (python)

Fixed submission:
from collections import Counter
N,M=list(map(int,input().split()))
cards=list(map(int,input().split()))
all_c=Counter(cards)

for i in range(M):
    time,val=list(map(int,input().split()))
    try:
        all_c[val]+=time
    except:
        all_c[val]=time

tmp=list(all_c.keys())
tmp.sort(reverse=True)
total=0
sum_time=0
for i in tmp:
    if sum_time>=N:
        break
    sum_time+=all_c[i]
    if sum_time<N:
        total+=i*all_c[i]
    else:
        total+=i*(all_c[i]+N-sum_time)
print(total)

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
cards=list(map(int,input().split()))
new=[]
cards.sort()
mod=0
for i in range(M):
    time,val=list(map(int,input().split()))
    mod+=time
    tmp=[val for _ in range(time)]
    new.append([val,time])
new.sort(key=lambda x:x[0],reverse=True)
print(sum(new))
"""
total=0
vali=0
if mod<N:
    total+=sum(cards[mod-N:])
for i in new:
    for j in range(i[1]):
        if vali==N:
            break
        total+=max(i[0],cards[vali])
        vali+=1
        
print(total)
"""
Problem p02701 (python)

Fixed submission:
n = int(input())
li = list()
for i in range(n):
	li.append(str(input()))

print(len(set(li)))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list()
for i range(n):
	li.append(str(input()))

print(len(set(li)))
Problem p02771 (python)

Fixed submission:
import sys

a, b, c = map(int, input().split())

#print(a, b, c)
ab = a == b
ac = a == c
bc = b == c

if ab and bc:
  print('No')
  sys.exit()

if not ab and not ac and not bc:
  print('No')
  sys.exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
import sys

a, b, c = map(int, input().split())

#print(a, b, c)
ab = a == b
ac = a == c
bc = b == c

if ab and bc:A
  print('No')
  sys.exit()

if not ab and not ac and not bc:
  print('No')
  sys.exit()

print('Yes')
Problem p02912 (python)

Fixed submission:
import heapq


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


itemCount, ticketCount = map(int, input().split(' '))
prices = map(int, input().split(' '))

h = []
for price in prices:
    _heappush_max(h, price)

for i in range(ticketCount):
    price = _heappop_max(h)
    _heappush_max(h, price // 2)
total = 0
for price in h:
    total += price

print(total)

Buggy submission (verdict: Runtime Error):
import heapq
 
itemCount, ticketCount = map(int, input().split(' '))
prices = map(int, input().split(' '))
 
h = []
for price in prices:
    heapq._heappush_max(h, price)
 
for i in range(ticketCount):
    price = _heappop_max(h)
    heapq._heappush_max(h, price // 2)
total = 0
for price in h:
    total += price
 
print(total)

Buggy submission (verdict: Runtime Error):
import heapq


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


itemCount, ticketCount = map(int, input().split(' '))
prices = map(int, input().split(' '))

h = []
for price in prices:
    _heappush_max(h, price)

for i in range(ticketCount):
    price = _heappop_max(h)
    _heappush_max(h, price // 2)
total = 0
for price in h:
    total += price

print(total)
Problem p02623 (python)

Fixed submission:
import numpy as np


def main():
    N, M, K = map(int, input().split())
    A = np.array([0] + [int(i) for i in input().split()])
    B = np.array([0] + [int(i) for i in input().split()])

    A.cumsum(out=A)
    B.cumsum(out=B)

    ans = 0
    j = M
    for i in range(N + 1):
        if A[i] > K:
            break
        while B[j] + A[i] > K:
            j -= 1
        ans = max(ans, i + j)

    print(ans)


if __name__ == '__main__':
    main()

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

a, b = [0], [0]
for i in range(N):
　　a.append(a[i] + A[i])
for i in range(M):
　　b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
　　if a[i] > K:
　　　　break
　　while b[j] > K - a[i]:
　　　　j -= 1
　　ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
1 N, M, K = map(int, input().split())
2 A = list(map(int, input().split()))
3 B = list(map(int, input().split()))
4
5 a, b = [0], [0]
6 for i in range(N):
7 　　a.append(a[i] + A[i])
8 for i in range(M):
9 　　b.append(b[i] + B[i])
10
11 ans, j = 0, M
12 for i in range(N + 1):
13 　　if a[i] > K:
14 　　　　break
15　　 while b[j] > K - a[i]:
16 　　　　j -= 1
17 　　ans = max(ans, i + j)
18 print(ans)

Buggy submission (verdict: Runtime Error):
1 N, M, K = map(int, input().split())
2 A = list(map(int, input().split()))
3 B = list(map(int, input().split()))
4
5 a, b = [0], [0]
6 for i in range(N):
7 	a.append(a[i] + A[i])
8 for i in range(M):
9 	b.append(b[i] + B[i])
10
11 ans, j = 0, M
12 for i in range(N + 1):
13 　　if a[i] > K:
14 		　break
15 　while b[j] > K - a[i]:
16 　　j -= 1
17 　ans = max(ans, i + j)
18 print(ans)
Problem p02629 (python)

Fixed submission:
def main():
    N = int(input())
    ans = ""

    while N:
        N -= 1
        tmp = N % 26
        ans += chr(tmp + ord("a"))
        N //= 26

    print(ans[::-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    ans = ""

    while N > 26:
        tmp = N % 26
        txt = "z" if tmp == 0 else chr(tmp + 96)
        # if tmp == 0:
        #     ans += "z"
        # else:
        #     ans += chr(tmp + 96)
        ans += txt
        # print(f"{ans = }. {N = }")
        N //= 26
    else:
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt

    print(ans[::-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    ans = ""

    while N > 26:
        tmp = N % 26
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt
        print(f"{ans = }. {N = }")
        N //= 26
    else:
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt

    print(ans[::-1])


if __name__ == '__main__':
    main()