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


#include <iostream>

using namespace std;

int main(){
    int n, m, i, j, yen, max=0;
    string s[100], t[100], tag;

    cin >> n;
    for(i=0; i<n; i++)
        cin >> s[i];
    
    cin >> m;
    for(i=0; i<m; i++)
        cin >> t[i];

    for(i=0; i<n; i++){
        yen = 0;
        tag = s[i];
        for(j=0; j<n; j++){
            if(tag == s[j])
                yen++;
        }
        for(j=0; j<m; j++){
            if(tag == t[j])
                yen--;
        }

        if(max < yen)
            max = yen;
    }

    cout << max << endl;

    return 0;
}

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

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

using namespace std;
#define ll long long
#define pb push_back

int main() {
  int n, m,j=0;
  cin >> n;
  vector<string> bc(n);
  for(int i = 0; i < n; i++){
      cin >> bc[i];
  }
  cin >> m;
  vector<string> rc(m);
  for(int i = 0; i < m; i++){
      cin >> rc[i];
  }
  sort(bc.begin(), bc.end());
  sort(rc.begin(), rc.end());
  vector<int> cnt(n+m,0);

  for(int i = 0; i < n; i++){
    for(int k = 0; k < m; k++){
      if(bc[i]==bc[k]){
        cnt[j]++;
      } else {
        j++;
      }
    }
  }

  j=0;
  for(int i = 0; i < n; i++){
    for(int k=0; k < m; k++){
      if(bc[i]==rc[k]){
        cnt[j]--;
        j++;
      }
      else {
        j++;
      }
    }
  }
  int max = 0;


  for(int i=0 ;i<cnt.size();i++){
    if(max < cnt[i]) max = cnt[i];
  }

  cout << max << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   24 |   sort(bc.begin(), bc.end());
      |   ^~~~
      |   sqrt
Language: C++

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

int main(){
    int n, m, i, j;
    string s;
    map<string, int> mp;
    bool flag = 1;
    vector<string> str;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> s;
        mp[s]++;
        str.push_back(s);
    }
    cin >> m;
    for(i = 0; i < m; i++){
        cin >> s;
        mp[s]--;
        str.push_back(s);
    }
    str.erase(unique(str.begin(), str.end()), str.end());
    int ans = 0;
    for(i = 0; i < p.size(); i++){
        ans = max(ans, mp[str.at(i)]);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: 'p' was not declared in this scope; did you mean 'mp'?
   24 |     for(i = 0; i < p.size(); i++){
      |                    ^
      |                    mp
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, s[N];
  cin >> N;
  int blue = 0;
  for(int i = 0; i < N; i++){
    cin >> s[i];
   blue++;
  }
  int M, t[M];
  cin >> M;
  int red = 0;
  for(int i = 0; i < M; i++){
    cin >> t[i];
    red++:
  }
int answer = max(0, blue, red);
  cout << answer << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: expected ';' before ':' token
   16 |     red++:
      |          ^
      |          ;
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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:18:17:   required from here
   18 | int answer = max(0, blue, red);
      |              ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <map>

using namespace std;

int main(){
  map<string,int> m;
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    string t;
    cin >> t;
    m[t]++;
  }
  int M;
  cin >> M;
  for(int i = 0; i < M; i++){
    string t;
    cin >> t;
    m[t]--;
  }
  int max = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++){
    max = max(m->second, max);
  }
  cout << max;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: error: base operand of '->' has non-pointer type 'std::map<std::__cxx11::basic_string<char>, int>'
   24 |     max = max(m->second, max);
      |                ^~
a.cc:24:14: error: 'max' cannot be used as a function
   24 |     max = max(m->second, max);
      |           ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) {
        cin >> blue[i];
    }
    int m;
    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) {
        cin >> red[i];
    }

    int ans = 0;
    int calc(string s){
        int buf = 0;
        for (string t: blue) {
            if (t == s) buf++;
        }
        for (string t: red) {
            if (t == s) buf--;
        }
        return buf;
    }

    for (string t: blue) {
        ans = max(ans, calc(t));
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: a function-definition is not allowed here before '{' token
   22 |     int calc(string s){
      |                       ^
a.cc:34:24: error: 'calc' was not declared in this scope; did you mean 'calloc'?
   34 |         ans = max(ans, calc(t));
      |                        ^~~~
      |                        calloc
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) {
        cin >> blue[i];
    }
    int m;
    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) {
        cin >> red[i];
    }

    int ans = 0;
    int calc = [&](string s) {
        int buf = 0;
        for (string t: blue) {
            if (t == s) buf++;
        }
        for (string t: red) {
            if (t == s) buf--;
        }
        return buf;
    };

    for (string t: blue) {
        ans = max(ans, calc(t));
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: cannot convert 'main()::<lambda(std::string)>' to 'int' in initialization
   22 |     int calc = [&](string s) {
      |                ^~~~~~~~~~~~~~~
      |                |
      |                main()::<lambda(std::string)>
   23 |         int buf = 0;
      |         ~~~~~~~~~~~~
   24 |         for (string t: blue) {
      |         ~~~~~~~~~~~~~~~~~~~~~~
   25 |             if (t == s) buf++;
      |             ~~~~~~~~~~~~~~~~~~
   26 |         }
      |         ~       
   27 |         for (string t: red) {
      |         ~~~~~~~~~~~~~~~~~~~~~
   28 |             if (t == s) buf--;
      |             ~~~~~~~~~~~~~~~~~~
   29 |         }
      |         ~       
   30 |         return buf;
      |         ~~~~~~~~~~~
   31 |     };
      |     ~           
a.cc:34:28: error: 'calc' cannot be used as a function
   34 |         ans = max(ans, calc(t));
      |                        ~~~~^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) {
        cin >> blue[i];
    }
    int m;
    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) {
        cin >> red[i];
    }

    int ans = 0;
    auto calc([&](string s)) {
        int buf = 0;
        for (string t: blue) {
            if (t == s) buf++;
        }
        for (string t: red) {
            if (t == s) buf--;
        }
        return buf;
    }

    for (string t: blue) {
        ans = max(ans, calc(t));
    }

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


Compiler output:
a.cc: In lambda function:
a.cc:22:28: error: expected '{' before ')' token
   22 |     auto calc([&](string s)) {
      |                            ^
a.cc: In function 'int main()':
a.cc:22:30: error: expected ',' or ';' before '{' token
   22 |     auto calc([&](string s)) {
      |                              ^
a.cc:34:28: error: invalid use of void expression
   34 |         ans = max(ans, calc(t));
      |                        ~~~~^~~
Language: C++

#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
  int n;
  cin>>n;
  vector<string> b(n);
  for(int i=0;i<n;i++)cin>>b.at(i);
  int m;
  cin>>m;
  vector<string> r(m);
  for(int i=0;i<m;i++)cin>>r.at(i);
  for(int i=0;i<m;i++){
    for(int j=0;j<b.size();j++){
      if(r.at(i)==b.at(j)){
     b.at(j)="00";
        break;
      }
    }
  }
int count=1,ans=0;
b.erase(remove(b.begin(),b.end(),"00"),b.end());
sort(b.begin(),b.end());
for(int i=1;i<b.size();i++){
    If(b.at(i-1)==b.at(i))count++;
   else count=1;
    ans=max(ans,count);
  }
cout<<count<<endl;  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'If' was not declared in this scope
   25 |     If(b.at(i-1)==b.at(i))count++;
      |     ^~
a.cc:26:4: error: 'else' without a previous 'if'
   26 |    else count=1;
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
  int n;
  cin>>n;
  vector<string> b(n);
  for(int i=0;i<n;i++)cin>>b.at(i);
  int m;
  cin>>m;
  vector<string> r(m);
  for(int i=0;i<m;i++)cin>>r.at(i);
  for(int i=0;i<m;i++){
    for(int j=0;j<b.size();j++){
      if(r.at(i)==b.at(j)){
      erase(b.at(j));
        break;
      }
    }
  }
cout<<b.size()<<endl;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'erase' was not declared in this scope
   16 |       erase(b.at(j));
      |       ^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  string s[N];
  int yen[N]={};
  for(int i=0;i<N;i++){
    cin >> s[i];
    for(int j=0;j<i;j++){
      if(s[i]==s[j]){
        yen[j]++;
      }
      else yen[i]++;
    }
  }
  int M;
  cin M;
  for(int i=0;i<M;i++){
    string x;
    cin >> x;
    for(int j=0;j<N;j++){
      if(x==s[j])yen[j]--;
    }
  }
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=max(0,yen[i]);
  }
  cout << sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:6: error: expected ';' before 'M'
   19 |   cin M;
      |      ^~
      |      ;
Language: C++

#include<iostream>
using namespace std;
int main(void){
  string s[110],t[110];
  int n,m;cin>>n;
  for(int i=0;i<n;i++)cin>>s[i];
  cin>>m;
  for(int i=0;i<m;i++)cin>>t[i];
  int ans=0;
  for(int i=0;i<N;i++){
    int sc=0;
    for(int j=0;j<N;j++)if(s[i]==s[j])sc++;
    for(int j=0;j<M;j++)if(s[i]==t[j])sc--;
    ans=max(ans,sc);
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'N' was not declared in this scope
   10 |   for(int i=0;i<N;i++){
      |                 ^
a.cc:13:19: error: 'M' was not declared in this scope
   13 |     for(int j=0;j<M;j++)if(s[i]==t[j])sc--;
      |                   ^
Language: C++

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

int main(){
int N;
  cin>>N;
  
  vector<string>s(N);
  for(int i=0;i<N;i++){
    cin>>s.at(i);
  }
  
  int M;
  cin>>M;
  
  vector<string>t(M);
  
  for(int i=0;i<M;i++){
    cin>>t.at(i);
  }
  
  int max=-100;
  
  for(int i=0;i<N;i++){
    int sum=0;
    for(int j=0;j<N;j++){
      if(s.at(i)==s.at(j)){
        sum++;
      }
    }
    
      int sum1=0;
      
      for(int k=0;k<M;k++){
        if(s.at(i)==t.at(k)){
          sum1++;
        }
      }
      
      if(sum-sum1>max){
        max=sum-sum1;
      }
    }
  
  if(max>0){
    cout<<max<<endl;
  }
  else{
cout<<0<<endl;
  }
}

  }


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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n;
  vector<string> blue(n);
  rep(i,n){
    cin>>blue[i];
  }
  cin>>m;
  vector<string> red(m);
  rep(i,m){
    cin>>red[i];
  }
  int ans=0;
  rep(i,n){
    ans=max(ans,blue.count(blue[i])-red.count(blue[i]));
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'count'
   18 |     ans=max(ans,blue.count(blue[i])-red.count(blue[i]));
      |                      ^~~~~
a.cc:18:41: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'count'
   18 |     ans=max(ans,blue.count(blue[i])-red.count(blue[i]));
      |                                         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n;
  vector<string> blue(n);
  rep(i,n){
    cin>>blue[i];
  }
  cin>>m;
  vector<string> red(m);
  rep(i,m){
    cin>>red[i];
  }
  int ans=0;
  rep(i,n){
    ans=max(ans,count(blue.begin(),blue.end(),blue[i])-count(red.begin(),red.end(),blue[i]));
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: no matching function for call to 'max(int&, std::__iterator_traits<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >, void>::difference_type)'
   18 |     ans=max(ans,count(blue.begin(),blue.end(),blue[i])-count(red.begin(),red.end(),blue[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__iterator_traits<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >, void>::difference_type' {aka 'long int'})
   18 |     ans=max(ans,count(blue.begin(),blue.end(),blue[i])-count(red.begin(),red.end(),blue[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:18:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   18 |     ans=max(ans,count(blue.begin(),blue.end(),blue[i])-count(red.begin(),red.end(),blue[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  map<string, int> v;
  for(int i = 0; i < n; i++){
    string s; cin >> s;
    v[s]++;
  }
  for(int i = 0; i < m; i++){
    string s; cin >> s;
    v[s]--;
  }
  int ans = 0;
  for(auto it : v) ans = max(ans, v.second);
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'second'
   15 |   for(auto it : v) ans = max(ans, v.second);
      |                                     ^~~~~~
Language: C++

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

int main() {
  int n,m;
  cin >> n;
  vector<string> s(n);
  for(int i = 0;i<n;i++){
    cin >> s.at(i);
  }
  cin >> m;
  vector<string> t(m);
  for(int i=0;i<m;i++){
    cin >> t.at(i);
  }
  
  int x,y;
  x =0;
  y=0;
  vector<int> asn(n);
  for(int i=0;i<n;i++){
    for(int j=0;i<n;i++){
      if(i != j && s.at(i) == s.at(j)){
        x++;
      }
    }
    for(int k=0;k<m;k++){
      if(s.at(i) == t.at(k)){
        y++;
      }
    }
    ans.at(i) = x - y;
  }
  
  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ane.end());
  if(ans.at(0) < 0){
    cout << 0 << endl;
  }
  else {
    cout << ans.at(0) << endl;
  }
}

    

  


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'ans' was not declared in this scope; did you mean 'asn'?
   32 |     ans.at(i) = x - y;
      |     ^~~
      |     asn
a.cc:35:8: error: 'ans' was not declared in this scope; did you mean 'asn'?
   35 |   sort(ans.begin(), ans.end());
      |        ^~~
      |        asn
a.cc:36:24: error: 'ane' was not declared in this scope
   36 |   reverse(ans.begin(), ane.end());
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
#include <iomanip>
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    REP(i, N) cin >> s[i];
    int M;
    cin >> M;
    vector<string> t(M);
    REP(i, M) cin >> t[i];
    map<string, int> cnt;
    REP(i, N) cnt[s[i]]++;
    REP(i, M) cnt[t[i]]--;
    ll ans = -INF;
    REP(i, N) {
        if(cnt[s[i]] > ans) {
            ans = cnt[s[i]];
        }
    }
    REP(i, M) { ans = max(cnt[t[i]], ans); }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:26: error: no matching function for call to 'max(std::map<std::__cxx11::basic_string<char>, int>::mapped_type&, ll&)'
   45 |     REP(i, M) { ans = max(cnt[t[i]], ans); }
      |                       ~~~^~~~~~~~~~~~~~~~
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:45:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   45 |     REP(i, M) { ans = max(cnt[t[i]], ans); }
      |                       ~~~^~~~~~~~~~~~~~~~
/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:45:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   45 |     REP(i, M) { ans = max(cnt[t[i]], ans); }
      |                       ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
#include <iomanip>
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    REP(i, N) cin >> s[i];
    int M;
    cin >> M;
    vector<string> t(M);
    REP(i, M) cin >> t[i];
    map<sting, int> cnt;
    REP(i, N) cnt[s[i]]++;
    REP(i, M) cnt[t[i]]--;
    sort(ALL(cnt));
    ll ans = -INF;
    REP(i, N) {
        if(cnt[s[i]] > ans) {
            ans = cnt[s[i]];
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'sting' was not declared in this scope
   36 |     map<sting, int> cnt;
      |         ^~~~~
a.cc:36:19: error: template argument 1 is invalid
   36 |     map<sting, int> cnt;
      |                   ^
a.cc:36:19: error: template argument 3 is invalid
a.cc:36:19: error: template argument 4 is invalid
a.cc:37:18: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   37 |     REP(i, N) cnt[s[i]]++;
      |                  ^
a.cc:38:18: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   38 |     REP(i, M) cnt[t[i]]--;
      |                  ^
a.cc:4:24: error: request for member 'begin' in 'cnt', which is of non-class type 'int'
    4 | #define ALL(obj) (obj).begin(), (obj).end()
      |                        ^~~~~
a.cc:39:10: note: in expansion of macro 'ALL'
   39 |     sort(ALL(cnt));
      |          ^~~
a.cc:4:39: error: request for member 'end' in 'cnt', which is of non-class type 'int'
    4 | #define ALL(obj) (obj).begin(), (obj).end()
      |                                       ^~~
a.cc:39:10: note: in expansion of macro 'ALL'
   39 |     sort(ALL(cnt));
      |          ^~~
a.cc:42:15: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   42 |         if(cnt[s[i]] > ans) {
      |               ^
a.cc:43:22: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   43 |             ans = cnt[s[i]];
      |                      ^
Language: C++

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

int main() {
	int N,M
  	cin >> N;
  	
  	vector<string> blue(N);
    for(int i = 0; i < N; i++) {
    	cin >> blue.at(i);
    }
  
  	cin >> M;
  	
   vector<string> red(M);
  	for(int i = 0; i < M; i++) {
    	cin >> red.at(i);
    }
  
	int ans = 0;
  	
  	for(int i = 0; i < N; i++) {
    	int score = 0;
      
      	for(int j = 0; j < N; j++) {
        	if(blue.at(i) == blue.at(j)) score++;
        }
      
      	for(int j = 0; j < M; j++) {
        	if(blue.at(i) == red.at(j)) score--;
        }
      
      	ans = max(ans,score);
    }
  
  	cout << ans << endl;
  	
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: expected initializer before 'cin'
    6 |         cin >> N;
      |         ^~~
a.cc:13:16: error: 'M' was not declared in this scope
   13 |         cin >> M;
      |                ^
Language: C++

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

int main() {
  int N,M;
  cin >> N;
  
  vector<string> word;
  vector<int> cnt;
  
  int i,j;
  string tmp;
  
  cin >> tmp;
  word.push_back(tmp);
  cnt.push_back(1);
  bool exist;
  
  for(i=1;i<N;i++){
    cin >> tmp;
    exist = false;
    for(j=0;j<word.size;j++){
      if(tmp == word.at(j)){
        cnt.at(j) += 1;
        exist = true;
        break;
      }
    }
    if(exist != true){
      word.push_back(tmp);
      cnt.push_back(1);
    }
  }
  
  cin >> M;
  for(i=1;i<M;i++){
    cin >> tmp;
    //exist = false;
    for(j=0;j<word.size;j++){
      if(tmp == word.at(j)){
        cnt.at(j) -= 1;
        //exist = true;
        break;
      }
    }
    /*if(exist != true){
      word.push_back(tmp);
      cnt.push_back(1);
    }*/
  }
  
  int max;
  max = 0;
  for(i=0;i<cnt.size;i++){
    if(max < cnt.at(i){
      max = cnt.at(i);
    }
       }
       cout << max;
       
        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int]' (did you forget the '()' ?)
   22 |     for(j=0;j<word.size;j++){
      |               ~~~~~^~~~
      |                        ()
a.cc:39:20: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int]' (did you forget the '()' ?)
   39 |     for(j=0;j<word.size;j++){
      |               ~~~~~^~~~
      |                        ()
a.cc:54:17: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   54 |   for(i=0;i<cnt.size;i++){
      |             ~~~~^~~~
      |                     ()
a.cc:55:23: error: expected ')' before '{' token
   55 |     if(max < cnt.at(i){
      |       ~               ^
      |                       )
a.cc:58:8: error: expected primary-expression before '}' token
   58 |        }
      |        ^
Language: C++

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


int main(){
  int N;
  cin >> N;
  map<string, int> A;
  for(int ii=0; ii<N; ii++){
    string a;
    cin >> a;
    if(A.find(a) != A.end()){
      A[a]++;
    }else{
      A[a] = 1;
    }
  }
  
  int M;
  cin >> M;
  for(int ii=0; ii<M; ii++){
    string a;
    cin >> a;
    if(A.find(a) != A.end()){
      A[a]--;
    }else{
      A[a] = -1;
    }
  }
  
  auto ans = max_element(A.begin(), A.end(), [](const pair& a, const pair& b){return a.second < b.second;})
  cout << ans->second << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:49: error: missing template argument list after 'std::pair'; template placeholder not permitted in parameter
   31 |   auto ans = max_element(A.begin(), A.end(), [](const pair& a, const pair& b){return a.second < b.second;})
      |                                                 ^~~~~
      |                                                      <>
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:89:12: note: 'template<class _T1, class _T2> struct std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:31:64: error: missing template argument list after 'std::pair'; template placeholder not permitted in parameter
   31 |   auto ans = max_element(A.begin(), A.end(), [](const pair& a, const pair& b){return a.second < b.second;})
      |                                                                ^~~~~
      |                                                                     <>
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'template<class _T1, class _T2> struct std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc: In lambda function:
a.cc:31:86: error: 'a' was not declared in this scope
   31 |   auto ans = max_element(A.begin(), A.end(), [](const pair& a, const pair& b){return a.second < b.second;})
      |                                                                                      ^
a.cc:31:97: error: 'b' was not declared in this scope
   31 |   auto ans = max_element(A.begin(), A.end(), [](const pair& a, const pair& b){return a.second < b.second;})
      |                                                                                                 ^
a.cc: In function 'int main()':
a.cc:32:3: error: expected ',' or ';' before 'cout'
   32 |   cout << ans->second << endl;
      |   ^~~~
Language: C++

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

int main(){
  int N, M;
  int max;
  cin >> N;
  vector<string> s(N);
  for(int i = 0; i < N; i++){
    cin >> s[i];
  }
  cin >> M;
  vector<string> t(M);
  for(int i = 0; i < M; i++){
    cin >> t[i];
  }
  for(int i = 0; i < N; i++){
    int x = 0;
    for(int j = 0; j < N; i++){
      if(s[i] == s[j]){
        x++;
      }
    }
    for(int j = 0; j < M; i++){
      if(s[i] == t[j]){
        x--;
      }
    }
    if(max <= x){
      max = x;
    }
  }
  if(max <= 0){
    cout << '0' << endl;
  }
  else if{
    cout << max << endl;
  }
}
      
      

Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: expected '(' before '{' token
   36 |   else if{
      |          ^
      |          (
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main() {
    int N, M;
    int max = 0;
    string s;
    vector<string> blue;
    vector<string> red;
    
    cin >> N;
    for ( int i = 0 ; i < N ; i++ ) {
        cin >> s;
        blue.push_back(s);
    }
    
    cin >> M;
    for ( int i = 0 ; i < M ; i++ ) {
        cin >> s;
        red.push_back(s);
    }
    
    for ( int i = 0 ; i < N ; i++ ) {
        int count = 0;
        string target = blue.at(i);
        
        for ( int l = 0 ; l < N ; i ++ ) {
            if ( target == blue.at(l) ){
                count++;
            }
        }
        
        for ( int m = 0 ; m < M ; i ++ ) {
            if ( target == red.at(m) ){
                count--;
            }
        }
        
        if ( max <= (countBlue - countRed) ){
            max = countBlue - countRed;
        }
    }
    
    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:22: error: 'countBlue' was not declared in this scope
   53 |         if ( max <= (countBlue - countRed) ){
      |                      ^~~~~~~~~
a.cc:53:34: error: 'countRed' was not declared in this scope; did you mean 'count'?
   53 |         if ( max <= (countBlue - countRed) ){
      |                                  ^~~~~~~~
      |                                  count
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main() {
    int N, M;
    int max = 0;
    string s;
    vector<string> blue;
    vector<string> red;
    
    cin >> N;
    for ( int i = 0 ; i < N ; i++ ) {
        cin >> s;
        blue.push_back(s);
    }
    
    cin >> M;
    for ( int i = 0 ; i < M ; i++ ) {
        cin >> s;
        red.push_back(s);
    }
    
    for ( int i = 0 ; i < N ; i++ ) {
        int countBlue = 0, countRed = 0;
        string target = blue.at(i);
        
        for ( int l = 0 ; l < N ; i ++ ) {
            if ( target == blue.at(l) ){
                countBlue++;
            }
        }
        
        for ( int m = 0 ; m < M ; i ++ ) {
            if ( target == red.at(l) ){
                countRed++;
            }
        }
        
        if ( max <= (countBlue - countRed) ){
            max = countBlue - countRed;
        }
    }
    
    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:35: error: 'l' was not declared in this scope
   48 |             if ( target == red.at(l) ){
      |                                   ^
Language: C++

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

string S[101], T[101];

int main(){
  int N, M;

  cin >> N;
  for (int i = 0; i < N; i++) cin >> S[i];

  cin >> M;
  for(int i=0; i < M; i++) cin >> M[i];

  int up = 0;
  int x = 0;

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(S[i] == S[j+1]) x++;
      //up と x を比較し、大きいほうの値でupを更新する
      up = max(x, up);
      x = 0;
    }
  }

  int down = 0;
  int y = 0;

  for(int i = 0; i < M; i++){
    for(int j = 0; j < M; j++){
      if(M[i] == M[j+1]) x++;
      //down と y を比較し、大きいほうの値でdownを更新する
      down = max(y, down);
      y = 0;
    }
  }
  cout << up - down;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:36: error: invalid types 'int[int]' for array subscript
   13 |   for(int i=0; i < M; i++) cin >> M[i];
      |                                    ^
a.cc:32:11: error: invalid types 'int[int]' for array subscript
   32 |       if(M[i] == M[j+1]) x++;
      |           ^
a.cc:32:19: error: invalid types 'int[int]' for array subscript
   32 |       if(M[i] == M[j+1]) x++;
      |                   ^
Language: C++

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

int main(){
  int N, M;
  vector <string> S(101), T(101);

  cin >> N;
  for (int i = 0; i < N; i++) cin >> S.at(i);

  cin >> M;
  for(int i=0; i < M; i++) cin >> M.at(i);

  int up = 0;
  int x = 0;

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(S.at(i) == S.at(j+1)) x++;
      //up と x を比較し、大きいほうの値でupを更新する
      up = max(x, up);
      x = 0;
    }
  }

  int down = 0;
  int y = 0;

  for(int i = 0; i < M; i++){
    for(int j = 0; j < M; j++){
      if(M.at(i) == M.at(j+1)) x++;
      //down と y を比較し、大きいほうの値でdownを更新する
      down = max(y, down);
      y = 0;
    }
  }
  cout << up - down;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:37: error: request for member 'at' in 'M', which is of non-class type 'int'
   12 |   for(int i=0; i < M; i++) cin >> M.at(i);
      |                                     ^~
a.cc:31:12: error: request for member 'at' in 'M', which is of non-class type 'int'
   31 |       if(M.at(i) == M.at(j+1)) x++;
      |            ^~
a.cc:31:23: error: request for member 'at' in 'M', which is of non-class type 'int'
   31 |       if(M.at(i) == M.at(j+1)) x++;
      |                       ^~
Language: C++

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

int main(){
  int N, M;
  vector string S(101), T(101);

  cin >> N;
  for (int i = 0; i < N; i++) cin >> S.at(i);

  cin >> M;
  for(int i=0; i < M; i++) cin >> M.at(i);

  int up = 0;
  int x = 0;

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(S.at(i) == S.at(j+1)) x++;
      //up と x を比較し、大きいほうの値でupを更新する
      up = max(x, up);
      x = 0;
    }
  }

  int down = 0;
  int y = 0;

  for(int i = 0; i < M; i++){
    for(int j = 0; j < M; j++){
      if(M.at(i) == M.at(j+1)) x++;
      //down と y を比較し、大きいほうの値でdownを更新する
      down = max(y, down);
      y = 0;
    }
  }
  cout << up - down;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: expected initializer before 'S'
    6 |   vector string S(101), T(101);
      |                 ^
a.cc:9:38: error: 'S' was not declared in this scope
    9 |   for (int i = 0; i < N; i++) cin >> S.at(i);
      |                                      ^
a.cc:12:37: error: request for member 'at' in 'M', which is of non-class type 'int'
   12 |   for(int i=0; i < M; i++) cin >> M.at(i);
      |                                     ^~
a.cc:19:10: error: 'S' was not declared in this scope
   19 |       if(S.at(i) == S.at(j+1)) x++;
      |          ^
a.cc:31:12: error: request for member 'at' in 'M', which is of non-class type 'int'
   31 |       if(M.at(i) == M.at(j+1)) x++;
      |            ^~
a.cc:31:23: error: request for member 'at' in 'M', which is of non-class type 'int'
   31 |       if(M.at(i) == M.at(j+1)) x++;
      |                       ^~
Language: C++

  vector<string> name(10000);
  vector<int> num(10000,0);
  int idx = -1;
   
  cin >> N;
     if(flg) {
        idx+=1;
        
        name.at(idx) = str;
        num.at(idx) += 1;
        
      }
      else {
        num.at(found_same_idx) += 1;
      }
  
  for(int i=0;i<N;i++) {
    string str;
    cin >> str;
    bool flg = true;
    int found_same_idx = 0;
    for (int j=0;j<idx&&flg==true;j++) {
      if(name.at(j) == str) {
       flg = false;
        found_same_idx = j;
      }
    }
      
      if(flg) {
        idx+=1;
        
        name.at(idx) = str;
        num.at(idx) += 1;
        
      }
      else {
        num.at(found_same_idx) += 1;
      }
  }

 cin >> M;
	
for(int i=0;i<M;i++) {
  bool flg = true;
    int found_same_idx = 0;
    for (int j=0;j<idx&&flg==true;j++) {
      if(name.at(j) == str) {
       flg = false;
        found_same_idx = j;
      }
    }
   if(flg==false)
      {
        num.at(found_same_idx) -= 1;
      }

}
max = num.at(0)
for(int i=1;i<idx;i++) {
  if(max < num.at(i)) max = num.at(i);
}

if(max < 0) max = 0;

cout<<max <<endl;



  
     /* for (int i=0;i<N;i++) {
        cout << "name :" <<name.at(i) << "  num :"<<num.at(i)<<"\n";
      }*/
    
      return 0;
    }


Compiler output:
a.cc:1:3: error: 'vector' does not name a type
    1 |   vector<string> name(10000);
      |   ^~~~~~
a.cc:2:3: error: 'vector' does not name a type
    2 |   vector<int> num(10000,0);
      |   ^~~~~~
a.cc:5:3: error: 'cin' does not name a type
    5 |   cin >> N;
      |   ^~~
a.cc:6:6: error: expected unqualified-id before 'if'
    6 |      if(flg) {
      |      ^~
a.cc:13:7: error: expected unqualified-id before 'else'
   13 |       else {
      |       ^~~~
a.cc:17:3: error: expected unqualified-id before 'for'
   17 |   for(int i=0;i<N;i++) {
      |   ^~~
a.cc:17:15: error: 'i' does not name a type
   17 |   for(int i=0;i<N;i++) {
      |               ^
a.cc:17:19: error: 'i' does not name a type
   17 |   for(int i=0;i<N;i++) {
      |                   ^
a.cc:41:2: error: 'cin' does not name a type
   41 |  cin >> M;
      |  ^~~
a.cc:43:1: error: expected unqualified-id before 'for'
   43 | for(int i=0;i<M;i++) {
      | ^~~
a.cc:43:13: error: 'i' does not name a type
   43 | for(int i=0;i<M;i++) {
      |             ^
a.cc:43:17: error: 'i' does not name a type
   43 | for(int i=0;i<M;i++) {
      |                 ^
a.cc:58:1: error: 'max' does not name a type
   58 | max = num.at(0)
      | ^~~
a.cc:59:13: error: 'i' does not name a type
   59 | for(int i=1;i<idx;i++) {
      |             ^
a.cc:59:19: error: 'i' does not name a type
   59 | for(int i=1;i<idx;i++) {
      |                   ^
a.cc:63:1: error: expected unqualified-id before 'if'
   63 | if(max < 0) max = 0;
      | ^~
a.cc:65:1: error: 'cout' does not name a type
   65 | cout<<max <<endl;
      | ^~~~
a.cc:74:7: error: expected unqualified-id before 'return'
   74 |       return 0;
      |       ^~~~~~
a.cc:75:5: error: expected declaration before '}' token
   75 |     }
      |     ^
Language: C++

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

int main() {
    int n, m;
    
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) cin >> blue.at(i);

    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) cin >> red.at(i);

    vector<string> cards(n) = blue();
    cards.insert(cards.end(), red.begin(), red.end());

    int max;
    for (int i = 0; i < n + m; i++) {
        int mon = 0;
        for (int j = 0; j < n; j++) {
            if (cards.at(i) == blue.at(j)) mon++; 
        }
        for (int j = 0; j < m; j++) {
            if (cards.at(i) == red.at(j)) mon--;
        }

        if (i == 0) max = mon;
        else if (max < mon) max = mon;
    }
    
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ',' or ';' before '=' token
   15 |     vector<string> cards(n) = blue();
      |                             ^
Language: C++

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

int main() {
    int n, m;
    
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) cin >> blue.at(i);

    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) cin >> red.at(i);

    vector<string> cards(n) = blue;
    cards.insert(cards.end(), red.begin(), red.end());

    int max;
    for (int i = 0; i < n + m; i++) {
        int mon = 0;
        for (int j = 0; j < n; j++) {
            if (cards.at(i) == blue.at(j)) mon++; 
        }
        for (int j = 0; j < m; j++) {
            if (cards.at(i) == red.at(j)) mon--;
        }

        if (i == 0) max = mon;
        else if (max < mon) max = mon;
    }
    
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ',' or ';' before '=' token
   15 |     vector<string> cards(n) = blue;
      |                             ^
Language: C++

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

int main() {
    int n, m;
    
    cin >> n;
    vector<string> blue(n);
    for (int i = 0; i < n; i++) cin >> blue.at(i);

    cin >> m;
    vector<string> red(m);
    for (int i = 0; i < m; i++) cin >> red.at(i);

    int max;
    for (int i = 0; i < n; i++) {
        int mon = 0;
        for (int j = 0; j < n; j++) {
            if (blue.at(j) == blue.at(i)) mon++; 
        }
        for (int j = 0; j < m; j++) {
            if (red.at(j) == blue.at(i)) mon--;
        }

        int max
        if (i == 0) max = mon;
        else if (max < mon) max = mon;
    }
    
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: expected initializer before 'if'
   26 |         if (i == 0) max = mon;
      |         ^~
a.cc:27:9: error: 'else' without a previous 'if'
   27 |         else if (max < mon) max = mon;
      |         ^~~~
Language: C++

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

int main(){
  int N,M;
  cin N;
  vector<int> s(N);
  for(int i=0;i<N;i++)
    cin >>s[i];
  cin M;
  vector<int> t(M);
  for(int i=0;i<M;i++)
    cin >>t[i];
  int answer=0;
  for(int i=0;i<N;i++){
    int csn=0;
    for(int j=i+1;j<N;j++){
      if(s[i]==s[j])
        csn++;
    }
    for(int k=0;k<M;k++){
      if(s[i]==t[k])
        csn--;
    }
    if(answer<csn)
      answer=csn;
  }
  cout <<answer <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:6: error: expected ';' before 'N'
    6 |   cin N;
      |      ^~
      |      ;
a.cc:10:6: error: expected ';' before 'M'
   10 |   cin M;
      |      ^~
      |      ;
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 0x3f3f3f3f;
const ll LINF = 1ll << 55;
const ll MOD = 1e9 + 7;
const ll MAXN = 400 + 5;
const ll MAXK = 1e5 + 10;

const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

int main() {
    ll N, M;
    cin >> N
    string s, t;
    unordered_map<string, ll> hashMap;
    for (int i = 0; i < N; ++i) {
        cin >> s;
        hashMap[s]++;
    }
    cin >> M;
    for (int j = 0; j < M; ++j) {
        cin >> t;
        hashMap[t]--;
    }
    ll ans = 0;
    for (auto& p : hashMap) {
        if (p.second > 0) {
            ans += p.second;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: expected ';' before 'string'
   19 |     cin >> N
      |             ^
      |             ;
   20 |     string s, t;
      |     ~~~~~~   
a.cc:23:16: error: 's' was not declared in this scope
   23 |         cin >> s;
      |                ^
a.cc:28:16: error: 't' was not declared in this scope
   28 |         cin >> t;
      |                ^
Language: C++

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

#define LOOP(val,times) for(val = 0;val < (times);++val)

int main(){
  int n,m,i,mx;
  string s;
  map <string,int> mp;
  scanf("%d",&n);
  LOOP(i,n){
    cin >> s;
    mp[s] ++;
  }
  scanf("%d",&m);
  LOOP(i,m){
    cin >> s;
    mp[s]--;
  }
  mx = 0;
  for(auto itr = mp.begin();itr != mp.end();++itr){
    mx = max(*itr->second,mx);
  }
  if(mx <= 0) printf("1");
  else printf("%d",mx);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: invalid type argument of unary '*' (have 'int')
   22 |     mx = max(*itr->second,mx);
      |              ^~~~~~~~~~~~
Language: C++

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

#define LOOP(val,times) for(val = 0;val < (times);++val)

int main(){
  int n,m,i,mx;
  string s;
  map <string,int> mp;
  scanf("%d",&n);
  LOOP(i,n){
    cin >> s;
    mp[s] ++;
  }
  scanf("%d",&m);
  LOOP(i,m){
    cin >> s;
    mp[s]--;
  }
  mx = 0;
  for(auto itr = mp.begin();itr != mp.end();itr++){
    mx = max(*itr->second,mx);
  }
  if(mx <= 0) printf("1");
  else printf("%d",mx);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: invalid type argument of unary '*' (have 'int')
   22 |     mx = max(*itr->second,mx);
      |              ^~~~~~~~~~~~