Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

answer=0

if N%2==0:
    for i in range(N//2):
        answer+=N-1
else:
    for i in range(N//2):
        answer+=N-1
    answer+=(N-1)//2
print(answer)

Fixed submission:
N=int(input())

answer=0

answer+=(N**2-N)//2

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

answer=0

for i in range(N):
    answer+=i
print(answer)

Fixed submission:
N=int(input())

answer=0

answer+=(N**2-N)//2

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[list(input()) for _ in range(N)]

count=0

ss=[]
tt=[]

for i in range(N-1):
    for j in range(N-i-1):
        ss=sorted(s[i])
        tt=sorted(s[i+j+1])
        if ss==tt:
            count+=1

print(count)

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]

S=[""]*N
T={}
count=0

for i in range(N):
    S[i]=sorted(s[i])
    S[i]="".join(S[i])
    if S[i] not in T:
        T[S[i]]=1
    else:
        count+=T[S[i]]
        T[S[i]]+=1

print(count)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
answer=B+C-A
if answer>=0
  print(answer)
else print(0)

Fixed submission:
A,B,C = map(int,input().split())
answer=B+C-A

if answer>=0:
  print(answer)
else :
  print(0)

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if B+C-A>=0
  print()
else print(0)

Fixed submission:
A,B,C = map(int,input().split())
answer=B+C-A

if answer>=0:
  print(answer)
else :
  print(0)

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if B+C-A>=0
  print()
else print(0)

Fixed submission:
A,B,C = map(int,input().split())
answer=B+C-A

if answer>=0:
  print(answer)
else :
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))

answer="Yes"

for i in range(N):
    if i>=1:
        if max(H[:i])>H[i]+1:
            answer="No"
            break
        else:
            pass
print(answer)

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

answer="Yes"

for i in range(1,N,):
    if H[N-i]>=H[N-i-1]:
        pass
    else:
        H[N-i-1]-=1
        if H[N-i]<H[N-i-1]:
            answer="No"

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))

answer="Yes"

for i in range(N):
    if i>=1:
        for j in range(i+1):
            if H[j]>H[i]+1:
                answer="No"
                break
            else:
                pass
print(answer)

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

answer="Yes"

for i in range(1,N,):
    if H[N-i]>=H[N-i-1]:
        pass
    else:
        H[N-i-1]-=1
        if H[N-i]<H[N-i-1]:
            answer="No"

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
S=int(input())

ma=pow(10,9)

for i in range(int(pow(S,1/2))+1,0,-1):
    #print(i)
    if S%i==0 and S//i<=ma:
        print(0,0,i,0,0,S//i)
        break


Fixed submission:
S=int(input())

X_2=pow(10,9)
X_3=(X_2-S)%X_2
Y_3=(S+X_3)//X_2

print(0,0,X_2,1,X_3,Y_3)

Buggy python submission (verdict: Time Limit Exceeded):
S=int(input())

ma=pow(10,9)

for i in range(1,int(pow(S,1/2))+1):
    #print(i)
    if S%i==0 and S//i<=ma:
        print(0,0,i,0,0,S//i)
        break


Fixed submission:
S=int(input())

X_2=pow(10,9)
X_3=(X_2-S)%X_2
Y_3=(S+X_3)//X_2

print(0,0,X_2,1,X_3,Y_3)
Buggy python submission (verdict: Runtime Error):
r=input()

print(3*r^2)

Fixed submission:
r=int(input())
answer=3*r**2
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R=map(int,input().split())

A=[]
D=[]

for i in range(R-L+1):
    A.append((i+L)%2019)

if A.count(1)>=2:
    B=set(A)
    B.add(1)
else:
    B=set(A)

C=list(itertools.combinations(B,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
    if 0 in D:
        break
E=sorted(D)
print(E[0])


Fixed submission:
import itertools
L,R=map(int,input().split())

A=[]
D=[]

if R-L+1<2019:
    for i in range(R-L+1):
        A.append((i+L)%2019)

    if A.count(1)>=2:
        B=set(A)
        B.add(1)
    else:
        B=set(A)

    C=list(itertools.combinations(B,2))
    for j in range(len(C)):
        D.append(C[j][0]*C[j][1]%2019)
    E=sorted(D)
    print(E[0])
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R=map(int,input().split())

A=[]
D=[]

for i in range(R-L+1):
    A.append((i+L)%2019)

if A.count(1)>=2:
    B=set(A)
    B.add(1)
else:
    B=set(A)

C=list(itertools.combinations(B,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
E=sorted(D)
print(E[0])


Fixed submission:
import itertools
L,R=map(int,input().split())

A=[]
D=[]

if R-L+1<2019:
    for i in range(R-L+1):
        A.append((i+L)%2019)

    if A.count(1)>=2:
        B=set(A)
        B.add(1)
    else:
        B=set(A)

    C=list(itertools.combinations(B,2))
    for j in range(len(C)):
        D.append(C[j][0]*C[j][1]%2019)
    E=sorted(D)
    print(E[0])
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R=map(int,input().split())

A=[]
D=[]

for i in range(R-L+1):
    A.append((i+L)%2019)
B=sorted(A)
C=list(itertools.combinations(A,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
E=sorted(D)
print(E[0])


Fixed submission:
import itertools
L,R=map(int,input().split())

A=[]
D=[]

if R-L+1<2019:
    for i in range(R-L+1):
        A.append((i+L)%2019)

    if A.count(1)>=2:
        B=set(A)
        B.add(1)
    else:
        B=set(A)

    C=list(itertools.combinations(B,2))
    for j in range(len(C)):
        D.append(C[j][0]*C[j][1]%2019)
    E=sorted(D)
    print(E[0])
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
L,R=map(int,input().split())

A=[]

for i in range(R-L+1):
    for j in range(R-i-L):
        A.append((i+L)*(j+i+L+1)%2019)
print(min(A))

Fixed submission:
import itertools
L,R=map(int,input().split())

A=[]
D=[]

if R-L+1<2019:
    for i in range(R-L+1):
        A.append((i+L)%2019)

    if A.count(1)>=2:
        B=set(A)
        B.add(1)
    else:
        B=set(A)

    C=list(itertools.combinations(B,2))
    for j in range(len(C)):
        D.append(C[j][0]*C[j][1]%2019)
    E=sorted(D)
    print(E[0])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S=input()

if S[0] == S[1] != S[2] == S[4] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')

Fixed submission:
S=input()

if S[0] == S[1] != S[2] == S[3] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S=input()

if S[0] == S[1] != S[2] == S[4]:
  print('Yes')
elif S[0] == S[2] != S[1] == S[3]:
  print('Yes')
elif S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')

Fixed submission:
S=input()

if S[0] == S[1] != S[2] == S[3] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))

count=0

for i in range(n-2):
    print(q)
    if q[1]==p[i+1]:
        count+=1

print(count)

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

count=0

for i in range(n-2):
    q=sorted(p[i:i+3])
    if q[1]==p[i+1]:
        count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
S=input()

for i in range(3):
    if S[i]=S[i+1]:
print('Bad')

    else:
print('Good')

Fixed submission:
S=input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
  print ('Bad')

else:
  print ('Good')
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))

count=0
dist=0

i=0
while dist<=X and count<=N:
    dist+=L[count]
    count+=1
    #print(dist)

print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

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

count=0
dist=0

i=0
while dist<=X or i<N-1:
    count+=1
    dist+=L[i]
    i+=1
    #print(dist)

print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

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

count=0
dist=0

i=0
while dist<=X or i<N:
    count+=1
    dist+=L[i]
    i+=1
    #print(dist)

print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

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

count=0
dist=0

i=0
while dist<=X:
    count+=1
    dist+=L[i]
    i+=1
    #print(dist)

print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

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

D=L[0]
i=1
count=1

if D>X:
    print(0)
else:
    while D<=X and i<=N:
        D+=L[i]
        i+=1
        count+=1
    print(count)
    

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)

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

D=0
i=0
count=0

while D<=X and i<=N:
    D+=L[i]
    i+=1
    count+=1
print(count)
    

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

dp=[0]*(N)

for i in range(1,N+1):
    if i==1 and 1 not in a:
        dp[0]=1
    elif i==2:
        if 2 in a:
            dp[1]=0
        else:
            dp[1]+=dp[0]+1

    elif i not in a:
        dp[i-1]=dp[i-2]+dp[i-3]

print(dp[N-1]%1000000007)
    

Fixed submission:
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

a.append(N+10)
dp=[0]*(N)
j=0

for i in range(1,N+1):
    if i==1 and 1!=a[j]:
        dp[0]=1
    elif i==2:
        if 2==a[j]:
            dp[1]=0
            j+=1
        else:
            dp[1]=dp[0]+1

    elif i!=a[j]:
        dp[i-1]=dp[i-2]+dp[i-3]
    else:
        j+=1
    

print(dp[N-1]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
LR=[list(map(int,input().split())) for _ in range(M)]

count=0
judge=0

for i in range(1,N+1):
    judge=0
    for lr in LR:
        if lr[0]<=i<=lr[1]:
            judge+=1
    if judge==M:
        count+=1

print(count)

Fixed submission:
N,M=map(int,input().split())
LR=[list(map(int,input().split())) for _ in range(M)]

l=1
r=N

for i in LR:
    #print(i)
    if i[0]>l:
        l=i[0]
    if i[1]<r:
        r=i[1]

if r>=l:
    print(r-l+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S=input()

ans=[]
count=0

for i in range(len(S)):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        count+=1
    else:
        ans.append(count)
        count=0

print(max(ans))

Fixed submission:
S=input()

ans=[]
count=0

for i in range(len(S)):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        count+=1
    else:
        ans.append(count)
        count=0

ans.append(count)

print(max(ans))
Buggy python submission (verdict: Runtime Error):
import math
N,M=map(int,input().split())
S=input()
T=input()

n=N//math.gcd(N,M)
m=M//math.gcd(N,M)
g=math.gcd(N,M)
judge=True

for i in range(g):
    if S[i*n]!=T[i*m]:
        judge=False

if judge==True:
    print(N*M//g)
else:
    print(-1)

Fixed submission:
import fractions
N,M=map(int,input().split())
S=input()
T=input()

n=N//fractions.gcd(N,M)
m=M//fractions.gcd(N,M)
g=fractions.gcd(N,M)
judge=True

for i in range(g):
    if S[i*n]!=T[i*m]:
        judge=False

if judge==True:
    print(N*M//g)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

base=M//N

if M%2==1:
    if base%2==1:
        for i in range(base,0,-2):
            if M%i==0:
                print(i)
                break
    else:
        for i in range(base-1,0,-2):
            if M%i==0:
                print(i)
                break
else:
    for i in range(base,0,-1):
        if M%i==0:
            print(i)
            break



Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))

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

base=M//N
answer=[0]*N
j=0

for i in range(base,base//2+1,-1):
    if M%i==0:
        answer[j]=i
        break
    elif M%(base-i+1)==0:
        answer[j]=base-i+1
        j+=1
print(max(answer))

Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

if M==6700417 or M==524287 or M==131071 :
    print(1)
else:
    for i in range(M//N,0,-1):
        if M%i==0:
            print(i)
            break



Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

if M==6700417:
    print(1)
else:
    for i in range(M//N,0,-1):
        if M%i==0:
            print(i)
            break



Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break



Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

base=M//N

for i in range(base,0,-1):
    if M%i==0:
        print(i)
        break



Fixed submission:
N,M=map(int,input().split())

base=M//N
li=[]


for i in range(1,int(pow(M,1/2))+1):
    if i<=base and M%i==0:
        li.append(i)
    if M%i==0 and M//i<=base:
        li.append(M//i)

print(max(li))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))

s=set(a)
count=0

for i in s:
    if a.count(i)-i<0:
        count+=a.count(i)
    else:
        count+=a.count(i)-i
print(count)

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

a=sorted(a)
s=set(a)
count=0

base=0
judge=0

for i in a:
    if base!=i:
        #print(judge,base)
        if judge>=base:
            count+=judge-base
        else:
            count+=judge
        base=i
        judge=1
    else:
        judge+=1
if judge>=base:
    count+=judge-base
else:
    count+=judge


print(count)
Buggy python submission (verdict: Runtime Error):
s=input()
li=list(s)

i=0
j=len(s)-1
answer=0

while i!=j:
    if li[i]==li[j]:
        i+=1
        j-=1
    else:
        if li[i]!="x" and li[j]!="x":
            answer=-1
            break
        elif li[i]=="x" and li[j]!="x":
            answer+=1
            i+=1
        elif li[i]!="x" and li[j]=="x":
            answer+=1
            j-=1

print(answer)


Fixed submission:
s=input()
li=list(s)

i=0
j=len(s)-1
answer=0

while i<j:
    if li[i]==li[j]:
        i+=1
        j-=1
    else:
        if li[i]!="x" and li[j]!="x":
            answer=-1
            break
        elif li[i]=="x" and li[j]!="x":
            answer+=1
            i+=1
        elif li[i]!="x" and li[j]=="x":
            answer+=1
            j-=1

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())

count=0

for i in range(K+1):
    for j in range(i+1):
        for k in range(j+1):
            if i+j+k==S:
                #print(i,j,k)
                if i==j and j==k:
                    count+=1
                elif i==j or j==k or i==k:
                    count+=3
                else:
                    count+=6
print(count)

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

count=0

for x in range(K+1):
    for y in range(x+1):
        z=S-x-y
        if z<0 or z>y:
            pass
        else:
            #print(x,y,z)
            if x==y==z:
                count+=1
            elif x==y or x==z or y==z:
                count+=3
            else:
                count+=6
        
print(count)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())

X=abs(x)
Y=abs(y)

if x<y:
    if x*y>0:
        print(y-x)
    elif x*y==0:
        print(abs(X-Y))
    else:
        print(abs(X-Y)+1)
else:
    if x*y>=0:
        print(abs(X-Y)+2)
    elif x*y=0:
        print(abs(X-Y)+1)
    else:
        print(abs(X-Y)+1)

Fixed submission:
x,y=map(int,input().split())

X=abs(x)
Y=abs(y)

if x<y:
    if x*y>0:
        print(abs(X-Y))
    elif x*y==0:
        print(abs(X-Y))
    else:
        print(abs(X-Y)+1)
else:
    if x*y>0:
        print(abs(X-Y)+2)
    elif x*y==0:
        print(abs(X-Y)+1)
    else:
        print(abs(X-Y)+1)
Buggy python submission (verdict: Runtime Error):
S=input()
s=list(S)

ans=0

for i in range(2**(len(s)-1)):
    judge=str(bin(i))[2:].rjust(len(s)-1,"0")
    sum=0
    plus=s[0]
    #print(judge)
    for j,jud in enumerate(judge):
        if jud=="0":
            plus+=s[j+1]
            #print(plus)
        else:
            sum+=int(plus)
            plus=""
            plus+=s[j+1]
    if len(plus)!=0:
        sum+=int(plus)
        #print(plus)
    #print(sum)
    ans+=sum
print(ans)

Fixed submission:
S=input()
s=list(S)

ans=0

if len(S)!=1:
    for i in range(2**(len(s)-1)):
        judge=str(bin(i))[2:].rjust(len(s)-1,"0")
        sum=0
        plus=s[0]
        #print(judge)
        for j,jud in enumerate(judge):
            if jud=="0":
                plus+=s[j+1]
                #print(plus)
            else:
                sum+=int(plus)
                plus=""
                plus+=s[j+1]
        if len(plus)!=0:
            sum+=int(plus)
            #print(plus)
        #print(sum)
        ans+=sum
else:
    ans=int(S)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=list(map(int,input.split()))
for i in range(len(n)):
  if(n[i]==0):
    cout<<i+1
    break

Fixed submission:
n=list(map(int,input().split()))
for i in range(len(n)):
  if(n[i]==0):
    print(i+1)
    break
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

Q = 998244353
S = [0] * (N + 1)

for _ in range(K):
    l, r = map(int, input().split())
    for i in range(l, r+1):
        S[i] = 1

P = [0] * N
P[0] = 1

for i in range(1, N):
    for j in range(i):
        P[i] += S[i-j] * P[j]
        P[i] = P[i] % Q

print(P[-1])

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

Q = 998244353
L, R = [], []

for _ in range(K):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
    
L = sorted(L)
R = sorted(R)

P = [0] * N
P[0] = 1

C = [0] * N
C[0] = 1
S = 1

for i in range(1, N):
    for l, r in zip(L, R):
        if l > i:
            break
        
        if r >= i:
            P[i] += C[i-l]
        else:
            s = C[i-l] - C[i-r-1]
            if s < 0:
                s += Q
            P[i] += s

        P[i] = P[i] % Q
    S += P[i]
    S %= Q
    C[i] = S


print(P[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K = map(int, input().split())
A = list(map(int, input().split()))

def is_cuttable(N):
    n = 0
    for a in A:
        i = np.ceil(a / N)
        n += int(i) - 1
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)

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

def is_cuttable(N):
    n = 0
    for a in A:
        i = a // N
        if a % N == 0:
            i -= 1
        n += int(i)
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)

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

def is_cuttable(A, K, N):
    n = 0
    for a in A:
        i = np.ceil(a / N)
        n += int(i) - 1
        if n > K:
            return False
    return True

N, K = map(int, input().split())
A = list(map(int, input().split()))

n_max = max(A)
n = n_max // 2
n_min = 0

while True:
    if is_cuttable(A, K, n):
        n_max = n
    else:
        n_min = n
    if n_max - n_min < 2:
        break
    n = (n_max + n_min) // 2
print(n_max)

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

def is_cuttable(N):
    n = 0
    for a in A:
        i = a // N
        if a % N == 0:
            i -= 1
        n += int(i)
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)

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

def is_cuttable(A, K, N):
    n = 0
    for a in A:
        i = np.ceil(a / N)
        n += int(i) - 1
        if n > K:
            return False
    return True

N, K = map(int, input().split())
A = list(map(int, input().split()))

n_max = max(A)
n = n_max // 2
n_min = 0

while True:
    if is_cuttable(A, K, n):
        n_max = n
    else:
        n_min = n
    if n_max - n_min < 2:
        break
    n = (n_max - n_min) // 2 + n_min
print(n_max)

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

def is_cuttable(N):
    n = 0
    for a in A:
        i = a // N
        if a % N == 0:
            i -= 1
        n += int(i)
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)