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

import java.io.*;
import java.util.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] words=br.readLine().split(" ");
HashMap<String,Integer> map=new HashMap<String,Integer>();
int occured=0;
String occuredword="";
int maxlength=0;
String maxword="";
for(String word:words){
if(!map.containskey(word)){
map.put(word,1);
}
else{
map.put(word,map.get(word)+1);
}
if(map.get(word)>occured){
ocuured=map.get(word);
occueredword=word;
}
if(word.length()>maxlength){
maxlength=word.length();
maxword=word;
}
}
}
}

Compiler output:
Main.java:14: error: cannot find symbol
if(!map.containskey(word)){
       ^
  symbol:   method containskey(String)
  location: variable map of type HashMap<String,Integer>
Main.java:21: error: cannot find symbol
ocuured=map.get(word);
^
  symbol:   variable ocuured
  location: class Main
Main.java:22: error: cannot find symbol
occueredword=word;
^
  symbol:   variable occueredword
  location: class Main
3 errors
Language: Java

import java.io.*;
import java.util.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] words=br.readLine().split(" ");
HashMap<String,Integer> map=new HashMap<String,Integer>();
int maxoccured=0;
String maxoccuredword="";
int maxlength=0;
String maxlengthword="";
for(String word:words){
if(!map.containsKey(word)){
map.put(word,1);
}
else{
map.put(word,map.get(word)+1);
}
if(map.get(word)>maxoccured){
maxoccured=map.get(word);
maxoccuredword=word;
}
if(word.length()>maxlength){
maxlength=word.length();
maxlengthword=word;
}
}
System.out.println(maxoccuredword+" "+maxlengthword
}
}

Compiler output:
Main.java:29: error: ')' or ',' expected
System.out.println(maxoccuredword+" "+maxlengthword
                                                   ^
1 error
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			
			while (sc.hasNext()) {
				String sentence = sc.next();
				
				
				//????????????????????????
				
				
			}

			// ???????????????1????????????????????¢???
			
			
			
			
			
			

		} finally {
			sc.close();
		}
	}
	
	// ???????????????????????????
	public String maxFrequency(String[] s){
		Map<String, Integer> frequency = new HashMap<String, Integer>();
		int count = 1;
		for(String word:s){
		if (frequency.containsKey(word)) {
			count += frequency.get(word);
		}
		frequency.put(word, count);
		}
		
		return null;
		
	}
	public String 
}

Compiler output:
Main.java:49: error: <identifier> expected
	public String 
	             ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			// ??\???
			while (sc.hasNextLine()) {
				String[] sentence = sc.nextLine().split(" ");

				// ???????????????1????????????????????¢???
				Main main = new Main();
//				String frequencyWord = main.maxFrequency(sentence);

				// ????????????????????????????????¢???
//				String longWord = main.maxLong(sentence);

				// ????????????
				System.out.println(main.maxFrequency(sentence) + " " + main.maxLong(sentence));
			}

		} finally {
			sc.close();
		}
	}

	// value?????????????????§??????key?????????
	public String maxFrequency(String[] s) {
		Map<String, Integer> frequency = new HashMap<String, Integer>();
		for (String word : s) {
			int count = 1;
			if (frequency.containsKey(word)) {
				count += frequency.get(word);
			}
			frequency.put(word, count);
		}

		return valueSort(frequency).get(0).getKey();

	}

	//
	public String maxLong(String[] str) {
		// ??????????????????????????????List?????\??????
		List<String> list = new ArrayList<String>(new HashSet<String>(
				Arrays.asList(str)));

		String max = new String();
		for (String s : list) {
			if (max.length() < s.length()) {
				max = s;
			}
		}
		return max;
	}

	// Map???value??§?????????????????????
	private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) {
		List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(
				map.entrySet());
		Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
			public int compare(Map.Entry<String, Integer> map1,
					Map.Entry<String, Integer> map2) {
				return map2.getValue().compareTo(map1.getValue());
			}
		});
		return list;
	}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			// ??\???
			while (sc.hasNextLine()) {
				String[] sentence = sc.nextLine().split(" ");

				// ???????????????1????????????????????¢???
				Main main = new Main();
				String frequencyWord = main.maxFrequency(sentence);

				// ????????????????????????????????¢???
				String longWord = main.maxLong(sentence);

				// ????????????
				System.out.println(frequencyWord + " " + longWord);
			}

		} finally {
			sc.close();
		}
	}

	// value?????????????????§??????key?????????
	public String maxFrequency(String[] s) {
		Map<String, Integer> frequency = new HashMap<String, Integer>();
		for (String word : s) {
			int count = 1;
			if (frequency.containsKey(word)) {
				count += frequency.get(word);
			}
			frequency.put(word, count);
		}

		return valueSort(frequency).get(0).getKey();

	}

	//
	public String maxLong(String[] str) {
		// ??????????????????????????????List?????\??????
		List<String> list = new ArrayList<String>(new HashSet<String>(
				Arrays.asList(str)));

		String max = new String();
		for (String s : list) {
			if (max.length() < s.length()) {
				max = s;
			}
		}
		return max;
	}

	// Map???value??§?????????????????????
	private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) {
		List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(
				map.entrySet());
		Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
			public int compare(Map.Entry<String, Integer> map1,
					Map.Entry<String, Integer> map2) {
				return map2.getValue().compareTo(map1.getValue());
			}
		});
		return list;
	}

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

import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		String line = scan.nextLine();
		String[] words = line.split(" ");
		int len = words.length;
		int[] counts = new int[len];
		int longest = 0;
		int max = 0;
		String sMax = "";
		String sLong = "";
		for(int i = 0; i < len; i++){
			if(words[i].length() > logest){
				logest = words[i].length();
				sLong = words[i];
			}
			for(int j = i + 1; j < words.length; j++){
				if(words[i].equals(words[j])){
					counts[i]++;
					if(max < counts[i]){
						max = counts[i];
						sMax = words[i];
					}
				}
			}
		}
		System.out.printf("%s %s\n", sMax, sLong);
	}
}

Compiler output:
Main.java:17: error: cannot find symbol
			if(words[i].length() > logest){
			                       ^
  symbol:   variable logest
  location: class Main
Main.java:18: error: cannot find symbol
				logest = words[i].length();
				^
  symbol:   variable logest
  location: class Main
2 errors
Language: Java

import sun.java2d.xr.MutableInteger;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Map<String, MutableInteger> map = new HashMap<>();
        try (Scanner scanner = new Scanner(System.in)) {
            while (scanner.hasNext()) {
                String str = scanner.next();
                if (!map.containsKey(str)) {
                    map.put(str, new MutableInteger(0));
                }
                MutableInteger integer = map.get(str);
                integer.setValue(integer.getValue() + 1);
            }
            String mostWord = map.entrySet().stream().max((o1, o2) -> new Integer(o1.getValue().getValue()).compareTo(o2.getValue().getValue())).get().getKey();
            String minWord  = map.entrySet().stream().min((o1, o2) -> new Integer(o1.getValue().getValue()).compareTo(o2.getValue().getValue())).get().getKey();
            System.out.printf("%s %s", mostWord, minWord);
        } catch (Exception e) {

        }
    }
}

Compiler output:
Main.java:1: error: package sun.java2d.xr is not visible
import sun.java2d.xr.MutableInteger;
                 ^
  (package sun.java2d.xr is declared in module java.desktop, which does not export it)
1 error
Language: Java

import java.util.Scanner;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		Map<String,Integer> h = new HashMap<String,Integer>();
		String a[] = new String[1000];
		int I = 0;
		int maxlength = 0;
		String maxleng = "";
		while(sc.hasNext()){
			String str = sc.next();
			if(h.containsKey(str)){
				int c = h.get(str).intValue();
				h.put(str,Integer.valueOf(c+1));
			}
			else{
				h.put(str,Integer.valueOf(1));
				a[I++] = str;
			}
		}
		int maxval = 0;
		String maxVal = "";
		for(int i=0;i<I;i++){
			if(h.get(a[i]).intValue() > maxval){
				maxval = h.get(a[i]).intValue();
				maxVal = a[i];
			}
			if(maxlength < a[i].length()){
				maxlength = a[i].length();
				maxleng = a[i];
			}
		}
		System.out.println(maxVal+" "+maxleng);
	}
}


Compiler output:
Main.java:8: error: cannot find symbol
		Map<String,Integer> h = new HashMap<String,Integer>();
		^
  symbol:   class Map
  location: class Main
Main.java:8: error: cannot find symbol
		Map<String,Integer> h = new HashMap<String,Integer>();
		                            ^
  symbol:   class HashMap
  location: class Main
2 errors
Language: Java

mport java.util.*;
import java.util.Map.Entry;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static Map<String, Integer> map;
	public static void main(String[] args) {
		read();
		solve();
	}
	
	static void read() {
		map = new HashMap<String ,Integer>();
		while(sc.hasNext()) {
			String str = sc.next();
			if(map.containsKey(str)) {
				int val = map.get(str);
				map.put(str, val+1);
			} else {
				map.put(str, 1);
			}			
		}
	}

	static void solve() {
		int max_len, max_appear;
		String max_len_str = "", max_appear_str = "";
		max_len = max_appear = 0;
		
		for(Entry<String, Integer> e : map.entrySet()) {
			String key = e.getKey();
			int value = e.getValue();
			int key_len = key.length();
			if(value > max_appear) {
				max_appear = value;
				max_appear_str = key;
			}
			if(key_len > max_len) {
				max_len = key_len;
				max_len_str = key;
			}
		}
		System.out.println(max_appear_str + " " + max_len_str);
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
Main.java:2: error: class, interface, enum, or record expected
import java.util.Map.Entry;
^
2 errors
Language: Java

import java.util.*;
import java.util.Map.Entry;

public class EnglishSentence{
	static Scanner sc = new Scanner(System.in);
	static Map<String, Integer> map = new HashMap<String, Integer>();
	
	// main\bh----------------------------------------------------------------
	public static void main(String[] args){
		read();
		solve();
	}
	
	
	// read\bh-----------------------------------------------------------------
	static boolean read() {
		//±±ÅüÍðÇÝÞ
		while(sc.hasNext()){
			String str = sc.next();
			
			if(map.containsKey(str)){
				int i = map.get(str);
				i++;
				map.put(str, i);
			} else{
				map.put(str, 1);
			}
		}
		
		return true;
	}
	
	
	// solve\bh------------------------------------------------------
	static void solve() {
		//±±Åâèðð¢ÄoÍ·é
		int max = 0, max2 = 0;
		String maxKey = "\0", maxKey2 = "\0";
		
		
		//SGgÉANZX
		for(Entry<String, Integer> e : map.entrySet()){
			//Ååo»ñðT·
			if(max2 < e.getValue()){
				max2 = e.getValue();
				maxKey2 = e.getKey();
			}
			
			//Åå¶ðT·
			if (max < e.getKey().length()){
				max = e.getKey().length();
				maxKey = e.getKey();
			}
		}
		
		
		
		System.out.println(maxKey2 + " " + maxKey);
	}
}

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

import java.util.*;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String[] words = sc.nextLine().split(" ");
		TreeMap<String, Integer> dic = new TreeMap<String, Integer>();
		String mode = "", longest = "";
		int max = 0, maxlen = 0;
		for(int i = 0; i < words.length; i++) {
			int cnt = 1;
			String key = words[i];
			if(dic.containsKey(key)) {
				cnt = dic.get(words[i]);
				//dic.remove(words[i]);
			}
			dic.put(key, ++cnt);
			
			if(max < cnt) {
				max = cnt;
				mode = key;
			}
			if(maxlen < key.length()) {
				maxlen = key.length();
				longest = key;
			}
		}
		System.out.println(mode + " " + longest);
	}

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

import java.util.*;
public class Main2 {
	HashMap<String, Integer> word;
	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		word = new HashMap<String, Integer>();
		while (sc.hasNext()) {
			String[] words = sc.next().split(" ");
			for (String str : words) {
				if (!word.containsKey(str)) 
					word.put(str, 1);
				else word.put(str, word.get(str)+1);
			}
		}
		String str = "";
		String strl = "";
		int count=0;
		for (Map.Entry<String, Integer> entry: word.entrySet()) {
			if (strl.length() < entry.getKey().length())strl = entry.getKey();
			if (count < entry.getValue()) {
				count = entry.getValue();
				str = entry.getKey();
			}
		}
		System.out.println(str + " " + strl);
		
	}
	public static void main(String[] args) {
		new Main2().run();
	}
}

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

#include <stdio.h>

int main(int argc,char* argv[]){
  int mode[100];
  int num;
  int i;
  int max = 0;
  
  for(i = 0;i < 100;i++){
    mode[i] = 0;
  }
  
  while(scanf("%d",&num) != EOF){
    mode[num-1]++;
  }
  
  for(i = 0;i < 100;i++){
    if(mode[i] > max){
      max = mode[i];
    }
  }
  
  for(i = 0;i < 100;i++){
    if(mode[i] == max){
      printf("%d\n",i+1);
    }
  }
  
  return 0;
  
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
  int num;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
  ^
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
            ^
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
                    ^
Main.java:11: error: class, interface, enum, or record expected
  }
  ^
Main.java:15: error: class, interface, enum, or record expected
  }
  ^
Main.java:17: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
            ^
Main.java:17: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
                    ^
Main.java:20: error: class, interface, enum, or record expected
    }
    ^
Main.java:23: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
            ^
Main.java:23: error: class, interface, enum, or record expected
  for(i = 0;i < 100;i++){
                    ^
Main.java:26: error: class, interface, enum, or record expected
    }
    ^
Main.java:31: error: class, interface, enum, or record expected
}
^
15 errors
Language: Java


import java.util.Scanner;

public class Main {
	private static String[] str;
	
	public static void main(String[] args) {
		setInput();
		System.out.println(str[getIndexMaxSameWords()] + " " + str[getIndexLongestWord()]);
	}
	
	public static void setInput(){
		String input = getLine();
		str = input.split(" ");
	}
	
	private static String getLine(){
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		sc.close();
		return str;
	}
	
	public static int getIndexLongestWord(){
		int index = 0;
		int maxLength = str[index].length();
		for(int i = 1; i < str.length; i++){
			if(maxLength < str[i].length()){
				maxLength = str[i].length();
				index = i;
			}
		}
		return index;
	}
	
	private static int getNumSameWords(int index){
		int numSameWord = 0;
		for(int i = 0; i < str.length; i++){
			if(str[index] == str[i]){
				numSameWord++;
			}
		}
		return numSameWord;
	}
	
	public static int getIndexMaxSameWords(){
		int index = 0;
		for(int i = 0; i < str.length; i++){
			if(index < getNumSameWords(i)){
				index = i;
			}
		}
		return index;
	}
	
	public static String getStr(int index) {
		return str[index];
	}
	
	public static void setStr(String[] str) {
		EnglishSentence.str = str;
	}
}

Compiler output:
Main.java:61: error: cannot find symbol
		EnglishSentence.str = str;
		^
  symbol:   variable EnglishSentence
  location: class Main
1 error
Language: Java

package Vol000;
import java.util.Arrays;
import java.util.Scanner;

public class AOJ0_29 
{
	public static void main(String atg[])
	{		
		Scanner sc = new Scanner(System.in);
		String s[] = new String[2002];
		int index = 0;
		while(sc.hasNext())
		{
			String str = sc.next();
			s[index] = str;
			index++;
		}

		int r[] = new int [index];
		boolean flag[] = new boolean[2002];
		//Arrays.fill(flag, true);
		for(int i=0; i<index; i++)
		{
			for(int j=i+1; j<index; j++)
			{
				//&&flag[j]==true
				if(s[i].equals(s[j]))
				{
					r[i]++;
					//flag[j]=false;
				}
			}
		}
		int max=0;
		int maxin=0;
		for(int i=0; i<index; i++)
		{
			if(max < r[i])
			{
				max=r[i];
				maxin = i;
			}
		}
		System.out.print(s[maxin]+" ");
		max =0;
		for(int i=0; i<index; i++)
			if(s[max].length()<s[i].length())
			{
				max =i;
			}
		System.out.println(s[max]);
	}
}

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

#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<string, int> P;

bool pairCompare(const P& firstElof, const P& secondElof)
{
	return firstElof.second > secondElof.second;
}

int main(void)
{
	string s, m;
	vector<P> v;
	while (cin >> s) {
		if (m.size() < s.size()) m = s;
		bool flag = true;
		for (int i = 0; i < v.size(); i++) {
			if (v[i].first == s) {
				flag = false;
				v[i].second++;
			}
		}
		if (flag) v.push_back(P(s,1));
	}
	sort(v.begin(), v.end(), pairCompare);
	cout << v[0].first << " " << m << endl;
	
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <string.h>
^
Main.java:3: error: illegal character: '#'
#include <vector>
^
Main.java:4: error: illegal character: '#'
#include <algorithm>
^
Main.java:7: error: class, interface, enum, or record expected
typedef pair<string, int> P;
^
Main.java:9: error: unnamed classes are a preview feature and are disabled by default.
bool pairCompare(const P& firstElof, const P& secondElof)
^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: illegal start of type
bool pairCompare(const P& firstElof, const P& secondElof)
                 ^
Main.java:30: error: not a statement
	cout << v[0].first << " " << m << endl;
	                               ^
Main.java:14: error: <identifier> expected
int main(void)
             ^
9 errors
Language: C

#include <iostream>
#include <string>

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
				}
			}
		}
	}
	m=0;
	for(j=0; j<=i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	return 0;
}

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

#include <iostream>
#include <string>

using namespace std;

int main(){
	string sent;
	string word[500];
	int a[500]={};
	int i,j,k,l;
	int n,m,len;
	i=0;
	while(cin>>sent){
		if(i==0){
			word[0]=sent;
			a[0]++;
			i++;
			len=sent.size();
			n=0;
		}
		else {
			if(len<sent.size()){
				len=sent.size();
				n=i;
			}
			for(j=0; j<i; j++){
				if(sent==word[j]){
					a[j]++;
					break;
				}
				if(j==i-1){
					word[i]=sent;
					a[i]++;
					i++;
					break;
				}
			}
		}
	}
	m=0;
	for(j=0; j<i; j++){
		if(m<a[j])m=j;
	}
	cout<<word[m]<<" "<<word[n]<<endl;
	// for(j=0; j<i; j++){
	// 	cout<<word[j]<<":"<<a[j]<<endl;
	// }
	//cout<<"len:"<<len<<" "<<word[n]<<endl;
	return 0;
}

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

#include <stdio.h>
#include <string.h>
 
int main(void){
    char str[1000][50], max[50];
    int len = 0, len1 = 0, n=0, cnt, mfreq = 0;

    while(scanf("%s", str[n]) != EOF){
        len = strlen(str[n]);
        if(len1 < len){
            len1 = len;
            strcpy(max, str[n]);
        }
        n++;
    }
    for(i=0; i < n; i++){
        cnt = 0;
        strcpy(strtemp, str[i]);
        for(j=0; j < n; j++){
            if(strcmp(str[j], strtemp) == 0) cnt++;
        }   
        if(mfreq < cnt){
            mfreq = cnt;
            strcpy(mfstr, strtemp);
        }
    }
     
    printf("%s %s\n", mfstr, max);
     
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:9: error: 'i' undeclared (first use in this function)
   16 |     for(i=0; i < n; i++){
      |         ^
main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:16: error: 'strtemp' undeclared (first use in this function); did you mean 'strsep'?
   18 |         strcpy(strtemp, str[i]);
      |                ^~~~~~~
      |                strsep
main.c:19:13: error: 'j' undeclared (first use in this function)
   19 |         for(j=0; j < n; j++){
      |             ^
main.c:24:20: error: 'mfstr' undeclared (first use in this function); did you mean 'str'?
   24 |             strcpy(mfstr, strtemp);
      |                    ^~~~~
      |                    str
Language: C

#include <stdio.h>
#include <string.h>
 
int main(){
    char str[1000][50], max[50];
    int len = 0, len1 = 0, n=0, cnt = 0, mfreq = 0, i = 0, J = 0;

    while(scanf("%s", str[n]) != EOF){
        len = strlen(str[n]);
        if(len1 < len){
            len1 = len;
            strcpy(max, str[n]);
        }
        n++;
    }
    for(i=0; i < n; i++){
        cnt = 0;
        strcpy(strtemp, str[i]);
        for(j=0; j < n; j++){
            if(strcmp(str[j], strtemp) == 0) cnt++;
        }   
        if(mfreq < cnt){
            mfreq = cnt;
            strcpy(mfstr, strtemp);
        }
    }
     
    printf("%s %s\n", mfstr, max);
     
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:16: error: 'strtemp' undeclared (first use in this function); did you mean 'strsep'?
   18 |         strcpy(strtemp, str[i]);
      |                ^~~~~~~
      |                strsep
main.c:18:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:13: error: 'j' undeclared (first use in this function)
   19 |         for(j=0; j < n; j++){
      |             ^
main.c:24:20: error: 'mfstr' undeclared (first use in this function); did you mean 'str'?
   24 |             strcpy(mfstr, strtemp);
      |                    ^~~~~
      |                    str
Language: C

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


int main(void){

  char s[1100];
  char x[1000][50];
  int i, j, n, len;
  int max, size;

  int a, b;
  int count;


  gets(s);
  n=0;
  len=strlen(s);
  i=j=0; 
  while(i<len){
    x[n][j]=s[i];
    i++;
    j++;
    if(s[i]==' '){
      i++;
      n++;
      j=0;
    }
  }
  n++;

  max=0;
  size=0;
  for(i=0; i<n; i++){
    count=1;
    for(j=i+1; j<n; j++){
      if(strcmp(x[i], x[j])==0){
	count++;
      }
    }
    if(max<count){
      max=count;
      a=i;
    }
    if(size<strlen(x[i])){
      size=strlen(x[i]);
      b=i;
    }
  }

  printf("%s %s\n", x[a], x[b]);


  return(0);
}



Compiler output:
main.c: In function 'main':
main.c:16:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   16 |   gets(s);
      |   ^~~~
      |   fgets
Language: C

import java.util.HashMap;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
//			while(sc.hasNextLine()){
//
//				String s = sc.nextLine();
//				if(s.equals("")) break;
//
//				int JOI=0;
//				int IOI=0;
//				for(int i=0;i<s.length();i++) {
//					if(s.indexOf("JOI",i)!=-1) {
//						JOI++;
//						i=s.indexOf("JOI",i)+1;
//					}
//				}
//
//				for(int i=0;i<s.length();i++) {
//					if(s.indexOf("IOI",i)!=-1) {
//						IOI++;
//						i=s.indexOf("IOI",i)+1;
//					}
//				}
//
//				System.out.println(JOI);
//				System.out.println(IOI);
//			}
//		}
//	}
////	black	00	00	00
////	blue	00	00	ff
////	lime	00	ff	00
////	aqua	00	ff	ff
////	red	ff	00	00
////	fuchsia	ff	00	ff
////	yellow	ff	ff	00
////	white	ff	ff	ff
//	static int[][] rgb = {
//			{0x00,0x00,0x00},
//			{0x00,0x00,0xff},
////			lime	00	ff	00
////			aqua	00	ff	ff
////			red	ff	00	00
////			fuchsia	ff	00	ff
////			yellow	ff	ff	00
////			white	ff	ff	ff
//
//	};
	//m n

		String s = sc.nextLine();
		String [] t = s.split(" ");
		String max = "";
		HashMap<String,Integer> count = new HashMap<>();
		for(String ss : t) {
			if(ss.length()>max.length()) {
				max = ss;
			}
			Integer n = count.get(ss);
			if(n == null) {
				count.put(ss, 1);
			}
			else {
				count.put(ss, n+1);
			}
		}
		String m="";
		int max2=0;
		for(String key: count.keySet()) {
			
			
			if(count.get(key)>max2) {
				max2=count.get(key);
				m=key;
			}
		}
		System.out.println(m+" "+max);
	}

	}
}



Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.HashMap;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.HashMap;
      |            ^
main.c:2:1: error: unknown type name 'import'
    2 | import java.util.Scanner;
      | ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | import java.util.Scanner;
      |            ^
main.c:5:1: error: unknown type name 'public'
    5 | public class Main {
      | ^~~~~~
main.c:5:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    5 | public class Main {
      |              ^~~~
Language: C

#include<iostream>
#include<map>
using namespace std;
map<string,int>mp;
string ans,s,amins;
int maxn=0,minn=0;
int main()
{
    while(cin>>s)
    {
        mp[s]++;
        if(mp[s]>maxn)
        {
                      maxn=mp[s];
                      ans=s;
        }
        if(s.size()>minn)
        {
                         minn=s.size();
                         amins=s;
        }
    }
    cout<<ans<<" "<<amins<<endl;
    return 0;
} 

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

sent=raw_input()
words=sent.split()
max_f,freq_w=0,""
max_len,len_w=0,""
for word in words:
    if max_f<words.count(word):
        freq_w=word
        max_f=words.count(word)
    if max_len<len(word):
        len_w=word
        max_len=len(word)
print "%s %s"%(freq_w,len_w)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | sent=raw_input()
      | ^~~~
main.c:1:1: error: type defaults to 'int' in declaration of 'sent' [-Wimplicit-int]
main.c:1:6: error: implicit declaration of function 'raw_input' [-Wimplicit-function-declaration]
    1 | sent=raw_input()
      |      ^~~~~~~~~
main.c:1:6: error: initializer element is not constant
main.c:2:1: error: expected ',' or ';' before 'words'
    2 | words=sent.split()
      | ^~~~~
Language: C

#include <stdio>
#include <string>

char str[50];
char word[1000][50];
int count[1000];

int main(void)
{
	int i, j, ind, ind2;
	int c, len = 0;
	i = 0;
	
	while (scanf("%s", str) != EOF){
		
		c = 1;
		for (j = 0; j < i; j++){
			
			if (strcmp(str, word[j]) == 0){
				count[j]++;
				c = 0;
			}
		}
		
		if (c == 1){
			strcpy(word[i], str);
			
			if (strlen(word[i]) > len){
				len = strlen(word[i]);
				ind = i;
			}
			i++;
		}
	}
	ind2 = 0;
	
	for (j = 0; j < i; j++){
		
		if (count[ind2] < count[j]){
			ind2 = j;
		}
	}
	
	printf("%s %s\n", word[ind2], word[ind]);
	
	return (0);
}

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

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

int main(void)
{
	char str[1024][64];
	int i, j;
	int ls;
	int lsl;
	int sl;
	int mus;
	int stri[1024];
	
	for (i = 0; i < 1024; i++){
		stri[i] = 0;
	}
	i = 0;
	ls = 0;
	lsl = 0;
	while (scanf("%s", str[i]) != EOF){
		sl = strlen(str[i]);
		if (sl > lsl){
			ls = i;
			lsl = sl;
		}
		for (j = 0; j <= i; j++){
			if (strcmp(str[j], str[i]) == 0){
				stri[j]++;
				break;
			}
		}
		i++;
	}
	mus = 0;
	for (j = 1; j < i; j++){
		if (stri[j] > stri[mus]){
			mus = j;
		}
	}
	
	printf("%s %s\n", str[mus], str[ls]);
	
	return (0);
}

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

#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string, int> table;
int main()
{
	string word, frequent, longest;
	size_t N = 0;
	while (cin >> word)
	{
		table[word]+=1;
		if (table[word] > N) 
		{
			frequest = word; 
			N = table[word];
		}
		if (word.size() > longest.size())longest = word;
	}
	cout << frequent <<' '<< longest << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'frequest' was not declared in this scope; did you mean 'frequent'?
   15 |                         frequest = word;
      |                         ^~~~~~~~
      |                         frequent
Language: C++

#include <map>
#include <string>
#include <iostream>
using namespace std;
map<string,int> table;
int main()
{
    string word, frequent, longest;
    size_t N=0;
    while (cin >> word)
    {
        table[word]++;
        if(table[word]>N)
        {
            N=table[word];
            frequent=word;
            if(word.size()>longest.size())
                longest=word;
    }
        cout<<frequent<<" "<<longest<<endl;
    }


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

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

int main(void) {
    vector<string> vec;
    string input, ans1;
    int maxLen = 0;
    while(cin >> input) {
        vec.push_back(input);
        if(input.length() > maxLen) {
            maxLen = (int)input.length();
            ans1 = input;
        }
    }
    map<int, string> hm;
    vector<string>::iterator ite;
    int max = 0;
    for(ite = vec.begin(); ite != vec.end(); ite++) {
        string now = *ite;
        int cnt = (int)count(vec.begin(), vec.end(), now);
        if(cnt > max) max = cnt;
        hm.insert(make_pair(cnt, now));
    }
    map<int, string>::iterator ite2;
    for(ite2 = hm.begin(); ite2 != hm.end(); ite2++) {
        if(ite2->first == max) {
            cout << ite2->second << " "; break;
        }
    }
    cout << ans1 << endl;
    return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: 'count' was not declared in this scope; did you mean 'cnt'?
   23 |         int cnt = (int)count(vec.begin(), vec.end(), now);
      |                        ^~~~~
      |                        cnt
Language: C++

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

using namespace std;

int main()
{
	int longlen = 0;
	string str, longstr;
	vector<pair<int, string> > vc;

	while (cin >> str)
	{
		if((int)strlen(str.c_str()) > longlen){
			longlen = strlen(str.c_str());
			longstr = str;
		}
		
		bool bl = true;
		vector<pair<int, string> >::iterator it = vc.begin();
		while(it != vc.end())
		{
			if(it->second == str){
				it->first--;
				bl = false;
			}
			it++;
		}

		if(bl){
			vc.push_back(make_pair(0, str));
		}
	}
	
	sort(vc.begin(), vc.end());

	cout << vc[0].second << " " << longstr << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'strlen' was not declared in this scope
   17 |                 if((int)strlen(str.c_str()) > longlen){
      |                         ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 |
Language: C++

#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
struct ST{string str;int c;int z;};

int main(){

int i=0;
string str,sth,stl;
struct ST P[1001];
int max=0;
while(cin>>str){
P[i].str=str;P[i].c=0;P[i].z=(int)str.size();
i++;
}
for(int j=0;j<i;j++)
for(int k=i-1;k>i;k--)
if(P[k-1].str>P[k].str){
struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM;
}

for(int j=1;j<i;j++)
{if(P[j-1].str==P[j].str)P[j].c++;

}
max=0;
for(int j=0;j<i;j++)
{if(max<P[j].c)sth=P[j].c;}
if(P[j].z>max)stl=P[j].str;

cout<<sth<<" "<<stl<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:6: error: 'j' was not declared in this scope
   30 | if(P[j].z>max)stl=P[j].str;
      |      ^
Language: C++

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

int main(){
	string str;
	string max_len_str;
	string most_many_str;
	int most=-1;
	int i;
	vector<pair<string, int> > v;
	string::iterator vi;
	cin>>str;
	v.push_back(pair<string, int>(str, 0));
	max_len_str == v[0].first;
	while(cin>>str){
		for(i=0;i<v.size();i++){
			if(v[i].first == str){
				v[i].second++;
				break;
			}
		}
		if(i==v.size()){
			if(max_len_str.size() < strlen(str.c_str())){
				max_len_str = str;
			}
			v.push_back(pair<string, int>(str, 0));
		}
	}
	for(i=0;i<v.size();i++){
		if(most < v[i].second){
			most = v[i].second;
			most_many_str = v[i].first;
		}
	}
	cout << most_many_str << " " << max_len_str << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   16 |         max_len_str == v[0].first;
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 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/basic_string.h:3755:5: note: declared here
 3755 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
a.cc:25:49: error: 'strlen' was not declared in this scope
   25 |                         if(max_len_str.size() < strlen(str.c_str())){
      |                                                 ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | #include<string>
Language: C++

a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)

Compiler output:
a.cc:1:16: error: empty character constant
    1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
      |                ^~
a.cc:1:1: error: 'a' does not name a type
    1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
      | ^
a.cc:1:26: error: expected constructor, destructor, or type conversion before '(' token
    1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
      |                          ^
a.cc:1:160: error: expected unqualified-id before ')' token
    1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
      |                                                                                                                                                                ^
a.cc:1:162: error: 'console' does not name a type; did you mean 'const'?
    1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
      |                                                                                                                                                                  ^~~~~~~
      |                                                                                                                                                                  const
Language: C++

#include <iostream>
using namespace std;

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=count; i>=0 ; i--){
		for(j=0 ; j<i-1 ; j++){
			if(check[j]>check[j+1]){
				check[j]^=check[j+1];
				check[j+1]^=check[j];
				check[j]^=check[j+1];
				freq=j;
			}
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:33: error: 'strcpy' was not declared in this scope
   19 |                                 strcpy((char*)&word[count] , (const char*)tmp);
      |                                 ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:24:17: error: 'strcpy' was not declared in this scope
   24 |                 strcpy((char*)&word[count],(const char*)tmp);
      |                 ^~~~~~
a.cc:24:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:28:28: error: 'strcmp' was not declared in this scope
   28 |                         if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
      |                            ^~~~~~
a.cc:28:28: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:43:22: error: 'strlen' was not declared in this scope
   43 |                 prev=strlen(word[0]);
      |                      ^~~~~~
a.cc:43:22: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
map<string,int> msi;
string s;
int ma=0;
int ma2=0;
string ans;
string ans2;
while (cin >> s,){
	if (!EXIST(msi,s))
		msi[s]=1;
	else{
		msi[s] = msi[s]+1;
		if (ma2<msi[s]){
		ans2=s;
		ma2 = msi[s];
		}
		}
	if (ma < s.length()){
	ans=s;
	ma = s.length();
	}
}
cout << ans2 << " "<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: expected primary-expression before ')' token
   53 | while (cin >> s,){
      |                 ^
Language: C++

<?php

$line = strtolower(trim(fgets(STDIN)));
$arr = explode(" ", $line);

$maxword = "";
$maxlenword = "";
$hash = array();
foreach($arr as $word){
	$hash[$word]++;
	
	if($hash[$maxword] < $hash[$word]){
	 	$maxword = $word;
	}
	if(strlen($maxlenword) < strlen($word)){
		$maxlenword = $word;
	}
}

echo "{$maxword} {$maxlenword}\n";

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:4:1: error: '$arr' does not name a type
    4 | $arr = explode(" ", $line);
      | ^~~~
a.cc:6:1: error: '$maxword' does not name a type
    6 | $maxword = "";
      | ^~~~~~~~
a.cc:7:1: error: '$maxlenword' does not name a type
    7 | $maxlenword = "";
      | ^~~~~~~~~~~
a.cc:8:1: error: '$hash' does not name a type
    8 | $hash = array();
      | ^~~~~
a.cc:9:8: error: expected constructor, destructor, or type conversion before '(' token
    9 | foreach($arr as $word){
      |        ^
a.cc:20:1: error: 'echo' does not name a type
   20 | echo "{$maxword} {$maxlenword}\n";
      | ^~~~
Language: C++

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

map<string, int> table;

int main()
{
    string word, frequent, longest;
    size_t N = 0;
    while (cin >> word)
    {
        table[word]++;
        if (N < table[word])
        {
            N = table[word];
            frequent = word;
        }
        if (word.size>longest.size)
            longest = word;
    }
    cout << frequent << " " << longest << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: 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 '()' ?)
   20 |         if (word.size>longest.size)
      |             ~~~~~^~~~
      |                      ()
a.cc:20:31: 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 '()' ?)
   20 |         if (word.size>longest.size)
      |                       ~~~~~~~~^~~~
      |                                   ()
Language: C++

#include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;
int main()
{
  string word,frequent,longest;
  map<string,int> table;
  size_t N=0;
  while(cin >> word){
    table[word] += 1;
    N =table[word] < N ? N : table[word];
    frequent = table[word] < N ? frequent : word;
    logest = word.size() < longest.size ? longest : word;
  }
  cout << frequent << " " << longest << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'logest' was not declared in this scope; did you mean 'longest'?
   15 |     logest = word.size() < longest.size ? longest : word;
      |     ^~~~~~
      |     longest
a.cc:15:36: 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 '()' ?)
   15 |     logest = word.size() < longest.size ? longest : word;
      |                            ~~~~~~~~^~~~
      |                                        ()
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, MAX);
	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:16:9: error: 'gets_s' was not declared in this scope
   16 |         gets_s(str, MAX);
      |         ^~~~~~
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;
      |                                       ^~~~