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

#include <iostream>
#include <iostream>
#include <algorithm>
#include <string>
#include <utility>
#include <unordered_map>
#include <typeinfo>
using namespace std;

//stringを入れると、mapを返す関数
unordered_map<char, int> countChar(string str) {
    unordered_map<char, int> dic;
    int N = str.length();
    for(int i=0; i<N; ++i) {
        auto itr = dic.find(str[i]);
        if(itr != dic.end()) {
            dic.at(str[i]) += 1;
        } 
        else {
            dic.insert(make_pair(str[i], 1));
        }
    }
    return dic;
}

//2つのdictionaryを引数として、共通なkeyの数を返す
int countCommonKeys(unordered_map<char, int> dic1, unordered_map<char, int> dic2) {
    int cnt = 0;

    for(auto iter = dic1.begin(); iter != dic1.end(); ++iter) {
        if(dic2.find(iter->first) != dic2.end() ) {
            cnt++;
        } 
    }
    return cnt;
}

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<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    int n,ans = 0;
    string s;
    cin >> n >> s;
    for(int i = 1;i < n;i++)
    {
        int count = 0;
        for(char tmp = 'a';tmp <= 'z';tmp++)
        {
            bool left = false,right = false;
            for(int j = 0;j < i;j++)
            {
                if(s[j] == tmp){left = true;}
            }

            for(int j = i;j < n;j++)
            {
                if(s[j] == tmp){right = true;}
            }

            if(left && right){count++}
        }
        if(ans < count){ans = count;}
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:38: error: expected ';' before '}' token
   31 |             if(left && right){count++}
      |                                      ^
      |                                      ;
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() {
int n;
  cin>>n;
  string s;
  cin>>s;
  
  int maxe=0;
  for(int c=0;c<=s.size()-2;c++){
    int eq=0;
    for(int i=0;i<=c;i++){
      for(int j=c+1;j<=s.size()-1;j++){
        if(s[j]==s[i]){
          eq++;
          break;
        }
      }
      maxe=max(maxe,eq);
    }
  
  cout<<maxe<<endl;
}

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

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans=0;
  for (int i=0; i<N; i++) {
    int cnt=0;
    for (char c='a'; c<='z'; c++) {
      bool x=false, bool y=false;
      for (int j=0; j<i; j++) {
        if (S[j]==c) {
          x=true;
        }
      }
        for (int j=i; j<N; j++) {
          if (S[j]==c) {
            y=true;
          }
        }
          if (x&&y) {
            cnt++;
          }
        ans=max(ans,cnt);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: expected unqualified-id before 'bool'
   12 |       bool x=false, bool y=false;
      |                     ^~~~
a.cc:20:13: error: 'y' was not declared in this scope
   20 |             y=true;
      |             ^
a.cc:23:18: error: 'y' was not declared in this scope
   23 |           if (x&&y) {
      |                  ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int variation(string s)
{
  char tmp = s[0];
  int r = 1;
  for(int i = 1; i < s.size(); ++i)
  {
    if(tmp != s[i])
    {
      ++r;
      tmp = s[i];
    }
  }
  return r;
}

int main()
{
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i = 1; i < s.size(); ++i)
  {
    string x = s.substr(0, i), y = s.substr(i);
    ans = max(ans, min(variation(x), variation(y));
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:51: error: expected ')' before ';' token
   28 |     ans = max(ans, min(variation(x), variation(y));
      |              ~                                    ^
      |                                                   )
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

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

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int n;
	string s;

	cin >> n;
	cin >> s;

	bool table[26];
	int ans = 0;
	int c;

	int i, len = s.size() - 1;

	repi(i, len, 1) {
		Mem0(table);
		c = 0;

		rep(j, i) table[s[j] - 'a'] = 1;
		repi(j, n, i) if (table[s[j] - 'a']) c++;

	    Max(ans, c);
	}

	Out(ans);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:83:21: error: 'j' was not declared in this scope
   83 |                 rep(j, i) table[s[j] - 'a'] = 1;
      |                     ^
a.cc:10:25: note: in definition of macro 'rep'
   10 | #define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
      |                         ^
a.cc:84:22: error: 'j' was not declared in this scope
   84 |                 repi(j, n, i) if (table[s[j] - 'a']) c++;
      |                      ^
a.cc:14:29: note: in definition of macro 'repi'
   14 | #define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
      |                             ^
Language: C++


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

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int N,co,ma;
	ma = 0;
	string S, Sa;
	for (int i = 0; i < N; i++) {
		co = 0;
		Sa = S.substr(0, i);
		Sb = S.substr(i + 1, N - 1);
		for (int j = 0; j <= i; j++) {
			for (int k = 0; k < N - i; k++) {
				if (Sa[j] == Sb[k])co++;
			}
		}
		ma = max(ma, co);
	}
	cout << ma << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'Sb' was not declared in this scope; did you mean 'Sa'?
   21 |                 Sb = S.substr(i + 1, N - 1);
      |                 ^~
      |                 Sa
Language: C++

#include<stdio.h>
#include<string.h>

int main()
{
    int N, cou = 0;
    char ch[9999], X[9999], Y[9999];

    scanf("%d", &N);

    getchar();

    gets(ch);

    for(int i = 0; i < N / 2; i++)
        X[i] = ch[i];
    for(int i = N / 2 , k = 0; i < N; i++, k++)
        Y[k] = ch[i];
    for(int j = 0; j < N / 2; j++)
    {
        for(int i = 0; i < N / 2; i++)
        {
            if(X[j] == Y[i])
            {
                cou++;
                break;
            }
            else
                continue;
        }
    }
    printf("%d\n", cou);
    return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> // 文字幅の指定 setw(int), 詰めたい文字の指定 setfill(char)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define p(x) cout << (x) << endl
#define FOR(i,r,n) for(ll i=(ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n); i>=r; i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) REP(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pb push_back

// 定義する？→左揃えで0埋め
// cout << setfill('0') << left << setw(4) << 12; // "0012"
// http://marycore.jp/prog/cpp/padding-left-right-zero/

const int inf = (int)1e9;
const ll INF = (ll)1e18;

// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

ll gcd (ll a, ll b) {
	while (b > 0) {
		ll t = a % b;
		a = b, b = t;
	}
	return a;
}

ll lcm (ll a, ll b) {
	return (a / gcd (a, b)) * b;
}

bool is_prime (ll n) {
		if (n < 2) return false;
		else if (n == 2) return true;
		else if (n % 2) return false;
		
		double sqrtn = sqrt(n);
		for (ll i = 3; i < sqrtn; i += 2) {
			if (n % i == 0) return false; 
		}
		return true;
}

ll ctoi(char c) {
	return (ll)(c - 48);
}

ll n, k, cnt=0, ans=0;
string s,t;

// ==================== template ============================

int main(void) {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	cin >> n >> s;
	string s1, s2;
	vi vs;

	REP(i, n) {
		s1 = s.substr(0, i+1);
		s2 = s.substr(i+1);

		cnt = 0;

		REP(j, s1.size()) {
			if (s2.find(s1.at(j)) != string::npos) {
				cnt += 1;
				replace(ALL(s2), s1.at(j), ' ');
			}
		}
		vs.pb(cnt);
		//cout << cnt << endl;
		//cout << s1 << endl;
		//cout << s2 << endl;
	}
	sort(ALL(vs));
	//cout << vs << endl;
	cout << vs.back() << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:93:33: error: 'replace' was not declared in this scope
   93 |                                 replace(ALL(s2), s1.at(j), ' ');
      |                                 ^~~~~~~
a.cc:101:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
  101 |         sort(ALL(vs));
      |         ^~~~
      |         sqrt
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  int ans=0;
  for(int i=1;i<n;i++){
    bool exist[26];
    bool used[26];
    fill(used,used+26,false);
    int sum=0;
    fill(exist,exist+26,false);
    for(int j=0;j<i;j++){
      int a=s[j]-'a';
      exist[a]=true;
    }
    for(int j=i;j<n;j++){
      int a=s[j]-'a';
      if(exist[a]&&!used[a]){
        sum++;
        used[a]=true;
    }
    ans=max(sum,ans);
  }
  cout<<ans<<endl;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  int ans=0;
  for(int i=1;i<n;i++){
    bool exist[26];
    bool used[26];
    fill(used,used+26,fasle);
    int sum=0;
    fill(exist,exist+26,false);
    for(int j=0;j<i;j++){
      int a=s[j]-'a';
      exist[a]=true;
    }
    for(int j=i;j<n;j++){
      int a=s[j]-'a';
      if(exist[a]&&!used[a]){
        sum++;
        used[a]=true;
    }
    ans=max(sum,ans);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'fasle' was not declared in this scope
   10 |     fill(used,used+26,fasle);
      |                       ^~~~~
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int count_same(string S, int sep) {
  string X, Y;
  set<int> sx, sy, result;
  X = S.substr(0, sep);
  Y = S.substr(sep);
  sx = set<int>(X.begin(), X.end());
  sy = set<int>(Y.begin(), Y.end());
  set_intersection(sx.begin(), sx.end(), sy.begin(), sy.end(), inserter(result, result.end()));
  return result.size();
}

int main() {
  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  rep1(i, N - 1) {
    ans = max(ans, count_same(S, i));
  }
  cout << ans << endl;
  return 0;
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int count_same(string S, int sep) {
  string X, Y;
  set<int> sx, sy, result;
  X = S.substr(0, sep);
  Y = S.substr(sep);
  sx = set<int>(X.begin(), X.end());
  sy = set<int>(Y.begin(), Y.end());
  set_intersection(sx.begin(), sx.end(), sy.begin(), sy.end(), inserter(result, result.end()));
  return result.size();
}

int main() {
  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  rep1(i, N - 1) {
    ans = max(ans, count_same(S, i));
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:35: error: a function-definition is not allowed here before '{' token
   51 | int count_same(string S, int sep) {
      |                                   ^
a.cc:62:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   62 | int main() {
      |         ^~
a.cc:62:9: note: remove parentheses to default-initialize a variable
   62 | int main() {
      |         ^~
      |         --
a.cc:62:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:62:12: error: a function-definition is not allowed here before '{' token
   62 | int main() {
      |            ^
a.cc:71:2: error: expected '}' at end of input
   71 | }
      |  ^
a.cc:27:12: note: to match this '{'
   27 | int main() {
      |            ^
Language: C++

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

int main() {
  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  for (int i = 0; i < n; i ++) {
    int cnt = 0;
    for (char x = 'a'; x <= 'z'; x ++) {
      bool left = false, right = false;

      for (int j = 0; j < i; j ++) {
        if (s.at(j) == x) {
          left = true;
        }
      }
      for (int j = i; j < n; j ++) {
        if (x.at(j) == x) {
          right = true;
        }
      }
      if (left && right) {
        cnt ++;
      }
    }
    if (ans < cnt) {
      ans = cnt;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: request for member 'at' in 'x', which is of non-class type 'char'
   21 |         if (x.at(j) == x) {
      |               ^~
Language: C++

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    string subA, subB;
    vector<char> v;
    bool b;
    for(int i = 1; i < n; i++){
        subA = s.substr(0, i);
        subB = s.substr(i, n-i);
        v.clear();
        for(int j = 0; j < subA.size(); j++){
            for(int k = 0; k < subB.size(); k++){
                if(subA[j] == subB[k]){
                    if(v.size() == 0){
                        v.push_back(subA[j]);
                    } else {
                        b = false;
                        for(int l = 0; l < v.size(); l++){
                            if(v[l] == subA[j]) b = true;
                        }
                        if(b == false) v.push_back(subA[j]);
                    }
                }
            }
        }
        ans = max(ans, v.size());
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: no matching function for call to 'max(int&, std::vector<char>::size_type)'
   31 |         ans = max(ans, v.size());
      |               ~~~^~~~~~~~~~~~~~~
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:31:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<char>::size_type' {aka 'long unsigned int'})
   31 |         ans = max(ans, v.size());
      |               ~~~^~~~~~~~~~~~~~~
/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:31:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |         ans = max(ans, v.size());
      |               ~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
	using namespace std;
	int main() {
		int n;
		cin >> n;
		string s;
		cin >> s;
		int ans = 0;
		for (int i = 1; i < n; i++) {
		
			int cnt = 0;
			
			
			for (char c = 'a'; c <= 'z'; c++) {
				bool left = false, right = false;

				for (int j = 0; j < i; j++) {
					if (s[j] == c)  left = true;
				
				}
				for(int j=i;j<n;j++){
					if (s[j] == c) {
						right = true;
					}

					if (left&&right) cnt++;
			}
				if (ans < cnt) ans = cnt;

		}
			cout << ans << endl;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:10: error: expected '}' at end of input
   32 |         }
      |          ^
a.cc:3:20: note: to match this '{'
    3 |         int main() {
      |                    ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

class Main{

	static char[][] map;
	static int H;
	static int W;

	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		String string = sc.next();		
		int ans = 0;

		for(int i = 0;i = N;i++){
			int sub = 0;
			char[] mae = string.substring(0,i).toCharArray();
			char[] ushiro = string.substring(i).toCharArray();

			Arrays.sort(mae);
			//Arrays.sort(ushiro);

			int j = 0;
			while(true){
				if(j >= mae.length){
					break;
				}



				while(true){
					if(j == mae.length-1){
						break;
					}
					if(mae[j] != mae[j+1]){			//aab みたいな時二つ目に移動
						break;
					}
					j++;
				}
				
				for(int k = 0;k < ushiro.length;k++){			//後ろにあるか判定
					if(mae[j] == ushiro[k]){
						sub++;
						break;
					}

				}
				j++;

			}
			ans = Math.max(ans, sub);

		}

		System.out.println(ans);

	}
}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Compiler output:
Main.java:19: error: incompatible types: int cannot be converted to boolean
		for(int i = 0;i = N;i++){
		                ^
1 error
Language: C++

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans=0;
    for(int i=0;i<n;i++){
        int cnt=0;

        for(char c='a';c<='z';c++){
            bool left=false,righe=false;

            for(int j=0;j<i;j++)
                if(s[j]==c)
                    left=true;

            for(int j=i;j<n;j++)
                if(s[j]==c)
                    right=true;
            
            if(left&&right)
                cnt++;
        }
        if(ans<cnt)
            ans=cnt;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   21 |                     right=true;
      |                     ~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
  int n;
  int ans=0;
  string s;
  cin >> n >> s;
  for(int i=1;i<s.size();i++){
  	map<char,int> P;
 		int p=0;
 		for(int j=0;j<i;j++){
 		char a=s[j];
 		P[a]=1;
 		}
  	for(int k=i;k<s.size();k++){
 		char b=s[k];
 		if(P[b]==1){
		 p++;
 		P[b]=0;
 			}
 		}
 		ans=max(ans,p);
 	}
 	cout<<ans<<endl;
    }
}

Compiler output:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int func(string s,string t){
  int ans=0;
  for (char c = 'a'; c <= 'z'; c++) {
    bool founds=false,foundt=false;
    for (int i = 0; i < s.length(); i++) {
      if(s[i]==c){
        founds=true;
      }
    }
    for (int i = 0; i < t.length(); i++) {
      if(t[i]==c){
        foundt=true;
      }
    }
    if(founds&&foundt) ans++;
  }
  return ans;
}

int main(){
  int N;
  string S;
  cin >> N >> S;
  itn ans=0;
  for (int i = 0; i <= N; i++) {
    int temp=func(S.substr(0,i),S.substr(i));
    ans=max(ans,temp);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'itn' was not declared in this scope; did you mean 'int'?
   27 |   itn ans=0;
      |   ^~~
      |   int
a.cc:30:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |     ans=max(ans,temp);
      |     ^~~
      |     abs
a.cc:32:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
//#define YES(ans) ans?cout<<"YES":cout<<"NO"

/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

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

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int ans = 0;
    int n;
    string s;
    cin >> n >> s;
    int first[30], last[30];
    REP(i, n)
    {
        first[i] = -1;
        last[i] = -1;
    }
    REP(i, n)
    {
        if (first[s[i] - 'a'] != -1)
            first[s[i] - 'a'] = i;
    }
    RREP(i, n)
    {
        if (last[s[i] - 'a'] != -1)
            last[s[i] - 'a'] = i;
    }
    REP(i, n)
    {
        num = 0;
        REP(j, 26)
        {
            if (first[j]<i&&<ilast[j])
                num++;
            ans = max(ans, num);
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   71 |         num = 0;
      |         ^~~
      |         enum
a.cc:74:29: error: expected primary-expression before '<' token
   74 |             if (first[j]<i&&<ilast[j])
      |                             ^
a.cc:74:30: error: 'ilast' was not declared in this scope; did you mean 'last'?
   74 |             if (first[j]<i&&<ilast[j])
      |                              ^~~~~
      |                              last
a.cc:79:2: error: expected '}' at end of input
   79 | }
      |  ^
a.cc:45:1: note: to match this '{'
   45 | {
      | ^
Language: C++

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

int main(){
    int n,max = 0;
    string s;
    cin >> n;
    cin >> s;
    for(int i = 1; i < n-1; i++){
        string a = s.substr(0,i);
        string b = s.substr(i+1);
        int count = 0;
        for(int j = 0; j <= 'z'; j++){
            if(find.(j) == find.j(j))
                count++;
        }
        if(count > max)
            max = count;
    }
    cout << max;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: expected unqualified-id before '(' token
   16 |             if(find.(j) == find.j(j))
      |                     ^
a.cc:16:33: error: overloaded function with no contextual type information
   16 |             if(find.(j) == find.j(j))
      |                                 ^
Language: C++

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int max = 0;
  for (int i=0; i<N) { //i番目までXに入っている
	int cnt = 0;
	for (char z='a'; z<='z'; z++) {
	  bool x=false;
	  bool y=false;
		for (int j=0; j<i) { 
			if(S.at(j) == z) x = true;
		}
		for (int j=i; j<N) {
			if(S.at(j) == z) y = true;
		}	  
	  if (x && y) cnt++;
	}
	if (cnt > max) max = cnt;
  }
  cout << max;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: expected ';' before ')' token
   10 |   for (int i=0; i<N) { //i番目までXに入っている
      |                    ^
      |                    ;
a.cc:15:34: error: expected ';' before ')' token
   15 |                 for (int j=0; j<i) {
      |                                  ^
      |                                  ;
a.cc:18:34: error: expected ';' before ')' token
   18 |                 for (int j=i; j<N) {
      |                                  ^
      |                                  ;
Language: C++

#include <iostream>
#include <bits/stdc++.h>

#define Max(a,b) max({a,b})
#define Min(a,b) min({a,b})
#define rep(i,m,n) for(int (i)=(m);(i)<(int)(n);(i)++)
#define len(n) n.size()
#define print(n); cout << n << endl;

// s.substr(i,n)

using namespace std;

//char a = 65;

int n,m,a,b,c,cou,co;
double d,k;
const ll LINF = 1e18;
char num = 65;
string s,t;

int main(){
    
    cin >> n >> s;
    int ans = 0;
    cou = 0;
    map<char,ll> mp;
    for(int i = 0;i < n-1;i++){
        mp[s[i]]++;
        map<char,ll> mpp;
        
        for(int j = i+1;j < n;j++){
            mpp[s[j]]++;
        }
        for(char c='a';c<='z';c++){
            if(mp[c] >= 1 && mpp[c] >= 1){
                cou++;
            }
        }
        ans = max(ans,cou);
        cou = 0;
    }
    print(ans)

    return 0;
}

Compiler output:
a.cc:18:7: error: 'll' does not name a type
   18 | const ll LINF = 1e18;
      |       ^~
a.cc: In function 'int main()':
a.cc:27:14: error: 'll' was not declared in this scope
   27 |     map<char,ll> mp;
      |              ^~
a.cc:27:16: error: template argument 2 is invalid
   27 |     map<char,ll> mp;
      |                ^
a.cc:27:16: error: template argument 4 is invalid
a.cc:29:11: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}]' for array subscript
   29 |         mp[s[i]]++;
      |           ^
a.cc:30:20: error: template argument 4 is invalid
   30 |         map<char,ll> mpp;
      |                    ^
a.cc:33:16: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}]' for array subscript
   33 |             mpp[s[j]]++;
      |                ^
a.cc:36:18: error: invalid types 'int[char]' for array subscript
   36 |             if(mp[c] >= 1 && mpp[c] >= 1){
      |                  ^
a.cc:36:33: error: invalid types 'int[char]' for array subscript
   36 |             if(mp[c] >= 1 && mpp[c] >= 1){
      |                                 ^
Language: C++

#include <iostream>
#include <bits/stdc++.h>

#define Max(a,b) max({a,b})
#define Min(a,b) min({a,b})
#define rep(i,m,n) for(int (i)=(m);(i)<(int)(n);(i)++)
#define len(n) n.size()
#define print(n); cout << n << endl;

// s.substr(i,n)

using namespace std;

//char a = 65;

int n,m,a,b,c,cou,co;
double d,k;
char num = 65;
string s,t;

int main(){
    
    cin >> n >> s;
    int ans = 0;
    cou = 0;
    map<char,ll> mp;
    for(int i = 0;i < n-1;i++){
        mp[s[i]]++;
        map<char,ll> mpp;
        
        for(int j = i+1;j < n;j++){
            mpp[s[j]]++;
        }
        for(char c='a';c<='z';c++){
            if(mp[c] >= 1 && mpp[c] >= 1){
                cou++;
            }
        }
        ans = max(ans,cou);
        cou = 0;
    }
    print(ans)

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: 'll' was not declared in this scope
   26 |     map<char,ll> mp;
      |              ^~
a.cc:26:16: error: template argument 2 is invalid
   26 |     map<char,ll> mp;
      |                ^
a.cc:26:16: error: template argument 4 is invalid
a.cc:28:11: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}]' for array subscript
   28 |         mp[s[i]]++;
      |           ^
a.cc:29:20: error: template argument 4 is invalid
   29 |         map<char,ll> mpp;
      |                    ^
a.cc:32:16: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}]' for array subscript
   32 |             mpp[s[j]]++;
      |                ^
a.cc:35:18: error: invalid types 'int[char]' for array subscript
   35 |             if(mp[c] >= 1 && mpp[c] >= 1){
      |                  ^
a.cc:35:33: error: invalid types 'int[char]' for array subscript
   35 |             if(mp[c] >= 1 && mpp[c] >= 1){
      |                                 ^
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include "../cxx-prettyprint/prettyprint.hpp"

int main() {
    int N;
    std::string S;
    std::cin >> N;
    std::cin >> S;

    int max_kind = 0;
    for (int i = 1; i < N; i ++) {
        std::vector<char> X, Y;
        std::copy(S.begin(), S.begin() + i, std::back_inserter(X));
        std::copy(S.begin() + i, S.end(), std::back_inserter(Y));
        std::sort(X.begin(), X.end());
        std::sort(Y.begin(), Y.end());

        std::vector<char> XandY;
        std::set_intersection(X.begin(), X.end(), Y.begin(), Y.end(), std::back_inserter(XandY));

        std::set<char> unique_chars(XandY.begin(), XandY.end());
        max_kind = std::max(max_kind, (int)unique_chars.size());
    }
    std::cout << max_kind << std::endl;
}


Compiler output:
a.cc:5:10: fatal error: ../cxx-prettyprint/prettyprint.hpp: No such file or directory
    5 | #include "../cxx-prettyprint/prettyprint.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int N;
  	string S;
  	cin >> N >> S;
  	int ans = 0;
  	for(int i = 1; i < N; i++){
      	int cnt = 0;
      	for(char c = 'a'; c <= 'z'; c++){
          	bool l = false, r = false;
          	for(int j = 0; j < i; j++){
              	if(S.at(j) == c){
                  	l = true;
                }
            }
            for(int j = i; j < n; j++){  
              	if(S.at(j) == c){
                  	r = true;
                }
            }
            if(l && r){
                  	cnt ++;
            }
        }
		if(ans < cnt){
          	ans = cnt;
        }
    }
      cout << cnt;
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: 'n' was not declared in this scope
   20 |             for(int j = i; j < n; j++){
      |                                ^
a.cc:33:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   33 |       cout << cnt;
      |               ^~~
      |               int
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
  int n, ans=0, k;
  string s;
  cin >> n >> s;
  for(int i=1; i<n; i++){
    k=0;
    for(char t='a'; t<='z'; t++;)
      if(s.substr(0,i).find(t)!=string::npos && s.substr(i).find(t)!=string::npos)
        k++;
    if(ans<k) ans = k;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: expected ')' before ';' token
   11 |     for(char t='a'; t<='z'; t++;)
      |        ~                       ^
      |                                )
a.cc:11:33: error: expected primary-expression before ')' token
   11 |     for(char t='a'; t<='z'; t++;)
      |                                 ^
Language: C++

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <map>
using namespace std;

#pragma warning(disable:4996)

typedef long long ll;
typedef pair<ll, ll> pll;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1000000007;

char in[105];

int cnt[26];

int main() {
	int N = strlen(in), i, j, ans = 0;
	scanf("%d %s", &N, in);

	for (i = 0; i <= N; i++) {
		for (j = 0; j < 26; j++) cnt[j] = 0;
		for (j = 0; j < i; j++) cnt[in[j] - 'a'] |= 1;
		for (j = i; j < N; j++) cnt[in[j] - 'a'] |= 2;

		int c = 0;
		for (j = 0; j < 26; j++) if (cnt[j] == 3) c++;
		ans = max(ans, c);
	}
	return !printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'strlen' was not declared in this scope
   21 |         int N = strlen(in), i, j, ans = 0;
      |                 ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <map>
  +++ |+#include <cstring>
    7 | using namespace std;
a.cc:24:14: error: 'i' was not declared in this scope
   24 |         for (i = 0; i <= N; i++) {
      |              ^
a.cc:25:22: error: 'j' was not declared in this scope
   25 |                 for (j = 0; j < 26; j++) cnt[j] = 0;
      |                      ^
a.cc:26:22: error: 'j' was not declared in this scope
   26 |                 for (j = 0; j < i; j++) cnt[in[j] - 'a'] |= 1;
      |                      ^
a.cc:27:22: error: 'j' was not declared in this scope
   27 |                 for (j = i; j < N; j++) cnt[in[j] - 'a'] |= 2;
      |                      ^
a.cc:30:22: error: 'j' was not declared in this scope
   30 |                 for (j = 0; j < 26; j++) if (cnt[j] == 3) c++;
      |                      ^
a.cc:31:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |                 ans = max(ans, c);
      |                 ^~~
      |                 abs
a.cc:33:32: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |         return !printf("%d\n", ans);
      |                                ^~~
      |                                abs
Language: C++

//解答から引用
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	int ans=0;
	for(int i=1;i<n;i++){
		int cnt=0;
		
		for(char c='a';c<='z';c++){
			bool left=false,right=false;
			
			for(int j=0;j<i;j++)
				if(s[j]==c)
					left=true;
			
			for(int j=i;j<n;j++)
				if(s[j]==c)
					right=true;
			
			if(left&&right)
				cnt++;
		}
		
		if(ans<cnt)
			ans=cnt;
	}
	
	cout<<cnt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |         cout<<cnt<<endl;
      |               ^~~
      |               int
Language: C++

#include <iostream>
using namespace std;

int func ( string s, string t ) {
  int ans = 0;
  for ( char c = 'a'; c <= 'z'; c++ ) {
    bool founds = false,foundt = false;
    for ( int i = 0; i < s.length(); i++ ) {
      if ( s[i] == c ) founds = true;
    }
    for ( int i = 0; i < t.length(); i++ ) {
      if ( t[i] == c ) foundt = true;
    }
    if ( founds == true && foundt == true ) ans++;
  }
  return ans;
}

int main() {
  int N;
  string S;
  int ans = 0;
  for ( int i = 0; i <= N: i++ ) {
    int tmp = func(S.substr(0,i),S.substr(i));
    ans = max(tmp,ans);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   23 |   for ( int i = 0; i <= N: i++ ) {
      |                    ^
a.cc:23:26: error: found ':' in nested-name-specifier, expected '::'
   23 |   for ( int i = 0; i <= N: i++ ) {
      |                          ^
      |                          ::
a.cc:23:25: error: 'N' is not a class, namespace, or enumeration
   23 |   for ( int i = 0; i <= N: i++ ) {
      |                         ^
a.cc:28:3: error: expected primary-expression before 'return'
   28 |   return 0;
      |   ^~~~~~
a.cc:27:23: error: expected ')' before 'return'
   27 |   cout << ans << endl;
      |                       ^
      |                       )
   28 |   return 0;
      |   ~~~~~~               
a.cc:23:7: note: to match this '('
   23 |   for ( int i = 0; i <= N: i++ ) {
      |       ^
Language: Java

public static void main(String[] args) throws IOException {
		BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
		BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in));
		String num = new String(br1.readLine());
		String text = new String(br2.readLine());
		System.out.println(cutAndCount(num, text));
	}

	public static int cutAndCount(String s1, String s2) {
		int num = Integer.parseInt(s1);
		int count = 0;
		for (int i = 1; i < num; i++) {
			char[] charLeft = s2.substring(0, i).toCharArray();
			char[] charRight = s2.substring(i).toCharArray();
			HashSet<Character> setLeft = new HashSet<>();
			HashSet<Character> setRight = new HashSet<>();
			for (char c : charLeft) {
				setLeft.add(c);
			}
			for (char c : charRight) {
				setRight.add(c);
			}
			setLeft.retainAll(setRight);
			if(setLeft.size() > count) count = setLeft.size();
		}
		return count;
	}

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) throws IOException {
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C

#include<stdio.h>
int main(void){
    int a;
    scanf("%d",&a);
    char b[100];
    for(int i=0;i<a;i++){
        scanf(" %c",&b[i]);
    }
    int c=a/2;
    char d[c],v[c];
    for(int i=0;i<c+1;i++){
        d[i]=b[i];
        v[i]=b[i+c];
    }
    for(int i=0;i<c;i++){
        for(int j=0)
    }
    for(int i=0;i<c+1;i++){
                printf(" %c %c",d[i],v[i],i);
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:20: error: expected ',' or ';' before ')' token
   16 |         for(int j=0)
      |                    ^
main.c:18:5: error: expected expression before 'for'
   18 |     for(int i=0;i<c+1;i++){
      |     ^~~
main.c:22:1: error: expected expression before '}' token
   22 | }
      | ^
main.c:22:1: error: expected expression before '}' token
main.c:22:1: error: expected declaration or statement at end of input
Language: C++

#include<stdio.h>
int main(){
int N,s=0,x,max=0;
char S[101];
scanf("%d %s",&N,S);
for(x=1;x<N;x++){
for(i=0;i<x;i++){
for(j=x;j<N;j++){
if(S[i]==S[j]){
s++;
break;}
}
}
if(s>max){max=s;}
s=0;
}
printf("%d",max);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'i' was not declared in this scope
    7 | for(i=0;i<x;i++){
      |     ^
a.cc:8:5: error: 'j' was not declared in this scope
    8 | for(j=x;j<N;j++){
      |     ^
Language: Java

import java.util.Scanner;
import java.util.Arrays;

public class Main{
  public static void main (String[] args){
    Scanner input = new Scanner(System.in);

    while(input.hasNext()){
      int N = input.nextInt();
      String S = input.next();

      int[] countCharX = new int[26];
      int[] countCharY = new int[26];
      int maxDiff = 0;
      for(int i = 1; i < S.length() - 1; ++i){
        Arrays.fill(countCharX, 0);
        Arrays.fill(countCharY, 0);

        for(int j = 0; j < i; ++j){
          ++countCharX[S.charAt(j) - 'a')];
        }

        for(int j = i; j < S.length(); ++j){
          ++countCharY[S.charAt(j) - 'a')];
        }
        
        int bothContain = 0;
        for(int j = 0; j < countCharX.length; ++j){
          if(countCharX[j] != 0 && countCharY[j] != 0){
            ++bothContain;
          }
        }

        maxDiff = Math.max(maxDiff, bothContain);
     }
     System.out.println(maxDiff);
    } 
  }
}
    

Compiler output:
Main.java:20: error: ']' expected
          ++countCharX[S.charAt(j) - 'a')];
                                        ^
Main.java:24: error: ']' expected
          ++countCharY[S.charAt(j) - 'a')];
                                        ^
2 errors
Language: Java

import java.util.Scanner;
import java.util.Arrays;

public class Main{
  public static void main (String[] args){
    Scanner input = new Scanner(System.in);

    while(input.hasNext()){
      int N = input.nextInt();
      String S = input.next();

      int[] countCharX = new int[26];
      int[] countCharY = new int[26];
      int maxDiff = 0;
      for(int i = 1; i < S.length() - 1; ++i){
        Arrays.fill(countCharX, 0);
        Arrays.fill(countCharY, 0);

        for(int j = 0; j < i; ++j){
          ++countCharX[S.charAt(j) - 'a');
        }

        for(int j = i; j < S.length(); ++j){
          ++countCharY[S.charAt(j) - 'a');
        }
        
        int bothContain = 0;
        for(int j = 0; j < countCharX.length; ++j){
          if(countCharX != 0 && countCharY != 0){
            ++bothContain;
          }
        }

        maxDiff = Math.max(maxDiff, bothContain):
     }
     System.out.println(maxDiff);
    } 
  }
}
    

Compiler output:
Main.java:20: error: ']' expected
          ++countCharX[S.charAt(j) - 'a');
                                        ^
Main.java:24: error: ']' expected
          ++countCharY[S.charAt(j) - 'a');
                                        ^
Main.java:34: error: ';' expected
        maxDiff = Math.max(maxDiff, bothContain):
                                                ^
3 errors
Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
#include<tuple>
#include<string>
#include<bits/stdc++.h>
using namespace std;

string str;
void solve(){
   int N
   bool l,r;
   l=false,r=false;
   int ans=0;

    cin>>N>>str;

    for(int i=1;i<N;i++){
        int cnt=0;
        for(char c='a';c<='z';c++){
            l=false,r=false;
            for(int g=0;g<i;g++){
               if( str[g]==c)l=true;
            }
            for(int j=i;j<=N;j++){
                if(str[j]==c)r=true;
            }
            if((l==true)&&(r==true))cnt++;
        }
        ans=max(ans,cnt);
    }

    
    cout<<ans<<endl;
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:12:4: error: expected initializer before 'bool'
   12 |    bool l,r;
      |    ^~~~
a.cc:13:4: error: 'l' was not declared in this scope
   13 |    l=false,r=false;
      |    ^
a.cc:13:12: error: 'r' was not declared in this scope
   13 |    l=false,r=false;
      |            ^
a.cc:16:10: error: 'N' was not declared in this scope
   16 |     cin>>N>>str;
      |          ^
Language: C++

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

int main() {
    int n;
    string s;
    cin>>n>>s;
    
    //string sa, sb;
    int div;
    int i;
    vector<int> counter(n);
    
    for(i=0; i<n; i++){
        counter[i]=0;
    }
    
    string all ="abcdefghijklmnopqrstuvwxyz";
    
    for(div=0; div<n; div++){
        string sa = s.substr(0,div);
        string sb = s.substr(div, n-div);
        for(i=0; i<26; i++){
            if(sa.find(all[i])!=string::npos and sb.find(all[i])!=string::npos){
                counter[div]++;
            }
        }
    }
    cout<<*max_element(counter.begin(), counter.end())<<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: 'max_element' was not declared in this scope
   31 |     cout<<*max_element(counter.begin(), counter.end())<<endl;
      |            ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;

int main(){

string a,b,s;
int n,cou;
int max = 0;

  cin >> n;
  cin >> s;

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

    a = s.substr(0,i);
    b = s.substr(i,n-i);


    set<char> sa(a.begin(), a.end());
    set<char> sb(b.begin(), b.end());
    vector<char> va(sa.begin(), sa.end());


    for(int j=0;j<va.size();j++){
      if(count(sb.begin(),sb.end(),va[j])>0){
        cou+=1;

      }
    }
    if(max<cou){
      max = cou;
    }
    cou = 0;

  }

cout << max << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:10: error: 'count' was not declared in this scope; did you mean 'cou'?
   28 |       if(count(sb.begin(),sb.end(),va[j])>0){
      |          ^~~~~
      |          cou
Language: C

#include <stdio.h>

int main() {
  int NUM;
  int MAX_left=0;
  int MAX_right=0;
  char c[101];
  
  int cnt_same=0;
  
  int reg_same_left[100][26];
  int reg_same_right[100][26];
  
  scanf("%d", &NUM);
  scanf("%s", c);
  
  for (int i=1; i<(NUM-1); i++) {
    // Init
    for (int j=0; j<26; j++) {
      reg_same_left[i][j] = 0;
      reg_same_right[i][j] = 0;  
    }
    
    // Check Char Left Side
    for (int j=0; j<i; j++) {
      reg_same_left[i][c[j] - 0x61] |= 1; 
    }
    // Check Char Right Side
    for (int j=i+1; j<NUM; j++) {
      reg_same_right[i][c[j] - 0x61] |= 1; 
    }
    // Count
    for (int j=0; j<26; j++)
      cnt_same += (int)(reg_same_left[i][j] & reg_same_right[i][j]);
    
    if (cnt_same > MAX)
      MAX = cnt_same;
  }
  printf("%d", MAX);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:36:20: error: 'MAX' undeclared (first use in this function)
   36 |     if (cnt_same > MAX)
      |                    ^~~
main.c:36:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main() {
  int NUM;
  int MAX=0;
  char c[101];
  scanf("%d", &NUM);
  scanf("%s", c);
  
  for (int i=0; i<(NUM-1); i++) {
    int tmp_cnt = 0;
    for (int j=i+1; j<NUM; j++) {
      if (c[i] == c[j])
        tmp_cnt++;
    }
    if (tmp_cnt > MAX)
      MAX = tmp_cnt;
  }
  print("%d", MAX);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:3: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   19 |   print("%d", MAX);
      |   ^~~~~
      |   printf