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):
N = int(input())
cmin = 10**5
for x in range(1,N):
    y = str(N-x)
    x = str(x)
    cnt = 0
    for i in range(len(x)):
        cnt += int(x[i])
    for j in range(len(y)):
        cnt += int(y[j])
    cmin = min(cmin,cnt)
print(cmin)

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

for a in range(1, n):

    b = n - a
    _list.append(sum(list(map(int, str(a)[::]))) + sum(list(map(int, str(b)[::]))))

print(min(_list))

Solution (Python):
def examA():
    N = SI()
    ans = 0
    for i in N:
        ans += int(i)
    if ans==1:
        ans = 10
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examA()

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

def Checker(sum, x):
    sum =  0
    while x > 0:
        sum += x % 10
        x = x // 10
    return sum

sum_list = []
for a in range(1, n):
    b = n - a
    sum_a = 0
    sum_b = 0
    
    y = Checker(sum_a, a)+ Checker(sum_b, b)
    sum_list.append(y)

print(min(sum_list))

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

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

def main():
	N = int(input())
	
	
	
	res = 1001001001
	t = 0
	for i in range(1,N):
		x = dsum(i)+dsum(N-i)
		if res>x:
			res = x
			t = i

	print(t,N-t,file=sys.stderr)
	print(res)
	
main()

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

Solution (Python):
A = input()
B = []
for i in A:
  B.append(int(i))
if sum(B) == 1:
  print('10')
else:
  print(sum(B))

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

ans = float("inf")
for a in range(1,n):
	b = n-a
	sa = str(a).rjust(6,"0")
	sb = str(b).rjust(6,"0")
	cnt = 0
	for i in range(6):
		cnt += int(sa[i]) + int(sb[i])

	ans = min(ans, cnt)

print(ans)

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

ans = 0
for i in range(len(n)):
  ans += int(n[i])
  
if ans == 1:
  print(10)
else:
  print(ans)

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

ans = 0
for i in range(len(n)):
  ans += int(n[i])
  
if ans == 1:
  print(10)
else:
  print(ans)

Solution (Python):
n=input()
if int(n)%10==0:
  print(10)
else:
  print(sum(map(int,list(n))))

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = input().rstrip()
    ans = sum(map(int, list(n)))
    if int(n) == 10 ** (len(n) - 1):
        ans = 10
    print(ans)
    return



if __name__ == '__main__':
    solve()

Solution (Python):

n=input()
ans=0
for i in range(len(n)):
    ans+=int(n[i])
if int(n)==10**(len(n)-1):
    ans=10
print(ans)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    if 10**(len(str(N))-1)==N:
        print(10)
    else:
        print(sum([int(i) for i in str(N)]))
        
if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
ans=float("inf")
for A in range(1,N):
    B=N-A
    num=0
    for i in range(4,-1,-1):
        a=A//10**i
        num+=a
        A%=10**i
        b=B//10**i
        num+=b
        B%=10**i
    ans=min(ans,num)
print(ans)

Solution (Python):
def main():
    from itertools import zip_longest
    N = int(input())
    ans = 1 << 60
    for i in range(1, N//2 + 2):
        c1 = str(i)
        c2 = str(N-i)
        cur = 0
        for s1, s2 in zip_longest(c1, c2, fillvalue=0):
            cur += int(s1) + int(s2)
        ans = min(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
ans = 10e9
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
  a = digitSum(a)
  b = digitSum(b)
  ans = min(ans, a+b)
print(ans)

Solution (Python):


import math
N=int(input())
ans=float('inf')
for i in range(1,math.ceil(N/2)+1):
    a_=str(i)
    b_=str(N-i)
    a=[int(j) for j in a_]
    b=[int(j) for j in b_]
    a=sum(a)
    b=sum(b)
    ans=min(ans,a+b)
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

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

if digit_sum(N) == 1:
    answer = 10
else:
    answer = digit_sum(N)
print(answer)

Solution (Python):


n=int(input())
k=str(n)
K=list(k)
count=True
for i in range(len(K)):
    if i==0:
        if K[i]!='1':
            break
    else:
        if K[i]!='0':
            break
    if i==len(K)-1:
        count=False
    

for j in range(len(K)):
    K[j]=int(K[j])
if count==True:
    print(sum(K))
else:
    print(10)

Solution (Python):
N=int(input())
sum_l=[]
for i in range(1,N):
    j=N-i
    i_l=list(str(i))
    j_l=list(str(j))
    sum_l.append(sum(list(map(int,i_l)))+sum(list(map(int,j_l))))

print(min(sum_l))

Solution (Python):
def main():
    from itertools import zip_longest
    N = int(input())
    ans = 1 << 60
    for i in range(1, N//2+1):
        cur = 0
        for c, d in zip_longest(str(i), str(N-i), fillvalue=0):
            cur += int(c) + int(d)
        ans = min(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
def dgsm(n):
    ans=0
    while n>0:
        ans+=n%10
        n//=10
    return(ans)
ans=10**6
n=int(input())
for i in range(1,n//2+1):
    ans=min(ans,dgsm(i)+dgsm(n-i))
print(ans)

Solution (Python):

N = int(input())

ans = 2 ** 30
for i in range(1, N//2 + 1):
    a = sum([int(c) for c in str(i)])
    b = sum([int(c) for c in str(N - i)])
    
    ans = min(ans, a+b)

print(ans)

Solution (Python):

n = int(input())
answer = 999999999

for i in range(1, n // 2 + 1):
    num_A = str(i)
    num_B = str(n - i)

    sum_digits_A = sum([int(j) for j in num_A])
    sum_digits_B = sum([int(j) for j in num_B])

    answer = min(answer, sum_digits_A + sum_digits_B)

print(answer)

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

s = []
for a in range(N + 1):
    s.append(sum([int(ch) for ch in str(a)]))

ans = 100000
for a in range(1, N//2 + 1):
    b = N - a
    ans = min(ans, s[a] + s[b])

print(ans)

Solution (Python):
n=input()
ls = [10**i for i in range(1,6)]
if int(n) in ls:
  print(10)
else:
  print(sum([int(list(n)[i]) for i in range(len(n))]))

Solution (Python):
n = int(input())
ans = 10**9
def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)
for a in range(1,n//2+3):
    b = n-a
    if a>=1 and b>=1:
        
        ans = min(digitSum(a)+digitSum(b),ans)
print(ans)

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

ret = float('inf')
for i in range(1, N) :
  ret = min(ret, sum(int(i) for i in str(i) + str(N - i)))

print(ret)

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


def sum_digit(num):
    tmp = str(num)
    res = 0
    for i in tmp:
        res += int(i)
    return res


res = sum_digit(2) + sum_digit(N - 2)
for i in range(3, N):
    tmp = sum_digit(i) + sum_digit(N - i)
    if res > tmp:
        res = tmp

print(res)

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

mini = None
for a in range(1, N):
    b = N - a

    a_sum = sum(int(c) for c in str(a))
    b_sum = sum(int(c) for c in str(b))

    if mini is None or (a_sum + b_sum) < mini:
        mini = a_sum + b_sum

print(mini)

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

ans=10**10
for i in range(1,n):
    a=str(i)
    b=str(n-i)
    temp=0
    for j in a:
        temp+=int(j)
    for j in b:
        temp+=int(j)
    ans=min(ans,temp)
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 = int(input())
ans = 10000
for i in range(1,n):
    a = str(i)
    b = str(n - i)
    a_tmp = 0
    b_tmp = 0
    for j in a:
        a_tmp += int(j)
    for k in b:
        b_tmp += int(k)
    if a_tmp + b_tmp < ans:
        ans = a_tmp + b_tmp
print(ans)

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

N = int(input())
a = list(range(1,N))
ans = 999999
 
for i in a:
	b = N - i
	c = digitSum(i)
	d = digitSum(b)
	if c + d < ans:
		ans = c + d

print
print(ans)

Solution (Python):
N=int(input())
ans = 1<<30
for i in range(1,N):
  a = i
  b = N-i
  t = sum(map(int,list(str(a)))) + sum(map(int,list(str(b))))
  ans = min(ans, t)
print(ans)

Solution (Python):


def ketatashi(a):
	a = str(a)
	ans = 0
	
	for i in range(len(a)):
		ans = ans + int(a[i])
	
	return ans
	

n = int(input())

min = 100

if n == 2:
	print(2)
	exit()

for i in range(1,n//2):
	if ketatashi(i) + ketatashi(n-i) < min :
		min = ketatashi(i) + ketatashi(n-i)
	

print(min)

Solution (Python):
N = int(input())
res = 99999
for a in range(1, N): 
        sum_ = 0 
        b = N - a 
        while (a > 0): 
                sum_ += a % 10
                a //= 10
        while (b > 0): 
                sum_ += b % 10
                b //= 10
        res = min(res, sum_)
print(res)

Solution (Python):
N = int(input())
A = []
while N != 0:
  A.append(N%10)
  N //= 10
if sum(A) == 1:
  print(10)
else:
  print(sum(A))

Solution (Python):



def findSumOfDigits(n):
    sum_digits = 0
    while n > 0 :
        sum_digits += n % 10
        n //= 10
    return sum_digits


def main()->None:
    N = int(input())
    
    range_A = range(1,N+1)
    min_total = 100000
    for a in range_A:
        b = N - a
        if b < 1 : continue
        sum_a = findSumOfDigits(a)
        sum_b = findSumOfDigits(b)
        total = sum_a + sum_b
        if total < min_total:
            min_total = total
    print(min_total)


if __name__ == "__main__":
    main()

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

ans = 10 ** 9
for a in range(1, n // 2 + 1):
    b = n - a
    tmp = sum([int(x) for x in str(a)])
    tmp += sum([int(x) for x in str(b)])
    ans = min(ans, tmp)

print(ans)

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

for i in str(n):
    sum += int(i)
if sum == 1:
    sum += 9
print(sum)

Solution (Python):
n = int(input())
m = n
sum = 0


for i in range(n):
    sum = m % 10 + sum
    m = m//10

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

Solution (Python):
s=input()
if s.count('0')==len(s)-1 and s[0]=='1':
    print(10)
else:
    
    print(sum(int(i) for i in s))

Solution (Python):



N = int(input())

l = []
for A in range(1,N):

    A_sum = sum(list(map(int,str(A))))
    B_sum = sum(list(map(int,str(N-A))))
    l.append(A_sum + B_sum)

print(min(l))

Solution (Python):
def F(N):
  return N if N < 10 else N % 10 + F(N // 10)

N = int(input())
x = F(N)

if x == 1:
  answer = 10
else:
  answer = x
  
print(answer)

Solution (Python):
def digit_10(n):
    dten = 0
    while(n>0):
        dten+=int(n%10)
        n/=10
    return dten

n = int(input())
l = []
for a in range(1,n):
    l.append(digit_10(a)+digit_10(n-a))
print(min(l))

Solution (Python):
n = int(input())
result =10**10
for i in range(1, n):
    A = str(i)
    a_sum = 0
    B = str(n - i)
    b_sum = 0
    for j in range(len(A)):
        a_sum += int(A[j])
    for k in range(len(B)):
        b_sum += int(B[k])
    if a_sum + b_sum <= result:
        result = a_sum + b_sum

print(result)

Solution (Python):
l = list(input())
if l[0]=="1" and set(l[1:]) == {"0"}:
  print(10)
else:
  ans = 0
  for i in l:
    ans += int(i)
  print(ans)

Solution (Python):
def calculate(n):
    ans = 0
    for i in range(len(str(n))):
        ans += n % 10
        n //= 10
    return ans


n = int(input())
val = 100000
num = []
for i in range(1, n):
    num.append([i, n-i])
    cal = calculate(num[i-1][0]) + calculate(num[i-1][1])
    if val > cal:
        val = cal
print(val)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    ans = INF
    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)

    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):
N = int(input())
ans = float('inf')
for i in range(1, N):
  ans = min(ans, sum([int(s) for s in str(i) + str(N-i)]))
print(ans)

Solution (Python):
N = int(input())
ans = float('inf')
for i in range(1,N):
    ans = min(ans,sum(list(map(int,str(i))))+sum(list(map(int,str(N-i)))))
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
res = INF
for i in range(1,n//2+2):
    tmp = 0
    t = str(i)
    j = str(n-i)
    for k in t:
        tmp += int(k)
    for k in j:
        tmp += int(k)
    res = min(res, tmp)
print(res)

Solution (Python):
N=int(input())
def f(x):
  s=0
  while x!=0:
    s+=x%10
    x//=10
  return(s)
minn=50
for i in range(1,N//2+1):
  minn=min(f(i)+f(N-i),minn)
print(minn)

Solution (Python):
N=int(input())
def f(x):
  s=0
  while x!=0:
    s+=x%10
    x//=10
  return(s)
minn=50
for i in range(1,N):
  minn=min(f(i)+f(N-i),minn)
print(minn)

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


def F(num):
    ans = 0
    for n in str(num):
        ans += int(n)
    return ans


min_num = 10**9
for A in range(1, N):
    B = N - A
    num = F(A) + F(B)
    if num < min_num:
        min_num = num
print(min_num)

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

ans=10**18
for i in range(1,n):
    ans=min(ans,sum(map(int,str(i)))+sum(map(int,str(n-i))))
print(ans)

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

def digit(n):
    return sum(list(map(int,str(n))))

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

Solution (Python):
n = int(input())
a = 0
b = n
m = 1000000
for i in range(n//2):
    a += 1
    b -= 1
    s = sum(list(map(int, list(str(a))))) + sum(list(map(int, list(str(b)))))
    m = min(m, s)
print(m)

Solution (Python):
n = int(input())
n_list = []
sum_list = []

for i in range(1,n//2+1):
  n_list.append([i,n-i])
for i in range(len(n_list)):
  a_rank = 0
  b_rank = 0
  for j in range(len(str(n_list[i][0]))):
    a_rank += int(str(n_list[i][0])[j])
  for j in range(len(str(n_list[i][1]))):
    b_rank += int(str(n_list[i][1])[j])
  sum_list.append(a_rank + b_rank)
print(min(sum_list))

Solution (Python):
n = int(input())
res = n
for i in range(1,n//2+1):
    tmp = 0
    a = str(n-i)
    b = str(i)
    for j in a:
        tmp += int(j)
    for j in b:
        tmp += int(j)
    res = min(res,tmp)
else:
    print(res)

Solution (Python):
N = int(input())
digits_sum_min = 1e9
for A in range(1, N):
    B = N - A
    digits_sum = 0
    for a in str(A):
        digits_sum+=int(a)
    for b in str(B):
        digits_sum+=int(b)      
    if digits_sum < digits_sum_min:
        digits_sum_min = digits_sum
print(digits_sum_min)

Solution (Python):
n=int(input())
ans=10**6
def calc(a,b):
  res=0
  for i in range(len(str(a))):
    res+=int(str(a)[i])
  for i in range(len(str(b))):
    res+=int(str(b)[i])
  return res
  
for i in range(1,n//2+1):
  a=i
  b=n-a
  ans=min(ans,calc(a,b))
print(ans)

Solution (Python):
def main():
  N = int(input())
  minimum = 1000000
  for A in range(1, N):
    B = N - A
    a_nums = list(map(lambda i: int(i), list(str(A))))
    b_nums = list(map(lambda i: int(i), list(str(B))))
    count = 0
    for a in a_nums:
      count += a
    for b in b_nums:
      count += b
    if minimum > count:
      minimum = count
  print(minimum)

main()

Solution (Python):
n = int(input())
minimum = n
for a in range(2, n-1):
    b = n-a
    sum_of_ab = sum([int(ad) for ad in str(a)]) + sum([int(bd) for bd in str(b)])
    if (sum_of_ab < minimum):
        minimum = sum_of_ab
print(minimum)

Solution (Python):

def get_ketawa(N):
    ans = 0
    while 1:
        if N == 0:
            break
        ans += N % 10
        N //= 10

    return ans
N = int(input())
tmp = get_ketawa(N)
if tmp == 1:
    print(10)
else:
    print(tmp)

Solution (Python):
def digit(x):
    if x <= 0: return 0
    return x % 10 + digit(x // 10)

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

ans = min(digit(a) + digit(n-a) for a in range(1, n))
print (ans)

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

for A in range(1, N+1):
    if 0 < N - A and N - A <= 100000:
        tempA = A
        tempB = N - A
        sumOfB = 0
        sumOfA = 0
        while tempA != 0 or tempB != 0:
            a = tempA % 10
            b = tempB % 10
            sumOfA += a
            sumOfB += b
            tempA = tempA // 10
            tempB = tempB // 10
        if sumOfA + sumOfB < ans:
            ans = sumOfA + sumOfB

print(ans)

Solution (Python):


n=int(input())
k=str(n)
K=list(k)
count=True
for i in range(len(K)):
    if i==0:
        if K[i]!='1':
            break
    else:
        if K[i]!='0':
            break
    if i==len(K)-1:
        count=False
    

for j in range(len(K)):
    K[j]=int(K[j])
if count==True:
    print(sum(K))
else:
    print(10)

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

check = n//2 +2
ans = 10**8

for i in range(1,check):
    s,t = str(i), str(n-i)
    s_li = list(s)
    t_li = list(t)
    
    s_li = [int(x) for x in s_li]
    t_li = [int(x) for x in t_li]
    
    ans = min(ans, sum(s_li)+sum(t_li))
    
print(ans)

Solution (Python):


N = int(input().split()[0])
S = str(N)
a_list = []
b_list = []
total = 0
if int(S[0]) == 1 and int(S[1:]) == 0:
    total = 10
else:
    for char in S:
        total += int(char)

ans = total

print(ans)

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

Solution (Python):
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def f(x):
    s = 0
    while x > 0:
        s += x % 10
        x //= 10
    return s


n = ri()
res = float('inf')
for a in range(1, n):
    res = min(res, f(a) + f(n - a))
print(res)

Solution (Python):
l = [int(i) for i in input()]
s = sum(l)
print(s if s!=1 else 10)

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

for i in range(1, N):
    b = N -i
    A=sum(list(map(int,list(str(i)))))
    B=sum(list(map(int,list(str(b)))))
    ans = min(ans, A+B)
print(ans)

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

def solve(n):
  for i in range(n//2):
    a=str(i+1)
    b=str(n-i-1)
    temp=0
    for ca in a:
      temp+=int(ca)
    for cb in b:
      temp+=int(cb)
    if i==0:
      res=temp
    else:
      res=min(res,temp)
  return res
  
print(solve(n))

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

for i in range(1, N):
    b = N -i
    A=sum(list(map(int,list(str(i)))))
    B=sum(list(map(int,list(str(b)))))
    ans = min(ans, A+B)
print(ans)

Solution (Python):
a = int(input())
mi=[]
for i in range(1,a):
    x=0
    y=0
    j = a - i
    for ii in str(i):
        x+=int(ii)
    for jj in str(j):
        y+=int(jj)
    mi.append(x+y)
print(min(mi))

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

ans = 0

while n / 10 > 0:
    ans += n % 10
    n = int(n / 10)

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

Solution (Python):

def findSumOfDigits(n):
  sum = 0
  while n > 0:
    sum += int(n % 10)
    n = int(n / 10)
  return sum

N = int(input())

if N % 10 != 0 :
  print(findSumOfDigits(N))
else:
  print("10")

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

ans = n
for i in range(1, n//2+1):
    A = str(i)
    B = str(n-i)
    c = 0
    for a in A:
        c += int(a)
    for b in B:
        c += int(b)
    ans = min(ans, c)
print(ans)

Solution (Python):
def digit_sum(n):
    ret=0
    while(n>0):
        ret+=n%10
        n=int(n/10)
    return ret

n=int(input())
ans=1000
for i in range(1,int(n/2)+1):
    tmp=digit_sum(i)+digit_sum(n-i)
    if ans>tmp:
        ans=tmp
print(ans)

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

N=int(input())
ans=100
for i in range(1,(N+1)//2+1):
    ans=min(ans,ds(i)+ds(N-i))
print(ans)

Solution (Python):

def dig(n):

    s = str(n)

    ret = 0

    for i in s:
        ret += int(i)

    return ret

N = int(input())

ans = float("inf")

for i in range(N // 2):
    i += 1
    j = N - i

    ans = min(ans, dig(i) + dig(j))

print (ans)

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

ans=100000000000000000
for i in range(1,N-N//2+1):
    a=sum(map(int,list(str(i))))
    b=sum(map(int,list(str(N-i))))
    ans=min(a+b,ans)
    
print(ans)

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

while n != 0:
    ans += n % 10
    n //= 10

if ans == 1 and len(N) > 1:
    print(10)
else:
    print(ans)

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

def wa(x):
    return sum([int(i) for i in list(str(x))])

ans = float("inf")
for i in range(1, n):
    j = n - i
    ans = min(ans, wa(i) + wa(j))

print(ans)

Solution (Python):
n = int(input())
min = 100000
for i in range(1,n):
  a = i
  b = n-i
  f = []
  while a > 0:
    f.append(a%10)
    a //= 10
  while b > 0:
    f.append(b%10)
    b //= 10
  if min>sum(f):
    min = sum(f)
print(min)

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

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

Solution (Python):
N=int(input())
m=[]
for A in range(1,N):
  s=0
  B=N-A
  a="".join(str(A))
  b="".join(str(B))
  for x in range(0,len(a)):
    s+=int(a[x])
  for y in range(0,len(b)):
    s+=int(b[y])
  m.append(s)
print(min(m))

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    mt = 10 ** 10
    for i in range(1, n):
        s = sum(list(map(int, list(str(i)))))
        t = sum(list(map(int, list(str(n - i)))))
        mt = min(mt, s + t)
    print(mt)


if __name__ == '__main__':
    slove()

Solution (Python):
n = int(input())
ans=n
for i in range(n-1):
    i+=1
    j=n-i
    i=list(str(i))
    j=list(str(j))
    for a in range(len(i)):
        i[a]=int(i[a])
    for a in range(len(j)):
        j[a]=int(j[a])
    if sum(i)+sum(j)<ans:
        ans=sum(i)+sum(j)
print(ans)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())

ans = INF
for a in range(1, N):
    b = N - a
    ans = min(ans, sum(list(map(int, str(a)))) + sum(list(map(int, str(b)))))
print(ans)

Solution (Python):
N=int(input())
m=[]
for A in range(1,N):
  s=0
  B=N-A
  a="".join(str(A))
  b="".join(str(B))
  for x in range(0,len(a)):
    s+=int(a[x])
  for y in range(0,len(b)):
    s+=int(b[y])
  m.append(s)
print(min(m))

Solution (Python):
n=int(input())
import math
ans=10**40
for i in range(1,n//2+1):
	x=i
	y=n-i
	p=0
	for j in range((int(math.log(x,10)+10**-7)+1)):
		p+=x%10
		x=x//10
	for j in range((int(math.log(y,10)+10**-7)+1)):
		p+=y%10
		y=y//10
	ans=min(ans,p)
print(ans)

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

def sumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n //= 10
    return sum
ans = 10**5
for A in range(1,N//2+1):
    B = N - A
    ans = min(ans, sumOfDigits(A) + sumOfDigits(B))

print(ans)

Solution (Python):
n = int(input())
ans = 10 ** 9
for i in range(1, n // 2 + 1):
    ans = min(ans, eval("+".join(str(i))) + eval("+".join(str(n - i))))
print(ans)

Solution (Python):
N = int(input())
ans = 0
A = range(1, N)
for a in A:
    b = N - a
    a_ = list(str(a))
    sum_a = sum(int(i) for i in a_)

    b_ = list(str(b))
    sum_b = sum(int(i) for i in b_)

    if a == 1:
        ans = sum_a + sum_b
    elif ans > sum_a + sum_b:
        ans = sum_a + sum_b
print(ans)

Solution (Python):
N = int(input())
ans = 0
A = range(1, N)
for a in A:
    b = N - a

    sum_a = 0
    q, mod = divmod(a, 10)
    sum_a += mod
    while q != 0:
        q, mod = divmod(q, 10)
        sum_a += mod

    sum_b = 0
    q, mod = divmod(b, 10)
    sum_b += mod
    while q != 0:
        q, mod = divmod(q, 10)
        sum_b += mod

    if a == 1:
        ans = sum_a + sum_b
    elif ans > sum_a + sum_b:
        ans = sum_a + sum_b
print(ans)

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

for num in range(1, n//2+1):
    a = num
    b = n - num
    a_s = sum(list(map(int, str(a))))
    b_s = sum(list(map(int, str(b))))
    c = a_s + b_s
    s.append(c)

print(min(s))

Solution (Python):

import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())

def sum_N(N):
	total = 0
	x = N
	while x > 0:
		total += x % 10
		x = x // 10
	return total

ans = 1000000000000
for i in range(1, N):
	ans = min(ans, sum_N(i) + sum_N(N - i))

print(ans)

Solution (Python):
N = int(input())
ans = float('inf')
for i in range(1, N):
    A = i
    B = N - i
    total = sum([int(c) for c in str(A)])
    total += sum([int(c) for c in str(B)])
    ans = min(ans, total)
print(ans)

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

ans=10**5
for i in range(1,(n//2+2)):
    wa=0
    for j in range(len(str(i))):
        wa += int(str(i)[j])
    for k in range(len(str(n-i))):
        wa += int(str(n-i)[k])
    ans=min(ans,wa)
print(ans)

Solution (Python):
a = int(input())
if a % 10 == 0:
    print(10)
else:
    c = 0
    while (a > 0):
        c += a % 10
        a = a//10
    print(c)

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

min_n=10**10
for A in range(1,N):
  B=N-A
  min_n=min(min_n,sum(map(int,list(str(A)+str(B)))))
print(min_n)

Solution (Python):
N = int(input())
for i in range(1, 10):
  if N == 10**i:
    
    print(10)
    exit()
r = sum(map(int, str(N)))
print(r)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    mt = 10 ** 20
    for i in range(1, n // 2 + 1):
        sa = str(i)
        sb = str(n - i)
        t = 0
        for j in range(len(sa)):
            t += int(sa[j])
        for j in range(len(sb)):
            t += int(sb[j])
        mt = min(mt, t)
    print(mt)


if __name__ == '__main__':
    slove()

Solution (Python):
N = int(input())
def summ(X):
  a = X//10000
  b = (X - a*10000)//1000
  c = (X - a*10000 - b*1000)//100
  d = (X - a*10000 - b*1000 - c*100)//10
  e = X - a*10000 - b*1000 - c*100 - d*10
  return a+b+c+d+e
X = []
for A in range(1,N):
  B = N-A
  C = summ(A) + summ(B)
  X.append(C)
print(min(X))

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

def digitSum(n):
    return sum([int(s) for s in str(n)])

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

print(ans)

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

Solution (Python):

def calcDigitSum(n):
    digitSum = 0
    digitSum += n % 10
    wari = n // 10

    while wari > 0:
        digitSum += wari % 10
        wari = wari // 10
    
    return digitSum

n = int(input())

a = 1
b = 0
ad = 0
bd = 0

if n % 10 != 0:

    while ad <= 0 or bd <= 0:
        ad = calcDigitSum(a)

        bd = calcDigitSum(n - a)

        a += 1
        b = n - a

    print(ad + bd)

else:
    print(10)

Solution (Python):
def resolve():
    n = int(input())
    ans = 10 ** 9
    for i in range(1, n):
        a, b = i, n - i
        sa = sum([int(d) for d in str(a)])
        sb = sum([int(d) for d in str(b)])
        if sa + sb < ans:
            ans = sa + sb
    print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):
N = input()

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

if ans == 1:
    ans = 10

print(ans)

Solution (Python):
n = int(input())
if n %10 ==0:
  print('10')
else:
  a = [str(i) for i in str(n)]
  print(sum(int(k) for k in a) )

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

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

ans = 10 ** 6
for i in range(1, N//2+1):
    A = i
    B = N - i
    ans = min(ans, sum(map(int, str(A))) + sum(map(int, str(B))))

print(ans)