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

 #include <iostream>
 using std::cin;
 using std::cout;
 using std::endl;

 #include <map>
 using std::map;

#include <string>
 using std::string;

 map<string, int> memo;

 int main (void) {
 int n;

 scanf("%lld", &n);
 for (int i = 0; i < n; i++) {
 string s;
 cin >> s;

 memo[s] += 1;
 }


 int maxv = 0;
 for (const auto& x : memo) {
 int v = x.second;
 if (v > maxv) maxv = v;
 }
 for (auto it = memo.begin(); it != memo.end(); it++) {
 if (it->second == maxv) {
cout << it->first << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:33:27: error: expected '}' at end of input
   33 | cout << it->first << endl;
      |                           ^
a.cc:32:26: note: to match this '{'
   32 |  if (it->second == maxv) {
      |                          ^
a.cc:33:27: error: expected '}' at end of input
   33 | cout << it->first << endl;
      |                           ^
a.cc:31:55: note: to match this '{'
   31 |  for (auto it = memo.begin(); it != memo.end(); it++) {
      |                                                       ^
a.cc:33:27: error: expected '}' at end of input
   33 | cout << it->first << endl;
      |                           ^
a.cc:14:18: note: to match this '{'
   14 |  int main (void) {
      |                  ^
Language: Java

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		Map<String, Integer> count = new TreeMap<String, Integer>();
		String base = sc.next();
		count.put(base, 1);
		for (int i = 1; i < N; i++) {
			String temp = sc.next();
			if (!count.containsKey(temp)) {
				count.put(temp, 1);
			} else {
				count.replace(temp, (count.get(temp) + 1));
			}
		}
		int temp = 0;
		for (String k : count.keySet()) {
			temp = Math.max(temp, count.get(k));
		}
		for (String k : count.keySet()) {
			if (temp == count.get(k)) {
				System.out.println(k);
			}
		}
	}

Compiler output:
Main.java:28: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

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

int main(){
  int n;
  cin>>n;
  map<string,int>r;
  int mx=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    r[s]++;
    mx=max(r[s],mx);
  }
  for(auto p:r){
    if(p.sc==mx){
      cout<<p.fs<<endl;
    }
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'struct std::pair<const std::__cxx11::basic_string<char>, int>' has no member named 'sc'
   16 |     if(p.sc==mx){
      |          ^~
a.cc:17:15: error: 'struct std::pair<const std::__cxx11::basic_string<char>, int>' has no member named 'fs'
   17 |       cout<<p.fs<<endl;
      |               ^~
Language: C++

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

int main(){
  int n;
  cin>>n;
  map<string,int>r;
  int mx=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    r[s]++;
    mx=max(r[s],mx);
  }
  for(auto p:r){
    if(r.sc==mx){
      cout<<r.fs<<endl;
    }
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'sc'
   16 |     if(r.sc==mx){
      |          ^~
a.cc:17:15: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'fs'
   17 |       cout<<r.fs<<endl;
      |               ^~
Language: C++

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

int main(){
  int n;
  cin>>n;
  map<string,int>r;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    r[s]++;
  }
  int mx=0;
  for(int i=0;i<n;i++){
    mx=max(r[s],mx);
  }
  for(auto p:r){
    if(r.sc==mx){
      cout<<r.fs<<endl;
    }
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 's' was not declared in this scope
   15 |     mx=max(r[s],mx);
      |              ^
a.cc:18:10: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'sc'
   18 |     if(r.sc==mx){
      |          ^~
a.cc:19:15: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'fs'
   19 |       cout<<r.fs<<endl;
      |               ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  char s;
  ans=0;
  ans=max(s);
  cin>>n;
  for(i=0;i<=n;i++){
    cin>>s;
  }
 if(s=>1.times()){
   count++;
 }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    6 |   ans=0;
      |   ^~~
      |   abs
a.cc:7:10: error: no matching function for call to 'max(char&)'
    7 |   ans=max(s);
      |       ~~~^~~
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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:7:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'char'
    7 |   ans=max(s);
      |       ~~~^~~
/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:   candidate expects 2 arguments, 1 provided
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0;i<=n;i++){
      |       ^
a.cc:12:7: error: expected primary-expression before '>' token
   12 |  if(s=>1.times()){
      |       ^
a.cc:12:8: error: unable to find numeric literal operator 'operator""times'
   12 |  if(s=>1.times()){
      |        ^~~~~~~
a.cc:13:9: error: no post-increment operator for type
   13 |    count++;
      |         ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  int mx=0;
  map<string,int>dic;
  rep(i,n){
    cin>>s;
    mp[s]++;
    mx=max(mx,m[s]);
  }
  for(auto mp:dic){
    cout<<mp.sc<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'mp' was not declared in this scope; did you mean 'mx'?
   26 |     mp[s]++;
      |     ^~
      |     mx
a.cc:27:15: error: 'm' was not declared in this scope
   27 |     mx=max(mx,m[s]);
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  map<string,int>mp;
  int mx=0;
  vector<string> s(n);
  rep(i,n){
    cin>>s[i];
    mp[s[i]]++;
    mx=max(mx,mp[s[i]]);
  }
  for(auto dic:mp){
    if(dic[s[i]]==mx)
      cout<<dic.sc<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: 'i' was not declared in this scope
   30 |     if(dic[s[i]]==mx)
      |              ^
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),f=1;
    HashMap<String,Integer> map=new HashMap<String,Integer>();
    for(int i=0;i<n;i++){
      String s=sc.next();
      if(map.get(s)==null){
        map.put(s,1);
      }else{
        map.put(s,map.get(s)+1);
        if(map.get(s)>f){
          f=map.get(s);
        }
      }
    }
    for(String key:map.setKey()){
      if(map.get(key)==f){
        System.out.println(key);
      }
    }
    
  }
}


Compiler output:
Main.java:19: error: cannot find symbol
    for(String key:map.setKey()){
                      ^
  symbol:   method setKey()
  location: variable map of type HashMap<String,Integer>
1 error
Language: C++

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

int main() {
  long long n;
  cin>>n;
  map<string,int>mp;
  int max=0;
  for(long long i=0;i<n;i++){
    string s;
    cin>>s;
    mp[s]++;
    if(max<mp[s]){
      max=mp[s];
    }
  }
  vector<string>ans;
  for(auto x:mp){
    if(x.second==max){
      ans.push_back(x.first);
    }
  }
  sort(ans.begin(),ans.end());
  for(long long i=0;i<ans.size()){
    cout<<ans.at(i)<< endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: expected ';' before ')' token
   24 |   for(long long i=0;i<ans.size()){
      |                                 ^
      |                                 ;
Language: C++

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

int main() {
  long long n;
  cin>>n;
  map<strung,int>mp;
  int max=0;
  for(long long i=0;i<n;i++){
    string s;
    cin>>s;
    mp[s]++;
    if(max<mp[s]){
      max=mp[s];
    }
  }
  vector<string>ans;
  for(auto x:mp){
    if(x.second==max){
      ans.push_back(x.first);
    }
  }
  sort(ans.begin(),ans.end());
  for(long long i=0;i<ans.size()){
    cout<<ans.at(i)<< endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'strung' was not declared in this scope; did you mean 'trunc'?
    7 |   map<strung,int>mp;
      |       ^~~~~~
      |       trunc
a.cc:7:17: error: template argument 1 is invalid
    7 |   map<strung,int>mp;
      |                 ^
a.cc:7:17: error: template argument 3 is invalid
a.cc:7:17: error: template argument 4 is invalid
a.cc:12:7: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   12 |     mp[s]++;
      |       ^
a.cc:13:14: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   13 |     if(max<mp[s]){
      |              ^
a.cc:14:13: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   14 |       max=mp[s];
      |             ^
a.cc:18:14: error: 'begin' was not declared in this scope
   18 |   for(auto x:mp){
      |              ^~
a.cc:18:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:18:14: error: 'end' was not declared in this scope
   18 |   for(auto x:mp){
      |              ^~
a.cc:18:14: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:24:33: error: expected ';' before ')' token
   24 |   for(long long i=0;i<ans.size()){
      |                                 ^
      |                                 ;
Language: C++

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

int main() {
  long long n;
  cin>>n;
  map<strung,int>mp;
  int max=0;
  for(long long i=0;i<n;i++){
    string s;
    cin>>s;
    mp[s]++;
    chmax(max,mp[s]);
  }
  vector<string>ans;
  for(auto x:mp){
    if(x.second==max){
      ans.push_back(x.first);
    }
  }
  sort(ans.begin(),ans.end());
  for(long long i=0;i<ans.size()){
    cout<<ans.at(i)<< endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'strung' was not declared in this scope; did you mean 'trunc'?
    7 |   map<strung,int>mp;
      |       ^~~~~~
      |       trunc
a.cc:7:17: error: template argument 1 is invalid
    7 |   map<strung,int>mp;
      |                 ^
a.cc:7:17: error: template argument 3 is invalid
a.cc:7:17: error: template argument 4 is invalid
a.cc:12:7: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   12 |     mp[s]++;
      |       ^
a.cc:13:17: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   13 |     chmax(max,mp[s]);
      |                 ^
a.cc:13:5: error: 'chmax' was not declared in this scope; did you mean 'max'?
   13 |     chmax(max,mp[s]);
      |     ^~~~~
      |     max
a.cc:16:14: error: 'begin' was not declared in this scope
   16 |   for(auto x:mp){
      |              ^~
a.cc:16:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:16:14: error: 'end' was not declared in this scope
   16 |   for(auto x:mp){
      |              ^~
a.cc:16:14: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:22:33: error: expected ';' before ')' token
   22 |   for(long long i=0;i<ans.size()){
      |                                 ^
      |                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  map<string,int>>mp;
  rep(i,n){
    string s;
    cin>>s;
    mp[s]++;
  }
  sort(all(mp));
  int mx=0;
  rep(i,mp.size()){
    mx=max(mx,mp.sc);
  }
  rep(i,mp.size()){
    if(mp.sc==mx){
      cout<<mp.fs<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: expected unqualified-id before '>' token
   21 |   map<string,int>>mp;
      |                 ^~
a.cc:25:5: error: 'mp' was not declared in this scope
   25 |     mp[s]++;
      |     ^~
a.cc:27:12: error: 'mp' was not declared in this scope
   27 |   sort(all(mp));
      |            ^~
a.cc:4:16: note: in definition of macro 'all'
    4 | #define all(v) v.begin(),v.end()
      |                ^
Language: C++

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

int main()
{
   int n; cin>>n;
   
   map<string,int>s;
  
  
   for(int i=0;i<n;i++)
   {
        string a;
     
        cin>>a;
   
        s[a]++;
      
   }
  int mx =0;
  for(auto p:s) mx = max(mx,s.second);
   
   int cnt=0;
  
   for(auto x:s)
   {
        if(x.second==mx)
        {
            cout<<x.first<<endl;
        }
       else
       {
           continue;
       }   
     
   }
     

return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'second'
   21 |   for(auto p:s) mx = max(mx,s.second);
      |                               ^~~~~~
Language: C++

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

int main()
{
   int n; cin>>n;
   
   map<string,int>s;
  
  
   for(int i=0;i<n;i++)
   {
        string a;
     
        cin>>a;
   
        s[a]++;
      
   }
  int mx =0;
  for(auto p:s) mx = max(mx,s.second);
   
   int cnt=0;
  
   for(auto x:s)
   {
        if(s.second==mx)
        {
            cout<<p.first<<endl;
        }
       else
       {
           continue;
       }   
     
   }
     

return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'second'
   21 |   for(auto p:s) mx = max(mx,s.second);
      |                               ^~~~~~
a.cc:27:14: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'second'
   27 |         if(s.second==mx)
      |              ^~~~~~
a.cc:29:19: error: 'p' was not declared in this scope
   29 |             cout<<p.first<<endl;
      |                   ^
Language: Java


import java.util.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());

        Map<String, Integer> map = new HashMap<String, Integer>();
        for (int i = 0; i < N; i++) {
            String key = scanner.next();
            Integer count = map.get(key);
            map.put(key, (count == null) ? 1 : count + 1);
        }

        Integer max=0;
        for (String key : map.keySet()) {
            max = Math.max(max, map.get(key));
        }

        List<String> moji = new ArrayList<>();
        for (String key : map.keySet()) {
            if(map.get(key)  == max) moji.add(key);
        }
        moji.stream().sorted().collect(Collectors.toList()).forEach(System.out::println);
    }
}


Compiler output:
Main.java:26: error: cannot find symbol
        moji.stream().sorted().collect(Collectors.toList()).forEach(System.out::println);
                                       ^
  symbol:   variable Collectors
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());

        Map<String, Integer> map = new HashMap<String, Integer>();
        for (int i = 0; i < N; i++) {
            String key = scanner.next();
            Integer count = map.get(key);
            map.put(key, (count == null) ? 1 : count + 1);
        }

        Integer max=0;
        for (String key : map.keySet()) {
            max = Math.max(max, map.get(key));
        }

        List<String> moji = new ArrayList<>();
        for (String key : map.keySet()) {
            if(map.get(key)  == max) moji.add(key);
        }
        System.out.println(moji.stream().sorted().collect(Collectors.toList()));
    }
}


Compiler output:
Main.java:25: error: cannot find symbol
        System.out.println(moji.stream().sorted().collect(Collectors.toList()));
                                                          ^
  symbol:   variable Collectors
  location: class Main
1 error
Language: Java

mport java.util.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());

        Map<String, Integer> map = new HashMap<String, Integer>();
        for (int i = 0; i < N; i++) {
            String key = scanner.next();
            Integer count = map.get(key);
            map.put(key, (count == null) ? 1 : count + 1);
        }


        Integer max=0;
        for (String key : map.keySet()) {
            max = Math.max(max, map.get(key));
        }

        for (String key : map.keySet()) {
            if(map.get(key)  == max) System.out.println(key);
        }
    }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  vector<string> s(n);
  rep(i, n) cin >> s.at(i):;
  sort(s.begin(), s.end());
  ll m=0;
  vector<string> ans;
  rep(i, n){
    ll cnt=0;
    if(s.at(i)==s.at(i+1)) {
      cnt++;
    }
    else {
      if(cnt>m) {
        ans.clear();
        ans.at(0)=s.at(i);
        m=cnt;
      }
      else if(cnt=m){
        ans.push_back(s.at(i));
      }
      else if(cnt<m){
      }
    }
  }
  
  for(int i=0; i<ans.size(); i++) cout << ans.at(i) << endl;
  
        
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: expected ';' before ':' token
    8 |   rep(i, n) cin >> s.at(i):;
      |                           ^
      |                           ;
Language: C++

#include <bits/stdc++.h>
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 ma = 0;      //文字列の最大の登場回数
    for(auto a : m){
        ma = max(ma,a.second);
    }
  
    for(auto b : m){
        if(b.second != max){
            m.erase(b.first);
        }
    }

    for(auto c : m){
        cout << c.first << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator!='
   20 |         if(b.second != max){
      |            ~~~~~~~~~^~~~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    string S[N];
    for(int i=0; i<N; i++){
        cin >> S[i];
    }
    sort(S, S+N);
    int vote[200010]={0};
    int max_vote=0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            if(S[j]==S[i]){
                vote[i]++;
                max_vote = max(vote[i], max_vote);
            }
        }
    }

    for(int i=0; i<N; i++){
        if(vote[i]==max_vote){
            cout << S[i] << endl;
        }
    }
    return 0;
}

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

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    ll N;
    int j, mx=0, a=0;

    cin >> N;

    string S;
    map<string, int> memo;

    rep(i, N) {
        cin >> S;
        memo[S]++;
    }

    int mx = 0;

    for(auto& x: memo) {
        int v = x.second;
        mx = max(mx, v);
    }

    for(auto i=memo.begin(); i!=memo.end(); i++) {
        if(i->second == mx) {
            cout << i->first << endl;
        }
    }

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: redeclaration of 'int mx'
   22 |     int mx = 0;
      |         ^~
a.cc:10:12: note: 'int mx' previously declared here
   10 |     int j, mx=0, a=0;
      |            ^~
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[i];
  sort(a.begin(),a.end());
  int big=1;
  int kari=1;
  string r=s[0];
  int i=1;
  while(i<n){
    if(r==s[i]) {
      kari++;
      if(i==n-1) big=max(big,kari);
    }
    else{
      big=max(big,kari);
      kari=1;
      r=s[i];
    }
    i++;
  }
  i=1;
  kari=1;
  r=s[0];
  while(i<n){
    if(r==s[i]){
      kari++;
      if(i==n-1){
        if(kari==big) cout<<r<<endl;
      }
    }
    else{
      if(kari==big){
        cout<<r<<endl;
      }
      r=s[i];
      kari=1;
    }
    i++;
  }
  if(n==1) cout<<s[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'a' was not declared in this scope
    9 |   sort(a.begin(),a.end());
      |        ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
using namespace std;
int main() {
	int n;
	string ans="No";
	cin >>n;
	map<string,int>memo;
	rep(i,n){
		string s;
		cin >> s;
		memo[s]++;
	}
	int maxv=0;
	for(const auto& x :memo){
		maxv=max(maxv,x.second);
	}
	for(auto it=memo.begin();memo.end();it++){
		if (it->second==maxv){
			cout << it->first<<endl;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:42: error: could not convert 'memo.std::map<std::__cxx11::basic_string<char>, int>::end()' from 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} to 'bool'
   18 |         for(auto it=memo.begin();memo.end();it++){
      |                                  ~~~~~~~~^~
      |                                          |
      |                                          std::map<std::__cxx11::basic_string<char>, int>::iterator {aka std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator}
Language: C

#include <stdio.h>

int main()
{
 int n,cnt[200000],i,j,max=0;
 char s[200000][10];
 char stack[200000][10];
  
  scanf("%d", &n);
  
  for(i=0;i<n;i++)
    scanf("%s", s[i]);
  
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(s[i]==s[j])
        cnt[i]++;
    }
  }
  j=0;
  for(i=0;i<n;i++){
    if(cnt[i]=>max){
      max = cnt[i];
    }
  }
   for(i=0;i<n;i++){
     if(cnt[i]==max){
       stack[j]==s[i];
       j++;
     }
   }
    for(i = 0;i<j-1;i++){
      for(m=j-1;m>i;m--){
        if(stack[m-1][0]>stack[m][0]){
          char temp = stack[m];
          stack[m]=stack[m-1];
          stack[m-1]=temp;
        }
      }
    }
    
   for(i=0;i<j;i++)
    printf("%s", stack[i]);
  
  return 0:
  
}

Compiler output:
main.c: In function 'main':
main.c:22:15: error: expected expression before '>' token
   22 |     if(cnt[i]=>max){
      |               ^
main.c:33:11: error: 'm' undeclared (first use in this function)
   33 |       for(m=j-1;m>i;m--){
      |           ^
main.c:33:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:45:11: error: expected ';' before ':' token
   45 |   return 0:
      |           ^
      |           ;
Language: C

#include <stdio.h>
#include <stdlib.h>

#define NUM 200001
#define HASH 100000007

long long hash(char* s)
{
	long long x = 0;
	int i;
	for (i = 0; s[i] != 0; i++) {
		x += s[i] - 'a';
		x = x << 5;
	}
	return x;
}

int lex_smaller(char* s1, char* s2)
{
	int i;
	for (i = 0; s1[i] != 0 && s2[i] != 0; i++) {
		if (s1[i] < s2[i]) return 1;
		else if (s1[i] > s2[i]) return -1;
	}
	if (s1[i] == s2[i]) return 0;
	else if (s1[i] == 0) return 1;
	else return -1;
}

void push(char* s, char** heap, int* n)
{
	int i = *n;
	char *tmp;
	heap[(*n)++] = s;
	while (1) {
		if (i == 0) break;
		else if (lex_smaller(heap[i], heap[(i - 1) / 2]) == 1) {
			tmp = heap[(i - 1) / 2];
			heap[(i - 1) / 2] = heap[i];
			heap[i] = tmp;
			i = (i - 1) / 2;
		} else break;
	}
}

char* pop(char** heap, int* n)
{
	int i = 0, j;
	char *tmp, *output = heap[0];
	heap[0] = heap[--(*n)];
	while (1) {
		if (i * 2 + 1 >= *n) break;
		else if (i * 2 + 2 >= *n) j = i * 2 + 1;
		else if (lex_smaller(heap[i * 2 + 1], heap[i * 2 + 2]) == 1) j = i * 2 + 1;
		else j = i * 2 + 2;
		if (lex_smaller(heap[j], heap[i]) == 1) {
			tmp = heap[j];
			heap[j] = heap[i];
			heap[i] = tmp;
			i = j;
		} else break;
	}
	return output;
}

int main()
{
	int i, N;
	char S[NUM][11];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", S[i]);
	
	long long h;
	int j, k, count[NUM] = {}, type[NUM] = {}, hash[HASH] = {};
	for (i = 1, k = 0; i <= N; i++) {
		h = hash(S[i]);
		if (hash[h % HASH] > 0) {
			for (j = 0; j < k; j++) {
				if (lex_smaller(S[i], S[type[j]]) == 0) {
					count[j]++;
					break;
				}
			}
			if (j == k) type[k++] = i;
		} else {
			type[k++] = i;
			hash[h % HASH]++;
		}
	}

	int p = 0, max = -1, argmax[NUM] = {};
	for (j = 0; j < k; j++) {
		if (count[j] > max) {
			max = count[j];
			argmax[0] = j;
			for (; p > 0; argmax[--p] = 0);
		} else if (count[j] == max) argmax[++p] = j;
	}
	
	int n = 0;
	char **heap = (char**)malloc(sizeof(char*) * (++p));
	for (i = 0; i < p; i++) push(S[type[argmax[i]]], heap, &n);
	while (n > 0) printf("%s\n", pop(heap, &n));

	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:76:21: error: called object 'hash' is not a function or function pointer
   76 |                 h = hash(S[i]);
      |                     ^~~~
main.c:74:52: note: declared here
   74 |         int j, k, count[NUM] = {}, type[NUM] = {}, hash[HASH] = {};
      |                                                    ^~~~
Language: C

#include <stdio.h>

int main(void){
  int n,i,j,k,l;
  scanf("%d",&n);
  char str[n][][2];
  for(i=0;i<n;i++)
  scanf("%s",&str[i][][0]);
  for(j=0;j<n;j++)
    for(k=j+1;k<n;k++)
      if(str[j][][0] == str[k][][0])
        str[k][][1]+=1;
  for(l=0;l<n;l++)
    if(str[l][][1]<=str[l+1][][1])
      printf("%s",str[l+1][][0]);
  return 0;
}
        

Compiler output:
main.c: In function 'main':
main.c:6:8: error: array type has incomplete element type 'char[][2]'
    6 |   char str[n][][2];
      |        ^~~
main.c:6:8: note: declaration of 'str' as multidimensional array must have bounds for all dimensions except the first
main.c:8:22: error: expected expression before ']' token
    8 |   scanf("%s",&str[i][][0]);
      |                      ^
main.c:11:17: error: expected expression before ']' token
   11 |       if(str[j][][0] == str[k][][0])
      |                 ^
main.c:12:16: error: expected expression before ']' token
   12 |         str[k][][1]+=1;
      |                ^
main.c:14:15: error: expected expression before ']' token
   14 |     if(str[l][][1]<=str[l+1][][1])
      |               ^
main.c:15:28: error: expected expression before ']' token
   15 |       printf("%s",str[l+1][][0]);
      |                            ^
Language: C

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N;
	char S[200001][11];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", S[i]);
	
	int j, k, count[200001] = {};
	for (i = 1; i <= N; i++) {
		for (j = 1; j < i; j++) {
			for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
			if (S[i][k] == 0 && S[j][k] == 0) count[j]++;
		}
	}
	
	int max = 0, argmax[200001] = {}, p = 0;
	for (i = 1; i <= N; i++) {
		if (count[i] > max) {
			max = count[i];
			argmax[0] = i;
			for (; p > 0; argmax[--p] = 0);
		} else if (count[j] == max) argmax[++p] = i;
	}

	long long *code = (long long*)malloc(sizeof(long long) * (++p));
	int *flag = (int*)malloc(sizeof(int) * p);
	for (i = 0; i < p; i++) {
		flag[i] = 0;
		code[i] = 0;
		for (j = 0; j < 10; j++) {
			if (S[argmax[i]][j] != 0) code += S[argmax[i]][j] - 'a' + 1;
			code = code << 5;
		}
	}
	
	long long min;
	int argmin;
	for (i = 0; i < p; i++) {
		min = 1 << 60;
		for (j = 0; j < p; j++) {
			if (flag[j] == 0 && code[j] < min) {
				min = code[j];
				argmin = j;
			}
		}
		printf("%s\n", S[argmin]);
		flag[argmin] = 1;
	}

	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:37: error: invalid operands to binary << (have 'long long int *' and 'int')
   35 |                         code = code << 5;
      |                                     ^~
main.c:42:25: warning: left shift count >= width of type [-Wshift-count-overflow]
   42 |                 min = 1 << 60;
      |                         ^~
Language: C

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N;
	char S[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", S[i]);
	
	int j, k, count[200001] = {};
	for (i = 1; i <= N; i++) {
		for (j = 1; j < i; j++) {
			for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
			if (S[i][k] == 0 && S[j][k] == 0) count[j]++;
		}
	}
	
	int max = 0, argmax[200001] = {}, p = 0;
	for (i = 1; i <= N; i++) {
		if (count[i] > max) {
			max = count[i];
			argmax[0] = i;
			for (; p > 0; argmax[--p] = 0);
		} else if (count[j] == max) argmax[++p] = i;
	}

	long long *code = (long long*)malloc(sizeof(long long) * (++p));
	int *flag = (int*)malloc(sizeof(int) * p);
	for (i = 0; i < p; i++) {
		flag[i] = 0;
		code[i] = 0;
		for (j = 0; j < 10; j++) {
			if (S[argmax[i]][j] != 0) code += S[argmax[i]][j] - 'a' + 1;
			code = code << 5;
		}
	}
	
	long long min;
	int argmin;
	for (i = 0; i < p; i++) {
		min = 1 << 60;
		for (j = 0; j < p; j++) {
			if (flag[j] == 0 && code[j] < min) {
				min = code[j];
				argmin = j;
			}
		}
		printf("%s\n", S[argmin]);
		flag[argmin] = 1;
	}

	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:41: error: subscripted value is neither array nor pointer nor vector
   14 |                         for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
      |                                         ^
main.c:14:52: error: subscripted value is neither array nor pointer nor vector
   14 |                         for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
      |                                                    ^
main.c:14:63: error: subscripted value is neither array nor pointer nor vector
   14 |                         for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
      |                                                               ^
main.c:15:33: error: subscripted value is neither array nor pointer nor vector
   15 |                         if (S[i][k] == 0 && S[j][k] == 0) count[j]++;
      |                                 ^
main.c:15:49: error: subscripted value is neither array nor pointer nor vector
   15 |                         if (S[i][k] == 0 && S[j][k] == 0) count[j]++;
      |                                                 ^
main.c:34:41: error: subscripted value is neither array nor pointer nor vector
   34 |                         if (S[argmax[i]][j] != 0) code += S[argmax[i]][j] - 'a' + 1;
      |                                         ^
main.c:34:71: error: subscripted value is neither array nor pointer nor vector
   34 |                         if (S[argmax[i]][j] != 0) code += S[argmax[i]][j] - 'a' + 1;
      |                                                                       ^
main.c:35:37: error: invalid operands to binary << (have 'long long int *' and 'int')
   35 |                         code = code << 5;
      |                                     ^~
main.c:42:25: warning: left shift count >= width of type [-Wshift-count-overflow]
   42 |                 min = 1 << 60;
      |                         ^~
Language: C++

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

int main() {
  ll n;
  cin>>n;
  vector<string> s(n);
  rep(i,n)  cin>>s[i];
  ////
  sort(all(s));
  int M=0;
  map<string,int> ma;
  rep(i,n-1){
    if(s[i]==s[i+1]){
      ma[s[i]]++; 
    }
    else{
      
    }
  }
  rep(i,n){
    M=max(m,ma[s[i]]);
  }
  
  
  wakarannn
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: 'm' was not declared in this scope
   26 |     M=max(m,ma[s[i]]);
      |           ^
a.cc:30:3: error: 'wakarannn' was not declared in this scope
   30 |   wakarannn
      |   ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    int n = 0;
    cin >> n;
    vector<string> s;
    map<string,int> counter;
    string tmp = "";

    for(int i = 0; i < n;i++){
        cin >> tmp;
        s.push_back(tmp);
        counter[s[i]] ++;
    }

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

    for(int i = 0;i < counter.size();i++){
        if(auto j = counter.begin();j != counter.end();j++){
            if(j->second == max){
                cout << j->first << endl;
            }
            
        }
        
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:55: error: expected ')' before ';' token
   27 |         if(auto j = counter.begin();j != counter.end();j++){
      |           ~                                           ^
      |                                                       )
a.cc:27:56: error: 'j' was not declared in this scope
   27 |         if(auto j = counter.begin();j != counter.end();j++){
      |                                                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;




int main(){

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

    map<string, int> dict;

    for(int i = 0,i <  N;i++){
        dict[S[i]]++;
    }

    // 最大値を取る
    int max_v = 0;
    for (auto x : dict){    // first: key, second: value
        max_v = max(max_v, x.second);
    }

    // 最大値と同じ要素を検索
    vector<string> ans;
    for (auto x : dict){
        if(x.second==max_v) ans.push_back(x.first);
    }

    sort(ans.begin(), ans.end());

    for(auto ans_s: ans){
        cout << ans_s << endl;
    }

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: expected ';' before '<' token
   12 |     for(int i = 0,i <  N;i++) cin >> S[i];
      |                    ^~
      |                    ;
a.cc:12:21: error: expected primary-expression before '<' token
   12 |     for(int i = 0,i <  N;i++) cin >> S[i];
      |                     ^
a.cc:16:20: error: expected ';' before '<' token
   16 |     for(int i = 0,i <  N;i++){
      |                    ^~
      |                    ;
a.cc:16:21: error: expected primary-expression before '<' token
   16 |     for(int i = 0,i <  N;i++){
      |                     ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count = 1;
		int max = 0;
		String[] S = new String[N];
		for(int i = 0;i < N;i++){
			S[i] = sc.next();
		}
		Arrays.sort(S);
		Map<String,Integer> map = new TreeMap<>();
		for(int i = 0;i < N - 1;i++){
			if(S[i + 1].equals(S[i])){
				count++;
			}else{
				map.put(S[i],count);
				max = Math.max(max,count);
				count = 1;
			}
		}
		for(String key : map.keySet()){
			if(map.get(key) == max){
				Syste.out.println(key);
			}
		}
	}
}

Compiler output:
Main.java:25: error: package Syste does not exist
				Syste.out.println(key);
				     ^
1 error
Language: C++

#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  int n; cin  >>n;
  map<string,int> MAP;
  vector<string> s(n);
  rep(i,n) {
  string a;
  cin >>a;
  s[i]=a;
  MAP[a]++;
  }
  int count=0;
  for(string S:s)  count =max(count,MAP[S]);
  for(auto it:MAP) {
      if (it.second == count) {
      cout << it.first << endl;
      }
  //for(auto it=MAP.begin();it!=MAP.end();it++) if(MAP[it]==count) cout <<it<<endl;
  }

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

#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  int n; cin  >>n;
  map<string,int> MAP;
  vector<string> s(n);
  rep(i,n) {
  string a;
  cin >>a;
  s[i]=a;
  MAP[a]++;
  }
  int count=0;
  for(string S:s)  count =max(count,MAP[S]);
  for (auto it = MAP.begin(); it != MAP.end(); it++) {
      if (it.second == count) {
      cout << it.first << endl;
      }
  //for(auto it=MAP.begin();it!=MAP.end();it++) if(MAP[it]==count) cout <<it<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: 'class __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__debug::map<std::__cxx11::basic_string<char>, int>, std::bidirectional_iterator_tag>' has no member named 'second'
   33 |       if (it.second == count) {
      |              ^~~~~~
a.cc:34:18: error: 'class __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__debug::map<std::__cxx11::basic_string<char>, int>, std::bidirectional_iterator_tag>' has no member named 'first'
   34 |       cout << it.first << endl;
      |                  ^~~~~
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String A[] = new String[N];
    Map<String, Integer> map = new HashMap<String, Integer>();
    int max_cnt = 1;
    for(int i = 0; i < N;i++){
      A[i] = sc.next();
      if(map.containsKey(A[i])){
          map.put(A[i],map.get(A[i])+1);
          max_cnt = Math.max(max_cnt,map.get(A[i]));
      }else{
          map.put(A[i],1);
      }
    }
    ArrayList<String> ar = new ArrayList<String>();
    for(String key : map.keySet()){
        if(map.get(key) == max_cnt){
            ar.add(key);
        }
    }
    Collection.sort(ar);
    for(int i=0; i < ar.size(); i++){
        System.out.println(ar.get(i));
    }  
  }
}




Compiler output:
Main.java:24: error: cannot find symbol
    Collection.sort(ar);
              ^
  symbol:   method sort(ArrayList<String>)
  location: interface Collection
1 error
Language: Java

import java.util.*;
public class MainC{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String A[] = new String[N];
    Map<String, Integer> map = new HashMap<String, Integer>();
    int max_cnt =1;
    for(int i=0;i<N;i++){
      A[i] = sc.next();
      if(map.containsKey(A[i])){
          map.put(A[i],map.get(A[i])+1);
          max_cnt = Math.max(max_cnt,map.get(A[i]));
      }else{
          map.put(A[i],1);
      }
    }
    ArrayList<String> ar = new ArrayList<String>();
    for(String key : map.keySet()){
        if(map.get(key) == max_cnt){
            ar.add(key);
        }
    }
    for(int i=0; i < ar.size(); i++){
        System.out.println(ar.get(i));
    }  
  }
}



Compiler output:
Main.java:2: error: class MainC is public, should be declared in a file named MainC.java
public class MainC{
       ^
1 error
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args)  throws IOException{
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int S[] = new int[N];
    Map<String, Integer> map = new HashMap<String, Integer>();
    int max_cnt =1;
    for(int i=0;i<N;i++){
      A[i] = sc.next();
      if(map.containsKey(A[i])){
          map.put(A[i],map.get(A[i])+1);
          max_cnt = Math.max(max_cnt,map.get(A[i]));
      }else{
          map.put(A[i],1);
      }
    }
    ArrayList<String> ar = new ArrayList<String>();
    for(String key : map.keySet()){
        if(map.get(key) == max_cnt){
            ar.add(key);
        }
    }
    for(int i=0; i < ary.size(); i++){
        System.out.println(ary.get(0));
    }  
  }
}


Compiler output:
Main.java:3: error: cannot find symbol
  public static void main(String[] args)  throws IOException{
                                                 ^
  symbol:   class IOException
  location: class Main
Main.java:10: error: cannot find symbol
      A[i] = sc.next();
      ^
  symbol:   variable A
  location: class Main
Main.java:11: error: cannot find symbol
      if(map.containsKey(A[i])){
                         ^
  symbol:   variable A
  location: class Main
Main.java:12: error: cannot find symbol
          map.put(A[i],map.get(A[i])+1);
                  ^
  symbol:   variable A
  location: class Main
Main.java:12: error: cannot find symbol
          map.put(A[i],map.get(A[i])+1);
                               ^
  symbol:   variable A
  location: class Main
Main.java:13: error: cannot find symbol
          max_cnt = Math.max(max_cnt,map.get(A[i]));
                                             ^
  symbol:   variable A
  location: class Main
Main.java:15: error: cannot find symbol
          map.put(A[i],1);
                  ^
  symbol:   variable A
  location: class Main
Main.java:24: error: cannot find symbol
    for(int i=0; i < ary.size(); i++){
                     ^
  symbol:   variable ary
  location: class Main
Main.java:25: error: cannot find symbol
        System.out.println(ary.get(0));
                           ^
  symbol:   variable ary
  location: class Main
9 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,max=0;
	cin >> n;
	map(string,int) m; //宣言
	for(int i=0;i<n;i++){
		cin >> s;
		m.at(s)++; //入力
		if(m.at(s)>max){
			max = m.at(s);
		}
	}
	for(auto p:m){
		if(p.second == max){  //intを参照
			cout << p.first << endl; //stringを参照
		}

	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: missing template arguments before '(' token
    6 |         map(string,int) m; //宣言
      |            ^
a.cc:6:19: error: expected primary-expression before ',' token
    6 |         map(string,int) m; //宣言
      |                   ^
a.cc:6:20: error: expected primary-expression before 'int'
    6 |         map(string,int) m; //宣言
      |                    ^~~
a.cc:8:24: error: 's' was not declared in this scope
    8 |                 cin >> s;
      |                        ^
a.cc:9:17: error: 'm' was not declared in this scope
    9 |                 m.at(s)++; //入力
      |                 ^
a.cc:14:20: error: 'm' was not declared in this scope
   14 |         for(auto p:m){
      |                    ^