criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

const int maxn = 1e3 + 5;
int pre[maxn * maxn];

struct X{
	int x,y;
}node[maxn * maxn];

int main(){
	int n,m,d,q,pos;
	cin >> n >> m >> d;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			scanf("%d",&pos);
			node[pos].x = i;
			node[pos].y = j;
		}
	}
	cin >> q;
	while(q--){
		int l,r,sum = 0;
		cin >> l >> r;
		for(int i = l + d;i <= r;i += d){
			sum += abs(node[i].x - node[i - d].x) + abs(node[i].y - node[i - d].y);
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'cin' was not declared in this scope
   19 |         cin >> n >> m >> d;
      |         ^~~
a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include <ctime>
  +++ |+#include <iostream>
    7 | using namespace std;
a.cc:34:17: error: 'cout' was not declared in this scope
   34 |                 cout << sum << endl;
      |                 ^~~~
a.cc:34:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:32: error: 'endl' was not declared in this scope
   34 |                 cout << sum << endl;
      |                                ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include <ctime>
  +++ |+#include <ostream>
    7 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int32 tx[90100][20] = {}, ty[90100][20] = {};
int main(void){
  int32 h, w, d;
  int32 A[310][310];
  map<int32, int32> x, y;
  cin >> h >> w >> d;
  REP(i, h){
    REP(j, w){
      cin >> A[i][j];
      A[i][j]--;
      x[A[i][j]] = j;
      y[A[i][j]] = i;
    }
  }
  REP(i, h*w){
    if(i < h*w-d){
      if(i+d >= 90100) continue;
      tx[i][0] = abs(x[i+d]-x[i]);
      ty[i][0] = abs(y[i+d]-y[i]);
    }
  }
  REP(i, h*w){
    REP(j, 19){
      if(i+d*(1<<j) >= 90100) continue;
      tx[i][j+1] = tx[i][j]+tx[i+d*(1<<j)][j];
      ty[i][j+1] = ty[i][j]+ty[i+d*(1<<j)][j];
    }
  }
  int32 Q;
  cin >> Q;
  REP(q, Q){
    int32 l, r;
    cin >> l >> r;
    int32 rx = 0, ry = 0;
    int32 now = 19;
    l--; r--;
    while(r-l){
      if(d*(1<<now) <= r-l){
        rx += tx[l][now];
        ry += ty[l][now];
        l += d*(1<<now);
        rest -= d*(1<<now);
      }
      now--;
    }
    cout << rx+ry << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: 'rest' was not declared in this scope
   65 |         rest -= d*(1<<now);
      |         ^~~~
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

int main() {
  int h, w, d;
  cin >> h >> w >> d;
  vector<int> row(h * w, -1);
  vector<int> col(h * w, -1);
  for (int r = 0; r < h; ++r) {
    for (int c = 0; c < w; ++c) {
      int a;
      cin >> a;
      row[a - 1] = r;
      col[a - 1] = c;
    }
  }

  vector<int64> costs(h * w, 0);
  for (int i = 0; i < d; ++i) {
    for (int x = i + d; x < h * w; x += d) {
      costs[x] = costs[i] + abs(row[x] - row[i]) + abs(col[x] - col[i]);
    }
  }

  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    cout << (costs[r - 1] - costs[l - 1]) << "\n";
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'int64' was not declared in this scope
   20 |   vector<int64> costs(h * w, 0);
      |          ^~~~~
a.cc:20:15: error: template argument 1 is invalid
   20 |   vector<int64> costs(h * w, 0);
      |               ^
a.cc:20:15: error: template argument 2 is invalid
a.cc:20:31: error: expression list treated as compound expression in initializer [-fpermissive]
   20 |   vector<int64> costs(h * w, 0);
      |                               ^
a.cc:23:12: error: invalid types 'int[int]' for array subscript
   23 |       costs[x] = costs[i] + abs(row[x] - row[i]) + abs(col[x] - col[i]);
      |            ^
a.cc:23:23: error: invalid types 'int[int]' for array subscript
   23 |       costs[x] = costs[i] + abs(row[x] - row[i]) + abs(col[x] - col[i]);
      |                       ^
a.cc:32:19: error: invalid types 'int[int]' for array subscript
   32 |     cout << (costs[r - 1] - costs[l - 1]) << "\n";
      |                   ^
a.cc:32:34: error: invalid types 'int[int]' for array subscript
   32 |     cout << (costs[r - 1] - costs[l - 1]) << "\n";
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,ans; 
int s(int a)
{
	int sum=0; 
	while(a!=0)
	{
		sum+=a%10;
		a/=10; 
	}
	return sum;
}
int main()
{
  //freopen("xxx.in","r",stdin);
  //freopen("xxx.out","w",stdout);
  cin>>n;
  for(int i=1;i<=n;i++)
  {
  	 ans=max(ans,s(i));
  } 
  cout<<ans<<endl;
  //fclose(stdin);
  //fclose(stdout);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: no matching function for call to 'max(long long int&, int)'
   21 |          ans=max(ans,s(i));
      |              ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:21:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   21 |          ans=max(ans,s(i));
      |              ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:21:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |          ans=max(ans,s(i));
      |              ~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>

typedef long long ll;

using namespace std;

#define rep(i,n) for(i=0;i<n;i++)
int main(){
    int i;
    char n[100];
    cin>>n;
    int max=0;
    int cnt=(int)strlen(n);
    int t=0;
    
    rep(i,cnt){
        if(n[i]=='9')
            t++;
    }
    if(t==cnt){
        cout<<9*cnt<<endl;
        return 0;
    }
    max=(cnt-1)*9;
    for(i=1;i<=10;i++){
        if((int)(n[0]-'0')<i){
            max+=(int)(n[0]-'0')-1;
            break;
        }
    }
    cout<<max<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'strlen' was not declared in this scope
   17 |     int cnt=(int)strlen(n);
      |                  ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<map>
  +++ |+#include <cstring>
    6 |
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  string N;
  cin >> N;
  int S=N.size(), A, K=0, ans;
  if (S[0]=='1') {
    A=1;
  }
  else if (S[0]=='2') {
    A=2;
  }
  else if (S[0]=='3') {
    A=3;
  }
  else if (S[0]=='4') {
    A=4;
  }
  else if (S[0]=='5') {
    ans=5;
  }
  else if (S[0]=='6') {
    A=6;
  }
  else if (S[0]=='7') {
    A=7;
  }
  else if (S[0]=='8') {
    A=8;
  }
  else {
    A=9;
  }
  ans=A+9*(S-1)-1;
  if (S==1) {
    ans=A;
  }
  else {
    for (int i=1; i<S; i++) {
      if (S[i]=='9') {
        K++;
      }
    }
    if (K==S-1) {
      ans=A+9*K;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: invalid types 'int[int]' for array subscript
   24 |   if (S[0]=='1') {
      |        ^
a.cc:27:13: error: invalid types 'int[int]' for array subscript
   27 |   else if (S[0]=='2') {
      |             ^
a.cc:30:13: error: invalid types 'int[int]' for array subscript
   30 |   else if (S[0]=='3') {
      |             ^
a.cc:33:13: error: invalid types 'int[int]' for array subscript
   33 |   else if (S[0]=='4') {
      |             ^
a.cc:36:13: error: invalid types 'int[int]' for array subscript
   36 |   else if (S[0]=='5') {
      |             ^
a.cc:39:13: error: invalid types 'int[int]' for array subscript
   39 |   else if (S[0]=='6') {
      |             ^
a.cc:42:13: error: invalid types 'int[int]' for array subscript
   42 |   else if (S[0]=='7') {
      |             ^
a.cc:45:13: error: invalid types 'int[int]' for array subscript
   45 |   else if (S[0]=='8') {
      |             ^
a.cc:57:12: error: invalid types 'int[int]' for array subscript
   57 |       if (S[i]=='9') {
      |            ^
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int sum1=0,sum2=0;
    sum1+=(s[0]-'0')-1;
    sum+=(s.length()-1)*9;
    for(int i=0;i<s.length();i++)
    {
        sum2+=(s[i]-'0');
    }
    cout<<max(sum1,sum2)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sum' was not declared in this scope; did you mean 'sum2'?
   13 |     sum+=(s.length()-1)*9;
      |     ^~~
      |     sum2
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
	string N;cin>>N;
 	ll ans=0;
 	ans += (N[0]-'0')-1;
 	ans += 9 * N.size() - 1;
 	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll ans=0;
      |         ^~
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |         ans += (N[0]-'0')-1;
      |         ^~~
      |         abs
Language: C++

#include <bits.stdc++.h>
using namespace std;

int main(){
	string N;cin>>N;
 	ll ans=0;
 	ans += (N[0]-'0')-1;
 	ans += 9 * N.size() - 1;
 	cout << ans << endl;
}

Compiler output:
a.cc:1:10: fatal error: bits.stdc++.h: No such file or directory
    1 | #include <bits.stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

	string n;
	cin >> n;

	int res=0;
	int ncount = 0;
	for (int i = 1; i < n.size(); i++) {
		res += 9;
		if (n[i] == '9') { ncount++; }
	}

	if (ncount != n.size - 1) {
		cout << res + (char)(n[0]) - '0' - 1 << endl;
	}
	else {
		cout << res + (char)(n[0]) - '0' << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   17 |         if (ncount != n.size - 1) {
      |                       ~~^~~~
      |                             ()
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
using namespace std;

int main()
{	
	string s;
	cin >> s;
	int n = s.size();
	int maxsum = 0,sum=0;
	for(int i=0;i<n;i++){
		maxsum = max(maxsum,sum+s[i]-49+(n-i-1)*9);
		sum += s[i]-48;
	}
	maxsum = max(maxsum.sum);
	cout << maxsum;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: request for member 'sum' in 'maxsum', which is of non-class type 'int'
   18 |         maxsum = max(maxsum.sum);
      |                             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int S(long long x) {
if(x < 10) return x;
return (x%10) + S(x/10);
}
int main() {
long long s;
cin >> s;
int ans = S(x);
int cur = 0;
while(x) {
x/=10;
cur += 9;
ans = max(ans, cur + S(x-1));
}
cout << ans;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'x' was not declared in this scope
   10 | int ans = S(x);
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
string n;
cin>>n;
int a=0;
int b=0;
int s=n.size();
for(int i=0; i<s; i++){
a+=n.at(i);}
if(a==9*s){
cout<<a<<endl;}
else{
cout<<9*(s-1)+s.at(0)-1<<endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: request for member 'at' in 's', which is of non-class type 'int'
   19 | cout<<9*(s-1)+s.at(0)-1<<endl;}
      |                 ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
string n;
cin>>n;
ll a=0;
ll b=0;
s=(ll)n.size();
for(ll i=0; i<s; i++){
a+=n.at(i);}
if(a==9*s){
cout<<a<<endl;}
else{
cout<<9*(s-1)+s.at(0)-1<<endl;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:1: error: 's' was not declared in this scope
   13 | s=(ll)n.size();
      | ^
Language: Java

import java.util.Scanner; 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = System.nextLine();
        int newSum = 0;
        int orgSum = 0;
        for( char ch : n.toCharArray()) {
            orgSum += ch -'0';
        }
        newSum = (n.charAt(0) - '0' )-  1;
        for( int i =1; i < n.length(); i++) {
            newSum += 9;   
        }
        System.out.println(Math.max(newSum, orgSum));
    }
}

Compiler output:
Main.java:5: error: cannot find symbol
        String n = System.nextLine();
                         ^
  symbol:   method nextLine()
  location: class System
1 error
Language: Java

import java.util.Scanner; 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = System.nextLine();
        int newSum = 0;
        int orgSum = 0;
        for( char ch : n.toCharArray()) {
            orgSum += ch -'0';
        }
        newSum = (n[0] - '0' )-  1;
        for( int i =1; i < n.length(); i++) {
            newSum += 9;   
        }
        System.out.println(Math.max(newSum, orgSum));
    }
}

Compiler output:
Main.java:5: error: cannot find symbol
        String n = System.nextLine();
                         ^
  symbol:   method nextLine()
  location: class System
Main.java:11: error: array required, but String found
        newSum = (n[0] - '0' )-  1;
                   ^
2 errors
Language: C++

n = input()

if len(n) == 1:
  print(n)
  exit()

if all(x == "9" for x in n[1:]):
  ans = n
else:
  ok = False
  ans = ""
  for i, c in enumerate(n):
    x = int(c)
    if x == 9:
      ans += "9"
    else:
      if ok:
        ans += "9"
      else:
        if i == len(n)-1:
          ans = ans[:-1]
          ans += str(int(n[i-1])-1)
          ans += "9"
        else:
          ans += str(x-1)
      ok = True
t = 0
for c in ans:
  x = int(c)
  t += x

print(t)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = input()
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 typedef long long ll;

int main() {
string s;cin>>s;
int lo = s.size();
bool big = 1;
for(int i = 1;i<lo;i++){
    if(s[i]!='9')big = 0;
}
int ans = 0;
if(big==1){
ans = (s[0]-'0')+(lo-1)*9;
}
else{
    ans = (S[0]-'0'-1)+(lo-1)*9;
}
cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'S' was not declared in this scope
   17 |     ans = (S[0]-'0'-1)+(lo-1)*9;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll a;
  cin >> a;
  ll ans,k=0;
  ll n=a;
  while(a>9){
    a/=10;
    k++;
  }
  ans=9*k+a-1;
  if(n%floor(pow(10,k))==0)ans++;
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%'
   14 |   if(n%floor(pow(10,k))==0)ans++;
      |      ~^~~~~~~~~~~~~~~~~
      |      |      |
      |      |      double
      |      ll {aka long long int}
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll a;
  cin >> a;
  ll ans,k=0;
  ll n=a;
  while(a>9){
    a/=10;
    k++;
  }
  ans=9*k+a-1;
  if(n%pow(10,k)==0)ans++;
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   14 |   if(n%pow(10,k)==0)ans++;
      |      ~^~~~~~~~~~
      |      |    |
      |      |    __gnu_cxx::__promote<double>::__type {aka double}
      |      ll {aka long long int}
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >>s;
  int c = (int)s[0];
  int k = (int)s.length();
  ans = c + (k-1)-1;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   ans = c + (k-1)-1;
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;

signed main(){
	string s; cin >> s;
	int n = s.size();
	int num = s[0] - '0';
    bool check = false;
    for(int i = 1; i < n; i++) if(s[i] != '9') check = true;
	if(!ok) cout << num + 9 * (n - 1) - 1 << endl;
  else cout << num + 9 * (n -1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'ok' was not declared in this scope
   10 |         if(!ok) cout << num + 9 * (n - 1) - 1 << endl;
      |             ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin>>s;
  	int cur=0;
  	for (char c:s){
    	cur+=c-'0';
    }
  	cout<<max(cur,(int)s[0]-'0'+9*(s.size()-1))<<endl;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   10 |         cout<<max(cur,(int)s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:10:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   10 |         cout<<max(cur,(int)s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:10:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   10 |         cout<<max(cur,(int)s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin>>s;
  	int cur=0;
  	for (char c:s){
    	cur+=c-'0';
    }
  	cout<<max(cur,s[0]-'0'+9*(s.size()-1))<<endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   10 |         cout<<max(cur,s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:10:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   10 |         cout<<max(cur,s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:10:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   10 |         cout<<max(cur,s[0]-'0'+9*(s.size()-1))<<endl;
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

signed main(){

  int64_t n;
  cin>>n;

  auto digit_sum = [](int64_t n){
    int res = 0;
    while(n){
      res+=n%10;
      n/=10;
    }
    return res;
  };

  int dig = to_string(n).size()-1;
  int64_t tmp = to_string(n)[0]-'0'-1;
  for(int i=0;i<dig;++i)tmp = tmp*10+9;
  ans = max(ans,digit_sum(tmp));
  cout<<(ans)<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   ans = max(ans,digit_sum(tmp));
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main(){
    ll n;
    int s = 9; 
    cin >> n;
    int cnt = 1;
    int r = x;
    while(x > 9){
        if(x/10 != 9 || x%10 != 9) s = 1;
        x /= 10;
        cnt++;
    }
    if(s == 9) cout << 9*cnt << endl;
    else{
        cout << x-1 + 9*(cnt-1)-1 << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'x' was not declared in this scope
   12 |     int r = x;
      |             ^
Language: C++

v#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    ll n;
    cin >> n;
    int c = 0, ninecnt = 0, digitcnt = 0;
    ll tmp = n;
    while (tmp > 0) {
        c = tmp % 10;
        if (c == 9) ninecnt++;
        tmp /= 10;
        digitcnt++;
    }
    if(digitcnt == 1){
        cout << n << endl;
    }
    else if (digitcnt - 1 <= ninecnt && c != 9) {
        cout << c + 9 * (digitcnt - 1) << endl;
    }
    else {
        cout << c + 9 * (digitcnt - 1) - 1 << endl;
    }
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n;
      |     ^~~
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << n << endl;
      |         ^~~~
a.cc:18:22: error: 'endl' was not declared in this scope
   18 |         cout << n << endl;
      |                      ^~~~
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << c + 9 * (digitcnt - 1) << endl;
      |         ^~~~
a.cc:21:43: error: 'endl' was not declared in this scope
   21 |         cout << c + 9 * (digitcnt - 1) << endl;
      |                                           ^~~~
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout << c + 9 * (digitcnt - 1) - 1 << endl;
      |         ^~~~
a.cc:24:47: error: 'endl' was not declared in this scope
   24 |         cout << c + 9 * (digitcnt - 1) - 1 << endl;
      |                                               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
using ll = long long;
using P = pair<int,int>;

int main(){
	string n;
	cin>>n;
	string s=n[0];
	bool a=true;
	rep(i,n.size()){
		a=a&&n[i]=='9'
	}
	if(a){
		puts(9*(int)n.size());
		return 0;
	}
	if(stoi(s)==1)puts(9*(int)(n.size()-1));
	else puts(9*(int)(n.size()-1)+stoi(s)-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   11 |         string s=n[0];
      |                     ^
a.cc:14:31: error: expected ';' before '}' token
   14 |                 a=a&&n[i]=='9'
      |                               ^
      |                               ;
   15 |         }
      |         ~
Language: C

#include<stdio.h>
int main()
{
  int b,c;
  b=0;
char a;
scanf("%s",a);
  for(int j=0;a[j]!="¥0";j++)
  {
  b=b+1;
  }
  
 if(b>1)
   {
 c=a[0]+9*b;
   }
  else c=a[0];
  
  
printf("%d",c);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:16: error: subscripted value is neither array nor pointer nor vector
    8 |   for(int j=0;a[j]!="¥0";j++)
      |                ^
main.c:15:5: error: subscripted value is neither array nor pointer nor vector
   15 |  c=a[0]+9*b;
      |     ^
main.c:17:11: error: subscripted value is neither array nor pointer nor vector
   17 |   else c=a[0];
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long l,sum,sum1;
string s;
int main(){
    cin>>s;
    l=s.size();
    for(int i=0;i<l;i++){
        sum1+=s[i]-'0';
        if(s[i]=='1'&&i==0)continue;else if(i==0){sum+=(s[i]-'0'-1);continue;}
        sum2+=9;
    }
    cout<<max(sum1,sum2)<<"\n";
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   11 |         sum2+=9;
      |         ^~~~
      |         sum1
a.cc:13:20: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   13 |     cout<<max(sum1,sum2)<<"\n";
      |                    ^~~~
      |                    sum1
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int ans;
int main() 
{
    cin>>s;
    int l=s.size();
    for(int i=1;i<l;i++) 
       ans+=9;
    int flag=1;
    for(int i=1;i<l;i++) 
       if(s[i]!='9') 
        flag=0;
    if(flag) 
         cout<<ans+str[0]-'0'<<endl;
    else 
         cout<<ans+str[0]-'1'<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: 'str' was not declared in this scope; did you mean 'std'?
   17 |          cout<<ans+str[0]-'0'<<endl;
      |                    ^~~
      |                    std
a.cc:19:20: error: 'str' was not declared in this scope; did you mean 'std'?
   19 |          cout<<ans+str[0]-'1'<<endl;
      |                    ^~~
      |                    std
Language: C++

#include <iostream>

using namespace std;

long long panduan(long long n){
    int s = 0;
    while(n > 0){
        s += n%10;
        n /= 10;
    }
    return s;
}

void Core(){
    long long n,tmp,x = 1;
    cin>>n;
    int s = panduan(n);
    tmp = n;
    while(tmp >= 10){
        tmp /= 10;
        x *= 10;
    }
    s = max(s,panduan(n/x*x - 1));
    cout<<s<<endl;
}

int main(){
    Core();
    return 0;
}

Compiler output:
a.cc: In function 'void Core()':
a.cc:23:12: error: no matching function for call to 'max(int&, long long int)'
   23 |     s = max(s,panduan(n/x*x - 1));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:23:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   23 |     s = max(s,panduan(n/x*x - 1));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>

using namespace std;

void panduan(long long n){
    int s = 0;
    while(n > 0){
        s += n%10;
        n /= 10;
    }
    return s;
}

void Core(){
    long long n,tmp,x = 1;
    cin>>n;
    int s = panduan(n);
    tmp = n;
    while(tmp >= 10){
        tmp /= 10;
        x *= 10;
    }
    s = max(ans,cs(n/x*x - 1));
    cout<<s<<endl;
}

int main(){
    Core();
    return 0;
}

Compiler output:
a.cc: In function 'void panduan(long long int)':
a.cc:11:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   11 |     return s;
      |            ^
a.cc: In function 'void Core()':
a.cc:17:20: error: void value not ignored as it ought to be
   17 |     int s = panduan(n);
      |             ~~~~~~~^~~
a.cc:23:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     s = max(ans,cs(n/x*x - 1));
      |             ^~~
      |             abs
a.cc:23:17: error: 'cs' was not declared in this scope; did you mean 's'?
   23 |     s = max(ans,cs(n/x*x - 1));
      |                 ^~
      |                 s
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  long ans = S.at(0) - '0' - 1, sub = 0; 
  ans += 9 * (S.size() - 1);
  for(char a: S)sub += S.at(i) - '0';
  cout << max(sub, ans) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: 'i' was not declared in this scope
    8 |   for(char a: S)sub += S.at(i) - '0';
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	string n;
    cin >> n;
    int size = n.size();
    int count = 0;

    if(n.size() == 1){
        count = n.at(0) - 48;
    }
    else if (n.at(0) != '9'){
        int digit;
        for (digit  = 0; digit < n.size(); digit++){
            if (n.at(digit) != '9'){
                break;
            }
        }
        if (digit == n.size()){
            count = 9 * (n.size() - 1) + n.at(0) - 48;
        }else{
            if (n.at(0) != '1'){
            str += n.at(0) - 1;
        }
        for (int i = 1; i < size; i++){
            str += '9';
        }

        count = 9 * (n.size() - 1) + (n.at(0) - 49);
        }
        
    }
    else{
        int digit;
        for (digit  = 0; digit < n.size(); digit++){
            if (n.at(digit) != '9'){
                break;
            }
        }
        if (digit == n.size()){
            count = 9 * n.size();
        }
        else{
            count = (digit - 1) * 9 + (n.at(digit - 1) - 49) 
            + (n.size() - digit) * 9;
        }

    }

    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'str' was not declared in this scope; did you mean 'std'?
   24 |             str += n.at(0) - 1;
      |             ^~~
      |             std
a.cc:27:13: error: 'str' was not declared in this scope; did you mean 'std'?
   27 |             str += '9';
      |             ^~~
      |             std
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,n,h) for(int i = n; i < h; ++i)
#define rep3(l,n,h) for(int l = n; l <= h; ++l)
typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;


int main(void) {
    string s;
    cin >> s;
    int h = s.length(),k,c = (s[0] - '0'), z = (s[0] - '0');
    long long n = z;
    rep2(i,1,h) {
        c *= 10;
        z += 9;
        k *= 10;
        k += 9;
        n *= 10;
        n += s[i] - '0';
    int x = c + k;
    if(n == x) {
        cout << z << endl;
        return 0;
    } else {
        cout << z - 1 << endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:13:16: note: to match this '{'
   13 | int main(void) {
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void){
	string  a;
  cin >> a;
  
 cout << (s[0]-1)+(s.size()-1)*9 << endl;
}
  
 

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: 's' was not declared in this scope
    9 |  cout << (s[0]-1)+(s.size()-1)*9 << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void solve(){
  string n;
  cin>>n;
  ll cnt=0;
  rep(i,n.size()){
    if(n[i]=='9')cnt++;
    }
  if(cnt>=n.size()-1){
    ll a=n[0]-'0';
    cout<<a+(9*(n.size()-1));
    return 0;
}
  else {
    ll a=n[0]-'0';
    cout<<a-1+(9*(n.size()-1));
}
}

int main(){
    cout<<std::fixed<<std::setprecision(10)
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:27:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   27 |     return 0;
      |            ^
a.cc: In function 'int main()':
a.cc:36:44: error: expected ';' before 'ios'
   36 |     cout<<std::fixed<<std::setprecision(10)
      |                                            ^
      |                                            ;
   37 |     ios::sync_with_stdio(false);
      |     ~~~
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int same = 0;
    for (int i = 0; i < N.length(); i++) {
      int d = N.charAt(i) - '0';
      smae += d;
    }
    int lower = (N.charAt(0) - '0') - 1;
    lower += 9*(N.length()-1);
    System.out.println(Math.max(lower, same));
  }
}

Compiler output:
Main.java:10: error: cannot find symbol
      smae += d;
      ^
  symbol:   variable smae
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int same = 0;
    for (int i = 0; i < N.length(); i++) {
      int d = N.charAt(i) - '0';
      smae += d;
    }
    int lower = (N.charAt(i) - '0') - 1;
    lower += 9*(N.length()-1);
    System.out.println(Math.max(lower, same));
  }
}

Compiler output:
Main.java:10: error: cannot find symbol
      smae += d;
      ^
  symbol:   variable smae
  location: class Main
Main.java:12: error: cannot find symbol
    int lower = (N.charAt(i) - '0') - 1;
                          ^
  symbol:   variable i
  location: class Main
2 errors
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int lower = 0;
    int same = 0;
    for (int i = 0; i < N.length(); i++) {
      int d = N.charAt(i) - '0';
      lower += Math.max(lower+9, same + Math.max(0, d-1));
      same += d;
    }
    Systen.out.println(Math.max(lower, same));
  }
}

Compiler output:
Main.java:14: error: package Systen does not exist
    Systen.out.println(Math.max(lower, same));
          ^
1 error
Language: C++

  #include <bits/stdc++.h>
  using namespace std;

  const int MOD = 1000000007;
  const double PI = acos(-1); 

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

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

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }



// // 二分探索(最小値を出す問題は疑う)
// bool C(ll x){
//     ll res = 0;
//     for(int i = 0; i < N; ++i){
// 		res += max(0ll, A[i]-x/F[i]);
//     }
//     return res <= K;
// }

//   ll binary_search(ll ok, ll ng){
//     while(abs(ok - ng) > 1){
//       ll mid = (ok + ng) / 2;
//       if(C(mid)) ok = mid;
//       else ng = mid;
//     }
//     return ok;
//   }

int main(){
string N;
cin >> N;
int len = N.length();

int sum = 0;
REP(i, len){
  sum += N.at(i) - '0'; 
}

cout << max((int)(N.size()-1)　*　9　+　N.at(0) -'0'- 1, sum) << endl;

}

Compiler output:
a.cc:71:30: error: extended character 　 is not valid in an identifier
   71 | cout << max((int)(N.size()-1)　*　9　+　N.at(0) -'0'- 1, sum) << endl;
      |                              ^
a.cc:71:33: error: extended character 　 is not valid in an identifier
   71 | cout << max((int)(N.size()-1)　*　9　+　N.at(0) -'0'- 1, sum) << endl;
      |                                 ^
a.cc:71:33: error: extended character 　 is not valid in an identifier
a.cc:71:39: error: extended character 　 is not valid in an identifier
   71 | cout << max((int)(N.size()-1)　*　9　+　N.at(0) -'0'- 1, sum) << endl;
      |                                       ^
a.cc: In function 'int main()':
a.cc:71:30: error: expected ')' before '\U00003000'
   71 | cout << max((int)(N.size()-1)　*　9　+　N.at(0) -'0'- 1, sum) << endl;
      |            ~                 ^~
      |                              )
Language: C

#include <include.h>
#include <string.h>
int main(){
  long long N;
  char a[5000];
  scanf("%s",a);
  N=strlen(a);
  if(N==1){printf("%d",a[0]-48);}
  else{
  printf("%lld",(N-1)*9+a[0]-48-1);
    }
  return 0;
  }

Compiler output:
main.c:1:10: fatal error: include.h: No such file or directory
    1 | #include <include.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;


int main() {
  ll N;
  cin >> N;
  vector<ll> d(1, 0);
  bool flg = false;
  ll num = N;
  bool flg = false;
  for (int i = 16; 0 <= i; --i) {
    ll div = num / pow(10, i);
    if (!flg && div != 0) {
      flg = true;
      continue;
    }
    num -= div * pow(10, i) - 1;
    d.push_back(num);
  }
  
  ll result = 0;
  for (int i = 0; i < d.size(); ++i) {
    ll n = N - d.at(i);
    ll r = 0;
    for (int j = 16; 0 <= j; --j) {
      ll div = n / pow(10, j);
      r += div;
      n -= div * pow(10, j);
    }
    result = max(result, r);
  }
  cout << result << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: redeclaration of 'bool flg'
   12 |   bool flg = false;
      |        ^~~
a.cc:10:8: note: 'bool flg' previously declared here
   10 |   bool flg = false;
      |        ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int ans=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll a[5];
int main(void){
  int n;
  scanf("%lld",&n);
  PRN(9*kt(n));
  return 0;
}


Compiler output:
main.c: In function 'kt':
main.c:40:5: error: 'sum' undeclared (first use in this function)
   40 |     sum++;
      |     ^~~
main.c:40:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,ans=0;
  cin >> n;
  while(n>9) {
    n/=10;
    ans++;
  }
  cout << c-1+ans*9 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'c' was not declared in this scope
   14 |   cout << c-1+ans*9 << endl;
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,ans=0;
  cin >> n;
  while(n>9) {
    n/=10;
    ans++;
  }
  cout << c-1+ans+9 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'c' was not declared in this scope
   14 |   cout << c-1+ans+9 << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
#define LL long long
using namespace std;
int qh(LL n)
{
    int sum = 0;
    while(n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
LL t,n;
int main()
{
    LL cnt = 1;
    cin >> n;
    int ans = qh(n);
    t = n;
    while(t >= 10)
    {
        temp /= 10;
        cnt *= 10;
    }
    ans = max(ans,qh(n / cnt * cnt - 1));
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'temp' was not declared in this scope; did you mean 'tm'?
   23 |         temp /= 10;
      |         ^~~~
      |         tm
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    
    string s = random_string(4);
    map<char, int> mp;
    rep(i, sz(s)) mp[s[i]]++;

    int ans = 0;
    // 変更の必要ない
    if ((mp['9'] == sz(s) - 1 && s[0] != '9') || mp['9'] == sz(s)) {
        rep(i, sz(s)) ans += s[i] - '0';
    } else {
        ans =  (sz(s) - 1) * 9 + s[0] - '0' - 1;
    }
    out(ans);
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'random_string' was not declared in this scope; did you mean 'random_r'?
   31 |     string s = random_string(4);
      |                ^~~~~~~~~~~~~
      |                random_r