Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int N;
int sumdig(int x)
{
  if (x<10) return x;
  return x%10+sumdig(x/10);
}
int main()
{
  cin>>N;
  int minsum=1000000;
  for (int i=1;i<=N/2;i++)
    minsum=min(minsum,sumdig(i)+sumdig(N-i));
  cout<<minsum<<endl;
  //system("pause");
  return 0;
}

Compiler output:
a.cc:30:2: error: stray '#' in program
   30 | }#include <iostream>
      |  ^
a.cc:59:2: error: stray '#' in program
   59 | }#include <iostream>
      |  ^
a.cc:88:2: error: stray '#' in program
   88 | }#include <iostream>
      |  ^
a.cc:117:2: error: stray '#' in program
  117 | }#include <iostream>
      |  ^
a.cc:146:2: error: stray '#' in program
  146 | }#include <iostream>
      |  ^
a.cc:175:2: error: stray '#' in program
  175 | }#include <iostream>
      |  ^
a.cc:30:3: error: 'include' does not name a type
   30 | }#include <iostream>
      |   ^~~~~~~
a.cc:44:5: error: redefinition of 'int N'
   44 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:45:5: error: redefinition of 'int sumdig(int)'
   45 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~
a.cc:59:3: error: 'include' does not name a type
   59 | }#include <iostream>
      |   ^~~~~~~
a.cc:73:5: error: redefinition of 'int N'
   73 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:74:5: error: redefinition of 'int sumdig(int)'
   74 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:79:5: error: redefinition of 'int main()'
   79 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~
a.cc:88:3: error: 'include' does not name a type
   88 | }#include <iostream>
      |   ^~~~~~~
a.cc:102:5: error: redefinition of 'int N'
  102 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:103:5: error: redefinition of 'int sumdig(int)'
  103 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:108:5: error: redefinition of 'int main()'
  108 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~
a.cc:117:3: error: 'include' does not name a type
  117 | }#include <iostream>
      |   ^~~~~~~
a.cc:131:5: error: redefinition of 'int N'
  131 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:132:5: error: redefinition of 'int sumdig(int)'
  132 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:137:5: error: redefinition of 'int main()'
  137 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~
a.cc:146:3: error: 'include' does not name a type
  146 | }#include <iostream>
      |   ^~~~~~~
a.cc:160:5: error: redefinition of 'int N'
  160 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:161:5: error: redefinition of 'int sumdig(int)'
  161 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:166:5: error: redefinition of 'int main()'
  166 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~
a.cc:175:3: error: 'include' does not name a type
  175 | }#include <iostream>
      |   ^~~~~~~
a.cc:189:5: error: redefinition of 'int N'
  189 | int N;
      |     ^
a.cc:15:5: note: 'int N' previously declared here
   15 | int N;
      |     ^
a.cc:190:5: error: redefinition of 'int sumdig(int)'
  190 | int sumdig(int x)
      |     ^~~~~~
a.cc:16:5: note: 'int sumdig(int)' previously defined here
   16 | int sumdig(int x)
      |     ^~~~~~
a.cc:195:5: error: redefinition of 'int main()'
  195 | int main()
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main()
      |     ^~~~