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

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

int main() {
  map<string, int> counter;
  
  int n;
  cin >> n;
  vector<string> plus(n);
  for (a:plus)
  {
    cin >> a;
    
    if(counter.count(a) == 0)
      counter.insert(pair <string, int> (a, 1));
    else
      counter.insert(pair <string, int> (a, counter.count(a)+1));
  }
  
  
  int m;
  cin >> m;
  vector<string> minus(m);
  for (b:plus)
  {
    cin >> b;
  if(counter.count(b) == 0)
      counter.insert(pair <string, int> (b, -1));
    else
      counter.insert(pair <string, int> (b, counter.count(a)-1));
  }
  
  counter.value_comp();
  if( counter.end()->secnd < 0)
    cout << 0 << endl;
  else
    cout << counter.end()->second << endl;
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: found ':' in nested-name-specifier, expected '::'
   10 |   for (a:plus)
      |         ^
      |         ::
a.cc:10:8: error: 'a' has not been declared
   10 |   for (a:plus)
      |        ^
a.cc:21:8: error: expected initializer before ';' token
   21 |   int m;
      |        ^
a.cc:22:11: error: expected ')' before ';' token
   22 |   cin >> m;
      |           ^
      |           )
a.cc:10:7: note: to match this '('
   10 |   for (a:plus)
      |       ^
a.cc:23:24: error: 'm' was not declared in this scope
   23 |   vector<string> minus(m);
      |                        ^
a.cc:24:9: error: found ':' in nested-name-specifier, expected '::'
   24 |   for (b:plus)
      |         ^
      |         ::
a.cc:24:8: error: 'b' has not been declared
   24 |   for (b:plus)
      |        ^
a.cc:33:21: error: could not convert 'counter.std::map<std::__cxx11::basic_string<char>, int>::value_comp()' from 'std::map<std::__cxx11::basic_string<char>, int>::value_compare' to 'bool'
   33 |   counter.value_comp();
      |   ~~~~~~~~~~~~~~~~~~^~
      |                     |
      |                     std::map<std::__cxx11::basic_string<char>, int>::value_compare
a.cc:34:3: error: expected primary-expression before 'if'
   34 |   if( counter.end()->secnd < 0)
      |   ^~
a.cc:33:24: error: expected ')' before 'if'
   33 |   counter.value_comp();
      |                        ^
      |                        )
   34 |   if( counter.end()->secnd < 0)
      |   ~~                    
a.cc:24:7: note: to match this '('
   24 |   for (b:plus)
      |       ^
a.cc:34:22: error: 'struct std::pair<const std::__cxx11::basic_string<char>, int>' has no member named 'secnd'; did you mean 'second'?
   34 |   if( counter.end()->secnd < 0)
      |                      ^~~~~
      |                      second
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 function 'int main()':
a.cc:10:28: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
   10 |                 cin >> blue(i);
      |                        ~~~~^~~
a.cc:16:27: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
   16 |                 cin >> red(i);
      |                        ~~~^~~
Language: C++

#include <bits/stdc++.h>
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 function 'int main()':
a.cc:8:28: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
    8 |                 cin >> blue(i);
      |                        ~~~~^~~
a.cc:14:27: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
   14 |                 cin >> red(i);
      |                        ~~~^~~
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(n);
  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 function 'int main()':
a.cc:28:17: error: could not convert 'blue' from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool'
   28 |   for(string t; blue){
      |                 ^~~~
      |                 |
      |                 std::vector<std::__cxx11::basic_string<char> >
a.cc:28:21: error: expected ';' before ')' token
   28 |   for(string t; blue){
      |                     ^
      |                     ;
Language: C++

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

int main(){
    int n,m;
    string s;
    map<string, int>m;

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        m[s]++;
    }
    cin >> m;
    for(int i=0;i<m;i++){
        cin >> s;
        m[s]--;
    }

    int ans=0;
    for(auto i=m.begin(); i!=m.end();i++)ans=max(i->second,ans);

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: conflicting declaration 'std::map<std::__cxx11::basic_string<char>, int> m'
    7 |     map<string, int>m;
      |                     ^
a.cc:5:11: note: previous declaration as 'int m'
    5 |     int n,m;
      |           ^
a.cc:12:10: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   12 |         m[s]++;
      |          ^
a.cc:17:10: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   17 |         m[s]--;
      |          ^
a.cc:21:18: error: request for member 'begin' in 'm', which is of non-class type 'int'
   21 |     for(auto i=m.begin(); i!=m.end();i++)ans=max(i->second,ans);
      |                  ^~~~~
a.cc:21:32: error: request for member 'end' in 'm', which is of non-class type 'int'
   21 |     for(auto i=m.begin(); i!=m.end();i++)ans=max(i->second,ans);
      |                                ^~~
Language: C++

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

int main(void){
  
  char s[100][10],t[100][10];
  int n,m;
  int i,j;
  int get,ans=0;
  
  scanf("%d",&n);
  
  for(i=0;i<=n;i++){
    
    scanf("%s",s[i]);
    
  }
  
  scanf("%d",&m);
  
  for(i=0;i<=m,;i++){
    
    scanf("%s",t[i]);
    
  }
  
  for(i=0;i<=n;i++){
    
    get=0;
    
    for(j=0;j<=n;j++){
      
      if(strcmp(s[i],s[j])==0){
        
        get++;
        
      }
      
    }
      
    for(j=0;j<=m;j++){ 
    
 	  if(strcmp(s[i],t[j])==0){
        
        get--;
        
      }
      
    }
    
    if(get>ans){
      
      ans=get;
      
    }
    
  }
    
  printf("%d",ans);
    
  return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: expected primary-expression before ';' token
   21 |   for(i=0;i<=m,;i++){
      |                ^
Language: C++

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

int main(void){
  
  char s[10][100],t[10][100];
  int n,m;
  int i,j;
  int get,ans=0;
  
  scanf("%d",&n);
  
  for(i=0;i<=n;i++){
    
    scanf("%s",s[][i]);
    
  }
  
  scanf("%d",&m);
  
  for(i=0;i<=m,;i++){
    
    scanf("%s",t[][i]);
    
  }
  
  for(i=0;i<=n;i++){
    
    get=0;
    
    for(j=0;j<=n;j++){
      
      if(strcmp(s[][i],s[][j])==0){
        
        get++;
        
      }
      
    }
      
    for(j=0;j<=m;j++){ 
    
 	  if(strcmp(s[][i],t[][j])==0){
        
        get--;
        
      }
      
    }
    
    if(get>ans){
      
      ans=get;
      
    }
    
  }
    
  printf("%d",ans);
    
  return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: expected primary-expression before ']' token
   15 |     scanf("%s",s[][i]);
      |                  ^
a.cc:21:16: error: expected primary-expression before ';' token
   21 |   for(i=0;i<=m,;i++){
      |                ^
a.cc:23:18: error: expected primary-expression before ']' token
   23 |     scanf("%s",t[][i]);
      |                  ^
a.cc:33:19: error: expected primary-expression before ']' token
   33 |       if(strcmp(s[][i],s[][j])==0){
      |                   ^
a.cc:33:26: error: expected primary-expression before ']' token
   33 |       if(strcmp(s[][i],s[][j])==0){
      |                          ^
a.cc:43:23: error: expected primary-expression before ']' token
   43 |           if(strcmp(s[][i],t[][j])==0){
      |                       ^
a.cc:43:30: error: expected primary-expression before ']' token
   43 |           if(strcmp(s[][i],t[][j])==0){
      |                              ^
Language: C++

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

int main(void){
  
  char s[10][100],t[10][100];
  int n,m;
  int i,j;
  int get,ans=0;
  
  scanf("%d",&n);
  
  for(i=0;i<=n,i++){
    
    scanf("%s",s[][i]);
    
  }
  
  scanf("%d",&m);
  
  for(i=0;i<=m,i++){
    
    scanf("%s",t[][i]);
    
  }
  
  for(i=0;i<=n;i++){
    
    get=0;
    
    for(j=0;j<=n;j++){
      
      if(strcmp(s[][i],s[][j])==0){
        
        get++;
        
      }
      
    }
      
    for(j=0;j<=m;j++){ 
    
 	  if(strcmp(s[][i],t[][j])==0){
        
        get--;
        
      }
      
    }
    
    if(get>ans){
      
      ans=get;
      
    }
    
  }
    
  printf("%d",ans);
    
  return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before ')' token
   13 |   for(i=0;i<=n,i++){
      |                   ^
      |                   ;
a.cc:15:18: error: expected primary-expression before ']' token
   15 |     scanf("%s",s[][i]);
      |                  ^
a.cc:21:19: error: expected ';' before ')' token
   21 |   for(i=0;i<=m,i++){
      |                   ^
      |                   ;
a.cc:23:18: error: expected primary-expression before ']' token
   23 |     scanf("%s",t[][i]);
      |                  ^
a.cc:33:19: error: expected primary-expression before ']' token
   33 |       if(strcmp(s[][i],s[][j])==0){
      |                   ^
a.cc:33:26: error: expected primary-expression before ']' token
   33 |       if(strcmp(s[][i],s[][j])==0){
      |                          ^
a.cc:43:23: error: expected primary-expression before ']' token
   43 |           if(strcmp(s[][i],t[][j])==0){
      |                       ^
a.cc:43:30: error: expected primary-expression before ']' token
   43 |           if(strcmp(s[][i],t[][j])==0){
      |                              ^
Language: C++

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

int main() {
  int N;
  cin>>N;
  
  // string型の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 max=-100;
  int count;
  string word;
  
  for(int i=0;i<N;++i){
    count=0;
    word=blue[i];
    for(int i=0;i<N;i++){
      if(word==blue[i])
        ++count;
    }
    for(int i=0;i<M;i++){
      if(word==red[i])
        --count;
    }
    
    if(max<count)
      max=count;
  }
  
  if(max<0)
    cout<<0<<endl;
  else
    cout<<max<<endl;
}


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

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

#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;

int main(){
  	int n,m,memo = 0,ans = 0;
  
  	cin >> n;
  	string s[n];
  	rep(i,n) cin >> s[i];
  
  	cin >> m;
  	string t[m];
  	rep(i,m) cin >> t[i];
  
  	rep(i,n){
      rep(j,n)
        if(s[i] == s[j]){
          memo++;
        }
      }
      rep(j,m){
        if(s[i] == t[j]){
          memo--;
        }
      }
  
  	 ans = max(memo,ans);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: 'i' was not declared in this scope
   27 |         if(s[i] == t[j]){
      |              ^
a.cc: At global scope:
a.cc:35:9: error: 'cout' does not name a type
   35 |         cout << ans << endl;
      |         ^~~~
a.cc:39:9: error: expected unqualified-id before 'return'
   39 |         return 0;
      |         ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

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

#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;

int main(){
  	int n,m,memo = 0,ans = 0;
  
  	cin >> n;
  	string s[n];
  	rep(i,n) cin >> s[i];
  
  	cin >> m;
  	string t[m];
  	rep(i,m) cin >> t[i];
  
  	rep(i,n){
      rep(i,n)
        if(s[i] == s[j]){
          memo++;
        }
      }
      rep(j,m){
        if(s[i] == t[j]){
          memo--;
        }
      }
  
  	 ans = max(memo,ans);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: 'j' was not declared in this scope
   22 |         if(s[i] == s[j]){
      |                      ^
a.cc:27:14: error: 'i' was not declared in this scope
   27 |         if(s[i] == t[j]){
      |              ^
a.cc: At global scope:
a.cc:35:9: error: 'cout' does not name a type
   35 |         cout << ans << endl;
      |         ^~~~
a.cc:39:9: error: expected unqualified-id before 'return'
   39 |         return 0;
      |         ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
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 i;
    int ans=0;
    for(int i=0;i<N;i++){
        //s_iと言うといくらもらえる？
        for(int j=0;j<N;j++){
            if(s.at(i) == s.at(j)) score[i]++;
        }
        for(int k=0;k<M;k++){
            if(s.at(i) == t.at(k)) score[i]--;
        }
        ans = max(score[i],ans);
    }
    
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:36: error: 'score' was not declared in this scope
   24 |             if(s.at(i) == s.at(j)) score[i]++;
      |                                    ^~~~~
a.cc:27:36: error: 'score' was not declared in this scope
   27 |             if(s.at(i) == t.at(k)) score[i]--;
      |                                    ^~~~~
a.cc:29:19: error: 'score' was not declared in this scope
   29 |         ans = max(score[i],ans);
      |                   ^~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: expected ';' before '}' token
   18 |         s[str]--
      |                 ^
      |                 ;
   19 |     }
      |     ~            
a.cc:22:27: error: expected ';' before '}' token
   22 |         max(ans,it.second)
      |                           ^
      |                           ;
   23 |     }
      |     ~                      
a.cc:22:12: warning: ignoring return value of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
   22 |         max(ans,it.second)
      |         ~~~^~~~~~~~~~~~~~~
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: declared here
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
Language: C++

s=gets.to_i.times.map{gets.chomp}
t=gets.to_i.times.map{gets.chomp}
puts [s.uniq.map{|x| s.count(x) - t.count(y)}.max, 0].max

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s=gets.to_i.times.map{gets.chomp}
      | ^
a.cc:2:1: error: 't' does not name a type
    2 | t=gets.to_i.times.map{gets.chomp}
      | ^
a.cc:3:1: error: 'puts' does not name a type
    3 | puts [s.uniq.map{|x| s.count(x) - t.count(y)}.max, 0].max
      | ^~~~
a.cc:3:46: error: expected unqualified-id before '.' token
    3 | puts [s.uniq.map{|x| s.count(x) - t.count(y)}.max, 0].max
      |                                              ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  map<string, int> yen{};
  int N,M;
  cin >> N;
  for(int i=0;i<N;i++){
    string s;
    cin >> s;
    if(yen.count(s)) yen[s] += 1;
    else yen.insert(make_pair(s,1));
  }
  cin >> M;
  for(int i=0;i<M;i++){
    string s;
    cin >> s;
    if(yen.count(s)) yen[s] -= 1;
    else yen.insert(make_pair(s,-1));
  }
  int max_yen = max_element(yen.begin(),yen.end());
  if( max_yen > 0) cout << max_yen << endl;
  else cout << 0 << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:28: error: cannot convert 'std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >' to 'int' in initialization
   39 |   int max_yen = max_element(yen.begin(),yen.end());
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  map<string, int> yen{};
  int N,M;
  cin >> N;
  for(int i=0;i<N;i++){
    string s;
    cin >> s;
    if(yen.count(s)) yen[s] += 1;
    else yen.insert(make_pair(s,1));
  }
  cin >> M;
  for(int i=0;i<M;i++){
    string s;
    cin >> s;
    if(yen.count(s)) yen[s] -= 1;
    else yen.insert(make_pair(s,-1));
  }
  int max_yen = max_element(yen.begin(),yen.end())
  if( max_yen > 0) cout << max_yen << endl;
  else cout << 0 << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:28: error: cannot convert 'std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >' to 'int' in initialization
   39 |   int max_yen = max_element(yen.begin(),yen.end())
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >
a.cc:41:3: error: 'else' without a previous 'if'
   41 |   else cout << 0 << endl;
      |   ^~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int n, m, x = 0;
  string s, t;
  
  vector<string>blue(n);
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> blue[i];
  }
  
  vector<string>red(m);
  cin >> 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;
        
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: expected ';' before '}' token
   33 |     ans = max(ans, calc(t))
      |                            ^
      |                            ;
   34 |   }
      |   ~
Language: C++

#! usr/bin/perl

use strict;
use warnings;


chomp(my $N = <STDIN>);
my %cards;
foreach (0..$N-1)
{
chomp (my $card = <STDIN>);
++$cards{$card};}
chomp(my $M = <STDIN>);
foreach  (0..$M-1)
{
chomp (my $card = <STDIN>);
--$cards{$card};
}


my @result = sort{
$cards{$b} <=> $cards{$a};
} keys %cards;

$cards{$result[0]}<0 ? print "0\n" :
print "$cards{$result[0]}\n";


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #! usr/bin/perl
      |  ^
a.cc:9:10: error: too many decimal points in number
    9 | foreach (0..$N-1)
      |          ^~~~~
a.cc:14:11: error: too many decimal points in number
   14 | foreach  (0..$M-1)
      |           ^~~~~
a.cc:21:4: error: stray '@' in program
   21 | my @result = sort{
      |    ^
a.cc:3:1: error: 'use' does not name a type
    3 | use strict;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use warnings;
      | ^~~
a.cc:7:6: error: expected constructor, destructor, or type conversion before '(' token
    7 | chomp(my $N = <STDIN>);
      |      ^
a.cc:8:1: error: 'my' does not name a type
    8 | my %cards;
      | ^~
a.cc:9:9: error: expected constructor, destructor, or type conversion before '(' token
    9 | foreach (0..$N-1)
      |         ^
a.cc:13:6: error: expected constructor, destructor, or type conversion before '(' token
   13 | chomp(my $M = <STDIN>);
      |      ^
a.cc:14:10: error: expected constructor, destructor, or type conversion before '(' token
   14 | foreach  (0..$M-1)
      |          ^
a.cc:21:1: error: 'my' does not name a type
   21 | my @result = sort{
      | ^~
a.cc:23:3: error: 'keys' does not name a type
   23 | } keys %cards;
      |   ^~~~
a.cc:25:1: error: '$cards' does not name a type
   25 | $cards{$result[0]}<0 ? print "0\n" :
      | ^~~~~~
a.cc:25:19: error: expected unqualified-id before '<' token
   25 | $cards{$result[0]}<0 ? print "0\n" :
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a;
  int ans = 0;
  string aa[a];
  for (int i = 0; i < a; i++) cin >> aa[i];
  cin >> b;
  string bb[b];
  for (int i = 0; i < b; i++) cin >> bb[i];
  for (int i = 0; i < a; i++) {
    int x = 0;
    for (int j = 0; j < a; j++) {
      if (aa[i] == aa[j]) x++;
    }
    for (int j = 0; j < b; j++) {
      if (aa[i] == bb[j]) x--;
    }
    ans = max(ans, x);
  }
  cout << ans << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: expected '}' at end of input
   22 |   cout << ans << endl;
      |                       ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

    #include <iostream>
    #include <string>
    #include <algorithm> 
    #include <cstdlib>
    using namespace std;
    int main(){
        int N,M,ans=0;
        cin >> N;
        char **s;
      	s = new *char(M);
        for(int i=0;i<N;i++){
          	s = new char(11);
            cin >> s[i];
        }
      	
        cin >> M;
        string *t;
      	t = new *char(M);
      	t = new char(11);
        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;j++){
                if(s[i]==s[j]){
                    x++;
                }
            }
            for(int j=0;j<N;j++){
                if(s[i]==t[j]){
                    x--;
            }
        }
            ans = max(ans,x);
        }
         cout << ans << endl;
      
    	
    }
       

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected type-specifier before '*' token
   10 |         s = new *char(M);
      |                 ^
a.cc:12:21: error: cannot convert 'char*' to 'char**' in assignment
   12 |                 s = new char(11);
      |                     ^~~~~~~~~~~~
      |                     |
      |                     char*
a.cc:18:17: error: expected type-specifier before '*' token
   18 |         t = new *char(M);
      |                 ^
a.cc:19:13: error: cannot convert 'char*' to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} in assignment
   19 |         t = new char(11);
      |             ^~~~~~~~~~~~
      |             |
      |             char*
Language: C++

    #include <iostream>
    #include <string>
    #include <algorithm> 
    #include <cstdlib>
    using namespace std;
    int main(){
        int N,M,ans=0;
        cin >> N;
        string *s;
      s = new string*(N);
        for(int i=0;i<N;i++){
            cin >> s[i];
        }
        cin >> M;
        string *t;
      t = new string*(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;j++){
                if(s[i]==s[j]){
                    x++;
                }
            }
            for(int j=0;j<N;j++){
                if(s[i]==t[j]){
                    x--;
            }
        }
            ans = max(ans,x);
        }
         cout << ans << endl;
      delete(s);
      delete(t);
    }
       

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: invalid conversion from 'int' to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} [-fpermissive]
   10 |       s = new string*(N);
      |                       ^
      |                       |
      |                       int
a.cc:10:11: error: cannot convert 'std::string**' {aka 'std::__cxx11::basic_string<char>**'} to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} in assignment
   10 |       s = new string*(N);
      |           ^~~~~~~~~~~~~~
      |           |
      |           std::string** {aka std::__cxx11::basic_string<char>**}
a.cc:16:23: error: invalid conversion from 'int' to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} [-fpermissive]
   16 |       t = new string*(M);
      |                       ^
      |                       |
      |                       int
a.cc:16:11: error: cannot convert 'std::string**' {aka 'std::__cxx11::basic_string<char>**'} to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} in assignment
   16 |       t = new string*(M);
      |           ^~~~~~~~~~~~~~
      |           |
      |           std::string** {aka std::__cxx11::basic_string<char>**}
Language: C++

#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
using namespace std;
int main(){
    long long N,M,ans=0;
    cin >> N;
    string s[105];
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    cin >> M;
    string t[105];
    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;j++){
            if(s[i]==s[j]){
                x++;
            }
        }
        for(int j=0;j<N;j++){
            if(s[i]==t[j]){
                x--;
        }
    }
        ans = max(ans,x);
    }
        if(ans<=0){
        cout << 0 << endl;
    }else{
        cout << ans << endl;
}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: no matching function for call to 'max(long long int&, int&)'
   30 |         ans = max(ans,x);
      |               ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   30 |         ans = max(ans,x);
      |               ~~~^~~~~~~
/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,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   30 |         ans = max(ans,x);
      |               ~~~^~~~~~~
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
using namespace std;
int main(){
    int N,M,ans=0;
    cin >> N;
    string s[1000];
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    cin >> M;
    string t[1000];
    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;j++){
            if(s[i]==s[j]){
                x++;
            }
        }
        for(int j=0;j<N;j++){
            if(s[i]==t[j]){
                x--;
        }
    }
        ans = max(ans,x);
    }
        if(ans<=0){
        cout << 0 << endl;
    }else{
        cout << ans << endl;
}
   

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int Na, Nb;
  cin >> Na;
  
  vector<string> s(Na);
  vector<int> num(Na);
  
  string word;
  
  for(int i = 0; i < Na; i++) {
    cin >> s.at(i);
  }
  cin >> Nb;
  vector<string> t(Nb);
  for(int i = 0; i < Nb; i++) {
    cin >> t.at(i);
  }
  for(int i = 0; i < Na; i++) {
    for(int j = 0; j < Na; j++) {
      if(s.at(i) == s.at(j)){
        num.at(i)++;
      }
    }
    for(int j = 0; j < Nb; j++) {
      if(s.at(i) == t.at(j)){
        num.at(i)--;
      }
    }
  }
  cout << max(int answer = *max_element(num.begin(), num.end()), 0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: expected primary-expression before 'int'
   33 |   cout << max(int answer = *max_element(num.begin(), num.end()), 0) << endl;
      |               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int Na, Nb;
  cin >> Na;
  
  vector<string> s(Na);
  vector<int> num(Na);
  
  string word;
  
  for(int i = 0; i < Na; i++) {
    cin >> s.at(i);
  }
  cin >> Nb;
  vector<string> t(Nb);
  for(i = 0; i < Nb; i++) {
    cin >> t.at(i);
  }
  for(int i = 0; i < Na; i++) {
    for(int j = 0; j < Na; j++) {
      if(s.at(i) == s.at(j)){
        num.at(i)++;
      }
    }
    for(int j = 0; j < Nb; j++) {
      if(s.at(i) == t.at(j)){
        num.at(i)--;
      }
    }
  }
  cout << max(int max = *max_element(num.begin(), num.end()), 0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i = 0; i < Nb; i++) {
      |       ^
a.cc:33:15: error: expected primary-expression before 'int'
   33 |   cout << max(int max = *max_element(num.begin(), num.end()), 0) << endl;
      |               ^~~
Language: C++

#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)
 
std::string n[120], m[120];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}
#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)
 
std::string n[100], m[100];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}


Compiler output:
a.cc:42:13: error: conflicting declaration 'std::string n [100]'
   42 | std::string n[100], m[100];
      |             ^
a.cc:6:13: note: previous declaration as 'std::string n [120]'
    6 | std::string n[120], m[120];
      |             ^
a.cc:42:21: error: conflicting declaration 'std::string m [100]'
   42 | std::string n[100], m[100];
      |                     ^
a.cc:6:21: note: previous declaration as 'std::string m [120]'
    6 | std::string n[120], m[120];
      |                     ^
a.cc:43:5: error: redefinition of 'int a'
   43 | int a, b, count, max = 0;
      |     ^
a.cc:7:5: note: 'int a' previously declared here
    7 | int a, b, count, max = 0;
      |     ^
a.cc:43:8: error: redefinition of 'int b'
   43 | int a, b, count, max = 0;
      |        ^
a.cc:7:8: note: 'int b' previously declared here
    7 | int a, b, count, max = 0;
      |        ^
a.cc:43:11: error: redefinition of 'int count'
   43 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:7:11: note: 'int count' previously declared here
    7 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:43:18: error: redefinition of 'int max'
   43 | int a, b, count, max = 0;
      |                  ^~~
a.cc:7:18: note: 'int max' previously defined here
    7 | int a, b, count, max = 0;
      |                  ^~~
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main()
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)
 
std::string n[120], m[120];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}
#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)
 
std::string n[120], m[120];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}
提出情報


Compiler output:
a.cc:42:13: error: redefinition of 'std::string n [120]'
   42 | std::string n[120], m[120];
      |             ^
a.cc:6:13: note: 'std::string n [120]' previously declared here
    6 | std::string n[120], m[120];
      |             ^
a.cc:42:21: error: redefinition of 'std::string m [120]'
   42 | std::string n[120], m[120];
      |                     ^
a.cc:6:21: note: 'std::string m [120]' previously declared here
    6 | std::string n[120], m[120];
      |                     ^
a.cc:43:5: error: redefinition of 'int a'
   43 | int a, b, count, max = 0;
      |     ^
a.cc:7:5: note: 'int a' previously declared here
    7 | int a, b, count, max = 0;
      |     ^
a.cc:43:8: error: redefinition of 'int b'
   43 | int a, b, count, max = 0;
      |        ^
a.cc:7:8: note: 'int b' previously declared here
    7 | int a, b, count, max = 0;
      |        ^
a.cc:43:11: error: redefinition of 'int count'
   43 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:7:11: note: 'int count' previously declared here
    7 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:43:18: error: redefinition of 'int max'
   43 | int a, b, count, max = 0;
      |                  ^~~
a.cc:7:18: note: 'int max' previously defined here
    7 | int a, b, count, max = 0;
      |                  ^~~
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main()
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~
a.cc:73:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   73 | 提出情報
      | ^~~~~~~~
Language: C++

#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)
 
std::string n[110], m[110];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}
#include <iostream>
#include <string>
#define REF1(j, k) for(int i = j; i <= k; i++)
#define REF2(h, i) for(int j = h; j <= i; j++)

std::string n[100], m[100];
int a, b, count, max = 0;
int main()
{
	std::cin >> a;
	REF1(1, a)
		std::cin >> n[i];
	std::cin >> b;
	REF1(1, b)
		std::cin >> m[i];
	REF1(1, a)
	{
		count = 0;
		REF2(1, a)
		{
			if(n[i] == n[j])
			{
				count++;
			}
			if(n[i] == m[j])
			{
				count--;
			}
			if(max < count)
			{
				max = count;
			}
		}
	}
	std::cout << max << std::endl;
}

Compiler output:
a.cc:42:13: error: conflicting declaration 'std::string n [100]'
   42 | std::string n[100], m[100];
      |             ^
a.cc:6:13: note: previous declaration as 'std::string n [110]'
    6 | std::string n[110], m[110];
      |             ^
a.cc:42:21: error: conflicting declaration 'std::string m [100]'
   42 | std::string n[100], m[100];
      |                     ^
a.cc:6:21: note: previous declaration as 'std::string m [110]'
    6 | std::string n[110], m[110];
      |                     ^
a.cc:43:5: error: redefinition of 'int a'
   43 | int a, b, count, max = 0;
      |     ^
a.cc:7:5: note: 'int a' previously declared here
    7 | int a, b, count, max = 0;
      |     ^
a.cc:43:8: error: redefinition of 'int b'
   43 | int a, b, count, max = 0;
      |        ^
a.cc:7:8: note: 'int b' previously declared here
    7 | int a, b, count, max = 0;
      |        ^
a.cc:43:11: error: redefinition of 'int count'
   43 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:7:11: note: 'int count' previously declared here
    7 | int a, b, count, max = 0;
      |           ^~~~~
a.cc:43:18: error: redefinition of 'int max'
   43 | int a, b, count, max = 0;
      |                  ^~~
a.cc:7:18: note: 'int max' previously defined here
    7 | int a, b, count, max = 0;
      |                  ^~~
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main()
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,m,i,j;
  char s[105];
  char t[105];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> s[i];
  }
  cin >> m;
  for(i=0;i<m;i++){
    cin >> t[i];
  }
  int x;
  int ans = 0;
  for(i=0;i<n;i++){
    x = 0;
    for(j=0;j<max(n,m);j++){
      if(j < n){
        if(s[i] == s[j]) x += 1;
      }
      if(j < m){
        if(s[i] == t[j]) x -= 1;
      }
    }
    if(x > ans){
      ans = x;
    }
  }
  int ans = x[0];
  for(i=1;i<n;i++){
    if(x[i] > ans){
      ans = x[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: redeclaration of 'int ans'
   32 |   int ans = x[0];
      |       ^~~
a.cc:17:7: note: 'int ans' previously declared here
   17 |   int ans = 0;
      |       ^~~
a.cc:32:14: error: invalid types 'int[int]' for array subscript
   32 |   int ans = x[0];
      |              ^
a.cc:34:9: error: invalid types 'int[int]' for array subscript
   34 |     if(x[i] > ans){
      |         ^
a.cc:35:14: error: invalid types 'int[int]' for array subscript
   35 |       ans = x[i];
      |              ^
Language: C++

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

int main(){
  int N;
  vector<string> B(N);
  for(int i=0;i<N;i++){
    cin >> B[i];
  }
  int M;
  vector<string> R(M);
  for(int i=0;i<M;i++){
    cin >> R[i];
  }
  int c =0;
  int d =0;
  for(int i=0;i<N;i++){

      for(int j=0;j<N;j++){
        if(N[i]==N[j]) c++;
      }
      for(int j=0;j<N;j++){
        if(N[i]==M[j]) c--;
      }
      if(d<c)d=c;

   }
  cout << d << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: invalid types 'int[int]' for array subscript
   20 |         if(N[i]==N[j]) c++;
      |             ^
a.cc:20:19: error: invalid types 'int[int]' for array subscript
   20 |         if(N[i]==N[j]) c++;
      |                   ^
a.cc:23:13: error: invalid types 'int[int]' for array subscript
   23 |         if(N[i]==M[j]) c--;
      |             ^
a.cc:23:19: error: invalid types 'int[int]' for array subscript
   23 |         if(N[i]==M[j]) c--;
      |                   ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    map<string, int> m;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        m[s]++;
    } 
    int M;
    cin >> M;
    for(int i = 0; i < M; i++){
        string t;
        cin >> t;
        m[t]--;
    } 
    
    int mx = (*max_element(m.begin(), m.end())).second;
    mx = max(mx, 0);

    cout << mx << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: error: 'max_element' was not declared in this scope
   24 |     int mx = (*max_element(m.begin(), m.end())).second;
      |                ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
 
vector<pair<string,int> > v;

int main(){
	
	int n,m;cin>>n>>m;
	rep(i,n)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,1));
	}
	
	rep(i,m)
	{
		string s;cin >> s;
		v.push_back(make_pair(s,-1));
	}
	int ans = 0;
	rep(i,n+m)
	{
		string name = v[i].first;
		int cost = v[i].second;
		rep(i,n+m)
		{
			if(name == v[j].first)cost = v[j].second;
		}
		ans = max(ans,cost);
	}
	
	cout << ans << endl;
}

//cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:32:38: error: 'j' was not declared in this scope
   32 |                         if(name == v[j].first)cost = v[j].second;
      |                                      ^
Language: C++

#include<stdio.h>

int main()
{
    char n[200],m[200];
    int N,M,x,y,z=0,sum[200]={1},an=1;

    scanf("%d",&N);
    for(x=0;x<N;x++)
        scanf(" %s",&n[x]);
    scanf("%d",&M);
    for(x=0;x<M;x++)
        scanf(" %s",&m[x]);

    for(x=0;x<N;x++){
        for(y=0;y<N;y++){a
            if(x!=y&&n[x]==n[y]){
                sum[x]++;
            }
        }
        for(y=0;y<M;y++){
            if(x!=y&&m[x]==m[y]){
                sum[x]--;
            }
        }
    }

    for(x=0;x<N;x++){
        if(an<sum[x]){
            an=sum[x];
        }
    }
    printf("%d",an);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: 'a' was not declared in this scope; did you mean 'an'?
   16 |         for(y=0;y<N;y++){a
      |                          ^
      |                          an
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,m;
  cin >> n;
  vector<string> s,t;
  for(int i=0; i<n; i++){
    cin>>s[i];
  }
  cin>>m;
  for(int j=0; j<m; j++){
    cin>>t[j];
  }
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  
  vector<int> sn(n),tn(m);
  fill(sn.begin(),sn.end(),1);
  fill(tn.begin(),tn.end(),-1);
  
  for(int i=0; i<n-1; i++){
    if(s[i]==s[i+1]){
      s.erase(s.begin()+i);
      sn.erase(sn.begin()+i);
      sn[i]++;
      n--;
    }
  }
  for(int i=0;i<m-1;i++){
    if(t[i]==t[i+1]){
      t.erase(t.begin()+i);
      tn.erase(tn.begin()+i);
      tn[i]--;
      m--;
    }
  }

  vector<int> ans(n+m+1);
  fill(ans.begin(),ans.end(),0);
  int ite=1;
  for(int i=0,j=0;i<n;i++){
    if(s[i]==t[j]){
      ans[ite++]=sn[i]+tn[j++];
    }else if(s[i]<t[j]){
      ans[ite++]=sn[i];
    }else{
      ans[ite++]=tn[j++];
      i--;
    }
  }

  cout<<ans[max_element(ans.begin(),ans.end())]<<endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:55:12: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   55 |   cout<<ans[max_element(ans.begin(),ans.end())]<<endl;
      |            ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~