Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    n,m = LI()
    e = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        e[a-1].add(b-1)
        e[b-1].add(a-1)
    r = [0] * n

    qq = I()
    for _ in range(qq):
        v,d,c = LI()
        v -= 1
        r[v] = c
        f = [False] * n
        f[v] = True
        q = [v]
        for __ in range(d):
            t = []
            for p in q:
                for vv in e[p]:
                    if f[vv]:
                        continue
                    f[vv] = True
                    t.append(vv)
                    r[vv] = c
            q = t

    return '\n'.join(map(str, r))



print(main())


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    n,m = LI()
    e = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        e[a-1].add(b-1)
        e[b-1].add(a-1)
    r = [0] * n

    q = I()
    qq = sorted([[_] + LI() for _ in range(q)], reverse=True)
    f = [-1] * n
    for _,v,d,c in qq:
        v -= 1
        if f[v] >= d:
            continue
        if r[v] == 0:
            r[v] = c
        q = [v]
        for nd in range(d-1,-1,-1):
            t = []
            for p in q:
                for vv in e[p]:
                    if f[vv] >= nd:
                        continue
                    f[vv] = nd
                    t.append(vv)
                    if r[vv] == 0:
                        r[vv] = c
            q = t

    return '\n'.join(map(str, r))



print(main())
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,m = LI()
    r = 0
    d = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        d[a].add(b)
        d[b].add(a)
    for a in itertools.permutations(range(2,n+1)):
        if a[0] not in d[1]:
            continue
        f = True
        for i in range(m-2):
            if a[i] not in d[a[i+1]]:
                f = False
                break
        if f:
            r += 1

    return r


print(main())


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,m = LI()
    r = 0
    d = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        d[a].add(b)
        d[b].add(a)
    for a in itertools.permutations(range(2,n+1)):
        if a[0] not in d[1]:
            continue
        f = True
        for i in range(len(a)-1):
            if a[i] not in d[a[i+1]]:
                f = False
                break
        if f:
            r += 1

    return r


print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def bs(f, mi, ma):
    mm = -1
    while ma > mi + eps:
        mm = (ma+mi) / 2.0
        if f(mm):
            mi = mm + eps
        else:
            ma = mm
    if f(mm):
        return mm + eps
    return mm

def main():
    xy = sorted([LI() for _ in range(3)])
    x = list(map(lambda _: _[0] - xy[0][0], xy))
    y = list(map(lambda _: _[1] - xy[0][1], xy))
    a = []
    for i in range(3):
        a.append(((x[i] - x[i-1])**2 + (y[i] - y[i-1])**2) ** 0.5)
    ma = max(a)
    s = abs(x[1]*y[2] - x[2]*y[1]) / 2
    r = 2 * s / sum(a)

    def f(i):
        return (1-i/r) * ma - 2*i > 0


    return bs(f, 0, ma)




print(main())



Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def bs(f, mi, ma):
    mm = -1
    while ma > mi + eps:
        mm = (ma+mi) / 2.0
        if f(mm):
            mi = mm + eps
        else:
            ma = mm
    if f(mm):
        return mm + eps
    return mm

def main():
    xy = sorted([LI() for _ in range(3)])
    x = list(map(lambda _: _[0] - xy[0][0], xy))
    y = list(map(lambda _: _[1] - xy[0][1], xy))
    a = []
    for i in range(3):
        a.append(((x[i] - x[i-1])**2 + (y[i] - y[i-1])**2) ** 0.5)
    ma = max(a)
    s = abs(x[1]*y[2] - x[2]*y[1]) / 2
    r = 2 * s / sum(a)

    def f(i):
        return (1-i/r) * ma - 2*i > 0


    return bs(f, 0, ma)




print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = sorted([I() for _ in range(n)])
    d = collections.defaultdict(lambda: inf)
    x = 0
    for c in a:
        x ^= c
    d[x] = 0
    for c in a:
        c1 = c ^ (c-1)
        e = {}
        for k,v in list(d.items()):
            if d[k^c1] > v + 1:
                e[k^c1] = v + 1
        for k,v in e.items():
            d[k] = v

    if d[0] == inf:
        return -1

    return d[0]




print(main())



Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = sorted([I() for _ in range(n)])
    x = 0
    for c in a:
        x ^= c
    s = set()
    for c in a:
        s.add(c ^ (c-1))

    r = 0
    for c in sorted(s, reverse=True):
        cb = bin(c)
        xb = bin(x)
        if len(cb) == len(xb) and x > 0:
            x ^= c
            r += 1

    if x != 0:
        return -1

    return r




print(main())
Buggy python submission (verdict: Runtime Error):
N = input()
l = input().split()

N=int(N)
a=range(1,N+1)
b=range(1,N+1)
a=[i*N for i in a]
b=[i*N for i in b]
b.reverse()

c=0
for i in l:
    i=int(i)
    b[i-1]+=c
    c+=1

for i in a:
    print(i,end=" ")
print("")
for i in b:
    print(i,end=" ")


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    h,w = list(map(int, input().split()))
    a = [input() for _ in range(h)]
    c = 0
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                c += 1
    if c == h + w -1:
        return 'Possible'
    return 'Impossible'


print(f())
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ra = []
for i in xrange(n):
    ra.append((i+1)*30000)
rb = []
for i in xrange(n):
    rb.append((n-i)*30000+a[i])

for i in ra:
    print(i,end=" ")
print("")
for i in rb:
    print(i,end=" ")


Fixed submission:
N = input()
l = input().split()

N=int(N)
a=range(1,N+1)
b=range(1,N+1)
a=[i*N for i in a]
b=[i*N for i in b]
b.reverse()

c=0
for i in l:
    i=int(i)
    b[i-1]+=c
    c+=1

for i in a:
    print(i,end=" ")
print("")
for i in b:
    print(i,end=" ")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ra = []
for i in xrange(n):
    ra.append((i+1)*30000)
rb = []
for i in xrange(n):
    rb.append((n-i)*30000+a[i])
print ' '.join(map(str,ra))
print ' '.join(map(str,rb))


Fixed submission:
N = input()
l = input().split()

N=int(N)
a=range(1,N+1)
b=range(1,N+1)
a=[i*N for i in a]
b=[i*N for i in b]
b.reverse()

c=0
for i in l:
    i=int(i)
    b[i-1]+=c
    c+=1

for i in a:
    print(i,end=" ")
print("")
for i in b:
    print(i,end=" ")
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    r = 0

    if a[-1] > t[-1] or a[0] < t[0]:
        return 0

    for i in range(1,n):
        if m > a[i]:
            m = a[i]
        if (t[i-1] < t[i] and t[i] > m) or t[i] < t[i-1]:
            return 0
    for i in range(n-2,-1,-1):
        if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
            return 0

    r = 1
    for i in range(1,n-1):
        if t[i] != t[i-1] or a[i] != a[i+1]:
            continue
        if t[i] < a[i]:
            r = r * t[i] % mod
        else:
            r = r * a[i] % mod

    return r


print(f())


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    r = 0

    if a[-1] > t[-1] or a[0] < t[0]:
        return 0

    for i in range(1,n):
        if (t[i-1] < t[i] and t[i] > a[i]) or t[i] < t[i-1]:
            return 0

    for i in range(n-2,-1,-1):
        if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
            return 0

    r = 1
    for i in range(1,n-1):
        if t[i] != t[i-1] or a[i] != a[i+1]:
            continue
        if t[i] < a[i]:
            r = r * t[i] % mod
        else:
            r = r * a[i] % mod

    return r


print(f())
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 && b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0:
        return 'Negative'
    return 'Positive'

print(f())


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 and b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0:
        return 'Negative'
    return 'Positive'

print(f())

Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 && b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0
        return 'Negative'
    return 'Positive'

print(f())


Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 and b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0:
        return 'Negative'
    return 'Positive'

print(f())
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from collections import Counter
slope=Counter()
slope_zero=0
slope_inf=0
both_zero=0
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    if a==0 and b==0:
        both_zero+=1
    else:
        if a==0:
            slope_zero+=1
        elif b==0:
            slope_inf+=1
        else:
            sign=(a//abs(a))*(b//abs(b))
            a=abs(a)
            b=abs(b)
            gc=gcd(a,b)
            a//=gc
            b//=gc
            if sign==1:
                slope[(a,b)]+=1
            else:
                slope[(-a,b)]+=1
ans=1
mod=10**9+7
for a,b in slope.keys():
    if slope[(a,b)]>0:
        aa=-b
        bb=a
        if bb<0:
            bb*=-1
            aa*=-1
        if slope[(aa,bb)]>0:
            ans*=(pow(2,slope[(a,b)],mod)+pow(2,slope[(aa,bb)],mod)-1+mod)%mod
            ans%=mod
            slope[(aa,bb)]=0
        else:
            ans*=(pow(2,slope[(a,b)],mod))%mod
            ans%=mod
ans*=(pow(2,slope_zero,mod)+pow(2,slope_inf,mod)-1+mod)%mod
ans%=mod
ans+=both_zero
if ans>=mod:
    ans%=mod
print((ans-1+mod)%mod)




Fixed submission:
from fractions import gcd
from collections import Counter
slope=Counter()
slope_zero=0
slope_inf=0
both_zero=0
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    if a==0 and b==0:
        both_zero+=1
    else:
        if a==0:
            slope_zero+=1
        elif b==0:
            slope_inf+=1
        else:
            sign=(a//abs(a))*(b//abs(b))
            a=abs(a)
            b=abs(b)
            gc=gcd(a,b)
            a//=gc
            b//=gc
            if sign==1:
                slope[(a,b)]+=1
            else:
                slope[(-a,b)]+=1
ans=1
mod=10**9+7
for a,b in slope.keys():
    if slope[(a,b)]>0:
        aa=-b
        bb=a
        if bb<0:
            bb*=-1
            aa*=-1
        if slope[(aa,bb)]>0:
            ans*=(pow(2,slope[(a,b)],mod)+pow(2,slope[(aa,bb)],mod)-1+mod)%mod
            ans%=mod
            slope[(aa,bb)]=0
        else:
            ans*=(pow(2,slope[(a,b)],mod))%mod
            ans%=mod
ans*=(pow(2,slope_zero,mod)+pow(2,slope_inf,mod)-1+mod)%mod
ans%=mod
ans+=both_zero
if ans>=mod:
    ans%=mod
print((ans-1+mod)%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=[[0 for j in range(60)] for i in range(n)]
for i in range(len(a)):
    a[i]-=1
    f[i][0]=a[i]
#do binary lifting 
for j in range(1,60):
    for i in range(n):
        f[i][j]=f[f[i][j-1]][j-1]
ans=0
for j in range(59,-1,-1):
    if 1<<j<=k:
        ans=f[ans][j]
        k-=1<<j
print(ans+1)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=[[0 for j in range(60)] for i in range(n)]
for i in range(len(a)):
    a[i]-=1
    f[i][0]=a[i]
#do binary lifting 
for j in range(1,60):
    for i in range(n):
        f[i][j]=f[f[i][j-1]][j-1]
ans=0
for j in range(59,-1,-1):
    if 1<<j<=k:
        ans=f[ans][j]
        k-=1<<j
print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
from fractions import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)



Fixed submission:
k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
from fractions import gcd
import functools 
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            @functools.lru_cache(None) 
            def gc(x,y):
                if x>y:
                    x,y=y,x
                return gcd(x,y)

            ans+=gcd(a,gcd(b,c))
print(ans)



Fixed submission:
k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
from fractions import gcd
import functools 
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            @functools.lru_cache(None) 
            def gc(x,y):
                if x>y:
                    x,y=y,x
                return gcd(x,y)

            ans+=gcd(a,gcd(b,c))
print(ans)



Fixed submission:
k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
from fractions import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
#            print(a,b,c)
            ans+=gcd(a,gcd(b,c))
print(ans)



Fixed submission:
k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
from fractions import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
#            print(a,b,c)
            ans+=gcd(a,gcd(b,c))
print(ans)



Fixed submission:
k=int(input())
ans=0
from math import gcd
for a in range(1,k+1):
    for b in range(1,k+1):
        t=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(c,t)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
cur=1
ans=[]
while len(ans)<k:
    num=str(cur)
    n=len(num)
    flag=True
    pos=-1
  #  print(num,end=' num\n')
    for i in range(n-1):
        if abs(int(num[i])-int(num[i+1]))>1:
            pos=i+1
            flag=False
            break
 #   print(flag)
    if flag==True:
        ans.append(cur)
        cur+=1
    else:
        if int(num[pos])!=9:
            ch=str(int(num[pos])+1)
#            print(ch)
            cur=int(num[:pos]+ch+num[pos+1:])
        else:
            ch=str(int(num[pos-1])+1)
            cur=int(num[:pos-1]+ch+'0'*len(num[pos:]))
print(ans[-1])


Fixed submission:
k=int(input())
cur=1
ans=-1
cnt=0
while cnt<k:
    num=str(cur)
    n=len(num)
    flag=True
    pos=-1
  #  print(num,end=' num\n')
    for i in range(n-1):
        if abs(int(num[i])-int(num[i+1]))>1:
            pos=i+1
            flag=False
            break
 #   print(flag)
    if flag==True:
        ans=cur
        cur+=1
        cnt+=1
    else:
        if int(num[pos])!=9:
            ch=str(int(num[pos])+1)
#            print(ch)
            cur=int(num[:pos]+ch+num[pos+1:])
        else:
            ch=str(int(num[pos-1])+1)
            cur=int(num[:pos-1]+ch+'0'*len(num[pos:]))
print(ans)
Buggy python submission (verdict: Runtime Error):
l=int(input())
x=l/3
#print((l/3)**3)
print(f"{x*x*x:09f}")


Fixed submission:
l=float(input())

x=l/3
print((l/3)**3)
#print(f"{x*x*x:0.6f}")

Buggy python submission (verdict: Runtime Error):
l=int(input())
x=l/3
#print((l/3)**3)
print(f"{x*x*x:0.9f}")


Fixed submission:
l=float(input())

x=l/3
print((l/3)**3)
#print(f"{x*x*x:0.6f}")

Buggy python submission (verdict: Runtime Error):
l=int(input())
x=l/3
#print((l/3)**3)
print(f"{x*x*x:0.6f}")



Fixed submission:
l=float(input())

x=l/3
print((l/3)**3)
#print(f"{x*x*x:0.6f}")

Buggy python submission (verdict: Runtime Error):
l=float(input())
x=l/3
#print((l/3)**3)
print(f"{x*x*x:0.6f}")



Fixed submission:
l=float(input())

x=l/3
print((l/3)**3)
#print(f"{x*x*x:0.6f}")

Buggy python submission (verdict: Runtime Error):
import sys
l=int(input())
x=l/3
ans=0
print(f"{x*x*x:0.6f}")
sys.exit()
for i in [x-1,x,x+1]:
    for j in [x-1,x,x+1]:
        for k in [x-1,x,x+1]:
            if i+j+k==l:
                ans=max(ans,i*j*k)
print(ans)


Fixed submission:
l=float(input())

x=l/3
print((l/3)**3)
#print(f"{x*x*x:0.6f}")
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
k=min(k,n-1)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
fact=[1]*(n+1)
for i in range(2,n+1):
  fact[i]=(fact[i-1] *i)%mod
def nCr(n,r):
  if r==0 or r==n:
    return 1
  val=((fact[n]*mpow(fact[r],mod-2))%mod*mpow(fact[n-r],mod-2))%mod
  return val
ans=0
for h in range(k+1):
  ans=(ans+(nCr(n,h)*nCr(n-1,n-h-1))%mod)%mod
print(ans)


Fixed submission:
n,k=map(int,input().split())
k=min(k,n-1)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
fact=[1]*(n+1)
ifact=[1]*(n+1)
for i in range(2,n+1):
  fact[i]=(fact[i-1] *i)%mod
ifact[n]=mpow(fact[n],mod-2)
for i in range(n-1,1,-1):
  ifact[i]=((i+1)*ifact[i+1])%mod
def nCr(n,r):
  if r==0 or r==n:
    return 1
  val=(fact[n]*ifact[r])%mod
  return (val*ifact[n-r])%mod
ans=0
for h in range(k+1):
  ans=(ans+(nCr(n,h)*nCr(n-1,n-h-1))%mod)%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
A=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),A)
b=[lc//i for i in A]
print(sum(b)%(1000*1000000+7))


Fixed submission:
from functools import reduce
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),A)
b=[lc//i for i in A]
print(sum(b)%(1000*1000000+7))

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
a=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),a)
b=[lc//i for i in a]
print(sum(b)%(1000*1000000+7))


Fixed submission:
from functools import reduce
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),A)
b=[lc//i for i in A]
print(sum(b)%(1000*1000000+7))