Problem:
 Score : 200 points    Problem Statement Takahashi has two positive integers A and B .  It is known that A plus B equals N .
Find the minimum possible value of "the sum of the digits of A " plus "the sum of the digits of B " (in base 10 ).      Constraints  2 ≤ N ≤ 10^5  N is an integer.         Input Input is given from Standard Input in the following format:  N       Output Print the minimum possible value of "the sum of the digits of A " plus "the sum of the digits of B ".        Sample Input 1 15      Sample Output 1 6  When A=2 and B=13 , the sums of their digits are 2 and 4 , which minimizes the value in question.       Sample Input 2 100000      Sample Output 2 10

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()

ans = INF
for i in range(1, N):
    total = 0
    A = str(i)
    B = str(N-i)
    for a in A:
        total += int(a)
    for b in B:
        total += int(b)
    ans = min(ans, total)
print(ans)

Solution (Python):
n = int(input())
res = float('inf')
for a in range(1, int(n/2)+1):
    b = n-a
    tmp = 0
    for c in str(a):
        tmp += int(c)
    for c in str(b):
        tmp += int(c)
    res = min(res, tmp)
print(res)

Solution (Python):
import math
n = int(input())
if math.log10(n) %1 == 0:
    print(10)
    exit()
else:
    ans = 0
    n = str(n)
    for i in range(len(n)):
        ans += int(n[i])
print(ans)

Solution (Python):
N = int(input())
if N == 2:
    print(2)
    exit()
ans = float('inf')
for i in range(2,N):
    A = i
    B = N - i
    tmp = 0
    for k in str(A):
        tmp += int(k)
    for k in str(B):
        tmp += int(k)
    ans = min(ans,tmp)
print(ans)

Solution (Python):
n=int(input())
ans=1e10
for i in range(1,n//2+1):
  ans=min(ans,sum(map(int,list(str(i))))+sum(map(int,list(str(n-i)))))
print(ans)

Solution (Python):
n = int(input())
ans = 10**10
for i in range(1,n):
    j = n-i
    l1 = len(str(i))
    l2 = len(str(j))
    l1_cnt,l2_cnt = 0,0
    for k in range(l1):
        l1_cnt +=int(str(i)[k])
    for l in range(l2):
        l2_cnt +=int(str(j)[l])
    ans = min(ans,l1_cnt+l2_cnt)
print(ans)

Solution (Python):
N=int(input())
ans=10**17
for i in range(1,N//2+1):
  j=N-i
  i_str=str(i)
  j_str=str(j)
  tmp1=0
  tmp2=0
  for v1 in range(len(i_str)):
    tmp1+=int(i_str[v1])
  for v2 in range(len(j_str)):
    tmp2+=int(j_str[v2])
  ans=min(ans,tmp1+tmp2)
print(ans)

Solution (Python):
N = int(input())
ans = 10**5
for a in range(1, N//2 + 1):
    suma = 0
    sumb = 0
    b = N - a
    while a > 0:
        suma += a % 10
        a //= 10
    while b > 0:
        sumb += b % 10
        b //= 10
    if (suma + sumb) < ans:
        ans = suma + sumb
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
check = [10, 100, 1000, 10000, 100000]
ans = 0
if n in check:
    ans = 10
else:
    n = str(n)
    for i in range(len(n)):
        ans += int(n[i])
print(ans)

Solution (Python):

import sys


def solve(N: int):
    s_n = str(N)
    keta = len(s_n)

    if N == 10**(keta-1):
        print(10)
        return
    answer = 0
    for i in range(keta):
        answer += int(s_n[i])
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
from math import log10
N=input()

if log10(int(N)) % 1==0:
    print("10")
else:
    print(sum(map(int, list(N))))

Solution (Python):
def sumDigits(i):
    s = 0
    while i > 0:
        s += (i % 10)
        i = int(i / 10)
    return s

def main():
    N = int(input())
    m2 = 9 * 6
    for i in range(1, N + 1):
        k = N - i
        if k > 0:
            m2 = min(m2, sumDigits(i) + sumDigits(k))
    print(m2)

main()

Solution (Python):
def sumDigits(i):
    s = 0
    while i > 0:
        s += (i % 10)
        i = int(i / 10)
    return s

N = int(input())

m = 9*6
for i in range(1, N):
    k = N - i
    m = min(m, sumDigits(i) + sumDigits(k))

print(m)

Solution (Python):
def sumDigits(i):
    s = 0
    while i > 0:
        s += (i % 10)
        i = int(i / 10)
    return s

N = int(input())

m = 9*6
for i in range(1, N):
    k = N - i
    m = min(m, sumDigits(i) + sumDigits(k))

print(m)

Solution (Python):
def sumDigits(i):
    s = 0
    while i > 0:
        s += (i % 10)
        i = int(i / 10)
    return s

N = int(input())

m = N
for i in range(1, N):
    k = N - i
    m = min(m, sumDigits(i) + sumDigits(k))

print(m)

Solution (Python):



def sumOfDigits(n):
    res = 0
    while n > 0:
        res += n % 10
        n //= 10
    return res


n = int(input())
mn = n
for i in range(1, n):
    b = n - i
    mn = min(sumOfDigits(i) + sumOfDigits(b), mn)

print(mn)

Solution (Python):
n = int(input())

s = []
for i in range(1, n):
    j = n - i
    if i + j == n:
        a = sum(map(int, str(i)))
        b = sum(map(int, str(j)))
        s.append(a + b)
print(min(s))

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


def digsum(num):
    ans = 0
    while num > 0:
        p, q = divmod(num, 10)
        num = p
        ans += q
    return ans

N = I()
ans = INF
for i in range(1, N // 2 + 1):
    ans = min(ans, digsum(i) + digsum(N - i))
print(ans)

Solution (Python):
n = int(input())


def digit_sum(num):
    ret = 0
    s = str(num)
    for e in s:
        ret += int(e)

    return ret


ans = float("inf")
for a in range(1, n):
    b = n - a
    ds = digit_sum(a) + digit_sum(b)
    ans = min(ans, ds)

print(ans)

Solution (Python):
import sys
import math

def minSum(n):
    min_sum = 0
    for i in range(1, n):
        a = i
        b = n - i
        min_sum_a, min_sum_b = 0, 0
        while  a > 0:
            min_sum_a += a%10
            a = math.floor(a/10)
        while b > 0:
            min_sum_b += b%10
            b = math.floor(b/10)
        
        if i == 1:
            min_sum = min_sum_a + min_sum_b
        else:
            if min_sum > min_sum_a + min_sum_b:
                min_sum = min_sum_a + min_sum_b
    return min_sum

n = int(input())

print("{}".format(minSum(n)))

Solution (Python):
n = int(input());A = [] ; s = 0 ; t = 0

for i in range(1,n):
    for j in range(len(str(i))):
        s += int(str(i)[j])
    for k in range(len(str(n-i))):
        t += int(str(n-i)[k])
    a = s + t
    A.append(a)
    s = 0 ; t = 0
    
print(min(A))

Solution (Python):
N = int(input())

def _sum(s):
    result = 0
    S = str(s)
    for i in range(len(S)):
        result += int(S[i])

    return result

ans = 10**6
for A in range(1,N):
    B = N-A
    tmp = _sum(A)+_sum(B)
    if (tmp < ans):
        ans = tmp

print(ans)

Solution (Python):
n = int(input())
c = []
for i in range(1, n//2 +1):
    a = sum(map(int, str(i)))
    b = sum(map(int, str(n-i)))
    c.append(a+b)
print(min(c))

Solution (Python):
def get_digit_sum(n):
    result = 0
    while n > 0:
        result += n % 10
        n //= 10
    return result


def main():
    ab_sum = int(input())
    answer = float("inf")
    for i in range(1, ab_sum // 2):
        answer = min(answer, get_digit_sum(i) + get_digit_sum(ab_sum - i))
    print(answer if ab_sum > 3 else 2)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = 0
b = 0
ans = 10**9
for i in range(1,n):
    a = i
    b = n-i
    ans_a = 0
    ans_b = 0
    a = list(str(a))
    b = list(str(b))
    for i in range(len(a)):
        ans_a += int(a[i])
    for i in range(len(b)):
        ans_b += int(b[i])
    ans = min(ans,ans_a+ans_b)
print(ans)

Solution (Python):
def sum_digit(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num //= 10
    return sum

N = int(input())

ans = float("inf")

for A in range(1, N):
    B = N - A
    ans = min(ans, sum_digit(B) + sum_digit(A))

print(ans)

Solution (Python):
n=input()
ans=0
for i in n:
    ans += int(i)
if ans == 1 and len(n) >= 2:
    print(10)
else:
    print(ans)

Solution (Python):
n = int(input())
min = 100
a_sum = 0
b_sum = 0

for a in range(1, n):
  b = n-a
  while a >= 1:
    a_sum += a%10
    a = a//10
  
  while b >= 1:
    b_sum += b%10
    b = b//10
  
  if a_sum + b_sum < min:
    min = a_sum + b_sum
  
  a_sum = 0
  b_sum = 0

print(min)

Solution (Python):
n = int(input())
digit_sum_list = []

def digit_sum(t):
    r = t
    result_digit_sum = 0
    while(r > 0):
        result_digit_sum += r % 10
        r //= 10
    return result_digit_sum

for i in range(1, n+1):
    if digit_sum(i)+ digit_sum(n-i) >=2:
        digit_sum_list.append((digit_sum(i) + digit_sum(n-i)))
print(min(digit_sum_list))

Solution (Python):
N = input()
ans = 0

for i in range(len(N)):
    ans += int(N[i])

if ans >= 2:
    print(ans)
else:
    print(10)

Solution (Python):
N = input()
ans = 0
for n in N :
    ans += int(n)
if ans == 1 and len(N) >= 2 :
    print(10)
else :
    print(ans)

Solution (Python):
n = int(input())
li = []
for a in range(1, n):
    b = n - a
    a_sum = sum([int(x) for x in str(a)])
    b_sum = sum([int(y) for y in str(b)])
    total_sum = a_sum + b_sum
    li.append(total_sum)
print(min(li))

Solution (Python):
N = int(input())
ans = 10**9+7
for A in range(1,N//2+2):
    B = N - A
    A_ = [int(i) for i in list(str(A))]
    B_ = [int(i) for i in list(str(B))]
    ans = min(ans,sum(A_)+sum(B_))
print(ans)

Solution (Python):
n=int(input())
def digit(k):
  r=[int(i) for i in str(k)]
  return sum(r)
ans=100
for i in range(1,n//2 + 1):
  j=n-i
  ans = min(ans,digit(i)+digit(j))
print(ans)

Solution (Python):
n = int(input())
ans = 10**9
for i in range(1,n):
    ans_a = 0
    ans_b = 0
    a = str(i)
    b = str(n-i)
    for j in a:
        ans_a += int(j)
    for k in b:
        ans_b += int(k)
    ans = min(ans,ans_a+ans_b)
print(ans)

Solution (Python):
def dig_sum(n):
    rtn = 0
    while n > 0:
        rtn += n % 10
        n //= 10
    return rtn

def main():
    n = int(input())
    ans = 10**18
    for i in range(1, n//2+2):
        buf = dig_sum(i) + dig_sum(n-i)
        if buf < ans:
            ans = buf
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans = []

def digitSum(num):
    s = str(num)
    array = list(map(int,s))
    return sum(array)

for A in range(1,N):
    B = N-A
    ans.append(digitSum(A)+digitSum(B))
print(min(ans))

Solution (Python):
N = int(input())
ans = 10**5
for i in range(1,N):
    a = str(i)
    b = str(N - i)
    s = 0
    for j in range(len(a)):
        s += int(a[j])
    for j in range(len(b)):
        s += int(b[j])
    ans = min(s,ans)
print(ans)

Solution (Python):
N= int(input())
sum=0
while N>0:
    sum +=N%10
    N //=10
if sum ==1:
    print(10)
else:
    print(sum)

Solution (Python):
N=list(input())
ans=0
for x in N:
  x=int(x)
  if x%2==1:
    ans+=1
  ans+=(x//2)*2
if ans==1:
  print(10)
else:
  print(ans)

Solution (Python):
N = int(input())
mini = float("inf")
for A in range(1,N-1+1):
  mini = min(mini,sum([int(digit) for digit in str(A)])+sum([int(digit) for digit in str(N-A)]))
print(mini)

Solution (Python):
import math
n = int(input())
ans = 1001001001
for a in range(1, n):
    b = n - a
    if a > b: break
    map(int, str(a))
    cnddt = sum(map(int, str(a))) + sum(map(int, str(b)))
    ans = min(ans, cnddt)
print(ans)

Solution (Python):
n = int(input())

answer = int('9' * 5)
for i in range(1, n):
    str_w = str(n - i)
    str_i = str(i)

    answer = min(
        answer,
        sum([int(w) for w in str_w]) + sum([int(wi) for wi in str_i])
    )
print(answer)

Solution (Python):
N = list(input())
list1 = [int(x) for x in N]
if N.count("0") == len(N) - 1 and N[0] == "1" and len(N) != 1:
  print(10)
else:
  print(sum(list1))

Solution (Python):
N = int(input())
  
total = N
for i in range(N-2):
  A = i+2
  B = N - A
  a_total = 0
  for a in range(len(str(A))):
    a_total += int(str(A)[a])
  b_total = 0
  for b in range(len(str(B))):
    b_total += int(str(B)[b])
  
  if a_total + b_total < total:
    total = a_total + b_total
    

print(total)

Solution (Python):
N = int(input())
def kakuwa(n):
    res = 0
    while n > 0:
        res += n%10
        n //=10
    return res

ans = 10000
for a in range(1,N):
    s = kakuwa(a)+kakuwa(N-a)
    if(s < ans):
        ans = kakuwa(a)+kakuwa(N-a)
print(ans)

Solution (Python):
n = int(input())
c = n
def digitsum(n):
  s = 0
  while n>0:
    s += n % 10
    n //= 10
  return s
for i in range(1, n//2+1):
  a = digitsum(i)
  b = digitsum(n-i)
  if c > a + b:
    c = a + b
print(c)

Solution (Python):
N = int(input())

def calc_digits_sum(n):
    return sum([int(i) for i in list(str(n))])

ans = float('inf')
for i in range(1, N):
    A = i
    B = N - i
    
    a_sum = calc_digits_sum(A)
    b_sum = calc_digits_sum(B)
    
    ans = min(ans, a_sum + b_sum)
    
print(ans)

Solution (Python):
N = int(input())

def calc_digits_sum(n):
    return sum([int(i) for i in list(str(n))])

ans = float('inf')
for i in range(1, N):
    A = i
    B = N - i
    
    a_sum = calc_digits_sum(A)
    b_sum = calc_digits_sum(B)
    
    ans = min(ans, a_sum + b_sum)
    
print(ans)

Solution (Python):
N = int(input())

t = sum([int(i) for i in list(str(N))])


if t == 1:
    ans = 10
else:
    ans = t
print(ans)

Solution (Python):
import math
N=int(input())
c=0
min=float("inf")
for i in range(1,(N//2)+1):
    s1=list(str(i))
    s2=list(str(N-i))
    
    for j in range(len(s1)):
        c=c+int(s1[j])

    for j in range(len(s2)):
        c=c+int(s2[j])
    if c<min:
        min=c
    c=0
print(min)

Solution (Python):
def calc(x):
  ans=0;s=str(x)
  for c in s:
    ans+=int(c)
  return ans
N=int(input())

print(min([calc(a)+calc(N-a) for a in range(1,N)]))

Solution (Python):
n=input()
ans=0
for i in range(len(n)):
    ans+=int(n[i])
if ans==int(n[0]) and len(n)>=2:
    ans+=9
print(ans)

Solution (Python):
n = int(input())

ans = float("inf")
a, b = 0, 0
while True:
    a += 1
    b = n - a

    if b <= 0:
        break

    ans = min(ans, sum(map(lambda x: int(x), str(a))) + sum(map(lambda x: int(x), str(b))))

print(ans)

Solution (Python):
n = list(map(int, list(input())))
 
if n[0] == 1 and sum(n)  == 1:
    print(10)
else:
    print(sum(n))

Solution (Python):
n = list(map(int, list(input())))

if n[0] == 1 and sum(n)  == 1:
    print(10)
else:
    print(sum(n))

Solution (Python):
n = int(input())
if n%10==0:
    print(10)
    exit(0)
ans = pow(10,10)
for a in range(n+1):
    b = n-a
    tmp_ans = 0

    for sa in str(a):
        tmp_ans += int(sa)

    for sb in str(b):
        tmp_ans += int(sb)

    ans = min(ans, tmp_ans)
print(ans)

Solution (Python):
ans = 9999999999
n = int(input())
for a in range(1, n):
  b = n - a
  ans = min(ans, sum(map(int, list(str(a)))) + sum(map(int, list(str(b))))) 

print(ans)

Solution (Python):
N=int(input())
print(min(sum(map(int,str(i)))+sum(map(int,str(N-i))) for i in range(1, N//2+1)))

Solution (Python):
N =input()
list = [int(i) for i in N]

ans = sum(list)
if ans ==1:
  print(10)
else:
  print(ans)

Solution (Python):
N=int(input())
ans=0
for i in range(N//2):
  s=0
  a=i+1
  b=N-i-1
  while a>0 or b>0:
    s+=a%10+b%10
    a=a//10
    b=b//10
  if ans==0 or ans>s:
    ans=s
print(ans)

Solution (Python):
n = int(input())
mi = 9999999999999999
for i in range(1,n):
    jj = n - i
    r = 0
    si = str(i)
    sj = str(jj)
    for i in range(len(si)):
        r += int(si[i])
    for i in range(len(sj)):
        r += int(sj[i])
    if mi > r:
        mi = r
print(mi)

Solution (Python):
N = int(input())

ans = float("inf")

A = 0
B = N
for i in range(N//2):

    A += 1
    B -= 1

    if A + B > N:
        break

    else:

        s_a = str(A)
        s_b = list(str(B))

        a = [int(i) for i in s_a]
        b = [int(i) for i in s_b]

        ans = min(ans, sum(a)+sum(b))

print(ans)

Solution (Python):
N = int(input())
ans = N+1
for i in range(1,N//2+1):
    stra = str(i)
    strb = str(N-i)
    a = ''
    b = ''
    for j in range(len(stra)):
        a += stra[j]+'+'
    a = a[:-1]
    for j in range(len(strb)):
        b += strb[j]+'+'
    b = b[:-1]
    ans = min(ans,eval(a)+eval(b))
print(ans)

Solution (Python):
import numpy as np
N = int(input())

def Num_Each_Digit(N,limit):
    ans = np.array([])
    
    if N < 10**(limit):
        for i in range(1,limit+1):
            if (10**(i-1) > N):
                break
            if i == 1:
                ans = np.append( ans, (N%(10**i)))
            elif i > 1:
                ans = np.append( ans, (N%(10**i)-N%(10**(i-1)))/(10**(i-1)))

        return ans
                
    else:
        print("too large")
        return N
    
digit = Num_Each_Digit(N,10)
    
if N == 10**(len(digit)-1):
    print(10)
    
else:
    print(int(np.sum(digit)))

Solution (Python):
def main():
    N = list(str(input()))
    n = int("".join(N))
    sum_N = sum(list(map(int,N)))
    if n%10 == 0 and sum_N == 1:
        print(10)
    else:
        print(sum_N)


if __name__ == '__main__':
    main()

Solution (Python):



def digit_plus(num):
    i=num
    sum=0
    while i != 0:
        digit = i % 10
        sum += digit
        i //= 10
    
    return sum


n = int(input().strip())

min=n
for a in range(2,n):
    b = n - a
    sum_a_b = digit_plus(a) + digit_plus(b)

    if min > sum_a_b:
        min = sum_a_b

print(min)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    min_val = float('inf')
    for a in range(1, int(n/2)+1):
        b = n - a
        val = sum([int(c) for c in str(a)]) + sum([int(c) for c in str(b)])
        if val < min_val:
            min_val = val
    print(min_val)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())

def keta(num) :
    ket = 0
    while num > 0 :
        ket += num%10
        num //= 10
    return ket

ans = 1000

for i in range(1,N) :
    total = keta(i) + keta(N-i)
    ans = min(ans, total)

print(ans)

Solution (Python):
N = int(input())
MIN = float("inf")

def Sum_Digits(D):
  SUM = 0
  while D > 0:
    SUM += D%10
    D = int((D-D%10)/10)
  return SUM

for a in range(1, N):
  b = N - a
  A = Sum_Digits(a)
  B = Sum_Digits(b)
  if A + B < MIN:
    MIN = A + B
    
print(MIN)

Solution (Python):
n = int(input())

def d_sum(x):
    return sum(int(y) for y in str(x))

ans = float('inf')
for a in range(1, n):
    b = n - a
    dsum = d_sum(a) + d_sum(b)
    ans = min(ans, dsum)

print(ans)

Solution (Python):
n = int(input())

ans = float('inf')
for a in range(1, n):
    b = n - a
    dsum = 0
    for i in range(len(str(a))):
        x = int(str(a)[i])
        dsum += x
    for i in range(len(str(b))):
        x = int(str(b)[i])
        dsum += x
    ans = min(ans, dsum)

print(ans)

Solution (Python):
def digSum(num):
    ret = 0
    for c in num:
        ret += int(c)
    return ret

n = int(input())
ans = 10000
for i in range(1, n):
    a = str(i)
    b = str(n - i)
    ans = min(ans, digSum(a) + digSum(b))

print(ans)

Solution (Python):
def count(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n = n // 10
	return sum

N = int(input())
j = 0
ans = []

for i in range(1, N):
	j = N - i
	ans_count = count(i) + count(j)
	ans.append(ans_count)

print(int(min(ans)))

Solution (Python):
def sum_digit(num):
    sums = 0
    while num != 0:
        sums += num % 10
        num //= 10
    return sums

n = int(input())
min_ans = 9 * 4
for i in range(1, n):
    ans = sum_digit(i) + sum_digit(n - i)
    if min_ans > ans:
        min_ans = ans
print(min_ans)

Solution (Python):

s = input()
n = int(s)
for i in range(5):
    if n == 10**(i+1):
        print(10)
        exit()
        
print(sum([int(i) for i in s]))

Solution (Python):
N =input()
ans = 0
for i in range(len(N)):
    ans += int(N[i])
    
if(N[0] == "1" and int(N)%10 == 0):
    print(ans*10)
else:
    print(ans)

Solution (Python):
import math
N = int(input())
n = N
amari = 0
for i in range (len(str(N))):
  amari += n % 10
  n = math.floor(n / 10)
if amari == 1:
  print(10)
else:
  print(amari)

Solution (Python):
try:
    N = int(input())
    min_ = 99999
    for a in range(N):
        b = N-a
        if b>0 and a>0:
            j = sum(map(int, str(a)))
            i = sum(map(int, str(b)))
            _ = i + j
            if _<min_:
                min_ = _
    print(min_)
except EOFError:
    pass

Solution (Python):
def digits_sum(x):
    result = 0
    while x > 0:
        result += x % 10
        x //= 10
    return result

N = int(input())

result = 10**5

for A in range(1, N):
    B = N - A
    result = min(result, digits_sum(A) + digits_sum(B))

print(result)

Solution (Python):
N = int(input())

def SumDigits(num):
    sum = 0
    while True:
        sum += num % 10
        num //= 10
        if num == 0:
            break
    return sum

infinity = float('inf')
min = infinity

for x in range(1, N//2 + 1):
    
    
    
    if SumDigits(x) + SumDigits(N - x) < min:
        min = SumDigits(x) + SumDigits(N - x)
print(min)

Solution (Python):
N = int(input())

def SumDigits(num):
    sum = 0
    while True:
        sum += num % 10
        num //= 10
        if num == 0:
            break
    return sum

infinity = float('inf')
min = infinity

for x in range(1, N):
    if SumDigits(x) + SumDigits(N - x) < min:
        min = SumDigits(x) + SumDigits(N - x)
print(min)

Solution (Python):
N = int(input())

def SumDigits(num):
    sum = 0
    while True:
        sum += num % 10
        num //= 10
        if num == 0:
            break
    return sum

infinity = float('inf')
min = infinity

for x in range(1, N):
    if SumDigits(x) + SumDigits(N - x) < min:
        min = SumDigits(x) + SumDigits(N - x)
print(min)

Solution (Python):
N = int(input())

def SumDigits(num):
    sum = 0
    while True:
        sum += num % 10
        num //= 10
        if num == 0:
            break
    return sum

infinity = float('inf')
min = infinity

for x in range(1, N):
    if SumDigits(x) + SumDigits(N - x) < min:
        min = SumDigits(x) + SumDigits(N - x)
print(min)

Solution (Python):
N = int(input())
loopnum, _ = divmod(N,2)
min_count = 100000
ans = 100000

for num in range(1,loopnum+1):
    count = 0
    A = str(num)
    B = str(N-num)
    for i in range(len(str(A))):
        count += int(A[i])
    for j in range(len(str(B))):
        count += int(B[j])
    if min_count >= count:

        min_count = count
        ans = count
print(ans)

Solution (Python):
N = int(input())
print(min([sum([ord(c) - 48 for c in str(A)]) + sum([ord(c) - 48 for c in str(N - A)]) for A in range(1, N)]))

Solution (Python):
N = int(input())
n = 10 ** (len(str(N-1)) - 1)
a = list(str(N - n))
print(sum(list(map(int, a)))+1)

Solution (Python):
N = int(input())

if N%10 == 0:
    print(10)
else:
    l = []
    for i in range(6):
        l.append(int(N%10))
        N /= 10
    print(sum(l))

Solution (Python):
N = int(input())

summ = []
for i in range(1,N//2 + 1):
    A = []
    B = []
    k = N-i
    for __ in range(6):
        A.append(int(i%10))
        B.append(int(k%10))
        i /= 10
        k /= 10
    summ.append(sum(A+B))
print(min(summ))

Solution (Python):

import numpy as np
N = int(input())
Nd2 = int(np.ceil(N / 2))
min_total = np.inf
for i in range(1, -~Nd2):
    n = i
    n2 = N - i
    total = 0
    dig = 10
    while n:
        a, b = divmod(n, dig)
        n = a
        total += b
    while n2:
        a, b = divmod(n2, dig)
        n2 = a
        total += b
    min_total = min(min_total, total)

print(min_total)

Solution (Python):
N = int(input())
ans = float("inf")
for i in range(1, N):
    ans = min(ans, sum([int(n) for n in list(str(i))]
                       )+sum([int(n) for n in list(str(N-i))]))

print(ans)

Solution (Python):
n = int(input())
l = []
for i in range(1,n):
    l.append(sum([int(j) for j in list(str(n-i)+str(i))]))
print(min(l))

Solution (Python):
N=int(input())
a=[0]+[sum(map(int, list(str(i)))) for i in range(1, N+1)]
print(min([a[i]+a[N-i] for i in range(1, N//2+1)]))

Solution (Python):
N = input()
li = [int(i) for i in N]
ans = sum(li)
if ans == 1:
    print(10)
else:
    print(ans)

Solution (Python):
N =int(input())
x=0
y=0
while N//10**(y+1)>0:
    y=y+1
if N==10**y:
    print(10)
else:
    while y>=0:
        x=x+N//10**y
        N=N-(10**y)*(N//10**y)
        y=y-1
    print(x)

Solution (Python):
N = int(input())
if N == 10 or N == 100 or N == 1000 or N == 10000 or N == 100000:
	print(10)
else:
	ans = 0
	N = str(N)
	for i in range(len(N)):
		ans += int(N[i])
	print(ans)

Solution (Python):
n=int(input())
m=100000
for x in range(1,n//2+1):
  y=n-x
  x,y=list(str(x)),list(str(y))
  z=sum(list(map(int,x)))+sum(list(map(int,y)))
  m=min(m,z)
print(m)

Solution (Python):
n = input()
p = [10,10**2,10**3,10**4,10**5]
ans = 0
for i in range(len(p)):
    if int(n) == p[i]:
        ans = 10
        break
else:
    for i in range(len(n)):
        ans += int(n[i])
print(ans)

Solution (Python):
n=int(input())
ans=float('inf')

def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

for i in range(1,n):
    a=i
    b=n-i
    ans=min(ans,digitSum(a)+digitSum(b))

print(ans)

Solution (Python):
N = int(input())
A = [i for i in str(N)]
result = 0
for j in range(len(A)):
  result += int(A[j])
if result == 1 and A[0] == "1":
  print(10)
else:
  print(result)

Solution (Python):
n = input()
 
if int(n) % 10 == 0:
	print(10)
else:
	ans = 0
	for i in n:
		ans += int(i)
	print(ans)

Solution (Python):
import math





n = int(input())
n_1 = n-1

tot = 0
count = 0
num = int(n/2)
list_ini = list(str(n_1))
tot_min = 1 + sum(int(i) for i in list_ini)

for i in range(num):
  a = i+1
  b = n-i-1
  list_a = list(str(a))
  list_b = list(str(b))
  tot_a = sum(int(ii) for ii in list_a)
  tot_b = sum(int(ii) for ii in list_b)
  if(tot_min > tot_a + tot_b):
    tot_min = tot_a + tot_b
    
print(tot_min)

Solution (Python):
N = int(input())
s = [(i+1, N-i-1) for i in range((N-1) // 2 + 1)]
ss = [sum(list(map(int,list(str(v[0])[::1])))) + sum(list(map(int,list(str(v[1])[::1])))) for v in s]
print(min(ss))

Solution (Python):
ans=float('inf')
n=int(input())
for i in range(1,n):
    z=0
    j=n-i
    c=str(i)+str(j)
    for k in c:
        z+=int(k)
    ans=min(ans,z)
print(ans)

Solution (Python):
n = int(input())

ans = float("inf")  
for i in range(1, n):
    a = sum([int(i) for i in list(str(i))])
    b = sum([int(i) for i in list(str(n-i))])
    if ans > a+b:
        ans = a + b
print(ans)

Solution (Python):
n = int(input())
ans = 9*10
def f(x):
    kurainowa = 0
    while x>0:
        kurainowa += x%10
        x = x // 10
    return kurainowa
for a in range(1,n):
    b = n-a
    if ans > f(a) + f(b):
        ans = f(a) + f(b)
print(ans)

Solution (Python):
def sumNum(num, sums):
    if num == 0:
        return sums
    sums += num % 10
    num = num // 10
    return sumNum(num, sums)

N = int(input())
keta = 0

for A in range(1, N):
    B = N - A
    _A = sumNum(A, 0)
    _B = sumNum(B, 0)
    ret = _A + _B
    if keta == 0:
        keta = ret
    if keta <= ret:
        continue
    keta = ret

print(keta)

Solution (Python):
import math
N = int(input())
n = N
amari = 0
for i in range (len(str(N))):
  amari += n % 10
  n = math.floor(n / 10)
if amari == 1:
  print(10)
else:
  print(amari)

Solution (Python):
N = int(input())
ans = 10**9
def f(x):
    answer = 0
    while x>0:
        answer += x % 10
        x //= 10
    return answer

for a in range(1, N+1):
    b = N - a
    if f(a)+f(b)<ans and b != 0:
        ans = f(a)+f(b)
print(ans)

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
def calc(a,b):
    sa=list(str(a))
    sb=list(str(b))
    res=0
    for aa in sa:
        res+=int(aa)
    for bb in sb:
        res+=int(bb)
    return res

n=ni()
ans=10**6
for i in range(1,n):
    a=i
    b=n-i
    t=calc(a,b)
    ans=min(ans,t)
print(ans)

Solution (Python):
N = int(input())

anslist=[]

for i in range(1,N):
    a = str(i)
    b = str(N-i)
    asum = sum(list(map(int,a)))
    bsum = sum(list(map(int,b)))
    SUM = asum + bsum
    anslist.append(SUM)

print(min(anslist))

Solution (Python):
n = int(input())
mi = 10**9

def f(n):
    sums = 0
    while n>0:
        sums += n%10
        n //= 10
    return sums

for a in range(1, n+1):
    b = n-a
    if mi > f(a)+f(b) and b>0:
        mi = f(a)+f(b)
print(mi)

Solution (Python):
n = input()
length = len(n)

if n[0] == "1" and n[1:] == "0" * (length - 1):
  print(10)
else:
  print(sum(list(map(int, list(n)))))

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())

mi = 10**10

for i in range(1,n):
    a = str(i)
    b = str(n-i)
    point = 0
    for i in a:
        point += int(i)
    for j in b:
        point += int(j)
    mi = min(point,mi)
print(mi)

Solution (Python):
n = int(input())
ans = 10**10
for i in range(1,n):
	ans = min(ans,sum([int(j) for j in str(i)])+sum([int(j) for j in str(n-i)]))
print(ans)

Solution (Python):
N = int(input())


def f(X):
  return sum(list(map(int, str(X))))

summedDigit = 0
sumArray = []
for A in range(N+1):
  if A > 0 and A != N:
    B = N - A
    summedDigit = f(A) + f(B)
    sumArray.append(summedDigit)

print(min(sumArray))

Solution (Python):
N = int(input())


def f(X):
  return sum(list(map(int, str(X))))

summedDigit = 0
sumArray = []
for A in range(N+1):
  if A > 0:
    B = N - A
    if A != N:
      summedDigit = f(A) + f(B)
      sumArray.append(summedDigit)

print(min(sumArray))

Solution (Python):
N = int(input())
A = str(N - 1)
B = '1'
ans = 10 ** 9
for i in range(1, (N // 2) + 1):
    tmpa = list(map(int, A))
    tmpb = list(map(int, B))
    tmp = sum(tmpa) + sum(tmpb)
    ans = min(ans, tmp)
    A = str(N - i - 1)
    B = str(i + 1)

print(ans)

Solution (Python):
n = int(input())

ans = 0

for i in reversed(range(6)):
    k = n // (10 ** i)
    n = n % (10 ** i)
    ans += k

if ans != 1:
    print(ans)
elif ans == 1:
    print(10)