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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class Main {

	private BufferedReader in = new BufferedReader(new InputStreamReader(
			System.in));

	public static void main(String[] args) {
		Main wordcount = new Main();
		String[] words = wordcount.input();
		Map<String, ArrayList<Integer>> entries = wordcount.count(words);
		wordcount.print(entries);
	}

	/**
	 * 出現位置を保存
	 */
	private Map<String, ArrayList<Integer>> count(String[] entries) {
		Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>();
		for (int i = 0; i < entries.length; i += 2) {
			if (entries[i].equals(""))
				continue;
			List<Integer> index;
			if ((index = map.get(entries[i])) == null) {
				ArrayList<Integer> list = new ArrayList<Integer>();
				list.add(Integer.parseInt(entries[i + 1]));
				map.put(entries[i], list);
			} else {
				index.add(Integer.parseInt(entries[i + 1]));
			}
		}
		return map;
	}

	/**
	 * 単語＋改行＋indexで出力
	 */
	private void print(Map<String, ArrayList<Integer>> map) {
		for (String str : map.keySet()) {
			List<Integer> list = map.get(str);
			Collections.sort(list);
			System.out.print(str + "\n" + list.get(0));
			for (int i = 1; i < list.size(); i++) {
				System.out.print(" " + list.get(i));
			}
			System.out.println();
		}
	}

	/**
	 * 標準入力から読み込んだ文字列を空白区切りで分割
	 */
	private String[] input() {
		String str = null;
		try {
			str = in.readLine();
			while (true) {
				String input = in.readLine();
				if (input == null)
					break;
				str = str + " " + input;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (str == null)
			return new String[0];
		else
			return str.toLowerCase().split("\\s+");
	}
}

Compiler output:
Main.java:47: error: cannot find symbol
			Collections.sort(list);
			^
  symbol:   variable Collections
  location: class Main
1 error
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String, List<Integer>> ref = new HashMap<String, List<Integer>>();
		PriorityQueue<String> q = new PriorityQueue<String>();
		while(sc.hasNext()){
			String s = sc.next();
			if(ref.containsKey(s)){
				ref.get(s).add(sc.nextInt());
			}
			else{
				q.add(s);
				List<Integer> list = new ArrayList<Integer>();
				list.add(sc.nextInt());
				ref.put(s, list);
			}
		}
		while(!q.isEmpty()){
			String s = q.poll();
			List<Integer> list = ref.get(s);
			System.out.println(s);
			Collections.sort(list);
			boolean f = true;
			for(int v:list){
				if(!f)System.out.print(" ");
				f = false;
				System.out.print(v);
			}
			System.out.println();
		}
	}

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

#include<stdio.h>
#define W 30
#define P 1000

int main(){

int p;
char c[W];

while(scanf("%c %d",c,&p)!=EOF){


}

retrn 0;

}

Compiler output:
main.c: In function 'main':
main.c:15:1: error: 'retrn' undeclared (first use in this function)
   15 | retrn 0;
      | ^~~~~
main.c:15:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:6: error: expected ';' before numeric constant
   15 | retrn 0;
      |      ^~
      |      ;
Language: C

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

struct word{
  char w[31];
  int p;
}wo[1000];

int compare(const void *a,const void *b){
  int i;
  for(i=0;;i++){
    if(((struct word *)a)->w[i]!='\0'&&((struct word *)b)->w[i]=='\0')return -1;
    if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]!='\0')return 1;
    if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]=='\0')return 0;
    if(((struct word *)a)->w[i]!=((struct word *)b)->w[i]){
      return ((struct word *)a)->w[i]-((struct word *)b)->w[i];
    }
  }
  return 0;
}
    
int main(void) {
  int i=0,j,d;
  char s;
  
  while(scanf("%s%d",wo[i].w,&(wo[i++].d)));
  qsort(wo,i,sizeof(struct word),compare);
  
  for(j=0;j<i;j++){
    printf("%s %d",wo[j].w,wo[j].p);
    for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      printf(" %d",wo[k].p);
    }
    puts("");
    j=k-1;
  }
  i=0;
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:39: error: 'struct word' has no member named 'd'
   26 |   while(scanf("%s%d",wo[i].w,&(wo[i++].d)));
      |                                       ^
main.c:31:9: error: 'k' undeclared (first use in this function)
   31 |     for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      |         ^
main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   31 |     for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      |               ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c: At top level:
main.c:40:3: error: expected identifier or '(' before 'return'
   40 |   return 0;
      |   ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C

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

struct word{
  char w[31];
  int p;
}wo[1000];

int compare(const void *a,const void *b){
  int i;
  for(i=0;;i++){
    if(((struct word *)a)->w[i]!='\0'&&((struct word *)b)->w[i]=='\0')return -1;
    if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]!='\0')return 1;
    if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]=='\0')return 0;
    if(((struct word *)a)->w[i]!=((struct word *)b)->w[i]){
      return ((struct word *)a)->w[i]-((struct word *)b)->w[i];
    }
  }
  return 0;
}
    
int main(void) {
  int i=0,j,k,d;
  char s;
  
  while(scanf("%s%d",wo[i].w,&(wo[i++].p)));
  qsort(wo,i,sizeof(struct word),compare);
  
  for(j=0;j<i;j++){
    printf("%s %d",wo[j].w,wo[j].p);
    for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      printf(" %d",wo[k].p);
    }
    puts("");
    j=k-1;
  }
  i=0;
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   31 |     for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      |               ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c: At top level:
main.c:40:3: error: expected identifier or '(' before 'return'
   40 |   return 0;
      |   ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C

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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word
{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(char *, int, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	char	tempWord[31];
    int		tempPage;
	
	while(scanf("%s %d", tempWord, &tempPage) != EOF)
	{
		for(cnt1 = 0; cnt1 < 100; cnt1++)
		{
			if(wordArray[cnt1].page == 0)
			{
				wordArray[cnt1].page = tempPage;
				strcpy(wordArray[cnt1].word, tempWord);
				break;
			}
			else if(is_smaller(tempWord, tempPage, cnt1))
			{
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--)
				{
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWord);
				wordArray[cnt1].page = tempPage;
				break;
			}
		}
	}
}

BOOL is_smaller(char *tempWord, int input_page, int cnt)
{
	if(strcmp(tempWord, wordArray[cnt].word) < 0)
		return TRUE;
	else if(strcmp(tempWord, wordArray[cnt].word) == 0)
	{
		if(input_page < wordArray[cnt].page)
			return TRUE;
		else
			return FALSE;
	}
	else
		return FALSE;
}

void output(WORD *wordArray)
{
	int		output_cnt = 0;
	char	last_print_word[30] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
			
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Compiler output:
main.c: In function 'is_smaller':
main.c:63:9: error: 'else' without a previous 'if'
   63 |         else if(strcmp(tempWord, wordArray[cnt].word) == 0)
      |         ^~~~
main.c:67:17: error: expected '}' before 'else'
   67 |                 else
      |                 ^~~~
main.c: At top level:
main.c:70:9: error: expected identifier or '(' before 'else'
   70 |         else
      |         ^~~~
main.c:72:1: error: expected identifier or '(' before '}' token
   72 | }
      | ^
Language: C

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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word
{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(char *, int, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	char	tempWord[31];
    int		tempPage;
	
	while(scanf("%s %d", tempWord, &tempPage) != EOF)
	{
		for(cnt1 = 0; cnt1 < 100; cnt1++)
		{
			if(wordArray[cnt1].page == 0)
			{
				wordArray[cnt1].page = tempPage;
				strcpy(wordArray[cnt1].word, tempWord);
				break;
			}
			else if(is_smaller(tempWord, tempPage, cnt1))
			{
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--)
				{
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWord);
				wordArray[cnt1].page = tempPage;
				break;
			}
		}
	}
}

BOOL is_smaller(char *tempWord, int input_page, int cnt)
{
	if(strcmp(tempWord, wordArray[cnt].word) < 0)
		return TRUE;
	else if(strcmp(tempWord, wordArray[cnt].word) == 0)
	{
		if(input_page < wordArray[cnt].page)
			return TRUE;
		else
		{
			return FALSE;
		}
	}
	else
	{
		return FALSE;
	}
}

void output(WORD *wordArray)
{
	int		output_cnt = 0;
	char	last_print_word[30] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
			
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Compiler output:
main.c: In function 'is_smaller':
main.c:63:9: error: 'else' without a previous 'if'
   63 |         else if(strcmp(tempWord, wordArray[cnt].word) == 0)
      |         ^~~~
main.c:67:17: error: expected '}' before 'else'
   67 |                 else
      |                 ^~~~
main.c: At top level:
main.c:72:9: error: expected identifier or '(' before 'else'
   72 |         else
      |         ^~~~
main.c:76:1: error: expected identifier or '(' before '}' token
   76 | }
      | ^
Language: C

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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(WORD, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
		for(cnt1 = 0; cnt1 < 100; cnt1++){
			if(wordArray[cnt1].page == 0){
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1)){
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--){
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0)
		return TRUE;
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0)
	{
		if(tempWORD.page < wordArray[cnt].page)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	else
	{
		return FALSE;
	}
}

void output()
{
	int		output_cnt = 0;
	char	last_print_word[31] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Compiler output:
main.c: In function 'is_smaller':
main.c:55:9: error: 'else' without a previous 'if'
   55 |         else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0)
      |         ^~~~
Language: C

#include<functional>
#include<list>
#include<queue>
#include<stack>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


class word{
 public:
  char w[31];
  std::priority_queue<int> q;
};


int main(){
  using namespace std;  
  int p,cmp;
  char str[31];
  list<word> wlst;
  list<word>::iterator it;
  stack<int> b;
  word *buf;

  while(scanf("%s %d",str,&p)!=EOF){
    it=wlst.begin();
    while(it!=wlst.end()){
      cmp=strcmp(it->w,str);
      if(!cmp){
	it->q.push(p);
	break;
      }else if(cmp>0){
	buf=new word();
	strcpy(buf->w,str);
	buf->q.push(p);
	wlst.insert(it,*buf);
	break;
      }
      ++it;
    }
    if(it==wlst.end()){
      buf=new word();
      strcpy(buf->w,str);
      buf->q.push(p);
      wlst.insert(it,*buf);
    }
  }
  it=wlst.begin();
  while(it!=wlst.end()){
    printf("%s\n",it->w);
    while(!(it->q.empty())){
      b.push(it->q.top());
      it->q.pop();
    }
    while(1){
      printf("%d",b.top());
      b.pop();
      if(b.empty()){
	printf("\n");
	break;
      }else{
	printf(" ");
      }
    }
    it++;
  }
  return 0;
}

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

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

int i,look,first,prev,n,index;
int dic[105][2],page[105];
char s[105][35],word[35];

int main(void){
	while(scanf("%s %d",s[n],&page[n])!=EOF){
		dic[n][0]=n;dic[n][1]=999;

		look=first;prev=-1;
		while(look!=n){
			index=dic[look][0];
			if(strcmp(s[n],s[index])<0 || (strcmp(s[n],s[index])==0 && page[n]<page[index]) ){
				dic[n][1]=look;
				if(prev<0){first=n;}
				else{dic[prev][1]=n;}
				break;
			}
			else{
				if(dic[look][1]>111){
					dic[look][1]=n;
					break;
				}
				else{
					prev=look;
					look=dic[look][1];
				}
			}
		}
		n++;
	}

	i=first;
	while(i<111){
		if(strcmp(word,s[dic[i][0]])!=0){
			strcpy(word,s[dic[i][0]]);
			if(i!=first)printf("\n");
			printf("%s\n",word);
			printf("%d",page[dic[i][0]]);
		}
		else{
			printf(" %d",page[dic[i][0]]);
		}

		i=dic[i][1];
	}

	printf("\n");

	return 0;
}

Compiler output:
main.c:5:25: error: 'index' redeclared as different kind of symbol
    5 | int i,look,first,prev,n,index;
      |                         ^~~~~
In file included from /usr/include/string.h:462,
                 from main.c:2:
/usr/include/strings.h:68:14: note: previous declaration of 'index' with type 'char *(const char *, int)'
   68 | extern char *index (const char *__s, int __c)
      |              ^~~~~
Language: C

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

string str;
int n;

map<string, vector<int> > dict;

int main(){
    while(cin >> str >> n){
	dict[str].push_back(n);
    }
    map<string, vector<int> >::iterator it = dict.begin();
    while(it != dict.end()){
	cout << it->first << endl;
	sort(it->second.begin(), it->second.end());
	for(int i = 0;i < it->second.size();i++){
	    if(i != 0)cout << " ";
	    cout << it->second.at(i);
	}
	cout << endl;
	it++;
    }
    return 0;
}

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

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

typedef struct {
	char word[ 31 ];
	int cnt, page[ 100 ];
} Data;

Data data[ 100 ];

int compare1( const void *a, const void *b ) {
	return *(int *)a - *(int *)b;
}

int compare2( const void *a, const void *b ) {
	return strcmp( (*(Data *)a).word, (*(Data *)b).word );
}

int main( void ) {
	int i, j;
	char word[ 31 ];
	int page, cnt;

	cnt = 0;
	while ( scanf( "%s %d", word, &page ) != EOF ) {
		for ( i = 0; i < cnt && strcmp( word, data[ i ].word ); i++ ) ;
		if ( i == cnt )
			strcpy( data[ cnt++ ].word, word );
		data[ i ].page[ data[ i ].cnt++ ] = page;
	}

	for ( i = 0; i < cnt; i++ )
		qsort( data[ i ].page, data[ i ].cnt, sizeof(int), &compare1 );
	qsort( data, cnt, sizeof(Data), &compare2 );

	while ( i = 0; i < cnt; i++ ) {
		puts( data[ i ].word );
		for ( j = 0; j < data[ i ].cnt; j++ )
			printf( "%d%c", data[ i ].page[ j ], j == data[ i ].cnt - 1 ? '\n' : ' ' );
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:37:22: error: expected ')' before ';' token
   37 |         while ( i = 0; i < cnt; i++ ) {
      |               ~      ^
      |                      )
Language: C++

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

using namespace std;

int main()
{
	map<string, vector<int> > index;
	vector<string> strv;
	string s;
	int p;
	
	while (cin >> s >> p){
		if (index.find(s) == index.end()){
			strv.push_back(s);
		}
		index[s].push_back(p);
	}
	sort(strv.begin(), strv.end());
	for (int i = 0; i < strv.size(); i++){
		sort(index[strv[i]].begin(), index[strv[i]].end());
		cout << strv[i] << endl;
		cout << index[strv[i]][0];
		for (int j = 1; j < index[strv[i]].size(); j++){
			cout << ' ' << index[strv[i]][j];
		}
		cout << endl;
	}
	
	return 0;
}

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

#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main() {
	map<string, vector<int> > D;
	string w;
	int n;
	while(cin >> w >> n) {
		D[w].push_back(n);
	}
	map<string, vector<int> >::iterator it = D.begin();
	for(; it != D.end(); it++) {
		cout << it->first << endl;
		int size = it->second.size();
		sort(it->second.begin(),it->second.end());
		for(int i = 0; i < size - 1; i++){
			cout << it->second[i] << " ";
		}
		cout << it->second[size-1] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |                 sort(it->second.begin(),it->second.end());
      |                 ^~~~
      |                 short
Language: C++

/*
	0105:book Index
*/
#include	<iostream>
#include	<vector>
#include	<utility>
#include	<string>

using namespace std;

typedef pair<string, int> P_SI;

int main(void) {
	string memstr = " ";
	vector<P_SI> words;
	
	while(1) {
		string buf_s;
		int buf_i;
		
		cin >> buf_s >> buf_i;
		if(cin.eof()) { break; }
		words.push_back( P_SI(buf_s, buf_i) );
	}
	sort( words.begin(), words.end() );
	
	vector<P_SI>::iterator it = words.begin();
	bool isFirst = true;
	while( it != words.end() ) {
		string buf_s = (*it).first;
		int buf_i = (*it).second;
		
		if(buf_s != memstr) {
			if(it != words.begin()) {
				cout << endl;
			}
			cout << buf_s << endl;
			memstr = buf_s;
			isFirst = true;
		}
		if(isFirst) {
			cout << buf_i;
			isFirst = false;
		} else {
			cout << ' ' << buf_i;
		}
		it++;
	}
	cout << endl;
	return 0;
}

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

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <conio.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))




int main(){
	string str;
	vector<pair<string,int>>sp;
	int cnt=0;
	while(cnt==0||kbhit()){
		getline(cin,str);
		string t1="",t2="";
		int i;
		for(i=0;str[i]!=' ';i++){
			t1+=str[i];
		}
		i++;
		for(;i<SZ(str);i++){
			t2+=str[i];
		}
		int num=toInt(t2);
		sp.PB(MP(t1,num));
		cnt++;
	}
	bool c=false;
	SORT(sp);
	REP(i,SZ(sp)){
		if(!c)cout<<sp[i].first<<endl;
		if(i!=SZ(sp)-1&&sp[i].first==sp[i+1].first){
			cout<<sp[i].second<<" ";
			c=true;
		}else{
			c=false;
			cout<<sp[i].second<<endl;
		}
		
	}
	return 0;
}

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

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <conio.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))




int main(){
	string str;
	vector<pair<string,int>>sp;
	int num;
	while(cin>>str>>num){
		sp.PB(MP(str,num));
	}
	bool c=false;
	SORT(sp);
	REP(i,SZ(sp)){
		if(!c)cout<<sp[i].first<<endl;
		if(i!=SZ(sp)-1&&sp[i].first==sp[i+1].first){
			cout<<sp[i].second<<" ";
			c=true;
		}else{
			c=false;
			cout<<sp[i].second<<endl;
		}
		
	}
	return 0;
}

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

//Name: Book Index
//Level: 2
//Category: やるだけ
//Note:

/**
 * mapを使って語句とページ番号を管理すると、語句は勝手に昇順に並ぶ。
 * ページ番号は出力時にソートする。
 *
 * オーダーは O(N|S| log N)。
 * ただしNは語句の個数、|S|は語句の最大長。
 */
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

bool solve() {
    string word;
    int page;
    map<string,vector<int>> dict;
    while(cin >> word >> page) {
        dict[word].push_back(page);
    }
    for(auto &e : dict) {
        cout << e.first << endl;
        sort(begin(e.second), end(e.second));
        for(int i = 0; i < (int)e.second.size(); ++i) {
            if(i > 0) cout << ' ';
            cout << e.second[i];
        }
        cout << endl;
    }
    return false;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    while(solve()) ;
    return 0;
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:29:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   29 |         sort(begin(e.second), end(e.second));
      |         ^~~~
      |         short
Language: C++

??£??£??£???

Compiler output:
a.cc:1:3: error: extended character £ is not valid in an identifier
    1 | ??£??£??£???
      |   ^
a.cc:1:6: error: extended character £ is not valid in an identifier
    1 | ??£??£??£???
      |      ^
a.cc:1:9: error: extended character £ is not valid in an identifier
    1 | ??£??£??£???
      |         ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ??£??£??£???
      | ^
Language: C++

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

int main()
{
	int temp;
	int k,page;
	int i,flag=0;
	int j,count=0;
	string word;
	string index[1000];
	int num[1000][100];
	int appe[1000][2];
	memset(num,0,sizeof(num));
	memset(appe,0,sizeof(appe));
	for(i=0;i<1000;i++)
	{
		index[i]="";
	}
	while(cin>>word>>page)
	{
		for(j=0;j<flag;j++)
		{
			if(word.compare(index[j])!=0)
			{
				count++;
			}
			else
			{
				for(k=0;k<100;k++)
				{
					if(num[j][k]==0)
					{
						num[j][k]=page;
						break;
					}
				}
			}
		}

		if(count==flag)
		{
			index[flag]=word;
			num[flag][0]=page;
			appe[flag][0]=flag;
			appe[flag][1]=word.at(0)-'a';
		}
		count=0;
		flag++;
	}

	for(i=0;i<flag;i++)
	{
		for(j=0;j<flag-1-i;j++)
		{
			if(appe[j][1]>appe[j+1][1])
			{
				temp=appe[j][1];
				appe[j][1]=appe[j+1][1];
				appe[j+1][1]=temp;

				temp=appe[j][0];
				appe[j][0]=appe[j+1][0];
				appe[j+1][0]=temp;
			}
		}
	}

	for(i=0;i<flag;i++)
	{
		j=0;
		cout<<index[appe[i][0]]<<endl;		

		while(num[appe[i][0]][j]!=0)
		{
			cout<<num[appe[i][0]][j]<<" ";
			j++;
		}
		cout<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(num,0,sizeof(num));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<cstdio>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(void)
{
	map < string, vector<int> > index;

	char cbuf[31];
	int ibuf;

	while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF)
	{
		index[cbuf].push_back(ibuf);
	}

	for (auto &elem : index)
	{
		sort(elem.second.begin(), elem.second.end());
		printf_s("%s\n", elem.first.c_str());
		for (auto &vecElem : elem.second)
		{
			printf_s("%d ", vecElem);
		}
		printf_s("\n");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |         while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF)
      |                ^~~~~~~
      |                scanf
a.cc:22:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   22 |                 printf_s("%s\n", elem.first.c_str());
      |                 ^~~~~~~~
      |                 printf
Language: C++

#include<stdio.h>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(void)
{
	map < string, vector<int> > index;

	char cbuf[31];
	int ibuf;

	while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF)
	{
		index[cbuf].push_back(ibuf);
	}

	for (auto &elem : index)
	{
		sort(elem.second.begin(), elem.second.end());
		printf_s("%s\n", elem.first.c_str());
		for (auto &vecElem : elem.second)
		{
			printf_s("%d ", vecElem);
		}
		printf_s("\n");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |         while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF)
      |                ^~~~~~~
      |                scanf
a.cc:22:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   22 |                 printf_s("%s\n", elem.first.c_str());
      |                 ^~~~~~~~
      |                 printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
pair<string,int> a[100];
int main(){
	int t=0,g;
	string f,b;
	while(cin>>a[t].first>>a[t].second)t++;
	sort(a,a+t);
	b=a[0].first
	cout<<b<<endl<<a[0].second;
	for(int i=1;i<t;i++){
		bool n=0;
		f=a[i].first,g=a[i].second;
		if(i)if(f==b)n=1;
		if(n)cout<<" "<<g;
		else cout<<endl<<f<<endl<<g;
		b=f;
	}
	cout<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected ';' before 'cout'
    9 |         b=a[0].first
      |                     ^
      |                     ;
   10 |         cout<<b<<endl<<a[0].second;
      |         ~~~~
Language: C++

#include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}

Compiler output:
a.cc:1:31: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}
      |                               ^~~~~~~~~
a.cc:1:10: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;pair<string,int> a[];int main(){int t=0,g,i;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);string f,b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}

Compiler output:
a.cc:2:38: error: array size missing in 'a'
    2 | using namespace std;pair<string,int> a[];int main(){int t=0,g,i;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);string f,b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}
      |                                      ^
Language: C++

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

using namespace std;

int main(int argc, char const *argv[]){
    vector<int> pages;
    map<string, vector<int> > books; 
    string name;
    int page;

    while (cin>>name>>page){
        auto it = books.find(name);
        if (it != books.end()){
            books[name].push_back(page);
        }
        else{
            vector<int> pages = {page};
            books.insert(make_pair(name, pages));
        }
    }

    for (auto& book : books){
        cout<<book.first<<endl;

        sort(book.second.begin(), book.second.end());

        for (const auto& page : book.second){
            cout<<page<<" ";
        }
        cout<<'\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |         sort(book.second.begin(), book.second.end());
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  map<string,vector<int> >A;
  string s;
  int n;
  while(cin>>s>>n){
    A[s].push_back(n);
  }
  map<string,vector<int> >::iterator t=A.begin();
  while(t!=A.end()){
    cout<<t->first<<endl;
    sort(t->second.begin(),t->second.end());
    for(int i=0;i<size-1i++){
      if(i)cout<<' '<<t->second[i];
      else cout<<t->second[i];
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   14 |     for(int i=0;i<size-1i++){
      |                        ~~^~
a.cc:14:28: error: expected ';' before ')' token
   14 |     for(int i=0;i<size-1i++){
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  map<string,vector<int> >A;
  string s;
  int n;
  while(cin>>s>>n){
    A[s].push_back(n);
  }
  map<string,vector<int> >::iterator t=A.begin();
  while(t!=A.end()){
    cout<<t->first<<endl;
    sort(t->second.begin(),t->second.end());
    for(int i=0;i<SIZE-1i++){
      if(i)cout<<' '<<t->second[i];
      else cout<<t->second[i];
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'SIZE' was not declared in this scope
   14 |     for(int i=0;i<SIZE-1i++){
      |                   ^~~~
a.cc:14:26: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   14 |     for(int i=0;i<SIZE-1i++){
      |                        ~~^~
a.cc:14:28: error: expected ';' before ')' token
   14 |     for(int i=0;i<SIZE-1i++){
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  map<string,vector<int> >A;
  string s;
  int n;
  while(cin>>s>>n){
    A[s].push_back(n);
  }
  map<string,vector<int> >::iterator t=A.begin();
  while(t!=A.end()){
    cout<<t->first<<endl;
    sort(t->second.begin(),t->second.end());
    for(int i=0;i<t->second.size()++){
      if(i)cout<<' '<<t->second[i];
      else cout<<t->second[i];
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: lvalue required as increment operand
   14 |     for(int i=0;i<t->second.size()++){
      |                   ~~~~~~~~~~~~~~^~
a.cc:14:37: error: expected ';' before ')' token
   14 |     for(int i=0;i<t->second.size()++){
      |                                     ^
      |                                     ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<pair<string,int>> str(100000);
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int count = 0;
    int c_n = 0;
    while (cin >> str[count].first) {
        cin >> str[count].second;
        count++;
    }
    sort(str.begin(), str.begin() + count);
    cout << str[0].first << endl;
    cout << str[0].second;
    for (int i = 1; i < count; i++) {
        if (str[i].first != str[i-1].first) {
            cout << endl << str[i].first << endl;
            cout << str[i].second;           
        } else {
            cout << " " << str[i].secosnd;
        }
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'secosnd'; did you mean 'second'?
   29 |             cout << " " << str[i].secosnd;
      |                                   ^~~~~~~
      |                                   second
Language: C++

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

int main(){
  map< string , vector<int> > mp;
  
  string str;
  int num;
  
  while( cin>>str>>num ){
    mp[ str ].push_back( num );
  }

  //for( pair<string,vector<int> > p : mp){ 
    string name=p.first;
    vector<int> v=p.second;
    sort(v.begin(),v.end());
    
    cout<<name<<endl;

    for(int i=0;i<(int)v.size();i++){
      if(i>0)cout<<' ';
      cout<<v[i];
    }
    cout<<endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'p' was not declared in this scope; did you mean 'mp'?
   18 |     string name=p.first;
      |                 ^
      |                 mp
a.cc: At global scope:
a.cc:31:3: error: expected unqualified-id before 'return'
   31 |   return 0;
      |   ^~~~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <set>
using namespace std;
class data{
public:
  string words;  
  int page;
  bool operator < (const data& s)const{
    if(words < s.words) return true;
    else if(words > s.words) return false;
    else{
      if(page < s.page) return true;
      else return false;
    }
  }
};
int main(){
  int i=0;
  data in[1000];
  while(1){
    in[i].words="";
    char c;
    if(scanf("%c", &c)==EOF) break;
    in[i].words+=c;
    for(int j=1;;j++){
      scanf("%c", &c);
      if(c==' ') break;
      in[i].words+=c;
    }
    cin >> in[i].page;
    getchar();
    i++;
  }
  
  sort(in,in+i);

  cout << in[0].words << endl << in[0].page;
  for(int j=1;j<i;j++){
    if(in[j-1].words != in[j].words){
      cout << endl;
      cout << in[j].words << endl << in[j].page;
    }
    else{
      cout << ' ' << in[j].page;
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: reference to 'data' is ambiguous
   21 |   data in[1000];
      |   ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:6:7: note:                 'class data'
    6 | class data{
      |       ^~~~
a.cc:23:5: error: 'in' was not declared in this scope; did you mean 'i'?
   23 |     in[i].words="";
      |     ^~
      |     i
a.cc:37:8: error: 'in' was not declared in this scope; did you mean 'i'?
   37 |   sort(in,in+i);
      |        ^~
      |        i
a.cc:37:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   37 |   sort(in,in+i);
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <string>
using namespace std;
class data{
public:
  string words;  
  int page;
  bool operator < (const data& s)const{
    if(words < s.words) return true;
    else if(words > s.words) return false;
    else{
      if(page < s.page) return true;
      else return false;
    }
  }
};
int main(){
  int i=0;
  data in[1000];
  while(1){
    in[i].words="";
    char c;
    if(scanf("%c", &c)==EOF) break;
    in[i].words+=c;
    for(int j=1;;j++){
      scanf("%c", &c);
      if(c==' ') break;
      in[i].words+=c;
    }
    cin >> in[i].page;
    getchar();
    i++;
  }
  
  sort(in,in+i);

  cout << in[0].words << endl << in[0].page;
  for(int j=1;j<i;j++){
    if(in[j-1].words != in[j].words){
      cout << endl;
      cout << in[j].words << endl << in[j].page;
    }
    else{
      cout << ' ' << in[j].page;
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: reference to 'data' is ambiguous
   19 |   data in[1000];
      |   ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:7: note:                 'class data'
    4 | class data{
      |       ^~~~
a.cc:21:5: error: 'in' was not declared in this scope; did you mean 'i'?
   21 |     in[i].words="";
      |     ^~
      |     i
a.cc:35:8: error: 'in' was not declared in this scope; did you mean 'i'?
   35 |   sort(in,in+i);
      |        ^~
      |        i
a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |   sort(in,in+i);
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <string>
using namespace std;
class data{
public:
  string words;  
  int page;
  bool operator < (const data&s)const{
    if(words < s.words) return true;
    else if(words > s.words) return false;
    else{
      if(page < s.page) return true;
      else return false;
    }
  }
};
int main(){
  int i=0;
  data in[1000];
  while(1){
    in[i].words="";
    char c;
    if(scanf("%c", &c)==EOF) break;
    in[i].words+=c;
    for(int j=1;;j++){
      scanf("%c", &c);
      if(c==' ') break;
      in[i].words+=c;
    }
    cin >> in[i].page;
    getchar();
    i++;
  }
  
  sort(in,in+i);

  cout << in[0].words << endl << in[0].page;
  for(int j=1;j<i;j++){
    if(in[j-1].words != in[j].words){
      cout << endl;
      cout << in[j].words << endl << in[j].page;
    }
    else{
      cout << ' ' << in[j].page;
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: reference to 'data' is ambiguous
   19 |   data in[1000];
      |   ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:7: note:                 'class data'
    4 | class data{
      |       ^~~~
a.cc:21:5: error: 'in' was not declared in this scope; did you mean 'i'?
   21 |     in[i].words="";
      |     ^~
      |     i
a.cc:35:8: error: 'in' was not declared in this scope; did you mean 'i'?
   35 |   sort(in,in+i);
      |        ^~
      |        i
a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |   sort(in,in+i);
      |   ^~~~
      |   short