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):
def sum_of_dig(n):
    s = str(n)
    l = len(s)
    return sum(int(s[i]) for i in range(l))

N = int(input())
ans = sum_of_dig(N//2)+sum_of_dig(N-N//2)
for A in range(1, N//2):
    tmp = sum_of_dig(A)+sum_of_dig(N-A)
    if ans > tmp:
        ans = tmp
else:
    print(ans)

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

ans = 10000
for a in range(1, n):
    wa = (sum(list(map(int, list(str(a)))))) + (sum(list(map(int, list(str(n - a))))))
    if ans > wa:
        ans = wa

print(ans)

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

for i in str(N):
    a += int(i)
if a == 1:
    print(10)
else:
    print(a)

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

Solution (Python):
n=int(input())
minsum=float('inf')
for i in range(1,(n//2)+1):
    a=i
    b=n-i
    asum=0
    bsum=0
    while a>0:
        asum+=a%10
        a=a//10
    while b>0:
        bsum+=b%10
        b=b//10
    sum=asum+bsum
    if sum<minsum:
        minsum=sum
print(int(minsum))

Solution (Python):

import os,re,sys,operator,math,heapq,string


from itertools import accumulate,combinations
from sys import stdin,setrecursionlimit


setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
ans=10**9
if n&1:
    s,e=0,n
else:
    s,e=1,n-1
while s<=e:
    if s+e==n:
        now=0
        for i in str(s):
            now+=int(i)
        for i in str(e):
            now+=int(i)
        ans=min(ans,now)
    s+=1
    e-=1
print(ans)

Solution (Python):
N = int(input())
ans = 10**18
for A in range(1,N):
    result = 0
    B = str(N-A)
    A = str(A)
    for i in A+B:
        result += int(i)
    ans = min(ans,result)
print(ans)

Solution (Python):
ans=999

N=int(input())
for p in range(1,N//2+1):
    q= N-p

    p=list(str(p))
    p=list(map(int,p))
    q=list(str(q))
    q=list(map(int,q))

    ans=min(ans,sum(p)+sum(q))

print(ans)

Solution (Python):
def ketanowa(num):
  return sum(list(map(int,str(num))))

N = int(input())
ans = 10**5
for i in range(1, N//2+1):
  goukei = ketanowa(i) + ketanowa(N-i)
  ans = min(goukei, ans)
print(ans)

Solution (Python):
def ketanowa(num):
  return sum(list(map(int,str(num))))

N = int(input())
ans = 10**5
for i in range(1, N//2+1):
  goukei = ketanowa(i) + ketanowa(N-i)
  if goukei < ans:
    ans = goukei
print(ans)

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
def main():
  n = int(input())
  ans = 100000
  for i in range(1, (n+2)//2):
    r = (n-i)//10000 + ((n-i)//1000)%10 + ((n-i)//100)%10 + ((n-i)//10)%10 + (n-i)%10 
    l = i//10000 + (i//1000)%10 + (i//100)%10 + (i//10)%10 + i%10
    ans = min(ans, r + l)
  print(ans)
  
if __name__ == '__main__':
  main()

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

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

for A in range(1,N):
  Asum = sum(list(map(int, str(A)))) 
  Bsum = sum(list(map(int, str(N-A)))) 
  if ans > (Asum+Bsum):
    ans = (Asum+Bsum)

print(ans)

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

ans = 10**7

for A in range(1, N):
    B = N - A
    a = [int(a) for a in str(A)]
    b = [int(b) for b in str(B)]
    s = sum(a) + sum(b)
    
    if s < ans:
        ans = s
        
print(ans)

Solution (Python):
import math

if __name__ == '__main__':
    N = int(input())
    
    A_last = N // 2
    
    for A in range(1, A_last + 1):
        B = N - A
        A_origin = A
        
        A_sum = 0
        B_sum = 0
        
        while A > 0:
            r = A % 10
            A_sum += r
            A = A // 10
        
        while B > 0:
            r = B % 10
            B_sum += r
            B = B // 10
        
        total = A_sum + B_sum
        
        if A_origin == 1:
            total_min = total
        else:
            if total < total_min:
                total_min = total
    
    print(total_min)

Solution (Python):
n = int(input())
_min = None
for a in range(1, n):
    t = sum(map(int, list(str(a)))) + sum(map(int, list(str(n - a))))
    if _min is None or _min > t:
        _min = t
print(_min)

Solution (Python):
s=sum(map(int,input()));print(s*(s!=1)or 10)

Solution (Python):
n=int(input())
s=[]
for i in range(int(n/2)):
  a=str(i+1)
  b=str(n-int(a))
  s_a=0
  s_b=0
  for j in range(len(a)):
    s_a+=int(a[j])
  for k in range(len(b)):
    s_b+=int(b[k])
  s.append(s_a+s_b)
print(min(s))

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

minimum = 1e+9999
for a in range(1,N):
  b = N - a
  a_str = str(a)
  b_str = str(b)
  sum = 0
  for i in range(len(a_str)):
    sum += int(a_str[i])
  for i in range(len(b_str)):
    sum += int(b_str[i])
  if sum < minimum:
    minimum = sum
print(minimum)

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

min = n
for i in range(1, n):
  j = n -i
  
  a = i
  b = j
  
  
  total = 0
  while a > 0:
    total += a % 10
    a = int(a/10)
  while b > 0:
    total += b % 10
    b = int(b/10)
  if min > total:
    min = total
        
print(min)

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

s = 0
while N > 0:
    s += N % 10
    N //= 10
print(10 if s == 1 else s)

Solution (Python):
n=input()

if int(n)%10==0:
    print(10)
else:
    s=list(n)
    print(sum([int(ss) for ss in s]))

Solution (Python):
n=int(input())
val=10**5
for a in range(1,n):
	if sum(map(int,str(a)))+sum(map(int,str(n-a)))< val:
		val = sum(map(int,str(a))) + sum(map(int,str(n-a)))
print(val)

Solution (Python):
n=int(input())
val=10**5
for a in range(1,n):
	if sum(map(int,str(a)))+sum(map(int,str(n-a)))< val:
		val = sum(map(int,str(a))) + sum(map(int,str(n-a)))
print(val)

Solution (Python):
n=int(input())
val=10**5
for a in range(1,n):
	if sum(map(int,str(a)))+sum(map(int,str(n-a)))< val:
		val = sum(map(int,str(a))) + sum(map(int,str(n-a)))
print(val)

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


if __name__ == '__main__':
    slove()

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    def digitsum(n):
        res = 0
        while n:
            res += n%10
            n //= 10
        return res
    n = I()
    ans = float("inf")
    for a in range(1,(n>>1)+1):
        b = n-a
        m = digitsum(a)+digitsum(b)
        if m < ans:
            ans = m
    print(ans)
    return


def B():
    def comb(a,b):
        return fact[a]*inv_fact[b]*inv_fact[a-b]%mod
    mod = 998244353
    n,a,b,k = LI()
    fact = [1]*(n+1)
    for i in range(1,n+1):
        fact[i] = fact[i-1]*i%mod
    inv_fact = [None]*(n+1)
    inv_fact[n] = pow(fact[n],mod-2,mod)
    for i in range(n)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod

    ans = 0
    for x in range(n+1):
        if (k-a*x)%b == 0 and k >= a*x and k-a*x <= n*b:
            y = (k-a*x)//b
            ans += comb(n,x)*comb(n,y)%mod
        ans %= mod
    print(ans)


def C():
    n = I()
    d = LIR(n)
    x = [None for i in range(n)]
    for i in range(n):
        if d[i][0]*d[i][1] <= 0:
            x[i] = 0
        else:
            if d[i][1] < 0:
                x[i] = d[i][1]
            else:
                x[i] = d[i][0]
    x.sort(key = lambda x:x)
    l = 0
    r = n-1
    ans = abs(x[l])
    k = 1
    while r-l > 0:
        ans += x[r]-x[l]
        if k:
            k = 0
            l += 1
        else:
            k = 1
            r -= 1
    ans += abs(x[r])
    l = 0
    r = n-1
    ans2 = abs(x[r-1])
    k = 0
    while r-l > 0:
        ans2 += x[r]-x[l]
        if k:
            k = 0
            l += 1
        else:
            k = 1
            r -= 1
    ans2 += abs(x[r])
    print(max(ans,ans2))

def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    A()

Solution (Python):
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())

        ans = 100000000000000
        for A in range(1, N):
            B = N - A
            ans = min(ans, self.f(A) + self.f(B))
        print(ans)

    def f(self, n: int) -> int:
        s = str(n)
        res = 0
        for c in s:
            res += int(c)
        return res


if __name__ == '__main__':
    AtCoder().main()

Solution (Python):
n=int(input())
a=0
s=list(str(n))
sets=list(set(s))
sets.sort()
if len(sets)==2 and sets[0]=='0' and sets[1]=='1':
  print(10)
else:
  for i in s:
    a+=int(i)
  print(a)

Solution (Python):
N = int(input())
m = 999
M = []
N1 = 0
N2 = 0
for i in range(N-1):
  L1 = list(str(i+1))
  N1 = 0
  N2 = 0
  for j in range(len(L1)):
    N1 += int(L1[j])
  L2 = list(str(N - (i+1)))
  for j in range(len(L2)):
    N2 += int(L2[j])
  M.append(N1+N2)
print(min(M))

Solution (Python):
def main():
    N = int(input())
    min_v = float('inf')
    for i in range(1, N//2+1):
        s = str(i)
        t = str(N-i)
        v = sum([int(c) for c in s + t])
        min_v = min(min_v, v)
    return min_v


if __name__ == '__main__':
    print(main())

Solution (Python):
x=int(input())
count=10000
for a in range(1, x):
    suma=0
    sumb=0
    b=x-a
    while (a > 0):
        suma += a%10
        a= a//10
    while (b > 0):
        sumb += b%10
        b=b//10
    count = min(count, suma+sumb)
print(count)

Solution (Python):
x=int(input())
count=100000
suma=0
sumb=0
for a in range(1, x):
    b = x-a
    y = sum(map(int, str(a))) + sum(map(int, str(b)))
    if y<count:
        count=y
print(count)

Solution (Python):
n=int(input())
ans=100000000
for i in range(1,n):
  b=n-i
  _=sum(map(int,str(i))) + sum(map(int,str(b)))
  if _ < ans:
    ans = _
print(ans)

Solution (Python):
n = int(input())
kij=100
for i in range(1,n):
  aa = len(str(i))
  bb = len(str(n-i))
  asum=0
  bsum=0
  t=i
  s=n-i
  while(t>0):
    asum += t%10
    t = (t-t%10)/10
  while(s>0):
    bsum += (s)%10
    s = (s-s%10)/10
  if asum+bsum<kij:
    kij=asum+bsum
print(int(kij))

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

Solution (Python):


def sum_digits(val):
    work = 0
    while True:
        work += val % 10
        val //= 10
        if val == 0:
            break
    return work
   
n = int(input())

values = []
for a in range(1, n + 1):
    b = n - a
    if b < 1:
        continue
    
    values.append(sum_digits(a) + sum_digits(b))

values.sort()

print("0" if len(values) == 0 else values[0])

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

import sys
N = int(sys.stdin.readline().rstrip())
min = 1000000
for i in range(1, N):
    a = sumOfDigits(i)
    b = sumOfDigits(N-i)
    if min > a + b:
        min = a + b
print(min)

Solution (Python):
N = int(input())
candidates = []
for A in range(1,N):
  sumA = sum(list(map(int,str(A))))
  sumB = sum(list(map(int,str(N-A))))
  candidates.append(sumA + sumB)

candidates.sort()
print(candidates[0])

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

for a in range(1,n):
  b = n - a
  suma = 0
  sumb = 0
  for i in range(5):
    suma = suma + a%10
    a= a//10
  for i in range(5):
    sumb = sumb + b%10
    b= b//10
  array.append(suma+sumb)
  
print(min(array))

Solution (Python):
N = int(input())
a_sum = 0
b_sum = 0
Sum = []
for a in range(1,N):
  b = N-a
  a_sum = 0
  b_sum = 0
  while (a>0):
    a_sum += a%10
    a //= 10
  while (b>0):
    b_sum += b%10
    b //= 10
  Sum.append(a_sum+b_sum)
print(min(Sum))

Solution (Python):
n = int(input())
result = 1000
for i in range(1,n//2 + 1):
    b = n - i
    a2 = str(i)
    b2 = str(b)
    a_sum = 0
    b_sum = 0
    for x in range(len(a2)):
        a_sum += int(a2[x])
    for y in range(len(b2)):
        b_sum += int(b2[y])
    result = min(result,a_sum + b_sum)
print(result)

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

ans = 0
for i in range(6):
    ans += N % 10
    N //= 10
if ans == 1:
    ans = 10

print (ans)

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

lis1 = []
lis2 = []
ans = n

for a in range(1, int(n/2)+1):
	aa = 0
	bb = 0
	b = n - a
	
	for j in str(a):
		lis1.append(j)
	for i in range(len(lis1)):
		aa += int(lis1[i])
		
	for j in str(b):
		lis2.append(j)
	for i in range(len(lis2)):
		bb += int(lis2[i])
	s 	= aa + bb
	if s < ans:
		ans = s
		
	lis1.clear()
	lis2.clear()

print(ans)

Solution (Python):
N = int(input())
A_up = N // 2
f_min = 10 ** 5
for A in range(1, A_up+1):
    B = N - A
    f = sum(map(int, list(str(A)+str(B))))
    if f_min > f:
        f_min = f
print(f_min)

Solution (Python):

import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int):
    m = 1e18
    for i in range(1, N):
        res = sum([int(a) for a in list(str(i))]) + sum([int(b) for b in list(str(N-i))])
        m = min(res, m)
    print(m)
    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())

def f(x):
    s = 0
    for xi in str(x):
        s += int(xi)
    return s

ans = float("inf")
for i in range(1,n):
    a = i
    b = n-i
    ans = min(ans,f(a)+f(b))
print(ans)

Solution (Python):
n=input()
a=["10","100","1000","10000","100000"]
new=sum(list(map(int,n)))
if n in a:
    print(10)
else:
    print(new)

Solution (Python):



def sum_of_digits(x):
    return sum(map(int, str(x)))


N = int(input())
digits = [sum_of_digits(i) for i in range(0, N + 1)]
answer = digits[1] + digits[N - 1]
for i in range(1, N):
    a = digits[i] + digits[N - i]
    if answer > a:
        answer = a
print(answer)

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

def f(n):
  return sum(map(int, str(n)))

ans = 1e9+7
for i in range(1, N//2+1):
  ans = min(ans, f(i) + f(N - i))
print(ans)

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

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

box =[]

for x in range(1,n):
    y = n -x
    xsum = sum(list(map(int, str(x))))
    ysum = sum(list(map(int, str(y))))
    box.append(xsum + ysum)
            
    
            
print(min(box))

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

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

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

n = input().strip()

if str(n)[0] == "1" and all(c=="0" for c in str(n)[1:]):
    print(10)
else:
    ans = 0
    for c in str(n):
        ans += int(c)
    print(ans)

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

n = input().strip()

a = ""
b = ""

import math

for c in n:
    d = int(c)
    a += str(math.ceil(d/2))
    b += str(math.floor(d/2))

ans = 0
if int(n) % 10 == 0:
    ans += 9
for c in a:
    ans += int(c)
for c in b:
    ans += int(c)

print(ans)

Solution (Python):
n = int(input())
m = 1000
for i in range(1, n):
    m = min(m, sum(list(map(int, str(i)))) + sum(list(map(int, str(n - i)))))
print(m)

Solution (Python):
Num = int(input())
stack =0
Min = 100000000000

for i in range(1,Num):
    Num_Array = [Num - i , i]

    for x in range(2):
        while not 0 <= Num_Array[x] < 1:
             stack +=  Num_Array[x] % 10
             Num_Array[x] = int(Num_Array[x] / 10)
    if Min > stack:
        Min = stack

    stack = 0
print(Min)

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

ans = 10 ** 5

for i in range(1, n//2+1):
  t = str(i) + str(x-i)
  temp = 0
  for j in t:
    temp += int(j)
  ans = min(ans, temp)

print(ans)

Solution (Python):
n = int(input())
t = 10 ** (len(str(n - 1)) - 1)
print(sum(int(e) for e in str(t)) + sum(int(e) for e in str(n - t)))

Solution (Python):
n=int(input())
count=[]
for a in range(1,n) :
  b=n-a
  la=list(str(a));lb=list(str(b))
  suma=0;sumb=0
  for sa in la :
    suma+=int(sa)
  for sb in lb :
    sumb+=int(sb)
  count.append(suma+sumb)
print(min(count))

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

for i in range(1, N//2+1):
    a = str(i)
    b = str(N - i)
    wa_a = sum([int(t) for t in a])
    wa_b = sum([int(t) for t in b])
    if result > wa_a + wa_b:
        result = wa_a + wa_b
print(result)

Solution (Python):
n=int(input());s=lambda x:sum(map(int,str(x)));print(min(s(x)+s(n-x)for x in range(1,n//2+2)))

Solution (Python):

def main():
    ans = sum(list(map(int,list(input()))))
    if  ans!=1:
        print(ans)
    else:
        print(10)
 

    
if __name__== "__main__":
    main()

Solution (Python):
n = int(input())
mt = 10 ** 9
for i in range(1, n):
    t = 0
    for j in range(len(str(i))):
        t += int(str(i)[j])
    for j in range(len(str(n - i))):
        t += int(str(n - i)[j])
    mt = min(mt, t)
print(mt)

Solution (Python):
N = int(input())
score = float('inf')
for a in range(1,N):
    b = N-a
    x = 0
    for i in str(a)+str(b):
        x += int(i)
    score = min(score,x)
print(score)

Solution (Python):

N = int(input())


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


s = sumdigit(1) + sumdigit(N-1)  
for i in range(N // 2):
    A = i + 1
    B = N - A
    tmp = sumdigit(A) + sumdigit(B)
    s = min(s, tmp)
print(str(s))

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

def find(a):
    global total
    total = 0
    while a > 0:
        total += a % 10
        a //= 10
    return total

ans = float('inf')
for i in range(1,n):
    tmp = find(i) + find(n-i)
    ans = min(ans, tmp)
print(ans)

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

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

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

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

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

min_sum = None
for A in range(1,N):
  B = N - A
  a = [int(i) for i in list(str(A))]
  b = [int(i) for i in list(str(B))]
  y = sum(a) + sum(b)
  if min_sum is None or y < min_sum:
    min_sum = y
print(min_sum)

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

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

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

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

for i in range(1,N):
    tmp1 = list(str(i))
    tmp2 = list(str(N-i))
    s1 = 0
    s2 = 0
    for j in range(len(tmp1)):
        s1 += int(tmp1[j])
    for j in range(len(tmp2)):
        s2 += int(tmp2[j])
    tmp3 = abs(s1+s2)
    l.append(tmp3)

ans = min(l)
print(ans)

Solution (Python):
N = int(input())
n = N//2

def get_val(num1, num2):
  num1 = sum([int(i) for i in str(num1)])
  num2 = sum([int(i) for i in str(num2)])
  return num1 + num2
  
ans = 10**9
for i in range(1, n+2):
  pool = get_val(i, N-i)
  if ans > pool:
    ans = pool
print(ans)

Solution (Python):
N=sum(map(int,input()))
if N==1:
  print(10)
else:
  print(N)

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

wa_min = n
for i in range(1,n+1):
	n1 = n - i
	n2 = i
	wa1 = 0
	wa2 = 0
	while n1 > 0:
		mod = n1 % 10
		wa1 += mod
		n1 = n1 // 10
	while n2 > 0:
		mod2 = n2 % 10
		wa2 += mod2
		n2 = n2 // 10
	if (wa1 + wa2) < wa_min:
		wa_min = (wa1 + wa2)
	if i == n-i:
		break
print(wa_min)

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

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

mi = 100000000

for a in range(1,N):
    x = a
    sa = 0
    
    while x!=0:
        sa = sa + x%10
        x = x//10
   
    x = N-a
    sb = 0
    
    while x!=0:
        sb = sb +x%10
        x = x //10

    if sa +sb < mi:
        mi = sa + sb

print(mi)

Solution (Python):
def SOD(n):
    ans=0
    while n>0:
        ans+=n%10
        n=n//10
    return ans
ans=SOD(int(input()))
if ans==1:
    print(10)
else:print(ans)

Solution (Python):
a = int(input())
e = 10 ** 9
for i in range(10 ** 6):
    if i > a:
        break
    else:
        b = str(i)
        c = str(a - int(b))
        d = 0
        if int(b) > 0 and int(c) > 0:
            for j in range(len(b)):
                d += int(b[j])
            for j in range(len(c)):
                d += int(c[j])
            e = min(e, d)
print(e)

Solution (Python):
n=sum(map(int,input()));print([n,10][n==1])

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

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

print(10 if n in [10 ** x for x in range(6)] else sum(map(int,str(n))))

Solution (Python):
N=int(input())
ans=10000000000
for i in range(N-1):
        sum = 0
        num = i+1
        smu=0
        while num!=0:
        	dig = num % 10
        	sum = sum + dig
        	num = int(num / 10)
        smu+=sum
        sum=0
        num = N-(i+1)
        while num!=0:
        	dig = num % 10
        	sum = sum + dig
        	num = int(num / 10)
        smu+=sum
        ans=min(ans,smu)
print(ans)

Solution (Python):
N = int(input())
s = []
for i in range(1,N):
    a = 0
    b = 0
    A = i
    B = N-i
    while A != 0:
        a += A%10
        A = A//10
    while B !=0:
        b += B%10
        B = B//10
    add = a+b
    s.append(add)
print(min(s))

Solution (Python):
n=int(input())
ans=10**9+7
for i in range(1,n//2+1):
    tmp=sum([int(i) for i in list(str(i))])+sum([int(i) for i in list(str(n-i))])
    if tmp<ans:ans=tmp
print(ans)

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

def sum_10(n):
  return sum([int(l) for l in str(n)])

li=[]
for i in range(1,N//2 +1):
    if N - N//2 <= N - i <= N:
      li.append(sum_10(i)+sum_10(N - i))
print(min(li))

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

for i in range(1, N):
  temp = 0
  n = str(i)
  m = str(N-i)
  for j in range(len(n)):
    temp += int(n[j])
  for j in range(len(m)):
    temp += int(m[j])
  ans = min(ans, temp)
print(ans)

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

N = int(input())
examples = list()

for i in range((N//2)+1)[1:]:
    A = i
    B = N - i
    total = findSumOfDigits(A) + findSumOfDigits(B)
    examples.append(total)

print(min(examples))

Solution (Python):
N = int(input())
sum_min = 10000000
for a in range((N)//2+1):
    n_a = a+1
    n_b = N-a-1
    sum_a = 0
    sum_b = 0
    while(n_a>0):
        sum_a += n_a%10
        n_a //= 10
    while(n_b>0):
        sum_b += n_b%10
        n_b //= 10
    sum_all = sum_a + sum_b
    if(sum_all <= sum_min):
        sum_min = sum_all
print(sum_min)

Solution (Python):


def main():
    n = int(input())
    ans = sum(map(int, str(n)))  
    print(ans if ans != 1 else 10)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    n = int(input())
    ans = float("inf")
    for i in range(1, n // 2 + 1):
        j = n - i
        ds = sum(map(int, str(i))) + sum(map(int, str(j)))  
        ans = min(ans, ds)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
f = 10 ** 9
for i in range(1, a):
    c = str(a-i)
    d = str(i)
    e = 0
    for j in range(len(c)):
        e += int(c[j])
    for j in range(len(d)):
        e += int(d[j])
    f = min(f, e)
print(f)

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

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

Solution (Python):
Ns = input()
Nint = int(Ns)
tens = [10**i for i in range(1,6)]

result = 0
if Nint in tens:
    result = 10
else:
    result = sum(list(map(int,list(Ns))))

print(result)

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


ans = sum(list(map(int,n)))

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

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

def dig(a):
    ret = 0
    while a:
        ret += a % 10
        a //= 10
    return ret

ans = 100000000000000
for i in range(1, n):
    ans = min(ans, dig(i)+dig(n-i))
print(ans)

Solution (Python):
N=input()
if int(N)%10==0:
    print(10)
else:
    sum=0
    for i in range(len(N)):
        sum+=int(N[i])
    print(sum)

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

Solution (Python):

from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

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

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

    minnum = BIGNUM
    for A in range(1, N):
        B = N - A
        n = numsum(A) + numsum(B)
        if n < minnum:
            minnum = n
    print(minnum)

if __name__ == '__main__':
    main()

Solution (Python):
def addnum(a):
    a = str(a)
    sum = 0
    for i in range(len(str(a))):
        sum += int(a[i])
    return sum

N = int(input())
min = 10**9
tmp = 0
for A in range(1,N//2+2):
    B = N-A
    tmp = addnum(A)+addnum(B)
    if min>tmp:
        min = tmp
print(min)

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

def get_sum(num):
    i = num
    s = 0
    while i != 0:
        s += i % 10
        i = i // 10
    return s


if N % 2 == 0:
    last_A = int(N/2)
else:
    last_A = int((N-1)/2 + 1)

ans = float("inf")
for A in range(1, last_A + 1):
    B = N - A
    sum_of_AB = get_sum(A) + get_sum(B)
    ans = min(ans, sum_of_AB)

print(ans)

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

ans = N
for A in range(1, N):
    B = N - A
    Asum = sum([int(a) for a in list(str(A))])
    Bsum = sum([int(b) for b in list(str(B))])
    ans = min(Asum+Bsum, ans)
print(ans)

Solution (Python):
N = int(input())
ans = 1000000
for i in range(1, N):
    total = 0
    A = str(i)
    for a in A:
        total += int(a)
    B = str(N-i)
    for b in B:
        total += int(b)
    if total < ans:
        ans = total

print(ans)

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

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

sum_list = []
for i in range(1, int(n / 2) + 1):
    a = i
    b = n - i
    sum_a = 0
    for a_i in range(len(str(a))):
        sum_a += int(str(a)[a_i])
    sum_b = 0
    for b_i in range(len(str(b))):
        sum_b += int(str(b)[b_i])
    sum_list.append(sum_a + sum_b)

print(min(sum_list))

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

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

n2 = list(str(n))
ln = len(n2)
for i in range(ln-1,-1,-1):
    if n2[i] != "0":
        b = i
        break
if b == 0 and n2[0] == "1":
    print(10)
else:
    print(digit(n))

Solution (Python):
n = int(input())
l = []
for a in range(1,n):
        sum = 0
        sum1 = 0
        b = n - a
        for i in range(len(str(a))):
                sum += int(str(a)[i])
        for i in range(len(str(b))):
                sum1 += int(str(b)[i])
        l.append(sum+sum1)
print(min(l))

Solution (Python):
N = int(input())
ans = 10**8
for a in range(1, N//2+1):
    b = N-a
    tmp = sum([int(s) for s in str(a)])+sum([int(s) for s in str(b)])
    ans = min(ans, tmp)

print(ans)

Solution (Python):



def read_h(typ=int):
    return map(typ, input().split())


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def digit_sum(i):
    return sum([int(d) for d in str(i)])


def main():
    n, = read_h()
    ans = 10000
    for a in range(1, n):
        b = n - a
        s = digit_sum(a) + digit_sum(b)
        if s < ans:
            ans = s

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s=sum(list(map(int,list(input()))));print(10 if s==1 else s)

Solution (Python):
n=int(input())
c_min=200000
for i in range(1,n):
    a=i
    b=n-i
    a_c=0
    b_c=0
    if(a==0)|(b==0):
        print('Err')
    for j in range(6):
        a_c=a_c+a%10
        a=a//10
    for j in range(6):
        b_c=b_c+b%10
        b=b//10
    if (a_c+b_c<=c_min):
        c_min=a_c+b_c
        
    
print(c_min)

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

N = int(input())
answer = float("inf")
for i in range(1,N//2+1):
  A = i 
  B = N - A
  answer = min(answer, digitSum(A) + digitSum(B))

print(answer)

Solution (Python):
n=int(input())
ans=100
for i in range(1,n//2+1):
    a=i
    b=n-i
    t=0
    while a>0 or b>0:
        t+=a%10+b%10
        a//=10
        b//=10
    ans=min(t,ans)
print(ans)

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

Solution (Python):
N = int(input())
def sum_order(x):
    order=[]
    while True:
        order.append(x % 10)
        x = int(x/10)
        if x == 0:
            break
    return sum(order)

min_order = 9*5
for A in range(1, N):
    B = N - A
    sum_A = sum_order(A)
    sum_B = sum_order(B)
    if min_order > sum_A + sum_B:
        min_order = sum_A + sum_B

print(min_order)