Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
T1, T2=(int(i) for i in input().split())
A1, A2=(int(i) for i in input().split())
B1, B2=(int(i) for i in input().split())

if T1*A1+T2*A2==T1*B1+T2*B2:
    print("infinity")
elif ((A1>B1) & (T1*A1+T2*A2-(T1*B1+T2*B2)>0)) or ((A1<B1) & (T1*A1+T2*A2-(T1*B1+T2*B2)<0)):
    print(0)
else:
    d=T1*A1+T2*A2-(T1*B1+T2*B2)#T1+T2だけ走った後離れている距離
    if abs(T1*(A1-B1))%d==0:
        ss=1
    print(abs(T1*(A1-B1))//d*2-ss+1)

Fixed submission:
T1, T2=(int(i) for i in input().split())
A1, A2=(int(i) for i in input().split())
B1, B2=(int(i) for i in input().split())

if T1*A1+T2*A2==T1*B1+T2*B2:
    print("infinity")
elif ((A1>B1) & (T1*A1+T2*A2-(T1*B1+T2*B2)>0)) or ((A1<B1) & (T1*A1+T2*A2-(T1*B1+T2*B2)<0)):
    print(0)
else:
    d=abs(T1*A1+T2*A2-(T1*B1+T2*B2))#T1+T2だけ走った後離れている距離
    ss=0
    if abs(T1*(A1-B1))%d==0:
        ss=1
        
    print(abs(T1*(A1-B1))//d*2-ss+1)
Buggy python submission (verdict: Runtime Error):
N, K=(int(i) for i in input().split())
A=[int(i) for i in input().split()]

import numpy as np
from scipy.ndimage.interpolation import shift

res=[0]*(N+1)
res[1] = A[0]
for i in range(0,len(A)):
    res[i+1] = (res[i] + A[i])%K

array=np.array(res)
ans=0

for i in range(1,N):
    ans+=((array-shift(array,i,cval=0))%K==i).sum()
print(ans)


Fixed submission:
S=input()
if (S=="SUN"):
    print(7)
elif (S=="MON"):
    print(6)
elif (S=="TUE"):
    print(5)
elif (S=="WED"):
    print(4)
elif (S=="THU"):
    print(3)
elif (S=="FRI"):
    print(2)
elif (S=="SAT"):
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=[int(i) for i in input().split()]
L=sorted(L)
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k]:
                ans+=1
            else:
                break
print(ans)

Fixed submission:

N=int(input())
L=[int(i) for i in input().split()]
L=sorted(L)
ans=0
import bisect

for i in range(N-2):
    for j in range(i+1,N-1):
        insert_index = bisect.bisect_left(L,L[i]+L[j])
        ans+=insert_index-j-1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

N= int(input())
A=[[int(i), ind] for ind, i in enumerate(input().split())]

ans=""
A=sorted(A)
for i in range(N):
    ans=ans+str(A[i][1]+1)+" "
print(ans[:-1])

Fixed submission:

N= int(input())
A=[[int(i), ind] for ind, i in enumerate(input().split())]

A=sorted(A)
for i in range(N-1):
    print(A[i][1]+1, end=" ")
print(A[N-1][1]+1)

Buggy python submission (verdict: Time Limit Exceeded):
N= int(input())
A=[int(i) for i in input().split()]

from  heapq import heappush, heappop

hq=[]
for i in range(N):
    heappush(hq, (A[i],i))

ans=""
for i in range(N):
    ans=ans+str(heappop(hq)[1]+1)+" "
print(ans[:-1])




Fixed submission:

N= int(input())
A=[[int(i), ind] for ind, i in enumerate(input().split())]

A=sorted(A)
for i in range(N-1):
    print(A[i][1]+1, end=" ")
print(A[N-1][1]+1)
Buggy python submission (verdict: Runtime Error):
S=input()
if (S="Sunny"):
    print("Cloudy")
elif (S="Cloudy"):
    print("Rainy")
else:
    print("Sunny")

Fixed submission:
S=input()
if (S=="Sunny"): print("Cloudy")
elif (S=="Cloudy"):print("Rainy")
else: print("Sunny")
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2==0:
    s=N/2
    print(int(s*(N-1)))
if N%2==1:
    s=(N-1)/2
    print(int(s*N))

Fixed submission:
S=input()
T=input()

ans=0
if S[0]==T[0]:ans+=1
if S[1]==T[1]:ans+=1
if S[2]==T[2]:ans+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
print(int(N/2*(N-1)))



Fixed submission:
S=input()
T=input()

ans=0
if S[0]==T[0]:ans+=1
if S[1]==T[1]:ans+=1
if S[2]==T[2]:ans+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=N
ans=0
m=N
for i in range(N-1,0,-1):
    if i%s<m%s:
        ans+=m%s
        m=s-1
        s-=1
    else:
        ans+=i%s
        s-=1
print(ans)
        

Fixed submission:
N=int(input())
if N%2==0:
    s=int(N/2)
    print(s*(N-1))
if N%2==1:
    s=int((N-1)/2)
    print(s*N)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=(int(i) for i in input().split())
gate=[]
for i in range(M):
    gate.append([int(i) for i in input().split()])
    gate[i].append(gate[i][1]-gate[i][0])
gate=sorted(gate,key=lambda x:x[2])

answer=0
for i in range(N+1):
    ok=1
    for l,r,p in gate:
        if l<=i and i<=r:
            pass
        else:
            ok=0
            break
    if ok==1:
        answer+=1
print(answer)

Fixed submission:
N,M=(int(i) for i in input().split())
gate=[]
for i in range(M):
    gate.append([int(i) for i in input().split()])
    
maxl=max(gate,key=lambda x:x[0])[0]
minr=min(gate,key=lambda x:x[1])[1]
if maxl<=minr:
    print(minr-maxl+1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=(int(i) for i in input().split())
gate=[]
for i in range(M):
    gate.append([int(i) for i in input().split()])

answer=0
for i in range(N+1):
    ok=1
    for l,r in gate:
        if l<=i and i<=r:
            pass
        else:
            ok=0
            break
    if ok==1:
        answer+=1
print(answer)
        

Fixed submission:
N,M=(int(i) for i in input().split())
gate=[]
for i in range(M):
    gate.append([int(i) for i in input().split()])
    
maxl=max(gate,key=lambda x:x[0])[0]
minr=min(gate,key=lambda x:x[1])[1]
if maxl<=minr:
    print(minr-maxl+1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
for i in range(M):
    b,c=(int(i) for i in input().split())
    l=[c]*b
    a.extend(l)

a=sorted(a,reverse=True)
answer=0
for i in range(N):
    answer+=a[i]
print(answer)

Fixed submission:
N,M=(int(i) for i in input().split())
a=[[int(i),1] for i in input().split()]

for i in range(M):
    b,c=(int(i) for i in input().split())
    a.append([c,b])
    

a=sorted(a,key=lambda x:x[0],reverse=True)
answer=0
i=0
n=0
while True:
    answer+=a[i][0]*a[i][1]
    i+=1
    n+=a[i-1][1]
    if n>=N:
        answer-=a[i-1][0]*(n-N)
        break
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=(int(i) for i in input().split())
a=[int(i) for i in input().split()]

for i in range(M):
    b,c=(int(i) for i in input().split())
    for i in range(b):
        a.append(c)

a=sorted(a,reverse=True)
answer=0
for i in range(N):
    answer+=a[i]
print(answer)

Fixed submission:
N,M=(int(i) for i in input().split())
a=[[int(i),1] for i in input().split()]

for i in range(M):
    b,c=(int(i) for i in input().split())
    a.append([c,b])
    

a=sorted(a,key=lambda x:x[0],reverse=True)
answer=0
i=0
n=0
while True:
    answer+=a[i][0]*a[i][1]
    i+=1
    n+=a[i-1][1]
    if n>=N:
        answer-=a[i-1][0]*(n-N)
        break
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=(int(i) for i in input().split())
import math
answer=0
for r in range(0,math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        if R*r+G*g>N:
            break
        if (N-R*r-G*g)%B==0:
            answer+=1

print(answer)




Fixed submission:
R,G,B,N=(int(i) for i in input().split())
import math
answer=0
for r in range(0,math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        sss=R*r+G*g
        if sss>N:
            break
        if (N-sss)%B==0:
            answer+=1
print(answer)
Buggy python submission (verdict: Runtime Error):
a,b =map(int(i) for i in input().split())
if a==b:
  print(a*a)
elif a>b:
  print(2*a-1)
else:
  print(b*2-1)
    

Fixed submission:
a,b =(int(i) for i in input().split())
if a==b:
  print(a*2)
elif a>b:
  print(2*a-1)
else:
  print(b*2-1)
Buggy python submission (verdict: Time Limit Exceeded):
S =input()
l=len(S)
N=int(S,2)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if (N & 0b10**i)!=0:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if (N & 0b10**i)!=0:
    	bpopcount+=1
    else:
      	apopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount) 




Fixed submission:
S =input()
l=len(S)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if int(S[i])==1:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if int(S[i])==1:
    	bpopcount+=1
    else:
      	apopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount)

Buggy python submission (verdict: Time Limit Exceeded):
S =input()
l=len(S)
N=int(S,2)
a=0b1
b=0b0
for i in range(1,l):
  if i%2==0:
    a=a+0b10**i
  else:
  	b=b+0b10**i
aN=a ^ N
bN=b ^ N
apopcount=0
bpopcount=0
for i in range(0,l):
  if (aN & 0b10**i)!=0:
    apopcount+=1
  if (bN & 0b10**i)!=0:
    bpopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount)
    



Fixed submission:
S =input()
l=len(S)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if int(S[i])==1:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if int(S[i])==1:
    	bpopcount+=1
    else:
      	apopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount)
Buggy python submission (verdict: Runtime Error):
SHINJUKU

Fixed submission:
x=input()
N=len(x)
maxl=0
for i in range(N):
  if (x[i]=="A")or(x[i]=="T")or(x[i]=="G")or(x[i]=="C"):
    j=1
    while (i+j<N):
      if ((x[i+j]=="A")or(x[i+j]=="T")or(x[i+j]=="G")or(x[i+j]=="C")):
        j=j+1
      else:
        break
    if maxl<j:
      maxl=j
      maxi=i
    
print(maxl)
Buggy python submission (verdict: Runtime Error):
N, K=[int(i) for i in input().split()]
h=[int(i) for i in input().split()]

cost=[0]
for i in range(1,N):
    m_cost=999999
    for j in range(1,min(K,i)+1):
        if m_cost>=cost[i-j]+abs(h[i]-h[i-j]):
            m_cost=cost[i-j]+abs(h[i]-h[i-j])
    cost.append(m_cost)
print(cost.pop()) 




Fixed submission:
N=int(input())
h=[int(i) for i in input().split()]

cost=[0]
for i in range(1,N):
    if i!=1: 
        cost.append(min(cost[i-1]+abs(h[i]-h[i-1]), cost[i-2]+abs(h[i]-h[i-2])))
    else:
        cost.append(cost[i-1]+abs(h[i]-h[i-1]))
print(cost.pop())
Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np

N, W=[int(i) for i in input().split()]
wv=[[int(i) for i in input().split()] for _ in range(N)]

dp=np.zeros((N,W+1)).astype("int64")


for i in range(N):
    for w in range(W+1):
        if i==0:
            if wv[i][0]<=w:
                dp[i][w]=wv[i][1]
        else:
            if w>=wv[i][0]:
                dp[i][w]=max(dp[i-1][w-wv[i][0]]+wv[i][1],dp[i-1][w])
            else:
                dp[i][w]=dp[i-1][w]

print(int(dp[-1].max())) 

Fixed submission:


N, W=[int(i) for i in input().split()]
wv=[[int(i) for i in input().split()] for _ in range(N)]


dp=[[0]*(W+1) for _ in range(N)]

for i in range(N):
    for w in range(W+1):
        if i==0:
            if wv[i][0]<=w:
                dp[i][w]=wv[i][1]
        else:
            if w>=wv[i][0]:
                dp[i][w]=max(dp[i-1][w-wv[i][0]]+wv[i][1],dp[i-1][w])
            else:
                dp[i][w]=dp[i-1][w]

print(max(dp[-1]))

Buggy python submission (verdict: Runtime Error):

import numpy as np

N, W=[int(i) for i in input().split()]
wv=[[int(i) for i in input().split()] for _ in range(N)]

dp=np.zeros((N,W+1)).astype("int64")


for i in range(N):
    for w in range(W+1):
        if i==0:
            if wv[i][0]<=w:
                dp[i][w]=wv[i][1]
        else:
            if w>=wv[i][0]:
                dp[i][w]=max(dp[i-1][w-wv[i][0]]+wv[i][1],dp[i-1][w])
            else:
                dp[i][w]=dp[i-1][w]

print(int(dp[-1].max())) 

Fixed submission:


N, W=[int(i) for i in input().split()]
wv=[[int(i) for i in input().split()] for _ in range(N)]


dp=[[0]*(W+1) for _ in range(N)]

for i in range(N):
    for w in range(W+1):
        if i==0:
            if wv[i][0]<=w:
                dp[i][w]=wv[i][1]
        else:
            if w>=wv[i][0]:
                dp[i][w]=max(dp[i-1][w-wv[i][0]]+wv[i][1],dp[i-1][w])
            else:
                dp[i][w]=dp[i-1][w]

print(max(dp[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())

total = 0
for m in range(1,N):
    sub = 1

    tmp = m
    for i in range(2, int(-(-m**0.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            sub *= (cnt + 1)

    if tmp != 1:
        sub *= 2

    total += sub

print(total)



Fixed submission:
import sys
import math

input = sys.stdin.readline

N = int(input())

total = 0
for i in range(1, N):
    total += (N-1) // i

print(total)

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

import sympy

N = int(input())

total = 0
for i in range(1,N):
    total += len(sympy.divisors(i))

print(total)


Fixed submission:
import sys
import math

input = sys.stdin.readline

N = int(input())

total = 0
for i in range(1, N):
    total += (N-1) // i

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

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

for i in range(N):
    A[i] = A[i] % (1e9 + 7)

sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += A[i]*A[j] % (1e9 + 7)

print(int(sum % (1e9 + 7)))



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

N = int(input())
A = list(map(int, input().split()))
mod = int(1e9+7)

sum = 0
row = 0
for ii in range(N-1):
    i = N-2-ii
    row += A[i+1]
    row %= mod
    sum += A[i] * row
    sum %= mod

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

S=tuple(input().strip())
N=len(S)+1
x = [0]

for i in range(1,N):
    if S[i-1] == '<':
        x.append(x[i-1] + 1)
    else:
        x.append(0)
        for j in range(i):
            if x[i-1-j] == x[i-j]:
                x[i-1-j] += 1
            else:
                break

print(sum(x))


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

S=tuple(input().strip())
N=len(S)+1
sets = []
count = 0

for c in S:
    d = 1 if c == '<' else -1
    if count * d < 0:
        sets.append(count)
        count = d
    else:
        count += d
sets.append(count)

sum = 0
for i in range(len(sets)):
    k=sets[i]
    if k > 0:
        sum += (k*(k+1))//2
    else:
        sum += (k*(k-1))//2
        if i > 0:
            sum -= min(sets[i-1], -k)

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
ans=[]
for i in range(N):
    ans.append(A.index(B[i])+1)

ans = map(str,ans)
print(" ".join(ans))


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
for i in range(N):
    A[i] = [i+1, A[i]]

A.sort(key=lambda x:x[1])

ans=[]
for i in range(N):
    ans.append(A[i][0])

ans = map(str, ans)
print(' '.join(ans))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

S=input()
K=int(input())

n = 0
m = 0
for c in S:
    if c != '1':
        m = int(c)
        break
    n += 1
if K <= n:
    print(1)
else:
    print(m)



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

S=input().strip()
K=int(input().strip())

n = 0
m = 0
for c in S:
    if c != '1':
        m = int(c)
        break
    n += 1
if K <= n:
    print(1)
else:
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input())
a = []
for _ in range(N):
    a.append(int(input()))
found = [0]*N

steps = 0
i = 0
found[i] = 1
while True:
    j = a[i] - 1
    if found[j] == 1:
        print(-1)
        exit()
    steps += 1
    i = j
    if i == 1:
        print(steps)
        exit()


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

N=int(input())
a = []
for _ in range(N):
    a.append(int(input()))
found = [0]*N

steps = 0
i = 0
found[i] = 1
while True:
    j = a[i] - 1
    if found[j] == 1:
        print(-1)
        exit()
    steps += 1
    i = j
    found[i] = 1
    if i == 1:
        print(steps)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0
for a in range(1, N+1):
    b = 1
    while a * b < N:
        ans += 1
        b += 1

print(ans)


Fixed submission:
N = int(input())

ans = 0
for a in range(1, N+1):
    x = N // a

    if N % a == 0:
        ans += x - 1
    else:
        ans += x

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def execute(N, A):
    dst = 0
    for i in range(N-1):
        for j in range(i+1, N):

            dst += A[i] * A[j]

    return dst % (10**9+7)

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    print(execute(N, A))

Fixed submission:
def execute(N, A):
    dst = 0
    s = sum(A)
    for v in A:
        s -= v
        dst += v * s

    return dst % (10**9+7)

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    print(execute(N, A))
Buggy python submission (verdict: Time Limit Exceeded):
def execute(X, K, D):
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D

    return abs(X)

if __name__ == '__main__':
    X, K, D = map(int, input().split())
    print(execute(X, K, D))

Fixed submission:
def execute(X, K, D):
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D

    return abs(X)

def execute2(X, K, D):
    T = int(abs(X) / D)
    if X > 0:
        if K < T:
            return X - K * D
        else:
            Y = X - T * D
            if (K - T) % 2 == 0:
                return Y
            else:
                return D - Y
    else:
        if K < T:
            return (X + K * D) * -1
        else:
            Y = X + T * D
            if (K - T) % 2 == 0:
                return -1 * Y
            else:
                return D + Y


if __name__ == '__main__':
    X, K, D = map(int, input().split())
    print(execute2(X, K, D))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()

ans = N

for i in range(N):
    j = 0
    while True:
        if j == N or A[j] > A[i]:break
        if i != j and A[i] % A[j] == 0:
            ans -= 1
            break
        j += 1

print(ans)


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

M = 10**6 + 1

cnt = [0] * M

for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for b in range(a, M, a):
        cnt[b] += 1

ans = 0
for a in A:
    if cnt[a] == 1:ans += 1

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

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

ans = 1
for a in A:
    ans *= a

if ans > 10**18:
    ans = -1

print(ans)

Fixed submission:
N = int(input())

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

if 0 in A:
    print(0)
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            exit(0)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

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

for i in range(M):
    A, B = map(int, input().split())
    path[A].append(B)
    path[B].append(A)

ans = [0] * (N + 1)
ans[1] = 1
dst = [1]

while True:
    if len(dst) == 0:break
    tmp = []
    for d in dst:
        for a in path[d]:
            if ans[a] == 0:
                ans[a] = d
                for b in path[a]:
                    if ans[b] == 0:
                        tmp.append(a)

    dst = tmp

for a in ans[2:]:
    if a == 0:
        print('No')
        exit()

print('Yes')
for a in ans[2:]:
    print(a)


Fixed submission:
from collections import defaultdict, deque

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

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    path[A].append(B)
    path[B].append(A)

prev = [0] * N
dist = [0] * N
q = deque([0])

while (len(q) > 0):
    a = q.popleft()
    for b in path[a]:
        if dist[b] != 0:continue
        q.append(b)
        prev[b] = a
        dist[b] = dist[a] + 1

print('Yes')

for a in prev[1:]:
    a += 1
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
cnt = 0
for a in range(1,n):
    i = 1
    while a * i < n:
        if a * (i+1000000) < n:
            cnt += 1000000
            i += 1000000
        else:
            cnt += 1
            i += 1
    
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
for a in range(1,n):
    cnt += (n-1) // a
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
cnt = 0
for a in range(1,n):
    i = 1
    while a * i < n:
        cnt += 1
        i += 1
    
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
for a in range(1,n):
    cnt += (n-1) // a
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
cnt = 0
for a in range(1,n):
    for c in range(1,n-a+1):
        if ((n-c)/a) % 1 == 0:
            cnt += 1
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
for a in range(1,n):
    cnt += (n-1) // a
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
l = []
for i in range(len(t)):
    for j in range(i+1,len(t)+1):
        if t[i:j] in s[i:]:
            l.append(t[i:j])
l2 = []
for j in l:
    l2.append(len(j))
            
print(len(t) - max(l2))

Fixed submission:
s = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
    s2 = s[i:]
    cnt = 0
    for j in range(len(t)):
        if s2[j] == t[j]:
            cnt += 1
    l.append(cnt)
print(len(t)-max(l))
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int, input().split())
print(math.ceil(n/x)*t)

Fixed submission:
import math
n,x,t = map(int, input().split())
print(math.ceil(n/x)*t)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)

Fixed submission:
n = int(input())

if n%9 ==0:
    print("Yes")
else:
    print("No")

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

if n/9 == n//9:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())

if n%9 ==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(n-1):
    res += max(0,max(a[:-(i+1)])-a[-(i+1)])
print(res)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
res = 0
for i in range(n-1):
    res += max(0,max(a[:-(i+1)])-a[-(i+1)])
print(res)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
temp_max = 0
for x in a:
    if temp_max > x:
        res += temp_max - x
    temp_max = max(temp_max,x)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d = map(int, input().split())

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    i = 0
    while (d < x)&(i != k-1):
        x -= d
        i += 1
    if (k-i)%2 ==1:
        x -= d
else:
    i = 0
    while (-d > x)&(i != k-1):
        x += d
        i += 1
    if (k-i)%2 ==1:
        x += d

print(abs(x))

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

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d
else:
    if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d

print(abs(x))