Harryxun/stf_run huggingface dataset:
import math
import itertools

n,m,q = map(int,input().split())
li=[input() for i in range(q)]

ans_list=list()
ans=0

lis =  list(range(1,m+1))
for team in itertools.combinations(lis, n):

    for i in range(q):
      lix=li[i].split()
      
      if team[int(lix[1])-1]-team[int(lix[0])-1]==int(lix[2]):
        ans+=int(lix[3])
        
    ans_list+=[ans]
    ans=0
      
    
    
print(max(ans_list))


### FIXED CODE ###

import math
import itertools

n,m,q = map(int,input().split())
li=[input() for i in range(q)]

ans_list=list()
ans=0
xans=0

lis =  list(range(1,m+1))
for team in itertools.combinations_with_replacement(lis,n):
  
    for i in range(q):
      
      lix=li[i].split()
      
      if team[int(lix[1])-1]-team[int(lix[0])-1]==int(lix[2]):
        ans=int(lix[3])
        xans+=ans
        
       
        
    ans_list+=[xans]
    xans=0
      
    
    
print(max(ans_list))
n, k = map(int, input().split())

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

print(len(links))
for link in links:
  print(link[0], link[1])

### FIXED CODE ###

n, k = map(int, input().split())

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

  print(len(links))
  for link in links:
    print(link[0], link[1])
N,M = map(int,input().split())
a=[]
for _ in range(M):
    a.append(int(input()))
    
kaidan = [1, 2]

for i in range(2, N):
  kaidan.append(kaidan[i-1]+ kaidan[i-2])

ans = 1

if a[0] - 1 > 0:
    ans *= kaidan[a[0] - 2]
  
for i in range(M-1):
  if((a[i] + 1) > (a[i+1] - 1)):
    ans *= 0
  else:
    ans *= (kaidan[a[i+1] - a[i] - 3])

if N - (a[M - 1] + 1) > 0:
    ans *= kaidan[N - (a[M - 1] + 2)]
print(ans%1000000007)
  

### FIXED CODE ###

N,M = map(int,input().split())
a=[]
for _ in range(M):
    a.append(int(input()))
    
kaidan = [1, 2]

for i in range(2, N):
  kaidan.append(kaidan[i-1]+ kaidan[i-2])

if M == 0:
  ans = kaidan[N - 1]
else:
  ans = 1

  if a[0] - 1 > 0:
      ans *= kaidan[a[0] - 2]

  for i in range(M-1):
    if((a[i] + 1) > (a[i+1] - 1)):
      ans *= 0
    elif((a[i] + 1) == (a[i+1] - 1)):
      ans *= 1
    else:
      ans *= (kaidan[a[i+1] - a[i] - 3])

  if N - (a[M - 1] + 1) > 0:
      ans *= kaidan[N - (a[M - 1] + 2)]
      
print(ans%1000000007)
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

A,B=map(int,input().split())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')
import collections
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]

dis = [[-1]*W for i in range(H)]
black = set()
white = set()

start = [-1, -1]

for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            start[0] = i
            start[1] = j

            break
    if start[0] != -1:
        break


dp = [[10**9]*W for i in range(H)]


q = collections.deque([start])
dp[start[0]][start[1]] = 0
while(q):
    x, y = q.popleft()
    if x > 0:
        if dp[x-1][y] > dp[x][y]+1:
            if A[x-1][y] == ".":
                dp[x-1][y] = dp[x][y]+1
            else:
                dp[x-1][y] = 0
            q.append([x-1, y])
    if x < W-1:
        if dp[x+1][y] > dp[x][y]+1:
            if A[x+1][y] == ".":
                dp[x+1][y] = dp[x][y]+1
            else:
                dp[x+1][y] = 0
            q.append([x+1, y])
    if y > 0:
        if dp[x][y-1] > dp[x][y]+1:
            if A[x][y-1] == ".":
                dp[x][y-1] = dp[x][y]+1
            else:
                dp[x][y-1] = 0
            q.append([x, y-1])
    if y < H-1:
        if dp[x][y+1] > dp[x][y]+1:
            if A[x][y+1] == ".":
                dp[x][y+1] = dp[x][y]+1
            else:
                dp[x][y+1] = 0
            q.append([x, y+1])
ans = 0
for i in range(H):
    ans = max(ans, max(dp[i]))

print(ans)


### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]
dp = [[H+W]*W for i in range(H)]

q = collections.deque()
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            dp[i][j] = 0
            q.append([i, j])
            break
    if q:
        break


while(q):
    x, y = q.popleft()
    if x > 0:
        if dp[x-1][y] > dp[x][y]+1:
            if A[x-1][y] == ".":
                dp[x-1][y] = dp[x][y]+1
            else:
                dp[x-1][y] = 0
            q.append([x-1, y])
    if x < H-1:
        if dp[x+1][y] > dp[x][y]+1:
            if A[x+1][y] == ".":
                dp[x+1][y] = dp[x][y]+1
            else:
                dp[x+1][y] = 0
            q.append([x+1, y])
    if y > 0:
        if dp[x][y-1] > dp[x][y]+1:
            if A[x][y-1] == ".":
                dp[x][y-1] = dp[x][y]+1
            else:
                dp[x][y-1] = 0
            q.append([x, y-1])
    if y < W-1:
        if dp[x][y+1] > dp[x][y]+1:
            if A[x][y+1] == ".":
                dp[x][y+1] = dp[x][y]+1
            else:
                dp[x][y+1] = 0
            q.append([x, y+1])
ans = 0
for i in range(H):
    ans = max(ans, max(dp[i]))
print(ans)
x,y,a,b,c=map(int,input().split())
p,q,r=[reversed(sorted(list(map(int,input())))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)


### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p,q,r=[list(reversed(sorted(list(map(int,input().split()))))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)
n = int(input())
for i in range(n):
  ab[i][0], ab[i][1] = map(int, input().split())
  ab[i][2] = ab[i][0] + ab[i][1]
sorted(ab, key=lambda x: x[2])
print(sum(ab[0::2][0])-sum(ab[1::2][1]))

### FIXED CODE ###

# C
n = int(input())
if n==1:
    a, b =map(int, input().split())
    print(a)
else:
    def return_a(n):
        return n[0]
    def return_b(n):
        return n[1]
    ab = [[0] * 3 for i in range(n)]
    for i in range(n):
        ab[i][0], ab[i][1] = map(int, input().split())
        ab[i][2] = ab[i][0] + ab[i][1]
    ab = sorted(ab, key=lambda x: x[2], reverse=True)
    print(sum(map(return_a, ab[0::2])) - sum(map(return_b, ab[1::2])))
n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
for k in range(n):
    high[k]>=high[k+1]:
            count+=1
        else:
            ans.append(count)
            count=0
print(max(ans))

### FIXED CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
MaxC=0
for k in range(n-1):
    if high[k]>=high[k+1]:
        count+=1
        MaxC=max(MaxC,count)
    else:
        count=0
print(MaxC)
x = input()
print(x ** 3)

### FIXED CODE ###

x = int(input())

print(x ** 3)
H = list(map(int,input().split()))
h = H[0]
w = H[1]
x = H[2]
y = H[3]

if (h-2*x)*(w-2*y)!=0 or ((h-2*x==0) and (w-2*y==0)) and (x != h x != 0 or y != 0 y != w):
  a = 1
else:
  a = 0

print(h*w/2,a)

### FIXED CODE ###

H = list(map(int,input().split()))
h = H[0]
w = H[1]
x = H[2]
y = H[3]

if (h-2*x==0) and (w-2*y==0):
  a = 1
else:
  a = 0

print(h*w/2,a)
import numpy as np

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

if K == 1:
  print(0)
else:
  N_swp = np.abs(N - K)
  while N_swp != 0 and N_swp < N :
    N = N_swp
    N_swp = np.abs(N - K)
  print(N)


### FIXED CODE ###


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

if K == 1:
  print(0)
else:
  a = N % K
  if a > K-a:
    print(K-a)
  else:
    print(a)
import math


def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    m = 3
    while m ** 2 <= n:
        if n % m == 0:
            return False
        m += 2
    return True


A, B = map(int, input().split())
d = math.gcd(A, B)
n = 1
s = set()
while n ** 2 <= d:
    if d % n == 0:
        if is_prime(n):
            s.add(n)
        if is_prime(d // n):
            s.add(d // n)
    n += 1
s.add(1)
print(len(s))

### FIXED CODE ###

from fractions import gcd


def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    m = 3
    while m ** 2 <= n:
        if n % m == 0:
            return False
        m += 2
    return True


A, B = map(int, input().split())
d = gcd(A, B)
n = 1
s = set()
while n ** 2 <= d:
    if d % n == 0:
        if is_prime(n):
            s.add(n)
        if is_prime(d // n):
            s.add(d // n)
    n += 1
s.add(1)
print(len(s))
def main():
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [0] * n
f[0] = 1
s, g = 0, 0
j = a[0] - 1
jpre = 0
c = 1
i = 0
while True:
    if i >= n:
        break
    if f[j] != 0:
        s = jpre
        g = j
        break
    else:
        f[j] = c
        c += 1
        jpre = j
        j = a[j] - 1
    i += 1
f[0] = 0
ans = (k - g) % (s - g) + f[g]
for i in range(n):
    if f[i] == ans:
        print(i + 1)
        break

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [-1] * n
f[0] = 0
s1, s2, g1, g2 = 0, 0, 0, 0
j = a[0] - 1
jpre = 0
c = 1
i = 0
while True:
    if i >= k:
        s1, s2 = f[jpre], jpre
        g1, g2 = 0, 0
        break
    if f[j] != -1:
        s1, s2 = f[jpre], jpre
        g1, g2 = f[j], j
        break
    else:
        f[j] = c
        c += 1
        jpre = j
        j = a[j] - 1
    i += 1
ans = (k - g1) % (s1 - g1 + 1) + f[g2]
for i in range(n):
    if f[i] == ans:
        print(i + 1)
        break
# ｎとｍの取得
data = input().split()
n = int(data[0]) #n == 人数
m = int(data[1]) #m == 数字の種類
ans = 0
#ｎ回データを取得してカウント

j = 1 #j == 好きな数字
i = 1 #i == 行数カウンタ
c = [0] * m #c == ある数が含まれているかのカウンタ　0で初期化
    #データの取得

while i <= n:
    tmp = input()
    td = tmp[1:] #td == 好きな番号
    tn = tmp[0]  #tn == 好きな番号の数
    print(td)
    # 数字が含まれているかの比較
    while j <= m: # jがすべての数字について実行
        j = str(j)# jを文字列に変換
        if j in td: # jがｔｄに含まれるかの分岐
            j = int(j) #　ｊを数値に戻す
            c[j] += 1 # ｃのｊ番目の要素にカウント
        j = int(j) #if ではじかれたとき用にｊを数値に戻す
        j += 1# ｊをカウント
    j = 1    
    i += 1 # iをカウント

# 全てに含まれている数字の集計

for x in c:
    if x == n:
        ans += 1

print(c)

print(ans)


### FIXED CODE ###

data = input().split()
a = int(data[0])
b = int(data[1])

if b%a == 0:
  print(a+b)
else:
  print(b-a)
import sys
word = input()

if len(word)%2 == 1:
    print("No")
    sys.exit()
tab = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
flag = True
for i in range(len(word)):
    if word.count(tab[i])%2 == 1:
        flag = False
        break
if flag:print("Yes")
else: print("No")


### FIXED CODE ###

word = input()

flag = True
if len(word)%2 == 1:
    flag = False

wordset = set(word)
leng = len(wordset)
for s in wordset:
    if word.count(s)%2 == 1:
        flag = False
        break
if flag:print("Yes")
else: print("No")
n = int(input())
    a = list(map(int,input().split()))
    red = 0
    ans = 0
    cnt = [0]*10
    for x in a:
        if x < 3200:
            cnt[x//400] +=1
        else:
            red+=1
    for x in cnt:
        if x >0:ans+=1

    if red == n:ans = 1
    print(ans)
    ans+=red
    print(ans)



### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
red = 0
ans = 0
cnt = [0]*10
for x in a:
    if x < 3200:
        cnt[x//400] +=1
    else:
        red+=1
for x in cnt:
    if x >0:ans+=1

if red == n:print(1)
else:print(ans)
ans+=red
print(ans)
n,k=map(int,input())
if k%2:
  print((n//k)**3)
else:
  l=k//2
  if l%2:
    print(((n+l)//k)**3)
  else:
    print(((n+l)//k)**3 + (n//k)**3)

### FIXED CODE ###

n,k=map(int,input().split())
if k%2:
  print((n//k)**3)
else:
  l=k//2
  print(((n+l)//k)**3+(n//k)**3)
a,b,c = map(int, raw_input().split(' '))
print 'Yes' if a+b < c and 4*a*b < (c - a - b) **2 else 'No'


### FIXED CODE ###

print [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
][int(raw_input())-1]
def resolve_c():
    n, m = map(int, input().split())
    ac_list = [0] * m
    wa_list = [0] * m
    wa_tmp_list = [0] * m
    for i in range(m):
        p, s = input().split()
        if ac_list[int(p)] == 0:
            if s == "AC":
                ac_list[int(p)] = 1
                wa_list[int(p)] = wa_tmp_list[int(p)]
            elif s == "WA":
                wa_tmp_list[int(p)] += 1
    print(str(sum(ac_list)) + " " + str(sum(wa_list)))
resolve_c()

### FIXED CODE ###

def resolve_c():
    n, m = map(int, input().split())
    ac_list = [0] * n
    wa_list = [0] * n
    wa_tmp_list = [0] * n
    for i in range(m):
        p, s = input().split()
        if ac_list[int(p)-1] == 0:
            if s == "AC":
                ac_list[int(p)-1] = 1
                wa_list[int(p)-1] = wa_tmp_list[int(p)-1]
            elif s == "WA":
                wa_tmp_list[int(p)-1] += 1
    print(str(sum(ac_list)) + " " + str(sum(wa_list)))
resolve_c()
t=0
for i in sorted(map(int,[*open(0)]),key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)

### FIXED CODE ###

t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t%10)%10
print(t)
a, o, b = input().split()
if o = '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

### FIXED CODE ###

a, o, b = input().split()
if o == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
N, M = map(int, input().split())
Pajew = [i for i in range(n)]
import sys
sys.setrecursionlimit(1000000)

def find(x, Pajew):
    if Pajew[x] == x:
        return x
    else:
        a = find(Pajew[x], Pajew)
        Pajew[x] =a
        return a

def unite(x, y):
    x = find(x, Pajew)
    y = find(y, Pajew)
    if x != y:
        Pajew[x] = y

for _ in range(M):
    a, b = map(int, input().split())
    unite(a-1, b-1)

grou = 0
for i in range(N):
    if i == Pajew[i]:
        grou +=1
        
        
print(grou-1)

### FIXED CODE ###

N, M = map(int, input().split())
Pajew = [i for i in range(N)]
import sys
sys.setrecursionlimit(1000000)

def find(x, Pajew):
    if Pajew[x] == x:
        return x
    else:
        a = find(Pajew[x], Pajew)
        Pajew[x] =a
        return a

def unite(x, y):
    x = find(x, Pajew)
    y = find(y, Pajew)
    if x != y:
        Pajew[x] = y

for _ in range(M):
    a, b = map(int, input().split())
    unite(a-1, b-1)

grou = 0
for i in range(N):
    if i == Pajew[i]:
        grou +=1


print(grou-1)
from sys import setrecursionlimit
import numpy as np


setrecursionlimit(10**6)

N, M = tuple(map(int, input().split()))
Ls = np.zeros((M,), dtype=int)
Rs = np.zeros((M,), dtype=int)
Ds = np.zeros((M,), dtype=int)

for i in range(M):
    Ls[i], Rs[i], Ds[i] = tuple(map(int, input().split()))

Ls = Ls - 1
Rs = Rs - 1

adjacency_list = []
for i in range(N):
    adjacency_list.append([])

for i in range(M):
    adjacency_list[Ls[i]].append((Rs[i], Ds[i]))
    adjacency_list[Rs[i]].append((Ls[i], -Ds[i]))

visited = np.zeros(N, dtype=bool)
weights = np.zeros(N, dtype=int)
to_be_visited = []


def DFS(node_index):
    global adjacency_list, visited, weights, to_be_visited
    adjacent_node_information = adjacency_list[node_index]
    for adjacent_node_index, adjacent_edge_weight in adjacent_node_information:
        if not visited[adjacent_node_index]:
            visited[adjacent_node_index] = True
            to_be_visited.append(adjacent_node_index)
            weights[adjacent_node_index] = weights[node_index] + adjacent_edge_weight

    if len(to_be_visited) == 0:
        return 0
    else:
        DFS(to_be_visited.pop())

pointer = 0
for pointer in range(N):
    if not visited[pointer]:
        to_be_visited.append(pointer)
        DFS(pointer)

for i in range(M):
    if weights[Rs[i]] - weights[Ls[i]] != Ds[i]:
        print("No")
        exit()

print("Yes")

### FIXED CODE ###

X = int(input())
A = int(input())
B = int(input())
count = (X - A) // B

print(X - A - B * count)
a,b,k=map(int,input().split())

s=set()
l=[]

for i in range(a,b+1):
    l.append(i)

for i in range(k):
    s.add(l[i])
    s.add(l[-i-1])
    
s_l=list(s)
s_l.sort()
for i in range(len(s_l)):
    print(s_l[i])

### FIXED CODE ###

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

ans=list(range(a,min(a+k,b)))+list(range(max(a,b-k+1),b+1))
ans=set(ans)
ans=list(ans)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
import numpy as np
N = int(input())
B = str(input())
B_array = np.array(list(map(int, list(B))))
B_1 = B_array.sum()
mod_list_m1 = []
mod_list = []
mod_list_p1 = []
for i in range(N):
    mod_list.append((2**i) % (B_1))
    mod_list_m1.append((2**i) % (B_1-1))
    mod_list_p1.append((2**i) % (B_1+1))
mod_list = np.array(mod_list)[::-1]
mod_list_m1 = np.array(mod_list_m1)[::-1]
mod_list_p1 = np.array(mod_list_p1)[::-1]

def calc_small(n, iter):
    
    iter += 1
    mod = n % np.array(list(map(int, list(bin(n)[2:])))).sum()
    if mod == 0:
        return iter
    else:
        return calc_small(mod, iter)

for i in range(N):
    Z_array = B_array.copy()
    Z_array[i] = 1 if B_array[i] == 0 else 0
    if Z_array.sum() == 0:
        print(1)
        continue
    mod = Z_array.dot(mod_list_p1) % (B_1+1) if B_array[i] == 0 else Z_array.dot(mod_list_m1) % (B_1-1)
    iter = 1
    if mod == 0:
        print(iter)
    else:
        print(calc_small(mod, iter))


### FIXED CODE ###

N = int(input())
B = input()

B_1 = B.count("1")
mod_p1 = int(B,2) % (B_1+1)
if B_1 != 1:
    mod_m1 = int(B,2) % (B_1-1)

def calc_small(n, iter):
    iter += 1
    mod = n % bin(n).count("1")

    if mod == 0:
        return iter
    else:
        return calc_small(mod, iter)

for i in range(N):
    if B_1 == 1 and int(B[i]) == 1:
        print(0)
        continue
    mod = (mod_m1 - pow(2,N-i-1,B_1-1)) % (B_1-1) if int(B[i]) == 1 else (mod_p1 + pow(2,N-i-1,B_1+1)) % (B_1+1)
    iter = 1
    if mod == 0:
        print(iter)
    else:
        print(calc_small(mod, iter))
n=int(input())
a=list(map(int,input().split()))
s=''
ans=1
for i in range(n-1):
  if a[i]<a[i+1]:
    s+='x'
  elif a[i]>a[i+1]:
    s+='y'
for i in range(len(s)):
  if s[i]!=s[i+1]:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
x=[]
ans=1

for i in range(n-1):
  if a[i+1]==a[i]:
    continue
  x.append(a[i+1]-a[i])
  
flag=True

for i in range(len(x)-1):
  if flag==False:
    flag=True
    continue
  if x[i]<0 and x[i+1]>0 or x[i]>0 and x[i+1]<0:
    ans+=1
    flag=False
    

print(ans)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
ans = 2
if len(a) == 1 and a[0]!=n:
  ans += a[1]-1
b = factorization(n-1)
chk = 1
for i in range(len(b)):
  chk *= (b[i][1]+1)
ans += chk-1

if len(a) >= 2:
  for i in range(len(a)):
    for j in range(a[i][1]):
      if int(n/(a[i][0]**j))%a[i][0]**j == 0:
        ans += 1
print(ans)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
  
def divisorize(n):
    ## 約数
    f = factorization(n)
    divisors = [1]
    for k in range(len(f)):
        num_divisors = len(divisors)
        for i in range(1, f[k][1] + 1):
            for j in range(num_divisors):
                divisors.append(divisors[j] * f[k][0] ** i)
    return sorted(divisors)
  
n = int(input())
ans = 0
chk = divisorize(n-1)
for i in divisorize(n)[1:]:
  m = n
  while True:
    if m == 1:
        ans += 1
        chk.append(i)
        break
    if m < i:
      break
    if m%i == 0:
      m = m//i
    else:
      m = m%i

chk = set(chk)
print(len(chk)-1)
def yesno(S)
S=int(input())
if S=='AAA' or S=='BBB':
  return('No')
else:
  return('Yes')
print(yesno(S))
  

### FIXED CODE ###

def yesno(S):
  if S=="AAA" or S=="BBB":
    return "No"
  else:
    return "Yes"
S=input()
print(yesno(S))
a = int(input())
import math
print("{:.5f} {:.5f}".format(a ** 2 * math.pi, 2 * a * math.pi))

### FIXED CODE ###

a = float(input())
import math
print("{:.5f} {:.5f}".format(a ** 2 * math.pi, 2 * a * math.pi))
N_input = int(input())
t_input = []
x_input = []
y_input = []

for _ in range(N_input):
    t, x, y = map(int, input().split())
    t_input.append(t)
    x_input.append(x)
    y_input.append(y)

def can_reach(t_now, n_now, x_now, y_now): # 残り時間で到達可能かチェック
    distance = abs(x_input[n_now] - x_now) + abs(y_input[n_now] - y_now)
    if distance <= t_input[n_now] - t_now and (distance + (t_input[n_now] - t_now))%2 == 0: # 到達可能圏内かつ距離と残り時間の偶奇が一致
        return True
    else:
        return False

def rest_travel(t_now, n_now, x_now, y_now): # 現在時刻t、通過済チェックポイント数n、現在位置x, y
    if t_now == max(t_input): # ゴール
        print("Yes")
        exit()
    elif can_reach(t_now, n_now, x_now, y_now):
        rest_travel(t_input[n_now+1], n_now+1, x_input[n_now+1], y_input[n_now+1])
    else: # 到達不可
        print("No")
        exit()

rest_travel(0,0,0,0)

### FIXED CODE ###

N = int(input())

t_b = x_b = y_b = 0 # 直前の時刻と位置保存用

def dist(x, x_b, y, y_b):
    return abs(x-x_b) + abs(y-y_b)

miss_flg = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if dist(x, x_b, y, y_b) > t - t_b or ((t - t_b) + dist(x, x_b, y, y_b))% 2 == 1: # 到達不能もしくは距離と残り時間の偶奇が不一致
        miss_flg = 1
    t_b, x_b, y_b = t, x, y

print("Yes" if miss_flg == 0 else "No")
import math

n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10^9

for i in range(0,math.ceil((n-k+1)/2)):
    tmp1 = abs(h[n-k+i] - h[i])
    tmp2 = abs(h[n-1-i] - h[n-k-i])
    if tmp1==0 or tmp2==0:
        crr_min=0
        break

    if tmp1<crr_min:
        crr_min=tmp1

    if tmp2<crr_min:
        crr_min=tmp2


print(crr_min)

### FIXED CODE ###

import math

n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10**9

for i in range(0,math.ceil((n-k+1)/2)):
    tmp1 = h[i+k-1] - h[i]
    tmp2 = h[-1-i] - h[-i-k]
    if tmp1==0 or tmp2==0:
        crr_min=0
        break

    if tmp1<crr_min:
        crr_min = tmp1

    if tmp2<crr_min:
        crr_min = tmp2


print(crr_min)
N = input()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N /= 10
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

print("No"if int(input())%9else"Yes")