TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())

divisor = [N]
ans = 0


for i in range(2,N+1,1):
    if i*i <= N:
        if N % i == 0:
            divisor.append(i)
            divisor.append(N//i)


yakusuuu = [N-1]
for i in range(2,N,1):
    if i*i <= N:
        if N % i == 1:
            yakusuuu.append(i)
            yakusuuu.append((N-1)//i)

for i in yakusuuu:
    if N % i == 1:
        ans += 1




for K in divisor:
    
    for i in range(N):
        if N % K == 0:
            N = N//K
        else:
            break
    

    if N == 1:
        ans += 1
        
    else:
        N %= K
        if N == 1:
            ans += 1 
        




print(ans)

N = int(input())

divisor = [N]
ans = 0


for i in range(2,N+1,1):
    if i*i < N:
        if N % i == 0:
            divisor.append(i)
            divisor.append(N//i)
    elif i*i == N:
        divisor.append(i)
    else:
        break


yakusuuu = [N-1]
for i in range(2,N,1):
    if i*i < (N-1):
        if (N - 1)% i == 0:
            yakusuuu.append(i)
            yakusuuu.append((N-1)//i)
    elif i*i == (N-1):
        yakusuuu.append(i)
    else:
        break

for i in yakusuuu:
    if N % i == 1:
        ans += 1




M = N

for K in divisor:
    
    while M % K == 0:
        M = M//K

    

    if M == 1:
        ans += 1
        
    else:
        M =  M % K
        if M == 1:
            ans += 1 
    
    M = N
        




print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from collections import defaultdict

def prime_factrize(n):
    b = defaultdict(int)
    while n % 2 == 0:
        b[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            b[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        b[n] += 1
    return b

n = int(input())
primes = prime_factrize(n)
ans = 0
if n not in primes.keys():
    ans += 1
for k, v in primes.items():
    ans += (n // k ** v) % k == 1

m = 2
n1 = n - 1
while m * m <= n1:
    ans += n1 % m == 0
    m += 1
print(ans)


def divisors(n):
    x = set()
    m = 1
    while m * m <= n:
        if n % m == 0:
            x.add(m)
            x.add(n // m)
        m += 1
    return x

n = int(input())
d = divisors(n)
ans = 0
for k in d:
    if k == 1:
        continue
    nn = n
    while nn % k == 0:
        nn = nn // k
    ans += nn % k == 1

d1 = divisors(n - 1)
ans += len(d1) - 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
def is_prime(n):
    if n == 2 or n%2 == 0:
        return False
    for i in range(2,int(n**0.5)):
        if n%i == 0:
            return False
    return True

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

ans = 2
N = int(input())
if is_prime(N):
    print(ans)
else:
    div = make_divisors(N)
#    print(div)
#    print(len(div)*2+1)



def is_prime(n):
    if n == 2 or n%2 == 0:
        return False
    for i in range(2,int(n**0.5)):
        if n%i == 0:
            return False
    return True

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

ans = 2
N = int(input())
if is_prime(N):
    print(ans)
else:
    div = make_divisors(N)
    print(len(div)*2+1)



def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

ans = 2
N = int(input())

div = make_divisors(N)
div_1 = make_divisors(N-1)
ans = 0
for i in div:
    p = N
    if i == 1:
        continue
    while p%i == 0:
        p = p//i
    if p%i == 1:
        ans +=1

print(ans + len(div_1)-1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from math import gcd

print(gcd(120, 24))

from fractions import gcd

print(gcd(120, 24))


N = int(input())

def isOk(k):
    n = N
    while n % k == 0:
        n //= k
    return n % k == 1


def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    
    return divisors

div1 = divisors(N)
div2 = divisors(N - 1)

ans = len([0 for d in div1 if d != 1 and isOk(d)]) + len([0 for d in div2 if d != 1 and isOk(d)])
print(ans)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
num = int(input())
num -= 1
result = 1
for i in range(2, int(pow(num, 0.5))+1):
    c = 0
    while num%i==0:
        num //= i
        c += 1
    if c>0:
        result *= c+1

if num > 1:
    result *= 2
result -= 1
num += 1
for i in range(2, int(pow(num, 0.5))+1):
    n = num
    if n%i==0:
        while n%i==0:
            n //= i
        if n%i==1 or i%n==1:
            result += 1

print(result)

num = int(input())
n = num
num -= 1
result = 1
for i in range(2, int(pow(num, 0.5))+1):
    c = 0
    while num%i==0:
        num //= i
        c += 1
    if c>0:
        result *= c+1

if num > 1:
    result *= 2
result -= 1

r = set()
for i in range(2, int(pow(n, 0.5))+1):
    num = n
    if num%i==0:
        r.add(i)
        r.add(n//i)
r.add(n)
for i in r:
    num = n
    while num%i==0:
        num //= i
    if num%i == 1:
        result += 1

print(result)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from sys import stdin
def make_divisors(n):
    mod0 = set()
    mod1 = set()
    for i in range(2, int(n**0.5)+1):
        if n%i==0:
            mod0.add(i)
            mod0.add(n/i)
        if (n-1)%i==0:
            mod1.add(i)
            mod1.add((n-1)/i)
    print(mod0)
    print(mod1)
    return mod0,mod1

N=list(map(int,(stdin.readline().strip().split())))
num=N[0]
K=0
mod0,mod1=(make_divisors(num))
# mod0.remove(1)
# mod1.remove(1)
for i in mod0:
    num = N[0]
    while(num % i == 0):
        num/=i

    if num%i==1:
        K+=1
K+=len(mod1)+2
print(K)


from sys import stdin
def make_divisors(n):
    mod0 = set()
    mod1 = set()
    for i in range(2, int(n**0.5)+1):
        if n%i==0:
            mod0.add(i)
            mod0.add(n/i)
        if (n-1)%i==0:
            mod1.add(i)
            mod1.add((n-1)/i)
    print(mod0)
    print(mod1)
    return mod0,mod1

N=list(map(int,(stdin.readline().strip().split())))
num=N[0]
K=0
mod0,mod1=(make_divisors(num))
# mod0.remove(1)
# mod1.remove(1)
for i in mod0:
    num = N[0]
    while(num % i == 0):
        num/=i

    if num%i==1:
        K+=1
K+=len(mod1)+2
print(K)


from sys import stdin
def make_divisors(n):
    mod0 = set()
    mod1 = set()
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            mod0.add(i)
            # mod0.add(n//i)
        if (n-1)%i==0:
            mod1.add(i)
            # mod1.add((n-1)//i)
    return mod0,mod1

N=list(map(int,(stdin.readline().strip().split())))
num=N[0]
K=0
mod0,mod1=(make_divisors(num))
mod0.remove(1)
mod1.remove(1)
for i in mod0:
    num = N[0]
    while(num % i == 0):
        num//=i

    if num%i==1:
        K+=1
K+=len(mod1)
print(K)


from sys import stdin
def make_divisors(n):
    mod0 = set()
    mod1 = set()
    for i in range(2, int(n**0.5)+1):
        if n%i==0:
            mod0.add(i)
            mod0.add(n/i)
        if (n-1)%i==0:
            mod1.add(i)
            mod1.add((n-1)/i)
    return mod0,mod1

N=list(map(int,(stdin.readline().strip().split())))

num=N[0]
if num==2:print(1)
else:
    K=0
    mod0,mod1=(make_divisors(num))
    # mod0.remove(1)
    # mod1.remove(1)
    for i in mod0:
        num = N[0]
        while(num % i == 0):
            num/=i

        if num%i==1:
            K+=1
    K+=len(mod1)+2
    print(K)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	return divisors


n=int(input())
#n%k!=0
cnt=len(make_divisors(n-1))

#n%k==0
lst=make_divisors(n)
for k in lst:
	t=n
	while t%k==0:
		t//=k
	t%=k
	if  t==1:
		cnt+=1
print(cnt-1)


def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	return divisors


n=int(input())
#n%k!=0
cnt=len(make_divisors(n-1))-1

#n%k==0
lst=make_divisors(n)
for k in lst:
	if k!=1:
		t=n
		while t%k==0:
			t//=k
		if (t-1)%k==0:
			cnt+=1
print(cnt)

Verdicts: Time Limit Exceeded

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
n = int(input())
a = [n]
if n != 2:
    a.append(n - 1)

def div_(N, k):
    while N % k == 0:
        N /= k
    if N % k == 1:
        a.append(k)

for k in range(2, int(n ** 0.5) + 1):
    if n % k == 0:
        div_(n,k)
        if k != n / k:
            div_(n, n // k)

    if (n - 1) % k == 0:
        a.append(k)
        if k != (n - 1) / k:
            a.append((n - 1) // k)

print(a)
print(len(a))

n = int(input())
a = [n]
if n != 2:
    a.append(n - 1)

def div_(N, k):
    while N % k == 0:
        N /= k
    if N % k == 1:
        a.append(k)

for k in range(2, int(n ** 0.5) + 1):
    if n % k == 0:
        div_(n,k)
        if k != n / k:
            div_(n, n // k)

    if (n - 1) % k == 0:
        a.append(k)
        if k != (n - 1) / k:
            a.append((n - 1) // k)

print(len(a))

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())

def check(p):
  _N = N
  while _N%p == 0:
    _N //= p
  return ((_N-1)%p == 0) or (_N == 1)

n = int(N**0.5)
P0 = set([N])
P1 = set([N-1])
for i in range(2, n+1):
  if N%i == 0:
    P0.add(i)
    P0.add(N//i)

n = int((N-1)**0.5)
for i in range(2, n+1):
  if N%i == 0:
    P1.add(i)
    P1.add((N-1)//i)

ans = len(P1)
for p in P0:
  ans += check(p)

print(ans)


N = int(input())

def check(p):
  _N = N
  while _N%p == 0:
    _N //= p
  return ((_N-1)%p == 0) or (_N == 1)

n = int(N**0.5)
P0 = set([N])
P1 = set([N-1])
for i in range(2, n+1):
  if N%i == 0:
    P0.add(i)
    P0.add(N//i)

n = int((N-1)**0.5)
for i in range(2, n+1):
  if N%i == 0:
    P1.add(i)
    P1.add(N//i)

ans = len(P1)
for p in P0:
  ans += check(p)

print(ans)


n = int(input())
ans = 0

def calc(n,k):
    while(n%k==0):
        n = n//k
    n  %= k
    return n

def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if(n%i == 0):
            divisors.append(i)
            if(i!= n//i):
                divisors.append(n//i)

    return  divisors

divisors = make_divisors(n)
divisors += make_divisors(n-1)
divisors = set(divisors)
for i in divisors:
    if(i != 1):
        if( calc(n,i)==1 ):
            ans += 1

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from copy import deepcopy
import numpy as np
def factor(N):
    ans = []
    for i in range(1,int(np.sqrt(N))+1):
        if N%i == 0:
            ans.append(i)
            if N//i != i:
                ans.append(i)
    return ans

def check(K,N):
    while 1:
        if N%K == 0:
            N = N//K
        else:
            break
    if N%K == 1:
        return True
    else:
        return False

N = int(input())
ans = len(factor(N-1)[1:])
for K in factor(N)[1:]:
    if check(K,N):
        ans += 1

print(ans)   

import numpy as np
def factor(N):
    ans = []
    for i in range(1,int(np.sqrt(N))+1):
        if N%i == 0:
            ans.append(i)
            if N//i != i:
                ans.append(N//i)
    return ans

def check(K,N):
    while N >= K:
        if N%K == 0:
            N //= K
        else:
            N %= K
    if N%K == 1:
        return True
    else:
        return False

N = int(input())
ans = len(factor(N-1))-1

for K in factor(N)[1:]:
    if check(K,N):
        ans += 1

print(ans)            


Verdicts: Time Limit Exceeded

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
nl = make_divisors(n)
nl_p = make_divisors(n+1)
nl_m = make_divisors(n-1)
l = sorted(list(set(nl + nl_p+nl_m)))
print(l)

ans = 0
for i in range(1, len(l)-1):
    p = n
    k = l[i]
    while p > k:
        if p%k == 0:
            p = p//k
        elif p%k == 1:
            p = 1
            break
        else:
            break
    if p == 1:
        ans += 1
print(ans+1)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
nl = make_divisors(n)
nl_m = make_divisors(n-1)
l = sorted(list(set(nl + nl_m)))

ans = 0
for i in range(1, len(l)-1):
    p = n
    k = l[i]
    while p%k == 0:
        p = p // k
    if p%k == 1:
        ans += 1
print(ans+1)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
import math

N = int(input())

cnt = 0

if N == 2:
  print(1)
  exit()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors
res1 = sorted(make_divisors(N))
print(res1)
res1 = res1[1:math.ceil(len(res1)/2)]

for num in res1:
  kensa = N
  while True:
    if kensa % num == 0:
      kensa = kensa // num
      continue
    break
  if kensa % num == 1:
    cnt += 1

res2 = sorted(make_divisors(N-1))
cnt += len(res2[1:])+1

print(cnt)

import math
 
N = int(input())
 
cnt = 0
 
if N == 2:
  print(1)
  exit()
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    
    return divisors
res1 = sorted(make_divisors(N))
res1 = res1[1:math.ceil(len(res1)/2)]
 
for num in res1:
  kensa = N
  while True:
    if kensa % num == 0:
      kensa = kensa // num
      continue
    break
  if kensa % num == 1:
    cnt += 1
 
res2 = sorted(make_divisors(N-1))
cnt += len(res2[1:])+1
 
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())
N_tmp = N
pf={}
for i in range(2,int(N**0.5)+1):
    while N%i==0:
        pf[i]=pf.get(i,0)+1
        N//=i
if N>1:pf[N]=1

kouho = [1]
for k in pf.keys():
    new_kouho = []
    for v in range(0, pf[k] + 1):
        for val in kouho:
            new_kouho.append(val * k ** v)
            new_kouho.append(val * k ** v - 1)
        kouho.extend(new_kouho)

cnt = 0
for v in sorted(list(set(kouho)))[1:]:
    K = v
    tmp_N = N_tmp
    if K <= 1: continue
    print(tmp_N, K)
    while tmp_N >= K:
        if tmp_N % K == 0:
            tmp_N = tmp_N // K
        else:
            tmp_N = tmp_N % K
    if tmp_N == 1:
        cnt += 1

print(cnt)

N = int(input())
N_tmp = N

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

cnt = 0
divisors = make_divisors(N)
divisors_n1 = make_divisors(N-1)
divisors.extend(divisors_n1)
for K in divisors:
    tmp_N = N_tmp
    if K <= 1: continue
    while tmp_N % K == 0:
        tmp_N = tmp_N // K
    tmp_N = tmp_N % K
    if tmp_N == 1:
        cnt += 1

print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from itertools import product

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 _num(arr):
    out = 1
    for item in arr:
        out *= (item[1]+1)
    return out

n_orig = int(input())
arr = factorization(n_orig)
arr1 = factorization(n_orig - 1)

if len(arr)==1 and arr[0][1]==1:
    print(_num(arr1))
else:
    tmp = _num(arr1)-1
    
    for nums in product(*[range(item[1]+1) for item in arr]):
        n = n_orig
        kk = 1
        for num, base in zip(nums, arr):
            base = base[0]
            kk *= base**num
        if (kk==1):
            continue
        while n%kk==0:
            n /= kk
        if ((n - 1) % kk == 0):
            print(kk)
            tmp += 1
    print(tmp)

from itertools import product

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 _num(arr):
    out = 1
    for item in arr:
        out *= (item[1]+1)
    return out

n_orig = int(input())
arr = factorization(n_orig)
arr1 = factorization(n_orig - 1)

if n_orig==2:
    print(1)
elif len(arr)==1 and arr[0][1]==1:
    print(_num(arr1))
else:
    tmp = _num(arr1)-1
    
    for nums in product(*[range(item[1]+1) for item in arr]):
        n = n_orig
        kk = 1
        for num, base in zip(nums, arr):
            base = base[0]
            kk *= base**num
        if (kk==1):
            continue
        while n%kk==0:
            n /= kk
        if ((n - 1) % kk == 0):
            tmp += 1
    print(tmp)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
n = int(input())

tmp = n - 1
ret = len(make_divisors(tmp)) - 1

tmplen = make_divisors(tmp)

for item in tmplen:
    if item == 1:
        continue
    val = n
    while True:
        if val % item == 0:
            val = val // item
        else:
            if val % item == 1:
                ret += 1
            break

print(ret)


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())

tmp = n - 1
ret = len(make_divisors(tmp)) - 1

tmplen = make_divisors(n)

for item in tmplen:
    if item == 1:
        continue
    val = n
    while True:
        if val % item == 0:
            val = val // item
        else:
            if val % item == 1:
                ret += 1
            break

print(ret)


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())
cnt = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors
N1_yakusu = make_divisors(N-1)
N_yakusu = make_divisors(N)
cnt += len(N1_yakusu)
for s in N_yakusu:
    new_N = s
    while(new_N%K==0):
        new_N = new_N//K
    if(new_N%K == 1):
        cnt += 1
print(cnt)

N = int(input())
cnt = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.pop(0)
    return divisors
N1_yakusu = make_divisors(N-1)
N_yakusu = make_divisors(N)
cnt += len(N1_yakusu)
for K in N_yakusu:
    new_N = N
    while(new_N%K==0):
        new_N = new_N//K
    if(new_N%K == 1):
        cnt += 1
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())



def divisor(n):
    ass = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass  


div_n = divisor(N)
div_n1 = divisor(N - 1)

ans = []
for d in div_n:
    nd = N // d
    if nd % d == 1:
        ans.append(d)

for d in div_n1:
    ans.append(d)


ans = list(set(ans))
print(ans)
print(len(ans)-1)


import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())



def divisor(n):
    ass = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass  


div_n = divisor(N)
div_n1 = divisor(N - 1)

ans = []
for d in div_n:
    if d == 1:
        continue
    n = N
    while n % d == 0:
        n //= d

    if n % d == 1 or n == 1:
        ans.append(d)

for d in div_n1:
    if d == 1:
        continue
    if N % d == 0:
        nd = N // d
        if nd % d == 1 or nd % d == 0:
            ans.append(d)
    else:
        ans.append(d)


ans = list(set(ans))
# print(ans)
print(len(ans))


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

L = len(make_divisors(N))

ans = 0
for i in range(L):
    t = N
    while t%(make_divisors(N)[i]) == 0:
        t = t//make_divisors(N)[i]
    if t%(make_divisors(N)[i]) == 1:
        ans = ans + 1
        
print(ans + len(make_divisors(N-1)) -1)

N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

L = len(make_divisors(N))

A = make_divisors(N)

ans = 0
for i in range(1,L):
    t = N
    while t%(A[i]) == 0:
        t = t//A[i]
    if t%A[i] == 1:
        ans = ans + 1
        
print(ans + len(make_divisors(N-1)) -1)

Verdicts: Time Limit Exceeded

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from math import sqrt
from fractions import gcd
from collections import Counter

n = int(input()) 
times = 0


def gcd(tmpn):
    lists = []
    while True:
        end = True
        for i in range(2, int(sqrt(tmpn)) + 1):
            if tmpn % i == 0:
                lists.append(i)
                tmpn = tmpn // i
                end = False         
        if end:  
            lists.append(tmpn)
            break
    return lists


def gori(lists, num=1, ans=[]):
    if len(lists) == 0:
        ans.append(num)
        return ans
    for i in range(len(lists)):
        tmp = lists[0:i] + lists[i + 1:len(lists)]
        ans = gori(tmp, num * lists[i], ans)
        ans = gori(tmp, num, ans)
    return ans


a = Counter(gcd(n - 1))
times = sum(map(lambda x: x+1, a.values())) - 1

a = set(gori(gcd(n)))
a.remove(1)

for i in a:
    tmp = n // i
    if tmp < i:
        if tmp == 1:
            times += 1
        
    else:
        while True:
            if tmp < i:
                if tmp == 1:
                    times += 1
                    break
            if tmp % i == 0:
                tmp = int(tmp / i)
                    
            else:
                if tmp % i == 1:
                    times += 1
                break

print(times)      

from collections import Counter

n = int(input()) 
times = 0

def make_divisors(n):
    divisors = [n]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors
    
times = len(make_divisors(n - 1))
a = make_divisors(n)

for i in a:
    tmp = n // i
    if tmp == 1:
        times += 1 
        continue
    while tmp % i == 0:
        tmp = tmp // i
    if tmp % i == 1:
        times += 1 
    
print(times if n != 2 else 1)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
n = int(input())

count = 1
divisor = []

d = 2
while d * d < n - 1:
  if n % d == 1:
    count += 2
  d += 1
if d * d == n:
  count += 1

d = 2
while d * d < n:
  if n % d == 0:
    divisor.append(d)
    divisor.append(n // d)
  d += 1
if d * d == n:
  divisor.append(d)
count += 1

for d in divisor:
  tmp = n
  while tmp % d == 0:
    tmp //= d
  if tmp % d == 1:
    count += 1

n = int(input())

if n == 2:
  count = 1
else:
  count = 2
divisor = []

d = 2
while d * d < n - 1:
  if (n - 1) % d == 0:
    count += 2
  d += 1
if d * d == n - 1:
  count += 1

d = 2
while d * d < n:
  if n % d == 0:
    divisor.append(d)
    divisor.append(n // d)
  d += 1
if d * d == n:
  divisor.append(d)

for d in divisor:
  tmp = n
  while tmp % d == 0:
    tmp //= d
  if tmp % d == 1:
    count += 1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())
ans = set()

def check(N, k):
    if k<2:
        return False
    N //= k
    while N:
        if (N-1)%k==0:
            return True
        if N%k:
            return False
        N //= k

for k in range(1, int(N**0.5)+1):
    if (N-1)%k==0:
        ans.add(k)
        ans.add((N-1)//k)
    if N%k==0:
        if check(N, k):
            ans.add(k1)
        if check(N, N//k):
            ans.add(k2)

ans.remove(1)
print(len(ans))

N = int(input())

ans = set()
for k in range(1, int(N**0.5)+1):
    if (N-1)%k==0:
        k1, k2 = k, (N-1)//k
        if k1>=2:
            ans.add(k1)
        if k2>=2:
            ans.add(k2)
    if N%k==0:
        k1, k2 = k, N//k
        if k1>=2:
            v = N
            while v-1:
                if (v-1)%k1==0:
                    ans.add(k1)
                    break
                v //= k1
        if k2>=2:
            v = N
            while v-1:
                if (v-1)%k2==0:
                    ans.add(k2)
                    break
                v //= k2
print(len(ans))

N = int(input())
ans = set()

def check(N, k):
    if k<2:
        return False
    N //= k
    while N:
        if (N-1)%k==0:
            return True
        if N%k:
            return False
        N //= k

for k in range(1, int(N**0.5)+1):
    if (N-1)%k==0:
        ans.add(k)
        ans.add((N-1)//k)
    if N%k==0:
        if check(N, k):
            ans.add(k)
        if check(N, N//k):
            ans.add(N//k)

ans.remove(1)
print(len(ans))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors


N = int(input())
ans = 0
K_cand = set(make_divisors(N) + make_divisors(N-1))  

for K in K_cand:
    if K == 1:  
        continue

    
    while N%K == 0:
        N = N // K

    
    N = N%K

    
    if N == 1:
        ans += 1

print(ans)


from copy import deepcopy


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors

N0 = int(input())
ans = 0


K_cand = set(make_divisors(N0) + make_divisors(N0-1))
print(K_cand)

for K in K_cand:
    N = deepcopy(N0)
    if K == 1:  
        continue
    else:
        while N%K == 0:
            N = N // K  
        N = N%K  
        if N == 1:
            ans += 1

print(ans)


from copy import copy

def make_divisors(n):
    
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors


N0 = int(input())
cand = set(make_divisors(N0) + make_divisors(N0-1))

ans = 0
for K in cand:
    if K == 1:
        continue
    N = copy(N0)
    while N%K == 0:
        N //= K
    N %= K
    if N == 1:
        ans += 1

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
import numpy as np

N, M = map(int, input().split())
ABC = np.zeros((N, 3))
for i in range(N):
    ABC[i][0], ABC[i][1], ABC[i][2] = map(int, input().split())
DEF = np.zeros((M, 3))
for i in range(M):
    DEF[i][0], DEF[i][1], DEF[i][2] = map(int, input().split())


x_co = {-10**9-1, 10**9+1}
y_co = {-10**9-1, 10**9+1}
for i in range(N):
    x_co.add(ABC[i][0])
    x_co.add(ABC[i][1])
    y_co.add(ABC[i][2])
for i in range(M):
    x_co.add(DEF[i][0])
    y_co.add(DEF[i][1])
    y_co.add(DEF[i][2])

x_co = np.array(sorted(list(x_co)))
y_co = np.array(sorted(list(y_co)))
xL = len(x_co) - 1
yL = len(y_co) - 1
x_co_d = {x_co[i]: i for i in range(xL+1)}
y_co_d = {y_co[i]: i for i in range(yL+1)}


s_ex_tate = np.zeros((yL+1, xL))
s_ex_yoko = np.zeros((xL+1, yL))
for i in range(N):
    a = x_co_d[ABC[i][0]]
    b = x_co_d[ABC[i][1]]
    c = y_co_d[ABC[i][2]]
    s_ex_tate[c][a:b] = 1
for i in range(M):
    d = x_co_d[DEF[i][0]]
    e = y_co_d[DEF[i][1]]
    f = y_co_d[DEF[i][2]]
    s_ex_yoko[d][e:f] = 1


for i in range(xL):
    if x_co[i+1] > 0:
        xf = [i]
        break
    if x_co[i+1] == 0:
        xf = [i, i+1]
        break
for i in range(yL):
    if y_co[i+1] > 0:
        yf = [i]
        break
    if y_co[i+1] == 0:
        yf = [i, i+1]
        break

def sq(x, y):
    return int((x_co[x+1]-x_co[x]) * (y_co[y+1]-y_co[y]))


Q = []
# houmon = [[False] * yL for _ in range(xL)]
houmon = np.zeros((xL, yL))
ans = 0
is_inf = False
for x in xf:
    for y in yf:
        houmon[x][y] = 1
        Q.append((x, y))

while Q:
    x, y = Q.pop()
    if x in [0, xL-1] or y in [0, yL-1]:
        is_inf = True
        break
    ans += sq(x, y)
    if (not houmon[x-1][y]) and (not s_ex_yoko[x][y]):
        houmon[x-1][y] = True
        Q.append((x-1, y))
    if (not houmon[x][y-1]) and (not s_ex_tate[y][x]):
        houmon[x][y-1] = True
        Q.append((x, y-1))
    if (not houmon[x+1][y]) and (not s_ex_yoko[x+1][y]):
        houmon[x+1][y] = True
        Q.append((x+1, y))
    if (not houmon[x][y+1]) and (not s_ex_tate[y+1][x]):
        houmon[x][y+1] = True
        Q.append((x, y+1))
    
if is_inf:
    print('INF')
else:
    print(ans)

N = int(input())


# O(N**0.5)
def yakusu(N):
    ret = [[], []]
    for i in range(1, int(N ** 0.5)+1):
        if N % i == 0:
            ret[0].append(i)
            if i ** 2 != N:
                ret[1].append(N//i)
    return ret[0] + ret[1][::-1]

ans = 0
for a in yakusu(N):
    if a == 1: continue
    
    if N % a == 0:
        b = N
        while b % a == 0:
            b //= a
        if (b-1) % a == 0:
            ans += 1
print(ans + len(yakusu(N-1)) - 1)

Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
n = int(input())

def divisior(n):
    a = []
    i = 1
    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i != n): a.append(n//i)
        i += 1

    return a

ans = 0
a = divisior(n).sort()

for x in a[1:]:
    tmp = n
    while (tmp%x == 0): tmp = tmp//x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)




n = int(input())

def divisior(n):
    a = []
    i = 1
    while (i*i <= n):
        if n%i == 0:
            a.append(i)
            if (i*i != n): a.append(n//i)
        i += 1
    return a

ans = 0
a = divisior(n)

for x in a:
    if x == 1: continue
    tmp = n
    while (tmp%x == 0): tmp = tmp//x
    if (tmp%x == 1) : ans += 1

b = divisior(n-1)

ans = ans + len(b) -1

print(ans)




Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
N = int(input())

def check(p):
  _N = N
  while _N%p == 0:
    _N //= p
  return (_N-1)%p == 0

n = int(N**0.5) + 1
P0 = set([N])
P1 = set([N-1])
for i in range(2, n+1):
  if (N-1)%i == 0:
    P1.add(i)
    P1.add((N-1)//i)
  if N%i == 0:
    P0.add(i)
    P0.add(N//i)

P2.discard(1)
P1.discard(1)
ans = len(P1)
for p in P0:
  ans += check(p)

print(ans)

def check(p):
  _N = N
  while _N%p == 0:
    _N //= p
  return (_N-1)%p == 0

def calc_divisors(n):
    m = int(n**0.5)
    left = []
    right = []
    for i in range(1, m+1):
        if n%i == 0:
            left.append(i)
            right.append(n//i)
    if left[-1] == right[-1]:
        right.pop()
    return left + right[::-1]

N = int(input())
P0 = calc_divisors(N)[1:] 
P1 = calc_divisors(N-1)[1:] 
ans = len(P1)
for p in P0:
  ans += check(p)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
n=int(input())
nlist=make_divisors(n)
n1list=make_divisors(n-1)
# print(nlist)
# print(n1list)
answer=len(n1list)-1
for i in nlist[1:len(nlist)]:
    pra=n
    while (pra%i==0):
        pra=pra/i
    if pra%i==1:
        answer+=1
print(answer)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n=int(input())
nlist=make_divisors(n)
n1list=make_divisors(n-1)
# print(nlist)
# print(n1list)
answer=len(n1list)-1
for i in nlist[1:len(nlist)]:
    pra=n
    while (pra%i==0):
        pra=pra/i
    if pra%i==1:
        answer+=1
print(answer)


Verdicts: Runtime Error

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
n = int(input())
k = 2
count = 0
while k * k <= n:
    if n % k == 1:
        if k == n-1 or k*k == n-1:
            count += 1
        else:
            count += 2
    elif n % k == 0:
        n_copy = n
        while n_copy % k == 0:
            n_copy //= k
        if n_copy % k == 1:
            if k == n_copy-1 or k*k == n_copy-1:
                count += 1
            else:
                count += 2
    k += 1
print(count)


n = int(input())
k = 2
count = set()
while k * k <= n:
    if n % k == 1:
        count.add(k)
        count.add((n-1)//k)
    elif n % k == 0:
        n_copy = n
        while n_copy % k == 0:
            n_copy //= k
        if n_copy % k == 1:
            count.add(k)
    k += 1
if n > 2:
    count.add(n-1)
count.add(n)
print(len(count))


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
from collections import defaultdict

n = int(input())


def factorization_dict(k):
    ret = defaultdict(int)
    i = 2
    while k > 1 and i * i <= k:
        while k % i == 0:
            ret[i] += 1
            k //= i
        i += 1
    if k > 1:
        ret[k] += 1
    return ret


def factorization_list(k):
    ret = []
    i = 2
    while k > 1 and i * i <= k:
        while k % i == 0:
            ret += [i]
            k //= i
        i += 1
    if k > 1:
        ret += [k]
    return ret


fact = factorization_list(n)
fact1 = factorization_dict(n - 1)
print(fact)

s = set()


for i in range(1, pow(2, len(fact))):
    k = 1
    for j in range(len(fact)):
        if (i >> j) & 1:
            k *= fact[j]
    nn = n
    while nn % k == 0:
        nn //= k

    if nn % k == 1:
        s.add(k)

mul = 1
for v in fact1.values():
    mul *= v + 1

print(len(s) + mul - 1)

n = int(input())
if n == 2:
    print(1)
    exit()

fact = [n]
fact1 = [n-1]
i = 2
while i * i <= n:
    if n % i == 0:
        fact += [i]
        if n // i != i:
            fact += [n//i]
    i += 1

i = 2
while i * i <= n-1:
    if (n-1) % i == 0:
        fact1 += [i]
        if (n-1) // i != i:
            fact1 += [(n-1)//i]
    i += 1

ans = 0
for x in fact:
    k = n
    while k % x == 0:
        k //= x
    if k % x == 1:
        ans += 1

print(ans + len(fact1))

Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N.  We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.    * Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.  In how many choices of K will N become 1 in the end?

Submission attempts (in order):
def f_division_or_substraction():
    N = int(input())

    def divisor_list(n):
        
        ret = set()
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.update({k, n // k})
        return sorted(ret)

    ans = (len(divisor_list(N - 1)) - 1)  
    for k in divisor_list(N):
        if k == 1:
            continue
        n = N
        while n % k == 0:
            n //= k
        ans += 1
    return ans

print(f_division_or_substraction())


def f_division_or_substraction():
    N = int(input())

    def divisor_list(n):
        
        ret = set()
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.update({k, n // k})
        return sorted(ret)

    ans = (len(divisor_list(N - 1)) - 1)  
    for k in divisor_list(N):
        if k == 1:
            continue
        n = N
        while n % k == 0:
            n //= k
        ans += 1

print(f_division_or_substraction())

def f_division_or_substraction():
    N = int(input())

    def divisor_list(n):
        
        ret = set()
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.update({k, n // k})
        return sorted(ret)

    ans = (len(divisor_list(N - 1)) - 1)  
    for k in divisor_list(N):
        if k == 1:
            continue
        n = N
        while n % k == 0:
            n //= k
        ans += 1 if n % k == 1 else 0
    return ans

print(f_division_or_substraction())

Verdicts: Wrong Answer

Wrong Answer

Accepted