Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=list(map(int,input().split()))
c=[]
for i in range(a):
    c.append(b.index(i+1)+1)
result = ' '.join(map(str,c))
print(result)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=[0]*a
"""
for i in range(a):
    c.append(b.index(i+1)+1) #おそらく計算量O(N^2)
"""
for i in range(a):
    c[b[i]-1]=i+1
result = ' '.join(map(str,c))
print(result)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
while True:
    if b[i-1]>=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
    i+=1
    if i==a:
        break
print(max(total2,total))

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
while True:
    if b[i-1]>=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
            total=0
    i+=1
    if i==a:
        break
print(max(total2,total))

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
while True:
    if b[i-1]>=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
            total=0
    i+=1
    if i==a:
        break
print(max(total2))

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
while True:
    if b[i-1]>=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
            total=0
    i+=1
    if i==a:
        break
print(max(total2,total))

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
total=0
total2=0
i=1
for i in range(a-1):
    if b[i+1]<=b[i]:
        total+=1
    else:
        if total2<=total:
            total2=total
        total=0
print(max(total2,total))
Buggy python submission (verdict: Time Limit Exceeded):
L,M=map(int,input().split())
a=[0]*L
for i in range(M):
    b,c=map(int,input().split())
    for j in range(b-1,c):
        a[j]+=1
print(a.count(M))

Fixed submission:
L,M=map(int,input().split())
a=[0]*L
x=[]
y=[]
for i in range(M):
    b,c=map(int,input().split())
    x.append(b)
    y.append(c)
if max(x)<=min(y):
    print(-max(x)+min(y)+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
b=[]
s=[0]*M
for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a)
for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]]+=1
print(s.count(N))

Fixed submission:
N,M=map(int,input().split())
b=[]
s=[0]*M
for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a)
for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]-1]+=1
print(s.count(N))
Buggy python submission (verdict: Runtime Error):
n=int(input())
rec=list(map(int,input().split()))
s=[rec[0],abs(rec[1]-rec[0])]
for i in range(2,n):
        total2=abs(rec[i]-rec[i-2])+s[i-2]
        total1=abs(rec[i]-rec[i-1])+s[i-1]
        s.append(min(total2,total))
print(s[-1])

Fixed submission:
n=int(input())
rec=list(map(int,input().split()))
s=[0,abs(rec[1]-rec[0])]
for i in range(2,n):
        total2=abs(rec[i]-rec[i-2])+s[i-2]
        total1=abs(rec[i]-rec[i-1])+s[i-1]
        s.append(min(total2,total1))
print(s[-1])

Buggy python submission (verdict: Runtime Error):
n=int(input())
rec=list(map(int,input().split()))
s=[rec[0],rec[1]-rec[0]]
for i in range(2,n):
        total2=abs(rec[i]-rec[i-2])+s[i-2]
        total1=abs(rec[i]-rec[i-1])+s[i-1]
        s.append(min(total2,total))
print(s[-1])

Fixed submission:
n=int(input())
rec=list(map(int,input().split()))
s=[0,abs(rec[1]-rec[0])]
for i in range(2,n):
        total2=abs(rec[i]-rec[i-2])+s[i-2]
        total1=abs(rec[i]-rec[i-1])+s[i-1]
        s.append(min(total2,total1))
print(s[-1])
Buggy python submission (verdict: Runtime Error):
import math
from numba import jit
n,k=map(int,input().split())
h=list(map(int,input().split()))
s=[0]*n
@jit
for i in range(1,n):
    total=math.inf
    for j in range(1,k+1):
        if i-j<0:
            break
        total=min(total,abs(h[i]-h[i-j])+s[i-j])
    s[i]=(total)
print(s[-1])

Fixed submission:
import math
from numba import jit
n,k=map(int,input().split())
h=list(map(int,input().split()))
@jit
def a(N,K,H):
    s=[0]*n
    for i in range(1,N):
        total=math.inf
        for j in range(1,K+1):
            if i-j<0:
                break
            total=min(total,abs(H[i]-H[i-j])+s[i-j])
        s[i]=(total)
    print(s[-1])
a(n,k,h)

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

Fixed submission:
import math
from numba import jit
n,k=map(int,input().split())
h=list(map(int,input().split()))
@jit
def a(N,K,H):
    s=[0]*n
    for i in range(1,N):
        total=math.inf
        for j in range(1,K+1):
            if i-j<0:
                break
            total=min(total,abs(H[i]-H[i-j])+s[i-j])
        s[i]=(total)
    print(s[-1])
a(n,k,h)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n,k=map(int,input().split())
h=list(map(int,input().split()))
s=[0,abs(h[1]-h[0])]
total=10**5
for i in range(2,n):
    total=math.inf
    for j in range(1,k+1):
        if i-j<0:
            break
        total=min(total,abs(h[i]-h[i-j])+s[i-j])
    s.append(total)
print(s[-1])

Fixed submission:
import math
from numba import jit
n,k=map(int,input().split())
h=list(map(int,input().split()))
@jit
def a(N,K,H):
    s=[0]*n
    for i in range(1,N):
        total=math.inf
        for j in range(1,K+1):
            if i-j<0:
                break
            total=min(total,abs(H[i]-H[i-j])+s[i-j])
        s[i]=(total)
    print(s[-1])
a(n,k,h)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
x=[]
y=[]
for i in range(a,b+1):
    x.append(i)
if len(x)<k:
    k=len(x)
for i in range(k):
    y.append(x[i])
for i in range(1,k+1):
    y.append(x[-i])
y=list(set(y))
y.sort()
for i in range(len(y)):
    print(y[i])

Fixed submission:
a,b,k=map(int,input().split())
x=[]
y=[]
if b-a<k:
    k=b-a+1
for i in range(a,a+k):
    x.append(i)
for i in range(b-k+1,b+1):
    x.append(i)
x=list(set(x))
x.sort()
for i in range(len(x)):
    print(x[i])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
x=[]
y=[]
for i in range(a,b+1):
    x.append(i)
for i in range(k):
    y.append(x[i])
for i in range(1,k+1):
    y.append(x[-i])
y.sort()
for i in range(len(y)):
    print(y[i])

Fixed submission:
a,b,k=map(int,input().split())
x=[]
y=[]
if b-a<k:
    k=b-a+1
for i in range(a,a+k):
    x.append(i)
for i in range(b-k+1,b+1):
    x.append(i)
x=list(set(x))
x.sort()
for i in range(len(x)):
    print(x[i])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
x=[]
y=[]
for i in range(a,b+1):
    x.append(i)
for i in range(k):
    y.append(x[i])
for i in range(1,k+1):
    y.append(x[-i])
y.sort()
for i in range(len(y)):
    print(y[i])

Fixed submission:
a,b,k=map(int,input().split())
x=[]
y=[]
if b-a<k:
    k=b-a+1
for i in range(a,a+k):
    x.append(i)
for i in range(b-k+1,b+1):
    x.append(i)
x=list(set(x))
x.sort()
for i in range(len(x)):
    print(x[i])
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(2):
    d=2*c[i]
    e=2*abs(9-c[i])
    total+=min(d,e)
print(total)

Fixed submission:
a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(a):
    d=2*c[i]
    e=2*abs(b-c[i])
    total+=min(d,e)
print(total)

Buggy python submission (verdict: Runtime Error):
#Collecting Balls
a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(2):
    d=2*c[i]
    e=2*abs(9-c[i])
    total+=min(d,e)
print(total)

Fixed submission:
a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(a):
    d=2*c[i]
    e=2*abs(b-c[i])
    total+=min(d,e)
print(total)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b==c:
    print(-1)
total=0
else:
    while True:
        x=a/2
        y=b/2
        z=c/2
        a=y+z
        b=x+z
        c=x+y
        total+=1
        if a%2!=0 or b%2!=0 or c%2!=0:
            print(total)
            break

Fixed submission:
a,b,c=map(int,input().split())
if a%2!=0 or b%2!=0 or c%2!=0:
    print(0)
elif a==b==c:
    print(-1)
else:
    total=0
    while True:
        x=a/2
        y=b/2
        z=c/2
        a=y+z
        b=x+z
        c=x+y
        total+=1
        if a%2!=0 or b%2!=0 or c%2!=0:
            print(total)
            break
Buggy python submission (verdict: Runtime Error):
#Contest with Drinks Easy
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    total=t
    total[a]=b
    print(sum(total))

Fixed submission:
import copy
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    total=copy.copy(t)
    total[a-1]=b
    print(sum(total))

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    total=t
    total2[a]=b
    print(sum(total2))

Fixed submission:
import copy
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    total=copy.copy(t)
    total[a-1]=b
    print(sum(total))
Buggy python submission (verdict: Runtime Error):
w=sorted(input())
total=False
for i in range(0,len(w),2):
    if w[i]!=w[i+1]:
        print("No")
        total=True
        break
if total==False:
    print("Yes")

Fixed submission:
w=sorted(input())
total=False
if len(w)==1:
    total=True
    print("No")
else:
    for i in range(0,len(w),2):
        if w[i]!=w[i+1]:
            print("No")
            total=True
            break
if total==False:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=a[i]*a[j]
        ans%=10**9+7
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
s=sum(a)
for i in range(n-1,-1,-1):
    s-=a[i]
    ans+=a[i]*(s)
    ans%=10**9+7
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[0]*10**7
s=int(n**0.65)+1
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Fixed submission:
n=int(input())
l=[0]*10**7
s=int(n**0.7)+10
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[0]*(n+1)
m=n
for x in range(1,m):
    for y in range(1,m-x):
        for z in range(1,m-x-y):
            value=x*x+y*y+z*z+x*y+y*z+z*x
            if value>n:
                m=x+y+z
                continue
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Fixed submission:
n=int(input())
l=[0]*10**7
s=int(n**0.7)+10
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[0]*(n+1)
for x in range(1,n):
    for y in range(1,n-x):
        for z in range(1,n-x-y):
            value=x*x+y*y+z*z+x*y+y*z+z*x
            if value>n:
                continue
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Fixed submission:
n=int(input())
l=[0]*10**7
s=int(n**0.7)+10
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
for i in range(1,n+1):
    count=0
    for x in range(1,i):
        for y in range(1,i-x):
            for z in range(1,i-x-y):
                if x*x+y*y+z*z+x*y+y*z+z*x==i:
                    count+=1
    print(count)


Fixed submission:
n=int(input())
l=[0]*10**7
s=int(n**0.7)+10
for x in range(1,s):
    for y in range(1,s-x):
        for z in range(1,s-x-y):
            l[x*x+y*y+z*z+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(l[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys

x=int(input())
a=1
while(1):
    if(a+1)**5>x:
        break
    a+=1
b=0
s=0
while(1):
    while(1):
        if(a==b):
            break
        if x%(a-b)==0:
            A=a**5
            B=b**5
            k=x-A
            if(-B==k):
                print(a,b)
                sys.exit()
            elif (B==k):
                print(a,-b)
                sys.exit()
        b+=1
    a+=1

Fixed submission:
import sys

x=int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if(i**5-j**5==x):
            print(i,j)
            sys.exit()

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

x=int(input())
a=1
b=0
s=0
while(1):
    while(1):
        if(a==b):
            break
        if x%(a-b)==0:
            A=a**5
            B=b**5
            k=x-A
            if(-B==k):
                print(a,b)
                sys.exit()
            elif (B==k):
                print(a,-b)
                sys.exit()
        b+=1
    a+=1

Fixed submission:
import sys

x=int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if(i**5-j**5==x):
            print(i,j)
            sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
a=1
b=0
s=0
while(1):
    while(1):
        if(a==b):
            break
        if x%(a-b)==0:
            A=a**5
            B=b**5
            if(A-B==x):
                print(a,b)
                s=1
                break
            elif (-A-B==x):
                print(-a,b)
                s=1
                break
            elif (A+B==x):
                print(a,-b)
                s=1
                break
        b+=1
    if(s==1):
        break
    a+=1

Fixed submission:
import sys

x=int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if(i**5-j**5==x):
            print(i,j)
            sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
a=0
b=0
s=0
while(1):
    while(1):
        A=a**5
        B=b**5
        if(A-B==x):
            print(a,b)
            s=1
            break
        elif (-A-B==x):
            print(-a,b)
            s=1
            break
        elif (A+B==x):
            print(a,-b)
            s=1
            break
        if(a==b):
            break
        b+=1
    if(s==1):
        break
    a+=1

Fixed submission:
import sys

x=int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if(i**5-j**5==x):
            print(i,j)
            sys.exit()
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=[0]*n

for i in a:
  l[i]+=1
print(l[1])
for i in a:
  print(l[i+1])


Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
m=max(a)
c=collections.Counter(a)
c=c.most_common()
l=[0]*n
for i in range(len(c)):
    l[c[i][0]-1]=c[i][1]
print(l[0])
for j in range(1,n):
    print(l[j])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
ans=[0]*n
for i in range(max(l)):
    ans[i]=l.count(i+1)
for j in range(n):
    print(ans[j])

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
m=max(a)
c=collections.Counter(a)
c=c.most_common()
l=[0]*n
for i in range(len(c)):
    l[c[i][0]-1]=c[i][1]
print(l[0])
for j in range(1,n):
    print(l[j])
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import functools

def gcd(*numbers):
    return functools.reduce(fractions.gcd, numbers)

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for p in range(1,k+1):
            ans+=gcd(i,j,p)
print(ans)

Fixed submission:
def gcd2(i,j):
    if i<j:
        i,j=j,i
    while j>0:
        i=i%j
        i,j=j,i
    return i

k=int(input())
ans=0
for i in range(1,k+1):
    if i==1:
        ans+=k**2
        continue
    for j in range(1,k+1):
        tmp=gcd2(i,j)
        if tmp==1:
            ans+=k
            continue
        for p in range(1,k+1):
            ans+=gcd2(tmp,p)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
check=True
for i in range(q):
    a=input().split()
    if(a[0]=="1"):
        check= not check
    else:
        if(a[1]=="1"):
            if(check):
                s=a[2]+s
            else:
                s+=a[2]
        else:
            if(check):
                s+=a[2]
            else:
                s=a[2]+s
print(s if check else s[::-1])



Fixed submission:
import sys
from collections import deque
s = input()
q = int(input())
dq = deque(s)
rev = False
for i in range(q):
    t = input().split()
    if t[0] == "1":
        rev = not rev
    else:
        if t[1] == "1":
            if rev:
                dq.append(t[2])
            else:
                dq.appendleft(t[2])
        else:
            if rev:
                dq.appendleft(t[2])
            else:
                dq.append(t[2])
s = "".join(list(dq))
if rev:
    print(s[::-1])
else:
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
check=True
for i in range(q):
    a=input().split()
    if(a[0]=="1"):
        check= not check
    else:
        if(a[1]=="1"):
            if(check):
                s=a[2]+s
            else:
                s+=a[2]
        else:
            if(check):
                s+=a[2]
            else:
                s=a[2]+s
ans=''
for i in range(1,len(s)+1):
    ans+=s[-i]
print(s if check else ans)



Fixed submission:
import sys
from collections import deque
s = input()
q = int(input())
dq = deque(s)
rev = False
for i in range(q):
    t = input().split()
    if t[0] == "1":
        rev = not rev
    else:
        if t[1] == "1":
            if rev:
                dq.append(t[2])
            else:
                dq.appendleft(t[2])
        else:
            if rev:
                dq.appendleft(t[2])
            else:
                dq.append(t[2])
s = "".join(list(dq))
if rev:
    print(s[::-1])
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
l=[0]*n
k=-1
for i in range(n):
    s,c=map(int,input().split())
    if s==1:
        if c==0:
            print(-1)
            sys.exit()
    if l[s-1]!=0:
        if l[s-1]==c:
            pass
        else:
            print(-1)
            sys.exit()
    l[s-1]=c
a=""
for j in range(n):
    a+=str(l[j])
if a[0]=="0":
    a[0]=="1"
print(int(a))

Fixed submission:
import sys
n,m=map(int,input().split())
a1=0
a2=0
a3=0
c1=0
c2=0
c3=0
for i in range(m):
    s,c=map(int,input().split())
    if s==1:
        if c1==1:
            if a1==c:
                pass
            else:
                print(-1)
                sys.exit()
        else:
            a1=c
            c1=1
    if s==2:
        if c2==1:
            if a2==c:
                pass
            else:
                print(-1)
                sys.exit()
        else:
            a2=c
            c2=1
    if s==3:
        if c3==1:
            if a3==c:
                pass
            else:
                print(-1)
                sys.exit()
        else:
            a3=c
            c3=1
if n==1:
    pass
else:
    if c1==0:
        a1=1
if n==1:
    ans=a1
elif n==2:
    ans=a1*10+a2
else:
    ans=a1*100+a2*10+a3
k=ans//10**(n-1)
if k==0:
    if n==1:
        print(ans)
    else:
        print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans=2**n-1
n1=1
n2=1
for i in range(a):
    n1*=n-i
    n1/=i+1
for j in range(b):
    n2*=n-i
    n2/=i+1
print(int(ans-n1-n2))

Fixed submission:
def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c

n, a, b = map(int, input().split())
MOD = 10**9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,a,b=map(int,input().split())
ans=2**n
n1=factorial(n) / factorial(a) / factorial(n - a)
n2=factorial(n) / factorial(b) / factorial(n - b)
n1%=10**9+7
n2%=10**9+7
ans-=n1+n2
ans=ans%(10**9+7)
print(int(ans-1))

Fixed submission:
def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c

n, a, b = map(int, input().split())
MOD = 10**9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans=2**n
n1=1
n2=1
for i in range(1,1+a):
    n1 = n1 * (n - i + 1) / i
    n1%=10**9+7
for j in range(1,1+b):
    n2 = n2 * (n - j + 1) /j
    n2%=10**9+7
ans-=n1+n2
ans=ans%(10**9+7)
print(int(ans-1))

Fixed submission:
def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c

n, a, b = map(int, input().split())
MOD = 10**9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)
Buggy python submission (verdict: Runtime Error):
n=int(input())
dict={}
for i in range(n):
    s=input()
    if s in dict_keys:
        dict[s]=1
    else:
        dict[s]+=1
items_sorted = sorted(dict.items(), key = lambda x : x[1])
value=items_sorted[0][0]
i=0
while(1):
    if items_sorted[i][0]==value:
        print(items_sorted[i][1])
    else:
        break

Fixed submission:
import collections

N = int(input())
l = []
 
for _ in range(N):
    s = str(input())
    l.append(s)

c = collections.Counter(l)
c = c.most_common()
 
most_count = c[0][1]
c.sort()
 
for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s="YES"
for i in range(n):
    for j in range(i+1,n):
        if a[i]==a[j]:
            s="NO"
            break
print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
s="YES"
for i in range(n-1):
    if a[i]==a[i+1]:
        s="NO"
        break
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s="NO"
for i in range(n):
    for j in range(i+1,n):
        if a[i]==s[j]:
            s="YES"
            break
print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
s="YES"
for i in range(n-1):
    if a[i]==a[i+1]:
        s="NO"
        break
print(s)