Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03450 (python)

Fixed submission:
N,M = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(M) ]

up = [ set([]) for i in range(N)]
dw = [ set([]) for i in range(N)]

for l,r,d in li:
  dw[l-1].add(r-1)
  up[r-1].add(l-1)

S = []
for n in range(N):
  if ( len(up[n])==0 ):
    S.append(n)
L = []
for i in range(N+M):

  if ( len(S)==0 ):
    break
  n = S.pop()
  L.append(n)
  for r in dw[n]:
    up[r].discard(n)
    if ( len(up[r]) == 0 ):
      S.append(r)
  dw[n]=set()

BREAK=False
if (sum([len(s) for s in up])>0):
    BREAK=True

dwl = [ set([]) for i in range(N)]
for l,r,d in li:
  dwl[l-1].add((r-1,d))

dis = [-1]*N

for n in L:
  if (BREAK):
    break
  if (dis[n]==-1):
    dis[n]=0
  for r,d in dwl[n]:
    if (dis[r]==-1):
        dis[r]=dis[n]+d
    else:
        if not (dis[r]==dis[n]+d):
            BREAK=True
            break
if (BREAK):
    print ("No")
else:
    print ("Yes")

Buggy submission (verdict: Runtime Error):
II.c=-1

N,M = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(M) ]

up = [ set([]) for i in range(N)]
dw = [ set([]) for i in range(N)]

for l,r,d in li:
  dw[l-1].add(r-1)
  up[r-1].add(l-1)

S = []
for n in range(N):
  if ( len(up[n])==0 ):
    S.append(n)
L = []
for i in range(N+M):

  if ( len(S)==0 ):
    break
  n = S.pop()
  L.append(n)
  for r in dw[n]:
    up[r].discard(n)
    if ( len(up[r]) == 0 ):
      S.append(r)
  dw[n]=set()

BREAK=False
if (sum([len(s) for s in up])>0):
    BREAK=True

dwl = [ set([]) for i in range(N)]
for l,r,d in li:
  dwl[l-1].add((r-1,d))

dis = [-1]*N

for n in L:
  if (BREAK):
    break
  if (dis[n]==-1):
    dis[n]=0
  for r,d in dwl[n]:
    if (dis[r]==-1):
        dis[r]=dis[n]+d
    else:
        if not (dis[r]==dis[n]+d):
            BREAK=True
            break
if (BREAK):
    print ("No")
else:
    print ("Yes")

Buggy submission (verdict: Runtime Error):
II.c=-1

N,M = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(M) ]

up = [ set([]) for i in range(N)]
dw = [ set([]) for i in range(N)]

for l,r,d in li:
  dw[l-1].add(r-1)
  up[r-1].add(l-1)

S = []
for n in range(N):
  if ( len(up[n])==0 ):
    S.append(n)
L = []
for i in range(N+M):

  if ( len(S)==0 ):
    break
  n = S.pop()
  L.append(n)
  for r in dw[n]:
    up[r].discard(n)
    if ( len(up[r]) == 0 ):
      S.append(r)
  dw[n]=set()

BREAK=False
if (sum([len(s) for s in up])>0):
    BREAK=True

dwl = [ set([]) for i in range(N)]
for l,r,d in li:
  dwl[l-1].add((r-1,d))

dis = [-1]*N

for n in L:
  if (BREAK):
    break
  if (dis[n]==-1):
    dis[n]=0
  for r,d in dwl[n]:
    if (dis[r]==-1):
        dis[r]=dis[n]+d
    else:
        if not (dis[r]==dis[n]+d):
            BREAK=True
            break
if (BREAK):
    print ("No")
else:
    print ("Yes")
Problem p03584 (python)

Fixed submission:
N,K = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(N) ]

kbit = []
k = K
for i in range(100000000):
  if (k == 0):
    break
  kbit.append( k%2 )
  k//=2
keta = len(kbit)

def chk(c):
  #print (c)
  s = 0
  for k,v in li:
    if ( (c^k)|c == c ):
      #print ( k,v,"ok" )
      s += v
  return s

ma = 0

if (K<100):
  for i in range(K+1):
  	ma = max(ma, chk(i))
else:
  ma = max(ma, chk( 0 ))
  ma = max(ma, chk( 1 ))
  ma = max(ma, chk( 2 ))
  ma = max(ma, chk( 3 ))
  ma = max(ma, chk( 4 ))
  ma = max(ma, chk( (1<<(keta-1))-1) )
  ma = max(ma, chk ( K ) )

  for i in range(keta):
    if ( kbit[keta-1-i] == 0 ):
      continue
    else:
      bit = [0]*(keta)
      for j in range(keta):
        if (i<j):
          bit[keta-1-j]=1
        elif (j<i):
          bit[keta-1-j]=kbit[keta-1-j]
        else:
          bit[keta-1-j]=0

      v = 0
      for j in range(keta):
        if (bit[j]==1):
          v += 2**(j)
      #print ( v , bit )
      ma = max(ma, chk ( v ) )
print ( ma )

Buggy submission (verdict: Runtime Error):
N,K = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(N) ]

kbit = []
k = K
for i in range(100000000):
  if (k == 0):
    break
  kbit.append( k%2 )
  k//=2
keta = len(kbit)

def chk(c):
  #print (c)
  s = 0
  for k,v in li:
    if ( (c^k)|c == c ):
      #print ( k,v,"ok" )
      s += v
  return s

ma = 0
ma = max(ma, chk( (1<<(keta-1))-1) )
ma = max(ma, chk ( K ) )

for i in range(keta):
  if ( kbit[keta-1-i] == 0 ):
    continue
  else:
    bit = [0]*(keta)
    for j in range(keta):
      if (i<j):
        bit[keta-1-j]=1
      elif (j<i):
        bit[keta-1-j]=kbit[keta-1-j]
      else:
        bit[keta-1-j]=0
    
    v = 0
    for j in range(keta):
      if (bit[j]==1):
        v += 2**(j)
    #print ( v , bit )
    ma = max(ma, chk ( v ) )
print ( ma )
Problem p03674 (python)

Fixed submission:
N = int(input())
li =  [ int(it) -1 for it in input().split() ] 

import sys
sys.setrecursionlimit(10000000)

from functools import lru_cache
MOD = 1000000007
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
@lru_cache(maxsize=None)
def modinv(a):
    (inv, q, gcd_val) = egcd(a, MOD)
    return inv % MOD

fac_li = [0]*( 1000009 )
if True:
  s = 1
  for i in range(1,1000001):
    s = (s*i)%MOD
    fac_li[i] = s
def factorial(k):
  if (k<=1):
    return 1
  return fac_li[k]
@lru_cache(maxsize=None)
def combination(n,m):
  return (factorial(n)*modinv(factorial(m))*modinv(factorial(n-m)))%MOD

#print ( factorial(5),factorial(3) )
#print ( combination(5,3) )

import collections as col
c = col.Counter( li ).items()
a = [ it for it in c if it[1] == 2][0][0]
p1 = li.index(a)
p2 = li[p1+1:].index(a) + 1 + p1
#print ( p1 , p2 )
H = p1 + (N-p2)
#print ( H )

li=[]
for i in range(1,N+2):
  a =  (combination(N+1,i) - (combination(H,i-1)if (i-1)<=H else 0))%MOD
  li.append(a)
print ( "\n".join( map(str,li) ) )

Buggy submission (verdict: Runtime Error):
N = int(input())
li =  [ int(it) -1 for it in input().split() ] 

from functools import lru_cache
MOD = 1000000007
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
@lru_cache(maxsize=None)
def modinv(a):
    (inv, q, gcd_val) = egcd(a, MOD)
    return inv % MOD
@lru_cache(maxsize=None)
def factorial(k):
  if (k<=1):
    return 1
  return (factorial(k-1)*k)%MOD
@lru_cache(maxsize=None)
def combination(n,m):
  return (factorial(n)*modinv(factorial(m))*modinv(factorial(n-m)))%MOD

#print ( factorial(5),factorial(3) )
#print ( combination(5,3) )

import collections as col
c = col.Counter( li ).items()
a = [ it for it in c if it[1] == 2][0][0]
p1 = li.index(a)
p2 = li[p1+1:].index(a) + 1 + p1
#print ( p1 , p2 )
H = p1 + (N-p2)
#print ( H )

li=[]
for i in range(1,N+2):
  a =  (combination(N+1,i) - (combination(H,i-1)if (i-1)<=H else 0))%MOD
  li.append(a)
print ( "\n".join( map(str,li) ) )
Problem p03722 (python)

Fixed submission:
N,M = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(M) ]
li = [ (a-1,b-1,c) for a,b,c in li ]

dw = [ [] for i in range(N) ]


for a,b,c in li:
  dw[a].append( (b,c) )

NOT = 1e+16 -1 
  
cost = [NOT]*N
cost[0]=0
cosli = []
for i in range(1000):
  chk = [0]*N
  now = 0
  pop=[now]
  for i in range(N):
    if (len(pop)==0):
      break
    now = pop.pop()
    chk[now]=1
    for b,c in dw[now]:
      if ( cost[b] == NOT ):
        cost[b] = cost[now] + c
      else:
        cost[b] = max(cost[now] + c,cost[b])
      if (chk[b]==0):
        pop.append(b)
  cosli.append( cost[N-1] )  

if ( cosli[-1] != cosli[-2] ):
  print ("inf")
else:
  print (cosli[-1])

Buggy submission (verdict: Runtime Error):
N,M = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(M) ]
li = [ (a-1,b-1,c) for a,b,c in li ]

dw = [ [] for i in range(N) ]


for a,b,c in li:
  dw[a].append( (b,c) )

NOT = 1e+10 -1 
  
cost = [NOT]*N
cost[0]=0
cosli = []
for i in range(1000):
  chk = [0]*N
  now = 0
  pop=[now]
  for i in range(N):
    now = pop.pop()
    chk[now]=1
    for b,c in dw[now]:
      if ( cost[b] == NOT ):
        cost[b] = cost[now] + c
      else:
        cost[b] = max(cost[now] + c,cost[b])
      if (chk[b]==0):
        pop.append(b)
  cosli.append( cost[N-1] )  

if ( cosli[-1] != cosli[-2] ):
  print ("inf")
else:
  print (cosli[-1])
Problem p03959 (python)

Fixed submission:
MOD = 1000000007
n = int(input())
tli = [ int(it) for it in input().split() ]
ali = [ int(it) for it in input().split() ]
#print (tli,ali)

mav1 = max(tli)
mav2 = max(ali)
mav = mav1
#print (mav1,mav2)
if (mav1!=mav2):
  print (0)
else:
  mai1 = tli.index(mav)
  mai2 = n-1-list(reversed(ali)).index(mav)
  #print (mai1,mai2)
  if (mai2<mai1):
    print (0)
  else:
    s = 1
    tma = -1
    for i in range(0,mai1+1):
      if tli[i]>tma:
        tma = tli[i]
        #print ("lt",tma)
      else:
        s*=(tli[i])
        s%=MOD
        #print ("l")
    tma = -1
    for i in range(n-1,mai2-1,-1):
      if ali[i]>tma:
        tma = ali[i]
        #print ("rt",tma)
      else:
        s*=(ali[i])
        s%=MOD
        #print ("r")
    if (mai2-mai1>1):
      for i in range(mai2-mai1-1):
        s*=mav
        s%=MOD
    print ( s%(1000000007) )

Buggy submission (verdict: Runtime Error):
n = int(input())
tli = [ int(it) for it in input().split() ]
ali = [ int(it) for it in input().split() ]
#print (tli,ali)

mav1 = max(tli)
mav2 = max(ali)
mav = mav1
#print (mav1,mav2)
if (mav1!=mav2):
  print (0)
else:
  mai1 = tli.index(mav)
  mai2 = n-1-list(reversed(ali)).index(mav)
  #print (mai1,mai2)
  if (mai2<mai1):
    print (0)
  else:
    s = 1
    tma = -1
    for i in range(0,mai1+1):
      if tli[i]>tma:
        tma = tli[i]
        #print ("lt",tma)
      else:
        s*=(tli[i])
        #print ("l")
    tma = -1
    for i in range(n-1,mai2-1,-1):
      if ali[i]>tma:
        tma = ali[i]
        #print ("rt",tma)
      else:
        s*=(ali[i])
        #print ("r")
    if (mai2-mai1>1):
      for i in range(mai2-mai1-1):
        s*=mav
  #print ( s )
  print ( s%(1000000007) )
Problem p04015 (python)

Fixed submission:
import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = [int(it) for it in input().split()]
li = [int(it) for it in input().split()]
for i in li:
    hi_ = hi.copy()
    hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
  s+=hi[(i+1)*a,i+1]
print (s)

Buggy submission (verdict: Runtime Error):
import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = [int(it) for it in input().split()]
li = [int(it) for it in input().split()]
for i in li:
  　hi_ = hi.copy()
    hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
  s+=hi[(i+1)*a,i+1]
print (s)

Buggy submission (verdict: Runtime Error):
import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = [int(it) for it in input().split()]
li = [int(it) for it in input().split()]
for i in li:
  　hi_ = hi.copy()
    hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
  s+=hi[(i+1)*a,i+1]
print (s)
Problem p03006 (python)

Fixed submission:
"""
map(int,input().split())

X = input().split()
x = []
for i in range(0,len(X)):
    x.append(X[i])

"""

def search(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

N = int(input())



ball = []

for n in range(N):
    x,y = map(int,input().split(" "))
    ball.append((x,y))

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

#最適p,q計算
pqList = []
pqCount = []
for i in range(0,N):
    for j in range(0,N):
        if i != j:
           i_x = ball[i][0]
           i_y = ball[i][1]
           j_x = ball[j][0]
           j_y = ball[j][1]
           s = search(pqList,(i_x-j_x,i_y-j_y))
           if s != -1 :
               pqCount[s] += 1
           else:
               pqList.append((i_x-j_x,i_y-j_y))
               pqCount.append(1)

print(int(N - (max(pqCount))))

Buggy submission (verdict: Runtime Error):
"""
map(int,input().split())

X = input().split()
x = []
for i in range(0,len(X)):
    x.append(X[i])

"""
def search(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

N = int(input())

ball = []

for n in range(N):
    x,y = map(int,input().split(" "))
    ball.append((x,y))

#最適p,q計算
pqList = []
pqCount = []
for i in range(0,N):
    for j in range(0,N):
        if i != j:
           i_x = ball[i][0]
           i_y = ball[i][1]
           j_x = ball[j][0]
           j_y = ball[j][1]
           s = search(pqList,(i_x-j_x,i_y-j_y))
           if s != -1 :
               pqCount[s] += 1
           else:
               pqList.append((i_x-j_x,i_y-j_y))
               pqCount.append(1)

print(int(N - (max(pqCount))))

Buggy submission (verdict: Runtime Error):
"""
map(int,input().split())

X = input().split()
x = []
for i in range(0,len(X)):
    x.append(X[i])

"""
def search(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

N = int(input())

ball = []

for n in range(N):
    x,y = map(int,input().split(" "))
    ball.append((x,y))

#最適p,q計算
pqList = []
pqCount = []
for i in range(0,N):
    for j in range(0,N):
        if i != j:
           i_x = ball[i][0]
           i_y = ball[i][1]
           j_x = ball[j][0]
           j_y = ball[j][1]
           s = search(pqList,(abs(i_x-j_x),abs(i_y-j_y)))
           if s != -1 :
               pqCount[s] += 1
           else:
               pqList.append((abs(i_x-j_x),abs(i_y-j_y)))
               pqCount.append(1)

print(int(N - (max(pqCount)/2)))
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())

als = []
bls = []

for a in range(1,A+1):
  if A%a == 0:
    als.append(a)
for b in range(1,B+1):
  if B%b == 0:
    bls.append(b)

common = []

for a in als:
  if a in bls:
    common.append(a)

common.sort()
print(common[-K])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())

als = []
bls = []

for a in range(1,A):
  if A%a == 0:
    als.append(a)
for b in range(1,B):
  if B%b == 0:
    bls.append(b)

common = []

for a in range(0,len(als)):
  if a in bls:
    common.append(a)

common.sort()
print(common[K-1])
Problem p03109 (python)

Fixed submission:
S = input().split("/")


if int(S[0])>= 2020:
  print("TBD")
elif int(S[0]) == 2019:
  if int(S[1]) >=5:
    print("TBD")
  else:
    print("Heisei")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
S = input().split("/")

if S[0]>= 2020:
  print("TBD")
elif S[0] == 2019:
  if S[1] >5:
    print("TBD")
  else:
    print("Heisei")
else:
  print("Heisei")
Problem p03136 (python)

Fixed submission:
N = int(input())
Lin = input().split(" ")

Lls = []

for i in range(0,N):
    Lls.append(int(Lin[i]))

Lls.sort(reverse = True)

maxSide = Lls[0]
otherSide = 0
for i in range(1,N):
    otherSide = otherSide + Lls[i]

if maxSide < otherSide:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
Lin = input().split(" ")

Lls = []

for i in range(0,N):
    Lls.append(Lin[i])

Lls.sort(reverse = True)

maxSide = Lls[0]
otherSide = 0
for i in range(1,N):
    otherSide = otherSide + Lls[i]

if maxSide < otherSide:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
Lin = input().split(" ")

Lls = []

for i in range(0,N):
    Lls.append(Lin[i])

Lls.sort(reverse = True)

maxSide = Lls[0]
otherSide = 0
for i in range(1,N):
    otherSide = otherSide + Lls[i]

if maxSide < otherSide:
    print("Yes")
other:
    print("No")
Problem p03206 (python)

Fixed submission:
#A問題を2回間違えた灰コーダー

D = int(input())
 
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
D = int(input())
 
if D == 25:
  print(Christmas)
else if D == 24:
  print(Christmas Eve)
else if D == 23:
  print(Christmas Eve Eve)
else if D == 22:
  print(Christmas Eve Eve Eve)

Buggy submission (verdict: Runtime Error):
D = int(input())

if D == 25:
  print(Christmas)
elif D == 24:
  print(Christmas Eve)
elif D == 23:
  print(Christmas Eve Eve)
elif D == 22:
  print(Christmas Eve Eve Eve)
Problem p03262 (python)

Fixed submission:
import math

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


N,X = map(int,input().split())
x = input().split()
xls = []
 
for n in range(0,N):
    xls.append(int(x[n]))
 
xls.append(X)
xls.sort(reverse = True)
 
tousa = []
 
for n in range(0,N):
    tousa.append(xls[n]-xls[n+1])
 
if len(tousa) == 1:
    print(tousa[0])
    exit()
gcdd = gcd(tousa[0],tousa[1])
 
for n in range(0,N):
    gcdd = gcd(gcdd,tousa[n])
    
print(gcdd)

Buggy submission (verdict: Runtime Error):
import math

N,X = map(int,input().split())
x = input().split()
xls = []

for n in range(0,N):
    xls.append(int(x[n]))

xls.append(X)
xls.sort(reverse = True)

tousa = []

for n in range(0,N):
    tousa.append(xls[n]-xls[n+1])

if len(tousa) == 1:
    print(tousa[0])
    exit()
gcd = math.gcd(tousa[0],tousa[1])

for n in range(0,N):
    gcd = math.gcd(gcd,tousa[n])
    
print(gcd)
Problem p03611 (python)

Fixed submission:
N = int(input())

tmp = input().split(" ")

als = [0]*(10**5 + 10)

for n in tmp:
    nowNum = int(n)
    als[nowNum - 1] += 1
    als[nowNum] += 1
    als[nowNum + 1] += 1


    
print(max(als))

Buggy submission (verdict: Runtime Error):
N = int(input())

tmp = input().split(" ")

als = [0]*(10**5)

for n in tmp:
    nowNum = int(n)
    als[nowNum - 1] += 1
    als[nowNum] += 1
    als[nowNum + 1] += 1


    
print(max(als))
Problem p03029 (python)

Fixed submission:
li = list(map(int, input().split()))
print(int((li[0]*3+li[1])/2))

Buggy submission (verdict: Runtime Error):
li = list(int(input()))
print(int((li[0]*3+li[1])/2))
Problem p03059 (python)

Fixed submission:
a,b,t=list(map(int, list(input().split())))
print(int(t/a)*b)

Buggy submission (verdict: Runtime Error):
a,b,t=list(map(int, list(input().split())))
return int(t/a)*b
Problem p02995 (python)

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

s1 = (a-1) // c
s2 = (a-1) // d
s3 = (a-1) // (c*d//math.gcd(c,d))
S = (a-1) - (s1 + s2 -s3)

l1 = b // c
l2 = b // d
l3 = b // (c*d//math.gcd(c,d))
L = b - (l1 + l2 - l3)

print(L-S)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
N = list(range(a, b+1, 1))
t = 0
for n in N:
  if n % c != 0 and n % d != 0:
    t += 1
print(t)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
N = list(range(a, b+1, 1))
t = 0
for n in N:
  if n % c == 0 and n % d == 0:
    t += 1
print(t)
Problem p03145 (python)

Fixed submission:
k = input().split()
a = k[0]
b = k[1]
c = k[2]
for i in range(len(k)):
    k[i] = int(k[i])
h = max(k)

Buf = 1
del k[k.index(h)]

for i in k:
    Buf = Buf * int(i)
r = Buf/2
print(int(r))

Buggy submission (verdict: Runtime Error):
k = input().split()
a = k[0]
b = k[1]
c = k[2]
Sum = 0
h = max(k)

Buf = 1
del k[k.index[h]]

for i in k:
    buf = Buf*i

print(int(buf/2))
Problem p03605 (python)

Fixed submission:
a=input()
if a/10==9 or a%10==9:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
a=""
a=raw_input()
ans=0
for i in range(len(a)-1):
	if a[i]=='9':
		ans=1
if ans==1:
	print 'Yes'
if ans==0:
	print 'No'

Buggy submission (verdict: Runtime Error):
a=""
a=input()
ans=0
for i in range(len(a)):
	if a[i]=='9':
		ans=1
if ans==1:
	print 'Yes'
if ans==0:
	print 'No'
Problem p02995 (python)

Fixed submission:
import fractions

entrada = list(map(int,input().split(" ")))

rangoMenor = entrada[0]
rangoMayor = entrada[1]
divisor1 = entrada[2]
divisor2= entrada[3]

multiplo = divisor2*divisor1// fractions.gcd(divisor1,divisor2)
cantidad = rangoMayor-rangoMenor
repetidos = rangoMayor//multiplo - rangoMenor//multiplo

if rangoMenor%divisor1==0:
	divisibles1 = rangoMayor//divisor1 +1 - rangoMenor//divisor1
else:
	divisibles1 = rangoMayor // divisor1 - rangoMenor//divisor1

divisibles2 = rangoMayor//divisor2 - rangoMenor//divisor2

resultado = cantidad -(divisibles1+divisibles2) +repetidos + 1
print(resultado)

Buggy submission (verdict: Runtime Error):
import math

entrada = list(map(int,input().split(" ")))

rangoMenor = entrada[0]
rangoMayor = entrada[1]
divisor1 = entrada[2]
divisor2= entrada[3]


multiplo = divisor2*divisor1// math.gcd(divisor1,divisor2)
cantidad = rangoMayor-rangoMenor
repetidos = rangoMayor//multiplo - rangoMenor//multiplo

if rangoMenor%divisor1==0:
	divisibles1 = rangoMayor//divisor1 +1 - rangoMenor//divisor1
else:
	divisibles1 = rangoMayor // divisor1 - rangoMenor//divisor1

divisibles2 = rangoMayor//divisor2 - rangoMenor//divisor2

resultado = cantidad -(divisibles1+divisibles2) +repetidos + 1
print(resultado)
Problem p03061 (python)

Fixed submission:
import sys

def gcd(a, b):
    b, a = sorted([a, b])
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)

def get_cum_gcd(N, As):
    cum_gcd = [0] * N
    for i, n in enumerate(As):
        if i == 0:
            cum_gcd[i] = n
        else:
            cum_gcd[i] = gcd(cum_gcd[i-1], n)
    return cum_gcd

def get_cav_gcds(N, cum_l, cum_r):
    cav_gcds = [0] * N
    for i in range(N):
        if i == 0:
            cav_gcds[i] = cum_r[i+1]
        elif i == N-1:
            cav_gcds[i] = cum_l[i-1]
        else:
            cav_gcds[i] = gcd(cum_l[i-1], cum_r[i+1])
    return cav_gcds

def main():
    input = sys.stdin.readline
    N = int(input())
    As = list(map(int, input().split()))
    cum_l = get_cum_gcd(N, As)
    cum_r = list(reversed(get_cum_gcd(N, reversed(As))))
    cav_gcds = get_cav_gcds(N, cum_l, cum_r)
    print(max(cav_gcds))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

def get_cum_gcd(N, As):
    cum_gcd = [0] * N
    for i, n in enumerate(As):
        if i == 0:
            cum_gcd[i] = n
        else:
            cum_gcd[i] = np.gcd(cum_gcd[i-1], n)
    return cum_gcd

def get_cav_gcds(N, cum_l, cum_r):
    cav_gcds = [0] * N
    for i in range(N):
        if i == 0:
            cav_gcds[i] = cum_r[i+1]
        elif i == N-1:
            cav_gcds[i] = cum_l[i-1]
        else:
            cav_gcds[i] = np.gcd(cum_l[i-1], cum_r[i+1])
    return cav_gcds

def main():
    input = sys.stdin.readline
    N = int(input())
    As = list(map(int, input().split()))
    cum_l = get_cum_gcd(N, As)
    cum_r = list(reversed(get_cum_gcd(N, reversed(As))))
    cav_gcds = get_cav_gcds(N, cum_l, cum_r)
    print(max(cav_gcds))

if __name__ == '__main__':
    main()
Problem p03400 (python)

Fixed submission:
n = int(input())
day, x = map(int, input().split())
a = [int(input()) for _ in range(n)]


def choco(cday):
    sum = 0
    for i in range(day):
        if cday * i + 1 <= day:
           sum += 1
    return sum


csum = sum(list(map(choco, a))) + x
print(csum)

Buggy submission (verdict: Runtime Error):
from typing import List

n = int(input())
day, x = map(int, input().split())
a = [int(input()) for _ in range(n)]
def choco(cday):
    sum = 0
    for i in range(day):
        if cday * i + 1 <= day:
           sum += 1
    return sum
csum = sum(list(map(choco, a))) + x
print(csum)