criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int max = 0;
        //区切るところを変えて探す
        for (int i=1;i<N;i++){
            String str1 = S.substring(0,i);
            String syr2 = S.substring(i);
            int count = 0
            //アルファベットあるかな
            boolean[] ar1 = new boolean[26];
            boolean[] ar2 = new boolean[26];
            for (int j=0;j<str1.length();j++){//前半
                ar1[str1.charAt(j)-'a']=true;
            }
            for (int j=0;j<str2.length();j++){//後半
                ar2[str2.charAt(j)-'a']=true;
            }
            for (int j=0;j<26;j++){//両方にあるか
                if (ar1[j]&&ar2[j]){
                  count++;
                }
            }
            max = Math.max(max,count);
        }
        System.out.println(max);
    }
}

Compiler output:
Main.java:12: error: ';' expected
            int count = 0
                         ^
1 error
Language: Java

import java.util.Scanner; 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int max = 0;
        //アルファベットあるかな
        boolean[] ar1 = new boolean[26];
        boolean[] ar2 = new boolean[26];
        //区切るところを変えて探す
        for (int i=1;i<N;i++){
            String str1 = S.substring(0,i);
            String str2 = S.substring(i);
            int count = 0;
            for (int j=0;j<str1.length();j++){//前半
                ar1[str1.charAt(j)-'a']=true;
            }
            for (int j=0;j<str2.length();j++){//後半
                ar2[str2.charAt(j)-'a']=true;
            }
            for (int j=0;j<26;j++){//両方にあるか
                if(ar1[j] && ar2[j]){
                  count++;
                }
            }
            max = Math.max(max,count);
        }
        System.out.println(max);
    }


Compiler output:
Main.java:30: error: reached end of file while parsing
    }
     ^
1 error
Language: Java

import java.util.Scanner; 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int max = 0;
        int ans = 0;
        //アルファベットあるかな
        boolean[] b1 = new boolean[26];
        boolean[] b2 = new boolean[26];
        //区切るところを変えて探す
        for (int i=1;i<N;i++){
            String str1 = s.substring(0,i);
            String str2 = s.substring(i);
            for (int j=0;j<str1.length();j++){//前半
                b1[s1.charAt(j)-97]=true;
            }
            for (int j=0;j<str2.length();j++){//後半
                b2[s2.charAt(j)-97]=true;
            }
            for (int j=0;j<26;j++){//両方にあるか
                if(b1[j] && b2[j]){
                  ans++;
                }
            }
            max = Math.max(max,ans);
        }
        System.out.println(max);
    }
}

Compiler output:
Main.java:14: error: cannot find symbol
            String str1 = s.substring(0,i);
                          ^
  symbol:   variable s
  location: class Main
Main.java:15: error: cannot find symbol
            String str2 = s.substring(i);
                          ^
  symbol:   variable s
  location: class Main
Main.java:17: error: cannot find symbol
                b1[s1.charAt(j)-97]=true;
                   ^
  symbol:   variable s1
  location: class Main
Main.java:20: error: cannot find symbol
                b2[s2.charAt(j)-97]=true;
                   ^
  symbol:   variable s2
  location: class Main
4 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
      // 取得
	  int N = sc.nextInt();
      String S = sc.next();
      int max = 0;
      for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
          for(int k=0;k<=i;k++){
          	if(s.charAt(k)==s.charAt(j)){
            	count++;
              	max = Math.max(max,count);
          	}
          }
        }
      }
      System.out.println(max);
    }
}

Compiler output:
Main.java:12: error: cannot find symbol
          	if(s.charAt(k)==s.charAt(j)){
          	   ^
  symbol:   variable s
  location: class Main
Main.java:12: error: cannot find symbol
          	if(s.charAt(k)==s.charAt(j)){
          	                ^
  symbol:   variable s
  location: class Main
Main.java:13: error: cannot find symbol
            	count++;
            	^
  symbol:   variable count
  location: class Main
Main.java:14: error: cannot find symbol
              	max = Math.max(max,count);
              	                   ^
  symbol:   variable count
  location: class Main
4 errors
Language: Java

import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int ans = 0;
        for (int i=1;i<s.length();i++){
            String s1 = s.substring(0,i);
            String s2 = s.substring(i);
            

Compiler output:
Main.java:11: error: reached end of file while parsing
            String s2 = s.substring(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 sum=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){
              sum++;
            }
        }
        if(ans<sum) ans=count;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:25: error: cannot resolve overloaded function 'count' based on conversion to type 'int'
   23 |         if(ans<sum) ans=count;
      |                         ^~~~~
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N =sc.nextInt();
    String S =sc.next();
    
    int ans = 0;
    for(int i = 1; i < N; i++) {
      Set<String> front = new HashSet<>(Arrays.asList(s.substring(0, i).split("")));
      Set<String> back = new HashSet<>(Arrays.asList(s.substring(i, n).split("")));
      int count = 0;
      for(String value : front) {
        if (back.contains(value)) {
          count++;
        }
      }
      if (count > ans) {
        ans = count;
      }
    }
    System.out.println(ans);
  }
}
 
    
    

Compiler output:
Main.java:10: error: cannot find symbol
      Set<String> front = new HashSet<>(Arrays.asList(s.substring(0, i).split("")));
                                                      ^
  symbol:   variable s
  location: class Main
Main.java:11: error: cannot find symbol
      Set<String> back = new HashSet<>(Arrays.asList(s.substring(i, n).split("")));
                                                                    ^
  symbol:   variable n
  location: class Main
Main.java:11: error: cannot find symbol
      Set<String> back = new HashSet<>(Arrays.asList(s.substring(i, n).split("")));
                                                     ^
  symbol:   variable s
  location: class Main
3 errors
Language: C++

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<pair<int, int>> alphabet(26, (1000, 0);
  for (int i = 0; i < N; i++) {
    if (alphabet[S[i]-'97'].first == 1000) alphabet[S[i]-'97'].first = i;
    else {
      if (i > alphabet[S[i]-'97'].second) alphabet[S[i]-'97'].second = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int tmp = 0;
    for (int j = 0; j < 26; i++) {
      if (alphabet[j].first < i && i < alphabet[j].second) tmp++;
    }
    if (ans > tmp) ans = tmp;
  }
  cout << ans << endl;
}


Compiler output:
a.cc:11:23: warning: multi-character character constant [-Wmultichar]
   11 |     if (alphabet[S[i]-'97'].first == 1000) alphabet[S[i]-'97'].first = i;
      |                       ^~~~
a.cc:11:58: warning: multi-character character constant [-Wmultichar]
   11 |     if (alphabet[S[i]-'97'].first == 1000) alphabet[S[i]-'97'].first = i;
      |                                                          ^~~~
a.cc:13:29: warning: multi-character character constant [-Wmultichar]
   13 |       if (i > alphabet[S[i]-'97'].second) alphabet[S[i]-'97'].second = i;
      |                             ^~~~
a.cc:13:57: warning: multi-character character constant [-Wmultichar]
   13 |       if (i > alphabet[S[i]-'97'].second) alphabet[S[i]-'97'].second = i;
      |                                                         ^~~~
a.cc: In function 'int main()':
a.cc:9:48: error: expected ')' before ';' token
    9 |   vector<pair<int, int>> alphabet(26, (1000, 0);
      |                                  ~             ^
      |                                                )
Language: C++

#include <algorithm>  // sort, unique
#include <deque>
#include <iostream>  // テスト
#include <string>
#include <vector>

/**
 * 3 2 2 1
 * sort-> 1 2 2 3
 * unique-> 1 2 3 x
 * erase-> 1 2 3
 */
template <typename T>
std::vector<T> deduplicate(std::vector<T> v) {
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());
    return v;
}
/**
 * std::unique は
 * 1. 連続した要素のうち先頭以外の要素を後ろに持っていく
 * 2. 後ろに持っていった要素の値は未規定になる
 * 3. 後ろに持っていった要素の先頭のイテレータを返す
 */
template <typename T>
std::deque<T> deduplicate(std::deque<T> d) {
    std::sort(d.begin(), d.end());
    d.erase(std::unique(d.begin(), d.end()), d.end());
    return d;
}

std::string deduplicate(std::string s) {
    std::sort(s.begin(), s.end());
    s.erase(std::unique(s.begin(), s.end()), s.end());
    return s;
}

// tests----------------------------------------------------------------
void abc098_b();  // stringの重複削除

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

void abc098_b() {
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;

    int ans = 0;
    for (int i = 1; i < n - 1; ++i) {
        std::string f = deduplicate(s.substr(0UL, i));
        std::string r = deduplicate(s.substr(i));

        int duplications = 0;
        for (char fc : f) {  // 𝑶(n * n/2 * n/2)
            // find は一致する要素を探してイテレータを返す
            if (r.find(fc) != string::npos) duplications++;
        }
        ans = std::max(ans, duplications);
    }

    std::cout << ans << "\n";
    return;
}

Compiler output:
a.cc: In function 'void abc098_b()':
a.cc:60:31: error: 'string' has not been declared
   60 |             if (r.find(fc) != string::npos) duplications++;
      |                               ^~~~~~
Language: C++

#include <algorithm>  // sort, unique
#include <deque>
#include <string>
#include <vector>

/**
 * 3 2 2 1
 * sort-> 1 2 2 3
 * unique-> 1 2 3 x
 * erase-> 1 2 3
 */
template <typename T>
std::vector<T> deduplicate(std::vector<T> v) {
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());
    return v;
}
/**
 * std::unique は
 * 1. 連続した要素のうち先頭以外の要素を後ろに持っていく
 * 2. 後ろに持っていった要素の値は未規定になる
 * 3. 後ろに持っていった要素の先頭のイテレータを返す
 */
template <typename T>
std::deque<T> deduplicate(std::deque<T> d) {
    std::sort(d.begin(), d.end());
    d.erase(std::unique(d.begin(), d.end()), d.end());
    return d;
}

std::string deduplicate(std::string s) {
    std::sort(s.begin(), s.end());
    s.erase(std::unique(s.begin(), s.end()), s.end());
    return s;
}

// tests----------------------------------------------------------------
void abc098_b();  // stringの重複削除

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

void abc098_b() {
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;

    int ans = 0;
    for (int i = 1; i < n - 1; ++i) {
        std::string f = deduplicate(s.substr(0UL, i));
        std::string r = deduplicate(s.substr(i));

        int duplications = 0;
        for (char fc : f) {  // 𝑶(n * n/2 * n/2)
            // find は一致する要素を探してイテレータを返す
            if (r.find(fc) != string::npos) duplications++;
        }
        ans = std::max(ans, duplications);
    }

    std::cout << ans << "\n";
    return;
}

Compiler output:
a.cc: In function 'void abc098_b()':
a.cc:47:10: error: 'cin' is not a member of 'std'
   47 |     std::cin >> n;
      |          ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <vector>
  +++ |+#include <iostream>
    5 | 
a.cc:49:10: error: 'cin' is not a member of 'std'
   49 |     std::cin >> s;
      |          ^~~
a.cc:49:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:31: error: 'string' has not been declared
   59 |             if (r.find(fc) != string::npos) duplications++;
      |                               ^~~~~~
a.cc:64:10: error: 'cout' is not a member of 'std'
   64 |     std::cout << ans << "\n";
      |          ^~~~
a.cc:64:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main(){
  int n;
  string s;
  cin>>n>>s;
  int num=0;
  for(int i=0;i<n;i++){
    int ans=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) ans++;
    }
    num=max(num,ans);
  }
  cout<<num<<endl;
}
     
    


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: unable to find character literal operator 'operator""c' with 'char' argument
   11 |     for(char c='a'c<='z';c++){
      |                ^~~~
a.cc:11:29: error: expected ';' before ')' token
   11 |     for(char c='a'c<='z';c++){
      |                             ^
      |                             ;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: unable to find character literal operator 'operator""c' with 'char' argument
   11 |     for(char c='a'c<='z';c++){
      |                ^~~~
a.cc:11:29: error: expected ';' before ')' token
   11 |     for(char c='a'c<='z';c++){
      |                             ^
      |                             ;
a.cc:13:21: error: 'ij' was not declared in this scope; did you mean 'j'?
   13 |       for(int j=0;j<ij++){
      |                     ^~
      |                     j
a.cc:13:25: error: expected ';' before ')' token
   13 |       for(int j=0;j<ij++){
      |                         ^
      |                         ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  string s;
  cin >> n >> s;
  
  vl f(n);
  vb exist(26, 0);
  rep(i, n) if(!exist[s[i]-'a']) {
    exist[s[i]-'a'] = 1;
    f[i]++;
  }
  rep(i, n) if(!exist[s[n-1-i]-'a']) {
    exist[s[n-1-i]-'a'] = 1;
    f[n-1-i]--;
  }
  ll ans=0, cnt=0;
  rep(i, n) {
    cnt += f[i];
    chmax(ans, cnt);
  }
  cout << ans << newl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'vb' was not declared in this scope; did you mean 'vs'?
   37 |   vb exist(26, 0);
      |   ^~
      |   vs
a.cc:38:17: error: 'exist' was not declared in this scope; did you mean 'exit'?
   38 |   rep(i, n) if(!exist[s[i]-'a']) {
      |                 ^~~~~
      |                 exit
a.cc:42:17: error: 'exist' was not declared in this scope; did you mean 'exit'?
   42 |   rep(i, n) if(!exist[s[n-1-i]-'a']) {
      |                 ^~~~~
      |                 exit
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  char s[200];
  cin >> s;
  int e,m=0;
  bool q,r,s;
  for(int i=1;i<strlen(s);i++){
    e=0;
    for(char j='a';j<='z';j++){
      q=0;
      r=0;
      s=0;
      for(int k=0;k<i;k++){
        if(s[k]==j)q=true;
      }
      for(int k=i;k<n;k++){
        if(s[k]==j)r=true;
      }
      if(q&&r)e++;
    }
    if(m<e)m=e;
  }
  cout << m;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: conflicting declaration 'bool s'
    9 |   bool q,r,s;
      |            ^
a.cc:6:8: note: previous declaration as 'char s [200]'
    6 |   char s[200];
      |        ^
a.cc:15:8: error: incompatible types in assignment of 'int' to 'char [200]'
   15 |       s=0;
      |       ~^~
Language: C++

#include<stdio.h>
int main(void)
{
	int n,x[30][2]={0},max=0,i,j,k;
	char s[101];
	char al[26]={"abcdefghijklmnopqrstuvwxyz"};
	scanf("%d %s", &n, s);
	for(i=0; i<n-1; i++)
	{
		for(j=0; j<26; j++)
		{
			for(k=0; k<=i; k++)
			{
				if(s[k]==al[j])
				x[j][0]=1;
			}
			for(k=i+1; k<n; k++)
			{
				if(s[k]==al[j])
				x[j][1]=1;
			}
		}
		k=0;
		for(j=0; j<26; j++)
		{
			if(x[j][0]>0&&x[j][1]>0)
			k++;
			x[j][0]=0;
			x[j][1]=0;
		}
		if(max<k)
		max=k;
	}
	printf("%d\n", max);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: initializer-string for 'char [26]' is too long [-fpermissive]
    6 |         char al[26]={"abcdefghijklmnopqrstuvwxyz"};
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 = 0; i < S.size(); i++) {
    int count = 0;
    bool left, right;
    
    for (charc = 'a'; c <= 'z'; c++) {
      for (int j = 0; j < i; j++) {
        if (S.at(j) == c) left = true;
      }
      for (int j = i; j < S.size(); j++) {
        if (S.at(j) == c) right = true;
      }
      
      if (left && right) count++;
    }
    
    if (count > ans) ans = count;
  }
   
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'charc' was not declared in this scope; did you mean 'char'?
   18 |     for (charc = 'a'; c <= 'z'; c++) {
      |          ^~~~~
      |          char
a.cc:18:23: error: 'c' was not declared in this scope
   18 |     for (charc = 'a'; c <= 'z'; c++) {
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int N;
    string S;
    cin >> N >> S;
    int ans=0;
    rep(i,N-1){
        string b,a;
        int count=0;
        a=S.substr(0,i+1);
        b=S.substr(i);
        int x[26]={};
        int y[26]={};
        rep(j,a.size()){
            x[a[j]-'a']++;
        }
        rep(j,b.size()){
            y[b[j]-'a']++;
        }
        rep(j,26){
            if(x[j]>0 && y[j]>0) count++;
        }
        ans=max(ans,count);
        
    }
    cout << and << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: expected identifier before '<<' token
   36 |     cout << and << endl;
      |                 ^~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define pb push_back
using namespace std;
using P = pair<int,int>;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef tuple<int,int,int> T;
typedef vector<P> vp;
typedef vector<T> vt;

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;
  int ans=0;
  for(int i=0; i<n; i++){
    int tmp=func(s.substr(0,i), s.substr(i));
    ans=max(ans,tmp);
  }
  cout << ans << endl;
  return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:46:12: error: expected '}' at end of input
   46 |   return 0;
      |            ^
a.cc:36:12: note: to match this '{'
   36 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string s;
cin>>n;
cin>>s;
int r = 0;
for(int i = 1; i < n; i++) {
int k = 0;
for(char c = 'a'; a <= 'z'; c++) {
  bool f = false, t = false; 
  for(int j = 0; j < i; j++) {
  if( s[j] == c) f = true;
  }
  for(int j = i; j < n; j++) {
  if(s[j] == c) t = true;
  }
  if(f && t) k++;
}
  if(r < k) r = k;
}
  
cout<<r<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'a' was not declared in this scope
   12 | for(char c = 'a'; a <= 'z'; c++) {
      |                   ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string s;
cin>>n;
cin>>s;
int r = 0;
for(int i = 1; i < n; i++) {
int k = 0;
for(char c = 'a'; a <'z'; c++) {
  bool f = false, t = false; 
  for(int j = 0; j < i; j++) {
  if( s[j] == c) f = true;
  }
  for(int j = i; j < n; j++) {
  if(s[j] == c) t = true;
  }
  if(f && t) k++;
}
  if(r < k) r = k;
}
  
cout<<r<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'a' was not declared in this scope
   12 | for(char c = 'a'; a <'z'; c++) {
      |                   ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;



int main() {
  int n;
  cin >> n;
  string s;
  int ans = 0;
  cin >> s;
  rep(i, 0, s.size() - 1) {
    int c = 0;
    for (int j = 'a'; j <= 'z' + 1; j++) {
      bool a=false, b=false;
      rep(k, 0, i + 1) {
        if (s[k] == j)a = true;
      }
      rep(l, i + 1 , s.size()) {
        if (s[l] == j)b = true;
      }
      if (a && b)c++;
    }
    ans = max(ans, c);
  }
  cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: 'i' was not declared in this scope
   26 |   rep(i, 0, s.size() - 1) {
      |       ^
a.cc:26:3: error: 'rep' was not declared in this scope; did you mean 'frexp'?
   26 |   rep(i, 0, s.size() - 1) {
      |   ^~~
      |   frexp
Language: C++

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>

#include<string>

#include<string.h>

#include<math.h>

using namespace std;



int main() {
  int n;
  cin >> n;
  string s;
  int ans = 0;
  cin >> s;
  rep(i, 0, s.size() - 1) {
    int c = 0;
    for (int j = 'a'; j <= 'z' + 1; j++) {
      bool a=false, b=false;
      rep(k, 0, i + 1) {
        if (s[k] == j)a = true;
      }
      rep(l, i + 1 , s.size()) {
        if (s[l] == j)b = true;
      }
      if (a && b)c++;
    }
    ans = max(ans, c);
  }
  cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'i' was not declared in this scope
   22 |   rep(i, 0, s.size() - 1) {
      |       ^
a.cc:22:3: error: 'rep' was not declared in this scope; did you mean 'frexp'?
   22 |   rep(i, 0, s.size() - 1) {
      |   ^~~
      |   frexp
Language: C++

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

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int num = 0;
  int ans = 0;
  for(int i = 1; i < N; i++){
    string a = substr(0,i);
    string b = substr(i,N - i);
      for(char c = 'a'; c <= 'z'; c++){
        int cnt = 0;
        bool right = false;
        bool left = false;
         for(int j = 0; j < a.size(); j++){
           if(a[j] == c) left = true;
         }
         for(int k = 0; k < b.size(); k++){
           if(b[k] == c) right = true;
         }
         if(right && left) cnt++;

    } 
    if(ans < cnt) ans = cnt;
}

cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   12 |     string a = substr(0,i);
      |                ^~~~~~
      |                strstr
a.cc:27:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |     if(ans < cnt) ans = cnt;
      |              ^~~
      |              int
Language: C++

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

int main(){
	int N;
	string S;
	cin>>N>>S;
	int max=0;
	for(int i=1;i<=N-1;i++){
		vector<int>A(28);
		vector<int>B(28);
		if(int j=0;j<N;j++){
			if(j<i){
				A.at(int(S.at(j)-97))++;
			}else{

			}
		}
	}
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: expected ')' before ';' token
   15 |                 if(int j=0;j<N;j++){
      |                   ~           ^
      |                               )
a.cc:15:32: error: 'j' was not declared in this scope
   15 |                 if(int j=0;j<N;j++){
      |                                ^
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 count=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(itn j=i;j<n;j++){
                if(s[j]==c){
                    right==true;
                }
            }
            if(left&&right){
                count++;
            }
        }
        if(ans < count){
            ans=count;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'itn' was not declared in this scope; did you mean 'int'?
   19 |             for(itn j=i;j<n;j++){
      |                 ^~~
      |                 int
a.cc:19:25: error: 'j' was not declared in this scope
   19 |             for(itn j=i;j<n;j++){
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,m=0;string S;cin>>N>>S;
  for(int i=1;i<S.size()-1){
    string X=S.substr(0,i),Y=S.substr(i);
    int c=0;
    for(char z='a';z<='z';z++){
      if(count(X.begin(),X.end(),z)*count(Y.begin(),Y.end(),z)!=0)c++;
    }
    m=max(c,m);
  }
  cout<<m<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:27: error: expected ';' before ')' token
    5 |   for(int i=1;i<S.size()-1){
      |                           ^
      |                           ;
Language: C++

#include <iostream>
#include <string>

#define cal(i, p, n) for(int i = p ; i < n ; i++)

using namespace std;

int main(){
    int N;
    int maxcount = 0;
    string S;
    cin >> N;
    cin >> S;
    cal(i, 1, N){
        string s1 = S.substr(0, i);
        string s2 = S.substr(i);
        sort(s1.begin(), s1.end());
        auto n = unique(s1.begin(), s1.end());
        s1.erase(n, s1.end());
        int count = 0;
        cal(j, 0, s1.length()){
            if(s2.find(s1[j])!= string::npos){
                count++;
            }
        }
        cout << s1 << " " << s2 << " " << count << endl;
        maxcount = max(maxcount, count);
    }
    cout << maxcount;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(s1.begin(), s1.end());
      |         ^~~~
      |         short
a.cc:18:18: error: 'unique' was not declared in this scope
   18 |         auto n = unique(s1.begin(), s1.end());
      |                  ^~~~~~
Language: C++

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

int func(string A,string B){
  int count = 0;
  for(char i= 'a';i<'z';i++){
    if(0 <= A.find(i) && A.find(i) < A.size() && 0 <= B.find(i) && B.find(i) < B.size()){
      count++;
    }
  }
  return count;
}
int main(){
  int a;
  cin >> a;
  string b;
  cin >> b;
  int MAX = 0;
  for(int i = 0;i<a-1;i++){
    string A = b.substr(0,i+1);
    string B = b.substr(i+1,a-1); 
    int m = func(A,B);
    MAX = max(m,MAX);
  }

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string s;
  cin >> N >> s;
  
  int ans = 0;
  
  REP(i,N-1){
	int l = i;
    int r = N - i;
    
    map<int,int> mpl;
    map<int,int> mpr;
    
    rep(j,l) mpl[s[j]-'a']++;
    for(int j = l;j < N;j++) mpr[s[j]-'a']++;
    
    int tmp = 0;
    
    rep(i,26) if(mpl[i] * mpr[i])tmp++;
    
    ans = max(ans,tmp);
  }
  
  cout << ans << endl;
}
    
    
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   REP(i,N-1){
      |       ^
a.cc:10:3: error: 'REP' was not declared in this scope
   10 |   REP(i,N-1){
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n; string s; set<char> st;
  for(int i=0;i<n;i++){
   st.insert(s[i]);
  
  }
  
  cout<<(st.length()+1)/2;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'class std::set<char>' has no member named 'length'
   10 |   cout<<(st.length()+1)/2;
      |             ^~~~~~
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:11:17: error: 'n' was not declared in this scope
   11 |   for(int i=1;i<n;++i){
      |                 ^
Language: C

#include<stdio.h>
#include<algorithm>
using namespace std;
#define fup(i,a,b) for(int i=a;i<b;++i)
#define fdn(i,a,b) for(int i=a;i>=b;--i)
#define mem(a,b) memset(a,b,sizeof(a))

void Main()
{
    int n;char a[105];
    scanf("%d %s",&n,a);
    int b[103][2],cz[130],cy[130];
    int s,sz,sy;
    fup(x,0,n)
    {
        sz=sy=s=0;
        mem(cz,0);mem(cy,0);
        fdn(i,x,0)++cz[a[i]];
        fup(i,x+1,n)++cy[a[i]];
        fup(i,95,130)
        {
            if(cz[i])++sz;
            if(cy[i])++sy;
            if(cz[i]&&cy[i])++s;
        }
        b[x][0]=sz+sy;
        b[x][1]=s;
    }
    int mx=-1,j=0;
    fup(i,0,n)if(mx<b[i][0])mx=b[i][0],j=i;
    printf("%d",b[j][1]);
}
int main()
{
Main();
return 0;
}

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

#include<stdio.h>
#include<algorithm>
using namespace std;
#define fup(i,a,b) for(int i=a;i<b;++i)
#define fdn(i,a,b) for(int i=a;i>=b;--i)
#define mem(a,b) memset(a,b,sizeof(a))

void Main()
{
    int n;char a[105];
    scanf("%d %s",&n,a);
    int b[103][2],cz[130],cy[130];
    int s,sz,sy;
    fup(x,0,n)
    {
        sz=sy=s=0;
        mem(cz,0);mem(cy,0);
        fdn(i,x,0)++cz[a[i]];
        fup(i,x+1,n)++cy[a[i]];
        fup(i,95,130)
        {
            if(cz[i])++sz;
            if(cy[i])++sy;
            if(cz[i]&&cy[i])++s;
        }
        b[x][0]=sz+sy;
        b[x][1]=s;
    }
    int mx=-1,j=0;
    fup(i,0,n)if(mx<b[i][0])mx=b[i][0],j=i;
    printf("%d",b[j][1]);
}
int main()
{
Main();
return 0;
}

Compiler output:
a.cc: In function 'void Main()':
a.cc:6:18: error: 'memset' was not declared in this scope
    6 | #define mem(a,b) memset(a,b,sizeof(a))
      |                  ^~~~~~
a.cc:17:9: note: in expansion of macro 'mem'
   17 |         mem(cz,0);mem(cy,0);
      |         ^~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

int main() {

	int N,anss=0;
  string lS,rS;
	cin>>N>>lS;
 
  
  for(int i=0; i<N; i++){
    rS.push_back(lS.at(i));
    lS.pop_front();
    for(int j=0; j<max(rS.size(),lS.size()); j++){ 
      int cnt=0;
      if(rS.at(j)==lS.at(j))cnt++;
      if(cnt>ans)ans=cnt;}
      
  }
	
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop_front'
   13 |     lS.pop_front();
      |        ^~~~~~~~~
a.cc:17:14: error: 'ans' was not declared in this scope; did you mean 'anss'?
   17 |       if(cnt>ans)ans=cnt;}
      |              ^~~
      |              anss
a.cc:21:15: error: 'ans' was not declared in this scope; did you mean 'anss'?
   21 |         cout<<ans<<endl;
      |               ^~~
      |               anss
Language: C++

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

int main() {

	int N,max=0;
  string lS,rS;
	cin>>N>>lS;
 
  
  for(int i=0; i<N; i++){
    rS.push_back(lS.at(i));
    lS.pop_front();
    for(int j=0; j<max(rS.size(),lS.size()); j++){ 
      int cnt=0;
      if(rS.at(j)==lS.at(j))cnt++;
      if(cnt>max)max=cnt;}
      
  }
	
	cout<<max<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop_front'
   13 |     lS.pop_front();
      |        ^~~~~~~~~
a.cc:14:23: error: 'max' cannot be used as a function
   14 |     for(int j=0; j<max(rS.size(),lS.size()); j++){
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

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


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 left = false;
			bool 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;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:40: error: 'z' was not declared in this scope
   16 |                 for (char c = 'a';c <= z;++c) {
      |                                        ^
Language: C++

#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	
 	 int count[30];
	for (int i = 1; i < n; i++) {
		memset(cnt, 0, sizeof(cnt));
		for (int k = 0; k < i; k++) {
			cnt[s[k] - 'a'] |= 1;
		}
		for (int k = i; k < n; k++) {
			cnt[s[k] - 'a'] |= 2;
		}
		int tmp = 0;
		for (int k = 0; k < 26; k++) {
			tmp += (cnt[k] & 3);
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |                 memset(cnt, 0, sizeof(cnt));
      |                        ^~~
      |                        int
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(cnt, 0, sizeof(cnt));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  int ans=0;
  rep(i,0,N-1){
    bitset<26> A,B,C;
    REP(j,0,i)
      A.set(S[j]-'a');
    rep(j,i+1,N)
      B.set(S[j]-'a');
    C=A&B;
    ans=max(ans,C.count());
    }
  cout<<ans;
  }


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

# https://atcoder.jp/contests/abc098/tasks/abc098_b

if ARGV[0]=="LOCAL_DEV"
  define_method("debug") do |var|
    p var
  end
else
  define_method("debug") do |var|
  end
end

N=STDIN.gets.strip.to_i
S=STDIN.gets.strip
ans=0
(1..S.size-1).each do |i|
  s=S[0,i]
  t=S[i,N]
  shash = Hash.new(0)
  thash = Hash.new(0)
  s.chars do |a|
    shash[a]+=1
  end
  t.chars do |a|
    thash[a]+=1
  end
  c=0
  ('a'..'z').each do |a|
    if shash[a]>0 && thash[a]>0
      c+=1
    end
  end
  ans=[ans,c].max
end

puts ans


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #https
    1 | # https://atcoder.jp/contests/abc098/tasks/abc098_b
      |   ^~~~~
a.cc:15:2: error: too many decimal points in number
   15 | (1..S.size-1).each do |i|
      |  ^~~~~~~~~~~
a.cc:3:1: error: expected unqualified-id before 'if'
    3 | if ARGV[0]=="LOCAL_DEV"
      | ^~
Language: C++

#include <iostream>
#include <map>
#include <string>
int main(){
  int n;
  std::string s;
  std::cin>>n>>s;
  std::map<char,int>m;
  for(char c:s){std::cout<<c;++m[c];}
  std::cout<<m['a']
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: expected ';' at end of input
   10 |   std::cout<<m['a']
      |                    ^
      |                    ;
a.cc:10:20: error: expected '}' at end of input
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

const long double PI = (acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}
int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    int ans = 0;
    for (int i = 1; i < n; i++)
    {
        int count = 0;
        for (char c = 'a'; c <= 'z'; c++)
        {
            bool left = false;
            bool right = false;
            for (int j = 0; j < i; j++)
            {
                if (s[j] == c)
                {
                    left = true;
                }
            }
            for (int k = i; k < n; k++)
            {
                if (s[k] == c)
                {
                    right = true;
                }
            }
            if (left && right)
            {
                count++;
            }
        }
        if (ans < count)
        {
            ans = count;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:1:25: error: 'acos' was not declared in this scope
    1 | const long double PI = (acos(-1));
      |                         ^~~~
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<int, int> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:36:5: error: 'string' was not declared in this scope
   36 |     string s;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | const long double PI = (acos(-1));
a.cc:37:5: error: 'cin' was not declared in this scope
   37 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | const long double PI = (acos(-1));
a.cc:38:12: error: 's' was not declared in this scope
   38 |     cin >> s;
      |            ^
a.cc:71:5: error: 'cout' was not declared in this scope
   71 |     cout << ans << endl;
      |     ^~~~
a.cc:71:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:71:20: error: 'endl' was not declared in this scope
   71 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | const long double PI = (acos(-1));
Language: C++

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

int mojsh(string s){
  sort(s.begin(),s.end());
  int cnt=0;
  for(int i=0;i<s.size()-1;i++){
    if(s[i+1]=s[i])cnt++;
  }
  return cnt;
}

int main(){
  int n;
  string s;
  cin>>n;
  cin>>s;
  int ma=0;
  for(i=0;i<n;i++){
    ma=max(ma,min(mojsh(s.substr(0,i)),mojsh(s.substr(i))));
  }
  cout<<ma;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i=0;i<n;i++){
      |       ^
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<s.size()-1; i++){
    string left,right;
    map<char,int> mp;
    int tmp = 0;
    left = s.substr(0,i);
    right = s.substr(i,s.size()-i);
    if(left.size()<right.size()){
      for(int j=0; j<right.size(); j++){
        mp[right.at(j)] = 1;
      }
      for(int j=0 j<left.size(); j++){
        if(mp.count(left.at(j))==1)tmp++;
      }
    }else{
      for(int j=0; j<left.size(); j++){
        mp[left.at(j)] = 1;
      }
      for(int j=0 j<right.size(); j++){
        if(mp.count(right.at(j))==1)tmp++;
      }
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
}
      
      
    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before 'j'
   20 |       for(int j=0 j<left.size(); j++){
      |                  ^~
      |                  ;
a.cc:27:18: error: expected ';' before 'j'
   27 |       for(int j=0 j<right.size(); j++){
      |                  ^~
      |                  ;
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<s.size()-1; i++){
    string left,right;
    map<char,int> mp;
    int tmp = 0;
    left = s.substr(0,i);
    right = s.substr(i,s.size()-i);
    if(left.size()<right.size()){
      for(int j=0; j<right.size(); j++){
        mp[right.at(j)] = 1;
      }
      for(int j=0 j<left.size(); j++){
        if(mp.count(left.at(j))==1)tmp++;
      }
    }else{
      for(int j=0; j<left.size(); j++){
        mp[left.at(j)] = 1;
      }
      for(int j=0 j<right.size(); j++){
        if(mp.count(right.at(j))==1)tmp++;
      }
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
}
      
      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: expected ';' before 'i'
   10 |   for(int i=1 i<s.size()-1; i++){
      |              ^~
      |              ;
a.cc:20:18: error: expected ';' before 'j'
   20 |       for(int j=0 j<left.size(); j++){
      |                  ^~
      |                  ;
a.cc:27:18: error: expected ';' before 'j'
   27 |       for(int j=0 j<right.size(); j++){
      |                  ^~
      |                  ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    string S;
    cin >> S;

    int answer = 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:19:20: error: 's' was not declared in this scope
   19 |                 if(s[j] == c){
      |                    ^
a.cc:25:21: error: 's' was not declared in this scope
   25 |                 if (s[j] == c){
      |                     ^
a.cc:34:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |         if (ans < cnt){
      |             ^~~
      |             abs
a.cc:39:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |     cout << ans << endl;
      |             ^~~
      |             abs