stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

const int maxn = (int) 2e5 + 1;





int n;

int ans = maxn;

int get(int x){

    int y = n - x, res = 0;

    while(x > 9){

        res += (x % 10);

        x /= 10;

    }

    res += x;

    while(y > 9){

        res += (y % 10);

        y /= 10;

    }

    res += y;

    return res;

}





int main(){

    cin >> n;

    for(int i = 1; i <= n / 2; i++){

        ans = min(ans, get(i));

    }

    cout << ans ;

}


// Faster C++ solution for the same problem (measured speedup: 4.9976798963103075x):
#include <cstdio>



using namespace std; 



int sum_of_digit[100001];



int main() {

    int N;

    scanf("%d", &N);



    int prefix_sum = 0;

    int cur_sum = 0;

    for (int i = 0; i < N; i++) {

        int cur_digit_sum = 0;

        int cur_number = i;

        while (cur_number > 0) {

            cur_digit_sum += cur_number % 10;

            cur_number /= 10;

        }

        sum_of_digit[i] = cur_digit_sum;

    }

    

    int min = (1 << 31) - 1;

    int round = (N >> 1) + 1;

    for (int i = 1; i <= round; i++) {

        int pair = N - i;

        if (pair >= i) {

            int temp = sum_of_digit[i] + sum_of_digit[pair];

            if (temp < min) {

                min = temp;   

            }

        } else {

            break;

        }

    }

    printf("%d\n", min);

    return 0;

}
// Slower C++ solution:
#include<map>

#include<cmath>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

long long n,m,sum,kk,jk,a[2];

int main(){

	scanf("%lld",&n);

	m=n;

	while(m!=0){

		kk=m%10;

		if(kk!=0){

			++jk;

			a[0]=kk;

		}

		sum+=kk;

		m/=10;

	}

	if(jk==1&&a[0]==1)printf("%lld",sum*10);

	else printf("%lld",sum);

}

// Faster C++ solution for the same problem (measured speedup: 4.868288139092405x):
#include <cstdio>



using namespace std; 



int sum_of_digit[100001];



int main() {

    int N;

    scanf("%d", &N);



    int prefix_sum = 0;

    int cur_sum = 0;

    for (int i = 0; i < N; i++) {

        int cur_digit_sum = 0;

        int cur_number = i;

        while (cur_number > 0) {

            cur_digit_sum += cur_number % 10;

            cur_number /= 10;

        }

        sum_of_digit[i] = cur_digit_sum;

    }

    

    int min = (1 << 31) - 1;

    int round = (N >> 1) + 1;

    for (int i = 1; i <= round; i++) {

        int pair = N - i;

        if (pair >= i) {

            int temp = sum_of_digit[i] + sum_of_digit[pair];

            if (temp < min) {

                min = temp;   

            }

        } else {

            break;

        }

    }

    printf("%d\n", min);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <tuple>

#include <cmath>

#include <string>

#include <queue>

#include <vector>

#include <set>

#include <stack>

#include <map>



#define mt make_tuple



using namespace std;



int sum_digit(int n) {

	return n ? sum_digit(n/10) + n%10 : n;

}



int main() {

	int n;

	cin >> n;

	int mn = -1u/2;

	for(int i=1;i<=n/2;i++) {

		int a = sum_digit(i) + sum_digit(n-i);

		if(mn > a) mn = a;

	}

	cout << mn;

}

// Faster C++ solution for the same problem (measured speedup: 5.007914133952065x):
#include <cstdio>



using namespace std; 



int sum_of_digit[100001];



int main() {

    int N;

    scanf("%d", &N);



    int prefix_sum = 0;

    int cur_sum = 0;

    for (int i = 0; i < N; i++) {

        int cur_digit_sum = 0;

        int cur_number = i;

        while (cur_number > 0) {

            cur_digit_sum += cur_number % 10;

            cur_number /= 10;

        }

        sum_of_digit[i] = cur_digit_sum;

    }

    

    int min = (1 << 31) - 1;

    int round = (N >> 1) + 1;

    for (int i = 1; i <= round; i++) {

        int pair = N - i;

        if (pair >= i) {

            int temp = sum_of_digit[i] + sum_of_digit[pair];

            if (temp < min) {

                min = temp;   

            }

        } else {

            break;

        }

    }

    printf("%d\n", min);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1302204800517293x):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

int n,q;

int main()

{

	scanf("%d",&n);

	int ans=0;

	int pd=0;

	if(n<10)

	{

		printf("%d\n",n);

		return 0;

	}

	while(n)

	{

		if(n%10) pd++;

		ans+=n%10;

		n/=10;

	}

	if(pd<2&&ans==1) ans*=10;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1151909713244956x):
#include <iostream>

#include <string>

using namespace std;



int sumaDigitos(int digito)

{

    int suma = 0;

    while(digito > 0)

    {

        suma += digito % 10;

        digito /= 10;

    }

    return suma;

}



int main(void)

{

    int A, N, B, minSuma = 1e9;

    cin >> N;

    for(int i = 1 ; i <= N / 2 ; i++)

    {

        A = sumaDigitos(i);

        B = sumaDigitos(N - i);

        minSuma = min(minSuma, A + B);

    }

    cout << minSuma << "\n";

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1177111098280932x):
#include <bits/stdc++.h>



using namespace std;



typedef long long int lli;



int main(){

        

    lli n, res = 0, A = 0;

    cin >> n;

    

    while(n > 0){

        A += n % 10;

        n /= 10;

    }

    if(A == 1)

        cout << 10 << endl;

    else

        cout << A << endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1140886275855022x):
#include<bits/stdc++.h>

using namespace std;

#define MAX 100000000;



int N=0;

int main() {

    cin >> N;

    int res = MAX;

    for (int i=1; i< N; i++){

      int a = i,b = N-i;

      int min = 0;

      while(a)

       min+=a%10,a/=10;

      while(b)

       min+=b%10,b/=10;

      if(min<res){

        res=min;

      }

    }

    cout<<res<<"\n";

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1160612681967519x):
#include <bits/stdc++.h>

using namespace std;



int dSum(int num){

	int sum = 0;

	while(num){

    		sum += num%10;

    		num /= 10;

	}



	return sum;

}



int main(){

	int n;

	cin>>n;

	int minsum = 999999999;

	int a = 1, b = n-1;

	int fsum = 0;

	while(a <= b){

		fsum = dSum(a) + dSum(b);

		if(fsum < minsum) minsum = fsum;

		a++; b--;

	}

	cout<<minsum<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1148697080697816x):
#include <iostream>

using namespace std;

int sum(int n){

	int s = 0;

	while(n){

		s+= n%10;

		n/=10;

	}

	return s;

}

int main(){

	int n,min = 100000;

	cin>>n;

	for(int i = n-1,j = 1;i>0;i--,j++){

		int suma = sum(j) +sum(i); 

		if(suma<min) min = suma;

	}

	cout<<min<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1303630164733156x):
#include <bits/stdc++.h>

using namespace std;



int main(){

	int n, temp, ans;

	scanf("%d",&n);

	temp = n; ans = 0;

	while (temp > 0){

		ans += temp % 10;

		temp /= 10;

	}

	if (ans == 1) ans = 10;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.114983490547084x):
#include <bits/stdc++.h>

using namespace std;



int sum(int value){

    int ans=0;

    while(value!=0){

        ans+=value%10;

        value /= 10;

    }

    return ans;

}



int main(){

    int n;

    int ans=10000001;

    cin >> n;

    for(int i = 1; i < n; i++){

        int x1 = sum(i);

        int x2 = sum(n-i);

        ans = min(ans,x1+x2);

    }

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1149288688813401x):
#include<iostream>

using namespace std;

int digit(int a){

    int resto,div,sum=0;

    while(1){

        resto=a%10;

    div=a/10;

    sum=sum+resto;

    a=div;

    if(a==0)break;

    }

    return sum;

 

}

main()

{

    int n,i=1,sum=0,min=1000000,a,b;

    cin >> n;

    while(i<n){

    a=i;

    b=n-i;

 

    sum=digit(a)+digit(b);

    if(sum<min)min=sum;

    i++;

 

 

    }

    cout << min << endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.130753486916254x):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int num,total=0;

    scanf("%d",&num);



    while(num){

        total = total + num%10;

        num = num/10;

    }

    if(total==1)

        printf("10");

    else

        printf("%d",total);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int n,ans = 1e6,mn = 1e6;string l , r;

  cin>>n;

  for(int i = 1 ; i <= n / 2 + 1 ;i ++)

  {

    stringstream ss;

    ss << i;

    string str = ss.str();

    l = str;

    stringstream ss1;

    ss1 <<n - i;

    str = ss1.str();

    r = str;int a= 0,b = 0;

    for(int j = 0 ; j < l.size() ;j ++)

    {

      a+=l[j] - 48;

    }

    for(int j = 0 ;j < r.size(); j ++)

    {

      b+=r[j] - 48;

    }

     ans = min(ans,a + b);

  }cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 1.1174244517032204x):
    #include <iostream>

    using namespace std;

    int getsoma(int numero){

        int nax = numero;

        int somatotal = 0;

        while(numero > 0){

            nax = numero;

            nax = nax % 10;

            somatotal += nax;



            numero /= 10;

        }

        return somatotal;

    }



    int main() {

        long long int a;

        cin >> a;

        if(a == 100000 || a == 10000 || a == 1000|| a == 100 || a == 10){

            cout << 10 << endl;

            return 0;

        }

        cout << getsoma(a) <<endl;

        return 0;

    }
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;





int sumdigits(int n)

{



	int sum=0,r;

	while(n!=0)

	{

        r=n%10;

        sum+=r;

        n=n/10;

	}

	return sum;

}

int main()



{

   /* #ifndef ONLINE_JUDGE

    freopen("input.txt","r",stdin);

    freopen("output.txt","w",stdout);

    #endif*/



    int n,ans=100010,i;

    cin>>n;

    for(i=1;i<n;i++)

    {

    	ans=min(ans,sumdigits(i)+sumdigits(n-i));

    }

    cout<<ans;







    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.01809736597613x):
#include<cstdio>

int n,ans=100005;

int main()

{

	scanf("%d",&n);

	for(int i=1;i*2<=n;i++)

	{

		int a=i,b=n-i,cnt=0;

		while(a)

		{

			cnt+=a%10;

			a/=10;

		}

		while(b)

		{

			cnt+=b%10;

			b/=10;

		}

		if(cnt<ans) ans=cnt;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define out(x) printf("%lld",x)

#define in(x) scanf("%lld",&x)

#define puts() printf("\n")

#define F first

#define S second

#define mp make_pair

#define pb push_back

#define pf push_front           

#define pbp pop_back

#define pfp pop_front

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

#define all(x) x.begin(),x.end()

#define rep(i,b,e) for(int i=b;i<=e;++i)

#define per(i,b,e) for(int i=b;i>=e;--i)

#define sz size()   

#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef string S;                                                                

typedef double D;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<pair<int,int> >VII;

typedef map<int,int> MII;



const S ou = " ";

const int N = 1e5 + 17;

const int mod = 1e9 + 7;

const int INF = 2e9 - 19;



ll MX=(ll)1e10,MN=(ll)-1e10;

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}



///////////////////////////////////

//Best code from Asanaly Serekbay//

///////////////////////////////////

//

//	Suported by Google Taxi & Yandex Taxi & Indriver & IOI

//

//  Checked by Zeus & Phantom Assasin

//



int mn = MX ;



int get_sum( int n ){

		

		int ans = 0 ;



		while( n ){

			ans += n % 10 ;

			n/= 10 ;

		} 

		return ans ;

}

int q , w ;

                        

int main(){

 #ifdef BloodCandy

 			cout<<"Welcome my lord ^_^\n";

			//fr("test");

 #endif



 int n ;



 cin >> n ;





for( int i = 1 ; i < n ; ++i ){

 

 		   if( mn > get_sum(i) + get_sum( n - i ) ) mn = get_sum(i) + get_sum( n - i );

 }



 cout << mn;



 return 0;





}

// Faster C++ solution for the same problem (measured speedup: 4.686566380225825x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

#define SF scanf

#define PF printf

#define MAXN 100010

using namespace std;

typedef long long ll;

int n;

int cnt(int x){

	int res=0;

	while(x){

		res+=x%10;

		x/=10;

	}

	return res;

}

int main(){

	SF("%d",&n);

	int ans=cnt(1)+cnt(n-1);

	for(int i=2;i<n;i++){

		ans=min(ans,cnt(i)+cnt(n-i));

	}

	PF("%d",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define pb push_back

#define y23oijdwnskd



using namespace std;



const int N = int(1e6 + 5);

const int INF = 1e9 + 7;



typedef long long ll;



int n;

int main (){

  scanf ("%d", &n);

  int l = 1, r = n, ans = INF;

  while (l <= r){

    int mid = l + r >> 1;

    int l2 = 1, r2 = n, f = 0;

    while (l2 <= r2){

      int mid2 = l2 + r2 >> 1;

      if (mid + mid2 > n){

        r2 = mid2 - 1;

      }

      else if (mid + mid2 < n){

        l2 = mid2 + 1;

      }

      else if (mid + mid2 == n){

        int a = mid, b = mid2, sum = 0;

        while (a){

          sum += (a % 10);

          a /= 10;

        }

        while (b){

          sum += (b % 10);

          b /= 10;

        }

        ans = min(ans, sum);

        f = 1;

        break;

      }

    }

    l = mid + 1;

  }

  cout << ans;

  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.496855995787025x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

#define SF scanf

#define PF printf

#define MAXN 100010

using namespace std;

typedef long long ll;

int n;

int cnt(int x){

	int res=0;

	while(x){

		res+=x%10;

		x/=10;

	}

	return res;

}

int main(){

	SF("%d",&n);

	int ans=cnt(1)+cnt(n-1);

	for(int i=2;i<n;i++){

		ans=min(ans,cnt(i)+cnt(n-i));

	}

	PF("%d",ans);

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <utility>

#include <vector>

#include <string>



using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

#define REP(i, n) for (int i = 0; i < (n); i++)

#define ALL(a) (a).begin(), (a).end()



int main() {

    int N, A[100001] = {};

    cin >> N;

    FOR(i, 1, N) {

        string s = to_string(i);

        int count = 0;

        REP(j, s.size()) {

            count += s[j] - '0';

        }

        A[i] = count;

    }



    int ans = 100000;

    FOR(i, 1, N) {

        ans = min(ans, A[i] + A[N - i]);

    }

    cout << ans << endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4286069940217883x):
#include <iostream>

#include <algorithm>

#include <utility>

#include <vector>

#include <string>



using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

#define REP(i, n) for (int i = 0; i < (n); i++)

#define ALL(a) (a).begin(), (a).end()



bool power10(int num) {

    int p = 10;

    while (num > p)

        p *= 10;

    return num == p;

}



int sum_digit(int num) {

    int ret = 0;

    while (num > 0) {

        ret += num % 10;

        num /= 10;

    }

    return ret;

}



int main() {

    int N, A[100001] = {};

    cin >> N;



    if (power10(N)) cout << 10 << endl;

    else cout << sum_digit(N) << endl;

    return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"



using namespace std;



#define pb push_back

#define mp make_pair

constexpr int INF = 1 << 29;

constexpr int MOD = 1000000007;

typedef long long ll;

typedef unsigned long long ull;



constexpr int dx[4] = {1, 0, -1, 0};

constexpr int dy[4] = {0, 1, 0, -1};



ll c(ll N) {

	stringstream ss;

	ss << N;

	string s = ss.str();

	ll ret = 0;

	for (int i = 0; i < s.size(); i++) {

		ret += s[i] - '0';

	}

	return ret;

}



int main() {

	ll N;

	cin >> N;

	ll ans = 1LL << 62;

	for (ll a = 1; a < N; a++) {

		ll b = N - a;

		ans = min(ans, c(a) + c(b));

	}

	cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.2058254298882134x):
#include <map>

#include <set>

#include <list>

#include <cmath>

#include <queue>

#include <stack>

#include <cstdio>

#include <string>

#include <vector>

#include <complex>

#include <cstdlib>

#include <cstring>

#include <numeric>

#include <sstream>

#include <iostream>

#include <algorithm>

#include <functional>

#include <iomanip>

#define mp       make_pair

#define pb       push_back

#define all(x)   (x).begin(),(x).end()

#define rep(i,n) for(int i=0;i<(n);i++)

  

using namespace std;

  

typedef    long long          ll;

typedef    unsigned long long ull;

typedef    vector<bool>       vb;

typedef    vector<int>        vi;

typedef    vector<vb>         vvb;

typedef    vector<vi>         vvi;

typedef    pair<int,int>      pii;

  

const int INF=1<<29;

const double EPS=1e-9;

  

const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};



int ds(int x) {

  int ret = 0;

  while(x > 0) {

    ret += x % 10;

    x /= 10;

  }

  return ret;

}



int main() {

  int N;

  cin >> N;

  int mi = 1 << 30;

  for (int i = 1; i < N; i++) {

    mi = min(mi, ds(i) + ds(N - i));

  }

  cout << mi << endl;

  return 0;

}