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

#define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1001
#define MIN -100001
#define _MAX 100
int main(void)
{
	int x, max = 0, max_n = 0, cou = 0, word_num[MAX / 2] = { 0 }, m_i, m_j;
	string word[MAX / 2];
	char str[MAX];
	gets_s(str);
	for (int i = 0; str[i] != '\0'; ++i) {
		for (int j = 0; str[i] != ' '; ++j, ++i) {
			word[cou][j] = str[i];
		}
		++cou;
	}
	for (int i = 0; i < cou; ++i) {
		if (word[i].size > max) {
			max = word[i].size; m_i = i;
		}
		for (int j = 0; j < i; ++j) {
			if (word[i] == word[j]) {
				++word_num[j];
				if (word_num[j] > max_n) { max_n = word_num[j]; m_j = j; }
			}
		}
	}
	cout << word[m_i] << " " << word[m_j] << "\n";
}	

Compiler output:
a.cc: In function 'int main()':
a.cc:2:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
    2 | #define gets_s gets
      |                ^~~~
a.cc:16:9: note: in expansion of macro 'gets_s'
   16 |         gets_s(str);
      |         ^~~~~~
a.cc:24:29: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   24 |                 if (word[i].size > max) {
      |                     ~~~~~~~~^~~~
      |                                 ()
a.cc:25:39: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
   25 |                         max = word[i].size; m_i = i;
      |                                       ^~~~
Language: C++


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main (void){
    
    char str[1000];
    gets(str);
    char tango[500][33];
    int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0;
    char max[33];
    int max_l = INT_MIN;
    int max_numer = 0;
    int yokuderu = 0;
    int yokuderu_temp = 0;
    int yokuderu_number = 0;
    while(str[i++] != '\0')
    {
        if(str[i-1] == ' ')
        {
            if((i-1)-temp>max_l)
            {
                max_l = (i-1) -temp;
                max_numer = j;
            }
            while(temp<i-1)
                tango[j][l++] = str[temp++];
            temp = i;
            j++;
            l = 0;
        }
    }
    
 
        if((i-1)-temp>max_l)
        {
            max_l = (i-1) -temp;
            max_numer = j;
        }
        while(temp<i-1)
            tango[j][l++] = str[temp++];
        temp = i;
        j++;
        l = 0;
    /*???????????§??????????????????*/
    //cout <<"number is " << j << endl;
    
    for(int m = 0; m < j;m++)
    {
        for(int k = 0; k<j;k++)
        {
            if(m != k)
            {
                if(strcmp(tango[m], tango[k]) == 0)
                {
                    yokuderu_temp++;
                }
            }
        }
        if(yokuderu_temp >= yokuderu)
        {
            yokuderu = yokuderu_temp;
            yokuderu_number = m;
        }
        yokuderu_temp = 0;
    }
    REP(i,32)
    cout << tango[yokuderu_number][i];
    cout << " ";
    while(tango[max_numer][m++] != '\0')
        cout << tango[max_numer][m-1];
    m = 0;
        cout << endl;
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   19 |     gets(str);
      |     ^~~~
      |     getw
a.cc:23:17: error: 'INT_MIN' was not declared in this scope
   23 |     int max_l = INT_MIN;
      |                 ^~~~~~~
a.cc:8:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <utility>
  +++ |+#include <climits>
    8 | 
a.cc:65:20: error: 'strcmp' was not declared in this scope
   65 |                 if(strcmp(tango[m], tango[k]) == 0)
      |                    ^~~~~~
a.cc:8:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <utility>
  +++ |+#include <cstring>
    8 |
Language: C++

#include <string.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main (void){
    
    char str[1000];
    gets(str);
    char tango[500][33];
    int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0;
    char max[33];
    int max_l = INT_MIN;
    int max_numer = 0;
    int yokuderu = 0;
    int yokuderu_temp = 0;
    int yokuderu_number = 0;
    while(str[i++] != '\0')
    {
        if(str[i-1] == ' ')
        {
            if((i-1)-temp>max_l)
            {
                max_l = (i-1) -temp;
                max_numer = j;
            }
            while(temp<i-1)
                tango[j][l++] = str[temp++];
            temp = i;
            j++;
            l = 0;
        }
    }
    
 
        if((i-1)-temp>max_l)
        {
            max_l = (i-1) -temp;
            max_numer = j;
        }
        while(temp<i-1)
            tango[j][l++] = str[temp++];
        temp = i;
        j++;
        l = 0;
    /*???????????§??????????????????*/
    //cout <<"number is " << j << endl;
    
    for(int m = 0; m < j;m++)
    {
        for(int k = 0; k<j;k++)
        {
            if(m != k)
            {
                if(strcmp(tango[m], tango[k]) == 0)
                {
                    yokuderu_temp++;
                }
            }
        }
        if(yokuderu_temp >= yokuderu)
        {
            yokuderu = yokuderu_temp;
            yokuderu_number = m;
        }
        yokuderu_temp = 0;
    }
    REP(i,32)
    cout << tango[yokuderu_number][i];
    cout << " ";
    while(tango[max_numer][m++] != '\0')
        cout << tango[max_numer][m-1];
    m = 0;
        cout << endl;
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   20 |     gets(str);
      |     ^~~~
      |     getw
a.cc:24:17: error: 'INT_MIN' was not declared in this scope
   24 |     int max_l = INT_MIN;
      |                 ^~~~~~~
a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <utility>
  +++ |+#include <climits>
    9 |
Language: C++

#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(){
	char num[100], damy[100], damy2[100];
	char now;
	string ans;
	int n, i, j, lng, cut = 0, l_damy;
	while(1){

		cin >> n;
		if(n == 0) break;
		cin >> num;


		for(i = 0; i < n; i ++){
			lng = strlen(num);
			now = num[0];
			for(j = 0; j < lng; j++){
				if(now == num[j]){
					cut ++;
					now = num[j];
				}
				else{
				}
			}

			ans = damy;
			l_damy = strlen(damy);
			for(j = 0; j < l_damy; j ++){
				num[j] = damy[j];
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: 'strlen' was not declared in this scope
   20 |                         lng = strlen(num);
      |                               ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cstdlib>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s,vv;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++){
        cnt=0;
        for(j=0;j<v.size();j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<v[i].size()){
            vv=v[i];
            lmax=max(lmax,vv.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:21: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   44 |             lmax=max(lmax,vv.size());
      |                  ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:44:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   44 |             lmax=max(lmax,vv.size());
      |                  ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:44:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |             lmax=max(lmax,vv.size());
      |                  ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize;
    string s;
    vector<string> v;
    while(cin>>s){
        v.pb(s);
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++){
        cnt=0;
        for(j=0;j<v.size();j++){
            if(v[i]==v[j]){
                cnt++;
            }
        }
        if(nmax<cnt){
            nmax=max(cnt,nmax);
            nind=i;
        }
        if(lmax<v[i].size()){
            lmax=max(lmax,v.size());
            lind=i;
        }
    }
    cout << v[lind] << v[nind] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: no matching function for call to 'max(int&, std::vector<std::__cxx11::basic_string<char> >::size_type)'
   43 |             lmax=max(lmax,v.size());
      |                  ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:43:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'})
   43 |             lmax=max(lmax,v.size());
      |                  ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:43:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |             lmax=max(lmax,v.size());
      |                  ~~~^~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)


int main(){
    int i, j, times=0;
    string tmp,maxLength,maxTimes;
    map<string, int> sentences;
    maxLength=""
    while(cin>>tmp){
        if(tmp.length()>maxLength.length()){
            maxLength=tmp;
        }
        if(sentences.count(tmp)==0){
            sentences.insert(map<string,int>::value_type(tmp,1));
        }else{
            sentences[tmp]++;
        }
        if(sentences[tmp]>times){
            times=sentences[tmp];
            maxTimes=tmp;
        }
    }
    cout << maxTimes << maxLength << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: expected ';' before 'while'
   27 |     maxLength=""
      |                 ^
      |                 ;
   28 |     while(cin>>tmp){
      |     ~~~~~
Language: C++

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

int main(){
	string s;
	int m;
	map<string,int> mp;
	while(cin>>s){
		mp[s]++;
		m=max(m,s,size());
	}
	
	int x=0;
	
	for(auto &el:mp){
		if(x<el.second){
			x=el.second;
		}
	}
	
	for(auto &el:mp){
		if(x==el.second){
			cout<<el.first<<" ";
			break;
		}
	}
	
	for(auto &el:mp){
		if(m==el.first.size()){
			cout<<el.first<<endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:31: error: no matching function for call to 'size()'
   10 |                 m=max(m,s,size());
      |                           ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
Language: C++

//
//  main.cpp
//  kazane
//
//  Created by h3036136 on 2017/07/27.
//  Copyright ?? 2017??´ h3036136. All rights reserved.
#include <iostream>
#include <string>
using namespace std;
int main(){
    long saidai=0;
    //char f;
    int a=0,cnt=0,num=0,max=0;
    string str,tango[1000]={""},answer,ans;
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]==' '){
            for(int j=a;j<i;j++){
                /*if(isupper(str[j])){
                    f=str[j];
                    f=f+32;
                    str[j]=f;
                }*/
                tango[cnt]+=str[j];
            }
            cnt=cnt+1;
            a=i+1;
        }
    }
    for(int p=a;p<str.size();p++){
        tango[cnt]+=str[p];
    }
    
    
    
    for(int k=0;k<=cnt;k++){
        if(saidai<tango[k].size()){
            saidai=tango[k].size();
            ans=tango[k];
        }
    }
    
    for(int s=1;s<cnt;s++){
        for(int t=s+1;t<=cnt;t++){
            if(tango[s]==tango[t]){
                num=num+1;
            }
        }
        if(max<num){
            max=num;
            answer=tango[t];
        }
    }
    cout<<answer<<" "<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:26: error: 't' was not declared in this scope
   51 |             answer=tango[t];
      |                          ^
Language: C++

#include<iostream>

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  std::map<std::string, int> occ;
  //std::cin >> str;
  //std::cout << str << std::endl;

  std::cin >> str;
  maxlen = str;
  maxocc = str;

  while(std::cin >> str){
    if(str.size()>maxlen.size()){
      maxlen = str;
    }
    occ[str]++;
    if(occ[str]>occ[maxocc]){
      maxocc = str;
    }
  }

  std::cout << maxlen << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'map' is not a member of 'std'
    7 |   std::map<std::string, int> occ;
      |        ^~~
a.cc:2:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    1 | #include<iostream>
  +++ |+#include <map>
    2 | 
a.cc:7:23: error: expected primary-expression before ',' token
    7 |   std::map<std::string, int> occ;
      |                       ^
a.cc:7:25: error: expected primary-expression before 'int'
    7 |   std::map<std::string, int> occ;
      |                         ^~~
a.cc:19:5: error: 'occ' was not declared in this scope
   19 |     occ[str]++;
      |     ^~~
Language: C++

#include<iostream>

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  map<std::string, int> occ;
  //std::cin >> str;
  //std::cout << str << std::endl;

  std::cin >> str;
  maxlen = str;
  maxocc = str;

  while(std::cin >> str){
    if(str.size()>maxlen.size()){
      maxlen = str;
    }
    occ[str]++;
    if(occ[str]>occ[maxocc]){
      maxocc = str;
    }
  }

  std::cout << maxlen << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'map' was not declared in this scope
    7 |   map<std::string, int> occ;
      |   ^~~
a.cc:7:18: error: expected primary-expression before ',' token
    7 |   map<std::string, int> occ;
      |                  ^
a.cc:7:20: error: expected primary-expression before 'int'
    7 |   map<std::string, int> occ;
      |                    ^~~
a.cc:19:5: error: 'occ' was not declared in this scope
   19 |     occ[str]++;
      |     ^~~
Language: C++

#include<iostream>
#include<map>
#include<string>

int main(){
  std::string str;
  std::string maxlen;
  std::string maxocc;
  map<std::string, int> occ;
  //std::cin >> str;
  //std::cout << str << std::endl;

  std::cin >> str;
  maxlen = str;
  maxocc = str;

  while(std::cin >> str){
    if(str.size()>maxlen.size()){
      maxlen = str;
    }
    occ[str]++;
    if(occ[str]>occ[maxocc]){
      maxocc = str;
    }
  }

  std::cout << maxlen << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'map' was not declared in this scope
    9 |   map<std::string, int> occ;
      |   ^~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:9:18: error: expected primary-expression before ',' token
    9 |   map<std::string, int> occ;
      |                  ^
a.cc:9:20: error: expected primary-expression before 'int'
    9 |   map<std::string, int> occ;
      |                    ^~~
a.cc:21:5: error: 'occ' was not declared in this scope
   21 |     occ[str]++;
      |     ^~~
Language: C++

#include<stdio.h>
int main(void) {
   int i = 0;
   char s[1000][100];
   while ( scanf("%s", s[n] ) != EOF ) n++;
   for ( i = 0; i < n ; i ++ ) {
      
   printf("%s", s[2]);
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:26: error: 'n' was not declared in this scope
    5 |    while ( scanf("%s", s[n] ) != EOF ) n++;
      |                          ^
a.cc:6:21: error: 'n' was not declared in this scope
    6 |    for ( i = 0; i < n ; i ++ ) {
      |                     ^
a.cc:10:2: error: expected '}' at end of input
   10 | }
      |  ^
a.cc:2:16: note: to match this '{'
    2 | int main(void) {
      |                ^
Language: C++

#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
    map<string,int>m;
    string s;
    vector<string>v;
    while(cin>>s){
        if('A'<=s[0]&&s[0]<='Z'){
            s[0]=s[0]-'A'+'a';
        }
        m[s]++;
        v.push_back(s);
    }
    int ans1=-1;
    int ans2=-1;
    string ans1s;
    string ans2s;
    for(int i=0;i<v.size();i++){
        if(ans1<m[v[i]]){
            ans1=m[v[i]];
            ans1s=v[i];
        }
        if(ans2<v[i].size()){
            ans2=v[i].size();
            ans2s=v[i];
        }
    }
    cout<<ans1s<<" "<<ans2s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<string>v;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <map>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:8:18: error: expected primary-expression before '>' token
    8 |     vector<string>v;
      |                  ^
a.cc:8:19: error: 'v' was not declared in this scope
    8 |     vector<string>v;
      |                   ^
Language: C++

#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <chrono>
  
typedef struct LettersInfo {
    std::string letters;
    unsigned int count;??°
} lettersInfo_s;
  
int main()
{
    std::string paramStr;
    std::getline(std::cin, paramStr);
  
    std::vector<lettersInfo_s*> lettersList;
  
    std::string letters;
    std::istringstream stream(paramStr);
  
    unsigned int maxLength = 0;
    std::string maxLengthStr;
  
    while (std::getline(stream, letters, ' ')) {
        unsigned int len = letters.size();
        if ( len != 0) {
            if ( maxLength < len ) {
                maxLengthStr = letters;
                maxLength = len;
            }
 
            unsigned int loopCount;
            for (loopCount = 0; loopCount < lettersList.size(); loopCount++) {
                if ( lettersList[loopCount]->letters == letters ) {
                    ++lettersList[loopCount]->count;
                    break;
                }
            }
 
            if (loopCount == lettersList.size()) {
                lettersInfo_s* plettersInfo = new lettersInfo_s();
                plettersInfo->letters = letters;
                ++plettersInfo->count;
                lettersList.push_back(plettersInfo);
            }
        }
    }
  
    unsigned int maxCount = 0;
    std::string maxCountStr;
    while( lettersList.size() > 0 ) {
 
        lettersInfo_s* plettersInfo = lettersList.back();
 
        unsigned int count = plettersInfo->count;
        if (maxCount < count) {
            maxCountStr = plettersInfo->letters;
            maxCount = count;
        }
        delete plettersInfo;
        lettersList.pop_back();
    }
  
    std::cout << maxCountStr << " " << maxLengthStr << std::endl;
  
    return 0;
}

Compiler output:
a.cc:9:26: error: extended character ° is not valid in an identifier
    9 |     unsigned int count;??°
      |                          ^
a.cc:9:24: error: expected unqualified-id before '?' token
    9 |     unsigned int count;??°
      |                        ^
Language: C++

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

#define TEXT_MAXNUM 1000
#define WORD_MAXNUM 33

typedef struct tagStrings
{
	char	str[WORD_MAXNUM];
	int		length;
	int		count;
} Strings_t;

void main( void )
{
	char		inputString[TEXT_MAXNUM] = "";
	
	Strings_t	words[TEXT_MAXNUM / 2] = {{0}};	// words in text
	char		tmpStr[WORD_MAXNUM] = {0};		// work
	int			wordNum = 0;					// record word num
	int			readIdx = 0;					// text read pointer
	int			readWordCount = 0;				// readding word length
	
	while( readIdx < TEXT_MAXNUM )
	{
		if( inputString[readIdx] == '\0' )
		{	// end text
			// @todo
			break;
		}
		tmpStr[readWordCount] = inputString[readIdx];	// read char
		
		if( tmpStr[readWordCount] == ' ' )
		{	// space -> partition word
			if( readWordCount )
			{
				tmpStr[readWordCount] = '\0';
				// word grep & record
				int i=0;
				for( i; i < wordNum; i++)
				{
					if( strcmp(words[i].str, tmpStr) == 0 )
					{	// recorded
						words[i].count++;
						break;
					}
				}
				if( i >= wordNum )
				{	// new record
					strcpy(words[wordNum].str, tmpStr);
					words[wordNum].length = readWordCount;
					words[wordNum].count = 1;
					wordNum++;		// record num +1
				}
				
				readWordCount = 0;
			}
			// not readding word -> next read
			readIdx++;
		}
		else
		{
			readWordCount++;
			readIdx++;
		}
	}
	
	// most, max index
	int maxLenIdx = 0;
	int mostIdx = 0;
	
	for( int i = 0; i < wordNum; i++)
	{
		int maxMost = 0;
		int maxLen  = 0;
		
		if( maxMost < words[i].count )
		{
			maxMost = words[i].count;
			mostIdx = i;
		}
		if( maxLen < words[i].length )
		{
			maxLen = words[i].length;
			maxLenIdx = i;
		}
	}
	
	// dump
	printf("%s %s\n", words[mostIdx].str, words[maxLenIdx].str);
	
	return;
}

Compiler output:
a.cc:14:1: error: '::main' must return 'int'
   14 | void main( void )
      | ^~~~
a.cc: In function 'int main()':
a.cc:92:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   92 |         return;
      |         ^~~~~~
Language: C++

#include<iostream>
#include<map>
#include<string>
using namespace std;
int main(){
	string b,mx; map<string,int> d;
	while(cin>>b){
		d[b]++; if(b.size()>mx.size())mx=b;
	}
	cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'max_element' was not declared in this scope
   10 |         cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<endl;
      |               ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  string str[1000];
  int appear[1000];
  int i, j, n=0;
  int maxlen, maxleni;
  int maxappear, maxappeari;

  while(cin>>string[n]){
    for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]);
    n++;
  }
  maxlen=0;
  for(i=0; i<n; i++){
    if(maxlen<string[i].size()){
      maxlen=string[i].size();
      maxleni=i;
    }
  }
  for(i=0; i<n; i++) appear[i]=0;
  for(i=0; i<n; i++){
    if(string[i].empty()) continue;
    for(j=i+1; j<n; j++)
      if(string[i]==string[j]){
        appear[i]++;
        string[j][0]='\0';
      }
  }
  maxappear=0;
  for(i=0; i<n; i++){
    if(maxappear<appear[i]){
      maxappear=appear[i];
      maxappeari=i;
    }
  }
  cout<<string[maxappeari]<<" "<<string[maxlen]<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected primary-expression before '[' token
   11 |   while(cin>>string[n]){
      |                    ^
a.cc:12:22: error: expected primary-expression before '[' token
   12 |     for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]);
      |                      ^
a.cc:12:45: error: structured binding declaration cannot have type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   12 |     for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]);
      |                                             ^~~
a.cc:12:45: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:48: error: expected initializer before '[' token
   12 |     for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]);
      |                                                ^
a.cc:12:48: error: expected ';' before '[' token
a.cc:17:21: error: expected primary-expression before '[' token
   17 |     if(maxlen<string[i].size()){
      |                     ^
a.cc:18:20: error: expected primary-expression before '[' token
   18 |       maxlen=string[i].size();
      |                    ^
a.cc:24:14: error: expected unqualified-id before '[' token
   24 |     if(string[i].empty()) continue;
      |              ^
a.cc:26:16: error: expected unqualified-id before '[' token
   26 |       if(string[i]==string[j]){
      |                ^
a.cc:28:15: error: structured binding declaration cannot have type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   28 |         string[j][0]='\0';
      |               ^~~
a.cc:28:15: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:28:18: error: expected initializer before '[' token
   28 |         string[j][0]='\0';
      |                  ^
a.cc:28:18: error: expected ';' before '[' token
a.cc:38:15: error: expected primary-expression before '[' token
   38 |   cout<<string[maxappeari]<<" "<<string[maxlen]<<endl;
      |               ^
a.cc:38:40: error: expected primary-expression before '[' token
   38 |   cout<<string[maxappeari]<<" "<<string[maxlen]<<endl;
      |                                        ^
Language: C++

#include<cstdio>
#include<cstring>
#include<string>

using namespace std;

string s[1001];
int count[1001];

int main(void){
	char temp[1001];
	
	while(gets(temp) != 0){
		int temp_n = strlen(temp);
		int c = 0;
		int max_h = 0;
		int max_H = 0;
		int max_l = 0;
		int max_L = 0;
		
		for(int i = 0; i < 1001; i++){
			s[i] = "";
			count[i] = 0;
		}
		
		for(int i = 0; i < temp_n; i++){
			for(int j = i; ; j++){
				if(temp[j] == ' '){
					i=j;
					c++;
					break;
				}else if(temp[j] == '\0'){
					i=j;
					c++;
					break;
				}
				s[c] += temp[j];
			}
		}
		
		for(int i = 0; i < c; i++){
			for(int j = 0; j < c; j++){
				if(i == j)continue;
				if(s[i] == s[j])count[i]++;
			}
		}
		
		for(int i = 0 ; i < c; i++){
			if(s[i].size() > max_L)max_l = i;
			if(count[i] > max_H)max_h = i;
		}
		
		printf("%s %s\n", s[max_h].c_str(), s[max_l].c_str() );
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         while(gets(temp) != 0){
      |               ^~~~
      |               getw
Language: C++

#include<iostream>
#include<map>
#include<string>
#include<stdio.h>
using namespace std;

bool compare(const pair<string, int> T1, const pair<string, int> T2) {
	return T1.second < T2.second;
}

int main (void){

	string str,maxByLength("");
	//map<int,string> X; //¶Ì·³
	map<string,int> Y; //¶Ì
	//int mm;

	while (cin>>str){
		if (str.size()>maxByLength.size())	maxByLength=str;
		Y[str]++;
	}

	// string maxByCount("");
	// int cnt = 0;
	pair<string, int> maxCountPair = *max_element(Y.begin(), Y.end(), compare);

	// cout << (*Y.rbegin()).first << " " << maxByLength << endl;
	// cout << maxByCount << " " << maxByLength << endl;
	cout << maxCountPair.first << " " << maxByLength << endl;

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:43: error: 'max_element' was not declared in this scope
   25 |         pair<string, int> maxCountPair = *max_element(Y.begin(), Y.end(), compare);
      |                                           ^~~~~~~~~~~
Language: C++

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

int main(){
	// word[s] Å ¶ñsÌo»ñªÔÁÄ­é
	map<string, int> word;
	vector<string> v;
	string s;
	int max=0,length=0;

	while( cin >> s ){
		v.push_back(s);
		
		//üÍµ½Pêª·ÅÉ é©T·
		if( word.count(s) ){
			word[s]++;
		}else{
			word[s] = 1;
		}
	}
	// ÅpoÌPêð²×é
	int mode=0;
	for(int i=0 ; i < v.size() ; i++ ){
		mode = max( mode , word[ v[i] ] );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( mode == word[ v[i] ] ){
			cout << v[i];
		}
	}
	// Å·ÌPêðßé
	int length = 0;
	for(int i=0 ; i < v.size() ; i++ ){
		length = max( length , v[i].size() );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( length == v[i].size() ){
			cout << " " << v[i] << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: 'max' cannot be used as a function
   27 |                 mode = max( mode , word[ v[i] ] );
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:35:13: error: redeclaration of 'int length'
   35 |         int length = 0;
      |             ^~~~~~
a.cc:12:19: note: 'int length' previously declared here
   12 |         int max=0,length=0;
      |                   ^~~~~~
a.cc:37:29: error: 'max' cannot be used as a function
   37 |                 length = max( length , v[i].size() );
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
	// word[s] Å ¶ñsÌo»ñªÔÁÄ­é
	map<string, int> word;
	vector<string> v;
	string s;

	while( cin >> s ){
		v.push_back(s);
		
		//üÍµ½Pêª·ÅÉ é©T·
		if( word.count(s) ){
			word[s]++;
		}else{
			word[s] = 1;
		}
	}
	// ÅpoÌPêð²×é
	int mode=0;
	for(int i=0 ; i < v.size() ; i++ ){
		mode = max( mode , word[ v[i] ] );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( mode == word[ v[i] ] ){
			cout << v[i];
		}
	}
	// Å·ÌPêðßé
	int length = 0;
	for(int i=0 ; i < v.size() ; i++ ){
		length = max( length , v[i].size() );
	}
	for(int i=0 ; i < v.size() ; i++ ){
		if( length == v[i].size() ){
			cout << " " << v[i] << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:29: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   36 |                 length = max( length , v[i].size() );
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:36:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   36 |                 length = max( length , v[i].size() );
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <cstdint>

typedef std::map<std::string, std::uint32_t> OccurenceWordMap;

class compare_second {
		typedef OccurenceWordMap::value_type value_type;
	public:
		bool operator()(value_type const& lhs, value_type const& rhs) const
		{
			return lhs.second < rhs.second;
		}
};

class compare_length {
		typedef std::string value_type;
	public:
		bool operator()(value_type const& lhs, value_type const& rhs) const
		{
			return lhs.length() < rhs.length();
		}
};

int main()
{
	std::string input_text;
	std::getline(std::cin, input_text);
	typedef std::vector<std::string> StringVec;
	StringVec word_vec;
	boost::algorithm::split(word_vec, input_text, boost::algorithm::is_space());
	OccurenceWordMap ow_map;
	for (std::string const& word : word_vec) {
		auto i = ow_map.lower_bound(word);
		if (i != ow_map.end() && !(ow_map.key_comp()(word, i->first))) {
			++i->second;
		}
		else {
			ow_map.emplace(word, 0);
		}
	}
	std::cout << std::max_element(ow_map.begin(), ow_map.end(), compare_second())->first << ' '
			  << *std::max_element(word_vec.begin(), word_vec.end(),  compare_length()) << std::endl;
	return 0;
}

Compiler output:
a.cc:6:10: fatal error: boost/algorithm/string.hpp: No such file or directory
    6 | #include <boost/algorithm/string.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<map>
#include<algorithm>

using namespace std;

int main(void){
  char s[1001][33];
  map<string,int>wd;
  int i=0;

  while(~scanf("%s",&s[i][0])){i++;}

  for(int j=0;j<i;j++)
    wd[s[j]]=0;

  for(int j=0;j<i;j++)
    wd[s[j]]++;

  int ans=0,len=0;
  for(int j=0;j<i;j++){
    ans=max(wd[s[j]],ans);
    len=max(len,(int)strlen(&s[j][0]));
  }

  string s1,s2;
  for(int j=0;j<i;j++){
    if(ans==wd[s[j]])s1=s[j];
    if(len==strlen(s[j]))s2=s[j];
  }
  cout << s1 << " " << s2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'strlen' was not declared in this scope
   23 |     len=max(len,(int)strlen(&s[j][0]));
      |                      ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | 
a.cc:29:13: error: 'strlen' was not declared in this scope
   29 |     if(len==strlen(s[j]))s2=s[j];
      |             ^~~~~~
a.cc:29:13: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

const int M = 33;
const int N = 1001;

char text[N];
char word[N][M];
char tmp[M], ansm[M], ansl[M]; 

void solve(char text[]) {
	qsort(word, k, sizeof(word[0]), cmp);
	int maxs = -1;
	int cnt = 1;
	strcpy(tmp, word[0]);
	strcpy(ansl, word[0]);
	int maxl = strlen(word[0]);
	for (int i=1; i<k; ++i) {
		if (maxl < strlen(word[i])) maxl = strlen(word[i]), strcpy(ansl, word[i]);
		if (!strcmp(tmp, word[i])) ++cnt;
		else {
			if (maxs < cnt) {
				maxs = cnt;
				strcpy(ansm, tmp);
			}
			cnt = 1;
			strcpy(tmp, word[i]);
		}
	}
	if (maxs < cnt) strcpy(ansm, tmp);
}

int main() {
	int i = 0;
	while (scanf("%s", word[i++]) != EOF);
	solve(i);
	cout<<ansm<<" "<<ansl<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void solve(char*)':
a.cc:16:21: error: 'k' was not declared in this scope
   16 |         qsort(word, k, sizeof(word[0]), cmp);
      |                     ^
a.cc:16:41: error: 'cmp' was not declared in this scope; did you mean 'tmp'?
   16 |         qsort(word, k, sizeof(word[0]), cmp);
      |                                         ^~~
      |                                         tmp
a.cc: In function 'int main()':
a.cc:40:15: error: invalid conversion from 'int' to 'char*' [-fpermissive]
   40 |         solve(i);
      |               ^
      |               |
      |               int
a.cc:15:17: note:   initializing argument 1 of 'void solve(char*)'
   15 | void solve(char text[]) {
      |            ~~~~~^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
    string str,s,mls,mcs,input[32];
    map <string,int> dic;
    int n,c,a,ml,mc;
    getline(cin,str)
        c = a = mc = ml = 0;
        str += ' ';
        while(str.length()){
            n = str.find(' ');
            s = str[c];
            ++c;
            for(;c < n;++c){
                s += str[c];
            }
            str.erase(0,n+1);
            c = 0;
            input[a] = s;
            ++a;
            ++dic[s];
            if(s.length() > ml) {
                ml = s.length();
                mls = s;
            }
        }
        for(int i = 0;i < a;++i){
            if(mc < dic[input[i]]){
                mc = dic[input[i]];
                mcs = input[i];
            }
       
        cout << mcs << " " << mls << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected ';' before 'c'
    9 |     getline(cin,str)
      |                     ^
      |                     ;
   10 |         c = a = mc = ml = 0;
      |         ~
Language: C++

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

typedef pair<int,string> P;

int main(void)
{

	char c;
	string str,maxstr;
	P d[1001] = {};	

	while(scanf("%c", &c), c != '\n'){
		if(c != ' '){
			str += c;
		}
		else {
			if(strlen(str.c_str()) > strlen(maxstr.c_str())){
				maxstr.clear();
				maxstr = str;
			}
			int i;
			for(i = 0; d[i].first != 0; i++){
				if(d[i].second == str){
					d[i].first++;
					break;
				}
			}
			if(d[i].first == 0){
				d[i] = P(1,str);
			}
			str.clear();
		}
	}
	if(strlen(str.c_str()) > strlen(maxstr.c_str())){
		maxstr.clear();
		maxstr = str;
	}
	int i;
	for(i = 0; d[i].first != 0; i++){
		if(d[i].second == str){
			d[i].first++;
			break;
		}
	}
	if(d[i].first == 0){
		d[i] = P(1,str);
	}
	str.clear();

	sort(d,d+1001);
	cout << d[1000].second << ' ' << maxstr << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: 'strlen' was not declared in this scope
   20 |                         if(strlen(str.c_str()) > strlen(maxstr.c_str())){
      |                            ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:37:12: error: 'strlen' was not declared in this scope
   37 |         if(strlen(str.c_str()) > strlen(maxstr.c_str())){
      |            ^~~~~~
a.cc:37:12: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char a[1010][100];
char b[10000];
int main()
{
	int i,j,l,s,m,n,p,k,s1,s2;
	while(gets(b))
	{
		l=strlen(b);
		j=0;p=0;n=0;s=0;
		for(i=0;i<l;i++)
		{
			if(b[i]!=' ')
			{
				char t=b[i];
				a[j][p++]=b[i];
			}
			else
			{
			//	cout<<p<<" --"<<endl;
				if(p>n)
				{
					n=p;
					m=j;
				}
				j++;
				p=0;
			}
		}
          if(p>n)
				{
					n=p;
					m=j;
				}
		int t=0;
		for(i=0;i<=j;i++)
		{
			s=0;
			for(s1=0;s1<=j;s1++)
			{
				if(strcmp(a[i],a[s1])==0)
					s++;
			}
			if(s>t)
			{
				t=s;
				s2=i;
			}
		}
		cout<<a[s2]<<" "<<a[m]<<endl;
	}
}

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

#include<stdio.h>
#include<string.h>
char str[33];
int lmax=0;
char mword[33];
typedef struct{
	char word[33];
	int time;
}data;
data d[1000];
int cd=0;
int i;
int main(){
	while(scanf("%s",str)!=EOF){
		if(strlen(str)>lmax){
			lmax=strlen(str);
			strcpy(mword,str);
		}
		for(i=0;i<cd;i++)if(strcmp(d[i].word,str)==0){
			d[i].time++;
			break;
		}
		if(i==cd){
			strcpy(d[cd].word,str);
			d[cd++].time=1;
		}
		}
	}
	int fm=0;
	for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
	printf("%s %s\n",d[fm].word,mword);
}
		

Compiler output:
a.cc:30:9: error: expected unqualified-id before 'for'
   30 |         for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
      |         ^~~
a.cc:30:17: error: 'i' does not name a type
   30 |         for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
      |                 ^
a.cc:30:22: error: 'i' does not name a type
   30 |         for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i;
      |                      ^
a.cc:31:15: error: expected constructor, destructor, or type conversion before '(' token
   31 |         printf("%s %s\n",d[fm].word,mword);
      |               ^
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

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

//文章が与えられた時、出現頻度の高い単語と最長の単語を出力するもの。
//文章に現れる単語リストを作ってそれぞれの文字列をカウントすればよい。

int main(){
	string sentence[1000];
	int sentenceNum[1000];
	int array[1000];
	string input;
	int count = 0;
	bool flag;　//単語リストから単語が見つかったどうか
	int maxLength = 0;

	for(int i=0; i < 1000; i++) sentenceNum[i] = 0;

	while(cin >> input){
		flag = false;

		//count == 0 文頭の単語の処理
		if(!count){
			sentence[0] = input;
			sentenceNum[0]++;
			count++;
			int inputSize = input.size();
			maxLength = max(maxLength, inputSize);
		}

		//文頭でない場合
		else {
			for(int i=0; i < count; i++){
				if(sentence[i] == input){
					sentenceNum[i]++;
					flag = true;
					break;
				}
			}
			if(!flag){
				sentence[count] = input;
				sentenceNum[count]++;
				count++;
				int inputSize = input.size();
				maxLength = max(maxLength, inputSize);
			}
		}
	}

	for(int i=0; i < 1000; i++) array[i] = sentenceNum[i];

	sort(array, array+1000, greater<int>());

	for(int i=0; i< count; i++){
		if(array[0] == sentenceNum[i]){
			cout << sentence[i];
		}
	}
	for(int i=0; i< count; i++){
		int sentenceSize = sentence[i].size();
		if(maxLength == sentenceSize){
			cout << " " << sentence[i] << endl;
		}
	}
}

Compiler output:
a.cc:16:19: error: extended character 　 is not valid in an identifier
   16 |         bool flag;　//単語リストから単語が見つかったどうか
      |                   ^
a.cc: In function 'int main()':
a.cc:16:19: error: '\U00003000' was not declared in this scope
   16 |         bool flag;　//単語リストから単語が見つかったどうか
      |                   ^~
a.cc:30:25: error: 'maxLength' was not declared in this scope
   30 |                         maxLength = max(maxLength, inputSize);
      |                         ^~~~~~~~~
a.cc:47:33: error: 'maxLength' was not declared in this scope
   47 |                                 maxLength = max(maxLength, inputSize);
      |                                 ^~~~~~~~~
a.cc:63:20: error: 'maxLength' was not declared in this scope
   63 |                 if(maxLength == sentenceSize){
      |                    ^~~~~~~~~