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

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

int main(){
	string s; cin>>s;
	vector<ll> N(s.sz);
	ll sum=0;
	rep(i,s.sz){
		N[i]=s[i]-'0';
		sum+=N[i];	
	}
	cout<<max(sum,(ll)9*(s.sz-1)+N[0]-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: no matching function for call to 'max(ll&, long long unsigned int)'
   26 |         cout<<max(sum,(ll)9*(s.sz-1)+N[0]-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
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:26:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   26 |         cout<<max(sum,(ll)9*(s.sz-1)+N[0]-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
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:26:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |         cout<<max(sum,(ll)9*(s.sz-1)+N[0]-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

int main(){
	string s; cin>>s;
	vector<ll> N(s.sz);
	ll sum=0;
	rep(i,s.sz){
		N[i]=s[i]-'0';
		sum+=N[i];	
	}
	cout<<max(sum,9*(s.sz-1)+N[0]-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: no matching function for call to 'max(ll&, long long unsigned int)'
   26 |         cout<<max(sum,9*(s.sz-1)+N[0]-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:26:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   26 |         cout<<max(sum,9*(s.sz-1)+N[0]-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
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:26:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |         cout<<max(sum,9*(s.sz-1)+N[0]-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
int main(){
longlong n,p=-1,q=1;
std::cin>>n;
longlong x=n;
while(x){x/=10;p++;q*=10;}
std::cout<<p*9+((n*10)/q)-1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'longlong' was not declared in this scope
    3 | longlong n,p=-1,q=1;
      | ^~~~~~~~
a.cc:4:11: error: 'n' was not declared in this scope
    4 | std::cin>>n;
      |           ^
a.cc:5:9: error: expected ';' before 'x'
    5 | longlong x=n;
      |         ^~
      |         ;
a.cc:6:7: error: 'x' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |       ^
a.cc:6:16: error: 'p' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |                ^
a.cc:6:20: error: 'q' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |                    ^
a.cc:7:12: error: 'p' was not declared in this scope
    7 | std::cout<<p*9+((n*10)/q)-1;
      |            ^
a.cc:7:24: error: 'q' was not declared in this scope
    7 | std::cout<<p*9+((n*10)/q)-1;
      |                        ^
Language: C++

#include <iostream>
int main(){
longlong n,p=-1,q=1;
cin>>n;
longlong x=n;
while(x){x/=10;p++;q*=10;}
std::cout<<p*9+((n*10)/q)-1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'longlong' was not declared in this scope
    3 | longlong n,p=-1,q=1;
      | ^~~~~~~~
a.cc:4:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 | cin>>n;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:4:6: error: 'n' was not declared in this scope
    4 | cin>>n;
      |      ^
a.cc:5:9: error: expected ';' before 'x'
    5 | longlong x=n;
      |         ^~
      |         ;
a.cc:6:7: error: 'x' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |       ^
a.cc:6:16: error: 'p' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |                ^
a.cc:6:20: error: 'q' was not declared in this scope
    6 | while(x){x/=10;p++;q*=10;}
      |                    ^
a.cc:7:12: error: 'p' was not declared in this scope
    7 | std::cout<<p*9+((n*10)/q)-1;
      |            ^
a.cc:7:24: error: 'q' was not declared in this scope
    7 | std::cout<<p*9+((n*10)/q)-1;
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int main(){
  ll N;
  int p;
  p=0;
  cin >> N;
  for(i=0;N>0;){
    p +=N%10;
    N/=10;
  }
  cout << p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i=0;N>0;){
      |       ^
Language: C++

#include<iostream>
using namespace std;

int main(void){
  long n;
  cin >> n;
  int digit[17];
  int b = n;
  int d = 0;
  int max = 0;
  bool flag;
  for(int i=0; true; ++i){
    a = b % 10;
    b = (b-a)/10;
  	digit[i] = a;
    d += 1;
    if(b<10){
      digit[i+1] = b;
      break;
    }
  }
  for(int i=d-1; i>=0; ++i){
    if(digit[i]!=9){
      for(int j=d; j>=0; ++j){
        max += 9;
      }
      cout << max-1;
      flag = true;
      break;
    }
  }
  if(!flag){
    cout << 9*(d+1);
  }
}

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

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

int main(){
	string s;cin>>s;
	int n=s.size(),a=s[0]-'0';
	if (n==1)ans=stoi(s);
	else ans=a+9*(n-1)-1;
	
cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |         if (n==1)ans=stoi(s);
      |                  ^~~
      |                  abs
a.cc:8:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |         else ans=a+9*(n-1)-1;
      |              ^~~
      |              abs
a.cc:10:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 | cout<<ans<<endl;
      |       ^~~
      |       abs
Language: C++

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

int main(){
	string s;cin>>s;
	int n=s.size(),a=s[0]-'0';
	if (n==1)ans=stoi(s);
	else ans=a+9*(n-1)-1;
	
cout<<ans<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string s;cin>>s;
      |         ^~~~~~
a.cc:5:18: error: 'cin' was not declared in this scope
    5 |         string s;cin>>s;
      |                  ^~~
a.cc:5:23: error: 's' was not declared in this scope
    5 |         string s;cin>>s;
      |                       ^
a.cc:7:18: error: 'ans' was not declared in this scope
    7 |         if (n==1)ans=stoi(s);
      |                  ^~~
a.cc:7:22: error: 'stoi' was not declared in this scope
    7 |         if (n==1)ans=stoi(s);
      |                      ^~~~
a.cc:8:14: error: 'ans' was not declared in this scope
    8 |         else ans=a+9*(n-1)-1;
      |              ^~~
a.cc:8:18: error: 'a' was not declared in this scope
    8 |         else ans=a+9*(n-1)-1;
      |                  ^
a.cc:10:1: error: 'cout' was not declared in this scope
   10 | cout<<ans<<endl;
      | ^~~~
a.cc:10:7: error: 'ans' was not declared in this scope
   10 | cout<<ans<<endl;
      |       ^~~
a.cc:10:12: error: 'endl' was not declared in this scope
   10 | cout<<ans<<endl;
      |            ^~~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  int res=0;
  for(int i=1;i<=9; i++)
  {
  long long x=i;
    if(x>=n) break;
    while(x*10+9)
    {
      x=x*10+9;
      sum+=9;
    }
    res=max(res,sum);
  }
  cout<<res<<'\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'sum' was not declared in this scope
   18 |       sum+=9;
      |       ^~~
a.cc:20:17: error: 'sum' was not declared in this scope
   20 |     res=max(res,sum);
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
using namespace std;int f(long n){int p=log10(n);return res=9*p+(int)(n/pow(10,p))-1;}int main(){long n;cin>>n;cout<<f(++n)<<endl;}

Compiler output:
a.cc: In function 'int f(long int)':
a.cc:4:57: error: 'res' was not declared in this scope
    4 | using namespace std;int f(long n){int p=log10(n);return res=9*p+(int)(n/pow(10,p))-1;}int main(){long n;cin>>n;cout<<f(++n)<<endl;}
      |                                                         ^~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
include <algorithm>
#include <string.h>
using namespace std;
int make(long n){
    int p = log10(n);
    int res = 9 * p + n / pow(10,p);
    return res;
}
int main(){
    long n;
    cin >> n;
    n++;
    cout << make(n) << endl;
}

Compiler output:
a.cc:3:1: error: 'include' does not name a type
    3 | include <algorithm>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:13:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |     cout << make(n) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:15:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |     cout << make(n) << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
include <algorithm>
using namespace std;
int make(long n){
    int p = log10(n);
    int res = 9 * p + n / pow(10,p);
    return res;
}
int main(){
    long n;
    cin >> n;
    n++;
    cout << make(n) << endl;
}

Compiler output:
a.cc:3:1: error: 'include' does not name a type
    3 | include <algorithm>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |     cout << make(n) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |     cout << make(n) << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

int main() {
  string n; cin>>n;
  rep(i, n.size()){if(n.size()==1){cout<<n[0]-'0'<<endl;
                                   return 0;}
    
    if(n[i]!='9'){
  cout<<(n[0]-'0')-1+(n.size-1)*9;
    return 0;}
                  }
  cout<<n.size*9;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13: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 '()' ?)
   13 |   cout<<(n[0]-'0')-1+(n.size-1)*9;
      |                       ~~^~~~
      |                             ()
a.cc:16:11: 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 '()' ?)
   16 |   cout<<n.size*9;
      |         ~~^~~~
      |               ()
Language: C++

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N; cin>>N;
    string s=to_string(N+1);
    int ans=0,cur=0;
    REP(i,s.size()){
        if(s[i]!='0') 
            ans=max(ans,cur+(s[i]-'1')+9*(s.size()-i-1));
        cur+=s[i]-'0';
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   16 |             ans=max(ans,cur+(s[i]-'1')+9*(s.size()-i-1));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:16:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   16 |             ans=max(ans,cur+(s[i]-'1')+9*(s.size()-i-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
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:16:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |             ans=max(ans,cur+(s[i]-'1')+9*(s.size()-i-1));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int calc(int N)
{
    int res=0;
    while(N>0){
        res+=N%10;
        N/=10;
    }
    return res;
}

signed main()
{   
    int N; cin>>N;
    int ans=calc(N);
    string s=to_string(N);
    ans=max(ans,(int)(s[0]-'1')+9*(s.size()-1));
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: no matching function for call to 'max(long long int&, long long unsigned int)'
   24 |     ans=max(ans,(int)(s[0]-'1')+9*(s.size()-1));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:24:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   24 |     ans=max(ans,(int)(s[0]-'1')+9*(s.size()-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
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:24:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |     ans=max(ans,(int)(s[0]-'1')+9*(s.size()-1));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
int main(void)
{
  char n[17];
  int max = 0;
  std::cin >> n;
  for(int i = 0; i < std::strlen(n); i++) max += int)n[i] - '0';
  for(int i = 0; i < std::strlen(n); i++){
    if((int)n[i] - '0' > 0){
      int sum = (int)n[i] - '1';
      for(int j = i + 1; j < std::strlen(n); j++) sum += 9;
      max = std::max(max, sum);
    }
  }
  std::cout << max << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:50: error: expected primary-expression before 'int'
    7 |   for(int i = 0; i < std::strlen(n); i++) max += int)n[i] - '0';
      |                                                  ^~~
Language: C++

//In The Name of Beauty
//...So here I go is my shot
//Feet fail me not 'cause maybe the only opportunity that I got...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 1e5 + 8;
ll const INF  = 1e12 + 8;
ll const delta = 1000000007;

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    ll ans = 0;
    ll temp = 0;
    for(ll i = 0;i < s.size();i++)
    {
        if(s[i] == '0')continue;
        ans = max(ans,temp + (s[i] - '0' - 1) + 9 * (s.size() - i - 1));
        temp += (s[i] - '0');
    }
    ans = max(ans,temp);
    cout << ans;
    return 0;
}
//Written by M_H_H_7


Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: no matching function for call to 'max(ll&, long long unsigned int)'
   30 |         ans = max(ans,temp + (s[i] - '0' - 1) + 9 * (s.size() - i - 1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:4:
/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:30:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   30 |         ans = max(ans,temp + (s[i] - '0' - 1) + 9 * (s.size() - i - 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
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:30:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   30 |         ans = max(ans,temp + (s[i] - '0' - 1) + 9 * (s.size() - i - 1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    ll n; cin >> n;
    ll m = n;
    int digit = 0;
    int first_digit = 0;
    int ans = 0;
    while(m > 0){
        m /= 10;
        digit++;
        if(m < 10){
            first_digit = m;
        }
    }
    ans = 9*(m-1) + first_digit;
    n_moto = first_digit;
    for(int i = 0; i < m; i++){
        n_moto = n_moto*10 + 9;
    }
    if(n_moto > n) ans--;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'n_moto' was not declared in this scope
   24 |     n_moto = first_digit;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>

int mian ()
{
	char str [100] ;
	while (scanf ("%s",str) !=EOF ) 
	{
	int len = strlen (str ) ;

	if (len == 1) printf ("%s\n",str);

	else 
	{
		int flag = 1 ;
		for (int i= 1 ; i<len ; i++ ) 
		{
			if (str[i] !='9' ){flag = 0;  break ;}
		}
		if (flag ) printf ("%d\n",str[0]-'0'+(len-1)*9) ;
		else 
		{
		int ans = (len-1 )*9;
		ans += str [0]-'0'-1;
		printf ("%d\n",ans) ;
		}
	}


	}

	return 0;

}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'N' was not declared in this scope
   17 |           cout<<top+9*(N.size()-1)<<endl;
      |                        ^
Language: C++

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

int main(){
  string n;
  cin>>n;
  int t=n.size();
  bool flg=true;
  for(int i=1;i<t;i++){
      if(n[i]!='9') flg=false;
  }
  int a=n[0]-'0';
  int b=
  if(t=1) cout<<n<<endl;
  else if(flg) cout<<n<<endl;
  else cout<<9*(t-1)+a-1<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected primary-expression before 'if'
   14 |   if(t=1) cout<<n<<endl;
      |   ^~
a.cc:15:3: error: 'else' without a previous 'if'
   15 |   else if(flg) cout<<n<<endl;
      |   ^~~~
Language: C++

n = input()
print(((int(n[0]) + 9 * (len(n) - 1)) if (n[1:] == (len(n) - 1) * '9') else ((int(n[0]) - 1) + 9 * (len(n) - 1))))


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;
char a[50];
int l,ans,f;
int main()
{
    gets(a);
    l=strlen(a);
    for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
    if(f) ans=(l-1)*9+a[0]-'0'-1;
    else ans=(l-1)*9+a[0]-'0';
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |     gets(a);
      |     ^~~~
      |     getw
a.cc:9:22: error: expected unqualified-id before '=' token
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |                      ^
a.cc:9:21: error: expected ';' before '=' token
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |                     ^~
      |                     ;
a.cc:9:22: error: expected primary-expression before '=' token
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |                      ^
a.cc:9:25: error: 'i' was not declared in this scope
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |                         ^
a.cc:9:28: error: expected ')' before ';' token
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |        ~                   ^
      |                            )
a.cc:9:29: error: 'i' was not declared in this scope
    9 |     for(register int =1;i<l;i++) if(a[i]!='9'){f=1;break;}
      |                             ^
Language: C


#include <stdio.h>
#include <math.h>
int main()
{   long long n;
    scanf("%lld",&n);
    int dig=log10(n);
    int head=n/(pow(10,dig));
    if(n==9||n==99||n==999||n==9999||n==99999||
        n==999999||n==9999999||n==99999999||n==999999999||n==9999999999||
        n==99999999999||n==999999999999||n==9999999999999||n==99999999999999||
        n==999999999999999||
        n==8||
        n==89||n==899||n==8999||n==89999||
        n==899999||n==8999999||n==89999999||n==899999999||n==8999999999||
        n==89999999999||n==899999999999||n==8999999999999||n==89999999999999||
        n==899999999999999||
        n==7||
        n==79||n==799||n==7999||n==79999||
        n==799999||n==7999999||n==79999999||n==799999999||n==7999999999||
        n==79999999999||n==799999999999||n==7999999999999||n==79999999999999||
        n==799999999999999||
        n==6||n==69||n==699||n==6999||n==69999||
        n==699999||n==6999999||n==69999999||n==699999999||n==6999999999||
        n==69999999999||n==699999999999||n==6999999999999||n==69999999999999||
        n==699999999999999||
        n==5||
        n==59||n==599||n==5999||n==59999||
        n==599999||n==5999999||n==59999999||n==599999999||n==5999999999||
        n==59999999999||n==599999999999||n==5999999999999||n==59999999999999||
        n==599999999999999||
        n==4||
        n==49||n==499||n==4999||n==49999||
        n==499999||n==4999999||n==499999999||n==499999999||n==4999999999||
        n==49999999999||n==499999999999||n==4999999999999||n==49999999999999||
        n==499999999999999||
        n==3||
        n==39||n==399||n==3999||n==39999||
        n==399999||n==3999999||n==39999999||n==399999999||n==3999999999||
        n==39999999999||n==399999999999||n==3999999999999||n==39999999999999||
        n==399999999999999|
        |n==2||
        n==29||n==299||n==2999||n==29999||
        n==299999||n==2999999||n==29999999||n==299999999||n==2999999999||
        n==29999999999||n==299999999999||n==2999999999999||n==29999999999999||
        n==299999999999999||
        n==1||
        n==19||n==199||n==1999||n==19999||
        n==199999||n==1999999||n==19999999||n==199999999||n==1999999999||
        n==19999999999||n==199999999999||n==1999999999999||n==19999999999999||
        n==199999999999999){
            dig++;
            dig*=9;
        }else{
    dig*=9;
    dig+=(head-1);
        }
        
        printf("%d",dig);
    

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:42:9: error: expected expression before '|' token
   42 |         |n==2||
      |         ^
Language: C


#include <stdio.h>
#include <math.h>
int main()
{   long long n;
    scanf("%lld",&n);
    int dig=log10(n);
    int head=n/(pow(10,dig));
    if(n==9||n==99||n==999||n==9999||n==99999||
        n==999999||n==9999999||n==99999999||n==999999999||n==9999999999||
        n==99999999999||n==999999999999||n==9999999999999||n==99999999999999||
        n==999999999999999||
        n==8||
        n==89||n==899||n==8999||n==89999||
        n==899999||n==8999999||n==89999999||n==899999999||n==8999999999||
        n==89999999999||n==899999999999||n==8999999999999||n==89999999999999||
        n==899999999999999||
        n==7||
        n==79||n==799||n==7999||n==79999||
        n==799999||n==7999999||n==79999999||n==799999999||n==7999999999||
        n==79999999999||n==799999999999||n==7999999999999||n==79999999999999||
        n==799999999999999||
        n==6||n==69||n==699||n==6999||n==69999||
        n==699999||n==6999999||n==69999999||n==699999999||n==6999999999||
        n==69999999999||n==699999999999||n==6999999999999||n==69999999999999||
        n==699999999999999||
        n==5||
        n==59||n==599||n==5999||n==59999||
        n==599999||n==5999999||n==59999999||n==599999999||n==5999999999||
        n==59999999999||n==599999999999||n==5999999999999||n==59999999999999||
        n==599999999999999||
        n==4||
        n==49||n==499||n==4999||n==49999||
        n==499999||n==4999999||n==499999999||n==499999999||n==4999999999||
        n==49999999999||n==499999999999||n==4999999999999||n==49999999999999||
        n==499999999999999||
        n==3||
        n==39||n==399||n==3999||n==39999||
        n==399999||n==3999999||n==39999999||n==399999999||n==3999999999||
        n==39999999999||n==399999999999||n==3999999999999||n==39999999999999||
        n==399999999999999|
        |n==2||
        n==29||n==299||n==2999||n==29999||
        n==299999||n==2999999||n==29999999||n==299999999||n==2999999999||
        n==29999999999||n==299999999999||n==2999999999999||n==29999999999999||
        n==299999999999999||
        n==1||
        n==19||n==199||n==1999||n==19999||
        n==199999||n==1999999||n==19999999||n==199999999||n==1999999999||
        n==19999999999||n==199999999999||n==1999999999999||n==19999999999999||
        n==199999999999999||){
            dig++;
            dig*=9;
        }else{
    dig*=9;
    dig+=(head-1);
        }
        
        printf("%d",dig);
    

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:42:9: error: expected expression before '|' token
   42 |         |n==2||
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int c(long long n)
{
    int s=0;while(n>0)
    {
    s+=n%10;n/=10;
    }
    return s;
}
main()
{
long long n,temp,cnt=1;
scanf("%d",&n);
int ans=c(n);
temp=n;
while(temp>=10)
{
temp/=10,cnt*=10;
}
ans=max(ans,cs(n/cnt*cnt-1));
printf("%d\n",ans);
return 0;
}

Compiler output:
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:21:13: error: 'cs' was not declared in this scope; did you mean 'cos'?
   21 | ans=max(ans,cs(n/cnt*cnt-1));
      |             ^~
      |             cos
Language: C++

/* Author rumoisen */
/* date 2018/10/07 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int main()
{
    ll n;
    int ans;
    cin>>n;
    bool kyuu=true;
    vector<int> n_;
    while(n>0){
        n_.pb(n%10);
        if(n>=10&&n_.back()!=9) kyuu=false;
        n/=10;
    }
    if(kyuu){
        ans=n_.back()+(n_.size-1)*9;
    }
    else{
        ans=n_.back()-1+(n_.size-1)*9;
    }
    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:27: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   45 |         ans=n_.back()+(n_.size-1)*9;
      |                        ~~~^~~~
      |                               ()
a.cc:48:29: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   48 |         ans=n_.back()-1+(n_.size-1)*9;
      |                          ~~~^~~~
      |                                 ()
Language: C++

/* Author rumoisen */
/* date 2018/10/07 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int main()
{
    ll n;
    int ans;
    cin>>n;
    bool kyuu=true;
    vector<int> n_;
    while(n>0){
        n_.pb(n%10);
        if(n_.back()!=9) kyuu=false;
        n/=10;
    }
    if(kyuu){
        ans=n_.back()+(n_.size-1)*9;
    }
    else{
        ans=n_.back()-1+(n_.size-1)*9;
    }
    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:27: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   45 |         ans=n_.back()+(n_.size-1)*9;
      |                        ~~~^~~~
      |                               ()
a.cc:48:29: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   48 |         ans=n_.back()-1+(n_.size-1)*9;
      |                          ~~~^~~~
      |                                 ()
Language: C++

#include <bits/stdc++.h>
using namespace std;
char s[100];
int a,b,c;
int main()
{
	gets(s);
	a=strlen(s);
	b=s[0]-'1';
	printf("%d\n",(a-1)*9+b);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include <bits/stdc++.h>
using namespace std;
char s[100];
int a,b,c;
int main()
{
gets(s);
a=strlen(s);
b=s[0]-'1';
printf("%d\n",(a-1)*9+b);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 | gets(s);
      | ^~~~
      | getw
Language: C++

#include<iostream>
main(){std::string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){std::string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:72: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    2 | main(){std::string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      |                                                                        ^~~~
      |                                                                        std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
main(){string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:8: error: 'string' was not declared in this scope
    2 | main(){string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      |        ^~~~~~
a.cc:2:8: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:2:27: error: 's' was not declared in this scope
    2 | main(){string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      |                           ^
a.cc:2:67: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    2 | main(){string s;std::cin>>s;std::cout<<(s.size()-1)*9+(s[0]-'0')<<endl;}
      |                                                                   ^~~~
      |                                                                   std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#import<iostream>
main(){string s;std::cin>>s;std::puts((s.size()-1)*9+(s[0]-'0'))}

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<iostream>
      |  ^~~~~~
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){string s;std::cin>>s;std::puts((s.size()-1)*9+(s[0]-'0'))}
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:8: error: 'string' was not declared in this scope
    2 | main(){string s;std::cin>>s;std::puts((s.size()-1)*9+(s[0]-'0'))}
      |        ^~~~~~
a.cc:2:8: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:2:27: error: 's' was not declared in this scope
    2 | main(){string s;std::cin>>s;std::puts((s.size()-1)*9+(s[0]-'0'))}
      |                           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  bool flag=false;
  for(int i=0;i<S.size()-1;i++){
    if(S[i]==9)continue;
    flag=ture;
  }
  if(flag){
    ans=S[S.size()-1]+S.size()*9-10;
    cout << ans << endl;
    return 0;
  }
  ans=S[S.size()]+9*S.size()-9;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'ture' was not declared in this scope
   25 |     flag=ture;
      |          ^~~~
a.cc:28:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     ans=S[S.size()-1]+S.size()*9-10;
      |     ^~~
      |     abs
a.cc:32:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   ans=S[S.size()]+9*S.size()-9;
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,sum=0,all=0,dip;
  cin>>n;
    while(n){
      dip=n%10;
      sum+=dip;
      n/=10;
    }
  string c=to_string(n);
  int a=c[0]-'0';
  int all=(a-1)+9(c.length()-1);
  cout<<max(all,sum)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: conflicting declaration 'int all'
   13 |   int all=(a-1)+9(c.length()-1);
      |       ^~~
a.cc:4:25: note: previous declaration as 'long long int all'
    4 |   long long int n,sum=0,all=0,dip;
      |                         ^~~
a.cc:13:18: error: expression cannot be used as a function
   13 |   int all=(a-1)+9(c.length()-1);
      |                 ~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,sum=0,all=0,dip;
  cin>>n;
    while(n){
      dip=n%10;
      sum+=dip;
      n/=10;
    }
  string c=to_string(n);
  int a=c[0]-'0'
  int all=(a-1)+9(c.length()-1);
  cout<<max(all,sum)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: expected ',' or ';' before 'int'
   13 |   int all=(a-1)+9(c.length()-1);
      |   ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
int main() {
 
	std::string n = {};
	int ans = 0, a = 0, i = 0;
	bool flug = false;
 
	std::cin >> n;
 
	ans += (n.size() - 1) * 9;
 
	if (n[i] == '0') { a = 0; }
	else if (n[i] == '1') { a = 1; }
	else if (n[i] == '2') { a = 2; }
	else if (n[i] == '3') { a = 3; }
	else if (n[i] == '4') { a = 4; }
	else if (n[i] == '5') { a = 5; }
	else if (n[i] == '6') { a = 6; }
	else if (n[i] == '7') { a = 7; }
	else if (n[i] == '8') { a = 8; }
	else if (n[i] == '9') { a = 9; }
 
	if (n.size() == 1) {
		std::cout << n[0] << std::endl;
		return 0;
	}
 
	if (n[n.size()-1] == '9' && n[n.size() - 2] && n[n.size()-3] != '0') {
		ans += a;
	}
	else { ans += a - 1; }
 
	std::cout << ans << std::endl;
 

Compiler output:
a.cc: In function 'int main()':
a.cc:37:39: error: expected '}' at end of input
   37 |         std::cout << ans << std::endl;
      |                                       ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^