Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline

# スタック最大数をセット
sys.setrecursionlimit(10**6)

h, w = map(int, input().split())
a = [[j == '#' for j in input()] for _ in range(h)]

queue = deque([(i, j, 0) for i in range(h)
               for j in range(w) if a[i][j]])

ans = 0

dx = (1, 0, 0, -1)
dy = (0, 1, -1, 0)


# def bfs(y, x, cnt):

# if (y < 0 or h <= y or x < 0 or w <= x or not a[y][x]):
#    return
#print(y, x, cnt)


while (queue):
    y, x, cnt = queue.popleft()
    # print(l)
    ans = max(ans, cnt)
    for ddx, ddy in zip(dx, dy):
        #print(ddx, ddy)
        if (0 <= y+ddy < h and 0 <= x+ddx < w and not a[y+ddy][x+ddx]):
            a[y+ddy][x+ddx] = True
            queue.append((y + ddy, x+ddx, cnt+1))
    # print(queue)
print(ans)

### FIXED CODE ###

from collections import deque
import copy
 
def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]
 
 
    # スタート地点をqueueに追加
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])
 
    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))
 
        if nque:
            que = copy.copy(nque)
        else:
            break
 
    print(count - 1)
 
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n = int(input())
ListP =[int(i) for i in input().split()]
points = 0
ListPos2 = [0] * (n + 1)
for i, a in enumerate(ListP):
	ListPos2[a] = i + 1
#print(ListPos2)
SetPos = {ListPos2[n]}
for i in reversed(range(1, n)):
	SetPos.add(ListPos2[i])
	ListPos = [0, 0] + sorted(SetPos) + [n+1, n+1]
	pos = ListPos.index(ListPos2[i])
	#print(SetDiff)
	#print(SetPos-SetDiff)
	#print(pos)
	#print(ListPos)
	low1 = ListPos[pos] - ListPos[pos-1]
	low2 = ListPos[pos-1] - ListPos[pos-2]
	high1 = ListPos[pos+1] - ListPos[pos]
	high2 = ListPos[pos+2] - ListPos[pos+1]
	points += i * (low1 * high2 + high1 * low2)
	#print(i, ListPos)
	#print(points, low1, high2, high1, low2)
print(points)

### FIXED CODE ###

n = int(input())
p = [int(i) for i in input().split()]

pos_list = [0] * n
for ind, i in enumerate(p):
	pos_list[i-1] = ind

left_nextInd = list(range(-1, n-1)) + [-1, -1]
right_nextInd = list(range(1, n+1)) + [n, n]

answer = 0
for i in range(1, n):
	ind = pos_list[i-1]
	l1 = left_nextInd[ind]
	l2 = left_nextInd[l1]
	r1 = right_nextInd[ind]
	r2 = right_nextInd[r1]

	answer += i * ((ind-l1) * (r2-r1) + (r1-ind) * (l1-l2))

	left_nextInd[r1] = l1
	right_nextInd[l1] = r1
print(answer)
### BUGGY CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue[0] + e
        queue.pop(0)
    else:
        tmp_ans += e
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)
### BUGGY CODE ###

def gcd(x,y):
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
N=int(input())
A=list(map(int,input().split(' ')))
ans = 0
l = 1
mod = 10**9+7
for i in A:
    g = gcd(l,i)
    l = l*i//g
for i in A:
    ans += l//i
    ans %=mod
print(ans)

### FIXED CODE ###

from fractions import gcd
N=int(input())
A=list(map(int,input().split(' ')))
ans = 0
l_1 = 1
l_2 = 1
mod = 10**9+7
def lcm(x,y):
    return x*y//gcd(x,y)
for i in A[:N//2]:
    l_1 = lcm(l_1,i)
for j in A[N//2:]:
    l_2 = lcm(l_2,j)
l = lcm(l_1,l_2)
out1 = sum([l_1//i for i in A[:N//2]])
out2 = sum([l_2//i for i in A[N//2:]])
out1 *= l//l_1
out2 *= l//l_2
print((out1+out2)%mod)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
for i in range(1,max(A)+1):
  print(A.count(i))
for j in range(max(A)+1,N+1):
  print(0)

### FIXED CODE ###

N = int(input())
A = map(int,input().split())
c=[]
for i in range (N):
  c.append(0)
for j in A:
  c[j-1]+=1

for C in c:
  print(C)
### BUGGY CODE ###

#coding: UTF-8
N=int(input())
lis=list(map(int, input().split()))
kind=list(set(lis))
kindn=len(kind)
out=0
for i in kind:
    if lis.count(i)%2==0:
        out+=1
if out%2==0:
    print(kindn)
else:
    print(kindn-1)

### FIXED CODE ###

#coding: UTF-8
import time
import collections
N=int(input())
lis=list(map(int, input().split()))
#kind=set(lis)
#kindn=len(kind)
kind_dict=collections.Counter(lis)
kindn=len(kind_dict)
out=0
for i in kind_dict:
    if kind_dict[i]%2==0:
        out+=1
if out%2==0:
    print(kindn)
else:
    print(kindn-1)
### BUGGY CODE ###

a,b,k = map(int,input().split())
list = list(l for l in range(a,b+1))
if b-a+1 < k*2:
  for i in range(a,b+1):
    print(i,end="\n")
else:
  for j in range(k):
    print(list[j],end="\n")
  for k in range(k-1,-1,-1):
    if k==0:
      k = -1
      print(list[k],end="\n")
    else:
      k = k*(-1)-1
      print(list[k],end="\n")

    

### FIXED CODE ###

a,b,k = map(int,input().split())
x = range(a,b+1) 
if b-a+1 < k*2:
  print(*x,sep="\n")
else:
  print(*x[:k],sep="\n")
  print(*x[-k:],sep="\n")
### BUGGY CODE ###

N = int(input())
p_list = list(map(float, input().split()))

dp = [[0]*(N+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(1, N+1):
    for j in range(i+1):
        dp[i][j] += dp[i-1][j] * (1-p_list[i-1])
        if j > 0:
            dp[i][j] += dp[i-1][j-1] * p_list[i-1]
ans = 0       
start = N//2 + 1
for p in dp[N][start:]:
    ans += p
print(ans)

### FIXED CODE ###

N = int(input())
p = list(map(float, input().split()))

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

for i in range(1, N+1):
    for j in range(i+1):
        prob = dp[i-1][j-1]*p[i-1]
        if i > 0:
            prob += dp[i-1][j]*(1.-p[i-1])
        dp[i][j] = max(dp[i][j], prob)
print(sum(dp[-1][N//2+1:]))
### BUGGY CODE ###

n = int(input())
ans = 1
for i in range(1, n + 1):
  ans *= i
print(ans % 1000000007)

### FIXED CODE ###

n = int(input())
ans = 1
for i in range(1, n + 1):
  ans = i * ans % 1000000007
print(ans)
### BUGGY CODE ###

import sys, heapq
input = sys.stdin.readline
n, q = map(int, input().split())
c = [int(x) for x in input().split()]


que = []
for i in range(q):
    l, r = map(int, input().split())
    heapq.heappush(que, (r, l, i))

bit = [0 for _ in range(n+1)]
def sum(i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= (i & -i)
    return s
def add(i, x):
    while i <= n:
        bit[i] += x
        i += (i & -i)


lastAppeared = [-1 for _ in range(n+1)]
ans = [None for _ in range(q)]
for i in range(1, n+1):
    if lastAppeared[c[i-1]] != -1:
        add(lastAppeared[c[i-1]], -1)
    lastAppeared[c[i-1]] = i
    add(i, 1)

    while len(que) > 0 and que[0][0] == i:
        r, l, x = heapq.heappop(que)
        ans[x] = sum(r)
        if l > 0:
            ans[x] -= sum(l-1)

    
print(*ans, sep='\n')


### FIXED CODE ###

import sys, heapq
input = sys.stdin.readline
n, q = map(int, input().split())
c = [int(x) - 1 for x in input().split()]

que = []
for i in range(q):
    l, r = map(int, input().split())
    que.append((l, r, i))



class SegTree(object):
    def __init__(self, n):
        self.BIT = [0] * (n + 1)
        self.num = n

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.BIT[i]
            i -= i & (-i)
        return s

    def add(self, i, x):
        while i <= self.num:
            self.BIT[i] += x
            i += i & (-i)
    

que.sort(key=lambda x: -x[1])
ans = [None] * q
last = [-1] * n
BIT = SegTree(n)

for i in range(1, n+1):
    if last[c[i-1]] != -1:
        BIT.add(last[c[i-1]], -1)
    last[c[i-1]] = i
    BIT.add(i, 1)

    while que and que[-1][1] == i:
        l, r, x = que.pop()
        ans[x] = BIT.sum(r) - BIT.sum(l-1)

print(*ans, sep='\n')
### BUGGY CODE ###

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

A.sort()
tmp = A.pop(-1)
index = 0
for _ in range(M):
  tmp //= 2
  if tmp == 0:
    if len(A) == 0:
      break
    tmp = A.pop(-1)
  if len(A) > 1 and tmp < A[-1]:
    A.append(tmp)
    tmp = A.pop(-2)
    A.sort()
A.append(tmp)

print(sum(A))

### FIXED CODE ###

import heapq

def minus_int(s):
  return -1 * int(s)

N, M = map(int, input().split())
A = list(map(minus_int, input().split()))
heapq.heapify(A)
for _ in range(M):
  tmp = int(heapq.heappop(A) / 2)
  heapq.heappush(A, tmp)

print(sum(A) * (-1))
### BUGGY CODE ###

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


k = int(input())

ans = 0

for i in range(k + 1):
    for j in range(k + 1):
        for n in range(k + 1):
            if i == 0 or j == 0 or n == 0:
                continue
            ans += gcd(gcd(i, j), n)

print(ans)


### FIXED CODE ###

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

k = int(input())
res = [0] * (k + 1)

ans = 0

for i in range(1, k + 1):
    for j in range(1, k + 1):
        res[gcd(i, j)] += 1

for n in range(1, k + 1):
    for r in range(1, k + 1):
        ans += gcd(r, n) * res[r]

print(ans)
### BUGGY CODE ###

R, C, K = map(int, input().split())
RC = [[0] * C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    RC[r-1][c-1] = v


def solve():
    memo = [[[0] * 4 for _ in range(C+1)] for _ in range(R+1)]
    for r in range(1,R+1):
        for c in range(1,C+1):
            v = RC[r-1][c-1]
            memo[r][c][0] = max(memo[r-1][c][3], memo[r][c-1][0])
            memo[r][c][1] = max(memo[r][c][0] + v, memo[r][c-1][1])
            memo[r][c][2] = max(memo[r][c][1], memo[r][c-1][1] + v, memo[r][c-1][2])
            memo[r][c][3] = max(memo[r][c][2], memo[r][c-1][2] + v, memo[r][c-1][3])
    return memo[-1][-1][3]

if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

R, C, K = map(int, input().split())
RC = [[0] * C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    RC[r-1][c-1] = v


def solve():
    memo = [[0] * 4 for _ in range(C+1)]
    prev = [[0] * 4 for _ in range(C+1)]
    for r in range(1,R+1):
        prev, memo = memo, prev
        for c in range(1,C+1):
            v = RC[r-1][c-1]
            memo[c][0] = max(prev[c][3], memo[c-1][0])
            memo[c][1] = max(memo[c][0] + v, memo[c-1][1])
            memo[c][2] = max(memo[c][1], memo[c-1][1] + v, memo[c-1][2])
            memo[c][3] = max(memo[c][2], memo[c-1][2] + v, memo[c-1][3])
    return memo[-1][3]

if __name__ == "__main__":
    print(solve())
### BUGGY CODE ###

import sys


class Unionfindtree:
    def __init__(self, number):
        self.par = [i for i in range(number)]
        self.rank = [0] * (number)

    def find(self, x):  # 親を探す
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):  # x,yを繋げる
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        if self.rank[px] < self.rank[py]:
            self.par[px] = py
        else:
            self.par[py] = px
        if self.rank[px] == self.rank[py]:
            self.rank[px] += 1

    def connect(self, x, y):  # 親が同じかみる
        return self.find(x) == self.find(y)


N,M=map(int,input().split())
K=[set() for i in range(M)]
tree=Unionfindtree(N)
for i in range(N):
    L=[int(i)-1 for i in input().split()]
    for m in L[1:]:
        K[m].add(i)
for i in range(M):
    Ki=list(K[i])
    for h in range(len(Ki)):
        for m in range(h+1,len(Ki)):
            tree.union(Ki[h],Ki[m])
for i in range(N):
    if not tree.connect(0,i):
        print('NO')
        sys.exit()
print('YES')




### FIXED CODE ###

import sys


class Unionfindtree:
    def __init__(self, number):
        self.par = [i for i in range(number)]
        self.rank = [0] * (number)

    def find(self, x):  # 親を探す
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):  # x,yを繋げる
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        if self.rank[px] < self.rank[py]:
            self.par[px] = py
        else:
            self.par[py] = px
        if self.rank[px] == self.rank[py]:
            self.rank[px] += 1

    def connect(self, x, y):  # 親が同じかみる
        return self.find(x) == self.find(y)


N,M=map(int,input().split())
K=[set() for i in range(M)]
tree=Unionfindtree(N)
for i in range(N):
    L=[int(i)-1 for i in input().split()]
    for m in L[1:]:
        K[m].add(i)
for i in range(M):
    Ki=list(K[i])
    if len(Ki)==0:
        continue
    for h in range(len(Ki)):
        tree.union(Ki[h],Ki[0])
for i in range(N):
    if not tree.connect(0,i):
        print('NO')
        sys.exit()
print('YES')
### BUGGY CODE ###

N = int(input())
C = input()
C = C.lstrip('R').rstrip('W')

i = 0
while len(C) > 0:
    l = C.index('R')
    r = C[::-1].index('W')
    n = min(l, r)
    C = C[n:]
    C = C[:-n]
    C = C.lstrip('R').rstrip('W')
    i += n
else:
    print(i)

### FIXED CODE ###

N = int(input())
C = input()

l, r = 0, N - 1
ans = 0
while l < r:
    if C[l] == 'R':
        l += 1
    elif C[r] == 'W':
        r -= 1
    else:
        ans += 1
        l += 1
        r -= 1
print(ans)
### BUGGY CODE ###

dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1),        ( 1, 1),( 1, 2),
( 0,-2),                        ( 0, 2),
(-1,-2),(-1,-1),        (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]

H, W = map(int, input().split())
sh, sw = map(lambda x:int(x)-1, input().split())
eh, ew = map(lambda x:int(x)-1, input().split())
S = [input() for _ in range(H)]

dst = [[-1]*W for _ in range(H)]

from collections import deque
dq = deque([(sh, sw, 0)])
while dq:
    h, w, d = dq.popleft()
    # if 0 <= h < H and 0 <= w < W and dst[h][w] < 0 and S[h][w] != '#':
    if dst[h][w] < 0 and S[h][w] != '#':
        dst[h][w] = d
    else:
        continue
    for i in range(4):
        nh = h + dhw[i][0]; nw = w + dhw[i][1]
        if 0 <= nh < H and 0 <= nw < W and dst[nh][nw] < 0 and S[nh][nw] != '#':
            dq.appendleft((nh, nw, d))
    for i in range(4, 24):
        nh = h + dhw[i][0]; nw = w + dhw[i][1]
        if 0 <= nh < H and 0 <= nw < W and dst[nh][nw] < 0 and S[nh][nw] != '#':
            dq.append((nh, nw, d+1))

print(dst[eh][ew])


### FIXED CODE ###

dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1),        ( 1, 1),( 1, 2),
( 0,-2),                        ( 0, 2),
(-1,-2),(-1,-1),        (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]

H, W = map(int, input().split())
sh, sw = map(lambda x:int(x)-1, input().split())
eh, ew = map(lambda x:int(x)-1, input().split())
S = [input() for _ in range(H)]

dst = [[-1]*W for _ in range(H)]

from collections import deque
dq = deque([(sh, sw, 0)])
while dq:
    h, w, d = dq.popleft()
    if 0 <= h < H and 0 <= w < W and dst[h][w] < 0 and S[h][w] != '#':
        dst[h][w] = d
    else:
        continue
    for i in range(4): dq.appendleft((h + dhw[i][0], w + dhw[i][1], d))
    for i in range(4, 24): dq.append((h + dhw[i][0], w + dhw[i][1], d+1))

print(dst[eh][ew])
### BUGGY CODE ###

print(sum([_ for _ in range(int(input()))]))

### FIXED CODE ###

N=int(input())
print(int((N-1)*N//2))
### BUGGY CODE ###

import numpy as np
N = int(input())
P = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if np.min(P[:i+1]) == P[i]:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

smallest_so_far = float("inf")
cnt = 0

for the_num in P:
    if the_num < smallest_so_far :
        smallest_so_far = the_num
        cnt += 1
print(cnt)
### BUGGY CODE ###

n=int(input())
p=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(i+1)
if p[0]==1:
  print(1)
else:
  ans=0
  k=l.index(1)
  for i in range(n):
    if p[n-i-1]==l[0]:
      ans+=1
      l.remove(l[0])
    else:
      l.remove(p[n-i-1])
  print(ans)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(i+1)
if p[0]==1:
  print(1)
else:
  ans=0
  k=float('inf')
  for i in range(n):
    if p[i]<=k:
        k=p[i]
        ans+=1
  print(ans)
### BUGGY CODE ###

a,b,x = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    if i%x ==0:
        cnt += 1
print(cnt)

### FIXED CODE ###

a,b,x = map(int,input().split())
import math
def func(n):
    if n >=0:
        return n//x+1
    if n ==-1:
        return 0
print(func(b)-func(a-1))
### BUGGY CODE ###

import collections

n = int(input())
aa = []

for i in range(n):
  s = sorted(input())
  s = [''.join(s)]
  aa.append(*s)

cc = collections.Counter(aa)
c = [c[1] for c in cc.items() if c[1] >1]

def fact(n):
  x = 1
  for i in range(1, n+1):
    x *= i
  return x

def comb(n):
  return fact(n) / ( 2 * fact((n-2)))


ans = 0
for i in range(len(c)):
  ans += comb(c[i])
  

print(int(ans))

### FIXED CODE ###

import collections

from scipy.special import comb


n = int(input())
aa = []

for i in range(n):
  s = sorted(input())
  s = [''.join(s)]
  aa.append(*s)

cc = collections.Counter(aa)
c = [c[1] for c in cc.items() if c[1] >1]

ans = 0
for i in range(len(c)):
  ans += comb(c[i], 2, exact=True)
  

print(int(ans))
### BUGGY CODE ###

n, m, k = map(int , input().split())
dif = set([i for i in range(1, n+1)])
m_list = [[] for _ in range(n+1)]
uni = [i for i in range(n+1)]
ab = sorted([list(map(int, input().split())) for _ in range(m)])
cd = [list(map(int, input().split())) for _ in range(k)]
for i in range(m):
    a, b = ab[i]
    m_list[a].append(b)
    m_list[b].append(a)
    a, b = sorted([a, b])
    for j in range(1, n+1):
        if uni[j] == uni[b]:
            uni[j] = uni[a]
    uni[b] = uni[a]

k_list = [[] for _ in range(n+1)]
for i in range(k):
    a, b = cd[i]
    k_list[a].append(b)
    k_list[b].append(a)


result = [0 for i in range(n+1)]
for i in range(1, n+1):
    r = dif - set(m_list[i])
    r = r - set(k_list[i])
    r = r - set([i])
    for j in list(r):
        if uni[j] == uni[i]:
            result[i] += 1

print(*result[1:])

### FIXED CODE ###

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


n, m, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n+1)]
uni = UnionFind(n+1)


for i in range(m):
    a, b = ab[i]
    con[a] += 1
    con[b] += 1
    uni.Unite(a, b)

for i in range(k):
    c, d = cd[i]
    if uni.isSameGroup(c,d):
        con[c] += 1
        con[d] += 1

result = []
for i in range(1, n+1):
    result.append(uni.Count(i)-con[i])
print(*result)
### BUGGY CODE ###

n = int(input())
T = []
for _ in range(n-1):
    T += [list(map(int, input().split()))]
T.sort()
P = [0]+[-1]*(n-1)
b = n-1
while b > 0:
    for u, v, w in T:
        pu, pv = P[u-1], P[v-1]
        if (pu >= 0) & (pv < 0):
            P[v-1] = (pu+(w%2))%2
            b -= 1
        if (pv >= 0) & (pu < 0):
            P[u-1] = (pv+(w%2))%2
            b -= 1
for p in P: print(p)


### FIXED CODE ###

n = int(input())
L = [[] for _ in range(n+1)]
R = [[] for _ in range(n+1)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    w %= 2
    L[u] += [[u, v, w]]
    R[v] += [[v, u, w]]
P = [[] for _ in range(2*n+2)]
P[1] += (L[1]+R[1])
L[1] = R[1] = []
for i in range(1, 2*n):
    for _, v, w in P[i]:
        P[i+2-w] += (L[v]+R[v])
        L[v] = R[v] = []
A = []
for p in P[1::2]: A += p
B = set([u for u, *_ in A])
for i in range(1, n+1): print(1 if i in B else 0)
### BUGGY CODE ###

p = 1
for i in range(int(input())):
    p *= (i + 1)
print(p % (10**9 + 7))


### FIXED CODE ###

p = 1
for i in range(int(input())):
    p = ((i + 1)*p) % (10**9 + 7)
print(p)
### BUGGY CODE ###

k = int(input())
val = 7
if k%2 == 0:
    ans = -1
else:
    for i in range(1,10**12+1):
        sub = val % k
        if sub == 0:
            ans = i
            break
        else:
            val = 10 * sub + 7
print(ans)

### FIXED CODE ###

k = int(input())
val = 7
if k%2 == 0:
    ans = -1
elif k%5 == 0:
    ans = -1
else:
    for i in range(1,10**12+1):
        if val >= k:
            sub = val % k
            if sub == 0:
                  ans = i
                  break
            else:
                  val = 10 * sub + 7
        else:
            val = 10 * val + 7
print(ans)
### BUGGY CODE ###

import math


def make_divisors(n):
    d = 0
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i != 0:
            continue
        if i * i == n:
            d += 1
        else:
            d += 2
    return d


def f(n):
    return sum(make_divisors(n - i) for i in range(1, n))


def f2(n):
    d = 0
    c = 0
    for i in range(1, n):
        e = 0
        if i * i == n:
            e -= 1
        elif n % i == 0:
            e -= 1
        e += n // i
        d += e

    return d

def main():
    print(f(int(input())))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


def f2(n):
    d = 0
    c = 0
    for i in range(1, n):
        e = 0
        if i * i == n:
            e -= 1
        elif n % i == 0:
            e -= 1
        e += n // i
        d += e

    return d

def main():
    print(f2(int(input())))


if __name__ == '__main__':
    main()