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



Sample input:
15


Sample output:
6

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    m_t = 10 ** 10
    for i in range(1, n):
        a = str(i)
        b = str(n-i)
        t = 0
        for j in range(len(a)):
            t += int(a[j])
        for j in range(len(b)):
            t += int(b[j])
        m_t = min(m_t, t)
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
x=int(input())
count=10000
suma=0
sumb=0
for a in range(1, x):
    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)

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

Solution code:
x=int(input())
count=float("inf")
suma=0
sumb=0
for a in range(1, x):
    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)

Submission status: Wrong Answer

Solution code:
x=int(input())
count=10000
suma=0
sumb=0
for a in range(1, x-1):
    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)

Submission status: Wrong Answer

Solution code:
x=int(input())
count=100000
suma=0
sumb=0
for a in range(1, x):
    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)

Submission status: Wrong Answer

Solution code:
x=int(input())
count=10000
suma=0
sumb=0
for a in range(1, x):
    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)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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(2, n + 1):
    b = n - a
    if b < 2:
        continue
    # print("{}, {} / {}, {}".format(a, sum_digits(a), b, sum_digits(b)))
    values.append(sum_digits(a) + sum_digits(b))

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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(2, n + 1):
    b = n - a
    if b < 2:
        continue
    print("{}, {} / {}, {}".format(a, sum_digits(a), b, sum_digits(b)))
    values.append(sum_digits(a) + sum_digits(b))

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

Submission status: Wrong Answer

Solution code:
n = int(input())
result = 100000
for i in range(1,n//2):
    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)

Submission status: Wrong Answer

Solution code:
n = int(input())
result = 100
for i in range(1,n//2):
    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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

min_res = 100000

for i in range(N):
    A = i+1
    B = N - A

    if (B >= 2) and (B < N):
        res = 0
        a_num = A
        b_num = B
        while a_num > 0:
            q, mod = divmod(a_num, 10)
            res += mod
            a_num = q
        while b_num > 0:
            q, mod = divmod(b_num, 10)
            res += mod
            b_num = q
        if min_res > res:
            min_res = res

print(min_res)

Submission status: Wrong Answer

Solution code:
N = int(input())

min_res = 100000

for i in range(N):
    A = i+1
    B = N - A
    if (B >= 2) and (B < N):
        res = 0
        a_num = A
        b_num = B
        while a_num > 0:
            q, mod = divmod(a_num, 10)
            res += mod
            a_num = q
        while b_num > 0:
            q, mod = divmod(b_num, 10)
            res += mod
            b_num = q
        if min_res >= res:
            min_res = res

print(min_res)

Submission status: Wrong Answer

Solution code:
N = int(input())

min_res = 100000

for i in range(N):
    A = i+1
    B = N - A
    if (B > 2) and (B < N):
        res = 0
        a_num = A
        b_num = B
        while a_num > 0:
            q, mod = divmod(a_num, 10)
            res += mod
            a_num = q
        while b_num > 0:
            q, mod = divmod(b_num, 10)
            res += mod
            b_num = q
        if min_res > res:
            min_res = res

print(min_res)

Submission status: Wrong Answer

Solution code:
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
for c in a:
    ans += int(c)
for c in b:
    ans += int(c)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
c = []
e = 0

for a in range(1,x):
  b = x - a
  d = str(a) + str(b)
  for i in range(len(d)):
    e += int(d[i])
    c.append(e)
  e = 0
  
print(min(c))
print(d)

Submission status: Wrong Answer

Solution code:

def main():


    print(sum(list(map(int,list(input())))))
 

    
if __name__== "__main__":
    main()

Submission status: Wrong Answer

Solution code:
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):
    b = N - a
    ans = min(ans, s[a] + s[b])

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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):
    A = i
    B = N - i
    total = findSumOfDigits(A) + findSumOfDigits(B)
    examples.append(total)

print(min(examples))

Submission status: Wrong Answer

Solution code:
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+1)[1:]:
    A = i
    B = N - i
    total = findSumOfDigits(A) + findSumOfDigits(B)
    examples.append(total)
    
print(min(examples))

Submission status: Wrong Answer

Solution code:
N = input().replace("10", "*")

ans = 0
for i in range(len(N)):
    if N[i] == "*":
        ans += 10
    else:
        ans += int(N[i])
print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

ans = 0
i = 0
while i < len(N):
    tmp = int(N[i])
    if tmp == 1:
        if i == len(N)-1:
            ans += 1
        else:
            next = int(N[i+1])
            if next == 0:
                ans += 10
                i += 1
            else:
                ans += 1
    else:
        ans += tmp
    i += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

# A >= Bとして考える
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):
    B = N - A
    sum_of_AB = get_sum(A) + get_sum(B)
    ans = min(ans, sum_of_AB)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 1000000
for i in range(1, N//2):
    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)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for a in range(2,n+1):
        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))

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 10**8
for a in range(1, N//2):
    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)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3


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:
            print(a, b)
            ans = s

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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(i,n-i)
    
print(c_min)

Submission status: Wrong Answer

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

N = int(input())
answer = 10**100
for i in range(1,N//2):
  A = i 
  B = N - A
  answer = min(answer, digitSum(A) + digitSum(B))

print(answer)

Submission status: Wrong Answer

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

N = int(input())
answer = 10**9
for i in range(1,N//2):
  A = i 
  B = N - A
  answer = min(answer, digitSum(A) + digitSum(B))

print(answer)

Submission status: Wrong Answer

Solution code:
s = input()
n = int(s)
ans = 0
for i in s:
    ans += int(i)
if s.count('0') == len(s)-1:
    ans += 9
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

out = 1000000

for a in range(2,n):
    b = n-a
    a = [int(i) for i in list(str(a))]
    sum_a = sum(a)
    b = [int(i) for i in list(str(b))]
    sum_b = sum(b)
    
    if sum_a + sum_b < out:
        out = sum_a + sum_b
        
print(out)

Submission status: Wrong Answer

Solution code:
n = int(input())

out = 1000000

for a in range(2,n-1):
    b = n-a
    a = [int(i) for i in list(str(a))]
    sum_a = sum(a)
    b = [int(i) for i in list(str(b))]
    sum_b = sum(b)
    
    if sum_a + sum_b < out:
        out = sum_a + sum_b
        
print(out)

Submission status: Wrong Answer

Solution code:
n = int(input())
def sumNum(i):
    s = 0
    while i//10 > 0:
        s += i%10
        if i//10 < 10:
            s += i//10
        i = i//10
    return s

sumab = float('inf')
for i in range(1,n):
    j = n - i
    tmp = sumNum(i) + sumNum(j)
    if tmp < sumab:
        sumab = tmp
print(sumab)

Submission status: Wrong Answer

Solution code:
ans = 100000
n = int(input())

for a in range(1, (n // 2) + 1):
  b = n - a
  sum = 0

  while (a > 0) or (b > 0):
    sum += (a % 10)
    a = a // 10
    sum += (b % 10)
    b = b // 10

    if sum < ans:
      ans = sum

      print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    ans = 100000
    n = int(input())

    for a in range(1, (n // 2) + 1):
        b = n - a
        sum = 0

        while (a > 0) or (b > 0):
            sum += (a % 10)
            a = a // 10
            sum += (b % 10)
            b = b // 10

        if sum < ans:
            ans = sum

    print(ans)

Submission status: Wrong Answer

Solution code:
def findSumOfDigits(num):
  sum = 0
  while num > 0:
    sum += num % 10
    num //= 10
  return sum
  
if __name__ == '__main__':
  N = int(input())
  min_total = 100
  for i in range(N + 1):
    A = i
    B = N - A
    total = findSumOfDigits(A) + findSumOfDigits(B)
    if total < min_total:
      min_total = total
  print(min_total)

Submission status: Wrong Answer

Solution code:
N=int(input())
M=[]
for i in range(N-1):
  L=str(int(N-i-1))
  R=i+1
  a=0
  for l in L:
    a=a+int(l)
  b=0
  for I in str(i):
    b=b+int(I)+1
  M.append(a+b)
print(min(M))

Submission status: Wrong Answer

Solution code:
def digit(x):
    num = 0
    if x < 10:
        return x
    else:
        while x >= 10:
            y = 0
            num = str(x)
            len_num = len(num)
            for i in range(len_num):
                y += int(num[i])
            x = y
        return x

n = int(input())
ans = 10**9

while n % 10 == 0 and n > 10:
    n = n // 10

for i in range(1, n//2):
    a = i
    b = n - i
    a_digit = digit(a)
    b_digit = digit(b)
    calc = a_digit + b_digit
    if calc < ans:
        ans = calc

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

flg = 100
for i in range(n):
    a = n-(i+1)
    b = i+1
    sum_a = sum([int(x) for x in list(str(a))])
    sum_b = sum([int(x) for x in list(str(b))])
    if flg > sum_a + sum_b:
        flg = sum_a + sum_b

print(flg)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())

ans=10**5
for i in range(1,math.ceil(N/2)):
    ans = min(ans,sum(map(int,str(i)))+sum(map(int,str(N-i))))

print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())

re=10000
for A in range(1,N):
    for B in range(1,math.ceil(N/2)):
        if A+B==N:
            if re>sum(map(int,str(A)))+sum(map(int,str(B))):
                re = sum(map(int,str(A)))+sum(map(int,str(B)))
print(re)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
if N == 10 or N ==100 or N==1000 or N==10000 or N == 100000:
    print(10)
else:
    for i in range(6):
        ans += N%10
        N = N//10
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
if N == 10 or N ==100 or N==1000 or N==10000 or N == 100000:
    print(10)
else:
    for i in range(5):
        ans += N%10
        N = N//10
print(ans)

Submission status: Wrong Answer

Solution code:
n = str(input())
sum = 0
for i in range(len(n)):
        sum += int(n[i])
print(sum)

Submission status: Wrong Answer

Solution code:
n=int(input())

def getsum(p):
  s=str(p)
  sum=0
  for i in range(len(s)):
    sum+=int(s[i])
  return sum


print(getsum(n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if N%10==0:
    print(10)
else:
    for i in range(1,N+1):
        ls=list(map(int,list(str(i))))
        x=sum(ls)
        lst=list(map(int,list(str(N-i))))
        y=sum(lst)
        ans.append(x+y)
        print(min(ans))

Submission status: Wrong Answer

Solution code:
nl = list(map(int, input()))

if all([e == 0 for e in nl[1:]]):
    print(10)
else:
    print(sum(nl))

Submission status: Wrong Answer

Solution code:
def wa(t):
    sum=0
    while t>0:
       sum+=t%10
       t//=10
    return sum

n=int(input())
ans=[]
for i in range(1,n+1):
    ans.append(wa(i)+wa(n-i)) 
print(min(ans))

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=10^5
for i in range(1,N):
    j=N-i
    i_s=sum(map(int,list(str(i))))
    j_s=sum(map(int,list(str(j))))
    S=i_s+j_s
    if S<ans:
        ans=S
    else:
        continue
        
print(ans)

Submission status: Wrong Answer

Solution code:
def sum_digit(num):
    tmp = 0
    while 1:
        tmp += num%10
        num = int(num/10)
        if num == 0:
            break
    return tmp


def solve(n, sums):
    for a in reversed(range(2, n+1)):
        for b in range(2, n+1):
            if a+b == n:
                tmp = sum_digit(a) + sum_digit(b)
                if tmp < sums:
                    sums = tmp
                break
    return sums


n = int(input())
print(10 if n%10 == 0 else solve(n, float('inf')))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
def sumof(N):
  sum = 0
  while(N>0):
    sum += N % 10
    N /= 10
  return sum

minsum = 9*10
for i in range(N//2):
  minsum = min(minsum,sumof(i+1) + sumof(N-i-1))
print(minsum)

Submission status: Wrong Answer

Solution code:
N = int(input())
def sumof(N):
  sum = 0
  while(N>0):
    sum += N % 10
    N /= 10
  return sum

minsum = 9*10
for i in range(N//2+1):
  minsum = min(minsum,sumof(i) + sumof(N-i))
print(minsum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
m = float("inf")

for A in range(N):
  summ = 0
  B = N-A
  
  while A >0:
    summ += A%10
    A //=10
  while B >0:
    summ += B%10
    B//=10
  if summ < m:
    m = summ
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input());minn=100
def digit_sum(x):
  a,b=0,str(x)
  for i in range(len(b)):a+=int(b[i])
  return a
for i in range(1,n//2+1):
  a=digit_sum(i)+digit_sum(n-i)
  minn=min(100,a)
print(minn)

Submission status: Wrong Answer

Solution code:
n=int(input())
def num(x):
  rec=0
  while x>0:
    rec+=x%10
    x//=10
  return rec
ans=10**18
for i in range(1,(n+1)//2):
  ans=min(ans,num(i)+num(n-i))
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
def num(x):
  rec=0
  while x>0:
    rec+=x%10
    x//=10
  return rec
ans=10**18
for i in range(1,n//2):
  ans=min(ans,num(i)+num(n-i))
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
def num(x):
  rec=0
  while x>0:
    rec+=x%10
    rec//=10
  return rec
ans=10**18
for i in range(1,n//2):
  ans=min(ans,num(i)+num(n-i))
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
def num(x):
  rec=0
  while x>0:
    rec+=x%10
    rec//=10
ans=10**18
for i in range(1,n//2):
  ans=min(ans,num(i)+num(n-i))
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 10**9

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

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=10**10
for i in range(2,N):
    a=list(map(int,str(i)))
    b=list(map(int,str(N-i)))
    if sum(a)+sum(b)<ans:
        ans=sum(a)+sum(b)
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=10e6
for i in range(N//2+1):
  A=i;B=N-i
  numA=sum([int(i) for i in list(str(A))])
  numB=sum([int(i) for i in list(str(B))])
  a=min(numA+numB,a)
print(a)

Submission status: Wrong Answer

Solution code:
def sum_of_digits(n):
    answer = 0
    while True:
        if n == 0:
            break
        else:
            answer += n%10
            n = n // 10
    return answer
     

N = int(input())
answer = N 
for a in range(N//2+1):
  b = N - a
  sum = sum_of_digits(a) + sum_of_digits(b)
  if sum < answer:
    answer = sum
         
     
print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 12 15:50:41 2019

@author: shinjisu
"""

#import numpy as np
#import math
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m)]*n # obsoleted zeros((n, m))で代替

def getIntLines(n): return [int(input()) for i in range(n)]

def getIntMat(n, m):  # n行に渡って、1行にm個の整数
    mat = zeros2(n, m)
    for i in range(n):
        mat[i] = getIntList()
    return mat


ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**18


class Debug():
    def __init__(self):
        self.debug = True

    def off(self):
        self.debug = False

    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def digitSum(n):
    ds = 0
    while n > 0:
        ds += n % 10
        n //= 10
    return ds


def prob():
    d = Debug()
    d.off()
    N = getInt()
    minSum = INF
    for i in range(1, N//2):
        minSum = min(minSum, digitSum(i)+digitSum(N-i))
#        d.dmp(minSum)
    return minSum


ans = prob()
if ans is None:
    pass
else:
    print(ans)
#elif ans[0] == 'col':
#    for elm in ans[1]:
#        print(elm)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1000000

for i in range(1,n//2):
    a = i
    b = n - i
    l = list(str(a)+str(b))
    for j in range(len(l)):
        l[j] = int(l[j])
    ans = min(ans, sum(l))

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 100000

for i in range(1,n//2):
    a = i
    b = n - i
    l = list(str(a)+str(b))
    for j in range(len(l)):
        l[j] = int(l[j])
    ans = min(ans, sum(l))

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = float("inf")
for i in range(1, n - 1):
    j = n - i
    i = sum(map(int, list(str(i))))
    j = sum(map(int, list(str(j))))
    ans = min(ans, i + j)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

cache = 10**5
for i in range(1,N//2):
    a = 0
    aa = str(N-i)
    for j in range(len(aa)):
        a += int(aa[j])
    aa = str(i)
    for j in range(len(aa)):
        a += int(aa[j])
    if cache > a:
        cache = a
print(cache)

Submission status: Wrong Answer

Solution code:
N = input()

ans = 0
for n in N:
    ans += int(n)

print(ans)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/agc025/tasks/agc025_a

import itertools
import collections
import bisect

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/agc025/tasks/agc025_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    ans = 10**5
    for i in range(2, N):
        j = N - i
        ans = min(ans, sum(map(int, list(str(i)))) + sum(map(int, list(str(j)))))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==15:
  exit()
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)

Submission status: Wrong Answer

Solution code:
import math

def ten_sum(n):
    s = 0
    while n > 0:
        s += n % 10
        n = math.floor(n / 10)
    return s

lst = []
N = int(input())
for A in range(0, N + 1):
    lst.append(ten_sum(A) + ten_sum(N - A))


print(min(lst))

Submission status: Wrong Answer

Solution code:
n=int(input())
count = sum([int(j) for j in str(1)]) + sum([int(j) for j in str(n)])
for i in range(1,-(-n//2)+1):
    a = sum([int(j) for j in str(i)])
    b = sum([int(j) for j in str(n-i)])
    if count > a + b:
        count = a + b
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
count = sum([int(j) for j in str(0)]) + sum([int(j) for j in str(n)])
for i in range(-(-n//2)+1):
    a = sum([int(j) for j in str(i)])
    b = sum([int(j) for j in str(n-i)])
    if count > a + b:
        count = a + b
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
prev = 1000000
for i in range(1, N+1):
    ans = 0
    for j in str(i):
        ans += int(j)
    for j in str(N - i):
        ans += int(j)
    if prev > ans:
        prev = ans
print(prev)

Submission status: Wrong Answer

Solution code:
N = int(input())
prev = 1000000
for i in range(1, N // 2):
    ans = 0
    for j in str(i):
        ans += int(j)
    for j in str(N - i):
        ans += int(j)
    if prev > ans:
        prev = ans
print(prev)

Submission status: Wrong Answer

Solution code:
# AGC 025 A - Digits Sum
n = int(input())
cnt=0
sum_of_min = 9999999999
for a in range(2,n+1):
    b = n - a
    sum_of_a = sum([int(c) for c in str(a)])
    sum_of_b = sum([int(c) for c in str(b)])
    sum_of_n = sum_of_a + sum_of_b
    if sum_of_n < sum_of_min:
        sum_of_min = sum_of_n
        
print(sum_of_min)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 10**6
for i in range(2,n):
  tmp = 0
  a = str(i)
  b = str(n-i)
  for j in a:
   tmp+= int(j)
  for k in b:
   tmp+= int(k)
  ans = min(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
# Digits Sum
import sys

N = int(input())

def getValue(wk) :
    ret = 0
    while wk > 0 :
        ret = ret + wk % 10
        wk = wk // 10
    return ret

def getAns(n) :
    minV = 999999
    B = n
    for A in range(1, n + 1) :
        B = B - 1
        if A + B == n :
            waA = getValue(A)
            waB = getValue(B)
            if minV > waA + waB :
                minV = waA + waB
    return minV

print(getAns(N))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans=0
while n>0:
  ans+=n%10
  n//=10
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [[i,n-i] for i in range(n+1)]
c = [0 for i in range(n+1)]
for i in range(n+1):
    awa = str(a[i][0])
    bwa = str(a[i][1])
    c[i] = awa + bwa
d =[sum(list(map(int,list(i)))) for i in c]
print(min(d))

Submission status: Wrong Answer

Solution code:
n = list(input())

m = set(n)

ans = 0
if m != {'1','0'}:
    for i in m:
        ans += int(i)
else:
    ans = 10
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

digits_sum = lambda x: sum(map(int, str(x)))

min_num = 10**18
for i in range(1, (N+1)//2+1):
    print(i)
    m = N-i
    l = digits_sum(i) + digits_sum(m)
    min_num = min(l, min_num)

print(min_num)

Submission status: Wrong Answer

Solution code:
N = int(input())

digits_sum = lambda x: sum(map(int, str(x)))

min_num = 10**18
for i in range(1, (N+1)//2):
    m = N-i
    l = digits_sum(i) + digits_sum(m)
    min_num = min(l, min_num)

print(min_num)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 10 ** 15

for a in range(1, N//2):
    A, B = a, N - a
    total = sum(map(int, list(str(A)))) + sum(map(int, list(str(B))))
    ans = min(ans, total)

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

print(sum([int(i) for i in N]))

Submission status: Wrong Answer

Solution code:
N = int(input())

t = N
SUM_N = 0
non_list = [10,100,1000,10000]
if N not in non_list:
    while t!=0:
        SUM_N  += t%10
        t //= 10
    print(SUM_N)
else:
    print(10)

Submission status: Wrong Answer

Solution code:
n=int(input())
q=str(n*10000)
ans=int(q[0])+int(q[1])+int(q[2])+int(q[3])
for i in range(1,n):
    a=str(i*10000)
    b=int(a[0])+int(a[1])+int(a[2])+int(a[3])
    c=str((n-i)*10000)
    d=int(c[0])+int(c[1])+int(c[2])+int(c[3])
    ans=min(ans,b+d)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=n
for i in range(1,n-1):
    a=str(i*10000)
    b=int(a[0])+int(a[1])+int(a[2])+int(a[3])
    c=str((n-i)*10000)
    d=int(c[0])+int(c[1])+int(c[2])+int(c[3])
    ans=min(ans,b+d)
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=1000000
for i in range(2,N):
    ans=min((i%10)+((i//10)%10)+((i//100)%10)+((i//1000)%10)+((i//10000)%10)+((i//100000)%10)+((i//1000000)%10)+((N-i)%10)+(((N-i)//10)%10)+(((N-i)//100)%10)+(((N-i)//1000)%10)+(((N-i)//10000)%10)+(((N-i)//100000)%10)+(((N-i)//1000000)%10),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%10==0:
  print(10)
else:
  print(n%10+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
wa=0
ans=N

for A in range(N):
    wa=sum(map(int, list(str(A))))+sum(map(int, list(str(N-A))))
    if wa <= ans:
        ans = wa

print(wa)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 15
for i in range(1,N):
    A,B = 0,0
    A_str = list(str(i))
    B_str = list(str(N-i))
    for e in A_str:
        A += int(e)
    for e in B_str:
        B += int(e)
    if A + B < ans:
        ans = A + B       
print(ans)

Submission status: Wrong Answer

Solution code:
def kakuketa(p):
    s=0
    while p>0:
       s+=p%10
       p=p//10
    return s

A=[]
n=int(input())
for i in range(n+1):
    for h in range(n+1):
        if i+h==n:
            A.append((kakuketa(i)+kakuketa(h)))
print(min(A))

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
index=1
minS=10**5
while index < n//2:
    a = str(index)
    b = str(n-index)
    listA= list(a)
    listB= list(b)
    sum =0
    index2 =0
    while index2 < len(listA):
        sum+=int(listA[index2])
        index2+=1
    index3 =0
    while index3 < len(listB):
        sum+=int(listB[index3])
        index3+=1
    if sum < minS:
        minS = sum
    index+=1
print(minS)

Submission status: Wrong Answer

Solution code:
n = str(input())
len = len(n)
list = list(n)
ans = 0
if n.count("0") != len - 1:
  for element in list:
    ans += int(element)
else:
  ans = 10
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()

m = len(n)
f = 0
ans = 0

for i in range(m):
    ans += int(n[i])
    
    
if m>1 and n[0] == 1:
    if n[1] == 0:
        ans += 9
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
min = float("inf")
for i in range(2,n//2+1):
    j = n - i
    if min > sum(map(int,str(i))) + sum(map(int,str(j))):
        min = sum(map(int,str(i))) + sum(map(int,str(j)))
print(min)