Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
xv, yv = [], []
xy = []
for _ in range(n):
    x, y = map(int, input().split())
    xv.append(x)
    yv.append(y)
    xy.append((x, y))

xv = sorted(xv)
yv = sorted(yv)
ans = (xv[n-1] - xv[0]) * (yv[n-1] - yv[0])
for l in range(n):
    lx = xv[l]
    for r in range(l+1, n):
        rx = xv[r]
        for b in range(n):
            by = yv[b]
            for t in range(b+1, n):
                ty = yv[t]
                cnt = 0
                for x, y in xy:
                    if lx <= x <= rx and by <= y <= ty:
                        cnt += 1
                if cnt >= k:
                    ans = min(ans, (rx - lx)*(ty - by))
print(ans)



Fixed submission:
n, k = map(int, input().split())
xv, yv = [], []
xy = []
for _ in range(n):
    x, y = map(int, input().split())
    xv.append(x)
    yv.append(y)
    xy.append((x, y))

xv = sorted(xv)
yv = sorted(yv)
ans = (xv[n-1] - xv[0]) * (yv[n-1] - yv[0])
for l in range(n):
    lx = xv[l]
    for r in range(l+1, n):
        rx = xv[r]
        for b in range(n):
            by = yv[b]
            for t in range(b+1, n):
                ty = yv[t]
                cnt = 0
                for x, y in xy:
                    if lx <= x <= rx and by <= y <= ty:
                        cnt += 1
                if cnt >= k:
                    ans = min(ans, (rx - lx)*(ty - by))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
ws = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w = 100*(a*i+b*j)
        if 0 < w < f:
            ws.append(w)
        if w >= f:
            break

ss = []
for i in range((f-100*a)//c+1):
    for j in range((f-100*a)//d+1):
        s = c*i+d*j
        if 0 < s < f-100*a:
            ss.append(s)

n = []
for w in ws:
    for s in ss:
        if w+s > f:
            continue
        if s > e*w//100:
            continue
        n.append((s/(w+s), w+s, s))

nmax = max(n, key=lambda x:x[0])
print(nmax[1], nmax[2])


Fixed submission:
a,b,c,d,e,f = map(int, input().split())
ws = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w = 100*(a*i+b*j)
        if 0 < w <= f:
            ws.append(w)
        if w >= f:
            break
ss = []
for i in range(f*e//(100+e)//c+1):
    for j in range(f*e//(100+e)//d+1):
        s = c*i+d*j
        if 0 <= s <= f*e//(100+e):
            ss.append(s)
n = []
for w in ws:
    for s in ss:
        if w+s > f:
            continue
        if s > e*w//100:
            continue
        n.append((s/(w+s), w+s, s))

nmax = max(n, key=lambda x:x[0])
print(nmax[1], nmax[2])

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
wvs = []
va = 0
while va <= f:
    va += 100*a
    vab = va
    while vab <= f:
        wvs.append(vab)
        vab += 100*b

svs = []
vc = 0
while vc+100*a <= f:
    vc += c
    vcd = vc
    while vcd+100*a <= f:
        svs.append(vcd)
        vcd += d

n = []
for w in wvs:
    for s in svs:
        if w+s > f:
            break
        if s/w > e/100:
            break
        n.append((s/(w+s), w+s, s))

nmax = max(n, key=lambda x:x[0])
print(nmax[1], nmax[2])


Fixed submission:
a,b,c,d,e,f = map(int, input().split())
ws = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w = 100*(a*i+b*j)
        if 0 < w <= f:
            ws.append(w)
        if w >= f:
            break
ss = []
for i in range(f*e//(100+e)//c+1):
    for j in range(f*e//(100+e)//d+1):
        s = c*i+d*j
        if 0 <= s <= f*e//(100+e):
            ss.append(s)
n = []
for w in ws:
    for s in ss:
        if w+s > f:
            continue
        if s > e*w//100:
            continue
        n.append((s/(w+s), w+s, s))

nmax = max(n, key=lambda x:x[0])
print(nmax[1], nmax[2])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
factors = []
while n%2 == 0:
    factors.append(2)
    n //=2

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
if n != 1:
    factors.append(n)

nf = len(factors)

fab = 11
sset = set()
als = 2**nf
for i in range(als):
    if als^i in sset:
        continue
    sset.add(i)
    
    a = 1
    b = 1
    for j in range(nf):
        if (i>>j)&1:
            a *= factors[j]
        else:
            b *= factors[j]

    fab = min(fab, max(len(str(a)), len(str(b))))
print(fab)


Fixed submission:
n = int(input())
factors = []
while n%2 == 0:
    factors.append(2)
    n //=2

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
if n != 1:
    factors.append(n)

nf = len(factors)

fab = 11
sset = set()
als = 2**nf
for i in range(als):
    if als^i in sset:
        continue
    sset.add(i)
    a = 1
    b = 1
    for j in range(nf):
        if (i>>j)&1:
            a *= factors[j]
        else:
            b *= factors[j]

    fab = min(fab, max(len(str(a)), len(str(b))))
print(fab)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
factors = []
while n%2 == 0:
    factors.append(2)
    n //=2

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
if n != 1:
    factors.append(n)

nf = len(factors)

fab = 11
for i in range(2**nf):
    a = 1
    b = 1
    for j in range(nf):
        if (i>>j)&1:
            a *= factors[j]
        else:
            b *= factors[j]

    fab = min(fab, max(len(str(a)), len(str(b))))
print(fab)

Fixed submission:
n = int(input())
factors = []
while n%2 == 0:
    factors.append(2)
    n //=2

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
if n != 1:
    factors.append(n)

nf = len(factors)

fab = 11
sset = set()
als = 2**nf
for i in range(als):
    if als^i in sset:
        continue
    sset.add(i)
    a = 1
    b = 1
    for j in range(nf):
        if (i>>j)&1:
            a *= factors[j]
        else:
            b *= factors[j]

    fab = min(fab, max(len(str(a)), len(str(b))))
print(fab)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for z in range(0, k+1):
    sz = s-z
    for xy in range(0, k+1):
        if xy+xy == sz:
            ans += 1
            break
        elif xy+xy > sz:
            break

    for x in range(0, k):
        for y in range(x+1, k+1):
            if x+y == sz:
                ans +=2
                break
            elif x+y > sz:
                break
print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0
for z in range(0, k+1):
    sz = s-z
    for x in range(0, k+1):
        szx = sz-x
        if 0 <= szx <= k:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty = map(int, input().split())
ofs = 1001
visited = [[0] * 2003 for _ in range(2003)]
stoij = {'U':[0, 1], 'D':[0,-1], 'L':[-1, 0], 'R':[1, 0]}

from collections import deque
def bfs(si, sj, gi, gj):
    q = deque([[si, sj, '']])
    visitedinbfs = [[0] * 2003 for _ in range(2003)]
    visitedinbfs[sj][si] = 1

    while q:
        i, j, s = q.popleft()
        if i == gi and j == gj:
            break

        for ns in ['U', 'D', 'L', 'R']:
            mi, mj = stoij[ns]
            ni, nj = i + mi, j + mj
            if ni < 0 or 2003 <= ni or nj < 0 or 2003 <= ni:
                continue
            if visitedinbfs[nj][ni] == 1 or visited[nj][ni] == 1:
                continue
            visitedinbfs[nj][ni] = 1
            q.append([ni, nj, s+ns])

    for ss in s:
        mi, mj = stoij[ss]
        si += mi
        sj += mj
        if si == gi and sj == gj:
            break
        visited[sj][si] = 1
    return s

ans =  bfs(sx+ofs, sy+ofs, tx+ofs, ty+ofs)
ans += bfs(tx+ofs, ty+ofs, sx+ofs, sy+ofs)
ans += bfs(sx+ofs, sy+ofs, tx+ofs, ty+ofs)
ans += bfs(tx+ofs, ty+ofs, sx+ofs, sy+ofs)
print(ans)


Fixed submission:
sx, sy, tx, ty = map(int, input().split())
dy = ty - sy
dx = tx - sx
ans = dy*'U' + dx*'R' + dy*'D' + dx*'L'
ans += 'L' + (dy+1)*'U' + (dx+1)*'R' + 'D'
ans += 'R' + (dy+1)*'D' + (dx+1)*'L' + 'U'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
sx, sy, tx, ty = map(int, input().split())
visited = [[0] * 4001 for _ in range(4001)]
ofs = 2000

stoij = {'U':[0, 1], 'D':[0,-1], 'L':[-1, 0], 'R':[1, 0]}

from collections import deque
def bfs(si, sj, gi, gj):
    q = deque([[si, sj, '']])
    visitedinbfs = [[0] * 4001 for _ in range(4001)]
    visitedinbfs[sj+ofs][si+ofs] = 1

    while q:
        i, j, s = q.popleft()
        if i == gi and j == gj:
            break

        for ns in ['U', 'D', 'L', 'R']:
            mi, mj = stoij[ns]
            ni, nj = i + mi, j + mj
            if visitedinbfs[nj+ofs][ni+ofs] == 1 or visited[nj+ofs][ni+ofs] == 1:
                continue
            visitedinbfs[nj+ofs][ni+ofs] = 1
            q.append([ni, nj, s+ns])

    for ss in s:
        mi, mj = stoij[ss]
        si += mi
        sj += mj
        if si == gi and sj == gj:
            break
        visited[sj+ofs][si+ofs] = 1
    
    return s

ans = bfs(sx, sy, tx, ty)
ans += bfs(tx, ty, sx, sy)
ans += bfs(sx, sy, tx, ty)
ans += bfs(tx, ty, sx, sy)
print(ans)


Fixed submission:
sx, sy, tx, ty = map(int, input().split())
dy = ty - sy
dx = tx - sx
ans = dy*'U' + dx*'R' + dy*'D' + dx*'L'
ans += 'L' + (dy+1)*'U' + (dx+1)*'R' + 'D'
ans += 'R' + (dy+1)*'D' + (dx+1)*'L' + 'U'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = tuple(map(lambda x:int(x)-1, input().split()))

paired = [0] * n
c = 0
for i in range(n-1):
    if paired[i]:
        continue

    for j in range(i+1, n):
        if A[i] == j and A[j] == i:
            paired[j] = 1
            paired[i] = 1
            c += 1
            break
print(c)


Fixed submission:
n = int(input())
A = tuple(map(lambda x:int(x)-1, input().split()))

paired = [0] * n
c = 0
for i in range(n-1):
    if paired[i]:
        continue

    if A[A[i]] == i:
        c += 1
        paired[A[i]] = 1

print(c)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

ns = []
for c in s[:-1]:
    ofstoa = ord('z')+1-ord(c)
    if k >= ofstoa:
        ns.append('a')
        k -= ofstoa
    else:
        ns.append(c)

last = ord(s[-1])
if last + k > ord('z'):
    ns.append(chr(last + k - 26))
else:
    ns.append(chr(last + k))

print(''.join(ns))

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

ns = []
for c in s[:-1]:
    if c == 'a':
        ns.append(c)
        continue

    ofstoa = ord('z')+1-ord(c)
    if k >= ofstoa:
        ns.append(chr(ord(c) + ofstoa - 26))
        k -= ofstoa
    else:
        ns.append(c)

last = ord(s[-1])
k = k%26
if last + k > ord('z'):
    ns.append(chr(last + k - 26))
else:
    ns.append(chr(last + k))
print(''.join(ns))
Buggy python submission (verdict: Runtime Error):
n, a = map(int, input().split())
X = tuple(map(int, input().split()))
dp = [[[0] * (n*max(X)+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    # i枚目までで
    for j in range(n):
        # j枚のカードを選んで
        for s in range(n*max(X)+1):
            # 合計がsになるパターン
            if dp[i][j][s] == 0:
                continue
            # i枚目のカードが選ばれない場合
            dp[i+1][j][s] += dp[i][j][s]
            # i枚目のカードが選ばれる場合
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)


Fixed submission:
n, a = map(int, input().split())
X = tuple(map(int, input().split()))
dp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    # i枚目までで
    for j in range(n):
        # j枚のカードを選んで
        for s in range(n*a+1):
            # 合計がsになるパターン
            if dp[i][j][s] == 0:
                continue
            # i枚目のカードが選ばれない場合
            dp[i+1][j][s] += dp[i][j][s]
            # i枚目のカードが選ばれる場合
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split())
X = tuple(map(int, input().split()))
X = sorted(X)

from collections import deque
ans = 0
for i in range(n):
    st = deque([[i, 1, X[i]]])
    while st:
        idx, count, s = st.pop()
        if count*a == s:
            ans += 1
        elif count*a < s:
            continue
        
        for ni in range(idx+1, n):
            st.append([ni, count+1, s+X[ni]])
print(ans)
        

Fixed submission:
n, a = map(int, input().split())
X = tuple(map(int, input().split()))
dp = [[[0] * (2550) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    # i枚目までで
    for j in range(n):
        # j枚のカードを選んで
        for s in range(n*a+1):
            # 合計がsになるパターン
            if dp[i][j][s] == 0:
                continue
            # i枚目のカードが選ばれない場合
            dp[i+1][j][s] += dp[i][j][s]
            # i枚目のカードが選ばれる場合
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
ans = 0
for k in range(1, n+1):
    ans += dp[n][k][k*a]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H, W = map(int, input().split())
CH, CW = map(int, input().split())
DH, DW = map(int, input().split())
CH -= 1
CW -= 1
DH -= 1
DW -= 1

mp = [input() for _ in range(H)]
ds = [[0,-1],[0,1],[-1,0],[1,0]]

memo1 = [[0]*W for _ in range(H)]

c = 0
for i in range(H):
  for j in range(W):
    if memo1[i][j] != 0:
      continue
    if mp[i][j] == '#':
      memo1[i][j] = -1
      continue
    h = deque([(i,j)])
    c += 1
    memo1[i][j] = c
    while h:
      t = h.popleft()
      for d in ds:
        if t[0]+d[0] >= 0 and t[0]+d[0] < H \
           and t[1]+d[1] >= 0 and t[1]+d[1] < W:
          if mp[t[0]+d[0]][t[1]+d[1]] == '.' and memo1[t[0]+d[0]][t[1]+d[1]] == 0:
            memo1[t[0]+d[0]][t[1]+d[1]] = c
            h.append((t[0]+d[0], t[1]+d[1]))
    
if memo1[CH][CW] == memo1[DH][DW]:
  print(0)
  exit()
    
ds = [[i,j] for i in range(-1,2) for j in range(-1,2)]
dic = {i:set([]) for i in range(1,c+1)}

for i in range(H):
  for j in range(W):
    if memo1[i][j] == -1:
      s = set([])
      for d in ds:
        if i+d[0] >= 0 and i+d[0] < H and j+d[1] >= 0 and j+d[1] < W:
          if memo1[i+d[0]][j+d[1]] > 0 and memo1[i+d[0]][j+d[1]] not in s:
            for u in s:
              dic[memo1[i+d[0]][j+d[1]]].add(u)
              dic[u].add(memo1[i+d[0]][j+d[1]])
            s.add(memo1[i+d[0]][j+d[1]])

s = memo1[CH][CW]
t = memo1[DH][DW]
  
lst = [10**9]*(c+1)
lst[s] = 0

h = deque([(s,0)])
while h:
  u = h.popleft()
  for v in dic[u[0]]:
    if lst[v] <= u[1]:
      continue
    lst[v] = lst[u[0]] + 1
    h.append((v,lst[v]))
    
    
if lst[t] == 10**9:
  print(-1)
else:
  print(lst[t])


Fixed submission:
from collections import deque

H, W = map(int, input().split())
CH, CW = map(lambda x:int(x)-1, input().split())
DH, DW = map(lambda x:int(x)-1, input().split())

mp = [input() for _ in range(H)]
ds1 = [[0,-1],[0,1],[-1,0],[1,0]]
ds2 = [[i,j] for i in range(-2,3) for j in range(-2,3)]

memo = [[0]*W for _ in range(H)]
memo[CH][CW] = 1

h1 = deque([(CH,CW)])
h2 = deque([])
ans = 0

while 1:
  while h1:
    t = h1.popleft()
    h2.append(t)
    for d in ds1:
      if t[0]+d[0] >= 0 and t[0]+d[0] < H \
         and t[1]+d[1] >= 0 and t[1]+d[1] < W:
        if mp[t[0]+d[0]][t[1]+d[1]] == '.' and memo[t[0]+d[0]][t[1]+d[1]] == 0:
          memo[t[0]+d[0]][t[1]+d[1]] = 1
          h1.append((t[0]+d[0], t[1]+d[1]))
  if memo[DH][DW] == 1:
    print(ans)
    exit()
  ans += 1

  while h2:
    t = h2.popleft()
    for d in ds2:
      if t[0]+d[0] >= 0 and t[0]+d[0] < H \
         and t[1]+d[1] >= 0 and t[1]+d[1] < W:
        if mp[t[0]+d[0]][t[1]+d[1]] == '.' and memo[t[0]+d[0]][t[1]+d[1]] == 0:
          memo[t[0]+d[0]][t[1]+d[1]] = 1
          h1.append((t[0]+d[0], t[1]+d[1]))
          
  if not h1:
    print(-1)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[:0:-1]

N = int(input())
As = list(map(int, input().split()))
st = set(As)
Fs = [0]*N
 
As.sort()
if N == 1:
  print(1)
  exit()
else:
  rlt = 1
  
for i in range(1,N):
  if As[i] == As[i-1]:
    Fs[i] = 1
    if Fs[i-1] == 0:
      rlt -= 1
    continue
  ls =  make_divisors(As[i])
  for l in ls:
    flag = 0
    if l in st:
      Fs[i] = 1
      flag = 1
      break
  if flag == 0:
    rlt += 1
    
print(rlt)

Fixed submission:
N = int(input())
As = list(map(int, input().split()))
 
As.sort()
 
st = set(As)
m = As[-1]
rlt = 0
Fs = [1]*(m+1)
 
for i in range(N):
  if i > 0 and As[i] == As[i-1]:
    Fs[As[i]] = 0
    continue
  j = 2
  while As[i]*j <= m:
    Fs[As[i]*j] = 0
    j += 1

for a in As:
  rlt += Fs[a]
    
print(rlt)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
As = list(map(int, input().split()))

st = set(As)

Fs = [0]*N

As.sort()
if N == 1:
  print(1)
  exit()
else:
  rlt = 1
  
for i in range(1,N):
  if As[i] == As[i-1]:
    Fs[i] = 1
    if Fs[i-1] == 0:
      rlt -= 1
    continue
  for j in range(i):
    flag = 0
    if Fs[j] == 1:
      continue
    else:
      if As[i] < 2*As[j]:
        break
      if As[i]%As[j] == 0:
        Fs[i] = 1
        flag = 1
        break
  if flag == 0:
    rlt += 1
        
print(rlt)

Fixed submission:
N = int(input())
As = list(map(int, input().split()))
 
As.sort()
 
st = set(As)
m = As[-1]
rlt = 0
Fs = [1]*(m+1)
 
for i in range(N):
  if i > 0 and As[i] == As[i-1]:
    Fs[As[i]] = 0
    continue
  j = 2
  while As[i]*j <= m:
    Fs[As[i]*j] = 0
    j += 1

for a in As:
  rlt += Fs[a]
    
print(rlt)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

S = input()
l = [0]
for i in range(1,len(S)+1):
  tmp = int(S[-i:])
  l.append(tmp%2019)

c = collections.Counter(l)

rlt = 0
for k in c:
  rlt += c[k]*(c[k]-1)//2

print(rlt)

Fixed submission:
import collections
 
S = input()
l = [0]
a = 0
b = 1

for i in range(1,len(S)+1):
  a = (a+int(S[-i])*b)%2019
  l.append(a)
  b = (b*10)%2019
  

c = collections.Counter(l)
 
rlt = 0
for k in c:
  rlt += c[k]*(c[k]-1)//2

print(rlt)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
As = list(map(int, input().split()))
P = 10**9+7

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

lcm = As[0]*As[1]//gcd(As[0],As[1])
 
for i in range(2,N):
  c = gcd(lcm, As[i])
  lcm *= As[i]//c

Fixed submission:
def pow_r(x, n, P):
  if n == 0:
    return 1
  if n % 2 == 0:
    return pow_r(x ** 2 % P, n // 2, P)
  else:
    return x * pow_r(x ** 2 % P, n // 2, P) 

from fractions import gcd

N = int(input())
As = list(map(int, input().split()))
P = 10**9+7

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

lcm = As[0]*As[1]//gcd(As[0],As[1])
 
for i in range(2,N):
  c = gcd(lcm, As[i])
  lcm *= As[i]//c

rlt = 0
for a in As:
  rlt += lcm*pow_r(a, P-2, P) % P
  rlt %= P
print(rlt)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd 

N = int(input())
As = list(map(int, input().split()))
P = 10**9+7

lcm = As[0]*As[1]//gcd(As[0],As[1])

for i in range(2,N):
  c = gcd(lcm, As[i])
  lcm *= As[i]//c
  
rlt = 0
for a in As:
  rlt += lcm//a
  rlt %= P

print(rlt)

Fixed submission:
def pow_r(x, n, P):
  if n == 0:
    return 1
  if n % 2 == 0:
    return pow_r(x ** 2 % P, n // 2, P)
  else:
    return x * pow_r(x ** 2 % P, n // 2, P) 

from fractions import gcd

N = int(input())
As = list(map(int, input().split()))
P = 10**9+7

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

lcm = As[0]*As[1]//gcd(As[0],As[1])
 
for i in range(2,N):
  c = gcd(lcm, As[i])
  lcm *= As[i]//c

rlt = 0
for a in As:
  rlt += lcm*pow_r(a, P-2, P) % P
  rlt %= P
print(rlt)
Buggy python submission (verdict: Runtime Error):
X = int(input(X))

a = X // 100
b = X % 100

m = 5*a

if b > m:
  print(0)
else:
  print(1)

Fixed submission:
X = int(input())

a = X // 100
b = X % 100

m = 5*a

if b > m:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
 
N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()
 
ans = 0
 
for i in range(N-1,1,-1):
  for j in range(i-1,0,-1):
    if 2*Ls[j] <= Ls[i]:
      break
    ans += (len(Ls[:j]) - bisect.bisect_right(Ls[:j],Ls[i]-Ls[j]))
       
print(ans)

Fixed submission:
import bisect
 
N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()
 
ans = 0
 
for i in range(0,N-2):
  for j in range(i+1,N-1):
    k = bisect.bisect_left(Ls,Ls[i]+Ls[j])
    ans += k - (j + 1)
       
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
 
N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()
 
ans = 0
 
for i in range(2,N):
  for j in range(1,i):
    if 2*Ls[j] <= Ls[i]:
      continue
    ans += (len(Ls[:j]) - bisect.bisect_right(Ls[:j],Ls[i]-Ls[j]))
       
print(ans)

Fixed submission:
import bisect
 
N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()
 
ans = 0
 
for i in range(0,N-2):
  for j in range(i+1,N-1):
    k = bisect.bisect_left(Ls,Ls[i]+Ls[j])
    ans += k - (j + 1)
       
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()

ans = 0

for i in range(2,N):
  for j in range(1,i):
    ans += (len(Ls[:j]) - bisect.bisect_right(Ls[:j],Ls[i]-Ls[j]))
       
print(ans)

Fixed submission:
import bisect
 
N = int(input())
Ls = list(map(int, input().split(" ")))
Ls.sort()
 
ans = 0
 
for i in range(0,N-2):
  for j in range(i+1,N-1):
    k = bisect.bisect_left(Ls,Ls[i]+Ls[j])
    ans += k - (j + 1)
       
print(ans)