Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
mod = 998244353
s = list(map(int, list(input())))
n = len(s)
dp = [[0]*(sum(s)+1) for _ in range(2*n+1)]
dp[0][0] = 1
curr = curb = 0
for i in range(2*n):
  if i < n:
    curb += s[i]
    curr += 2 - s[i]
  for j in range(min(i, curb)+1):
    if dp[i][j]:
      dp[i][j] %= mod
      if i - j < curr:
        dp[i+1][j] += dp[i][j]
      if j < curb:
        dp[i+1][j+1] += dp[i][j]
print(dp[2*n][curb])   

Fixed submission:
mod = 998244353
s = list(map(int, list(input())))
n = len(s)
dp = [[0]*(sum(s)+1) for _ in range(2*n+1)]
dp[0][0] = 1
curr = curb = 0
for i in range(2*n):
  if i < n:
    curb += s[i]
    curr += 2 - s[i]
  for j in range(min(i, curb)+1):
    if dp[i][j]:
      dp[i][j] %= mod
      if i - j < curr:
        dp[i+1][j] += dp[i][j]
      if j < curb:
        dp[i+1][j+1] += dp[i][j]
print(dp[2*n][curb] % mod)
Buggy python submission (verdict: Runtime Error):
x, t = = map(int, input().split())
print(x/t)

Fixed submission:
x, t = map(int, input().split())
print(x/t)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
y =[x[i+1] - x[i] for i in range(m-1)]
a=[0]
for i in range(n-1):
    a.append(y.index(max(y)) + 1)
    y[y.index(max(y))] = 0
a.append(m)
s = 0
for i in range(n):
    s += x[a[i+1]-1]-x[a[i]]
print(s)

Fixed submission:
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = list()
for i in range(m-1):
    y.append(x[i+1]-x[i])
y.sort(reverse=True)
print(x[-1]-x[0]-sum(y[:n-1]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n,m = map(int,input().split())
g = [set() for _ in range(n+1)]
gg = [0]*(n+1)
for _ in range(n-1+m):
    a,b = map(int,input().split())
    g[a].add(b)
    gg[b] = 1
p = [-1]*(n+1)
q = deque()
for i in range(1,n+1):
  if gg[i] == 0:
    p[i] = 0
    q.append(i)
    break
while q:
  v = q.popleft()
  for x in g[v]:
    q.append(x)
    p[x] = v
for x in p[1:]:
  print(x)


Fixed submission:
from collections import deque

n,m = map(int,input().split())
g = [set() for _ in range(n+1)]
gg = [0]*(n+1)
for _ in range(n-1+m):
    a,b = map(int,input().split())
    g[a].add(b)
    gg[b] += 1
p = [-1]*(n+1)
q = deque()
for i in range(1,n+1):
  if gg[i] == 0:
    p[i] = 0
    q.append(i)
    break
while q:
  v = q.popleft()
  for x in g[v]:
    gg[x] -= 1
    if gg[x] == 0:
      q.append(x)
      p[x] = v
for x in p[1:]:
  print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ov = []
un = 0
cnt = 0
for i in range(n):
  c = a[i]-b[i]
  if c >= 0:
    ov.append(c)
  else:
    un += c
    cnt += 1
if un == 0:
  print(0)
else:
  un *= -1
  ov.sort(reverse=True)
  ov2 = 0
  for i in range(n):
    ov2 += ov[i]
    if ov2 >= un:
      print(cnt+i+1)
      break
  else:
    print(-1)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ov = []
un = 0
cnt = 0
for i in range(n):
  c = a[i]-b[i]
  if c >= 0:
    ov.append(c)
  else:
    un += c
    cnt += 1
if un == 0:
  print(0)
else:
  un *= -1
  ov.sort(reverse=True)
  ov2 = 0
  for i in range(len(ov)):
    ov2 += ov[i]
    if ov2 >= un:
      print(cnt+i+1)
      break
  else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = [0] + list(map(int, input().split())) + [float("inf")]*(k+1)
dp = [float("inf")]*(n+k+1)
dp[0], dp[1] = 0, 0
for i in range(1,n):
    for j in range(1, k+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]))
print(dp[n])

Fixed submission:
n, k = map(int, input().split())
h = [0] + list(map(int, input().split())) + [float("inf")]*(k+1)
dp = [float("inf")]*(n+k+1)
dp[0], dp[1] = 0, 0
for i in range(1,n):
    for j in range(1, k+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]))
print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0]*n
for i in range(1,n):
    dp[i] = min([dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(i+1, k+1))])
print(dp[n-1])

Fixed submission:
n, k = map(int, input().split())
h = [0] + list(map(int, input().split())) + [float("inf")]*(k+1)
dp = [float("inf")]*(n+k+1)
dp[0], dp[1] = 0, 0
for i in range(1,n):
    for j in range(1, k+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]))
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
def chmax(dp, i, x):
  if dp[i] < x:
    dp[i] = x
    return True
  return False

n, W = map(int, input().split())
dp = [-10**9]*(W+1)
dp[0] = 0
for i in range(n):
  w, v = map(int, input().split())
  for i in range(W-w,-1,-1):
    dp[i+w] = max(dp[i+w], dp[i] + v) 
print(max(dp))

Fixed submission:
n,W = map(int, input().split())
l = [dict() for i in range(n+1)]
l[0][0] = 0
for i in range(1,n+1):
  w,v = map(int, input().split())
  l[i] = l[i-1].copy()
  l[i][w] = max(l[i].get(w,0),v)
  for x in l[i-1]:
    if x+w <= W:
      l[i][x+w] = max(l[i].get(x+w,0),l[i-1][x] + v)
print(max(l[n].values()))

Buggy python submission (verdict: Time Limit Exceeded):
n,W = map(int, input().split())
l = [dict() for i in range(n+1)]
l[0][0] = 0
for i in range(1,n+1):
  w,v = map(int, input().split())
  l[i] = l[i-1].copy()
  l[i][w] = max(l[i].get(w,0),v)
  for x in l[i-1]:
    if x+w <= W:
      l[i][x+w] = max(l[i].get(x+w,0),l[i-1][x] + v)
print(max(l[n].values()))

Fixed submission:
n,W = map(int, input().split())
l = [dict() for i in range(n+1)]
l[0][0] = 0
for i in range(1,n+1):
  w,v = map(int, input().split())
  l[i] = l[i-1].copy()
  l[i][w] = max(l[i].get(w,0),v)
  for x in l[i-1]:
    if x+w <= W:
      l[i][x+w] = max(l[i].get(x+w,0),l[i-1][x] + v)
print(max(l[n].values()))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  s = input()
  t = input()
  n = len(s)
  m = len(t)
  dp = [[0]*(m+1) for _ in range(n+1)]
  for i in range(n):
    for j in range(m):
      if s[i] == t[j]:
        dp[i+1][j+1] = dp[i][j] + 1
      else:
        dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
  i,j = n,m
  ans = ""
  while i and j:
    if dp[i][j] == dp[i-1][j]:
      i -= 1
    elif dp[i][j] == dp[i][j-1]:
      j -= 1
    else:
      i -= 1
      j -= 1
      ans += s[i]
  print(ans[::-1])

if __name__ == "__main__":
  main()

Fixed submission:
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
i,j = n,m
ans = ""
while i and j:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    ans += s[i]
print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
i,j = n,m
ans = ""
while i and j:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    ans += s[i]
print(ans[::-1])

Fixed submission:
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j] + 1
    else:
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
i,j = n,m
ans = ""
while i and j:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    ans += s[i]
print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [1.0] + list(map(float,input().split()))
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1.0
for i in range(1,n+1):
  dp[i][0] = dp[i-1][0]*(1.0-p[i])
  for j in range(1,i+1):
    dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i])
print(sum(dp[n][j] for j in range(n//2+1,n+1)))

Fixed submission:
n = int(input())
p = [1.0] + list(map(float,input().split()))
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1.0
for i in range(1,n+1):
  dp[i][0] = dp[i-1][0]*(1.0-p[i])
  for j in range(1,i+1):
    dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i])
print(sum(dp[n][j] for j in range(n//2+1,n+1)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = [0]*(1<<n)
ans[0] = 1
mod = 10**9 + 7

def popcnt(x):
  ret = 0
  for i in range(n):
    if x & (1<<i):
      ret += 1
  return ret

for bit in range(1<<n):
  if ans[bit]:
    i = popcnt(bit)
    v = 1
    for j in range(n):
      if not bit & v and a[i][j]:
        ans[bit|v] = (ans[bit|v] + ans[bit])%mod
      v <<= 1
print(ans[-1])

Fixed submission:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = [0]*(1<<n)
ans[0] = 1
mod = 10**9 + 7

def popcnt(x):
  ret = 0
  for i in range(n):
    if x & (1<<i):
      ret += 1
  return ret

for bit in range(1<<n):
  if ans[bit]:
    i = popcnt(bit)
    v = 1
    for j in range(n):
      if not bit & v and a[i][j]:
        ans[bit|v] = (ans[bit|v] + ans[bit])%mod
      v <<= 1
print(ans[-1])
Buggy python submission (verdict: Time Limit Exceeded):
k = list(map(int, list(input())))
n = len(k)
d = int(input())
dp = [[[0]*d for _ in range(2)] for _ in range(n+1)]
dp[0][0][0] = 1
mod = 10**9 + 7
for s in (0,1):
  for i in range(n):
    for j in range(10 if s else k[i]+1):
      for m in range(d):
        dp[i+1][s|(j<k[i])][(m+j)%d] = (dp[i+1][s|(j<k[i])][(m+j)%d] + dp[i][s][m]) % mod
print((dp[n][0][0] + dp[n][1][0] - 1) % mod)

Fixed submission:
k = list(map(int, list(input())))
n = len(k)
d = int(input())
dp = [[[0]*d for _ in range(2)] for _ in range(n+1)]
dp[0][0][0] = 1
mod = 10**9 + 7
for s in (0,1):
  for i in range(n):
    for j in range(10 if s else k[i]+1):
      for m in range(d):
        dp[i+1][s|(j<k[i])][(m+j)%d] = (dp[i+1][s|(j<k[i])][(m+j)%d] + dp[i][s][m]) % mod
print((dp[n][0][0] + dp[n][1][0] - 1) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,p+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Fixed submission:
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,int(p**.5)+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
if p > 1:
  primes[p] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict as dd
primes = dd(int)
n,p = int(input().split())
gcd = 1
for i in range(2,int(p**0.5)+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Fixed submission:
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,int(p**.5)+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
if p > 1:
  primes[p] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
while b:
  b = 0
  c = s.count("BW")
  if c:
    ans += c
    b = 1
    s = s.replace("BW", "WB")
print(ans)


Fixed submission:
s = input()
t = 0
c = 0
for i in range(len(s)):
  if s[i] == "W":
    t += i
    c += 1
print(t-c*(c-1)//2)
Buggy python submission (verdict: Runtime Error):
def burg(lev,x):
  if lev == 0:
    return x>0
  if x == 1:
    return 0
  if 1 < x <= h[lev-1]+1:
    return burg(lev-1,x-1)
  if x ==  h[lev-1]+2:
    return p[lev-1] + 1
  if h[lev-1]+3 <= x <= h[lev-1]*2 + 2:
    return p[lev-1] + 1 + burg(lev-1,x-(h[lev-1]+2))
  if x >= h[lev]:
    return paty[lev]

n,x = map(int, input().split())
h = [1]*(n+2)
p = [1]*(n+2)
for i in range(1,n+2):
  h[i] = h[i-1]*2 + 3
  p[i] = p[i-1]*2 + 1
print(burg(n,x))

Fixed submission:
def burg(lev,x):
  if lev <= 0:
    return int(x>0)
  if x <= 1:
    return 0
  if 1 < x < h[lev-1]+2:
    return burg(lev-1,x-1)
  if x == h[lev-1]+2:
    return p[lev-1] + 1
  if h[lev-1]+2 < x < h[lev]:
    return p[lev-1] + 1 + burg(lev-1,x-(h[lev-1]+2))
  if x >= h[lev]:
    return p[lev]

n,x = map(int, input().split())
h = [1]*(n+2)
p = [1]*(n+2)
for i in range(1,n+2):
  h[i] = h[i-1]*2 + 3
  p[i] = p[i-1]*2 + 1
print(burg(n,x))
Buggy python submission (verdict: Runtime Error):
s = list(input())
m = 1000
for i in range(len(s)-3):
  if s[i]*100+s[i+1]*10+s[i+2] < m:
    m = s[i]*100+s[i+1]*10+s[i+2]
print(m)

Fixed submission:
s = list(map(int, list(input())))
m = 1000
for i in range(len(s)-2):
  if abs(753 - (s[i]*100+s[i+1]*10+s[i+2])) < m:
    m = abs(753 - (s[i]*100+s[i+1]*10+s[i+2]))
print(m)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict as ddict
d = ddict(int)
for i in range(1,n):
  for p in range(2,int(i**.5)+2):
    while i%p == 0:
      d[p] += 1
      i//=p
f = [2,4,14,24,74]
g = [0]*5
for x in d.values():
  for i in range(5):
    if x >= f[i]:
      g[i] += 1
#3 5 5
#3 25
#15 5
#75
ans = f[1]*(f[1]-1)*(f[0]-2) + f[3]*(f[0]-1) + f[2]*(f[1]-1) + f[4]
print(ans)

Fixed submission:
from collections import defaultdict as ddict
d = ddict(int)
n = int(input())
for i in range(1,n+1):
  for p in range(2,int(i**.5)+2):
    while i%p == 0:
      d[p] += 1
      i//=p
  if i>1:
    d[i] += 1
g = [2,4,14,24,74]
f = [0]*5
for x in d.values():
  for i in range(5):
    if x >= g[i]:
      f[i] += 1
ans = f[1]*(f[1]-1)//2*(f[0]-2) + f[3]*(f[0]-1) + f[2]*(f[1]-1) + f[4]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,k = map(int, input().split())
  l = [0] + list(map(int, input().split()))
  for i in range(n):
    l[i+1] += l[i]
  a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
  x = 0
  for i in range(40,-1,-1):
    t = 2**i
    if sum(y&(t+x)==t+x for y in a) >= k:
      x += t
  return x

if __name__ == "__main__":
  print(main())


Fixed submission:
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i 
  if sum(map(lambda y:((y&(t+x)) == t+x),a)) >= k:
    x += t
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i
  if sum(1 if y&(t+x)==t+x else 0 for y in a) >= k:
    x += t
print(x)


Fixed submission:
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i 
  if sum(map(lambda y:((y&(t+x)) == t+x),a)) >= k:
    x += t
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i
  if sum(map(lambda y:((y&(t+x)) == t+x),a)) >= k:
    x += t
print(x)

Fixed submission:
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i 
  if sum(map(lambda y:((y&(t+x)) == t+x),a)) >= k:
    x += t
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
for i in range(n):
  for j in range(i+1,n+1):
    a.append(l[j]-l[i])
x = 0
for i in range(40,-1,-1):
  t = 2**i
  if sum(1 for p in a if p&(t+x)>=t+x) >= k:
    x += t
print(x)


Fixed submission:
n,k = map(int, input().split())
l = [0] + list(map(int, input().split()))
a = list()
for i in range(n):
  l[i+1] += l[i]
a = [l[j]-l[i] for i in range(n) for j in range(i+1,n+1)]
x = 0
for i in range(40,-1,-1):
  t = 2**i 
  if sum(map(lambda y:((y&(t+x)) == t+x),a)) >= k:
    x += t
print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
v = t-a
for i in range(n):
    h[i] = abs(v-h[i])
print(h.index(min(h))+1)

Fixed submission:
x, y = map(int, input().split())
print(int(x+y/2))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in d:
  r.sort()
for x in l:
  p = x[0]
  y = d[x[0]-1].index(x[1]) + 1
  print("{:06}{:06}".format(p,y))

Fixed submission:
n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
dic = [dict() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in range(n):
  d[r].sort()
  dic[r] = dict(zip(d[r],range(1,len(d[r])+1)))
for x in l:
  p = x[0]
  y = dic[x[0]-1][x[1]]
  print("{:06}{:06}".format(p,y))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in d:
  r.sort()
for x in l:
  p = x[0]
  y = d[x[0]-1].index(x[1]) + 1
  print("{:06}{:06}".format(p,y)

Fixed submission:
n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
dic = [dict() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in range(n):
  d[r].sort()
  dic[r] = dict(zip(d[r],range(1,len(d[r])+1)))
for x in l:
  p = x[0]
  y = dic[x[0]-1][x[1]]
  print("{:06}{:06}".format(p,y))
Buggy python submission (verdict: Runtime Error):
n, t =map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(n)]
m = sorted([i for i in l if i[1] <= t])
print(m[0][0])

Fixed submission:
n, t =map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(n)]
m = [i for i in l if i[1] <= t]
if m == []:
  print("TLE")
else:
  m.sort()
  print(m[0][0])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
for i in range(m//n,0,-1):
  if m%i == 0:
    print(i)
    break

Fixed submission:
n,m = map(int, input().split())
l = []
for i in range(1,int(m**0.5)+1):
  if m%i == 0:
    l.append(i)
    l.append(m//i)
r = [x for x in l if x <= m//n]
print(max(r))
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial as fac
from collections import defaultdict as ddict
n,m = map(int,input().split())
d = ddict(int)
ans = 1
mod = 10**9+7
def cc(n,r):
  return fac(n)//fac(r)//fac(n-r)
for i in range(2,int(m**.5)+1):
  while m % i == 0:
    d[i] += 1
    m //= i
if m > 1:
  d[m] += 1
for x in d:
  ans = ans * cc(d[x]+n-1,d[x])%mod
print(ans)

Fixed submission:
from math import factorial as fac
from collections import defaultdict as ddict
n,m = map(int,input().split())
d = ddict(int)
ans = 1
mod = 10**9+7
def f2(n,r):
  ret = 1
  for i in range(n,n-r,-1):
    ret *= i
  return ret
def cc(n,r):
  t = min(r,n-r)
  return f2(n,t)//fac(t)
for i in range(2,int(m**.5)+1):
  while m % i == 0:
    d[i] += 1
    m //= i
if m > 1:
  d[m] += 1
for x in d:
  ans = ans * cc(d[x]+n-1,d[x])%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a % 2 != 0 and b % 2 != 0:
  print(“Yes”)
else:
  print(“No”)


Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == '1':
  i += 1
if i == 0 or k <= i:
  print(1)
else:
  print(int(s[i]))

Fixed submission:
s = input()
k = int(input())
i = 0
l = len(s)
while s[i] == '1':
  if i >= l-1:
    break
  i += 1
if i == 0 or k <= i:
  print(s[0])
else:
  print(s[i])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == '1':
  i += 1
if i == 0 or k <= i:
  print(s[0])
else:
  print(s[i])

Fixed submission:
s = input()
k = int(input())
i = 0
l = len(s)
while s[i] == '1':
  if i >= l-1:
    break
  i += 1
if i == 0 or k <= i:
  print(s[0])
else:
  print(s[i])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
if k == 1 and s[0] == '1':
  print(s[0])
else:
  print(s[1])

Fixed submission:
s = input()
k = int(input())
i = 0
l = len(s)
while s[i] == '1':
  if i >= l-1:
    break
  i += 1
if i == 0 or k <= i:
  print(s[0])
else:
  print(s[i])
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
ans = 0
a = list(map(int, input().split()))
b = [0]*(n+1)
for i in range(1,n+1):
  b[i] = (a[i-1] + b[i-1])%m
f = [0]*m
for i in b:
  f[i] += 1
for i in f:
  ans += i*(i-1)//2
print(ans)

Fixed submission:
from collections import defaultdict as dd
d = dd(int)
d[0] = 1
n,m = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
f = 0
for i in range(1,n+1):
  f = (f + a[i-1])%m
  d[f] += 1
for i in d:
  ans += d[i]*(d[i]-1)//2
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
ans = 0
def kx(t):
  return int(t)%m
a = list(map(kx, input().split()))
b = [0]*(n+1)
for i in range(1,n+1):
  a[i] = a[i-1] + b[i-1]
f = [0]*m
for i in b:
  f[i] += 1
for i in f:
  ans += i*(i-1)//2
print(ans)

Fixed submission:
from collections import defaultdict as dd
d = dd(int)
d[0] = 1
n,m = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
f = 0
for i in range(1,n+1):
  f = (f + a[i-1])%m
  d[f] += 1
for i in d:
  ans += d[i]*(d[i]-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
b = 0
if s[0] == "A" and "C" in s[2:-2] and s.replace("A","",1).replace("C","",1).islower():
    print("AC")
else:
    print("WA")

Fixed submission:
s = input()
b = 0
if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower():
    print("AC")
else:
    print("WA")
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(m)]
l.sort(key=lambda x:x[1],reverse = True)
dec = 0
while l:
  a = l.pop()
  dec += 1
  l = [i for i in l if not (i[0] < a[1] <= i[1])]
print(dec)

Fixed submission:
n,m = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(m)]
l.sort(key=lambda x:x[1])
dec = 0
cur = 0
for i in l:
  if i[0] < cur <= i[1]:
    continue
  else:
    dec += 1
    cur = i[1]
print(dec)