qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
for i in range(N, m):
    if M % i == 0:
        x = M // i
        break
if x == 0:
    for i in reversed(range(1,m+1)):
        if M % i == 0:
            x = i
            break
print(x)

Fixed code:
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
        break
if m >N:
    for i in range(N, m):
        if M % i == 0:
            x = M // i
            break
if x == 0:
    for i in reversed(range(1, M //N +1)):
        if M % i == 0:
            x = i
            break
print(x)
Buggy code:
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)

Fixed code:
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
        if M%s==0:
          ans=s
          break
        s-=1
    print(ans)
Buggy code:
n, m = map(int, input().split())

def solve():
    res = 1
    for i in range(2, m//n+1):
        if m % i == 0:
            if (m // i) >= n:
                res = max(res, i)
                break
    print(res)

solve()


Fixed code:
n, m = map(int, input().split())

def solve():
    res = 1
    for i in range(m//n+1, 0, -1):
        if m % i == 0:
            if (m // i) >= n:
                res = i
                break
    print(res)

solve()
Buggy code:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(2,a+1):
    if M%i==0:
        x=i
        if M//i>i and M//i<=a:
            x=M//i
        break
print(x)


Fixed code:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)
Buggy code:
n, m = list(map(int, input().split(" ")))

ds = [x for x in range(1, m**.5+1) if m%x==0]
ds = ds + [m%x for x in ds]
ds = [x for x in ds if x<=m//n]
print(max(ds))

Fixed code:
n, m = list(map(int, input().split(" ")))

ds = [x for x in range(1, int(m**.5)+1) if m%x==0]
ds = ds + [m//x for x in ds]
ds = [x for x in ds if x<=m//n]
print(max(ds))
Buggy code:
n, m = map(int, input().split())

for i in range(1, int(m**0.5)+1)[::-1]:
    if (m % i == 0) and (m / n >= i):
        print(max(i, m // i))
        break


Fixed code:
n, m = map(int, input().split())

ans = 0
for i in range(1, int(m ** 0.5) + 1)[::-1]:
    if (m % i == 0):
        if m / i >= n:
            ans = max(ans, i)
        if i >= n:
            ans = max(ans, m // i)
print(ans)
Buggy code:
import math
n, m = map(int, input().split())
if m%2 == 0:
    divisor = [2, m//2]
else:
    divisor = []
for i in range(3, int(math.sqrt(m))+1, 2):
    if m%i == 0:
        divisor.append(i)
        divisor.append(m//i)
divisor = sorted(divisor, reverse=True)
a = m//n
for i in divisor:
    if i > a:
        continue
    if (m-(m//i*i))%i == 0:
        break
print(i)

Fixed code:
import math
n, m = map(int, input().split())
if m%2 == 0:
    divisor = [1, 2, m//2, m]
else:
    divisor = [1, m]
for i in range(3, int(math.sqrt(m))+1):
    if m%i == 0:
        divisor.append(i)
        divisor.append(m//i)
divisor = sorted(divisor, reverse=True)
a = m//n
for i in divisor:
    if i > a:
        continue
    if (m-(m//i*i))%i == 0:
        break
print(i)
Buggy code:
n, m = map(int, input().split())

for i in range(1, int(m**0.5)+1)[::-1]:
    if (m % i == 0):
        if m / i >= n:
            ans = max(ans, i)
        if i >= n:
            ans = max(ans, m // i)
print(ans)


Fixed code:
n, m = [int(i) for i in input().split()]

ans = 0
for i in range(int(m ** 0.5)):
      if m % (i+1) == 0 and m // (i+1) >= n:
          if m // (i+1) >= n:
              ans = max(ans, i+1)
          if i+1 >= n:
              ans = max(ans, m // (i+1))
print(ans)
Buggy code:
N ,M = map(int,input().split())
L = []
ans = 0
for i in range(1,int(M**(1/2)+1)):
    if M % i == 0:
        if i >= N: ans = max(ans,i)
        if M // i >= N: ans = max(ans,M//i)
print(ans)


Fixed code:
N ,M = map(int,input().split())
L = []
for i in range(1,int(M**(1/2)+1)):
    if M % i == 0:
        L.append((i,M//i))
ans = 0
for x in L:
    if x[1] >= N:
        ans = max(ans,x[0])
    if x[0] >= N:
        ans = max(ans,x[1])
print(ans)
Buggy code:
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    md = 1
    for i in range(1, (m // n + 1) ** 0.5 + 1):
        if m % i == 0:
            md = max(md, i)
    print(md)


if __name__ == '__main__':
    slove()


Fixed code:
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    md = 1
    for i in range(1, int(m ** 0.5) + 1):
        if m % i == 0:
            if n <= m // i:
                md = max(md, i)
            if n <= i:
                md = max(md, m // i)
    print(md)


if __name__ == '__main__':
    slove()
Buggy code:
N, M = map(int, input().split())

for i in range(M, 0, -1):
  if M % i == 0:
    print(i)
    exit()

Fixed code:
N, M = map(int, input().split())

for i in range(M // N, 0, -1):
  if M % i == 0:
    print(i)
    exit()
Buggy code:
import math
N, M = map(int, input().split())
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
    if M % i == 0:
        if M // i >= N:
            mx = max(mx, i)
    	if i >= N:
        	mx = max(mx, M//i)
print(mx)

Fixed code:
import math
N, M = map(int, input().split())
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
    if M % i == 0 and M // i >= N:
        mx = max(mx, i)
    if M % i == 0 and i >= N:
        mx = max(mx, M//i)
print(mx)
Buggy code:
# coding: utf-8
import math

N, M = [int(s) for s in input().strip().split()]

if N == 1:
    print(M)
    exit()

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M//d)

max_gcd = max([d for d in divisors if d > M/N])
print(max_gcd)


Fixed code:
# coding: utf-8
import math

N, M = [int(s) for s in input().strip().split()]

if N == 1:
    print(M)
    exit()

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M//d)

divisors.sort()
MAX_VAL = int(M/N)
for d in divisors:
    if d > MAX_VAL:
        break
    max_gcd = d

print(max_gcd)
Buggy code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        # divisors.sort(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = max(max_gcd, d)

    print(d)


if __name__ == '__main__':
    main()


Fixed code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        divisors.sort(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = d
            break

    print(d)


if __name__ == '__main__':
    main()
Buggy code:
import math

n,m=map(int,input().split())
if n==1:
        print(m)
else:
        l=[]
        for i in range(1,math.floor(m**0.5)+1):
           if m%i==0:
                l.append(i)
                if m//i<=m//n:
                        l.append(m//i)
        l.sort()
        print(l[-1])

Fixed code:
import math

n,m=map(int,input().split())
if n==1:
        print(m)
else:
        l=[]
        for i in range(1,math.floor(m**0.5)+1):
           if m%i==0 and i<=m//n:
                l.append(i)
                if m//i<=m//n:
                        l.append(m//i)
        l.sort()
        print(l[-1])
Buggy code:
n,m=map(int,input().split())
p=1
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    if m//i>=n:
      p=max(i,m//i,p)
print(p)

Fixed code:
n,m=map(int,input().split())
p=1
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    if m//i>=n:
      if i>=n:
        p=max(i,m//i,p)
      else:
        p=max(p,i)
print(p)
Buggy code:
from math import sqrt

N, M = [int(_) for _ in input().split()]
m = M

a = 1
flg = False
for i in range(2, int(sqrt(M)) + 1):
    if i <= M / N:
        a = max(a, i)
    b = M // i
    if b <= M / N:
        a = max(a, b)

print(a)


Fixed code:
from math import sqrt

N, M = [int(_) for _ in input().split()]
m = M

a = 0
flg = False
for i in range(1, int(sqrt(M)) + 1):
    if M % i==0:
        if i <= M / N:
            a = max(a, i)
        b = M // i
        if b <= M / N:
            a = max(a, b)

print(a)
Buggy code:
n, m = map(int, input().split())

count = 1
for i in range((m//n)+1, 1, -1):
    if m % i == 0:
        count = i
        break()

print(count)

Fixed code:
n, m = map(int, input().split())

count = 1
for i in range((m//n), 0, -1):
    if m % i == 0:
        count = i
        break

print(count)
Buggy code:
n, m = map(int,input().split())

an = m //n
while an*n != m:
  an = m//n
  n = 1 + (m-1)*an
  
print(an)


Fixed code:
n, m = map(int,input().split())

an = m //n
while an*n != m:
  an = m//n
  n = 1 + (m-1)//an
  
print(an)
Buggy code:
N, M = list(map(int,input().split()))
 
d = int(M/N)

def solve():
    # ans = 1
    # for i in range(M//N+1, 0, -1):
    #     if M % i == 0:
    #         if (M // i) >= N:
    #             print(i)
    #             break
    for i in range(d+1,0,-1):
    	if M%d == 0:
    		print(d)
    		break

	# i = 0
	# while True:
	# 	if M%(N+i+1) == 0:
	# 		print(int(M/(N+i+1)))
	# 		break
	# 	i += 1

if M%N == 0:
	print(d)
else:
	solve()

Fixed code:
N, M = list(map(int,input().split()))
 
d = int(M/N)

def solve():
    ans = 1
    for i in range(M//N+1, 0, -1):
        if M % i == 0:
            if (M // i) >= N:
                print(i)
                break
	# i = 0
	# while True:
	# 	if M%(N+i+1) == 0:
	# 		print(int(M/(N+i+1)))
	# 		break
	# 	i += 1

if M%N == 0:
	print(d)
else:
	solve()
Buggy code:
n,m = map(int,input().split())
a = m//n
di = []
for i in range(1, min(a+1,int(m**0.5)+1)):
  if m % i == 0:
    di.append(i)
    if i != m // i and a >=  m // i:
      di.append(m//i)
di.sort()
print(di,di[-1])

Fixed code:
n,m = map(int,input().split())
a = m//n
di = []
for i in range(1, min(a+1,int(m**0.5)+1)):
  if m % i == 0:
    di.append(i)
    if i != m // i and a >=  m // i:
      di.append(m//i)
di.sort()
print(di[-1])
Buggy code:
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
n,m=map(int,input().split())
d=divisor(m)
d.sort(reverse=1)
for i in d:
  if m//i>=n:print(i):exit()

Fixed code:
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
n,m=map(int,input().split())
d=divisor(m)
d.sort(reverse=1)
for i in d:
  if m//i>=n:print(i);exit()
Buggy code:
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
y = yaku(m)
np.max(np.array(y)[np.array(y) <= m/n])

Fixed code:
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
def yaku(n):
    fct = factorize(n)
    y = divisorize(fct)
    ys = []
    for yy in y:
        ys.append(num(yy))
    ys.sort()
    return ys

n,m = list(map(int,input().split()))
if n == 1 and m == 1:
    print(1)
else:
    y = yaku(m)
    print(np.max(np.array(y)[np.array(y) <= m/n]))
Buggy code:
import math
N, M = map(int, input().split())
sqrtM = round(math.sqrt(M))+1

for i in range(N,sqrtM+1):
  if M % i == 0:
    print(M//i)
    exit()
for i in range(M//N,M+1):
  if M % i == 0:
    print(M//i)
    exit()

Fixed code:
import math
N, M = map(int, input().split())
sqrtM = round(math.sqrt(M))+1

if N < sqrtM:
  for i in range(N,sqrtM+1):
    if M % i == 0:
      print(M//i)
      exit()
  for i in range(N-1,0,-1):
    if M % i == 0:
      print(i)
      exit()
else:
  for i in range(M//N,0,-1):
    if M % i == 0:
      print(i)
      exit()
Buggy code:
n, m = map(int, input().split())
if n == 1:
  print(m)
  exit()
for divide in range(n,int(m**(1/2))+1):
  if m % divide == 0:
    print(int(m/divide))
    exit()
for divide in range(n,0,-1):
  if m % divide == 0:
    print(divide)
    exit()

Fixed code:
n, m = map(int, input().split())
if n == 1:
  print(m)
  exit()
if n < int(m**(1/2)):
  for divide in range(n,int(m**(1/2))+1):
    if m % divide == 0:
      print(int(m/divide))
      exit()
  for divide in range(n,0,-1):
    if m % divide == 0:
      print(divide)
      exit()
else:
  for divide in range(m//n,0,-1):
    if m % divide == 0:
      print(divide)
      exit()
Buggy code:
import math

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

x=int(math.sqrt(m))

ans=1
for i in range(1,x+1):
  if i*n<=m:
    if i <= y:
      ans=max(ans,i)
    if (m/i)*n<=m:
      ans=max(ans,m/i)
print(ans)




Fixed code:
import math

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

x=int(math.sqrt(m))

ans=1
for i in range(1,x+1):
  if m%i==0:
    if i*n<=m:
      ans=max(ans,i)
    if int(m/i)*n<=m:
      ans=max(ans,int(m/i))
print(ans)
Buggy code:
import math
n, m = [int(item) for item in input().split()]

ans = 1
for i in range(1, int(math.sqrt(m))+1):
  if m%i == 0 
    if m >= i*n:
      ans = max(ans, i)
    else:
      ans = max(ans, m%i)
    
print(ans)

Fixed code:
import math
n, m = [int(item) for item in input().split()]

ans = 0
for i in range(1, int(math.sqrt(m))+1):
  if m%i == 0:
    if m >= i*n:
      ans = max(ans, i)
    if i>= n:
      ans = max(ans, m//i)
    
print(ans)
Buggy code:
N, M = map(int, input().split())

if N == 1:
    print(M)
else:
    ans = 1
    for g in range(1, int(M ** 0.5) + 2):
        if M % g == 0 and M / g >= N:
            ans = max(ans, g)

        g2 = M / g
        if M % g2 == 0 and M / g2 >= N:
            ans = max(ans, int(g2))
    print(ans)


Fixed code:
N, M = map(int, input().split())

ans = 1
for g in range(1, int(M ** 0.5) + 1):
    if M % g == 0 and M / g >= N:
        ans = max(ans, g)
    
    if M % g == 0:
        g2 = M // g
        if M % g2 == 0 and M / g2 >= N:
            ans = max(ans, g2)
print(ans)
Buggy code:
from math import sqrt

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

ans = 1
for i in range(1, int(sqrt(m/n))+1):
  if m % i == 0:
    ans = max(ans,i)
  if m % ((m//n)/i) == 0:
    ans = max(ans,i)

print(ans)    

Fixed code:
from math import sqrt

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

ans = 1
for i in range(1, int(sqrt(m)+1)):
  if m % i == 0:
    if n * i <= m:
      ans = max(ans,i)
    if n * (m//i) <= m:
      ans = max(ans, m//i)
                           
print(ans)
Buggy code:
#-*-coding:utf-8-*-

def main():
    n, m = map(int, input().split())
    ans = 1
    for i in range(1, int(m**0.9)+10):
        if m % i == 0 and m // i >= n:
            ans = max(ans, i)
    print(ans)
    
if __name__ == '__main__':
    main()

Fixed code:
#-*-coding:utf-8-*-

def main():
    n, m = map(int, input().split())
    ans = 1
    for i in range(1, int(m**0.5)+1):
        if m % i == 0:
            if m >= i * n:
                ans = max(ans, i)
            if m >= (m // i) * n:
                ans = max(ans, m // i)
    print(ans)
    
if __name__ == '__main__':
    main()
Buggy code:
import math
def main():
  n=int(input())
  a=int(n/100)
  if a*100+a*10+a>n:
    print(a*100+a*10+a)
  else:
    print((a+1)*100+(a+1)*10+a+1)
main()

Fixed code:
import math
def main():
  n=int(input())
  a=int(n/100)
  if a*100+a*10+a>=n:
    print(a*100+a*10+a)
  else:
    print((a+1)*100+(a+1)*10+a+1)
main()
Buggy code:
n = str(input())
memo = int( n[0] + n[0] + n[0] )
if int(n) < memo:
	print(memo)
else:
	print(memo + 111)

Fixed code:
n = str(input())
memo = int( n[0] + n[0] + n[0] )
if int(n) <= memo:
	print(memo)
else:
	print(memo + 111)
Buggy code:
n = int(input())
for i in range(10):
    if i * 111 > n:
        print(i * 111)
        break

Fixed code:
n = int(input())
for i in range(10):
    if i * 111 >= n:
        print(i * 111)
        break
Buggy code:
a=list(str(input()))
e=int(''.join(a))


b=int(a[1])-int(a[1]*111)
c=a[0]
c=int(c)
b = e-c*111
if b <0:
  print(c*111)
else:
  c+=1
  print(c*111)

Fixed code:
a=list(str(input()))
e=int(''.join(a))


b=int(a[1])-int(a[1]*111)
c=a[0]
c=int(c)
b = e-c*111
if b <=0:
  print(c*111)
else:
  c+=1
  print(c*111)
Buggy code:
n = int(input())
if n//111 = n/111:
  print(n)
else:
  print(((n//111)+1) * 111)

Fixed code:
n = int(input())
if n//111 == n/111:
  print(n)
else:
  print(((n//111)+1) * 111)
Buggy code:
N = int(input())

if N % 111 == 0:
    print(N)
    exit()

print(N * (N//111 + 1))

Fixed code:
N = int(input())

if N % 111 == 0:
    print(N)
    exit()

print(111 * (N//111 + 1))
Buggy code:
n = int(input())
while n % 111 != 0:
    x = n+1
    n += 1
print(x)

Fixed code:
n = int(input())
if n % 111 == 0:
    x = n
while n % 111 != 0:
    x = n+1
    n += 1

print(x)
Buggy code:
n = int(input())
a = -(-n//111)
if a = 10:
    print(1111)
else:
    print(a*111)

Fixed code:
n = int(input())
a = -(-n//111)
if a == 10:
    print(1111)
else:
    print(a*111)
Buggy code:
N=int(input())

for a in range(10):
    if a*111<=N:
        pass
    elif a*111>=N:
        print(a*111)
        break

Fixed code:
N=int(input())

for a in range(10):
    if a*111<N:
        pass
    elif a*111>=N:
        print(a*111)
        break
Buggy code:
n=int(input())
if n%111==0:
  print(n)
else:
  print((n//111)+1)

Fixed code:
n = int(input())
if n % 111 == 0:
  print(n)
else:
  print(111 * (n // 111 + 1))
Buggy code:
#coding:utf-8

n=int(input())
print(n+(111-((n%111))%111))

Fixed code:
#coding:utf-8

n=int(input())
print(n+(111-(n%111))%111)
Buggy code:
n = int(input())
ret = n // 111 + 1
print(ret * 111)

Fixed code:
n = int(input())
ret = (n-1) // 111 + 1
print(ret * 111)
Buggy code:
n = input()
if int(n) < int(n[0]) * 111:
  print(int(n[0]) * 111)
else:
  print((int(n[0]) + 1) * 111)


Fixed code:
n = input()
if int(n) <= int(n[0]) * 111:
  print(int(n[0]) * 111)
else:
  print((int(n[0]) + 1) * 111)
Buggy code:
N = int(input())
x = N-1 // 111

print((x+1)*111)

Fixed code:
N = int(input())
print(((N-1)//111+1)*111)
Buggy code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N = int(input())
for i in range(N, 1000):
	if N//100==N//10 ans N//10==N%10:
		print(N)
		sys.exit()

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Fixed code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N = int(input())
for i in range(N, 1000):
	if i//100==(i//10)%10:
		if i//100==i%10:
			print(i)
			sys.exit()

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
Buggy code:
a=int(input())
b=a%100
c=a//100
if b<=c*11:
  print(c*111)
else:
  print()c+1)*111)

Fixed code:
a=int(input())
b=a%100
c=a//100
if b<=c*11:
  print(c*111)
else:
  print((c+1)*111)
Buggy code:
r = input()
n = list(r)
x = int(n[0])*100 + int(n[0])*10 + int(n[0])

if x <= int(r):
  print( ((int(n[0])+1)*100 + (int(n[0])+1)*10 + int(n[0])+1))
else:
  print(x)

Fixed code:
r = input()
n = list(r)
x = int(n[0])*100 + int(n[0])*10 + int(n[0])

if x < int(r):
  print( ((int(n[0])+1)*100 + (int(n[0])+1)*10 + int(n[0])+1))
else:
  print(x)
Buggy code:
n = int(input())
t = n//100
t*=111
if t>n:
  print(t)
else:
  print(t+111)

Fixed code:
n = int(input())
t = n//100
t*=111
if t>=n:
  print(t)
else:
  print(t+111)
Buggy code:
N = int(input())
print((N // 111) + 1 if N % 111 != 0 else N // 111)


Fixed code:
N = int(input())
print(((N // 111) + 1) * 111 if N % 111 != 0 else (N // 111) * 111)
Buggy code:

n = int(input())
a = 0

if n % 111 == 0:
    print(n)
else:
    a = n // 111
    print(a)
    print((a+1) * 111)


Fixed code:

n = int(input())
a = 0

if n % 111 == 0:
    print(n)
else:
    a = n // 111
#    print(a)
    print((a+1) * 111)
Buggy code:
n = int(input())
k = -int(-n/111)
print(111*k)

Fixed code:
n = int(input())
print((-n//111)*-111)
Buggy code:
n = int(input())
k = 0
if int(n/111) == n/111:
  k = n/111
else k = int(n/111) + 1
print(111*k)

Fixed code:
n = int(input())
k = 0
if int(n/111) == n/111:
  k = int(n/111)
else:
  k = int(n/111) + 1
print(111*k)
Buggy code:
n=int(input())
a=n%100
if a==9:
    print(999)
else:
    ans=100*a+10*a+a
    if ans>=n:
        print(ans)
    else:
        print(ans+111)

Fixed code:
n=int(input())
a=(n-n%100)//100
if a==9:
    print(999)
else:
    ans=100*a+10*a+a
    if ans>=n:
        print(ans)
    else:
        print(ans+111)
Buggy code:
print((int(input() - 1) // 111 + 1) * 111)

Fixed code:
print((((int(input()) - 1) // 111) + 1) * 111)