Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
[N K] = list(map(int,input().split))
max = (N-1)*(N-2)/2
if max<K:
    print(-1)
    exit()

tree = []
for i in range(2, N):
    tree.append(1,N)

for i in range(max-K):
    tree.append(i+2,i+3)

print(max + max-K)
for i in tree:
    print(str(i[0]) + " " +str([1]))

Fixed submission:
[N ,K] = list(map(int,input().split()))
max = int((N-1)*(N-2)/2)
if max<K:
    print(-1)
    exit()

tree = []
for i in range(2, N+1):
    tree.append((1,i))
t = 3
a=0
for i in range(0, max-K):
    if i+t-a>N:
        a += i-a
        t+=1 
    tree.append((i+2-a,i+t-a))

print(len(tree))
for i in tree:
    print(str(i[0]) + " " +str(i[1]))

Buggy python submission (verdict: Runtime Error):
[N K] = list(map(int,input().split))
max = (N-1)*(N-2)/2
if max<K:
    print(-1)
    sys.exit()

tree = []
for i in range(2, N):
    tree.append(1,N)

for i in range(max-K):
    tree.append(i+2,i+3)

print(max + max-K)
for i in tree:
    print(str(i[0]) + " " +str([1]))

Fixed submission:
[N ,K] = list(map(int,input().split()))
max = int((N-1)*(N-2)/2)
if max<K:
    print(-1)
    exit()

tree = []
for i in range(2, N+1):
    tree.append((1,i))
t = 3
a=0
for i in range(0, max-K):
    if i+t-a>N:
        a += i-a
        t+=1 
    tree.append((i+2-a,i+t-a))

print(len(tree))
for i in tree:
    print(str(i[0]) + " " +str(i[1]))
Buggy python submission (verdict: Time Limit Exceeded):
AB = list(map(int, input().split()))
ketaB = 0

tmp = AB[1]
while 1:
    ketaB += 1
    if tmp ==0 or tmp == 1:
        break
    tmp /= 2
tmp = AB[0]

ans = 0
tmp = 2 ** (ketaB)
tmp2 = 0
A = AB[0]
B = AB[1]
check = 0
while tmp != 1:
    A = AB[0]
    B = AB[1]
    tmp2 = 0
    check =0
    while A % tmp < (tmp//2):
        if A == B:
            check = 1
            break
        A+=1
    while A % tmp != 0 and check !=1:
        tmp2 += 1
        if A == B:
            check = 1
            break
        A+=1
    A = AB[0]
    while B % tmp >= (tmp//2) and check !=1:
        B -= 1
        tmp2 += 1
    tmp //= 2
    ans += tmp*(tmp2 % 2)
print(int(ans))

Fixed submission:
AB = list(map(int, input().split()))
soto = AB[0] - 1
B = AB[1]
if soto % 4 == 0:
    tmp1 =soto
elif soto % 4 == 1:
    tmp1 = 1
elif soto % 4 == 2:
    tmp1= soto + 1
else :
    tmp1 = 0

if B % 4 == 0:
    tmp2 =B
elif B % 4 == 1:
    tmp2 = 1
elif B % 4 == 2:
    tmp2= B + 1
else :
    tmp2 = 0

ans = tmp1 ^ tmp2
print(ans)
Buggy python submission (verdict: Runtime Error):
def qSort(a):
    if len(a) in (0, 1):
        return a

    p = a[-1]
    l = [x for x in a[:-1] if x[1] <= p[1]]
    r = [x for x in a[:-1] if x[1] > p[1]]

    return qSort(l) + [p] + qSort(r)


N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = qSort(ab)
for i in range(N):
    for j in range(i, N):
        ab[j][1] -= ab[i][0]
        if ab[j][1] < 0:
            print("No")
            exit()
print("Yes")


Fixed submission:
N = int(input())
ab = [[0, 0]] + [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(len(ab) - 1):
    ab[i + 1][0] += ab[i][0]
    if ab[i + 1][1] < ab[i + 1][0]:
        print("No")
        exit()

print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
def bSort(a):
    for i in range(len(a)):
        for j in range(len(a)-1, i, -1):
            if a[j][1] < a[j-1][1]:
                a[j], a[j-1] = a[j-1], a[j]
    return a


N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = bSort(ab)
for i in range(N):
    for j in range(i, N):
        ab[j][1] -= ab[i][0]
        if ab[j][1] < 0:
            print("No")
            exit()
print("Yes")


Fixed submission:
N = int(input())
ab = [[0, 0]] + [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(len(ab) - 1):
    ab[i + 1][0] += ab[i][0]
    if ab[i + 1][1] < ab[i + 1][0]:
        print("No")
        exit()

print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(N):
    for j in range(i, N):
        ab[j][1] -= ab[i][0]
        if ab[j][1] < 0:
            print("No")
            exit()
print("Yes")


Fixed submission:
N = int(input())
ab = [[0, 0]] + [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(len(ab) - 1):
    ab[i + 1][0] += ab[i][0]
    if ab[i + 1][1] < ab[i + 1][0]:
        print("No")
        exit()

print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(N):
    for j in range(i, N):
        ab[j][1] -= ab[i][0]
        if ab[j][1] < 0:
            print("No")
            exit()
    ab = ab[:i] + sorted(ab[i:], key=lambda x: x[1])

print("Yes")


Fixed submission:
N = int(input())
ab = [[0, 0]] + [list(map(int, input().split())) for i in range(N)]
ab = sorted(ab, key=lambda x: x[1])
for i in range(len(ab) - 1):
    ab[i + 1][0] += ab[i][0]
    if ab[i + 1][1] < ab[i + 1][0]:
        print("No")
        exit()

print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

lr = [list(map(int, input().split())) for i in range(m)]
lr_gate = []

for i in range(m):
    for j in range(lr[i][0], lr[i][1] + 1):
        lr_gate.append(j)

lr_gate = map(str, lr_gate)
lr_collect = collections.Counter(lr_gate)

count = 0
for v in lr_collect.values():
    if v == m:
        count += 1

print(count)

Fixed submission:
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for i in range(m)]
lr.sort()
r_min = 100000
l_max = 0
lr_min = 100000

for i in range(m):
    l_max = max(lr[i][0], l_max)
    r_min = min(lr[i][1], r_min)

lr_min = [r_min - l_max + 1 if l_max <= r_min else 0]
print(lr_min[0])
Buggy python submission (verdict: Runtime Error):
num = input()
num1 = int(num[0] + num[1])
num2 = int(num[2] + num[3])

if(num1 < 13) and (num1 > 0):
    if(num2 < 13) and (num2 > 0):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(num2 < 13) and (num2 > 0):
        print("YYMM")
    else:
        print("NA")


Fixed submission:
inputstr1 = input().split()
n = int(inputstr1[0])
k = int(inputstr1[1])
s = input()

smalls = s[k-1].lower()

print(s[:k-1] + smalls + s[k:])
Buggy python submission (verdict: Runtime Error):
from functools import reduce


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


def lcm(a, b):
    return a * b // gcd(a, b)


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

l = [0 for i in range(n)]
for i in range(0, n - 1, 1):
    l[i + 1] = gcd(l[i], a[i])
    print(l[i + i])

r = [0 for i in range(n)]
for i in range(n - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i + 1])
    print(r[i])

m = [gcd(l[i], r[i]) for i in range(n)]

print(reduce(max, m))


Fixed submission:
from functools import reduce


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


def lcm(a, b):
    return a * b // gcd(a, b)


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

l = [0 for i in range(n)]
for i in range(0, n - 1, 1):
    l[i + 1] = gcd(l[i], a[i])

r = [0 for i in range(n)]
for i in range(n - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i + 1])

m = [gcd(l[i], r[i]) for i in range(n)]

print(reduce(max, m))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce


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


'''
def lcm(a, b):
    return a * b // gcd(a, b)
'''
n = int(input())
a_list = list(map(int, input().split()))
remove_list = a_list[:]
re_max = 0

for i in range(len(a_list)):
    remove_list.pop(i)
    re_max = max(re_max, reduce(gcd, remove_list))
    remove_list = a_list[:]

print(re_max)



Fixed submission:
from functools import reduce


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


def lcm(a, b):
    return a * b // gcd(a, b)


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

l = [0 for i in range(n)]
for i in range(0, n - 1, 1):
    l[i + 1] = gcd(l[i], a[i])

r = [0 for i in range(n)]
for i in range(n - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i + 1])

m = [gcd(l[i], r[i]) for i in range(n)]

print(reduce(max, m))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
'''
def lcm(a, b):
    return a * b // gcd(a, b)
'''
n = int(input())
a_list = list(map(int, input().split()))
remove_list = a_list[:]
max_list = []

for i in range(len(a_list)):
    remove_list.pop(i)
    max_list.append(reduce(gcd, remove_list))
    remove_list = a_list[:]

print(reduce(max, max_list))


Fixed submission:
from functools import reduce


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


def lcm(a, b):
    return a * b // gcd(a, b)


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

l = [0 for i in range(n)]
for i in range(0, n - 1, 1):
    l[i + 1] = gcd(l[i], a[i])

r = [0 for i in range(n)]
for i in range(n - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i + 1])

m = [gcd(l[i], r[i]) for i in range(n)]

print(reduce(max, m))
Buggy python submission (verdict: Runtime Error):
num = []
n = int(input())
for i in range(5):
    num.append(int(input()))
a = min(num)
t = n // a
t += 4
if (n % a != 0):
    t += 5
else:
    
print(t)


Fixed submission:
antenna = [int(input()) for i in range(5)]
k = int(input())

for i in antenna:
    antenna_out = list(filter(lambda j: (i - j) > k, antenna))
    if len(antenna_out) != 0:
        print(":(")
        break
else:
    print("Yay!")
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
count = 0

for i in range(q):
    s_extra = s[(lr[i][0] - 1):lr[i][1]]
    print(s_extra.count("AC"))

Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
s_count = [0 for i in range(n + 1)]
for i in range(n):
    s_count[i + 1] = s_count[i] + (1 if s[i:i + 2] == 'AC' else 0)

for i in range(q):
    print(s_count[lr[i][1] - 1] - s_count[lr[i][0] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
count = 0
for i in range(q):
    for j in range(lr[i][0] - 1, lr[i][1] - 1):
        if s[j] == 'A' and s[j + 1] == 'C':
            count += 1

    print(count)
    count = 0

Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
s_count = [0 for i in range(n + 1)]
for i in range(n):
    s_count[i + 1] = s_count[i] + (1 if s[i:i + 2] == 'AC' else 0)

for i in range(q):
    print(s_count[lr[i][1] - 1] - s_count[lr[i][0] - 1])
Buggy python submission (verdict: Runtime Error):
for i in range(len(S)):
  bottom_num=S[i-1]
  try:
    if S[i]<=S[i+1]:
      pass
    elif S[i]-1==S[i+1]:
      S[i]-=1  
      if S[i]<bottom_num:
        indication=False
        break      
    else: 
      indication=False
      break
  except:
    pass
print(S)
if indication:
  print("Yes")
else:
  print("No")

Fixed submission:
N=int(input())
H=list(map(int,input().split(" ")))

for i in reversed(range(N - 1)):
  if H[i + 1] - H[i] == -1:
    H[i] -= 1
  elif H[i + 1] - H[i] < -1:
        print('No')
        exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(2)]
A=list(map(int,S[0].split(" ")))
B=list(map(int,S[1].split(" ")))
mon_left=0
hero_left=0
counter=0
mon_killed=0

for i in range(N):
  if i==0:
    mon_sum=A[i]+A[i+1]
  else:
    mon_sum=(A[i]+A[i+1])-mon_killed
  hero = B[i]
    
  while hero>0 and mon_sum>0:
    counter+=1
    mon_sum -= 1
    hero -= 1
  if mon_sum > 0:
    mon_killed = 0
  elif mon_sum < 0:
    mon_killed = abs(mon_sum)

print(counter)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = 0

for i in range(n):
  if a[i] >= b[i]:
    m += b[i]
  else:
    b[i] -= a[i]
    if a[i+1] < b[i]:
      m += a[i+1]+a[i]
      a[i+1]=0
    else:
      a[i+1] -= b[i]
      m += b[i] + a[i]
      
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = list(map(int,[input() for i in range(n)]))
a_copy = copy.copy(a)

for i in range(n):
  a=copy.copy(a_copy)
  a.remove(a[i])
  print(max(a))

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
max_A = max(A)
max_num = 0
for i in range(N):
    if A[i] == max_A:
        # 最大値が複数ある場合の計算削減
        max_num += 1
        if max_num > 1:
            print(max_A)
        else:
            print(max(A[:i] + A[i + 1:]))
    else:
        print(max_A)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = input().split(" ")
N,M=int(N),int(M)
S=[input() for i in range(M)]
startship=[]
secondship=[]
for i in range(M):
  if S[i][0]=='1':
    startship.append(S[i])
for v in startship:
  for n in range(M):
    if v[2] == S[n][0] and S[n][2] == str(N):
      print('POSSIBLE')
      exit()    
  
print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
from_1 = [False]*N
to_N = [False]*N
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        from_1[b-1] = True
    elif b == N:
        to_N[a-1] = True
for i in range(1, N):
    if from_1[i] and to_N[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = input().split(" ")
N,M=int(N),int(M)
S=[input() for i in range(M)]

for i in range(M):
  if S[i][0] == '1':
    for n in range(M):
      if S[n][0] =='1':
        pass
      elif S[i][2] == S[n][0] and S[n][2] == str(N):
        print('POSSIBLE')
        exit()
        
print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
from_1 = [False]*N
to_N = [False]*N
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        from_1[b-1] = True
    elif b == N:
        to_N[a-1] = True
for i in range(1, N):
    if from_1[i] and to_N[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = input().split(" ")
N,M=int(N),int(M)
S=[input() for i in range(M)]

for i in range(M):
  if S[i][0] == '1':
    for n in range(M):
      if S[i][2] == S[n][0] and S[n][2] == str(N):
        print('POSSIBLE')
        exit()
        
print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
from_1 = [False]*N
to_N = [False]*N
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        from_1[b-1] = True
    elif b == N:
        to_N[a-1] = True
for i in range(1, N):
    if from_1[i] and to_N[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())

str_list = list(s)
x = str_list[k]
for i in range(len(s)):
    if str_list[i] != x:
        str_list[i] = "*"
str_changed = "".join(str_list)
print(str_changed)

Fixed submission:
n = int(input())
s = input()
k = int(input())

str_list = list(s)
x = str_list[k-1]
for i in range(len(s)):
    if str_list[i] != x:
        str_list[i] = "*"
str_changed = "".join(str_list)
print(str_changed)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, q= map(int, input().split())
s = input()

masu = np.ones(n+2)
def my_index_multi(l, x):
    return [i+1 for i, _x in enumerate(l) if _x == x]

for i in range(q):
    t, d = map(str, input().split())
    
    index = my_index_multi(s, t)

    if d == "R":
        tmp = masu[index]
        masu[index] = 0
        t_index = list(map(lambda x: x + 1, index))
        masu[t_index] += tmp
    else:
        tmp = masu[index]
        masu[index] = 0
        t_index = list(map(lambda x: x - 1, index))
        masu[t_index] += tmp       

print(int(np.sum(masu[1:n+1])))

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

if a == b == c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import copy
s = list(input())
def check01_2(s, pos):
    p = 0
    if abs(len(s) - pos)  > 2:
        for i in range(pos, len(s), 1):
            if s[i] != s[i+1]:
                del s[i:i+2]
                if i !=0:
                    p = i-1
                return check01_2(s, p)
    return s

s2 = copy.deepcopy(s)
s2 = check01_2(s2, 0)
print(len(s) - len(s2))



Fixed submission:
import numpy as np
s = list(input())

cnt = np.empty(2)
for i in range(len(s)):
    cnt[int(s[i]) - 0] += 1
ans = np.min(cnt) * 2
print(int(ans))

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

def check01(s):
    if len(s) > 1:
        for i in range(len(s)-1):
            if s[i] != s[i+1]:
                del s[i:i+2]
                return check01(s)
    return s
s2 = copy.deepcopy(s)
s2 = check01(s2)
print(len(s) - len(s2))



Fixed submission:
import numpy as np
s = list(input())

cnt = np.empty(2)
for i in range(len(s)):
    cnt[int(s[i]) - 0] += 1
ans = np.min(cnt) * 2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
i = input().spli(" ")
people = int(i[0])
train_fee = int(i[1])
taxi_fee = int(i[2])

train_sum = people * train_fee
if train_sum > taxi_fee:
    print(train_sum)
else:
    print(taxi_fee)


Fixed submission:
i = input().split(" ")
people = int(i[0])
train_fee = int(i[1])
taxi_fee = int(i[2])

train_sum = people * train_fee
if train_sum > taxi_fee:
    print(taxi_fee)
else:
    print(train_sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
seq_str = input().split(" ")
seq = [int(s) for s in seq_str]
counter = 0

for i in range(1,n-1):
    if seq[i-1] < sqe[i] and seq[i] < seq[i+1]
    counter =+ 1
print(counter)

Fixed submission:
n = int(input())
seq_str = input().split(" ")
seq = [int(s) for s in seq_str]
counter = 0

for i in range(1,n-1):
    if (seq[i-1]-seq[i])*(seq[i+1]-seq[i]) < 0:
        counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = 0

while height <= x and count < n+1:
    height += int(l[count])
    count += 1

print(count)


Fixed submission:
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = n+1

for i in range(n):
    if (height + int(l[i]) <= x):
        height += int(l[i])
    else:
        count = i + 1
        break

print(count)

Buggy python submission (verdict: Runtime Error):
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = 0

while height <= x:
    height += int(l[count])
    count += 1

print(count)


Fixed submission:
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = n+1

for i in range(n):
    if (height + int(l[i]) <= x):
        height += int(l[i])
    else:
        count = i + 1
        break

print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
if s == "A":
    print("T")
elif s == "T":
    print("A")
elif s == "C":
    print("G")
else:
    print("C")


Fixed submission:
s = input()
if s == "A":
    print("T")
elif s == "T":
    print("A")
elif s == "C":
    print("G")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
s = input()
if s == "A":
    print("T")
elif: s == "T":
    print("A")
elif s == "C":
    print("G")
else:
    print("C")


Fixed submission:
s = input()
if s == "A":
    print("T")
elif s == "T":
    print("A")
elif s == "C":
    print("G")
else:
    print("C")
Buggy python submission (verdict: Runtime Error):
s = input()
correct_list = ["A","C","G","T"]
x_list = [-1]

for i, c in enumerate(s):
    if c not in correct_list:
        x_list.append(i)
diff_list = []
for i in range(len(x_list)-1):
    diff_list.append(x_list[i+1]-x_list[i])
print(max(diff_list)-1)


Fixed submission:
s = input()
correct_list = ["A","C","G","T"]
x_list = [-1]

for i, c in enumerate(s):
    if c not in correct_list:
        x_list.append(i)
x_list.append(len(s))
diff_list = []
for i in range(len(x_list)-1):
    diff_list.append(x_list[i+1]-x_list[i])
print(max(diff_list)-1)
Buggy python submission (verdict: Runtime Error):
l = [int(i) for i in input().split(" ")]
print((l[0]-1)*(l[1]-1))
l = [int(i) for i in input().split(" ")]
print((l[0]-1)*(l[1]-1))


Fixed submission:
l = [int(i) for i in input().split(" ")]
print((l[0]-1)*(l[1]-1))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, M = sys.stdin.readline().strip().split()
N = int(N)
M = int(M)
L = M//N

for x in range(L, 0, -1):
  if M % x == 0:
    print(x)
    break

Fixed submission:
import sys
import math

N, M = sys.stdin.readline().strip().split()
N = int(N)
M = int(M)
P = M//N # これ以下で最大の、Mの約数を探す
Q = math.floor(math.sqrt(M)) #sqrt。解の探索範囲を絞るのに使う

# Mでないなら高々sqrt(M)


if P <= Q:
  # P=M/Nから1つずつ下がって探索
  for x in range(P, 0, -1):
    # print(x)
    if M % x == 0:
      print(x)
      break
elif P == M: # N=1
  print(M)
else:
  #1からQ=sqrt(M)まで増やす
  res = 1
  flag = 0
  for x in range(1, N, 1):
    # このときM/xはPより大きいことに注意
    if M % x == 0:
      res = x
  for x in range(N, Q+1, 1):
    if M % x == 0:
      print(M//x)
      flag = 1
      break
  if flag == 0:
    print(res)
Buggy python submission (verdict: Runtime Error):
import sys

N = sys.stdin.readline().strip()
N = int(N)

M = math.ceil(N / 111.0)
M = int(M * 111)


print(M)

Fixed submission:
import sys
import math
 
N = sys.stdin.readline().strip()
N = int(N)
 
M = math.ceil(N / 111.0)
M = int(M * 111)

print(M)
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int,input().split())

w = sorted(v)
ans = [] 

for i in range(1,n):
  ans.append(0)

for i in range(1,n):
  ans[i-1] = (w[i]+w[i-1])/2
  w[i] = ans[i-1]

print(ans[-1])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
now = a[0]
for i in range(1,n):
  now = ( now + a[i] ) / 2
print(now)
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(int(i))%2 == 1:
    count += 1
 
print(count)

Fixed submission:
a,b,c = map(int, input().split())
 
if b+c > a :
  print(c-(a-b))
  
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(int(i))//2 == 1:
    count += 1
 
print(count)

Fixed submission:
a,b,c = map(int, input().split())
 
if b+c > a :
  print(c-(a-b))
  
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in n:
  if len(i)%2 != 0:
    count += 1
 
print(count)

Fixed submission:
a,b,c = map(int, input().split())
 
if b+c > a :
  print(c-(a-b))
  
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

if B+C > A :
  print(C-(A-B))
  
else:
  print(0)

Fixed submission:
a,b,c = map(int, input().split())
 
if b+c > a :
  print(c-(a-b))
  
else:
  print(0)