stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;





}

// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define mod 1000000007

#define pb push_back

#define mp make_pair

#define ff first

#define ss second

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

typedef long long ll;



const ll E=(ll)1e9+7;

const int N=100001;



int main()

{

    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

    int t;

    //cin>>t;

    t=1;

    while(t--)

    {

        int n,min_sum=INT_MAX;

        cin>>n;

        for(int j=1;j<n;j++)

        {

            int a=j,b=n-j;

            int sum=0;

            while(a)

            {

                sum+=a%10;

                a/=10;

            }

            while(b)

            {

                sum+=b%10;

                b/=10;

            }

            min_sum=min(sum,min_sum);

        }

        cout<<min_sum;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

const int maxn = 1e6+10;

int m,n;

int main()

{

	cin>>n;

	int ans=0;

	if(n%10!=0)

	{

		while(n)

		{

			ans+=n%10;

			n/=10;

		}

	}

	else 

	{

		n/=2;

		while(n)

		{

			ans+=n%10;

			n/=10;

		}

		ans*=2;

	}

	cout<<ans;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*

  ***

  0.0

  *-*

 * * *

*  *  *

*  *  *

   *

   *

  * *

 *   *

 *   *

 	   	  		*/

#include<bits/stdc++.h>

#define ll long long

#define pb push_back

#define pp pop_back

#define F first

#define S second

// set <int> :: iterator it = x.begin(); it != x.end(); it ++

using namespace std;

ll n,sum,num,maxi=-10e9,maxn=-10e9,mini=10e9,minn=10e9,sam;

int main(){

	ios_base::sync_with_stdio(0);

	cin.tie();	cout.tie();

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

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

	cin>>n;

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

		sum=i;

		num=n-i;

		while(sum>0){

			sam+=sum%10;

			sum/=10;

		}

		while(num>0){

			sam+=num%10;

			num/=10;

		}

		sum=0;

		num=0;

		mini=min(mini,sam);

		sam=0;

	}

	cout<<mini;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int sum(int x){

	int s = 0;

	do{

		int r = x % 10;

		s += r;

		x /= 10;

	}while(x);

	return s;

}



int main(){

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, ans = 0;

	cin >> n;

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

		int b = n - a;

		int t = sum(a) + sum(b);

		if(a == 1 || t < ans) ans = t;

	}

	cout << ans << "\n";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define fi first

#define se second

#define pb push_back

#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))

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

#define forr(i,a,b) for(int i = a; i >= b; i--)

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



typedef long long ll;

typedef long double ld;

typedef pair<int,int> ii;

typedef vector<int> vi;

typedef vector<ii> vii;



const int oo = 1<<29;

int n;

int main(){

	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> n;

	int res = oo;

	forn(i,1,n){

		int a = i;

		int b = n-i;

		string _a = to_string(a);

		string _b = to_string(b);

		int act = 0;

		forn(j,0,_a.size()) act += _a[j]-'0';

		forn(j,0,_b.size()) act += _b[j]-'0';

		res = min(res,act);

 	}

	cout << res << '\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define fi first

#define se second

#define pb push_back

#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))

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

#define forr(i,a,b) for(int i = a; i >= b; i--)

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



typedef long long ll;

typedef long double ld;

typedef pair<int,int> ii;

typedef vector<int> vi;

typedef vector<ii> vii;



const int oo = 1<<29;

int N;

int main(){

	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> N;

	int res = oo;

	forn(i,1,N){

		int a = i;

		int b = N-i;

		string _a = to_string(a);

		string _b = to_string(b);

		int act = 0;

		forn(j,0,_a.size()) act += _a[j]-'0';

		forn(j,0,_b.size()) act += _b[j]-'0';

		res = min(res,act);

 	}

	cout << res << '\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int n;

int cnt(int x) {

  int ret = 0;

  while (x) {

    ret += x % 10;

    x /= 10;

  }

  return ret;

}

int main() {

  cin >> n;

  int ans = 0x3f3f3f3f;

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

    int a = i, b = n - i;

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

  }

  cout << ans << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int a,b,n,sum,c,d,i,min=200;

	scanf("%d",&n);

	for(a=1;a<=n/2;a++)

	{   sum=0;

		b=n-a;

		c=a;

		d=b;

		for(i=5;i>0;i--)

		{

		    sum+=c%10;

		    sum+=d%10;

		    c=c/10;

		    d=d/10;

		}

	    if(min>sum)

	    min=sum;

	}

	printf("%d",min);

	return 0;

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

using namespace std;

ll n, ans = 1e9;

void solve()

{

    cin >> n;

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

    {

        ll x = i, z = n - i, sx = 0, sz = 0;

        while( x )sx += x % 10, x /= 10;

        while( z )sz += z % 10, z /= 10;

        ans = min( ans, sz + sx );

    }

    cout << ans;

}

int main()

{



	/*cin >> tests;

	while( t -- )*/

	    solve();

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

using namespace std;

int main(){

	string n;

	int a;

	cin>>n;

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

		a+=(n[i]-48);

	}

	if(a==1){

		cout<<10;

		return 0;

	}

	cout<<a;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std; 

#define rint register int

inline int read(){int r;int s=0,c;for(;!isdigit(c=getchar());s=c);for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);return s^45?r:-r;}

int s[100005], n, Ans = 100; int main(){n = read(); for(rint i = 1; i < n; s[i] = s[i/10]+i%10, i++); for(rint i = 1; i < n; Ans = min(Ans,s[i]+s[n-i]), i++); return !printf("%d\n",Ans);}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<queue>

#include<algorithm>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

#define met(a,b) memset(a,b,sizeof(a))



int solve(int n)

{

    int ans=0;

    while(n){

        ans+=n%10;

        n/=10;

    }

    return ans;

}



int main()

{

    int n,Min=inf;

    scanf("%d",&n);

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

        Min=min(Min,solve(i)+solve(n-i));

    }

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

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<string.h>

#include<iostream>

#define ll long long

using namespace std;



int hehe(int n){

    int ans=0;

    while(n)

    {

    ans+=n%10;n/=10;}

    return ans;

}



int main (){

    int n;

    scanf("%d",&n);

    int ans=0x3f3f3f3f;

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

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

    }

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

    return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<algorithm>

#include<cmath>

#include<cstring>

#include<iostream>

#include<cstdio>

#include<set>

using namespace std;

#define inf 0x3f3f3f3f

const int maxn=1e6;

int fun(int n){

    int sum=0;

    while(n){

        sum+=(n%10);

        n/=10;

    }

    return sum;

}

int main()

{

    int n;

   while( cin>>n){

        int minn = inf;

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

            int sum = fun(i) + fun(n - i);

            if (minn > sum)

                minn = sum;

        }

        cout << minn << endl;

   }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<cstring>

using namespace std;

int main()

{

    char ch[10];

    scanf("%s",ch);

    int sum=0;

    for(int i=0;ch[i]!='\0';i++)

    {

        sum+=ch[i]-'0';

    }

    if(sum==1)  cout<<10<<endl;

    else cout<<sum<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <stdio.h>

#include <string.h>

#include <stdlib.h>



using namespace std;



int N;

int A, B, mini=99999999;

char a[10];

char b[10];

int sumA, sumB;



int main()

{

  cin >> N;

  if(N % 2 == 0)

  {

    A = N / 2;

    B = N / 2;

  }

  else

  {

    A = N / 2;

    B = (N / 2) + 1;

  }

  while(A>0)

  {

    sprintf(a, "%d", A);

    sprintf(b, "%d", B);

    for(int i=0; i<strlen(a); i++)

      sumA += a[i] - 48;

    for(int i=0; i<strlen(b); i++)

      sumB += b[i] - 48;

    if(sumA + sumB < mini)

      mini = sumA + sumB;

    sumA = 0;

    sumB = 0;

    A--;

    B++;

  }

  cout << mini << "\n";

  return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int sum(int N){

    int sum = 0;

    while(N > 0){

        sum += N % 10;

        N /= 10;

    }

    return sum;

}



int main(){

    int MIN = 1e9;

    int a, b, N;

    //La bruta xD

    cin >> N;

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

        a = sum(i);

        b = sum(N - i);

        MIN = min(MIN, a + b);

    }

    cout << MIN << "\n";



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int n;

	int sum=0;

	scanf("%d",&n);

	while(n>0)

	{

		sum+=n%10;

		n/=10; 

	 } 

	 if(sum==1)

	 {

	 	printf("10");

	 	return 0;

	 }

	 else 

	 {

	 	printf("%d",sum);

	 }

 } 

// Fastest known solution for this problem: