Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int,input().split())
t = pow(2, n, 10**9 + 7) - 1
x = 1
y = 1
for i in range(a):
    x *= (n - i)
    y *= (a - i)
f = (x // y) % (10**9 + 7)
x = 1
y = 1
for i in range(b):
    x *= (n - i)
    y *= (b - i)
s = (x // y) % (10**9 + 7)

print((t - f - s + (10**9 + 7)) % (10**9 + 7))


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

def inv(a):
    return pow(a, (10**9 + 7) - 2, (10**9 + 7))
    
    
t = pow(2, n, 10**9 + 7) - 1
x = 1
y = 1
for i in range(a):
    x *= (n - i)
    x %= (10**9 + 7)
    y *= (a - i)
    y %= (10**9 + 7)
    
f = (x * inv(y)) % (10**9 + 7)
x = 1
y = 1

for i in range(b):
    x *= (n - i)
    x %= (10**9 + 7)
    y *= (b - i)
    y %= (10**9 + 7)
s = (x * inv(y)) % (10**9 + 7)

print((t - f - s + (10**9 + 7)) % (10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
b.sort(reverse=True)


def ok(mid,a,b,k,n):
    tmp = 0
    for i in range(n):
        if a[i] * b[i] > mid:
            tmp += a[i] - mid//b[i]
    if tmp > k:
        return 1
    else:
        return -1


def bin_search(a,b,k,n):
    l = 0
    r = 10**20
    while l <= r:
        mid = l + (r - l)//2
        res = ok(mid,a,b,k,n)
        if res < 0:
            r = mid - 1
        else:
            l = mid + 1
    return l


print(bin_search(a,b,k,n))

Fixed submission:
n,k = map(int,input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
b.sort(reverse=True)


def ok(mid,a,b,k,n):
    tmp = 0
    for i in range(n):
        if a[i] * b[i] > mid:
            tmp += a[i] - mid//b[i]
    if tmp > k:
        return 1
    else:
        return -1


def bin_search(a,b,k,n):
    l = 0
    r = 10**12
    while l <= r:
        mid = l + (r - l)//2
        res = ok(mid,a,b,k,n)
        if res < 0:
            r = mid - 1
        else:
            l = mid + 1
    return l


print(bin_search(a,b,k,n))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(a - 2*b), 0)

Fixed submission:
a,b = map(int,input().split())
print(max(a - 2*b, 0))
Buggy python submission (verdict: Runtime Error):
n,w = map(int, input().split())
a = [[int(x) for x in input().split()] for i in range(n)]
dp = [10**100 for i in range(10**4 + 1)]
dp[0] = 0
for i in range(n):
    for j in range(10**4, -1, -1):
        if dp[j] != 10**100:
            dp[j + a[i][1]] = min(dp[j + a[i][1]], dp[j] + a[i][0])
for i in range(10**4, -1, -1):
    if dp[i] <= w:
        print(i)
        exit(0)

Fixed submission:
n,w = map(int, input().split())
a = [[int(x) for x in input().split()] for i in range(n)]
dp = [10**100 for i in range(10**5 + 1)]
dp[0] = 0
for i in range(n):
    for j in range(10**5, -1, -1):
        if dp[j] != 10**100:
            dp[j + a[i][1]] = min(dp[j + a[i][1]], dp[j] + a[i][0])
for i in range(10**5, -1, -1):
    if dp[i] <= w:
        print(i)
        exit(0)
Buggy python submission (verdict: Runtime Error):
 n = int(input())
  
print(1-n)

Fixed submission:
x = int(input())
if x ==1:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(1,n+1):
  if l[i-1]>l[i]:
     m.append(l[i-1]-l[i])
      l[i] = l[i-1]

print(sum(m))
  


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(1,n+1):
  if l[i-1]>l[i]:
     m.append(l[i-1]-l[i])
    l[i-1],l[i] = l[i],l[i-1]

print(sum(m))
  


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(1,n+1):
  if l[i-1]>l[i]:
     m.append(l[i-1]-l[i])
    l[i] = l[i-1]

print(sum(m))
  


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
    l[i+1] = l[i]

print(sum(m))
  


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
  if l[i]>l[i+1]:
    ans = ans + l[i]-l[i+1]
    l[i+1] = l[i]

print(ans)
  

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))
Buggy python submission (verdict: Runtime Error):
n = int(input())

l = list(map(int,input().split()))

l.sort()

if n < 3:
  print(0)

else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] is not l[j] and l[j] is not l[k] and l[k] is not l[i]:
          ans += 1
  print(ans)

Fixed submission:
n = int(input())

l = list(map(int,input().split()))

l.sort()
ans = 0

if n < 2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] < l[j] < l[k]:
          ans += 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

l = list(map(int,input().split()))

s = l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if s[i] + s[j] > s[k] and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          ans += 1
  print(ans)

Fixed submission:
n = int(input())

l = list(map(int,input().split()))

l.sort()
ans = 0

if n < 2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] < l[j] < l[k]:
          ans += 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

l = list(map(int,input().split()))

l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k]　and l[j] + l[k] > l[i]　and l[k] + l[i] > l[j]:
          ans += 1
  print(ans)

Fixed submission:
n = int(input())

l = list(map(int,input().split()))

l.sort()
ans = 0

if n < 2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] < l[j] < l[k]:
          ans += 1
  print(ans)
Buggy python submission (verdict: Runtime Error):
if X => 30:
  print('Yes')
else:
  print('No')

Fixed submission:
X = input()
X = int(X)

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

Buggy python submission (verdict: Runtime Error):
if X <30:
  print("No")
else:
  print("Yes")

Fixed submission:
X = input()
X = int(X)

if X >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
cnt = 0

for i in range(1,n+1):
  for j in range(1,n+1):
    if i%j = 0:
      ans += 1
  if ans = 8:
    cnt += 1

print(cnt)
      


Fixed submission:
N=int(input())

result=0
for i in range(1,N+1):
    if i%2!=0:
        divisor=0
        for j in range(1,i+1):
            if i%j==0:
                divisor+=1
        if divisor==8:
            result+=1
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
cnt = 0

for i in range(1,n+1):
  for j in range(1,n+1):
    if i%j = 0:
      ans += 1
  if ans = 8:
      
    cnt += 1

print(cnt)
      


Fixed submission:
N=int(input())

result=0
for i in range(1,N+1):
    if i%2!=0:
        divisor=0
        for j in range(1,i+1):
            if i%j==0:
                divisor+=1
        if divisor==8:
            result+=1
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
cnt = 0

for i in range(1,n+1):
  for j in range(1,n+1):
    if i%j = 0:
      ans += 1
    if ans = 8:
      cnt += 1

print(cnt)
      

Fixed submission:
N=int(input())

result=0
for i in range(1,N+1):
    if i%2!=0:
        divisor=0
        for j in range(1,i+1):
            if i%j==0:
                divisor+=1
        if divisor==8:
            result+=1
print(result)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
s = [input() for _ in range(w)]
l = []
for i in range(1,h-1):
    for j in range(1,w-1):
        if s[i][j] == "#":
            if s[i+1][j] == "#" or s[i-1][j] == "#" or s[i][j+1] == "#" or s[i][j-1] == "#":
                l.append(0)
            else:
                l.append(1)

if sum(l) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
H,W = map(int,input().split())
S = ["."*(W+2)]+["."+input()+"." for h in range(H)]+["."*(W+2)]

for h in range(1,H+1):
  for w in range(1,W+1):
    if S[h][w]=="#" and S[h-1][w]=="." and S[h+1][w]=="." and S[h][w-1]=="." and S[h][w+1]==".":
      print("No")
      exit()
      
print("Yes")
Buggy python submission (verdict: Runtime Error):
n  = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = []
for i in range(n):
  ans.append(sum(a[0:i+1] + sum(b[i:n]))

print(max(ans))

Fixed submission:
n  = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = []
for i in range(n):
  ans.append(sum(a[0:i+1]) + sum(b[i:n]))


print(max(ans))
Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[4]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])

Fixed submission:
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[3]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])

Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[4]:
    print(0)
else:
    print(l[2]-l[1])

Fixed submission:
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[3]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])

Buggy python submission (verdict: Runtime Error):
l = list(map(int.input().split()))

l.sort()

print(l[2]-l[1])

Fixed submission:
l = list(map(int,input().split()))

if l[1] < l[2]:
    print(0)
elif l[0] > l[3]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
al = [int(input()) for _ in range(n)]

pos = 0
for i in range(N):
    pos = A[pos] - 1
    if (pos == 1):
        print(i+1)
        exit()
print(-1)


Fixed submission:
n = int(input())
al = [int(input()) for _ in range(n)]

pos = 0
for i in range(n):
    pos = al[pos] - 1
    if (pos == 1):
        print(i+1)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    #各行では連続した区間
    #行ごとに見ないと話が進まん，降りるタイミぐは各列高々3000こ，来るタイミングも同様
    
    mod=10**9+7
    R,C,K=MI()
    S=[[0]*(C+1) for _ in range(R+1)]

    
    for i in range(K):
        r,c,v=MI()
        S[r][c]=v
        
        
    dp=[[[0]*4 for _ in range(C+1)]for i in range(R+1)]
    # dp[i][j][k]はi行j列まで見てその行でk個以下
    
    for i in range(R+1):
        for j in range(C+1):
            for k in range(3):
                #S(i,j)からの移動を考える
                
                #右へ移動，-,拾わない，拾う
                if j+1<=C:
                    dp[i][j+1][k+1]=max(dp[i][j+1][k+1],dp[i][j][k+1],dp[i][j][k]+S[i][j+1])
                
                #下へ
                if i+1<=R:
                    temp=0
                    for kk in range(4):
                        temp=max(temp,dp[i][j][kk])
                    dp[i+1][j][0]=temp
                    dp[i+1][j][1]=temp+S[i+1][j]
                
    ans=0
    for k in range(4):
        ans=max(ans,dp[-1][-1][k])
        
    # for i in range(R+1):
    #     print(dp[i])
        
    print(ans)
                
        
    

main()


Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    #各行では連続した区間
    #行ごとに見ないと話が進まん，降りるタイミぐは各列高々3000こ，来るタイミングも同様
    
    mod=10**9+7
    R,C,K=MI()
    S=[[0]*(C+1) for _ in range(R+1)]

    
    for i in range(K):
        r,c,v=MI()
        S[r][c]=v
        
        
    dp1=[[0]*(C+1)for _ in range(R+1)]
    dp2=[[0]*(C+1)for _ in range(R+1)]
    dp3=[[0]*(C+1)for _ in range(R+1)]
    # dp[i][j][k]はi行j列まで見てその行でk個以下
    
    for i in range(R+1):
        for j in range(C+1):
            #S(i,j)からの移動を考える
            
            #右へ移動，-,拾わない，拾う
            if j+1<=C:
                dp1[i][j+1]=max(dp1[i][j+1],dp1[i][j],S[i][j+1])
                dp2[i][j+1]=max(dp2[i][j+1],dp2[i][j],dp1[i][j]+S[i][j+1])
                dp3[i][j+1]=max(dp3[i][j+1],dp3[i][j],dp2[i][j]+S[i][j+1])
            
            #下へ
            if i+1<=R:
                temp=max(dp1[i][j],dp2[i][j],dp3[i][j])
                dp1[i+1][j]=temp+S[i+1][j]
                
    ans=max(dp1[-1][-1],dp2[-1][-1],dp3[-1][-1])
        
    # for i in range(R+1):
    #     print(dp[i])
        
    print(ans)
                
        
    

main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    A=LI()
    
    ng=-1
    ok=10**9
    
    def f(x):
        temp=0
        for i in range(N):
            temp+=(A[i]-0.1)//x
        
        return temp<=K
    
    while ok-ng>1:
        med=(ok+ng)//2
        if f(med):
            ok=med
        else:
            ng=med
               
    print(ok)
    

main()


Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    A=LI()
    
    ng=0
    ok=10**9
    
    def f(x):
        temp=0#切る回数
        for i in range(N):
            temp+=(A[i]-0.1)//x
        
        return temp<=K
    
    while ok-ng>1:
        med=(ok+ng)//2
        if f(med):
            ok=med
        else:
            ng=med
               
    print(ok)
    

main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    ans=[0]*N
     
     
    for i in range(N):
        ans[A[i]-1]+=1
        
    for i in range(N):
        print(ans[i])

main()


Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    ans=[0]*N
     
     
    for i in range(N-1):
        ans[A[i]-1]+=1
        
    for i in range(N):
        print(ans[i])

main()
Buggy python submission (verdict: Time Limit Exceeded):


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=input()
    Q=I()
    dir=0#0で先頭
    
    for _ in range(Q):
        q=list(input().split())
        if q[0]=="1":
            dir+=1
            dir%=2
        else:
            dir2=dir
            if q[1]=="2":
                dir2+=1
                dir2%=2
            if dir2==0:
                S=q[2]+S
            else:
                S=S+q[2]
            
    ans=list(S)
    
    if dir==1:
        ans=ans[::-1]
        
    print(''.join(map(str, ans)))
        

main()


Fixed submission:


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
from collections import deque


def main():
    mod=10**9+7
    S=deque(input())
    Q=I()
    dir=0#0で手前につける
    
    for _ in range(Q):
        q=list(input().split())
        if q[0]=="1":
            dir+=1
            dir%=2
        else:
            dir2=dir
            if q[1]=="2":
                dir2+=1
                dir2%=2
            if dir2==0:
                S.appendleft(q[2])
            else:
                S.append(q[2])
            
    ans=list(S)
    
    if dir==1:
        ans=ans[::-1]
        
    print(''.join(map(str, ans)))
        

main()

Buggy python submission (verdict: Time Limit Exceeded):


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=input()
    Q=I()
    dir=0#0で先頭
    
    for _ in range(Q):
        q=list(input().split())
        if q[0]=="1":
            dir+=1
            dir%=2
        else:
            dir2=dir
            if q[1]=="2":
                dir2+=1
                dir2%=2
            if dir2==0:
                S=q[2]+S
            else:
                S=S+q[2]
            
    ans=list(S)
    
    if dir==1:
        ans=ans[::-1]
        
    print(''.join(map(str, ans)))
        

main()


Fixed submission:


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
from collections import deque


def main():
    mod=10**9+7
    S=deque(input())
    Q=I()
    dir=0#0で手前につける
    
    for _ in range(Q):
        q=list(input().split())
        if q[0]=="1":
            dir+=1
            dir%=2
        else:
            dir2=dir
            if q[1]=="2":
                dir2+=1
                dir2%=2
            if dir2==0:
                S.appendleft(q[2])
            else:
                S.append(q[2])
            
    ans=list(S)
    
    if dir==1:
        ans=ans[::-1]
        
    print(''.join(map(str, ans)))
        

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

S=input()
dig=len(S)
N=int(S)


ans=0

b=0#繰り上がり
for i in range(dig):
    a=N%10+b
    if a<=4:
        ans+=a
        b=0
    elif a>=6:
        ans+=(10-a)
        b=1
    else:#a==5
        if (N%100 - N%10)//10 >=5:
            b=1
        else:
            b=0
        ans+=5
 
    N=N//10

        

if b==1:
    ans+=1

    
print(ans)
    
    

Fixed submission:
import bisect

S=input()
dig=len(S)

ans=0

b=0#繰り上がり
for i in range(dig):
    a=int(S[dig-i-1])+b
    if a<=4:
        ans+=a
        b=0
    elif a>=6:
        ans+=(10-a)
        b=1
    else:#a==5
        if i==dig-1:
            ans+=5
            b=0
        else:
            if int(S[dig-i-2])>=5:
                b=1
            else:
                b=0
            ans+=5


        

if b==1:
    ans+=1

    
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[[] for _ in range(H)]

for i in range(H):
    S[i]=input()
    
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

n=H*W
inf=10**9

d = [[inf]*n for _ in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            if j+1<W:
                if S[i][j+1]==".":
                    d[i*H+j][i*H+j+1]=1
                    d[i*H+j+1][i*H+j]=1
            if i+1<H:
                if S[i+1][j]==".":
                    d[i*H+j][(i+1)*H+j]=1
                    d[(i+1)*H+j][i*H+j]=1
    
        
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
ans=0

warshall_floyd(d)

for i in range(n):
    for j in range(n):
        if d[i][j]>=ans and d[i][j]<=inf-10:
            ans=d[i][j]

print(ans)

Fixed submission:
H,W=map(int,input().split())
S=[[] for _ in range(H)]

for i in range(H):
    S[i]=input()
    
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

n=H*W
inf=10**9

d = [[inf]*n for _ in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            if j+1<W:
                if S[i][j+1]==".":
                    d[i*W+j][i*W+j+1]=1
                    d[i*W+j+1][i*W+j]=1
            if i+1<H:
                if S[i+1][j]==".":
                    d[i*W+j][(i+1)*W+j]=1
                    d[(i+1)*W+j][i*W+j]=1
    
        
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
ans=0

warshall_floyd(d)

for i in range(n):
    for j in range(n):
        if d[i][j]>=ans and d[i][j]<=inf-10:
            ans=d[i][j]

print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
a = list(map(int, input().split()))


lcm = a[0]
for i in range(1, N):
    g= fractions.gcd(lcm, a[i])
    lcm = lcm * a[i] // g
    

for i in range(N):
    if (a[i]//g)%2==0:
        lcm=0
        break
    



ans=0
l=lcm//2
if l:
    ans=(M//l)-(M//(l+l))
print(ans)

Fixed submission:
import fractions
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
a = list(map(int, input().split()))


lcm = a[0]
for i in range(1, N):
    g= fractions.gcd(lcm, a[i])
    lcm = lcm * a[i] // g


g=a[0]
for i in range(N):
    g=fractions.gcd(g,a[i])

for i in range(N):
    if (a[i]//g)%2==0:
        lcm=0
        break    
    
    
ans=0
l=lcm//2
if l:
    ans=(M//l)-(M//(l+l))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())

ans1=0
ans2=0
if k>=a:
    ans1=0
    if a+b=<k:
        ans2=0
    else:
        ans2=b-(k-a)
else:
    ans1=a-k
    ans2=b
print(ans1,ans2)

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

ans1=0
ans2=0
if k>=a:
    ans1=0
    if a+b<=k:
        ans2=0
    else:
        ans2=b-(k-a)
else:
    ans1=a-k
    ans2=b
print(ans1,ans2)