Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def memoize(f):
    table = dict()
    def wrapper(x, i, a):
        key = (x, i)
        if key in table:
            return table[key]
        else:
            v = f(x, i, a)
            table[key] = v
            return v
    return wrapper

@memoize
def solve(x, i, a):
    if i == len(a) - 1:
        if a[i] == x:
            return 1
        else:
            return 0

    if x < a[i]:
        return 0
    else:
        m = solve(x - a[i], i + 1, a) + 1
        n = solve(x, i + 1, a)
        return max(m, n)

def main():
    n, x = [int(s) for s in input().split()]
    a = tuple(sorted(int(s) for s in input().split()))

    print(solve(x, 0, a))

main()


Fixed submission:
def main():
    n, x = [int(s) for s in input().split()]
    a = [int(s) for s in input().split()]
    a.sort()

    cnt = 0
    for i, y in enumerate(a):
        if x < y:
            break
        x -= y
        cnt += 1
    else:
        # distribute to all child
        if x != 0:
            cnt -= 1
    print(cnt)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def memoize(f):
    table = dict()
    def wrapper(x, a):
        key = (x, a)
        if key in table:
            return table[key]
        else:
            v = f(x, a)
            table[key] = v
            return v
    return wrapper

@memoize
def solve(x, a):
    if len(a) == 0:
        return 0

    if len(a) == 1:
        if a[0] == x:
            return 1
        else:
            return 0

    if x < a[0]:
        return solve(x, a[1:])
    else:
        m = solve(x - a[0], a[1:]) + 1
        n = solve(x, a[1:])
        return max(m, n)

def main():
    n, x = [int(s) for s in input().split()]
    a = tuple(int(s) for s in input().split())

    print(solve(x, a))

main()


Fixed submission:
def main():
    n, x = [int(s) for s in input().split()]
    a = [int(s) for s in input().split()]
    a.sort()

    cnt = 0
    for i, y in enumerate(a):
        if x < y:
            break
        x -= y
        cnt += 1
    else:
        # distribute to all child
        if x != 0:
            cnt -= 1
    print(cnt)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def solve(x, a):
    if len(a) == 0:
        return 0

    if len(a) == 1:
        if a[0] == x:
            return 1
        else:
            return 0

    if x < a[0]:
        return solve(x, a[1:])
    else:
        m = solve(x - a[0], a[1:]) + 1
        n = solve(x, a[1:])
        return max(m, n)

def main():
    n, x = [int(s) for s in input().split()]
    a = [int(s) for s in input().split()]

    print(solve(x, a))

main()


Fixed submission:
def main():
    n, x = [int(s) for s in input().split()]
    a = [int(s) for s in input().split()]
    a.sort()

    cnt = 0
    for i, y in enumerate(a):
        if x < y:
            break
        x -= y
        cnt += 1
    else:
        # distribute to all child
        if x != 0:
            cnt -= 1
    print(cnt)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    t = input()

    if is_match_swith_rotation(s, t):
        print('Yes')
    else:
        print('No')

def is_match_swith_rotation(s, t):
    end = l = len(t)
    while end != 0:
        try:
            pos = s.rfind(t[0], 0, end)
        except ValueError:
            return False
        if s[pos:] == t[:l-pos] and s[:pos] == t[l-pos:]:
            return True
        end = pos

    return False

main()

Fixed submission:
def main():
    s = input()
    t = input()

    if is_match_swith_rotation(s, t):
        print('Yes')
    else:
        print('No')

def is_match_swith_rotation(s, t):
    if t in s + s:
        return True
    else:
        return False

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    t = input()

    if is_match_swith_rotation(s, t):
        print('Yes')
    else:
        print('No')

def is_match_swith_rotation(s, t):
    end = len(t)
    while end != 0:
        try:
            pos = s.rfind(t[0], 0, end)
        except ValueError:
            return False
        if s[pos:] + s[:pos] == t:
            return True
        end = pos

    return False

main()

Fixed submission:
def main():
    s = input()
    t = input()

    if is_match_swith_rotation(s, t):
        print('Yes')
    else:
        print('No')

def is_match_swith_rotation(s, t):
    if t in s + s:
        return True
    else:
        return False

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(resolve(a))

def resolve(a):
    cnt = 0

    for i in range(len(a)):
        cnt += resolve_1(a, i)
    
    return cnt

def resolve_1(a, l):
    cnt = 1
    x = a[l]
    y = a[l]

    for i in range(l + 1, len(a)):
        x = x ^ a[i]
        y = y + a[i]
        if x != y:
            break
        cnt += 1
    
    return cnt


main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(resolve(a))

def resolve(a):
    cnt = 0
    base = 0
    skip = 0

    for i in range(len(a)):
        c, base = resolve_1(a, i, skip, base)

        skip = c - 1
        base = base ^ a[i]
        cnt += c

    
    return cnt

def resolve_1(a, i, skip, base):
    cnt = skip

    for j in range(i + skip, len(a)):
        if a[j] & base != 0:
            break
        
        cnt += 1
        base |= a[j]

    return (cnt, base)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    print(solve(a))

def solve(a):
    peaks = find_peaks(a)
    if all(check_peak(a, p) for p in peaks):
        return sum(a[p] for p in peaks)
    else:
        return -1

def check_peak(a, peak):
    if a[peak] > peak:
        return False
    
    base = peak - a[peak]
    for i in range(a[peak]):
        if a[base + i] < i:
            return False
    
    return True

def find_peaks(a):
    peaks = []

    for i in range(len(a) - 1):
        if a[i] != 0 and a[i + 1] <= a[i]:
            peaks.append(i)
    
    if a[len(a) - 1] != 0:
        peaks.append(len(a) - 1)
    
    return peaks

main()

Fixed submission:
import bisect

def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    a.append(0)
    ans = solve(a, n)
    print(ans)

def solve(a, n):
    if not check(a, n):
        return -1

    base = 0
    s = 0
    for i in range(n):
        if a[i] > base + i:
            return -1
        
        if a[i + 1] <= a[i]:
            s += a[i]
        
        base = i - a[i]
    
    return s

def check(a, n):
    if a[0] != 0:
        return False
    
    for i in range(1, n):
        if a[i] - a[i - 1] > 1:
            return False

    return True

main()
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())

s = set()
i = a
while i < b and i < a + k:
    s.add(i)
    i += 1

i = b
while i >= a and i > b - k:
    s.add(i)
    i -= 1

for x in sorted(s):
    print(x)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
blue = Counter(input() for _ in range(n))
m = int(input())
red = Counter(input() for _ in range(m))
c = (blue - red).most_common(1)

print(max(c[0][1], 0))

Fixed submission:
from collections import Counter

n = int(input())
blue = Counter(input() for _ in range(n))
m = int(input())
red = Counter(input() for _ in range(m))
c = (blue - red).most_common(1)

if c:
  print(max(c[0][1], 0))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
input()
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum(c[::2])
b = sun(c[1::2])
print(a - b)

Fixed submission:
input()
c = list(map(int, input().split()))
c.sort(reverse=True)
a = sum(c[::2])
b = sum(c[1::2])
print(a - b)
Buggy python submission (verdict: Runtime Error):
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][1] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

main()


Fixed submission:
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][0] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

main()
Buggy python submission (verdict: Runtime Error):
def issigit(s):
  return all(c in '0123456789' for c in s)

def check(s, a, b):
  if len(s) != a + b + 1:
    return False
  
  if not isdigit(s[:a]):
    return False
  
  if s[a] != '-':
    return False
  
  if not isdigit(s[-b:]):
    return False
  
  return True
  
a, b = map(int, input().split())
s = input()
if check(s, a, b):
  print('Yes')
else:
  print('No')


Fixed submission:
def isdigit(s):
  return all(c in '0123456789' for c in s)

def check(s, a, b):
  if len(s) != a + b + 1:
    return False
  
  if not isdigit(s[:a]):
    return False
  
  if s[a] != '-':
    return False
  
  if not isdigit(s[-b:]):
    return False
  
  return True
  
a, b = map(int, input().split())
s = input()
if check(s, a, b):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
from math import ceil, sqrr

n = int(input())
print(ceil(sqrt(n)) ** 2)

Fixed submission:
n = int(input())
lo, hi = 1, n

while hi - lo > 1:
  x = (hi + lo) // 2
  if x * x > n:
    hi = x
  else:
    lo = x

print(lo * lo)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    b = [int(s) for s in input().split()]
    c = [int(s) for s in input().split()]
    print(solve(n, a, b, c))

def solve(n, a, b, c):
    d = [c, b, a]
    dp = []
    dp.append([1 for _ in range(n)])
    dp.append([0 for _ in range(n)])
    dp.append([0 for _ in range(n)])

    for i in range(1, 3):
        for j in range(n):
            dp[i][j] = sum(dp[i-1][k] for k in range(n) if d[i-1][k] > d[i][j])

    return sum(dp[2])


def ilen(it):
    c = 0
    for _ in it:
        c += 1
    return c

main()


Fixed submission:
import bisect

def main():
    n = int(input())
    a = sorted([int(s) for s in input().split()])
    b = sorted([int(s) for s in input().split()])
    c = sorted([int(s) for s in input().split()])
    print(solve(n, a, b, c))

def solve(n, a, b, c):
    d = [c, b, a]
    dp = []
    dp.append([n - i for i in range(n)])
    dp.append([0 for _ in range(n)])
    dp.append([0 for _ in range(n)])

    for i in range(1, 3):
        for j in reversed(range(n)):
            k = bisect.bisect(d[i-1], d[i][j])
            if k == n:
                continue

            dp[i][j] = dp[i-1][k]
            if j != n - 1:
                dp[i][j] += dp[i][j+1]

    return dp[2][0]


def ilen(it):
    c = 0
    for _ in it:
        c += 1
    return c

main()
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    print(solve(t))

def solve(t):
    return reduce(lcm, t, 1)

def lcm(a, b):
    return a * b // gcd(a, b)

main()


Fixed submission:
from functools import reduce

def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    print(solve(t))

def solve(t):
    return reduce(lcm, t, 1)

def lcm(a, b):
    return a * b // gcd(a, b)

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

main()
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum[:k])

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[:k]))
Buggy python submission (verdict: Runtime Error):
input()
a = map(int, input().split())
print(max(a) - min(a))

Fixed submission:
input()
a = list(map(int, input().split()))
print(max(a) - min(a))
Buggy python submission (verdict: Time Limit Exceeded):
M = 10 ** 9 + 7

def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    print(solve(a, n))

def solve(a, n):
    if n % 2 == 0:
        for i in range(1, n, 2):
            if a.count(i) != 2:
                return 0
    else:
        if a.count(0) != 1:
            return 0
        for i in range(2, n, 2):
            if a.count(i) != 2:
                return 0

    return modpow(2, n // 2, M)

def modpow(a, b, m):
    r = 1

    while b != 0:
        if b & 0x01:
            r = (r * a) % m
        a = (a * a) % m
        b >>= 1

    return r

main()


Fixed submission:
from collections import Counter

M = 10 ** 9 + 7

def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    print(solve(a, n))

def solve(a, n):
    counter = Counter(a)

    if n % 2 == 0:
        for i in range(1, n, 2):
            if counter.get(i, None) != 2:
                return 0
    else:
        if counter.get(0, None) != 1:
            return 0
        for i in range(2, n, 2):
            if counter.get(i, None) != 2:
                return 0

    return modpow(2, n // 2, M)

def modpow(a, b, m):
    r = 1

    while b != 0:
        if b & 0x01:
            r = (r * a) % m
        a = (a * a) % m
        b >>= 1

    return r

main()
Buggy python submission (verdict: Runtime Error):
from collections import deque

m = [deque(input()) for _ in range(3)]
t = 0

while True:
  n = m[t].popleft()
  if not m[t]:
    print('ABC'[t])
    break
  t = n

Fixed submission:
from collections import deque

m = [deque(input()) for _ in range(3)]
t = 0

while True:
  if len(m[t]) == 0:
    print('ABC'[t])
    break
  
  t = 'abc'.find(m[t].popleft())
Buggy python submission (verdict: Runtime Error):
s = input()
m = []

for c in s:
  if c == 'B':
    if s:
      m.pop()
  else:
    m.append(c)

print(''.join(m))

Fixed submission:
s = input()
m = []

for c in s:
  if c == 'B':
    if m:
      m.pop()
  else:
    m.append(c)

print(''.join(m))
Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N = int(input())
ans = 0
for i in range(1, N):
    le = prime_factorize(N - i)
    if len(le) == len(set(le)):
        ans += pow(2, len(le))
    else:
        w = []
        p = 1
        for x in set(le):
            if le.count(x) > 1:
                w.append(x)
                p *= le.count(x) + 1
        ans += pow(2, len(set(le)) - len(w))*p
print(ans)

Fixed submission:
import math
N = int(input())
ans = 0
ve = math.floor(math.sqrt(N))
for st in range(ve):
    tmp = math.floor(N/(st+1)-0.000001)
    score = 2*(tmp - st)
    if score > 0:
        score -= 1
    ans += score
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = list(map(int, input().split()))
co = 0
ans = abs(X)
while abs(ans) > D/2 and (K - co) > 0:
    ans = abs(ans) - D
    co += 1
if (K - co) % 2 == 0:
    print(abs(ans))
else:
    ans = abs(ans) - D
    print(abs(ans))

Fixed submission:
X,K,D = list(map(int, input().split()))
co,ans = divmod(abs(X),D)
if (K - co) > 0:
    if (K - co) % 2 == 0:
        pass
    else:
        ans = abs(ans) - D
else:
    ans = abs(X) - K*D

print(abs(ans))

Buggy python submission (verdict: Runtime Error):
X,K,D = [int(input()) for i in range(3)]
print(2)

Fixed submission:
X,K,D = list(map(int, input().split()))
co,ans = divmod(abs(X),D)
if (K - co) > 0:
    if (K - co) % 2 == 0:
        pass
    else:
        ans = abs(ans) - D
else:
    ans = abs(X) - K*D

print(abs(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N >= 1000:
    a = N - 1000
else:
    a = a
while a >= 1000:
    a = a - 1000
if a != 0:
    a = 1000 - a
print(a)

Fixed submission:
N = int(input())
a = 0
if N >= 1000:
    a = N - 1000
else:
    a = N
while a >= 1000:
    a = a - 1000
if a != 0:
    a = 1000 - a
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
        N = int(input())
        A = list(map(int, input().split()))
        ans = 1

        for i in range(N):
                ans = ans*A[i]

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

        return ans


if __name__=="__main__":
        ans = main()
        print(ans)

Fixed submission:
def main():
        N = int(input())
        A = list(map(int, input().split()))
        ans = 1

        if 0 in A:
                ans = 0
        else:
                for i in range(N):
                        ans = ans*A[i]
                        if ans>10**18:
                                ans = -1
                                break

        return ans


if __name__=="__main__":
        ans = main()
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
        N = int(input())
        A = list(map(int, input().split()))

        l = []

        for i in range(N-1):
                if i+1 in A:
                        l.append(A.count(i+1))
                else:
                        l.append(0)
        l.append(0)


        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = []

        for i in range(N-1):
                l.append(A.count(i+1))
        l.append(0)

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = []

        for i in range(N-1):
                l.append(A.count(i+1))
        l.append(0)

        [print(n) for n in l]

if __name__=="__main__":
        main()

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = []

        for i in range(N-1):
                l.append(A.count(i+1))
                print(l[i])
        l.append(0)
        print(l[N-1])

if __name__=="__main__":
        main()

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()

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

        l = [0]*N

        for i in range(N-1):
                l[i] = A.count(i+1)
                print(l[i])
        print(l[N-1])

if __name__=="__main__":
        main()

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()
Buggy python submission (verdict: Time Limit Exceeded):
import math

def main():
        K = int(input())

        sum = 0

        for a in range(K):
                for b in range(K):
                        for c in range(K):
                                sum += math.gcd(math.gcd(a+1,b+1),c+1)

        print("{}".format(sum))

if __name__=="__main__":
        main()

Fixed submission:
import math

def main():
        K = int(input())

        total = 0

        for a in range(1,K+1):
                if a==1:
                        total += 1*K*K
                else:
                        for b in range(1,K+1):
                                if b==1:
                                        total += 1*K
                                else:
                                        for c in range(1,K+1):
                                                total += math.gcd(math.gcd(a,b),c)

        print("{}".format(total))

if __name__=="__main__":
        main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
        N, K = map(int, input().split())
        # K: fixed

        ans = 0

        if N%K==0:
                ans = 0
        else:
                if N>=K:
                        temp = K
                        while temp<N:
                                temp += K
                        upper = temp-N
                        lower = abs(upper-K)
                        ans = min(upper, lower)
                else:
                        ans = min(N, K-N)

        print("{}".format(ans))

if __name__=="__main__":
        main()

Fixed submission:
def main():
        N, K = map(int, input().split())
        # K: fixed
        ans = 0
        r = N%K

        if N%K==0:
                ans = 0
        else:
                ans = min(r, abs(r-K))

        print("{}".format(ans))

if __name__=="__main__":
        main()
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if (a>=0) and (b>=0) and (c>=0) and (d>=0):
    ans=b*d
elif (b<=0) and (d<=0):
    ans=a*c
elif (a<=0) and (b>=0) and (c<=0) and (d>=0):
    tmp1=a*c
    tmp2=b*d
    if tmp1>tmp2:
        ans=tmp1
    else:
        ans=tmp2
elif (a>=0) and (b>=0) and (d<=0):
    ans=a*d
elif (c>=0) and (d>=0) and (b<=0):
    ans=b*c
elif (a<=0) and (b>=0) and (c<=0) and (d<=0):
    ans=a*c
elif (a<=0) and (b<=0) and (c<=0) and (d>=0):
    ans=a*c
print(ans)

Fixed submission:
a, b, c, d = map(int, input().split())
if (a>=0) and (b>=0) and (c>=0) and (d>=0): #A
    ans=b*d
elif (b<=0) and (d<=0):#E
    ans=a*c
elif (a<=0) and (b>=0) and (c<=0) and (d>=0):#F
    tmp1=a*c
    tmp2=b*d
    if tmp1>tmp2:
        ans=tmp1
    else:
        ans=tmp2
elif (a>=0) and (b>=0) and (d<=0):#H
    ans=a*d
elif (c>=0) and (d>=0) and (b<=0):#C
    ans=b*c
elif (a<=0) and (b>=0) and (c<=0) and (d<=0):#I
    ans=a*c
elif (a<=0) and (b<=0) and (c<=0) and (d>=0):#D
    ans=a*c
elif (a>=0) and (b>=0) and (c<=0) and (d>=0):#G
    ans=b*d
elif (a<=0) and (b>=0) and (c>=0) and (d>=0):#B
    ans=b*d
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 1
b = 1
c = 1
cnt = 0
while n > a:
    while a * b < n:
        cnt += 1
        b += 1
    b = 1
    a += 1

print(cnt)

Fixed submission:
n = int(input())
a = 1
cnt = 0
while n > a:
    cnt += (n-1) // a
    a += 1

print(cnt)